Skip to content

Commit

Permalink
test: case: interfaces: Adapt tests to fit the test specification
Browse files Browse the repository at this point in the history
Mostly text fixes but major rewrite in some tests.
  • Loading branch information
mattiaswal committed Sep 24, 2024
1 parent 9de9402 commit bf058d3
Show file tree
Hide file tree
Showing 35 changed files with 215 additions and 168 deletions.
25 changes: 23 additions & 2 deletions test/case/ietf_interfaces/Readme.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,27 @@ include::ipv6_address/Readme.adoc[]

include::iface_phys_address/Readme.adoc[]

include::iface_status/Readme.adoc[]

include::routing_basic/Readme.adoc[]

include::bridge_basic/Readme.adoc[]

include::bridge_fwd_dual_dut/Readme.adoc[]

include::bridge_fwd_sgl_dut/Readme.adoc[]

include::bridge_veth/Readme.adoc[]

include::bridge_vlan/Readme.adoc[]

include::bridge_vlan_separation/Readme.adoc[]

include::dual_bridge/Readme.adoc[]

include::igmp_basic/Readme.adoc[]

include::igmp_vlan/Readme.adoc[]

include::static_multicast_filters/Readme.adoc[]

include::vlan_qos/Readme.adoc[]

2 changes: 1 addition & 1 deletion test/case/ietf_interfaces/bridge_basic/Readme.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ endif::topdoc[]
==== Test sequence
. Initialize
. Configure single bridge with a single physical port, bridge @ IP 10.0.0.2
. Ping bridge 10.0.0.2 from host:data with IP 10.0.0.1
. Verify ping 10.0.0.2 is possible from host:data


<<<
Expand Down
2 changes: 1 addition & 1 deletion test/case/ietf_interfaces/bridge_basic/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
}
})

with test.step("Ping bridge 10.0.0.2 from host:data with IP 10.0.0.1"):
with test.step("Verify ping 10.0.0.2 is possible from host:data"):
_, hport = env.ltop.xlate("host", "data")

with infamy.IsolatedMacVlan(hport) as ns:
Expand Down
4 changes: 2 additions & 2 deletions test/case/ietf_interfaces/bridge_basic/topology.dot
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ graph "1x2" {
];

target [
label="{ <mgmt> mgmt | <data> data } | target",
label="{ <mgmt> mgmt | <data> data } | target\n10.0.0.2/24 (br0)",
pos="10,12!",

kind="infix",
];

host:tgt -- target:mgmt [kind=mgmt]
host:data -- target:data [color=black, fontcolor=black, taillabel="10.0.0.1/24", headlabel="10.0.0.2/24"]
host:data -- target:data [color=black, fontcolor=black, taillabel="10.0.0.1/24"]
}
Binary file modified test/case/ietf_interfaces/bridge_basic/topology.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions test/case/ietf_interfaces/bridge_fwd_dual_dut/Readme.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
=== Bridge forwarding dual DUTs
==== Description
Ping through both DUTs using bridged ports.
Ping through two bridges on two different DUTs,

==== Topology
ifdef::topdoc[]
Expand All @@ -17,7 +17,7 @@ endif::topdoc[]
==== Test sequence
. Initialize
. Configure a bridge with triple physical port
. Ping host:data20 [10.0.0.3] and host:data21 [10.0.0.4]from host:data11 [10.0.0.2]
. Verify ping 10.0.0.3 and 10.0.0.4 from host:data11


<<<
Expand Down
5 changes: 2 additions & 3 deletions test/case/ietf_interfaces/bridge_fwd_dual_dut/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"""
Bridge forwarding dual DUTs
Ping through both DUTs using bridged ports.
Ping through two bridges on two different DUTs,
"""
import infamy

Expand Down Expand Up @@ -118,8 +118,7 @@
}
})

with test.step("Ping host:data20 [10.0.0.3] and host:data21 [10.0.0.4]"\
"from host:data11 [10.0.0.2]"):
with test.step("Verify ping 10.0.0.3 and 10.0.0.4 from host:data11"):

_, hport11 = env.ltop.xlate("host", "data11")
_, hport20 = env.ltop.xlate("host", "data20")
Expand Down
4 changes: 2 additions & 2 deletions test/case/ietf_interfaces/bridge_fwd_sgl_dut/Readme.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
=== Bridge forwarding single DUTs
==== Description
Tests forwarding through a DUT with two bridged interfaces
Tests forwarding through a DUT with two bridged interfaces on one DUT.

==== Topology
ifdef::topdoc[]
Expand All @@ -17,7 +17,7 @@ endif::topdoc[]
==== Test sequence
. Initialize
. Configure a bridge with dual physical port
. Ping host:data1 [10.0.0.2] from host:data0 [10.0.0.1]
. Verify ping from host:data0 to 10.0.0.1


<<<
Expand Down
4 changes: 2 additions & 2 deletions test/case/ietf_interfaces/bridge_fwd_sgl_dut/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"""
Bridge forwarding single DUTs
Tests forwarding through a DUT with two bridged interfaces
Tests forwarding through a DUT with two bridged interfaces on one DUT.
"""
import infamy

Expand Down Expand Up @@ -56,7 +56,7 @@
}
})

with test.step("Ping host:data1 [10.0.0.2] from host:data0 [10.0.0.1]"):
with test.step("Verify ping from host:data0 to 10.0.0.1"):
_, hport0 = env.ltop.xlate("host", "data0")
_, hport1 = env.ltop.xlate("host", "data1")

Expand Down
6 changes: 3 additions & 3 deletions test/case/ietf_interfaces/bridge_veth/Readme.adoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
=== Bridge with a physical port and a veth
==== Description
This tests the possibility to add software added ports, in this case
veth and bridge it with a physical port
This tests the possibility to add software added interfaces, in this case
VETH and bridge it with a physical interface

==== Topology
ifdef::topdoc[]
Expand All @@ -18,7 +18,7 @@ endif::topdoc[]
==== Test sequence
. Initialize
. Configure bridged eth port and veth pair with IP 10.0.0.2
. Ping other end of bridged veth pair on 10.0.0.2 from host:data with IP 10.0.0.1
. Verify ping from host:data to 10.0.0.2


<<<
Expand Down
6 changes: 3 additions & 3 deletions test/case/ietf_interfaces/bridge_veth/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"""
Bridge with a physical port and a veth
This tests the possibility to add software added ports, in this case
veth and bridge it with a physical port
This tests the possibility to add software added interfaces, in this case
VETH and bridge it with a physical interface
"""
import infamy

Expand Down Expand Up @@ -66,7 +66,7 @@
}
})

with test.step("Ping other end of bridged veth pair on 10.0.0.2 from host:data with IP 10.0.0.1"):
with test.step("Verify ping from host:data to 10.0.0.2"):
_, hport = env.ltop.xlate("host", "data")

with infamy.IsolatedMacVlan(hport) as ns:
Expand Down
5 changes: 2 additions & 3 deletions test/case/ietf_interfaces/bridge_vlan/Readme.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ image::topology.png[Bridge VLAN topology]
endif::testgroup[]
endif::topdoc[]
==== Test sequence
. Initialize
. Topology setup
. Connectivity check
. Configure DUTs
. Verify ping from host:data1 to 10.0.0.2 and 10.0.0.3


<<<
Expand Down
5 changes: 2 additions & 3 deletions test/case/ietf_interfaces/bridge_vlan/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@
import infamy

with infamy.Test() as test:
with test.step("Initialize"):
with test.step("Configure DUTs"):
env = infamy.Env()
dut1 = env.attach("dut1", "mgmt")
dut2 = env.attach("dut2", "mgmt")

with test.step("Topology setup"):
_, dut1_e0 = env.ltop.xlate("dut1", "data")
_, dut1_e1 = env.ltop.xlate("dut1", "to_dut2")
_, dut2_e0 = env.ltop.xlate("dut2", "to_dut1")
Expand Down Expand Up @@ -118,7 +117,7 @@
}
})

with test.step("Connectivity check"):
with test.step("Verify ping from host:data1 to 10.0.0.2 and 10.0.0.3"):
_, hport = env.ltop.xlate("host", "data1")

with infamy.IsolatedMacVlan(hport) as ns:
Expand Down
8 changes: 5 additions & 3 deletions test/case/ietf_interfaces/bridge_vlan_separation/Readme.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
=== Bridge VLAN separation
==== Description
Test that two VLAN is correctly separaretade in the bridge
Test that two VLAN is correctly separated in the bridge

==== Topology
ifdef::topdoc[]
Expand All @@ -16,8 +16,10 @@ endif::testgroup[]
endif::topdoc[]
==== Test sequence
. Initialize
. Configure a bridge with triple physical port
. Ping host:data20 [10.0.0.3] from host:data10 [10.0.0.1] through <bridge-vlan-10> and host:data21 [10.0.0.4] from host:data11 [10.0.0.2] through <bridge-vlan-20>
. Configure DUTs
. Verify ing 10.0.0.3 from host:data10
. Verify ing 10.0.0.4 from host:data11
. Verify ping not possible host:data10->10.0.0.4, host:data11->10.0.0.3, host:data10->10.0.0.2, host:data11->10.0.0.1


<<<
Expand Down
34 changes: 18 additions & 16 deletions test/case/ietf_interfaces/bridge_vlan_separation/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"""
Bridge VLAN separation
Test that two VLAN is correctly separaretade in the bridge
Test that two VLAN is correctly separated in the bridge
"""
import infamy

Expand All @@ -27,7 +27,7 @@
dut1 = env.attach("dut1", "mgmt")
dut2 = env.attach("dut2", "mgmt")

with test.step("Configure a bridge with triple physical port"):
with test.step("Configure DUTs"):
_, tport10 = env.ltop.xlate("dut1", "data0")
_, tport11 = env.ltop.xlate("dut1", "data1")
_, tport12 = env.ltop.xlate("dut1", "data2")
Expand Down Expand Up @@ -137,27 +137,29 @@
}
})

with test.step("Ping host:data20 [10.0.0.3] from host:data10 [10.0.0.1] through <bridge-vlan-10>" \
" and host:data21 [10.0.0.4] from host:data11 [10.0.0.2] through <bridge-vlan-20>"):

_, hport10 = env.ltop.xlate("host", "data10")
_, hport11 = env.ltop.xlate("host", "data11")
_, hport20 = env.ltop.xlate("host", "data20")
_, hport21 = env.ltop.xlate("host", "data21")
_, hport10 = env.ltop.xlate("host", "data10")
_, hport11 = env.ltop.xlate("host", "data11")
_, hport20 = env.ltop.xlate("host", "data20")
_, hport21 = env.ltop.xlate("host", "data21")

with infamy.IsolatedMacVlan(hport10) as ns10, \
infamy.IsolatedMacVlan(hport11) as ns11, \
infamy.IsolatedMacVlan(hport20) as ns20, \
infamy.IsolatedMacVlan(hport21) as ns21:
with infamy.IsolatedMacVlan(hport10) as ns10, \
infamy.IsolatedMacVlan(hport11) as ns11, \
infamy.IsolatedMacVlan(hport20) as ns20, \
infamy.IsolatedMacVlan(hport21) as ns21:

ns10.addip("10.0.0.1")
ns11.addip("10.0.0.2")
ns20.addip("10.0.0.3")
ns21.addip("10.0.0.4")
ns10.addip("10.0.0.1")
ns11.addip("10.0.0.2")
ns20.addip("10.0.0.3")
ns21.addip("10.0.0.4")

with test.step("Verify ing 10.0.0.3 from host:data10"):
ns10.must_reach("10.0.0.3")

with test.step("Verify ing 10.0.0.4 from host:data11"):
ns11.must_reach("10.0.0.4")

with test.step("Verify ping not possible host:data10->10.0.0.4, host:data11->10.0.0.3, host:data10->10.0.0.2, host:data11->10.0.0.1"):
infamy.parallel(lambda: ns10.must_not_reach("10.0.0.4"),
lambda: ns11.must_not_reach("10.0.0.3"),
lambda: ns10.must_not_reach("10.0.0.2"),
Expand Down
4 changes: 2 additions & 2 deletions test/case/ietf_interfaces/dual_bridge/Readme.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
=== Dual bridges
==== Description
Test that it is possible to ping a bridge through a bridge to another bridge
Test that it is possible to ping a bridge through a bridge to another bridge with VETH interfaces.

==== Topology
ifdef::topdoc[]
Expand All @@ -17,7 +17,7 @@ endif::topdoc[]
==== Test sequence
. Initialize
. Configure two bridges linked with a veth pair furthest bridge has IP 10.0.0.2
. Ping furthest bridge 10.0.0.2 from host:data with IP 10.0.0.1
. Verify ping from host:data to 10.0.0.2


<<<
Expand Down
4 changes: 2 additions & 2 deletions test/case/ietf_interfaces/dual_bridge/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"""
Dual bridges
Test that it is possible to ping a bridge through a bridge to another bridge
Test that it is possible to ping a bridge through a bridge to another bridge with VETH interfaces.
"""
import infamy

Expand Down Expand Up @@ -73,7 +73,7 @@
}
})

with test.step("Ping furthest bridge 10.0.0.2 from host:data with IP 10.0.0.1"):
with test.step("Verify ping from host:data to 10.0.0.2"):
_, hport = env.ltop.xlate("host", "data")

with infamy.IsolatedMacVlan(hport) as ns:
Expand Down
Binary file modified test/case/ietf_interfaces/dual_bridge/topology.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions test/case/ietf_interfaces/iface_phys_address/Readme.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
=== Custom MAC address on interface
==== Description
Test possibility to set mac address
Test possibility to set and remove custom mac address on interfaces

==== Topology
ifdef::topdoc[]
Expand All @@ -16,7 +16,9 @@ endif::testgroup[]
endif::topdoc[]
==== Test sequence
. Initialize
. Set custom MAC address
. Set custom MAC address to '02:01:00:c0:ff:ee' on target:mgmt
. Verify target:mgmt has MAC address '02:01:00:c0:ff:ee'
. Verify that target:mgmt has its origil MAC address again


<<<
Expand Down
10 changes: 7 additions & 3 deletions test/case/ietf_interfaces/iface_phys_address/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""
Custom MAC address on interface
Test possibility to set mac address
Test possibility to set and remove custom mac address on interfaces
"""
import copy
import infamy
Expand All @@ -19,7 +19,8 @@
cmac = "02:01:00:c0:ff:ee"
print(f"Target iface {tport} original mac {pmac}")

with test.step("Set custom MAC address"):
with test.step("Set custom MAC address to '02:01:00:c0:ff:ee' on target:mgmt"):
print(f"Intitial MAC address: {pmac}")
config = {
"interfaces": {
"interface": [{
Expand All @@ -29,14 +30,17 @@
}
}
target.put_config_dict("ietf-interfaces", config)

with test.step("Verify target:mgmt has MAC address '02:01:00:c0:ff:ee'"):
mac = iface.get_phys_address(target, tport)
print(f"Target iface {tport} current mac: {mac}")
assert mac == cmac

with test.step(f"Remove custom MAC address"):
with test.step(f"Remove custom MAC address '02:01:00:c0:ff:ee'"):
xpath=iface.get_iface_xpath(tport, "phys-address")
target.delete_xpath(xpath)

with test.step("Verify that target:mgmt has its origil MAC address again"):
until(lambda: iface.get_phys_address(target, tport) == pmac)

test.succeed()
9 changes: 5 additions & 4 deletions test/case/ietf_interfaces/igmp_basic/Readme.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ endif::topdoc[]
==== Test sequence
. Initialize
. Configure device
. Setup sender and receivers
. Verify that the group is flooded on all ports
. Verify that the group is still forwarded to the member
. Verify that the group is no longer forwarded to the non-member
. Start multicast sender on host:data0, group 224.1.1.1
. Verify that the group 224.1.1.1 is flooded on host:data1 and host:data2
. Join multicast group 224.1.1.1 on host:data1
. Verify group 224.1.1.1 is received on host:data1
. Verify that the group 224.1.1.1 is no longer received to host:data2


<<<
Expand Down
Loading

0 comments on commit bf058d3

Please sign in to comment.