mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-22 01:13:00 +02:00
test: Cleanup topologies
This commit is contained in:
@@ -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> mgmt | <data1> data1 | <data2> data2 }",
|
||||
pos="0,12!",
|
||||
requires="controller",
|
||||
];
|
||||
|
||||
target [
|
||||
label="{ <mgmt> mgmt | <data1> data1 | <data2> 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]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
../../../infamy/topologies/1x3.dot
|
||||
@@ -35,7 +35,7 @@
|
||||
<!-- host--target -->
|
||||
<g id="edge1" class="edge">
|
||||
<title>host:mgmt--target:mgmt</title>
|
||||
<path fill="none" stroke="lightgrey" stroke-width="2" d="M108,-58C108,-58 308.03,-58 308.03,-58"/>
|
||||
<path fill="none" stroke="lightgray" stroke-width="2" d="M108,-58C108,-58 308.03,-58 308.03,-58"/>
|
||||
</g>
|
||||
<!-- host--target -->
|
||||
<g id="edge2" class="edge">
|
||||
|
||||
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
@@ -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()
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
<polygon fill="none" stroke="black" points="0,-0.5 0,-69.5 108,-69.5 108,-0.5 0,-0.5"/>
|
||||
<text text-anchor="middle" x="25" y="-31.3" font-family="DejaVu Sans Mono, Book" font-size="14.00">host</text>
|
||||
<polyline fill="none" stroke="black" points="50,-0.5 50,-69.5 "/>
|
||||
<text text-anchor="middle" x="79" y="-54.3" font-family="DejaVu Sans Mono, Book" font-size="14.00">tgt</text>
|
||||
<text text-anchor="middle" x="79" y="-54.3" font-family="DejaVu Sans Mono, Book" font-size="14.00">mgmt</text>
|
||||
<polyline fill="none" stroke="black" points="50,-46.5 108,-46.5 "/>
|
||||
<text text-anchor="middle" x="79" y="-31.3" font-family="DejaVu Sans Mono, Book" font-size="14.00">data0</text>
|
||||
<text text-anchor="middle" x="79" y="-31.3" font-family="DejaVu Sans Mono, Book" font-size="14.00">data1</text>
|
||||
<polyline fill="none" stroke="black" points="50,-23.5 108,-23.5 "/>
|
||||
<text text-anchor="middle" x="79" y="-8.3" font-family="DejaVu Sans Mono, Book" font-size="14.00">data1</text>
|
||||
<text text-anchor="middle" x="79" y="-8.3" font-family="DejaVu Sans Mono, Book" font-size="14.00">data2</text>
|
||||
</g>
|
||||
<!-- target -->
|
||||
<g id="node2" class="node">
|
||||
@@ -26,25 +26,25 @@
|
||||
<polygon fill="none" stroke="black" points="308.03,-0.5 308.03,-69.5 432.03,-69.5 432.03,-0.5 308.03,-0.5"/>
|
||||
<text text-anchor="middle" x="337.03" y="-54.3" font-family="DejaVu Sans Mono, Book" font-size="14.00">mgmt</text>
|
||||
<polyline fill="none" stroke="black" points="308.03,-46.5 366.03,-46.5 "/>
|
||||
<text text-anchor="middle" x="337.03" y="-31.3" font-family="DejaVu Sans Mono, Book" font-size="14.00">data0</text>
|
||||
<text text-anchor="middle" x="337.03" y="-31.3" font-family="DejaVu Sans Mono, Book" font-size="14.00">data1</text>
|
||||
<polyline fill="none" stroke="black" points="308.03,-23.5 366.03,-23.5 "/>
|
||||
<text text-anchor="middle" x="337.03" y="-8.3" font-family="DejaVu Sans Mono, Book" font-size="14.00">data1</text>
|
||||
<text text-anchor="middle" x="337.03" y="-8.3" font-family="DejaVu Sans Mono, Book" font-size="14.00">data2</text>
|
||||
<polyline fill="none" stroke="black" points="366.03,-0.5 366.03,-69.5 "/>
|
||||
<text text-anchor="middle" x="399.03" y="-31.3" font-family="DejaVu Sans Mono, Book" font-size="14.00">target</text>
|
||||
</g>
|
||||
<!-- host--target -->
|
||||
<g id="edge1" class="edge">
|
||||
<title>host:tgt--target:mgmt</title>
|
||||
<path fill="none" stroke="cornflowerblue" stroke-width="2" d="M108,-58C108,-58 308.03,-58 308.03,-58"/>
|
||||
<title>host:mgmt--target:mgmt</title>
|
||||
<path fill="none" stroke="lightgray" stroke-width="2" d="M108,-58C108,-58 308.03,-58 308.03,-58"/>
|
||||
</g>
|
||||
<!-- host--target -->
|
||||
<g id="edge2" class="edge">
|
||||
<title>host:data0--target:data0</title>
|
||||
<title>host:data1--target:data1</title>
|
||||
<path fill="none" stroke="black" stroke-width="2" d="M108,-35C108,-35 308.03,-35 308.03,-35"/>
|
||||
</g>
|
||||
<!-- host--target -->
|
||||
<g id="edge3" class="edge">
|
||||
<title>host:data1--target:data1</title>
|
||||
<title>host:data2--target:data2</title>
|
||||
<path fill="none" stroke="black" stroke-width="2" d="M108,-12C108,-12 308.03,-12 308.03,-12"/>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
@@ -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
|
||||
|
||||
|
||||
<<<
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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> mgmt | <data1> data1 | <data2> data2 }",
|
||||
pos="0,12!",
|
||||
requires="controller",
|
||||
];
|
||||
|
||||
target [
|
||||
label="{ <mgmt> mgmt | <data1> data1 | <data2> 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"]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
../../../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> tgt | <data0> data0 | <data1> data1 }",
|
||||
pos="0,12!",
|
||||
requires="controller",
|
||||
label="host | { <mgmt> mgmt | <data1> data1 | <data2> data2 }",
|
||||
pos="0,12!",
|
||||
requires="controller",
|
||||
];
|
||||
|
||||
target [
|
||||
label="{ <mgmt> mgmt | <data0> data0 | <data1> data1 } | target",
|
||||
pos="10,12!",
|
||||
|
||||
requires="infix",
|
||||
target [
|
||||
label="{ <mgmt> mgmt | <data1> data1 | <data2> 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]
|
||||
}
|
||||
host:mgmt -- target:mgmt [requires="mgmt", color="lightgray"]
|
||||
host:data1 -- target:data1 [color="black"]
|
||||
host:data2 -- target:data2 [color="black"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user