diff --git a/test/case/ietf_routing/static_routing.py b/test/case/ietf_routing/static_routing.py index 64a23910..8379b9e0 100755 --- a/test/case/ietf_routing/static_routing.py +++ b/test/case/ietf_routing/static_routing.py @@ -19,6 +19,9 @@ import copy import infamy import time +import infamy.iface as iface +import infamy.route as route +from infamy.util import until def config_target1(target, data, link): target.put_config_dict("ietf-interfaces", { @@ -139,8 +142,7 @@ def config_remove_routes(target): new = copy.deepcopy(running) new["routing"]["control-plane-protocols"].clear() target.put_diff_dicts("ietf-routing",running,new) - time.sleep(2) # Replace with operatinal check when available - + with infamy.Test() as test: with test.step("Initialize"): env = infamy.Env(infamy.std_topology("2x2")) @@ -154,7 +156,15 @@ with infamy.Test() as test: config_target1(target1, target1data, target1_to_target2) config_target2(target2, target2_to_target1) - time.sleep(2) # Replace with operatinal check when available + until(lambda: route.ipv4_route_exist(target1, "192.168.200.1/32")) + until(lambda: route.ipv4_route_exist(target2, "0.0.0.0/0")) + + with test.step("Wait for links"): + until(lambda: iface.get_oper_up(target1, target1data)) + until(lambda: iface.get_oper_up(target1, target1data)) + until(lambda: iface.get_oper_up(target1, target1_to_target2)) + until(lambda: iface.get_oper_up(target2, target2_to_target1)) + with test.step("Ping from host to 192.168.200.1(dut2) through dut1"): _, hport0 = env.ltop.xlate("host", "data1") with infamy.IsolatedMacVlan(hport0) as ns0: @@ -163,6 +173,8 @@ with infamy.Test() as test: ns0.must_reach("192.168.200.1") with test.step("Remove static routes on dut1"): config_remove_routes(target1); + until(lambda: route.ipv4_route_exist(target1, "192.168.200.1/32") == False) + with test.step("Ping from host to 192.168.200.1(dut2) through dut1 (should not be possible)"): _, hport0 = env.ltop.xlate("host", "data1") with infamy.IsolatedMacVlan(hport0) as ns0: