mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-24 09:18:08 +00:00
parent
3ce3f925ae
commit
d7c60db2b9
@ -185,9 +185,7 @@ def _convert_1_3_later(topo, topo_path):
|
||||
if old_node["type"] == "VPCSDevice":
|
||||
node["node_type"] = "vpcs"
|
||||
elif old_node["type"] == "QemuVM":
|
||||
node["node_type"] = "qemu"
|
||||
if node["symbol"] is None:
|
||||
node["symbol"] = ":/symbols/qemu_guest.svg"
|
||||
node = _convert_qemu_node(node, old_node)
|
||||
elif old_node["type"] == "DockerVM":
|
||||
node["node_type"] = "docker"
|
||||
if node["symbol"] is None:
|
||||
@ -244,7 +242,7 @@ def _convert_1_3_later(topo, topo_path):
|
||||
else:
|
||||
raise NotImplementedError("Conversion of {} is not supported".format(old_node["type"]))
|
||||
|
||||
for prop in old_node["properties"]:
|
||||
for prop in old_node.get("properties", {}):
|
||||
if prop not in ["console", "name", "console_type", "use_ubridge"]:
|
||||
node["properties"][prop] = old_node["properties"][prop]
|
||||
|
||||
@ -474,3 +472,34 @@ def _convert_snapshots(topo_dir):
|
||||
shutil.copy(snapshot_arc, "/tmp/test.zip")
|
||||
|
||||
shutil.rmtree(old_snapshots_dir)
|
||||
|
||||
|
||||
def _convert_qemu_node(node, old_node):
|
||||
"""
|
||||
Convert qemu node from 1.X to 2.0
|
||||
"""
|
||||
|
||||
# In 2.0 the internet VM is replaced by the NAT node
|
||||
if old_node.get("properties", {}).get("hda_disk_image_md5sum") == "8ebc5a6ec53a1c05b7aa101b5ceefe31":
|
||||
node["console"] = None
|
||||
node["console_type"] = None
|
||||
node["node_type"] = "nat"
|
||||
del old_node["properties"]
|
||||
node["properties"] = {
|
||||
"ports": [
|
||||
{
|
||||
"interface": "eth1",
|
||||
"name": "nat0",
|
||||
"port_number": 0,
|
||||
"type": "ethernet"
|
||||
}
|
||||
]
|
||||
}
|
||||
if node["symbol"] is None:
|
||||
node["symbol"] = ":/symbols/cloud.svg"
|
||||
return node
|
||||
|
||||
node["node_type"] = "qemu"
|
||||
if node["symbol"] is None:
|
||||
node["symbol"] = ":/symbols/qemu_guest.svg"
|
||||
return node
|
||||
|
84
tests/topologies/1_5_internet/after/1_5_internet.gns3
Normal file
84
tests/topologies/1_5_internet/after/1_5_internet.gns3
Normal file
@ -0,0 +1,84 @@
|
||||
{
|
||||
"auto_start": false,
|
||||
"name": "1_5_internet",
|
||||
"project_id": "a64f6cf9-ea6e-42e6-9e4e-a2a292e2b827",
|
||||
"revision": 5,
|
||||
"topology": {
|
||||
"computes": [
|
||||
{"name": "GNS3 VM", "protocol": "http", "port": 3080, "host": "172.16.16.150", "compute_id": "vm"}
|
||||
],
|
||||
"drawings": [],
|
||||
"links": [
|
||||
{
|
||||
"link_id": "ANYUUID",
|
||||
"nodes": [
|
||||
{
|
||||
"adapter_number": 0,
|
||||
"node_id": "761c5e9e-eded-45b5-b6db-ca367b1855e2",
|
||||
"port_number": 0
|
||||
},
|
||||
{
|
||||
"adapter_number": 0,
|
||||
"node_id": "b8bef484-89d2-42a7-b151-6ead2eda965e",
|
||||
"port_number": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"nodes": [
|
||||
{
|
||||
"compute_id": "vm",
|
||||
"console": null,
|
||||
"console_type": null,
|
||||
"label": {
|
||||
"rotation": 0,
|
||||
"style": "font-family: TypeWriter;font-size: 10;font-weight: bold;fill: #000000;fill-opacity: 1.0;",
|
||||
"text": "Internet 0.1-1",
|
||||
"x": 39,
|
||||
"y": -25
|
||||
},
|
||||
"name": "Internet 0.1-1",
|
||||
"node_id": "b8bef484-89d2-42a7-b151-6ead2eda965e",
|
||||
"node_type": "nat",
|
||||
"properties": {
|
||||
"ports": [
|
||||
{
|
||||
"interface": "eth1",
|
||||
"name": "nat0",
|
||||
"port_number": 0,
|
||||
"type": "ethernet"
|
||||
}
|
||||
]
|
||||
},
|
||||
"symbol": ":/symbols/cloud.svg",
|
||||
"x": -111,
|
||||
"y": -147,
|
||||
"z": 1
|
||||
},
|
||||
{
|
||||
"compute_id": "vm",
|
||||
"console": 5001,
|
||||
"console_type": "telnet",
|
||||
"label": {
|
||||
"rotation": 0,
|
||||
"style": "font-family: TypeWriter;font-size: 10;font-weight: bold;fill: #000000;fill-opacity: 1.0;",
|
||||
"text": "PC1",
|
||||
"x": 18,
|
||||
"y": -25
|
||||
},
|
||||
"name": "PC1",
|
||||
"node_id": "761c5e9e-eded-45b5-b6db-ca367b1855e2",
|
||||
"node_type": "vpcs",
|
||||
"properties": {
|
||||
"startup_script_path": "startup.vpc"
|
||||
},
|
||||
"symbol": ":/symbols/vpcs_guest.svg",
|
||||
"x": -29,
|
||||
"y": 8,
|
||||
"z": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "topology",
|
||||
"version": "ANYSTR"
|
||||
}
|
121
tests/topologies/1_5_internet/before/1_5_internet.gns3
Normal file
121
tests/topologies/1_5_internet/before/1_5_internet.gns3
Normal file
@ -0,0 +1,121 @@
|
||||
{
|
||||
"auto_start": false,
|
||||
"name": "1_5_internet",
|
||||
"project_id": "a64f6cf9-ea6e-42e6-9e4e-a2a292e2b827",
|
||||
"revision": 4,
|
||||
"topology": {
|
||||
"links": [
|
||||
{
|
||||
"description": "Link from PC1 port Ethernet0 to Internet 0.1-1 port Ethernet0",
|
||||
"destination_node_id": 1,
|
||||
"destination_port_id": 1,
|
||||
"id": 1,
|
||||
"source_node_id": 2,
|
||||
"source_port_id": 2
|
||||
}
|
||||
],
|
||||
"nodes": [
|
||||
{
|
||||
"description": "QEMU VM",
|
||||
"id": 1,
|
||||
"label": {
|
||||
"color": "#ff000000",
|
||||
"font": "TypeWriter,10,-1,5,75,0,0,0,0,0",
|
||||
"text": "Internet 0.1-1",
|
||||
"x": 39.15625,
|
||||
"y": -25.0
|
||||
},
|
||||
"linked_clone": true,
|
||||
"port_name_format": "Ethernet{0}",
|
||||
"ports": [
|
||||
{
|
||||
"adapter_number": 0,
|
||||
"description": "connected to PC1 on port Ethernet0",
|
||||
"id": 1,
|
||||
"link_id": 1,
|
||||
"name": "Ethernet0",
|
||||
"nio": "NIO_UDP",
|
||||
"port_number": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"acpi_shutdown": false,
|
||||
"adapter_type": "e1000",
|
||||
"adapters": 1,
|
||||
"boot_priority": "c",
|
||||
"console": 5000,
|
||||
"console_type": "telnet",
|
||||
"cpu_throttling": 0,
|
||||
"cpus": 1,
|
||||
"hda_disk_image": "core-linux-6.4-internet-0.1.img",
|
||||
"hda_disk_image_md5sum": "8ebc5a6ec53a1c05b7aa101b5ceefe31",
|
||||
"hda_disk_interface": "ide",
|
||||
"hdb_disk_interface": "ide",
|
||||
"hdc_disk_interface": "ide",
|
||||
"hdd_disk_interface": "ide",
|
||||
"legacy_networking": false,
|
||||
"mac_address": "00:b8:27:96:5e:00",
|
||||
"name": "Internet 0.1-1",
|
||||
"options": "-device e1000,netdev=internet0 -netdev vde,sock=/var/run/vde2/qemu0.ctl,id=internet0 -nographic",
|
||||
"platform": "i386",
|
||||
"process_priority": "normal",
|
||||
"qemu_path": "/usr/bin/qemu-system-i386",
|
||||
"ram": 64,
|
||||
"usage": "Just connect stuff to the appliance. Everything is automated."
|
||||
},
|
||||
"server_id": 3,
|
||||
"symbol": ":/symbols/cloud.svg",
|
||||
"type": "QemuVM",
|
||||
"vm_id": "b8bef484-89d2-42a7-b151-6ead2eda965e",
|
||||
"x": -111.5,
|
||||
"y": -147.0
|
||||
},
|
||||
{
|
||||
"description": "VPCS device",
|
||||
"id": 2,
|
||||
"label": {
|
||||
"color": "#ff000000",
|
||||
"font": "TypeWriter,10,-1,5,75,0,0,0,0,0",
|
||||
"text": "PC1",
|
||||
"x": 18.5859375,
|
||||
"y": -25.0
|
||||
},
|
||||
"ports": [
|
||||
{
|
||||
"adapter_number": 0,
|
||||
"description": "connected to Internet 0.1-1 on port Ethernet0",
|
||||
"id": 2,
|
||||
"link_id": 1,
|
||||
"name": "Ethernet0",
|
||||
"nio": "NIO_UDP",
|
||||
"port_number": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"console": 5001,
|
||||
"name": "PC1",
|
||||
"startup_script_path": "startup.vpc"
|
||||
},
|
||||
"server_id": 3,
|
||||
"symbol": ":/symbols/vpcs_guest.svg",
|
||||
"type": "VPCSDevice",
|
||||
"vm_id": "761c5e9e-eded-45b5-b6db-ca367b1855e2",
|
||||
"x": -29.5,
|
||||
"y": 8.5
|
||||
}
|
||||
],
|
||||
"servers": [
|
||||
{
|
||||
"host": "172.16.16.150",
|
||||
"id": 3,
|
||||
"local": false,
|
||||
"port": 3080,
|
||||
"protocol": "http",
|
||||
"user": "",
|
||||
"vm": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "topology",
|
||||
"version": "1.5.2"
|
||||
}
|
@ -37,8 +37,8 @@
|
||||
"boot_priority": "c",
|
||||
"cpu_throttling": 0,
|
||||
"cpus": 1,
|
||||
"hda_disk_image": "core-linux-6.4-internet-0.1.img",
|
||||
"hda_disk_image_md5sum": "8ebc5a6ec53a1c05b7aa101b5ceefe31",
|
||||
"hda_disk_image": "core-linux-6.4.img",
|
||||
"hda_disk_image_md5sum": "12345a6ec53a1c05b7aa101b5ceefe31",
|
||||
"hda_disk_interface": "ide",
|
||||
"hdb_disk_interface": "ide",
|
||||
"hdc_disk_interface": "ide",
|
||||
|
@ -34,8 +34,8 @@
|
||||
"console_type": "telnet",
|
||||
"cpu_throttling": 0,
|
||||
"cpus": 1,
|
||||
"hda_disk_image": "core-linux-6.4-internet-0.1.img",
|
||||
"hda_disk_image_md5sum": "8ebc5a6ec53a1c05b7aa101b5ceefe31",
|
||||
"hda_disk_image": "core-linux-6.4.img",
|
||||
"hda_disk_image_md5sum": "12345a6ec53a1c05b7aa101b5ceefe31",
|
||||
"hda_disk_interface": "ide",
|
||||
"hdb_disk_interface": "ide",
|
||||
"hdc_disk_interface": "ide",
|
||||
|
Loading…
Reference in New Issue
Block a user