sonic-net / sonic-buildimage

Scripts which perform an installable binary image build for SONiC
Other
735 stars 1.42k forks source link

FRR Management Framework: Cannot activate BGP neighbor for address-families #20663

Open alexanderheckel opened 1 day ago

alexanderheckel commented 1 day ago

Hello,

in our PoC-Lab, we were not able to active BGP neighbors for any address-family using the management framework.

The value for admin-status, which indicates the address family active/inactive status according to the documentation, can be either up or down, while the management framework script seems to evaluate true or false.

https://github.com/sonic-net/sonic-buildimage/blob/8a9ff73c9339cabc9413b796157afae563df114f/src/sonic-yang-models/yang-models/sonic-bgp-common.yang#L345

However, after replacing type stypes:admin_status; with type boolean; and rebuilding the CLI extension the expected statement neighbor Ethernet0 activate will be generated.

Before the manipulation of the YANG file

/usr/local/yang-models/sonic-bgp-common.yang

...
grouping sonic-bgp-cmn-af {
...
        leaf admin_status {
            type stypes:admin_status;
            description "Indicates address family active/inactive status";
        }
...
}
...

Command

sudo config bgp-neighbor-af add default Ethernet0 ipv4_unicast --admin-status up (...)

/etc/sonic/config_db.json

    "BGP_NEIGHBOR_AF": {
        "default|Ethernet0|ipv4_unicast": {
            "admin_status": "up",
            "nhself": "true",
            "rrclient": "true"
        }
    }

vtysh | show run

 address-family ipv4 unicast
  neighbor Ethernet0 route-reflector-client
  neighbor Ethernet0 next-hop-self
 exit-address-family

After the manipulation of the YANG file

/usr/local/yang-models/sonic-bgp-common.yang

...
grouping sonic-bgp-cmn-af {
...
        leaf admin_status {
            type boolean;
            description "Indicates address family active/inactive status";
        }
...
}
...

Command

sudo config bgp-neighbor-af add default Ethernet0 ipv4_unicast --admin-status true (...)

etc/sonic/config_db.json

    "BGP_NEIGHBOR_AF": {
        "default|Ethernet0|ipv4_unicast": {
            "admin_status": "true",
            "nhself": "true",
            "rrclient": "true"
        }
    }

vtysh | show run

 address-family ipv4 unicast
  neighbor Ethernet0 activate
  neighbor Ethernet0 route-reflector-client
  neighbor Ethernet0 next-hop-self
 exit-address-family
alexanderheckel commented 1 day ago

One could also consider to replace admin_status with active or activate for BGP neighbor address familiy settings.

https://github.com/sonic-net/sonic-buildimage/blob/8a9ff73c9339cabc9413b796157afae563df114f/src/sonic-frr-mgmt-framework/frrcfgd/frrcfgd.py#L1831-L1833