Skip to content

Commit d74df1e

Browse files
authored
Update bgp suppress fib script for vrf case (sonic-net#17051)
* Update bgp suppress fib script for vrf case 1.Add 'BGP_GLOBALS' into config db 2.Remove 'nhopself' and 'rrclient' from 'BGP_NEIGHBOR' Change-Id: Ia1685053969117f2e46f19b2f09def19094c410a * Update test_bgp_suppress_fib.py
1 parent 2e05707 commit d74df1e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/bgp/test_bgp_suppress_fib.py

+16
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,22 @@ def setup_vrf_cfg(duthost, cfg_facts, nbrhosts, tbinfo):
304304
"""
305305
cfg_t1 = deepcopy(cfg_facts)
306306
cfg_t1.pop('config_port_indices', None)
307+
for loopback in cfg_t1['LOOPBACK_INTERFACE']:
308+
loopback_items = loopback.split('|')
309+
if len(loopback_items) == 2 and loopback_items[0] == 'Loopback0':
310+
ipaddr = ipaddress.ip_address(loopback_items[1].split('/')[0])
311+
if isinstance(ipaddr, ipaddress.IPv4Address):
312+
router_id = str(ipaddr)
313+
break
314+
dut_asn = tbinfo['topo']['properties']['configuration_properties']['common']['dut_asn']
315+
if 'BGP_GLOBALS' not in cfg_t1:
316+
cfg_t1['BGP_GLOBALS'] = {}
317+
cfg_t1['BGP_GLOBALS'][USER_DEFINED_VRF] = {}
318+
cfg_t1['BGP_GLOBALS'][USER_DEFINED_VRF]['router_id'] = router_id
319+
cfg_t1['BGP_GLOBALS'][USER_DEFINED_VRF]['local_asn'] = dut_asn
320+
for bgp_neighbor in cfg_t1['BGP_NEIGHBOR']:
321+
cfg_t1['BGP_NEIGHBOR'][bgp_neighbor].pop('nhopself', None)
322+
cfg_t1['BGP_NEIGHBOR'][bgp_neighbor].pop('rrclient', None)
307323
port_list = get_port_connected_with_vm(duthost, nbrhosts)
308324
vm_list = nbrhosts.keys()
309325
mg_facts = duthost.get_extended_minigraph_facts(tbinfo)

0 commit comments

Comments
 (0)