Fixes NAT node not working on Windows (#1163)

pull/1168/head
ziajka 7 years ago
parent 3dd5dbe0c1
commit 7523e9c4bc

@ -36,7 +36,9 @@ class Nat(Cloud):
raise NodeError("virbr0 is missing. You need to install libvirt")
interface = "virbr0"
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")
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…
Cancel
Save