expected = {
"192.168.255.1": {
"bgpState": "Established",
- "addressFamilyInfo": {"ipv4Unicast": {"acceptedPrefixCounter": 1}},
+ "addressFamilyInfo": {"ipv4Unicast": {"acceptedPrefixCounter": 2}},
}
}
return topotest.json_cmp(output, expected)
def _bgp_check_if_originated():
output = json.loads(tgen.gears["r1"].vtysh_cmd("show ip bgp summary json"))
- expected = {"ipv4Unicast": {"peers": {"192.168.255.2": {"pfxSnt": 1}}}}
+ expected = {"ipv4Unicast": {"peers": {"192.168.255.2": {"pfxSnt": 2}}}}
return topotest.json_cmp(output, expected)
- def _bgp_default_route_is_valid(router):
- output = json.loads(router.vtysh_cmd("show ip bgp 0.0.0.0/0 json"))
+ def _bgp_route_is_valid(router, prefix):
+ output = json.loads(router.vtysh_cmd("show ip bgp {} json".format(prefix)))
expected = {"paths": [{"valid": True}]}
return topotest.json_cmp(output, expected)
success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
assert result is None, "No 0.0.0.0/0 from r1 to r2"
- test_func = functools.partial(_bgp_default_route_is_valid, tgen.gears["r2"])
+ test_func = functools.partial(_bgp_route_is_valid, tgen.gears["r2"], "0.0.0.0/0")
success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
assert result is None, "Failed to see 0.0.0.0/0 in r2"
+ test_func = functools.partial(_bgp_route_is_valid, tgen.gears["r2"], "0.0.0.0/1")
+ success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
+ assert result is None, "Failed to see 0.0.0.0/1 in r2"
+
if __name__ == "__main__":
args = ["-s"] + sys.argv[1:]