Skip to content

Commit

Permalink
topotests: bgp_vpnv4_noretain, check presence of locpref in adj-rib-out
Browse files Browse the repository at this point in the history
Add a test that check that the detailed command of show bgp advertised
neighbors 10.125.0.2 displays the locpref value.

Signed-off-by: Philippe Guibert <[email protected]>
  • Loading branch information
pguibert6WIND committed Jan 6, 2025
1 parent c620272 commit 572bb5f
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions tests/topotests/bgp_vpnv4_noretain/test_bgp_vpnv4_noretain.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,29 @@ def check_show_bgp_ipv4_vpn(rname, json_file):
assert result is None, assertmsg


def check_show_bgp_ipv4_vpn_peer_advertised_routes(rname, peer, json_file):
tgen = get_topogen()
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
router = tgen.gears[rname]

logger.info(
"Checking VPNv4 advertised routes for on {} for peer {}".format(rname, peer)
)

json_file = "{}/{}/{}".format(CWD, router.name, json_file)
expected = json.loads(open(json_file).read())
test_func = partial(
topotest.router_json_cmp,
router,
"show bgp ipv4 vpn neighbors {} advertised-routes detail json".format(peer),
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 check_show_bgp_vrf_ipv4(rname, json_file):
tgen = get_topogen()
if tgen.routers_have_failure():
Expand Down Expand Up @@ -563,6 +586,21 @@ def test_bgp_retain_step12():
check_show_bgp_vrf_ipv4(rname, "ipv4_vrf_all_routes_init.json")


def test_bgp_advertised_routes_step13():
"""
Dump advertised routes from r1 to r2
Check that the localpref attribute is set on the show command
"""

tgen = get_topogen()
if tgen.routers_have_failure():
pytest.skip(tgen.errors)

check_show_bgp_ipv4_vpn_peer_advertised_routes(
"r1", "10.125.0.2", "ipv4_vpn_routes_advertised_10_125_0_2.json"
)


def test_memory_leak():
"Run the memory leak test and report results."
tgen = get_topogen()
Expand Down

0 comments on commit 572bb5f

Please sign in to comment.