mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-19 20:55:14 +02:00
test(e2e): assert the L2-anchor spec's server-side guarantees
The spec's gns3-server alignment section promised three assertions the suites never carried; they land in harness.py and run in every kernel scenario (plus the relay controls' anchor checks): - E.1 assert_pure_l2: anchors and bridges carry no L3 identity (addrgenmode none, no address in /proc/net/if_inet6, no ip -o -4 addr) -- the kernel scenarios' anchors and per-link/switch bridges, relay-mode anchors and the switch's relay TAPs alike (hardening is a creation-time property, not a datapath one); - E.2 assert_idle_silence (Dynamips suite): guest interfaces shut to silence IOS's own CDP/keepalives, settle 2.5 s, then a 5 s window of zero traffic over both anchors and the per-link bridge; - assert_forwarding: every attached port reports brport/state == 3 -- a bridge left DOWN keeps its ports disabled and forwards nothing, with no error anywhere; the assertion is the only signal. harness.l2only_supported() probes a throwaway uBridge once (link l2only against a nonexistent device: 208 = command present, 202-Unknown command = old build); without the command the assertions skip -- the spec's degradation contract, mirroring the tc-capability skip. The first live run caught a fifth-creator gap: the switch's relay port TAPs (minted implicitly by bridge add_nio_tap) carried a live fe80::. Delivered uBridge-side per the spec (fb72758: the transient TAP is hardened at creation, attaches untouched); the server needed no change, and the relay-control E.1 check is that creator's end-to-end coverage.
This commit is contained in:
5 files changed
+215
-2
No files matched your search
@@ -71,6 +71,13 @@ def _boot(server, project_id, node_id, timeout=360):
|
||||
return console
|
||||
|
||||
|
||||
def _eth_shutdown(console, shut):
|
||||
console.run("conf t")
|
||||
console.run("interface f1/0")
|
||||
console.run("shutdown" if shut else "no shutdown")
|
||||
console.run("end")
|
||||
|
||||
|
||||
def test_dynamips_kernel_datapath():
|
||||
server = harness.live_server(kernel=True)
|
||||
compute = server.compute
|
||||
@@ -108,6 +115,19 @@ def test_dynamips_kernel_datapath():
|
||||
assert harness.tap_exists(t1) and harness.tap_exists(t2), (t1, t2)
|
||||
assert harness.bridge_members(bridge) == sorted([t1, t2]), harness.bridge_members(bridge)
|
||||
|
||||
# L2-anchor spec §E.1: anchors and the per-link bridge carry no L3
|
||||
# identity (skipped on a uBridge without `link l2only` — the spec's
|
||||
# degradation), and both ports are FORWARDING — the silent-failure
|
||||
# guard against a bridge device left DOWN.
|
||||
if harness.l2only_supported():
|
||||
harness.assert_pure_l2(t1)
|
||||
harness.assert_pure_l2(t2)
|
||||
harness.assert_pure_l2(bridge)
|
||||
else:
|
||||
print(".. uBridge without link l2only: skipping the §E.1 assertions")
|
||||
harness.assert_forwarding(t1)
|
||||
harness.assert_forwarding(t2)
|
||||
|
||||
harness.configure_ios(c1, "R1", eth_ip="10.1.1.1")
|
||||
harness.configure_ios(c2, "R2", eth_ip="10.1.1.2")
|
||||
out = c1.run("show ip int brief")
|
||||
@@ -116,6 +136,18 @@ def test_dynamips_kernel_datapath():
|
||||
baseline = harness.wait_ping(c1, "10.1.1.2")
|
||||
assert baseline["success"] == 100, baseline["raw"]
|
||||
|
||||
# L2-anchor spec §E.2: shut the guest interfaces (silencing IOS's own
|
||||
# CDP/keepalives — the only legitimate speakers on the segment) and
|
||||
# demand the host side stays silent for 5 s: without the hardening
|
||||
# the host's own MLD/DAD noise floods the link (6 frames / 2 s).
|
||||
if harness.l2only_supported():
|
||||
for console in (c1, c2):
|
||||
_eth_shutdown(console, shut=True)
|
||||
harness.assert_idle_silence(t1, t2, bridge)
|
||||
for console in (c1, c2):
|
||||
_eth_shutdown(console, shut=False)
|
||||
assert harness.wait_ping(c1, "10.1.1.2", attempts=5)["success"] == 100
|
||||
|
||||
# delay 100: netem on both anchors (each impairs one direction),
|
||||
# one-way ~100 ms => RTT grows by ~200 ms
|
||||
compute.call("PUT", f"/projects/{pid}/links/{lid}", {"filters": {"delay": [100]}})
|
||||
@@ -237,6 +269,10 @@ def test_dynamips_relay_control():
|
||||
assert harness.bridge_members(harness.link_bridge_name(lid)) is None
|
||||
if harness.tap_exists(t1):
|
||||
assert not harness.tap_up(t1), "an unattached relay anchor should sit down"
|
||||
if harness.l2only_supported():
|
||||
# the L2 hardening is a creation-time property, not a
|
||||
# datapath one: relay anchors are pure L2 too
|
||||
harness.assert_pure_l2(t1)
|
||||
|
||||
harness.configure_ios(c1, "R1", eth_ip="10.1.1.1")
|
||||
harness.configure_ios(c2, "R2", eth_ip="10.1.1.2")
|
||||
|
||||
Reference in new issue
Block a user