mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-31 04:53:01 +02:00
test: vlan_iface_termination: Fix test spec issues
- Use standard topology - Include test case specification in parent README
This commit is contained in:
@@ -45,3 +45,5 @@ include::iface_enable_disable/Readme.adoc[]
|
||||
|
||||
include::veth_delete/Readme.adoc[]
|
||||
|
||||
include::vlan_iface_termination/Readme.adoc[]
|
||||
|
||||
|
||||
@@ -4,24 +4,26 @@ Verify that VLANs stacked on top of an interfaces that are also
|
||||
attached to a VLAN filtering bridge are always locally terminated.
|
||||
|
||||
....
|
||||
.-------------------.
|
||||
| dut |
|
||||
| |
|
||||
| a.10 br0 b.10 |
|
||||
| \ / \ / |
|
||||
'------a-----b------'
|
||||
| |
|
||||
| |
|
||||
.------a-----b------.
|
||||
| |
|
||||
| host |
|
||||
| |
|
||||
'-------------------'
|
||||
.---------------------------.
|
||||
| target |
|
||||
| |
|
||||
| data0.10 br0 data1.10 |
|
||||
| \ / \ / |
|
||||
'------data0-----data1------'
|
||||
| |
|
||||
| |
|
||||
.------data0-----data1------.
|
||||
| / : \ |
|
||||
| data0.10 : data1.10 |
|
||||
| : |
|
||||
| host |
|
||||
| : |
|
||||
'---------------------------'
|
||||
....
|
||||
|
||||
In this setup, even though VLAN 10 is allowed to ingress and egress on
|
||||
both `a` and `b`, _bridging_ of packets from one to the other must
|
||||
_not_ be allowed.
|
||||
both `data0` and `data1`, _bridging_ of packets from one to the other
|
||||
must _not_ be allowed.
|
||||
|
||||
==== Topology
|
||||
ifdef::topdoc[]
|
||||
@@ -36,13 +38,13 @@ image::topology.svg[VLAN Interface Termination topology]
|
||||
endif::testgroup[]
|
||||
endif::topdoc[]
|
||||
==== Test sequence
|
||||
. Set up topology and attach to dut
|
||||
. Configure bridge and VLAN interfaces on dut
|
||||
. 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:a reaches host:b with untagged packets
|
||||
. Verify that traffic on VLAN 10 from host:a does not reach host:b
|
||||
. Verify that host:a can reach dut on VLAN 10
|
||||
. Verify that host:b can reach dut on VLAN 10
|
||||
. 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 can reach target on VLAN 10
|
||||
|
||||
|
||||
<<<
|
||||
|
||||
@@ -5,40 +5,42 @@ Verify that VLANs stacked on top of an interfaces that are also
|
||||
attached to a VLAN filtering bridge are always locally terminated.
|
||||
|
||||
....
|
||||
.-------------------.
|
||||
| dut |
|
||||
| |
|
||||
| a.10 br0 b.10 |
|
||||
| \ / \ / |
|
||||
'------a-----b------'
|
||||
| |
|
||||
| |
|
||||
.------a-----b------.
|
||||
| |
|
||||
| host |
|
||||
| |
|
||||
'-------------------'
|
||||
.---------------------------.
|
||||
| target |
|
||||
| |
|
||||
| data0.10 br0 data1.10 |
|
||||
| \ / \ / |
|
||||
'------data0-----data1------'
|
||||
| |
|
||||
| |
|
||||
.------data0-----data1------.
|
||||
| / : \ |
|
||||
| data0.10 : data1.10 |
|
||||
| : |
|
||||
| host |
|
||||
| : |
|
||||
'---------------------------'
|
||||
....
|
||||
|
||||
In this setup, even though VLAN 10 is allowed to ingress and egress on
|
||||
both `a` and `b`, _bridging_ of packets from one to the other must
|
||||
_not_ be allowed.
|
||||
both `data0` and `data1`, _bridging_ of packets from one to the other
|
||||
must _not_ be allowed.
|
||||
|
||||
"""
|
||||
import infamy
|
||||
|
||||
with infamy.Test() as test:
|
||||
with test.step("Set up topology and attach to dut"):
|
||||
with test.step("Set up topology and attach to target"):
|
||||
env = infamy.Env()
|
||||
dut = env.attach("dut", "mgmt")
|
||||
tgt = env.attach("target", "mgmt")
|
||||
|
||||
with test.step("Configure bridge and VLAN interfaces on dut"):
|
||||
_, hporta = env.ltop.xlate("host", "a")
|
||||
_, hportb = env.ltop.xlate("host", "b")
|
||||
_, dporta = env.ltop.xlate( "dut", "a")
|
||||
_, dportb = env.ltop.xlate( "dut", "b")
|
||||
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")
|
||||
_, ddata1 = env.ltop.xlate("target", "data1")
|
||||
|
||||
dut.put_config_dicts({
|
||||
tgt.put_config_dicts({
|
||||
"ietf-interfaces": {
|
||||
"interfaces": {
|
||||
"interface": [
|
||||
@@ -51,25 +53,25 @@ with infamy.Test() as test:
|
||||
"vlan": [
|
||||
{
|
||||
"vid": 1,
|
||||
"untagged": [dporta, dportb]
|
||||
"untagged": [ddata0, ddata1]
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": dporta,
|
||||
"name": ddata0,
|
||||
"infix-interfaces:bridge-port": {
|
||||
"pvid": 1,
|
||||
"bridge": "br0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": f"{dporta}.10",
|
||||
"name": f"{ddata0}.10",
|
||||
"type": "infix-if-type:vlan",
|
||||
"vlan": {
|
||||
"id": 10,
|
||||
"lower-layer-if": dporta,
|
||||
"lower-layer-if": ddata0,
|
||||
},
|
||||
"ipv4": {
|
||||
"address": [
|
||||
@@ -81,18 +83,18 @@ with infamy.Test() as test:
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": dportb,
|
||||
"name": ddata1,
|
||||
"infix-interfaces:bridge-port": {
|
||||
"pvid": 1,
|
||||
"bridge": "br0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": f"{dportb}.10",
|
||||
"name": f"{ddata1}.10",
|
||||
"type": "infix-if-type:vlan",
|
||||
"vlan": {
|
||||
"id": 10,
|
||||
"lower-layer-if": dportb,
|
||||
"lower-layer-if": ddata1,
|
||||
},
|
||||
"ipv4": {
|
||||
"address": [
|
||||
@@ -108,35 +110,35 @@ with infamy.Test() as test:
|
||||
}
|
||||
})
|
||||
|
||||
with infamy.IsolatedMacVlan(hporta) as nsa, \
|
||||
infamy.IsolatedMacVlan(hportb) as nsb:
|
||||
with infamy.IsolatedMacVlan(hdata0) as ns0, \
|
||||
infamy.IsolatedMacVlan(hdata1) as ns1:
|
||||
|
||||
with test.step("Configure IP addresses and VLAN interfaces on host"):
|
||||
nsa.addip("10.0.1.1")
|
||||
nsa.runsh("""
|
||||
ns0.addip("10.0.1.1")
|
||||
ns0.runsh("""
|
||||
set -ex
|
||||
ip link add dev vlan10 link iface up type vlan id 10
|
||||
ip addr add 10.10.1.1/24 dev vlan10
|
||||
""")
|
||||
|
||||
nsb.addip("10.0.1.2")
|
||||
nsb.runsh("""
|
||||
ns1.addip("10.0.1.2")
|
||||
ns1.runsh("""
|
||||
set -ex
|
||||
ip link add dev vlan10 link iface up type vlan id 10
|
||||
ip addr add 10.10.2.1/24 dev vlan10
|
||||
""")
|
||||
|
||||
with test.step("Verify that host:a reaches host:b with untagged packets"):
|
||||
nsa.must_reach("10.0.1.2")
|
||||
with test.step("Verify that host:data0 reaches host:data1 with untagged packets"):
|
||||
ns0.must_reach("10.0.1.2")
|
||||
|
||||
with test.step("Verify that traffic on VLAN 10 from host:a does not reach host:b"):
|
||||
infamy.parallel(lambda: nsa.runsh("timeout -s INT 5 ping -i 0.2 -b 10.10.1.255 || true"),
|
||||
lambda: nsb.must_not_receive("ip src 10.10.1.1"))
|
||||
with test.step("Verify that traffic on VLAN 10 from host:data0 does not reach host:data1"):
|
||||
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:a can reach dut on VLAN 10"):
|
||||
nsa.must_reach("10.10.1.2")
|
||||
with test.step("Verify that host:data0 can reach target on VLAN 10"):
|
||||
ns0.must_reach("10.10.1.2")
|
||||
|
||||
with test.step("Verify that host:b can reach dut on VLAN 10"):
|
||||
nsb.must_reach("10.10.2.2")
|
||||
with test.step("Verify that host:data1 can reach target on VLAN 10"):
|
||||
ns1.must_reach("10.10.2.2")
|
||||
|
||||
test.succeed()
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
graph "vlan-iface-termination" {
|
||||
layout="neato";
|
||||
overlap="false";
|
||||
esep="+22";
|
||||
|
||||
node [shape=record, fontname="DejaVu Sans Mono, Book"];
|
||||
edge [color="cornflowerblue", penwidth="2", fontname="DejaVu Serif, Book"];
|
||||
|
||||
host [
|
||||
label="host | { <mgmt> mgmt | <a> a | <b> b }",
|
||||
pos="0,0!",
|
||||
kind="controller",
|
||||
];
|
||||
|
||||
dut [
|
||||
label="{ <mgmt> mgmt | <a> a | <b> b } | dut",
|
||||
pos="6,0!",
|
||||
kind="infix",
|
||||
];
|
||||
|
||||
host:mgmt -- dut:mgmt [kind=mgmt, color="lightgray"]
|
||||
host:a -- dut:a
|
||||
host:b -- dut:b
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
../../../infamy/topologies/1x3.dot
|
||||
@@ -2,50 +2,50 @@
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
||||
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
|
||||
<!-- Title: vlan-iface-termination Pages: 1 -->
|
||||
<svg width="254pt" height="78pt"
|
||||
viewBox="0.00 0.00 254.02 78.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Title: 1x3 Pages: 1 -->
|
||||
<svg width="440pt" height="78pt"
|
||||
viewBox="0.00 0.00 440.03 78.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 74)">
|
||||
<title>vlan-iface-termination</title>
|
||||
<polygon fill="white" stroke="transparent" points="-4,4 -4,-74 250.02,-74 250.02,4 -4,4"/>
|
||||
<title>1x3</title>
|
||||
<polygon fill="white" stroke="transparent" points="-4,4 -4,-74 436.03,-74 436.03,4 -4,4"/>
|
||||
<!-- host -->
|
||||
<g id="node1" class="node">
|
||||
<title>host</title>
|
||||
<polygon fill="none" stroke="black" points="0,-0.5 0,-69.5 100,-69.5 100,-0.5 0,-0.5"/>
|
||||
<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="75" y="-54.3" font-family="DejaVu Sans Mono, Book" font-size="14.00">mgmt</text>
|
||||
<polyline fill="none" stroke="black" points="50,-46.5 100,-46.5 "/>
|
||||
<text text-anchor="middle" x="75" y="-31.3" font-family="DejaVu Sans Mono, Book" font-size="14.00">a</text>
|
||||
<polyline fill="none" stroke="black" points="50,-23.5 100,-23.5 "/>
|
||||
<text text-anchor="middle" x="75" y="-8.3" font-family="DejaVu Sans Mono, Book" font-size="14.00">b</text>
|
||||
<text text-anchor="middle" x="79" y="-54.3" font-family="DejaVu Sans Mono, Book" font-size="14.00">tgt</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>
|
||||
<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>
|
||||
</g>
|
||||
<!-- dut -->
|
||||
<!-- target -->
|
||||
<g id="node2" class="node">
|
||||
<title>dut</title>
|
||||
<polygon fill="none" stroke="black" points="155.02,-0.5 155.02,-69.5 246.02,-69.5 246.02,-0.5 155.02,-0.5"/>
|
||||
<text text-anchor="middle" x="180.02" y="-54.3" font-family="DejaVu Sans Mono, Book" font-size="14.00">mgmt</text>
|
||||
<polyline fill="none" stroke="black" points="155.02,-46.5 205.02,-46.5 "/>
|
||||
<text text-anchor="middle" x="180.02" y="-31.3" font-family="DejaVu Sans Mono, Book" font-size="14.00">a</text>
|
||||
<polyline fill="none" stroke="black" points="155.02,-23.5 205.02,-23.5 "/>
|
||||
<text text-anchor="middle" x="180.02" y="-8.3" font-family="DejaVu Sans Mono, Book" font-size="14.00">b</text>
|
||||
<polyline fill="none" stroke="black" points="205.02,-0.5 205.02,-69.5 "/>
|
||||
<text text-anchor="middle" x="225.52" y="-31.3" font-family="DejaVu Sans Mono, Book" font-size="14.00">dut</text>
|
||||
<title>target</title>
|
||||
<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>
|
||||
<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>
|
||||
<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--dut -->
|
||||
<!-- host--target -->
|
||||
<g id="edge1" class="edge">
|
||||
<title>host:mgmt--dut:mgmt</title>
|
||||
<path fill="none" stroke="lightgray" stroke-width="2" d="M100,-58C100,-58 154.52,-58 154.52,-58"/>
|
||||
<title>host:tgt--target:mgmt</title>
|
||||
<path fill="none" stroke="cornflowerblue" stroke-width="2" d="M108,-58C108,-58 308.03,-58 308.03,-58"/>
|
||||
</g>
|
||||
<!-- host--dut -->
|
||||
<!-- host--target -->
|
||||
<g id="edge2" class="edge">
|
||||
<title>host:a--dut:a</title>
|
||||
<path fill="none" stroke="cornflowerblue" stroke-width="2" d="M100,-35C100,-35 154.52,-35 154.52,-35"/>
|
||||
<title>host:data0--target:data0</title>
|
||||
<path fill="none" stroke="black" stroke-width="2" d="M108,-35C108,-35 308.03,-35 308.03,-35"/>
|
||||
</g>
|
||||
<!-- host--dut -->
|
||||
<!-- host--target -->
|
||||
<g id="edge3" class="edge">
|
||||
<title>host:b--dut:b</title>
|
||||
<path fill="none" stroke="cornflowerblue" stroke-width="2" d="M100,-12C100,-12 154.52,-12 154.52,-12"/>
|
||||
<title>host:data1--target:data1</title>
|
||||
<path fill="none" stroke="black" stroke-width="2" d="M108,-12C108,-12 308.03,-12 308.03,-12"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
Reference in New Issue
Block a user