Updating test specs to have consistent formatting

This commit is contained in:
Jon-Olov Vatn
2024-10-17 15:11:19 +02:00
parent 272a7c1e69
commit d3b28339c1
9 changed files with 80 additions and 28 deletions
@@ -27,7 +27,7 @@ def calc_mac(base_mac, mac_offset):
return ':'.join(f'{x:02x}' for x in result)
def reset_mac(tgt, port, mac):
def reset_mac(tgt, port):
"""Reset DUT interface MAC address to default."""
node = "infix-interfaces:custom-phys-address"
xpath = iface.get_xpath(port, node)
@@ -69,10 +69,10 @@ with infamy.Test() as test:
assert mac == STATIC
with test.step("Reset target:data MAC address to default"):
reset_mac(target, tport, pmac)
reset_mac(target, tport)
with test.step("Verify target:data MAC address is reset to default"):
until(lambda: iface.get_phys_address(tgt, tport) == mac)
until(lambda: iface.get_phys_address(target, tport) == pmac)
with test.step("Set target:data to chassis MAC"):
config = {
@@ -115,10 +115,10 @@ with infamy.Test() as test:
assert mac == BMAC
with test.step("Reset target:data MAC address to default"):
reset_mac(target, tport, pmac)
reset_mac(target, tport)
with test.step("Verify target:data MAC address is reset to default"):
until(lambda: iface.get_phys_address(tgt, tport) == mac)
until(lambda: iface.get_phys_address(target, tport) == pmac)
test.succeed()
+23 -6
View File
@@ -1,24 +1,41 @@
=== VLAN QoS
=== VLAN Interface Ingress/Egress QoS
==== Description
Inject different packets from the host and verify that the VLAN priority
is handled correctly
is handled correctly for traffic ingressing and egressing a VLAN interface.
The test verifies that ingress PCP priority is mapped correctly to internal
priority ('from pcp' or static '0..7'), and that internal priority is mapped
correctly to PCP on egress ('from internal priority' or static '0..7').
{ "id": 1, "pcp": 0, "ingress": 0, "egress": 0, "expect": 0 },
{ "id": 2, "pcp": 0, "ingress": 0, "egress": 1, "expect": 1 },
{ "id": 3, "pcp": 0, "ingress": 3, "egress": 0, "expect": 0 },
{ "id": 4, "pcp": 0, "ingress": 4, "egress": "from-priority", "expect": 4 },
{ "id": 5, "pcp": 5, "ingress": "from-pcp", "egress": "from-priority", "expect": 5 },
{ "id": 6, "pcp": 6, "ingress": "from-pcp", "egress": "from-priority", "expect": 6 },
==== Topology
ifdef::topdoc[]
image::../../test/case/ietf_interfaces/vlan_qos/topology.png[VLAN QoS topology]
image::../../test/case/ietf_interfaces/vlan_qos/topology.png[VLAN Interface Ingress/Egress QoS topology]
endif::topdoc[]
ifndef::topdoc[]
ifdef::testgroup[]
image::vlan_qos/topology.png[VLAN QoS topology]
image::vlan_qos/topology.png[VLAN Interface Ingress/Egress QoS topology]
endif::testgroup[]
ifndef::testgroup[]
image::topology.png[VLAN QoS topology]
image::topology.png[VLAN Interface Ingress/Egress QoS topology]
endif::testgroup[]
endif::topdoc[]
==== Test sequence
. Initialize
. Set up topology and attach to target DUT
. Apply initial config without priority mapping
. Setup host VLANs
. Verify that packet with id=1 egressed with pcp=0
. Verify that packet with id=2 egressed with pcp=1
. Verify that packet with id=3 egressed with pcp=0
. Verify that packet with id=4 egressed with pcp=4
. Verify that packet with id=5 egressed with pcp=5
. Verify that packet with id=6 egressed with pcp=6
<<<
+44 -9
View File
@@ -15,10 +15,23 @@
# where the tag priority is snooped, with different combinations of
# pcp<->priority mappings and verify the results.
"""
VLAN QoS
VLAN Interface Ingress/Egress QoS
Inject different packets from the host and verify that the VLAN priority
is handled correctly
is handled correctly for traffic ingressing and egressing a VLAN interface.
The test verifies that ingress PCP priority is mapped correctly to internal
priority ('from pcp' or static '0..7'), and that internal priority is mapped
correctly to PCP on egress ('from internal priority' or static '0..7').
{ "id": 1, "pcp": 0, "ingress": 0, "egress": 0, "expect": 0 },
{ "id": 2, "pcp": 0, "ingress": 0, "egress": 1, "expect": 1 },
{ "id": 3, "pcp": 0, "ingress": 3, "egress": 0, "expect": 0 },
{ "id": 4, "pcp": 0, "ingress": 4, "egress": "from-priority", "expect": 4 },
{ "id": 5, "pcp": 5, "ingress": "from-pcp", "egress": "from-priority", "expect": 5 },
{ "id": 6, "pcp": 6, "ingress": "from-pcp", "egress": "from-priority", "expect": 6 },
"""
import infamy
@@ -34,8 +47,14 @@ PACKETS = (
{ "id": 6, "pcp": 6, "ingress": "from-pcp", "egress": "from-priority", "expect": 6 },
)
def verify_priority_mapping(p):
expect = f"192.168.10.2 > 192.168.11.2: ICMP echo request, id {p['id']}"
assert expect in packets, f"Missing id={p['id']}"
expect = f"vlan 11, p {p['expect']}, ethertype IPv4 (0x0800), " + expect
assert expect in packets, f"PCP mismatch for id={p['id']}"
with infamy.Test() as test:
with test.step("Initialize"):
with test.step("Set up topology and attach to target DUT"):
env = infamy.Env()
target = env.attach("target", "mgmt")
_, td0 = env.ltop.xlate("target", "data0")
@@ -143,12 +162,28 @@ with infamy.Test() as test:
packets = pcap.tcpdump("-e")
print(packets)
for p in PACKETS:
with test.step(f"Verify that id={p['id']} was received with pcp={p['expect']}"):
expect = f"192.168.10.2 > 192.168.11.2: ICMP echo request, id {p['id']}"
assert expect in packets, f"Missing id={p['id']}"
pkt=PACKETS[0]
with test.step ("Verify that packet with id=1 egressed with pcp=0"):
verify_priority_mapping(pkt)
expect = f"vlan 11, p {p['expect']}, ethertype IPv4 (0x0800), " + expect
assert expect in packets, f"PCP mismatch for id={p['id']}"
pkt=PACKETS[1]
with test.step ("Verify that packet with id=2 egressed with pcp=1"):
verify_priority_mapping(pkt)
pkt=PACKETS[2]
with test.step ("Verify that packet with id=3 egressed with pcp=0"):
verify_priority_mapping(pkt)
pkt=PACKETS[3]
with test.step ("Verify that packet with id=4 egressed with pcp=4"):
verify_priority_mapping(pkt)
pkt=PACKETS[4]
with test.step ("Verify that packet with id=5 egressed with pcp=5"):
verify_priority_mapping(pkt)
pkt=PACKETS[5]
with test.step ("Verify that packet with id=6 egressed with pcp=6"):
verify_priority_mapping(pkt)
test.succeed()
@@ -7,7 +7,7 @@ graph "1x3" {
edge [color="cornflowerblue", penwidth="2"];
host [
label="host | { <tgt> tgt | <data0> data0 | <data1> data1 }",
label="host | { <mgmt> mgmt | <data0> data0 | <data1> data1 }",
pos="0,12!",
kind="controller",
];
@@ -19,7 +19,7 @@ graph "1x3" {
kind="infix",
];
host:tgt -- target:mgmt [kind=mgmt]
host:mgmt -- target:mgmt [kind=mgmt, color=lightgrey]
host:data0 -- target:data0 [color=black, fontcolor=black, fontsize=12, taillabel="(vlan10) 192.168.10.2/24", headlabel="192.168.10.1/24 (vlan10)"]
host:data1 -- target:data1 [color=black, fontcolor=black, fontsize=12, taillabel="(vlan11) 192.168.11.2/24", headlabel="192.168.11.1/24 (vlan11)"]
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

+1 -1
View File
@@ -16,7 +16,7 @@ endif::testgroup[]
endif::topdoc[]
==== Test sequence
. Set up topology and attach to client and server DUTs
. Configure DUTs
. Configure client DUT as syslog client with server DUT as remote, and configure server DUT as syslog server
. Send security:notice log message from client
. Verify reception of client log message, incl. sorting to /log/security on server
+1 -1
View File
@@ -14,7 +14,7 @@ with infamy.Test() as test:
clientssh = env.attach("client", "mgmt", "ssh")
serverssh = env.attach("server", "mgmt", "ssh")
with test.step("Configure DUTs"):
with test.step("Configure client DUT as syslog client with server DUT as remote, and configure server DUT as syslog server"):
_, client_link = env.ltop.xlate("client", "link")
_, server_link = env.ltop.xlate("server", "link")
+4 -4
View File
@@ -7,13 +7,13 @@ graph "2x2" {
edge [color="cornflowerblue", penwidth="2"];
host [
label="host | { <client_mgmt> client_mgmt | <server_mgmt> server_mgmt }",
label="host | { <mgmt1> mgmt1 | <mgmt2> mgmt2 }",
pos="0,12!",
kind="controller",
];
client [
label="{ <mgmt> mgmt | <link> ĺink} | client",
label="{ <mgmt> mgmt | <link> link} | client",
pos="15,18!",
kind="infix",
@@ -24,7 +24,7 @@ graph "2x2" {
kind="infix",
];
host:cli_mgmt -- client:mgmt [kind=mgmt, color=lightgrey]
host:ser_mgmt -- server:mgmt [kind=mgmt, color=lightgrey]
host:mgmt1 -- client:mgmt [kind=mgmt, color=lightgrey]
host:mgmt2 -- server:mgmt [kind=mgmt, color=lightgrey]
client:link -- server:link [color=black, fontcolor=black, taillabel="10.0.0.2/24", headlabel="10.0.0.1/24"]
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 19 KiB