diff options
Diffstat (limited to 'tests/topotests/zebra_multiple_connected/test_zebra_multiple_connected.py')
| -rw-r--r-- | tests/topotests/zebra_multiple_connected/test_zebra_multiple_connected.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/topotests/zebra_multiple_connected/test_zebra_multiple_connected.py b/tests/topotests/zebra_multiple_connected/test_zebra_multiple_connected.py index dc47527c74..7dbeb6f1cc 100644 --- a/tests/topotests/zebra_multiple_connected/test_zebra_multiple_connected.py +++ b/tests/topotests/zebra_multiple_connected/test_zebra_multiple_connected.py @@ -19,6 +19,9 @@ import sys import pytest import json from functools import partial +from lib.topolog import logger + +pytestmark = pytest.mark.random_order(disabled=True) # Save the Current Working Directory to find configuration files. CWD = os.path.dirname(os.path.realpath(__file__)) @@ -159,6 +162,46 @@ def test_zebra_noprefix_connected(): assert result, "Connected Route should not have been added" +def test_zebra_noprefix_connected_add(): + "Test that a noprefixroute created with a manual route works as expected, this is for NetworkManager" + + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router = tgen.gears["r1"] + router.run("ip route add 192.168.44.0/24 dev r1-eth1") + + connected = "{}/{}/ip_route_connected.json".format(CWD, router.name) + expected = json.loads(open(connected).read()) + + test_func = partial( + topotest.router_json_cmp, router, "show ip route 192.168.44.0/24 json", expected + ) + result, _ = topotest.run_and_expect(test_func, None, count=20, wait=1) + assert result, "Connected Route should have been added\n{}".format(_) + + +def test_zebra_kernel_route_add(): + "Test that a random kernel route is properly handled as expected" + + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router = tgen.gears["r1"] + router.run("ip route add 4.5.6.7/32 dev r1-eth1") + + kernel = "{}/{}/ip_route_kernel.json".format(CWD, router.name) + expected = json.loads(open(kernel).read()) + + test_func = partial( + topotest.router_json_cmp, router, "show ip route 4.5.6.7/32 json", expected + ) + result, _ = topotest.run_and_expect(test_func, None, count=20, wait=1) + assert result, "Connected Route should have been added\n{}".format(_) + + if __name__ == "__main__": args = ["-s"] + sys.argv[1:] sys.exit(pytest.main(args)) |
