feat: model IOL adapters as 4-port units like the IOU node type

IOL interfaces come in 4-port units (Ethernet0/0-3, Ethernet1/0-3, ...),
addressed like IOU as (adapter_number, port_number 0-3):

- IOLDockerVM builds EthernetAdapter(interfaces=4) per adapter and asks
  the runner for adapters x 4 interfaces (num-eth).
- DockerVM threads port_number through the NIO/capture API (the compute
  routes parsed it from the URL but dropped it); single-port adapters
  keep the historical bridge{N} names and command sequence, multi-port
  adapters get one bridge per port (bridge{a}_{p}).
- The unix-socket NIO wiring addresses sockets flat across adapters:
  adapter x ports-per-adapter + port, so single-port images keep their
  exact socket layout.
- The controller port list for GNS3_IOL_RUNNER docker nodes is generated
  by StandardPortFactory with the IOU naming (Ethernet{segment0}/{port0},
  segment size 4); plain docker nodes keep eth{N}.
This commit is contained in:
YueGuobin committed 2026-09-05 21:54:51 +08:00
1 parent 9b55164064
commit 0ca9ccc637
9 files changed
+267 -110

No files matched your search

+26
View File
@@ -46,6 +46,32 @@ def node(compute, project):
return node
def test_docker_iol_ports_grouped_in_four_port_units(compute, project):
"""
IOL docker nodes (GNS3_IOL_RUNNER) model adapters as 4-port units: ports
are Ethernet0/0-3, Ethernet1/0-3, … addressed (adapter, port 0-3), like
the native IOU node type. Plain docker nodes keep the flat eth naming.
"""
node = Node(project, compute, "iol",
node_id=str(uuid.uuid4()),
node_type="docker",
properties={"adapters": 2, "environment": "GNS3_IOL_RUNNER=1"})
ports = node.ports
assert [p.asdict()["name"] for p in ports] == [
"Ethernet0/0", "Ethernet0/1", "Ethernet0/2", "Ethernet0/3",
"Ethernet1/0", "Ethernet1/1", "Ethernet1/2", "Ethernet1/3",
]
assert (ports[5].adapter_number, ports[5].port_number) == (1, 1)
assert ports[5].short_name == "e1/1"
node = Node(project, compute, "web",
node_id=str(uuid.uuid4()),
node_type="docker",
properties={"adapters": 2})
assert [p.asdict()["name"] for p in node.ports] == ["eth0", "eth1"]
def test_name(compute, project):
"""
If node use a name template generate names