Expose full interface address list and link state in cloud node API

Each host interface surfaced by the cloud node now reports:
- ip_addresses: every IPv4 and IPv6 address (previously only a single
  IPv4 was collected internally and then dropped before the response)
- status / speed / mtu / flags: operational state and link attributes
  sourced from psutil.net_if_stats(), with flags normalized to a list

The legacy ip_address / netmask / mac_address fields are preserved so
existing callers (compute link detection, GNS3 VM, VMware, has_netmask)
keep working. The new fields travel through the existing interfaces
payload that the controller forwards verbatim, so no controller-side
change is required and the PUT / ports_mapping flow is unaffected.
This commit is contained in:
YueGuobin committed 2026-07-10 13:56:07 +08:00
1 parent a66740e154
commit 9721660cc3
6 files changed
+196 -11

No files matched your search

+10 -1
View File
@@ -83,7 +83,16 @@ class Cloud(BaseNode):
network_interfaces = gns3server.utils.interfaces.interfaces()
for interface in network_interfaces:
host_interfaces.append(
{"name": interface["name"], "type": interface["type"], "special": interface["special"]}
{
"name": interface["name"],
"type": interface["type"],
"special": interface["special"],
"ip_addresses": interface.get("ip_addresses", []),
"status": interface.get("status", "down"),
"speed": interface.get("speed", 0),
"mtu": interface.get("mtu", 0),
"flags": interface.get("flags", []),
}
)
return {