Skip to content

Conversation

sansalun
Copy link
Contributor

Description
This pull request introduces - Add the option for configuring a multihop BFD multihop profile under a BGP node profile.

ACI Object
bfdMhNodeP is a child of the L3out node profile and bfdRsMhNodePol is a child of the bfdMhNodeP.
For example:
uni/tn-mytenant/out-myl3out/lnodep-mynodeprofile/bfdMhNodeP is of class bfdMhNodeP
uni/tn-mytenant/out-myl3out/lnodep-mynodeprofile/bfdMhNodeP/bfdRsMhNodePol is of class bfdRsMhNodePol

The bfdMhNodePol contains a tnBfdMhNodePolName field that must point to the existing BFD multihop policy name.
BFD multihop policies were already implemented in AAC for a different use case, so are not required for this enhancement.

Motivation
The additional option to configure BFD multihop under a BGP node profile.

Related Issues
https://wwwin-github.cisco.com/netascode/nac-aci/issues/533

Proposed Syntax
l3outs:
- name:
node_profiles:
- name:
nodes:
- node_id:
bfd_multihop:
auth_type:
auth_key_id:
auth_key:
bfd_multihop_node_policy:

Copy link
Contributor

@ogorczow ogorczow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the comments

validation {
condition = (
var.bfd_multihop.auth_key == null ||
can(regex("^[a-zA-Z0-9_.:-]{0,64}$", var.bfd_multihop.auth_key))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verify length of variable. Seems to be wrong

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been corrected. The variable length is 1 to 20. Updated this.

}
}

resource "aci_rest_managed" "bfd_multihop" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep resource name as class_name if possible

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. If object already exists, try to add some name after dash like eg. bfdMhNodeP-tenant.
  2. cannot we reuse existing resource bfdMhNodeP with condition var.tenant != "infra"?
    sr-mpls node-profile supports same values like keyId, type, key.
    @juchowan , what do you think? does it make sense to enable 2 ways of configuring bfd for infra sr-mpls and remove one of it in future via breaking change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I renamed the resources with _ The resource name is now as below
bfdMhNodeP_
bfdRsMhNodePol_

}
}

resource "aci_rest_managed" "bfd_multihop_node_policy" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

}
}

variable "bfd_multihop" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have following config:

apic:
  tenants:
    - name: sansalun
      l3outs:
        - name: L3OUT1
          vrf: VRF1
          domain: ROUTED1
          node_profiles:
            - name: NP_103
              nodes:
              - node_id: 103
                router_id: 5.5.5.7

and it creates me bfd_multihop policy even if i don't define it. Something is wrong

aci_tenants.tf Outdated
bgp_protocol_profile_name = try(np.bgp.name, "")
bgp_timer_policy = try("${np.bgp.timer_policy}${local.defaults.apic.tenants.policies.bgp_timer_policies.name_suffix}", "")
bgp_as_path_policy = try("${np.bgp.as_path_policy}${local.defaults.apic.tenants.policies.bgp_best_path_policies.name_suffix}", "")
bfd_multihop = try("${np.bfd_multihop}${local.defaults.apic.tenants.policies.bfd_multihop_node_policies.name_suffix}", "")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add also for node_profiles_auto

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also I do not understand why we try to apply "string" + "name_suffix" value into "object".
For some reason this code works, however I have no idea how. I don't know what variables do we read in bfd_multihop from yaml code.
Doesn't it make sense to make it bfd_multihop = { all attributes/variables here? }

class_name = "bfdMhNodeP"
content = {
keyId = var.bfd_multihop.auth_key_id
key = var.bfd_multihop.auth_key
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requires
lifecycle { ignore_changes = [content["key"]}
see ldap module example

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been added

class_name = "bfdMhNodeP"
}

resource "aci_rest_managed" "bfdRsMhNodePol" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't work for following code, why?

apic:
  tenants:
    - name: sansalun
      l3outs:
        - name: L3OUT1
          vrf: VRF1
          domain: ROUTED1
          node_profiles:
            - name: NP_101
              nodes:
              - node_id: 101
                router_id: 5.5.5.5
              bfd_multihop:
                auth_type: sha1
                auth_key_id: 1
                auth_key: C1sco123
                bfd_multihop_node_policy: BFD_MHOP_POL

@ogorczow
Copy link
Contributor

ogorczow commented Sep 22, 2025

Please folow up this yaml structure:

apic:
  tenants:
    - name: sansalun
      l3outs:
        - name: L3OUT1
          vrf: VRF1
          domain: ROUTED1
          node_profiles:
            - name: NP_103
              nodes:
              - node_id: 103
                router_id: 5.5.5.7
            - name: NP_102
              nodes:
              - node_id: 102
                router_id: 5.5.5.6
                bfd_multihop_node_policy: BFD_MHOP_POL
                bfd_multihop_auth:
                  type: sha1
                  key_id: 1
                  key: C1sco123
            - name: NP_101
              nodes:
              - node_id: 101
                router_id: 5.5.5.5
              bfd_multihop_node_policy: BFD_MHOP_POL
              bfd_multihop_auth:
                type: sha1
                key_id: 1
                key: C1sco123
              interface_profiles:
              - name: IPF101
                interfaces:
                  - node_id: 101
                    port: 5
                    ip: 10.15.1.2/28
                    bgp_peers:
                    - ip: 10.15.1.1
                      remote_as: 65010
      policies:
        bfd_multihop_node_policies:
          - name: BFD_MHOP_POL
            description: My BFD Node Policy
            detection_multiplier: 5
            min_rx_interval: 300
            min_tx_interval: 300
          - name: BFD-NODE2_POLICY

@sansalun sansalun marked this pull request as draft September 22, 2025 10:35
@juchowan juchowan marked this pull request as ready for review October 8, 2025 12:32
@juchowan juchowan merged commit 24ab81e into netascode:main Oct 8, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants