topotests: add bgp test to check the ADJ-RIB-OUT label value

This test ensures that when r1 changes the label value, then
the new value is automatically propagated to remote peer.
This demonstrates that the ADJ-RIB-OUT to r2 has been correctly
updated.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
This commit is contained in:
Philippe Guibert 2023-02-24 11:22:14 +01:00 committed by Louis Scalbert
parent 191675451e
commit 415befc30a
2 changed files with 84 additions and 0 deletions

View File

@ -0,0 +1,50 @@
{
"444:1":{
"prefix":"172.31.0.1/32",
"advertisedTo":{
"192.168.0.1":{
}
},
"paths":[
{
"aspath":{
"string":"65500",
"segments":[
{
"type":"as-sequence",
"list":[
65500
]
}
],
"length":1
},
"origin":"incomplete",
"metric":0,
"valid":true,
"bestpath":{
"overall":true,
"selectionReason":"First path received"
},
"extendedCommunity":{
"string":"RT:52:101"
},
"remoteLabel":102,
"nexthops":[
{
"ip":"192.168.0.1",
"afi":"ipv4",
"metric":0,
"accessible":true,
"used":true
}
],
"peer":{
"peerId":"192.168.0.1",
"routerId":"192.0.2.1",
"type":"external"
}
}
]
}
}

View File

@ -404,6 +404,40 @@ route-map RMAP permit 1
assert success, "{}, vpnv4 update {} still not present".format(router.name, prefix)
def test_adj_rib_out_label_change():
"""
Check that changing the VPN label on r1
is propagated on r2
"""
tgen = get_topogen()
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
logger.info("Changing VPN label value to export")
dump = tgen.gears["r1"].vtysh_cmd(
"""
configure terminal
router bgp 65500 vrf vrf1
address-family ipv4 unicast
label vpn export 102
"""
)
# Check BGP IPv4 route entry for 172.31.0.1 on r1
logger.info("Checking BGP IPv4 routes for convergence on r1")
router = tgen.gears["r2"]
json_file = "{}/{}/bgp_ipv4_vpn_route_1723101.json".format(CWD, router.name)
expected = json.loads(open(json_file).read())
test_func = partial(
topotest.router_json_cmp,
router,
"show bgp ipv4 vpn 172.31.0.1/32 json",
expected,
)
_, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assertmsg = '"{}" JSON output mismatches'.format(router.name)
assert result is None, assertmsg
def test_memory_leak():
"Run the memory leak test and report results."
tgen = get_topogen()