From 2cbba5cf1f0311ce15bb645229d49a578537b6da Mon Sep 17 00:00:00 2001 From: Ahmed Karic Date: Fri, 2 May 2025 17:06:23 +0200 Subject: [PATCH] test: Cleanup topologies --- .../ietf_interfaces/veth_delete/topology.dot | 26 +------ .../ietf_interfaces/veth_delete/topology.svg | 2 +- .../vlan_iface_termination/test.py | 74 +++++++++---------- .../vlan_iface_termination/topology.svg | 18 ++--- .../vlan_iface_termination.adoc | 16 ++-- .../infix_services/lldp_admin_status/test.py | 2 +- .../ssh_server_config/topology.dot | 25 +------ test/infamy/topologies/1x3.dot | 25 +++---- 8 files changed, 70 insertions(+), 118 deletions(-) mode change 100644 => 120000 test/case/ietf_interfaces/veth_delete/topology.dot mode change 100644 => 120000 test/case/infix_services/ssh_server_config/topology.dot diff --git a/test/case/ietf_interfaces/veth_delete/topology.dot b/test/case/ietf_interfaces/veth_delete/topology.dot deleted file mode 100644 index 10fb0dee..00000000 --- a/test/case/ietf_interfaces/veth_delete/topology.dot +++ /dev/null @@ -1,25 +0,0 @@ -graph "1x3" { - layout="neato"; - overlap="false"; - esep="+80"; - - node [shape=record, fontname="DejaVu Sans Mono, Book"]; - edge [color="cornflowerblue", penwidth="2", fontname="DejaVu Serif, Book"]; - - host [ - label="host | { mgmt | data1 | data2 }", - pos="0,12!", - requires="controller", - ]; - - target [ - label="{ mgmt | data1 | data2 } | target", - pos="10,12!", - - requires="infix", - ]; - - host:mgmt -- target:mgmt [requires="mgmt", color=lightgrey] - host:data1 -- target:data1 [color=black] - host:data2 -- target:data2 [color=black] -} diff --git a/test/case/ietf_interfaces/veth_delete/topology.dot b/test/case/ietf_interfaces/veth_delete/topology.dot new file mode 120000 index 00000000..7689a677 --- /dev/null +++ b/test/case/ietf_interfaces/veth_delete/topology.dot @@ -0,0 +1 @@ +../../../infamy/topologies/1x3.dot \ No newline at end of file diff --git a/test/case/ietf_interfaces/veth_delete/topology.svg b/test/case/ietf_interfaces/veth_delete/topology.svg index e7d561fa..9517e639 100644 --- a/test/case/ietf_interfaces/veth_delete/topology.svg +++ b/test/case/ietf_interfaces/veth_delete/topology.svg @@ -35,7 +35,7 @@ host:mgmt--target:mgmt - + diff --git a/test/case/ietf_interfaces/vlan_iface_termination/test.py b/test/case/ietf_interfaces/vlan_iface_termination/test.py index e2c32c45..c26ae1ec 100755 --- a/test/case/ietf_interfaces/vlan_iface_termination/test.py +++ b/test/case/ietf_interfaces/vlan_iface_termination/test.py @@ -8,14 +8,14 @@ attached to a VLAN filtering bridge are always locally terminated. .---------------------------. | target | | | -| data0.10 br0 data1.10 | +| data1.10 br0 data2.10 | | \ / \ / | -'------data0-----data1------' +'------data1-----data2------' | | | | -.------data0-----data1------. +.------data1-----data2------. | / : \ | -| data0.10 : data1.10 | +| data1.10 : data2.10 | | : | | host | | : | @@ -23,7 +23,7 @@ attached to a VLAN filtering bridge are always locally terminated. .... In this setup, even though VLAN 10 is allowed to ingress and egress on -both `data0` and `data1`, _bridging_ of packets from one to the other +both `data1` and `data2`, _bridging_ of packets from one to the other must _not_ be allowed. """ @@ -35,10 +35,10 @@ with infamy.Test() as test: tgt = env.attach("target", "mgmt") with test.step("Configure bridge and VLAN interfaces on target"): - _, hdata0 = env.ltop.xlate( "host", "data0") _, hdata1 = env.ltop.xlate( "host", "data1") - _, ddata0 = env.ltop.xlate("target", "data0") + _, hdata2 = env.ltop.xlate( "host", "data2") _, ddata1 = env.ltop.xlate("target", "data1") + _, ddata2 = env.ltop.xlate("target", "data2") tgt.put_config_dicts({ "ietf-interfaces": { @@ -53,35 +53,12 @@ with infamy.Test() as test: "vlan": [ { "vid": 1, - "untagged": [ddata0, ddata1] + "untagged": [ddata1, ddata2] }, ] } } }, - { - "name": ddata0, - "infix-interfaces:bridge-port": { - "pvid": 1, - "bridge": "br0" - } - }, - { - "name": f"{ddata0}.10", - "type": "infix-if-type:vlan", - "vlan": { - "id": 10, - "lower-layer-if": ddata0, - }, - "ipv4": { - "address": [ - { - "ip": "10.10.1.2", - "prefix-length": 24, - } - ] - } - }, { "name": ddata1, "infix-interfaces:bridge-port": { @@ -96,6 +73,29 @@ with infamy.Test() as test: "id": 10, "lower-layer-if": ddata1, }, + "ipv4": { + "address": [ + { + "ip": "10.10.1.2", + "prefix-length": 24, + } + ] + } + }, + { + "name": ddata2, + "infix-interfaces:bridge-port": { + "pvid": 1, + "bridge": "br0" + } + }, + { + "name": f"{ddata2}.10", + "type": "infix-if-type:vlan", + "vlan": { + "id": 10, + "lower-layer-if": ddata2, + }, "ipv4": { "address": [ { @@ -110,8 +110,8 @@ with infamy.Test() as test: } }) - with infamy.IsolatedMacVlan(hdata0) as ns0, \ - infamy.IsolatedMacVlan(hdata1) as ns1: + with infamy.IsolatedMacVlan(hdata1) as ns0, \ + infamy.IsolatedMacVlan(hdata2) as ns1: with test.step("Configure IP addresses and VLAN interfaces on host"): ns0.addip("10.0.1.1") @@ -128,17 +128,17 @@ with infamy.Test() as test: ip addr add 10.10.2.1/24 dev vlan10 """) - with test.step("Verify that host:data0 reaches host:data1 with untagged packets"): + with test.step("Verify that host:data1 reaches host:data2 with untagged packets"): ns0.must_reach("10.0.1.2") - with test.step("Verify that traffic on VLAN 10 from host:data0 does not reach host:data1"): + with test.step("Verify that traffic on VLAN 10 from host:data1 does not reach host:data2"): infamy.parallel(lambda: ns0.runsh("timeout -s INT 5 ping -i 0.2 -b 10.10.1.255 || true"), lambda: ns1.must_not_receive("ip src 10.10.1.1")) - with test.step("Verify that host:data0 can reach target on VLAN 10"): + with test.step("Verify that host:data1 can reach target on VLAN 10"): ns0.must_reach("10.10.1.2") - with test.step("Verify that host:data1 can reach target on VLAN 10"): + with test.step("Verify that host:data2 can reach target on VLAN 10"): ns1.must_reach("10.10.2.2") test.succeed() diff --git a/test/case/ietf_interfaces/vlan_iface_termination/topology.svg b/test/case/ietf_interfaces/vlan_iface_termination/topology.svg index d2fdf4fa..9517e639 100644 --- a/test/case/ietf_interfaces/vlan_iface_termination/topology.svg +++ b/test/case/ietf_interfaces/vlan_iface_termination/topology.svg @@ -14,11 +14,11 @@ host -tgt +mgmt -data0 +data1 -data1 +data2 @@ -26,25 +26,25 @@ mgmt -data0 +data1 -data1 +data2 target -host:tgt--target:mgmt - +host:mgmt--target:mgmt + -host:data0--target:data0 +host:data1--target:data1 -host:data1--target:data1 +host:data2--target:data2 diff --git a/test/case/ietf_interfaces/vlan_iface_termination/vlan_iface_termination.adoc b/test/case/ietf_interfaces/vlan_iface_termination/vlan_iface_termination.adoc index 8fd73631..cc955c6b 100644 --- a/test/case/ietf_interfaces/vlan_iface_termination/vlan_iface_termination.adoc +++ b/test/case/ietf_interfaces/vlan_iface_termination/vlan_iface_termination.adoc @@ -7,14 +7,14 @@ attached to a VLAN filtering bridge are always locally terminated. .---------------------------. | target | | | -| data0.10 br0 data1.10 | +| data1.10 br0 data2.10 | | \ / \ / | -'------data0-----data1------' +'------data1-----data2------' | | | | -.------data0-----data1------. +.------data1-----data2------. | / : \ | -| data0.10 : data1.10 | +| data1.10 : data2.10 | | : | | host | | : | @@ -22,7 +22,7 @@ attached to a VLAN filtering bridge are always locally terminated. .... In this setup, even though VLAN 10 is allowed to ingress and egress on -both `data0` and `data1`, _bridging_ of packets from one to the other +both `data1` and `data2`, _bridging_ of packets from one to the other must _not_ be allowed. ==== Topology @@ -41,10 +41,10 @@ endif::topdoc[] . Set up topology and attach to target . Configure bridge and VLAN interfaces on target . Configure IP addresses and VLAN interfaces on host -. Verify that host:data0 reaches host:data1 with untagged packets -. Verify that traffic on VLAN 10 from host:data0 does not reach host:data1 -. Verify that host:data0 can reach target on VLAN 10 +. Verify that host:data1 reaches host:data2 with untagged packets +. Verify that traffic on VLAN 10 from host:data1 does not reach host:data2 . Verify that host:data1 can reach target on VLAN 10 +. Verify that host:data2 can reach target on VLAN 10 <<< diff --git a/test/case/infix_services/lldp_admin_status/test.py b/test/case/infix_services/lldp_admin_status/test.py index 87e6183d..5f9befbb 100755 --- a/test/case/infix_services/lldp_admin_status/test.py +++ b/test/case/infix_services/lldp_admin_status/test.py @@ -22,7 +22,7 @@ def capture_traffic(iface, sec): return sniffer.output() def send_lldp_packet(iface, chassis_id, chassis_id_subtype, ttl=3): - eth = Ether(dst="01:80:c2:00:00:0e", type=0x88cc) + eth = Ether(src="02:01:02:03:04:05", dst="01:80:C2:00:00:0E", type=0x88cc) lldpdu = eth / LLDPDU() lldpdu /= LLDPDUChassisID(subtype=chassis_id_subtype, id=chassis_id) lldpdu /= LLDPDUPortID(subtype=5, id=iface) diff --git a/test/case/infix_services/ssh_server_config/topology.dot b/test/case/infix_services/ssh_server_config/topology.dot deleted file mode 100644 index 671ed493..00000000 --- a/test/case/infix_services/ssh_server_config/topology.dot +++ /dev/null @@ -1,24 +0,0 @@ -graph "1x3" { - layout="neato"; - overlap="false"; - esep="+80"; - - node [shape=record, fontname="DejaVu Sans Mono, Book"]; - edge [color="cornflowerblue", penwidth="2", fontname="DejaVu Serif, Book"]; - - host [ - label="host | { mgmt | data1 | data2 }", - pos="0,12!", - requires="controller", - ]; - - target [ - label="{ mgmt | data1 | data2 } | target", - pos="10,12!", - requires="infix", - ]; - - host:mgmt -- target:mgmt [requires="mgmt", color="lightgray"] - host:data1 -- target:data1 [color="black"] - host:data2 -- target:data2 [color="black"] -} diff --git a/test/case/infix_services/ssh_server_config/topology.dot b/test/case/infix_services/ssh_server_config/topology.dot new file mode 120000 index 00000000..7689a677 --- /dev/null +++ b/test/case/infix_services/ssh_server_config/topology.dot @@ -0,0 +1 @@ +../../../infamy/topologies/1x3.dot \ No newline at end of file diff --git a/test/infamy/topologies/1x3.dot b/test/infamy/topologies/1x3.dot index 2ba60559..f288f2f9 100644 --- a/test/infamy/topologies/1x3.dot +++ b/test/infamy/topologies/1x3.dot @@ -4,22 +4,21 @@ graph "1x3" { esep="+80"; node [shape=record, fontname="DejaVu Sans Mono, Book"]; - edge [color="cornflowerblue", penwidth="2", fontname="DejaVu Serif, Book"]; + edge [color="cornflowerblue", penwidth="2", fontname="DejaVu Serif, Book"]; host [ - label="host | { tgt | data0 | data1 }", - pos="0,12!", - requires="controller", + label="host | { mgmt | data1 | data2 }", + pos="0,12!", + requires="controller", ]; - target [ - label="{ mgmt | data0 | data1 } | target", - pos="10,12!", - - requires="infix", + target [ + label="{ mgmt | data1 | data2 } | target", + pos="10,12!", + requires="infix", ]; - host:tgt -- target:mgmt [requires="mgmt"] - host:data0 -- target:data0 [color=black] - host:data1 -- target:data1 [color=black] -} \ No newline at end of file + host:mgmt -- target:mgmt [requires="mgmt", color="lightgray"] + host:data1 -- target:data1 [color="black"] + host:data2 -- target:data2 [color="black"] +}