Skip to content

Commit

Permalink
topotests: add bgp test to check the ADJ-RIB-OUT label value
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
pguibert6WIND authored and louis-6wind committed Feb 23, 2024
1 parent 33d2e18 commit 6f1e250
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 0 deletions.
50 changes: 50 additions & 0 deletions tests/topotests/bgp_vpnv4_ebgp/r2/bgp_ipv4_vpn_route_1723101.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
]
}
}
34 changes: 34 additions & 0 deletions tests/topotests/bgp_vpnv4_ebgp/test_bgp_vpnv4_ebgp.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,40 @@ def test_export_add_route_target_to_route_map_command():
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()
Expand Down

0 comments on commit 6f1e250

Please sign in to comment.