mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-01 04:38:12 +00:00
Fixes NAT node not working on Windows (#1163)
This commit is contained in:
parent
3dd5dbe0c1
commit
7523e9c4bc
@ -36,7 +36,9 @@ class Nat(Cloud):
|
|||||||
raise NodeError("virbr0 is missing. You need to install libvirt")
|
raise NodeError("virbr0 is missing. You need to install libvirt")
|
||||||
interface = "virbr0"
|
interface = "virbr0"
|
||||||
else:
|
else:
|
||||||
if "vmnet8" not in [interface["name"] for interface in gns3server.utils.interfaces.interfaces()]:
|
names = filter(lambda x: 'vmnet8' in x.lower(),
|
||||||
|
[interface["name"] for interface in gns3server.utils.interfaces.interfaces()])
|
||||||
|
if not len(list(names)):
|
||||||
raise NodeError("vmnet8 is missing. You need to install VMware or use the NAT node on GNS3 VM")
|
raise NodeError("vmnet8 is missing. You need to install VMware or use the NAT node on GNS3 VM")
|
||||||
interface = "vmnet8"
|
interface = "vmnet8"
|
||||||
|
|
||||||
|
@ -59,3 +59,23 @@ def test_json_darwin(darwin_platform, project):
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def test_json_windows_with_full_name_of_interface(windows_platform, project):
|
||||||
|
with patch("gns3server.utils.interfaces.interfaces", return_value=[
|
||||||
|
{"name": "VMware Network Adapter VMnet8", "special": True, "type": "ethernet"}]):
|
||||||
|
nat = Nat("nat1", str(uuid.uuid4()), project, MagicMock())
|
||||||
|
assert nat.__json__() == {
|
||||||
|
"name": "nat1",
|
||||||
|
"node_id": nat.id,
|
||||||
|
"project_id": project.id,
|
||||||
|
"status": "started",
|
||||||
|
"ports_mapping": [
|
||||||
|
{
|
||||||
|
"interface": "vmnet8",
|
||||||
|
"name": "nat0",
|
||||||
|
"port_number": 0,
|
||||||
|
"type": "ethernet"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user