mirror of
https://github.com/GNS3/gns3-server.git
synced 2024-12-18 20:37:57 +00:00
When importing portable project NAT node is loaded on GNS3 VM
Fix #1030
This commit is contained in:
parent
facdf9c617
commit
851d6e1db8
@ -114,7 +114,7 @@ def import_project(controller, project_id, stream, location=None, name=None, kee
|
||||
# unless it's a linux host without GNS3 VM
|
||||
if not sys.platform.startswith("linux") or controller.has_compute("vm"):
|
||||
for node in topology["topology"]["nodes"]:
|
||||
if node["node_type"] in ("docker", "qemu", "iou"):
|
||||
if node["node_type"] in ("docker", "qemu", "iou", "nat"):
|
||||
node["compute_id"] = "vm"
|
||||
else:
|
||||
for node in topology["topology"]["nodes"]:
|
||||
|
@ -252,6 +252,50 @@ def test_import_iou_linux_with_vm(linux_platform, async_run, tmpdir, controller)
|
||||
assert topo["topology"]["nodes"][0]["compute_id"] == "vm"
|
||||
|
||||
|
||||
def test_import_nat_non_linux(windows_platform, async_run, tmpdir, controller):
|
||||
"""
|
||||
On non linux host NAT should be moved to the GNS3 VM
|
||||
"""
|
||||
project_id = str(uuid.uuid4())
|
||||
controller._computes["vm"] = AsyncioMagicMock()
|
||||
|
||||
topology = {
|
||||
"project_id": str(uuid.uuid4()),
|
||||
"name": "test",
|
||||
"type": "topology",
|
||||
"topology": {
|
||||
"nodes": [
|
||||
{
|
||||
"compute_id": "local",
|
||||
"node_id": "0fd3dd4d-dc93-4a04-a9b9-7396a9e22e8b",
|
||||
"node_type": "nat",
|
||||
"name": "test",
|
||||
"properties": {}
|
||||
}
|
||||
],
|
||||
"links": [],
|
||||
"computes": [],
|
||||
"drawings": []
|
||||
},
|
||||
"revision": 5,
|
||||
"version": "2.0.0"
|
||||
}
|
||||
|
||||
with open(str(tmpdir / "project.gns3"), 'w+') as f:
|
||||
json.dump(topology, f)
|
||||
|
||||
zip_path = str(tmpdir / "project.zip")
|
||||
with zipfile.ZipFile(zip_path, 'w') as myzip:
|
||||
myzip.write(str(tmpdir / "project.gns3"), "project.gns3")
|
||||
|
||||
with open(zip_path, "rb") as f:
|
||||
project = async_run(import_project(controller, project_id, f))
|
||||
|
||||
with open(os.path.join(project.path, "test.gns3")) as f:
|
||||
topo = json.load(f)
|
||||
assert topo["topology"]["nodes"][0]["compute_id"] == "vm"
|
||||
|
||||
|
||||
def test_import_iou_non_linux(windows_platform, async_run, tmpdir, controller):
|
||||
"""
|
||||
On non linux host IOU should be moved to the GNS3 VM
|
||||
|
Loading…
Reference in New Issue
Block a user