diff --git a/test/case/ietf_routing/ospf_basic/test.py b/test/case/ietf_routing/ospf_basic/test.py index a409e6ea..3aded3d9 100755 --- a/test/case/ietf_routing/ospf_basic/test.py +++ b/test/case/ietf_routing/ospf_basic/test.py @@ -160,23 +160,23 @@ def config_target2(target, link): with infamy.Test() as test: with test.step("Initialize"): env = infamy.Env() - target1 = env.attach("target1", "mgmt") - target2 = env.attach("target2", "mgmt") + R1 = env.attach("R1", "mgmt") + R2 = env.attach("R2", "mgmt") with test.step("Configure targets"): - _, target1data = env.ltop.xlate("target1", "data") - _, target2_to_target1 = env.ltop.xlate("target2", "target1") - _, target1_to_target2 = env.ltop.xlate("target1", "target2") + _, R1data = env.ltop.xlate("R1", "data") + _, R2_to_R1 = env.ltop.xlate("R2", "R1") + _, R1_to_R2 = env.ltop.xlate("R1", "R2") - parallel(config_target1(target1, target1data, target1_to_target2), - config_target2(target2, target2_to_target1)) + parallel(config_target1(R1, R1data, R1_to_R2), + config_target2(R2, R2_to_R1)) with test.step("Wait for OSPF routes"): print("Waiting for OSPF routes..") - until(lambda: route.ipv4_route_exist(target1, "192.168.200.1/32", source_protocol = "infix-routing:ospf"), attempts=200) - until(lambda: route.ipv4_route_exist(target2, "192.168.100.1/32", source_protocol = "infix-routing:ospf"), attempts=200) + until(lambda: route.ipv4_route_exist(R1, "192.168.200.1/32", source_protocol = "infix-routing:ospf"), attempts=200) + until(lambda: route.ipv4_route_exist(R2, "192.168.100.1/32", source_protocol = "infix-routing:ospf"), attempts=200) with test.step("Test connectivity"): - _, hport0 = env.ltop.xlate("host", "data1") + _, hport0 = env.ltop.xlate("PC", "data1") with infamy.IsolatedMacVlan(hport0) as ns0: ns0.addip("192.168.10.2") ns0.addroute("192.168.200.1/32", "192.168.10.1") diff --git a/test/case/ietf_routing/ospf_basic/topology.dot b/test/case/ietf_routing/ospf_basic/topology.dot index c3b6af0b..749654e0 100644 --- a/test/case/ietf_routing/ospf_basic/topology.dot +++ b/test/case/ietf_routing/ospf_basic/topology.dot @@ -2,31 +2,31 @@ graph "2x2" { layout="neato"; overlap="false"; esep="+20"; + size=10 node [shape=record, fontname="monospace"]; edge [color="cornflowerblue", penwidth="2"]; - host [ - label="host | { mgmt1 | data1 | mgmt2 | data2 }", - pos="0,12!", + PC [ + label="PC | { mgmt1 | data1 | mgmt2 | data2 }", + pos="20,80!", kind="controller", ]; - target1 [ - label="{ mgmt | data | target2} | target1", - pos="10,18!", + R1 [ + label="{ mgmt | data | R2} | R1 \n 192.168.100.1/32 \n(lo)", + pos="250,80!", kind="infix", ]; - target2 [ - label="{ target1 | mgmt | data } | target2", - pos="10,6!", + R2 [ + label="{ R1 | mgmt | data } | R2 \n 192.168.200.1/32 \n(lo)", + pos="250,30!", kind="infix", ]; - host:mgmt1 -- target1:mgmt [kind=mgmt] - host:mgmt2 -- target2:mgmt [kind=mgmt] - host:data1 -- target1:data - host:data2 -- target2:data - target1:target2 -- target2:target1 + PC:mgmt1 -- R1:mgmt [kind=mgmt] + PC:mgmt2 -- R2:mgmt [kind=mgmt] + PC:data1 -- R1:data [color="black", headlabel="192.168.10.1/24", taillabel="192.168.10.2/24", fontcolor="black"] + R1:R2 -- R2:R1 [headlabel="192.168.50.2/24", taillabel="192.168.50.1/24", labeldistance=1, fontcolor="blue"] } diff --git a/test/case/ietf_routing/ospf_basic/topology.png b/test/case/ietf_routing/ospf_basic/topology.png index 483114ef..cdf4e35b 100644 Binary files a/test/case/ietf_routing/ospf_basic/topology.png and b/test/case/ietf_routing/ospf_basic/topology.png differ diff --git a/test/case/ietf_routing/ospf_multiarea/test.py b/test/case/ietf_routing/ospf_multiarea/test.py index a5bb41c8..e24ce597 100755 --- a/test/case/ietf_routing/ospf_multiarea/test.py +++ b/test/case/ietf_routing/ospf_multiarea/test.py @@ -3,7 +3,7 @@ # # 10.0.0.1/32 (lo) # | -# +------+---------+ .1 10.0.12.1/30 .2+--------------------+ +# +------+---------+ .1 10.0.12.0/30 .2+--------------------+ # | R1 +-----------------------------+ R2 | # | | AREA0 | +-10.0.0.2/32 (lo) # +-------+--------+--.1 .1 -+--------+-----------+ @@ -329,7 +329,7 @@ def config_target2(target, ring1, ring2, cross, link): } }) -def config_target3(target, ring1, ring2, cross, link): +def config_target3(target, ring2, cross, link): target.put_config_dict("ietf-interfaces", { "interfaces": { "interface": [ @@ -431,7 +431,7 @@ def config_target3(target, ring1, ring2, cross, link): } }) -def config_target4(target, ring1, ring2, cross, link): +def config_target4(target, ring1, cross, link): target.put_config_dict("ietf-interfaces", { "interfaces": { "interface": [ @@ -547,81 +547,79 @@ def disable_link(target, link): with infamy.Test() as test: with test.step("Initialize"): env = infamy.Env() - dut1 = env.attach("dut1", "mgmt") - dut2 = env.attach("dut2", "mgmt") - dut3 = env.attach("dut3", "mgmt") - dut4 = env.attach("dut4", "mgmt") + R1 = env.attach("R1", "mgmt") + R2 = env.attach("R2", "mgmt") + R3 = env.attach("R3", "mgmt") + R4 = env.attach("R4", "mgmt") with test.step("Configure targets"): - _, dut1ring1 = env.ltop.xlate("dut1", "ring1") - _, dut1ring2 = env.ltop.xlate("dut1", "ring2") - _, dut2ring1 = env.ltop.xlate("dut2", "ring1") - _, dut2ring2 = env.ltop.xlate("dut2", "ring2") - _, dut3ring1 = env.ltop.xlate("dut3", "ring1") - _, dut3ring2 = env.ltop.xlate("dut3", "ring2") - _, dut4ring1 = env.ltop.xlate("dut4", "ring1") - _, dut4ring2 = env.ltop.xlate("dut4", "ring2") - _, dut1data = env.ltop.xlate("dut1", "data") - _, dut2data = env.ltop.xlate("dut2", "data") - _, dut3data = env.ltop.xlate("dut3", "data") - _, dut4data = env.ltop.xlate("dut4", "data") + _, R1ring1 = env.ltop.xlate("R1", "ring1") + _, R1ring2 = env.ltop.xlate("R1", "ring2") + _, R2ring1 = env.ltop.xlate("R2", "ring1") + _, R2ring2 = env.ltop.xlate("R2", "ring2") + _, R3ring2 = env.ltop.xlate("R3", "ring2") + _, R4ring1 = env.ltop.xlate("R4", "ring1") + _, R1data = env.ltop.xlate("R1", "data") + _, R2data = env.ltop.xlate("R2", "data") + _, R3data = env.ltop.xlate("R3", "data") + _, R4data = env.ltop.xlate("R4", "data") - _, dut1cross = env.ltop.xlate("dut1", "cross") - _, dut2cross = env.ltop.xlate("dut2", "cross") - _, dut3cross = env.ltop.xlate("dut3", "cross") - _, dut4cross = env.ltop.xlate("dut4", "cross") - parallel(config_target1(dut1, dut1ring1, dut1ring2, dut1cross, dut1data), - config_target2(dut2, dut2ring1, dut2ring2, dut2cross, dut2data), - config_target3(dut3, dut3ring1, dut3ring2, dut3cross, dut3data), - config_target4(dut4, dut4ring1, dut4ring2, dut4cross, dut4data)) + _, R1cross = env.ltop.xlate("R1", "cross") + _, R2cross = env.ltop.xlate("R2", "cross") + _, R3cross = env.ltop.xlate("R3", "cross") + _, R4cross = env.ltop.xlate("R4", "cross") + parallel(config_target1(R1, R1ring1, R1ring2, R1cross, R1data), + config_target2(R2, R2ring1, R2ring2, R2cross, R2data), + config_target3(R3, R3ring2, R3cross, R3data), + config_target4(R4, R4ring1, R4cross, R4data)) with test.step("Wait for neighbors"): print("Waiting for neighbors to peer") - until(lambda: route.ospf_get_neighbor(dut1, "0.0.0.0", dut1ring1, "10.0.0.2"), attempts=200) - until(lambda: route.ospf_get_neighbor(dut1, "0.0.0.1", dut1cross, "10.0.0.3"), attempts=200) - until(lambda: route.ospf_get_neighbor(dut2, "0.0.0.1", dut2ring1, "10.0.0.3"), attempts=200) - until(lambda: route.ospf_get_neighbor(dut2, "0.0.0.0", dut2ring2, "10.0.0.1"), attempts=200) - until(lambda: route.ospf_get_neighbor(dut2, "0.0.0.2", dut2cross, "10.0.0.4"), attempts=200) + until(lambda: route.ospf_get_neighbor(R1, "0.0.0.0", R1ring1, "10.0.0.2"), attempts=200) + until(lambda: route.ospf_get_neighbor(R1, "0.0.0.1", R1cross, "10.0.0.3"), attempts=200) + until(lambda: route.ospf_get_neighbor(R2, "0.0.0.1", R2ring1, "10.0.0.3"), attempts=200) + until(lambda: route.ospf_get_neighbor(R2, "0.0.0.0", R2ring2, "10.0.0.1"), attempts=200) + until(lambda: route.ospf_get_neighbor(R2, "0.0.0.2", R2cross, "10.0.0.4"), attempts=200) with test.step("Wait for routes from OSPF"): print("Waiting for routes from OSPF") - until(lambda: route.ipv4_route_exist(dut1, "10.0.0.2/32", nexthop="10.0.12.2", source_protocol = "infix-routing:ospf"), attempts=200) - until(lambda: route.ipv4_route_exist(dut1, "10.0.0.3/32", nexthop="10.0.13.2", source_protocol = "infix-routing:ospf"), attempts=200) - until(lambda: route.ipv4_route_exist(dut1, "10.0.0.4/32", nexthop="10.0.41.1", source_protocol = "infix-routing:ospf"), attempts=200) - until(lambda: route.ipv4_route_exist(dut1, "192.168.4.0/24", nexthop="10.0.41.1", source_protocol = "infix-routing:ospf"), attempts=200) - until(lambda: route.ipv4_route_exist(dut1, "10.0.24.0/30", nexthop="10.0.41.1", source_protocol = "infix-routing:ospf"), attempts=200) - until(lambda: route.ipv4_route_exist(dut2, "10.0.0.1/32", nexthop="10.0.23.2", source_protocol = "infix-routing:ospf"), attempts=200) - until(lambda: route.ipv4_route_exist(dut2, "10.0.0.3/32", nexthop="10.0.23.2", source_protocol = "infix-routing:ospf"), attempts=200) - until(lambda: route.ipv4_route_exist(dut2, "10.0.0.4/32", nexthop="10.0.24.2", source_protocol = "infix-routing:ospf"), attempts=200) - until(lambda: route.ipv4_route_exist(dut3, "0.0.0.0/0", nexthop="10.0.23.1", source_protocol = "infix-routing:ospf"), attempts=200) - until(lambda: route.ipv4_route_exist(dut4, "10.0.0.3/32", nexthop="10.0.41.2", source_protocol = "infix-routing:ospf"), attempts=200) - until(lambda: route.ipv4_route_exist(dut2, "10.0.13.0/30", nexthop="10.0.23.2", source_protocol = "infix-routing:ospf"), attempts=200) + until(lambda: route.ipv4_route_exist(R1, "10.0.0.2/32", nexthop="10.0.12.2", source_protocol = "infix-routing:ospf"), attempts=200) + until(lambda: route.ipv4_route_exist(R1, "10.0.0.3/32", nexthop="10.0.13.2", source_protocol = "infix-routing:ospf"), attempts=200) + until(lambda: route.ipv4_route_exist(R1, "10.0.0.4/32", nexthop="10.0.41.1", source_protocol = "infix-routing:ospf"), attempts=200) + until(lambda: route.ipv4_route_exist(R1, "192.168.4.0/24", nexthop="10.0.41.1", source_protocol = "infix-routing:ospf"), attempts=200) + until(lambda: route.ipv4_route_exist(R1, "10.0.24.0/30", nexthop="10.0.41.1", source_protocol = "infix-routing:ospf"), attempts=200) + until(lambda: route.ipv4_route_exist(R2, "10.0.0.1/32", nexthop="10.0.23.2", source_protocol = "infix-routing:ospf"), attempts=200) + until(lambda: route.ipv4_route_exist(R2, "10.0.0.3/32", nexthop="10.0.23.2", source_protocol = "infix-routing:ospf"), attempts=200) + until(lambda: route.ipv4_route_exist(R2, "10.0.0.4/32", nexthop="10.0.24.2", source_protocol = "infix-routing:ospf"), attempts=200) + until(lambda: route.ipv4_route_exist(R3, "0.0.0.0/0", nexthop="10.0.23.1", source_protocol = "infix-routing:ospf"), attempts=200) + until(lambda: route.ipv4_route_exist(R4, "10.0.0.3/32", nexthop="10.0.41.2", source_protocol = "infix-routing:ospf"), attempts=200) + until(lambda: route.ipv4_route_exist(R2, "10.0.13.0/30", nexthop="10.0.23.2", source_protocol = "infix-routing:ospf"), attempts=200) with test.step("Verify NSSA area"): # Should be only default route out of the area. - parallel(until(lambda: route.ipv4_route_exist(dut4, "11.0.8.0/24"), attempts=200), - until(lambda: route.ipv4_route_exist(dut4, "11.0.9.0/24"), attempts=200), - until(lambda: route.ipv4_route_exist(dut4, "11.0.10.0/24"), attempts=200), - until(lambda: route.ipv4_route_exist(dut4, "11.0.11.0/24"), attempts=200), - until(lambda: route.ipv4_route_exist(dut4, "11.0.12.0/24"), attempts=200), - until(lambda: route.ipv4_route_exist(dut3, "0.0.0.0/0"), attempts=200), - until(lambda: route.ipv4_route_exist(dut3, "10.0.12.0/30") == False, attempts=5), - until(lambda: route.ipv4_route_exist(dut3, "10.0.12.0/30") == False, attempts=5), - until(lambda: route.ipv4_route_exist(dut3, "11.0.8.0/24") == False, attempts=5), - until(lambda: route.ipv4_route_exist(dut3, "11.0.9.0/24") == False, attempts=5), - until(lambda: route.ipv4_route_exist(dut3, "11.0.10.0/24") == False, attempts=5), - until(lambda: route.ipv4_route_exist(dut3, "11.0.11.0/24") == False, attempts=5), - until(lambda: route.ipv4_route_exist(dut3, "11.0.12.0/24") == False, attempts=5), - until(lambda: route.ipv4_route_exist(dut3, "11.0.13.0/24") == False, attempts=5), - until(lambda: route.ipv4_route_exist(dut3, "11.0.14.0/24") == False, attempts=5), - until(lambda: route.ipv4_route_exist(dut3, "11.0.15.0/24") == False, attempts=5)) - assert(route.ospf_is_area_nssa(dut3, "0.0.0.1")) + parallel(until(lambda: route.ipv4_route_exist(R4, "11.0.8.0/24"), attempts=200), + until(lambda: route.ipv4_route_exist(R4, "11.0.9.0/24"), attempts=200), + until(lambda: route.ipv4_route_exist(R4, "11.0.10.0/24"), attempts=200), + until(lambda: route.ipv4_route_exist(R4, "11.0.11.0/24"), attempts=200), + until(lambda: route.ipv4_route_exist(R4, "11.0.12.0/24"), attempts=200), + until(lambda: route.ipv4_route_exist(R3, "0.0.0.0/0"), attempts=200), + until(lambda: route.ipv4_route_exist(R3, "10.0.12.0/30") == False, attempts=5), + until(lambda: route.ipv4_route_exist(R3, "10.0.12.0/30") == False, attempts=5), + until(lambda: route.ipv4_route_exist(R3, "11.0.8.0/24") == False, attempts=5), + until(lambda: route.ipv4_route_exist(R3, "11.0.9.0/24") == False, attempts=5), + until(lambda: route.ipv4_route_exist(R3, "11.0.10.0/24") == False, attempts=5), + until(lambda: route.ipv4_route_exist(R3, "11.0.11.0/24") == False, attempts=5), + until(lambda: route.ipv4_route_exist(R3, "11.0.12.0/24") == False, attempts=5), + until(lambda: route.ipv4_route_exist(R3, "11.0.13.0/24") == False, attempts=5), + until(lambda: route.ipv4_route_exist(R3, "11.0.14.0/24") == False, attempts=5), + until(lambda: route.ipv4_route_exist(R3, "11.0.15.0/24") == False, attempts=5)) + assert(route.ospf_is_area_nssa(R3, "0.0.0.1")) - _, hport0 = env.ltop.xlate("host", "data3") + _, hport0 = env.ltop.xlate("PC", "data3") with infamy.IsolatedMacVlan(hport0) as ns0: with test.step("Testing connectivitiy through NSSA area"): ns0.addip("192.168.3.2") ns0.addroute("0.0.0.0/0", "192.168.3.1") ns0.must_reach("11.0.8.1") - _, hport0 = env.ltop.xlate("host", "data4") + _, hport0 = env.ltop.xlate("PC", "data4") with infamy.IsolatedMacVlan(hport0) as ns0: ns0.addip("192.168.4.2") ns0.addroute("0.0.0.0/0", "192.168.4.1") @@ -632,9 +630,9 @@ with infamy.Test() as test: assert(trace[2][1] == "10.0.0.3") with test.step("Disable link between R1 and R4, and verify correct hops"): - disable_link(dut1, dut1ring2) # Here we should test with link breakers, to test BFD recouppling, for now disable the link - until(lambda: route.ipv4_route_exist(dut4, "10.0.0.3/32", nexthop="10.0.24.1", source_protocol = "infix-routing:ospf"), attempts=100) - until(lambda: route.ipv4_route_exist(dut4, "10.0.0.3/32", nexthop="10.0.41.2") == False, attempts = 10) + disable_link(R1, R1ring2) # Here we should test with link breakers, to test BFD recouppling, for now disable the link + until(lambda: route.ipv4_route_exist(R4, "10.0.0.3/32", nexthop="10.0.24.1", source_protocol = "infix-routing:ospf"), attempts=100) + until(lambda: route.ipv4_route_exist(R4, "10.0.0.3/32", nexthop="10.0.41.2") == False, attempts = 10) trace=ns0.traceroute("10.0.0.3") assert(len(trace) == 3) assert(trace[1][1] == "10.0.24.1") diff --git a/test/case/ietf_routing/ospf_multiarea/topology.dot b/test/case/ietf_routing/ospf_multiarea/topology.dot index 844e7b96..c4052c86 100644 --- a/test/case/ietf_routing/ospf_multiarea/topology.dot +++ b/test/case/ietf_routing/ospf_multiarea/topology.dot @@ -1,59 +1,60 @@ graph "ring-4-duts" { layout="neato"; - overlap="false"; + overlap=false; esep="+20"; - + splines=true; + size=10; + node [shape=record, fontname="monospace"]; edge [color="cornflowerblue", penwidth="2"]; - host [ - label="host | { mgmt1 | data1 | mgmt2 | data20 | data2 | mgmt3 | data3 | mgmt4 | data4 }", - pos="0,15!", - kind="controller", + PC [ + label=" { PC | { mgmt4 | data4 | mgmt1 | data1 | data2 | mgmt2 | data3 | mgmt3 } }", + pos="150,200!" + kind="controller", ]; - dut1 [ - label="{ mgmt | data | ring1 } | dut1 | { ring2 | cross }", - pos="10,18!", - kind="infix", + R1 [ + label="{ { mgmt | data } | \n R1 \n 10.0.0.1/32 \n(lo) } | { ring1 | cross | ring2 }", + pos="50,150!", + kind="infix", ]; - dut2 [ - label="{ mgmt | data | ring1 } | dut2 | { ring2 | cross }", - pos="10,12!", - kind="infix", + R4 [ + label="{ { mgmt | data } | \n R4 \n 10.0.0.4/32 \n(lo) } | { ring1 | cross | ring2 }", + pos="50,50!" + kind="infix", ]; - dut3 [ - label="{ mgmt | data | ring1 } | dut2 | { ring2 | cross}", - pos="10,12!", - kind="infix", + R2 [ + label="{ ring2 | cross | ring1 } | { { data | mgmt } | \n R2 \n10.0.0.2/32 \n(lo) }", + pos="250,150!" + kind="infix", ]; - dut4 [ - label="{ mgmt | data | ring1 } | dut2 | { ring2 | cross }", - pos="10,12!", - kind="infix", - ]; + R3 [ + label="{ ring2 | cross | ring1 } | { { data | mgmt } | \n R3 \n10.0.0.3/32 \n(lo) }", + pos="250,50!" + kind="infix", + ]; - host:mgmt1 -- dut1:mgmt [kind=mgmt] - host:mgmt2 -- dut2:mgmt [kind=mgmt] - host:mgmt3 -- dut3:mgmt [kind=mgmt] - host:mgmt4 -- dut4:mgmt [kind=mgmt] + PC:mgmt1 -- R1:mgmt [kind=mgmt, color="lightgray"] + PC:mgmt2 -- R2:mgmt [kind=mgmt, color="lightgray"] + PC:mgmt3 -- R3:mgmt [kind=mgmt, color="lightgray"] + PC:mgmt4 -- R4:mgmt [kind=mgmt, color="lightgray"] - # Host-Dut links - host:data1 -- dut1:data - host:data2 -- dut2:data - host:data3 -- dut3:data - host:data4 -- dut4:data + # PC-Dut links + PC:data1 -- R1:data [color="darkgreen"] + PC:data2 -- R2:data [color="darkgreen"] + PC:data3 -- R3:data [color="darkgreen"] + PC:data4 -- R4:data [color="darkgreen", headlabel=".1", label="192.168.4.0/24", taillabel=".2", labeldistance=2, fontcolor="darkgreen"] # Ring - dut1:ring1 -- dut2:ring2 - dut2:ring1 -- dut3:ring2 - dut3:ring1 -- dut4:ring2 - dut4:ring1 -- dut1:ring2 + R1:ring1 -- R2:ring2 [color="blue", headlabel=".2", label="(Area 0)\n10.0.12.0/30", taillabel=".1", labeldistance=2, fontcolor="blue"] + R2:ring1 -- R3:ring2 [color="purple", headlabel=".2", label="10.0.23.0/30\n(Area 1)", taillabel=".1", labeljust=r, labeldistance=2, fontcolor="purple"] + R4:ring1 -- R1:ring2 [color="brown", headlabel=".2", label="10.0.41.0/30\n(Area 2)", taillabel=".1", labeldistance=2, fontcolor="brown"] # Cross - dut1:cross -- dut3:cross - dut2:cross -- dut4:cross + R1:cross -- R3:cross [color="purple", headlabel=".2", label="10.0.13.0/30\n(Area 1)", taillabel=".1", labeldistance=2, fontcolor="purple"] + R2:cross -- R4:cross [color="brown", headlabel=".2", label="\n\n10.0.24.0/30\n(Area 2)", taillabel=".1", labeldistance=2, fontcolor="brown"] } diff --git a/test/case/ietf_routing/ospf_multiarea/topology.png b/test/case/ietf_routing/ospf_multiarea/topology.png index 4dfde070..7bd3db30 100644 Binary files a/test/case/ietf_routing/ospf_multiarea/topology.png and b/test/case/ietf_routing/ospf_multiarea/topology.png differ diff --git a/test/case/ietf_routing/ospf_unnumbered_interface/test.py b/test/case/ietf_routing/ospf_unnumbered_interface/test.py index efadc6bb..cd65b418 100755 --- a/test/case/ietf_routing/ospf_unnumbered_interface/test.py +++ b/test/case/ietf_routing/ospf_unnumbered_interface/test.py @@ -168,33 +168,33 @@ def config_target2(target, link): with infamy.Test() as test: with test.step("Initialize"): env = infamy.Env() - target1 = env.attach("target1", "mgmt") - target2 = env.attach("target2", "mgmt") + R1 = env.attach("R1", "mgmt") + R2 = env.attach("R2", "mgmt") with test.step("Configure targets"): - _, target1data = env.ltop.xlate("target1", "data") - _, target2_to_target1 = env.ltop.xlate("target2", "target1") - _, target1_to_target2 = env.ltop.xlate("target1", "target2") + _, R1data = env.ltop.xlate("R1", "data") + _, R2_to_R1 = env.ltop.xlate("R2", "R1") + _, R1_to_R2 = env.ltop.xlate("R1", "R2") - parallel(lambda: config_target1(target1, target1data, target1_to_target2), - lambda: config_target2(target2, target2_to_target1)) + parallel(lambda: config_target1(R1, R1data, R1_to_R2), + lambda: config_target2(R2, R2_to_R1)) with test.step("Wait for OSPF routes"): print("Waiting for OSPF routes..") - until(lambda: route.ipv4_route_exist(target1, "192.168.200.1/32", source_protocol = "infix-routing:ospf"), attempts=200) - until(lambda: route.ipv4_route_exist(target2, "192.168.100.1/32", source_protocol = "infix-routing:ospf"), attempts=200) - until(lambda: route.ipv4_route_exist(target2, "192.168.10.0/24", source_protocol = "infix-routing:ospf"), attempts=200) + until(lambda: route.ipv4_route_exist(R1, "192.168.200.1/32", source_protocol = "infix-routing:ospf"), attempts=200) + until(lambda: route.ipv4_route_exist(R2, "192.168.100.1/32", source_protocol = "infix-routing:ospf"), attempts=200) + until(lambda: route.ipv4_route_exist(R2, "192.168.10.0/24", source_protocol = "infix-routing:ospf"), attempts=200) with test.step("Check interface type"): - assert(route.ospf_get_interface_type(target1, "0.0.0.0", target1_to_target2) == "point-to-point") - assert(route.ospf_get_interface_type(target2, "0.0.0.0", target2_to_target1) == "point-to-point") + assert(route.ospf_get_interface_type(R1, "0.0.0.0", R1_to_R2) == "point-to-point") + assert(route.ospf_get_interface_type(R2, "0.0.0.0", R2_to_R1) == "point-to-point") - _, hport0 = env.ltop.xlate("host", "data1") + _, hport0 = env.ltop.xlate("PC", "data1") with infamy.IsolatedMacVlan(hport0) as ns0: ns0.addip("192.168.10.2") ns0.addroute("192.168.200.1/32", "192.168.10.1") with test.step("Test passive interface"): - assert(route.ospf_get_interface_passive(target1, "0.0.0.0", target1data)) + assert(route.ospf_get_interface_passive(R1, "0.0.0.0", R1data)) print("Verify that no hello packets are recieved from passive interfaces") ns0.must_not_receive("ip proto 89", timeout=15) # Default hello time 10s diff --git a/test/case/ietf_routing/ospf_unnumbered_interface/topology.dot b/test/case/ietf_routing/ospf_unnumbered_interface/topology.dot index c3b6af0b..e8a761f8 100644 --- a/test/case/ietf_routing/ospf_unnumbered_interface/topology.dot +++ b/test/case/ietf_routing/ospf_unnumbered_interface/topology.dot @@ -2,31 +2,31 @@ graph "2x2" { layout="neato"; overlap="false"; esep="+20"; + size=10 node [shape=record, fontname="monospace"]; edge [color="cornflowerblue", penwidth="2"]; - host [ - label="host | { mgmt1 | data1 | mgmt2 | data2 }", - pos="0,12!", + PC [ + label="PC | { mgmt1 | data1 | mgmt2 | data2 }", + pos="20,80!", kind="controller", ]; - target1 [ - label="{ mgmt | data | target2} | target1", - pos="10,18!", + R1 [ + label="{ mgmt | data | R2} | R1 \n 192.168.100.1/32 \n(lo)", + pos="250,80!", kind="infix", ]; - target2 [ - label="{ target1 | mgmt | data } | target2", - pos="10,6!", + R2 [ + label="{ R1 | mgmt | data } | R2 \n 192.168.200.1/32 \n(lo)", + pos="250,30!", kind="infix", ]; - host:mgmt1 -- target1:mgmt [kind=mgmt] - host:mgmt2 -- target2:mgmt [kind=mgmt] - host:data1 -- target1:data - host:data2 -- target2:data - target1:target2 -- target2:target1 + PC:mgmt1 -- R1:mgmt [kind=mgmt] + PC:mgmt2 -- R2:mgmt [kind=mgmt] + PC:data1 -- R1:data [color="black", headlabel="192.168.10.1/24", taillabel="192.168.10.2/24", fontcolor="black"] + R1:R2 -- R2:R1 [headlabel="10.0.0.2/32", taillabel="10.0.0.1/32", labeldistance=1, fontcolor="blue"] } diff --git a/test/case/ietf_routing/ospf_unnumbered_interface/topology.png b/test/case/ietf_routing/ospf_unnumbered_interface/topology.png index 483114ef..2e047f7f 100644 Binary files a/test/case/ietf_routing/ospf_unnumbered_interface/topology.png and b/test/case/ietf_routing/ospf_unnumbered_interface/topology.png differ diff --git a/test/case/ietf_routing/static_routing/test.py b/test/case/ietf_routing/static_routing/test.py index 4d56303c..582f6f51 100755 --- a/test/case/ietf_routing/static_routing/test.py +++ b/test/case/ietf_routing/static_routing/test.py @@ -191,24 +191,24 @@ def config_target2(target, link): with infamy.Test() as test: with test.step("Initialize"): env = infamy.Env() - target1 = env.attach("target1", "mgmt") - target2 = env.attach("target2", "mgmt") + R1 = env.attach("R1", "mgmt") + R2 = env.attach("R2", "mgmt") with test.step("Configure targets"): - _, target1data = env.ltop.xlate("target1", "data") - _, target2_to_target1 = env.ltop.xlate("target2", "target1") - _, target1_to_target2 = env.ltop.xlate("target1", "target2") + _, R1data = env.ltop.xlate("R1", "data") + _, R2_to_R1 = env.ltop.xlate("R2", "R1") + _, R1_to_R2 = env.ltop.xlate("R1", "R2") - parallel(config_target1(target1, target1data, target1_to_target2), - config_target2(target2, target2_to_target1)) + parallel(config_target1(R1, R1data, R1_to_R2), + config_target2(R2, R2_to_R1)) with test.step("Wait for routes"): - until(lambda: route.ipv4_route_exist(target1, "192.168.200.1/32")) - until(lambda: route.ipv4_route_exist(target2, "0.0.0.0/0")) - until(lambda: route.ipv6_route_exist(target1, "2001:db8:3c4d:200::1/128")) - until(lambda: route.ipv6_route_exist(target2, "::/0")) + until(lambda: route.ipv4_route_exist(R1, "192.168.200.1/32")) + until(lambda: route.ipv4_route_exist(R2, "0.0.0.0/0")) + until(lambda: route.ipv6_route_exist(R1, "2001:db8:3c4d:200::1/128")) + until(lambda: route.ipv6_route_exist(R2, "::/0")) - _, hport0 = env.ltop.xlate("host", "data1") + _, hport0 = env.ltop.xlate("PC", "data1") with infamy.IsolatedMacVlan(hport0) as ns0: with test.step("Configure host addresses and routes"): ns0.addip("2001:db8:3c4d:10::2", prefix_length=64, proto="ipv6") @@ -223,9 +223,9 @@ with infamy.Test() as test: ns0.must_reach("2001:db8:3c4d:200::1") with test.step("Remove static routes on dut1"): - target1.delete_xpath("/ietf-routing:routing/control-plane-protocols") - parallel(until(lambda: route.ipv4_route_exist(target1, "192.168.200.1/32") == False), - until(lambda: route.ipv6_route_exist(target1, "2001:db8:3c4d:200::1/128") == False)) + R1.delete_xpath("/ietf-routing:routing/control-plane-protocols") + parallel(until(lambda: route.ipv4_route_exist(R1, "192.168.200.1/32") == False), + until(lambda: route.ipv6_route_exist(R1, "2001:db8:3c4d:200::1/128") == False)) with test.step("Verify that dut2 is no longer reachable"): infamy.parallel(ns0.must_not_reach("192.168.200.1"), diff --git a/test/case/ietf_routing/static_routing/topology.dot b/test/case/ietf_routing/static_routing/topology.dot index c3b6af0b..4680f725 100644 --- a/test/case/ietf_routing/static_routing/topology.dot +++ b/test/case/ietf_routing/static_routing/topology.dot @@ -2,31 +2,31 @@ graph "2x2" { layout="neato"; overlap="false"; esep="+20"; + size=10 node [shape=record, fontname="monospace"]; edge [color="cornflowerblue", penwidth="2"]; - host [ - label="host | { mgmt1 | data1 | mgmt2 | data2 }", - pos="0,12!", + PC [ + label="PC | { mgmt1 | data1 | mgmt2 | data2 }", + pos="20,80!", kind="controller", ]; - target1 [ - label="{ mgmt | data | target2} | target1", - pos="10,18!", + R1 [ + label="{ mgmt | data | R2} | R1 \n 192.168.100.1/32 \n(lo)", + pos="250,80!", kind="infix", ]; - target2 [ - label="{ target1 | mgmt | data } | target2", - pos="10,6!", + R2 [ + label="{ R1 | mgmt | data } | R2 \n 192.168.200.1/32 \n(lo)", + pos="250,30!", kind="infix", ]; - host:mgmt1 -- target1:mgmt [kind=mgmt] - host:mgmt2 -- target2:mgmt [kind=mgmt] - host:data1 -- target1:data - host:data2 -- target2:data - target1:target2 -- target2:target1 + PC:mgmt1 -- R1:mgmt [kind=mgmt] + PC:mgmt2 -- R2:mgmt [kind=mgmt] + PC:data1 -- R1:data [ headlabel=".2", taillabel=".1", label="192.168.10.0/24", fontcolor="black", color="black"] + R1:R2 -- R2:R1 [headlabel=".2", taillabel=".1", label="192.168.50.0/24", labeldistance=1, fontcolor="blue"] } diff --git a/test/case/ietf_routing/static_routing/topology.png b/test/case/ietf_routing/static_routing/topology.png index 483114ef..8f53641c 100644 Binary files a/test/case/ietf_routing/static_routing/topology.png and b/test/case/ietf_routing/static_routing/topology.png differ