mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-23 14:24:34 +02:00
test(e2e): run every traffic checkpoint dual-stack (IPv6)
The live suite asserted the datapath over IPv4 only. Give every guest a ULA IPv6 address next to its v4 one and twin every v4 assertion point, sharing the impairment window (one filter application, both families asserted) so the runtime grows by minutes, not double. - harness: configure_ios(eth_ipv6=), ping() dispatches to `ping ipv6`, docker_bring_up_ipv6 (the Docker daemon leaves eth0 with disable_ipv6=1 on v6-less bridge networks, so the interfaces-file route cannot work), family-aware docker_wait_address, pcap_records scans every record (a leading DAD/MLD frame must not mask the sampled ethertype), and pcap_icmp_rtt measures the wire round trip from capture timestamps; - scenarios: connectivity/delay/suspend/isolation/churn checks in both families, captures assert 86dd next to 0800, the libpcap bpf drops are asserted family-selective (icmp vs icmp6, each killing its own family and leaving the other alive), the eBPF classifier modes on both families, marker v6 twins with an echo-specific expression (bare icmp6 also matches DAD/MLD and would break the exact counts), the v6 sharkd replay, and the link-local matrix gains the 86dd all-nodes row; serial (HDLC) legs stay v4-only; - the dynamips-emulated classic IOS under-reports its `ping ipv6` RTT by ~40 % of a delayed round trip (pcap-verified: the wire carries the v6 echo exchange in the same ~230 ms as v4 while the console reports ~130 ms), so the dynamips-family scenarios assert the v6 delay from the capture's own timestamps — recorded in tests/e2e/README.md. Full suite: 17 passed in 58m50s.
This commit is contained in:
11 files changed
+809
-105
No files matched your search
@@ -36,6 +36,12 @@ bridge, kernel filters, suspend and capture.
|
||||
``test_iol_docker_relay_control`` is the negative control on an isolated
|
||||
relay-configured instance: the same topology rides unix ↔ UDP through the
|
||||
uBridge relay (no anchors ever exist) and still pings.
|
||||
|
||||
Every checkpoint runs dual-stack: the IOS-XE guests carry a ULA v6 address
|
||||
next to their v4 one and each checkpoint pings both families — including
|
||||
the TAP-anchor bpf spot check (the libpcap expression is family-specific:
|
||||
each drop filter is asserted to kill its own family and leave the other
|
||||
alive) and the eBPF nth classifier (family-blind, asserted on both).
|
||||
"""
|
||||
|
||||
import re
|
||||
@@ -51,6 +57,10 @@ pytestmark = pytest.mark.e2e
|
||||
ETH = (0, 0)
|
||||
BOOT_TIMEOUT = 360
|
||||
|
||||
# the dual-stack half: a ULA mirroring 10.1.1.x
|
||||
R1_IP6 = "fd00:1:1::1"
|
||||
R2_IP6 = "fd00:1:1::2"
|
||||
|
||||
|
||||
def _pick_image(server):
|
||||
images = server.compute.docker_images()
|
||||
@@ -143,13 +153,17 @@ def test_iol_docker_kernel_datapath():
|
||||
harness.assert_forwarding(a1)
|
||||
harness.assert_forwarding(a2)
|
||||
|
||||
harness.configure_ios(c1, "R1", eth_ip="10.1.1.1", eth_if="Ethernet0/0")
|
||||
harness.configure_ios(c2, "R2", eth_ip="10.1.1.2", eth_if="Ethernet0/0")
|
||||
harness.configure_ios(c1, "R1", eth_ip="10.1.1.1", eth_if="Ethernet0/0", eth_ipv6=R1_IP6)
|
||||
harness.configure_ios(c2, "R2", eth_ip="10.1.1.2", eth_if="Ethernet0/0", eth_ipv6=R2_IP6)
|
||||
out = c1.run("show ip int brief")
|
||||
assert re.search(r"Ethernet0/0\s+10\.1\.1\.1\s+\S+\s+\S+\s+up\s+up", out), out
|
||||
out = c1.run("show ipv6 interface brief")
|
||||
assert R1_IP6.upper() in out.upper(), out # IOS prints v6 upper-case
|
||||
print(".. both routers configured, pinging through the port-bridge swap")
|
||||
baseline = harness.wait_ping(c1, "10.1.1.2")
|
||||
assert baseline["success"] == 100, baseline["raw"]
|
||||
baseline6 = harness.wait_ping(c1, R2_IP6)
|
||||
assert baseline6["success"] == 100, baseline6["raw"]
|
||||
|
||||
# L2-anchor spec §E.2: with the guests shut the anchors and the
|
||||
# per-link bridge stay silent for 5 s. These anchors come from
|
||||
@@ -163,6 +177,7 @@ def test_iol_docker_kernel_datapath():
|
||||
for console in (c1, c2):
|
||||
_eth_shutdown(console, shut=False)
|
||||
assert harness.wait_ping(c1, "10.1.1.2", attempts=5)["success"] == 100
|
||||
assert harness.wait_ping(c1, R2_IP6, attempts=5)["success"] == 100
|
||||
else:
|
||||
print(".. uBridge without link l2only: skipping the §E.2 assertion")
|
||||
|
||||
@@ -176,10 +191,15 @@ def test_iol_docker_kernel_datapath():
|
||||
delayed = harness.wait_ping(c1, "10.1.1.2")
|
||||
assert delayed["success"] == 100, delayed["raw"]
|
||||
assert delayed["avg"] >= 150, (baseline, delayed)
|
||||
delayed6 = harness.wait_ping(c1, R2_IP6)
|
||||
assert delayed6["success"] == 100, delayed6["raw"]
|
||||
assert delayed6["avg"] >= 150, (baseline6, delayed6)
|
||||
compute.call("PUT", f"/projects/{pid}/links/{lid}", {"filters": {}})
|
||||
assert "netem" not in harness.qdiscs(a1), harness.qdiscs(a1)
|
||||
fast = harness.wait_ping(c1, "10.1.1.2")
|
||||
assert fast["success"] == 100 and fast["avg"] < harness.FAST_RTT_MS, fast
|
||||
fast6 = harness.wait_ping(c1, R2_IP6)
|
||||
assert fast6["success"] == 100 and fast6["avg"] < harness.FAST_RTT_MS, fast6
|
||||
|
||||
# Classifier spot check on the container's TAP anchor (the Docker
|
||||
# suite runs the full matrix on veth host ends): cls_bpf match-drop
|
||||
@@ -187,7 +207,7 @@ def test_iol_docker_kernel_datapath():
|
||||
# same way.
|
||||
tc_caps = (caps or {}).get("ubridge_tc") or {}
|
||||
if tc_caps.get("cbpf"):
|
||||
print(".. bpf 'icmp' drops everything on the TAP anchor")
|
||||
print(".. bpf 'icmp' drops v4 ICMP only on the TAP anchor")
|
||||
compute.call("PUT", f"/projects/{pid}/links/{lid}", {"filters": {"bpf": ["icmp"]}})
|
||||
assert "clsact" in harness.qdiscs(a1) and "clsact" in harness.qdiscs(a2), (
|
||||
harness.qdiscs(a1),
|
||||
@@ -195,9 +215,18 @@ def test_iol_docker_kernel_datapath():
|
||||
)
|
||||
blocked = harness.ping(c1, "10.1.1.2", repeat=4)
|
||||
assert blocked["success"] == 0, blocked["raw"]
|
||||
v6_alive = harness.wait_ping(c1, R2_IP6)
|
||||
assert v6_alive["success"] == 100, v6_alive["raw"]
|
||||
print(".. bpf 'icmp6' drops v6 ICMP only on the TAP anchor")
|
||||
compute.call("PUT", f"/projects/{pid}/links/{lid}", {"filters": {"bpf": ["icmp6"]}})
|
||||
v4_alive = harness.wait_ping(c1, "10.1.1.2")
|
||||
assert v4_alive["success"] == 100, v4_alive["raw"]
|
||||
blocked6 = harness.ping(c1, R2_IP6, repeat=4)
|
||||
assert blocked6["success"] == 0, blocked6["raw"]
|
||||
compute.call("PUT", f"/projects/{pid}/links/{lid}", {"filters": {}})
|
||||
assert "clsact" not in harness.qdiscs(a1), harness.qdiscs(a1)
|
||||
assert harness.wait_ping(c1, "10.1.1.2")["success"] == 100
|
||||
assert harness.wait_ping(c1, R2_IP6)["success"] == 100
|
||||
else:
|
||||
print(".. uBridge reports no cbpf: skipping the bpf check")
|
||||
|
||||
@@ -210,8 +239,13 @@ def test_iol_docker_kernel_datapath():
|
||||
print(f".. {loss} % round-trip loss")
|
||||
# the kernel counts per direction: 1 - (2/3)^2 = 55.6 % round trip
|
||||
assert 20 <= loss <= 90, nth["raw"]
|
||||
nth6 = harness.ping(c1, R2_IP6, repeat=9)
|
||||
loss6 = 100 - nth6["success"]
|
||||
print(f".. {loss6} % round-trip loss (v6)")
|
||||
assert 20 <= loss6 <= 90, nth6["raw"]
|
||||
compute.call("PUT", f"/projects/{pid}/links/{lid}", {"filters": {}})
|
||||
assert harness.wait_ping(c1, "10.1.1.2")["success"] == 100
|
||||
assert harness.wait_ping(c1, R2_IP6)["success"] == 100
|
||||
else:
|
||||
print(".. uBridge reports no eBPF nth: skipping the frequency_drop check")
|
||||
|
||||
@@ -221,19 +255,25 @@ def test_iol_docker_kernel_datapath():
|
||||
assert not harness.tap_up(a1)
|
||||
dead = harness.ping(c1, "10.1.1.2", repeat=3)
|
||||
assert dead["success"] == 0, dead["raw"]
|
||||
dead6 = harness.ping(c1, R2_IP6, repeat=3)
|
||||
assert dead6["success"] == 0, dead6["raw"]
|
||||
compute.call("PUT", f"/projects/{pid}/links/{lid}", {"suspend": False})
|
||||
assert harness.tap_up(a1)
|
||||
assert harness.wait_ping(c1, "10.1.1.2")["success"] == 100
|
||||
assert harness.wait_ping(c1, R2_IP6)["success"] == 100
|
||||
|
||||
# capture: AF_PACKET on the anchor writes a real pcap
|
||||
# capture: AF_PACKET on the anchor writes a real pcap — both
|
||||
# families inside the window
|
||||
capture = compute.call("POST", f"/projects/{pid}/links/{lid}/capture/start", {"data_link_type": "DLT_EN10MB"})
|
||||
harness.ping(c1, "10.1.1.2")
|
||||
harness.ping(c1, R2_IP6)
|
||||
time.sleep(1)
|
||||
compute.call("POST", f"/projects/{pid}/links/{lid}/capture/stop")
|
||||
path = capture["capture_file_path"]
|
||||
count, ethertypes = harness.pcap_records(path)
|
||||
assert count >= 4, f"{path}: {count} records"
|
||||
assert count >= 8, f"{path}: {count} records"
|
||||
assert "0800" in ethertypes, (path, ethertypes)
|
||||
assert "86dd" in ethertypes, (path, ethertypes)
|
||||
|
||||
# delete / re-create the kernel link: the port bridge's TAP leg is
|
||||
# released (stop -> delete_nio_tap), the anchor survives (the node
|
||||
@@ -247,6 +287,7 @@ def test_iol_docker_kernel_datapath():
|
||||
bridge = harness.link_bridge_name(lid)
|
||||
assert link["kernel_datapath"] is True, link
|
||||
assert harness.wait_ping(c1, "10.1.1.2", attempts=5)["success"] == 100
|
||||
assert harness.wait_ping(c1, R2_IP6, attempts=5)["success"] == 100
|
||||
|
||||
# node stop: uBridge holds the anchor fds, so the port bridges go
|
||||
# first and the taps with them (a stopped container must not litter
|
||||
@@ -263,8 +304,9 @@ def test_iol_docker_kernel_datapath():
|
||||
c1 = _boot(server, pid, n1_id)
|
||||
assert harness.tap_exists(a1)
|
||||
assert harness.bridge_members(bridge) == sorted([a1, a2]), harness.bridge_members(bridge)
|
||||
harness.configure_ios(c1, "R1", eth_ip="10.1.1.1", eth_if="Ethernet0/0")
|
||||
harness.configure_ios(c1, "R1", eth_ip="10.1.1.1", eth_if="Ethernet0/0", eth_ipv6=R1_IP6)
|
||||
assert harness.wait_ping(c1, "10.1.1.2", attempts=5)["success"] == 100
|
||||
assert harness.wait_ping(c1, R2_IP6, attempts=5)["success"] == 100
|
||||
|
||||
c1.close()
|
||||
c2.close()
|
||||
@@ -322,10 +364,12 @@ def test_iol_docker_relay_control():
|
||||
# the L2 hardening is a creation-time property, not a
|
||||
# datapath one: relay anchors are pure L2 too
|
||||
harness.assert_pure_l2(a1)
|
||||
harness.configure_ios(c1, "R1", eth_ip="10.1.1.1", eth_if="Ethernet0/0")
|
||||
harness.configure_ios(c2, "R2", eth_ip="10.1.1.2", eth_if="Ethernet0/0")
|
||||
harness.configure_ios(c1, "R1", eth_ip="10.1.1.1", eth_if="Ethernet0/0", eth_ipv6=R1_IP6)
|
||||
harness.configure_ios(c2, "R2", eth_ip="10.1.1.2", eth_if="Ethernet0/0", eth_ipv6=R2_IP6)
|
||||
relay_ping = harness.wait_ping(c1, "10.1.1.2")
|
||||
assert relay_ping["success"] == 100, relay_ping["raw"]
|
||||
relay_ping6 = harness.wait_ping(c1, R2_IP6)
|
||||
assert relay_ping6["success"] == 100, relay_ping6["raw"]
|
||||
|
||||
c1.close()
|
||||
c2.close()
|
||||
|
||||
Reference in new issue
Block a user