diff --git a/gns3server/compute/builtin/nodes/nat.py b/gns3server/compute/builtin/nodes/nat.py index 1efd22fd..a8919039 100644 --- a/gns3server/compute/builtin/nodes/nat.py +++ b/gns3server/compute/builtin/nodes/nat.py @@ -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" diff --git a/tests/compute/builtin/nodes/test_nat.py b/tests/compute/builtin/nodes/test_nat.py index 8924c95a..c864f936 100644 --- a/tests/compute/builtin/nodes/test_nat.py +++ b/tests/compute/builtin/nodes/test_nat.py @@ -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" + } + ] + } \ No newline at end of file