mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-19 12:45:19 +02:00
test(e2e): give the dynamips routers a detected idle-PC
Without one every c7200 busy-waits a full CPU core for the whole scenario -- the tests create raw nodes and no template supplies a value (measured: constant ~100 % per router, up to ~6 minutes per dynamips scenario). harness.dynamips_idlepc() detects a value through the controller's auto_idlepc endpoint (the GUI idle-PC finder path: a throwaway project boots the image, candidate values are validated by measuring actual CPU usage) and caches it in ~/.cache/gns3-e2e/idlepc.json keyed by the image checksum, so the cost (~100 s here) is paid once per image, not per run. GNS3_E2E_IDLEPC overrides detection; any failure returns None and the scenarios run without one rather than fail on a CPU optimisation. All four scenarios that boot c7200 routers (dynamips kernel/relay, ethernet switch kernel/relay) pass the value at creation. Live: detected 0x60189234 for the M11 image (238 s first run including detection); the routers drop from ~100 % during boot to 3-8 % steady (sampled per process), and a re-run reports the cached value with no detection.
This commit is contained in:
4 files changed
+101
-10
No files matched your search
@@ -67,7 +67,7 @@ def _switch_bridge_name(switch_id):
|
||||
return "gns3" + switch_id.replace("-", "")[:6]
|
||||
|
||||
|
||||
def _create_topology(compute, pid, image, name):
|
||||
def _create_topology(compute, pid, image, name, idlepc=None):
|
||||
switch = compute.call(
|
||||
"POST",
|
||||
f"/projects/{pid}/nodes",
|
||||
@@ -83,8 +83,8 @@ def _create_topology(compute, pid, image, name):
|
||||
},
|
||||
},
|
||||
)
|
||||
r1 = compute.create_dynamips_router(pid, f"{name}-R1", image, SLOTS)
|
||||
r2 = compute.create_dynamips_router(pid, f"{name}-R2", image, SLOTS)
|
||||
r1 = compute.create_dynamips_router(pid, f"{name}-R1", image, SLOTS, idlepc=idlepc)
|
||||
r2 = compute.create_dynamips_router(pid, f"{name}-R2", image, SLOTS, idlepc=idlepc)
|
||||
return switch, r1, r2
|
||||
|
||||
|
||||
@@ -100,12 +100,13 @@ def test_ethernet_switch_kernel_fast_path():
|
||||
if compute.capabilities().get("ubridge_tap") is not True:
|
||||
pytest.skip("this compute's uBridge cannot create persistent TAPs (ubridge_tap != True)")
|
||||
image = _pick_image(server)
|
||||
idlepc = harness.dynamips_idlepc(server, image)
|
||||
|
||||
project = compute.create_project("esw-e2e")
|
||||
pid = project["project_id"]
|
||||
sw_bridge = None
|
||||
try:
|
||||
switch, r1, r2 = _create_topology(compute, pid, image, "E2E")
|
||||
switch, r1, r2 = _create_topology(compute, pid, image, "E2E", idlepc)
|
||||
switch_id = switch["node_id"]
|
||||
r1_id, r2_id = r1["node_id"], r2["node_id"]
|
||||
sw_bridge = _switch_bridge_name(switch_id)
|
||||
@@ -262,12 +263,13 @@ def test_ethernet_switch_relay_control():
|
||||
server = harness.live_server(kernel=False)
|
||||
compute = server.compute
|
||||
image = _pick_image(server)
|
||||
idlepc = harness.dynamips_idlepc(server, image)
|
||||
|
||||
project = compute.create_project("esw-e2e-relay")
|
||||
pid = project["project_id"]
|
||||
sw_bridge = None
|
||||
try:
|
||||
switch, r1, r2 = _create_topology(compute, pid, image, "E2E")
|
||||
switch, r1, r2 = _create_topology(compute, pid, image, "E2E", idlepc)
|
||||
sw_bridge = _switch_bridge_name(switch["node_id"])
|
||||
r1_id, r2_id = r1["node_id"], r2["node_id"]
|
||||
a1 = harness.anchor_name(r1_id, *ETH)
|
||||
|
||||
Reference in new issue
Block a user