Skip to content

Commit 4ad0909

Browse files
committed
[yang] BGP support autort in address family (PR sonic-net#21575)
`autort` is a supported option in the frr-mgmt-framework as can be seen in https://github.com/sonic-net/sonic-buildimage/blob/3d8c940997c3855b650fc0eea7f9db46546b17ac/src/sonic-frr-mgmt-framework/frrcfgd/frrcfgd.py#L1830 and https://github.com/sonic-net/sonic-buildimage/blob/3d8c940997c3855b650fc0eea7f9db46546b17ac/src/sonic-frr-mgmt-framework/templates/bgpd/bgpd.conf.db.addr_family.evpn.j2#L4-L5 However, the yang models do not allow this so when adding this value to `config_db.json` then running `config replace` a validation issue is encountered. This adds yang support and validates the only known valid value of `rfc8365-compatible` is set. Test cases have been updated to validate the behavior. Signed-off-by: Brad House (@bradh352)
1 parent 9848f59 commit 4ad0909

File tree

5 files changed

+59
-0
lines changed

5 files changed

+59
-0
lines changed

src/sonic-frr-mgmt-framework/tests/test_config.py

+2
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ def hdl_confed_peers_cmd(is_del, cmd_list, chk_data):
129129
'ibgp_route_distance': '115',
130130
'local_route_distance': '238'},
131131
conf_bgp_af_cmd('default', 100, 'ipv4') + ['{}distance bgp 100 115 238']),
132+
CmdMapTestInfo('BGP_GLOBALS_AF', 'default|ipv6_unicast', {'autort': 'rfc8365-compatible'},
133+
conf_bgp_af_cmd('default', 100, 'ipv6') + ['{}autort rfc8365-compatible']),
132134
CmdMapTestInfo('BGP_GLOBALS_AF', 'default|ipv6_unicast', {'advertise-all-vni': 'true'},
133135
conf_bgp_af_cmd('default', 100, 'ipv6') + ['{}advertise-all-vni']),
134136
CmdMapTestInfo('BGP_GLOBALS_AF', 'default|ipv6_unicast', {'advertise-svi-ip': 'true'},

src/sonic-yang-models/tests/files/sample_config_db.json

+1
Original file line numberDiff line numberDiff line change
@@ -1783,6 +1783,7 @@
17831783
"max_ibgp_paths": "2"
17841784
},
17851785
"default|l2vpn_evpn": {
1786+
"autort": "rfc8365-compatible",
17861787
"advertise-all-vni": "true",
17871788
"advertise-svi-ip": "true"
17881789
}

src/sonic-yang-models/tests/yang_model_tests/tests/bgp.json

+7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
"BGP_GLOBAL_VALID": {
33
"desc": "Configure BGP global table."
44
},
5+
"BGP_GLOBALS_AF_AUTORT_VALID": {
6+
"desc": "BGP Address Family l2vpn_evpn with autort set to rfc8365-compatible"
7+
},
8+
"BGP_GLOBALS_AF_AUTORT_INVALID": {
9+
"desc": "BGP Address Family l2vpn_evpn with autort set to an invalid value",
10+
"eStr": "Invalid value \"invalid\" in \"autort\" element."
11+
},
512
"BGP_GLOBALS_AF_ADVERTISE_ALL_VNI_TRUE": {
613
"desc": "BGP Address Family l2vpn_evpn with advertise-all-vni set to true"
714
},

src/sonic-yang-models/tests/yang_model_tests/tests_config/bgp.json

+42
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,48 @@
8181
}
8282
}
8383
},
84+
"BGP_GLOBALS_AF_AUTORT_VALID": {
85+
"sonic-bgp-global:sonic-bgp-global": {
86+
"sonic-bgp-global:BGP_GLOBALS": {
87+
"BGP_GLOBALS_LIST": [
88+
{
89+
"vrf_name":"default",
90+
"local_asn": 65001
91+
}
92+
]
93+
},
94+
"sonic-bgp-global:BGP_GLOBALS_AF": {
95+
"BGP_GLOBALS_AF_LIST": [
96+
{
97+
"vrf_name": "default",
98+
"afi_safi": "l2vpn_evpn",
99+
"autort": "rfc8365-compatible"
100+
}
101+
]
102+
}
103+
}
104+
},
105+
"BGP_GLOBALS_AF_AUTORT_INVALID": {
106+
"sonic-bgp-global:sonic-bgp-global": {
107+
"sonic-bgp-global:BGP_GLOBALS": {
108+
"BGP_GLOBALS_LIST": [
109+
{
110+
"vrf_name":"default",
111+
"local_asn": 65001
112+
}
113+
]
114+
},
115+
"sonic-bgp-global:BGP_GLOBALS_AF": {
116+
"BGP_GLOBALS_AF_LIST": [
117+
{
118+
"vrf_name": "default",
119+
"afi_safi": "l2vpn_evpn",
120+
"autort": "invalid"
121+
}
122+
]
123+
}
124+
}
125+
},
84126
"BGP_GLOBALS_AF_ADVERTISE_ALL_VNI_TRUE": {
85127
"sonic-bgp-global:sonic-bgp-global": {
86128
"sonic-bgp-global:BGP_GLOBALS": {

src/sonic-yang-models/yang-models/sonic-bgp-global.yang

+7
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,13 @@ module sonic-bgp-global {
446446
description "Maximum duration to suppress a stable route";
447447
}
448448

449+
leaf autort {
450+
type enumeration {
451+
enum rfc8365-compatible;
452+
}
453+
description "L2VPN derive route targets as per rfc8365 for interoperability with other implementations.";
454+
}
455+
449456
leaf advertise-all-vni {
450457
type boolean;
451458
description "L2VPN advertise all VNIs";

0 commit comments

Comments
 (0)