diff --git a/test/case/ietf_interfaces/iface_phys_address/test.py b/test/case/ietf_interfaces/iface_phys_address/test.py index b20bd87b..c6a7d27a 100755 --- a/test/case/ietf_interfaces/iface_phys_address/test.py +++ b/test/case/ietf_interfaces/iface_phys_address/test.py @@ -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() diff --git a/test/case/ietf_interfaces/vlan_qos/Readme.adoc b/test/case/ietf_interfaces/vlan_qos/Readme.adoc index 9a287cab..48336897 100644 --- a/test/case/ietf_interfaces/vlan_qos/Readme.adoc +++ b/test/case/ietf_interfaces/vlan_qos/Readme.adoc @@ -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 <<< diff --git a/test/case/ietf_interfaces/vlan_qos/test.py b/test/case/ietf_interfaces/vlan_qos/test.py index 735bff1a..4d3ca19c 100755 --- a/test/case/ietf_interfaces/vlan_qos/test.py +++ b/test/case/ietf_interfaces/vlan_qos/test.py @@ -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() diff --git a/test/case/ietf_interfaces/vlan_qos/topology.dot b/test/case/ietf_interfaces/vlan_qos/topology.dot index cb48acb3..5874d342 100644 --- a/test/case/ietf_interfaces/vlan_qos/topology.dot +++ b/test/case/ietf_interfaces/vlan_qos/topology.dot @@ -7,7 +7,7 @@ graph "1x3" { edge [color="cornflowerblue", penwidth="2"]; host [ - label="host | { tgt | data0 | data1 }", + label="host | { mgmt | data0 | 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)"] } \ No newline at end of file diff --git a/test/case/ietf_interfaces/vlan_qos/topology.png b/test/case/ietf_interfaces/vlan_qos/topology.png index 60ac74fe..cab51133 100644 Binary files a/test/case/ietf_interfaces/vlan_qos/topology.png and b/test/case/ietf_interfaces/vlan_qos/topology.png differ diff --git a/test/case/ietf_syslog/remote/Readme.adoc b/test/case/ietf_syslog/remote/Readme.adoc index b16f57be..59fb03b5 100644 --- a/test/case/ietf_syslog/remote/Readme.adoc +++ b/test/case/ietf_syslog/remote/Readme.adoc @@ -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 diff --git a/test/case/ietf_syslog/remote/test.py b/test/case/ietf_syslog/remote/test.py index f01c1abb..0d25cd8f 100755 --- a/test/case/ietf_syslog/remote/test.py +++ b/test/case/ietf_syslog/remote/test.py @@ -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") diff --git a/test/case/ietf_syslog/remote/topology.dot b/test/case/ietf_syslog/remote/topology.dot index 36df1c80..0e61e731 100644 --- a/test/case/ietf_syslog/remote/topology.dot +++ b/test/case/ietf_syslog/remote/topology.dot @@ -7,13 +7,13 @@ graph "2x2" { edge [color="cornflowerblue", penwidth="2"]; host [ - label="host | { client_mgmt | server_mgmt }", + label="host | { mgmt1 | mgmt2 }", pos="0,12!", kind="controller", ]; client [ - label="{ mgmt | ĺink} | client", + label="{ mgmt | 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"] } diff --git a/test/case/ietf_syslog/remote/topology.png b/test/case/ietf_syslog/remote/topology.png index b222d636..7ec808ac 100644 Binary files a/test/case/ietf_syslog/remote/topology.png and b/test/case/ietf_syslog/remote/topology.png differ