tests: Check if VRF instance has a different ASN than a default VRF

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit c6c0403c61)
This commit is contained in:
Donatas Abraitis 2024-07-13 13:14:33 +03:00 committed by Mergify
parent b5db1e7352
commit 19a0e3d544

View File

@ -58,6 +58,24 @@ def test_bgp_vrf_different_asn():
if tgen.routers_have_failure(): if tgen.routers_have_failure():
pytest.skip(tgen.errors) pytest.skip(tgen.errors)
def _bgp_check_instances():
output = json.loads(tgen.gears["r1"].vtysh_cmd("show bgp vrf all json"))
expected = {
"default": {
"vrfName": "default",
"localAS": 65000,
},
"vrf100": {
"vrfName": "vrf100",
"localAS": 65100,
},
}
return topotest.json_cmp(output, expected)
test_func = functools.partial(_bgp_check_instances)
_, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
assert result is None, "Can't see vrf100 to be under 65100 ASN"
def _bgp_check_imported_route(): def _bgp_check_imported_route():
output = json.loads( output = json.loads(
tgen.gears["r1"].vtysh_cmd("show ip route 192.168.1.0/24 json") tgen.gears["r1"].vtysh_cmd("show ip route 192.168.1.0/24 json")