mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-17 22:08:35 +00:00
Return flag for special interface that you can use in the cloud
Fix https://github.com/GNS3/gns3-gui/issues/1509
This commit is contained in:
parent
803064d5cf
commit
84a2f8b4a3
@ -55,7 +55,8 @@ class Cloud(BaseNode):
|
||||
network_interfaces = interfaces()
|
||||
for interface in network_interfaces:
|
||||
host_interfaces.append({"name": interface["name"],
|
||||
"type": interface["type"]})
|
||||
"type": interface["type"],
|
||||
"special": interface["special"]})
|
||||
|
||||
return {"name": self.name,
|
||||
"node_id": self.id,
|
||||
|
@ -26,10 +26,15 @@ HOST_INTERFACE_SCHEMA = {
|
||||
"minLength": 1,
|
||||
},
|
||||
"type": {
|
||||
"description": "Interface type",
|
||||
"enum": ["ethernet", "tap"]
|
||||
},
|
||||
"special": {
|
||||
"description": "If true the interface is non standard (firewire for example)",
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": ["name", "type"],
|
||||
"required": ["name", "type", "special"],
|
||||
"additionalProperties": False
|
||||
}
|
||||
|
||||
|
@ -205,4 +205,11 @@ def interfaces():
|
||||
if service_installed is False:
|
||||
raise aiohttp.web.HTTPInternalServerError(text="The Winpcap or Npcap is not installed or running")
|
||||
|
||||
# This interface have special behavior
|
||||
for result in results:
|
||||
result["special"] = False
|
||||
for special_interface in ("lo", "vmnet", "vboxnet", "docker", "lxcbr", "virbr", "ovs-system", "veth", "fw", "p2p"):
|
||||
if result["name"].lower().startswith(special_interface):
|
||||
result["special"] = True
|
||||
|
||||
return results
|
||||
|
@ -22,7 +22,11 @@ from gns3server.utils.interfaces import interfaces, is_interface_up
|
||||
|
||||
def test_interfaces():
|
||||
# This test should pass on all platforms without crash
|
||||
assert isinstance(interfaces(), list)
|
||||
interface_list = interfaces()
|
||||
assert isinstance(interface_list, list)
|
||||
for interface in interface_list:
|
||||
if interface["name"].startswith("vmnet"):
|
||||
assert interface["special"]
|
||||
|
||||
|
||||
def test_is_interface_up():
|
||||
|
Loading…
Reference in New Issue
Block a user