Two real iol-xe containers (Cisco CML iol-runner images, real IOS-XE on the telnet console) against an isolated instance, the real uBridge with the swappable bridge TAP leg: * kernel link reports kernel_datapath; anchors exist from node start and the per-link bridge enslaves exactly the two of them; * real ICMP crosses the [unix <-> tap] port-bridge relay; delay 100 lands as netem on both anchors with the measured RTT growing >= 150 ms and returning < 50 ms when cleared; * suspend admin-downs the anchor and kills the traffic; resume restores; AF_PACKET capture writes a real pcap; * link delete/re-create swaps the port leg out and back in with the ping returning; node stop leaves no gx devices and a start recreates the whole wiring from the NIO; project delete cleans everything; * the relay control on a relay-configured instance keeps the link off the kernel and still pings (anchors may exist idle — the same semantics as QEMU's and Dynamips' anchors: the server flag decides attachment, not anchor birth). Harness: create_iol_router (the appliance's template properties), docker_images, iol_anchor_name, stage_iol_base_config (the shipped iol-xe-base.txt copied into the isolated instance's configs dir — the GNS3_IOL_STARTUP_CONFIG lookup path), boot_wait(straight_prompt=True) for images that boot from NVRAM straight into the CLI with no 'Press RETURN' sentinel, and GNS3_E2E_DEBUG=1 to run the isolated instance with debug logging (the uBridge command stream lands in server.log — how the ensure-anchor EBUSY was pinned down).
2.7 KiB
Live end-to-end tests
Tests under this directory run against a real server: real uBridge, real
kernel interfaces (privileged), real emulator binaries and real images. They
verify what unit tests cannot — that a datapath actually forwards traffic,
that kernel bridges actually enslave anchors, that tc impairments actually
shape packets. They are marked e2e and excluded from normal test runs
(see tests/pytest.ini); run them explicitly:
pytest -m e2e tests/e2e -s # -s shows the progress prints
pytest -m e2e tests/e2e -k dynamips # one scenario
Two run modes, chosen per test through harness.live_server(kernel=...):
- Target an existing server — set
GNS3_E2E_URL(e.g.http://127.0.0.1:3080/v3, plusGNS3_E2E_USER/GNS3_E2E_PASSWORD, default admin/admin). The server must already be configured for the datapath under test (kernel links needenable_kernel_datapath = True). - Isolated instance (the default) — the harness starts its own server
process on a free port with its own config directory (the controller DB
and every path follow the config), so nothing on the machine is touched.
It needs
ubridge,dynamipsand an images directory (GNS3_E2E_IMAGES, default~/GNS3/images) available locally.
Either way each test creates its own project and deletes it again. Set
GNS3_E2E_KEEP=1 to keep the project (and a started instance) on failure
and print where to look at it.
harness.py holds the shared pieces — REST client, server lifecycle, the
IOS console driver, host-side kernel inspections (bridge membership, tap
admin state, tc qdiscs) — so a new node type adds only its own scenario
module.
Current scenarios:
test_dynamips_kernel_datapath.py— two real c7200 routers: kernel link (anchors, per-link bridge, netem delay, suspend, capture, delete/re-create, stop/start) plus a serial link staying on the relay, and a negative control on an isolated relay-configured instance.test_ethernet_switch_kernel_datapath.py— a real Ethernet switch (kernel bridge) between two c7200 routers: deferred joins on boot, VLAN isolation, absorbed-anchor filters/suspend/capture, VPCS peers staying on the relay, and a relay negative control.test_iol_docker_kernel_datapath.py— two real iol-xe containers (Cisco CML iol-runner images): kernel link through the port bridge's swappable TAP leg (anchors at start, netem delay, suspend, capture, link delete/re-create swap, node stop/start rewiring) and a relay negative control.
Set GNS3_E2E_DEBUG=1 to run the isolated instance with debug logging (the
uBridge command stream lands in its server.log).