mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-30 20:28:08 +00:00
Drop NAT port from cloud from old topologies
It was almost not used (only one occurrence in the whole beta test). Fix #844
This commit is contained in:
parent
1bf54bcaeb
commit
b1ae884bf0
@ -295,9 +295,9 @@ def _convert_1_3_later(topo, topo_path):
|
|||||||
elif old_node["type"] == "IOUDevice":
|
elif old_node["type"] == "IOUDevice":
|
||||||
node["node_type"] = "iou"
|
node["node_type"] = "iou"
|
||||||
elif old_node["type"] == "Cloud":
|
elif old_node["type"] == "Cloud":
|
||||||
_create_cloud(node, old_node, ":/symbols/cloud.svg")
|
old_node["ports"] = _create_cloud(node, old_node, ":/symbols/cloud.svg")
|
||||||
elif old_node["type"] == "Host":
|
elif old_node["type"] == "Host":
|
||||||
_create_cloud(node, old_node, ":/symbols/computer.svg")
|
old_node["ports"] = _create_cloud(node, old_node, ":/symbols/computer.svg")
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError("Conversion of {} is not supported".format(old_node["type"]))
|
raise NotImplementedError("Conversion of {} is not supported".format(old_node["type"]))
|
||||||
|
|
||||||
@ -483,6 +483,7 @@ def _create_cloud(node, old_node, icon):
|
|||||||
del old_node["properties"]["nios"]
|
del old_node["properties"]["nios"]
|
||||||
|
|
||||||
ports = []
|
ports = []
|
||||||
|
keep_ports = []
|
||||||
for old_port in old_node.get("ports", []):
|
for old_port in old_node.get("ports", []):
|
||||||
if old_port["name"].startswith("nio_gen_eth"):
|
if old_port["name"].startswith("nio_gen_eth"):
|
||||||
port_type = "ethernet"
|
port_type = "ethernet"
|
||||||
@ -492,6 +493,8 @@ def _create_cloud(node, old_node, icon):
|
|||||||
port_type = "tap"
|
port_type = "tap"
|
||||||
elif old_port["name"].startswith("nio_udp"):
|
elif old_port["name"].startswith("nio_udp"):
|
||||||
port_type = "udp"
|
port_type = "udp"
|
||||||
|
elif old_port["name"].startswith("nio_nat"):
|
||||||
|
continue
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError("The conversion of cloud with {} is not supported".format(old_port["name"]))
|
raise NotImplementedError("The conversion of cloud with {} is not supported".format(old_port["name"]))
|
||||||
|
|
||||||
@ -512,10 +515,12 @@ def _create_cloud(node, old_node, icon):
|
|||||||
"port_number": len(ports) + 1,
|
"port_number": len(ports) + 1,
|
||||||
"type": port_type
|
"type": port_type
|
||||||
}
|
}
|
||||||
|
keep_ports.append(old_port)
|
||||||
ports.append(port)
|
ports.append(port)
|
||||||
|
|
||||||
node["properties"]["ports_mapping"] = ports
|
node["properties"]["ports_mapping"] = ports
|
||||||
node["properties"]["interfaces"] = []
|
node["properties"]["interfaces"] = []
|
||||||
|
return keep_ports
|
||||||
|
|
||||||
|
|
||||||
def _convert_snapshots(topo_dir):
|
def _convert_snapshots(topo_dir):
|
||||||
|
53
tests/topologies/1_5_cloud_nat/after/1_5_cloud_nat.gns3
Normal file
53
tests/topologies/1_5_cloud_nat/after/1_5_cloud_nat.gns3
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
{
|
||||||
|
"auto_start": false,
|
||||||
|
"name": "untitled",
|
||||||
|
"project_id": "ANYSTR",
|
||||||
|
"revision": 6,
|
||||||
|
"topology": {
|
||||||
|
"computes": [
|
||||||
|
{
|
||||||
|
"compute_id": "local",
|
||||||
|
"host": "127.0.0.1",
|
||||||
|
"name": "Local",
|
||||||
|
"port": 3080,
|
||||||
|
"protocol": "http"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"drawings": [],
|
||||||
|
"links": [
|
||||||
|
],
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"compute_id": "local",
|
||||||
|
"console": null,
|
||||||
|
"console_type": null,
|
||||||
|
"first_port_name": null,
|
||||||
|
"label": {
|
||||||
|
"rotation": 0,
|
||||||
|
"style": "font-family: TypeWriter;font-size: 10;font-weight: bold;fill: #000000;fill-opacity: 1.0;",
|
||||||
|
"text": "Cloud 2",
|
||||||
|
"x": 55,
|
||||||
|
"y": -25
|
||||||
|
},
|
||||||
|
"name": "Cloud 2",
|
||||||
|
"node_id": "ANYSTR",
|
||||||
|
"node_type": "cloud",
|
||||||
|
"port_name_format": "Ethernet{0}",
|
||||||
|
"port_segment_size": 0,
|
||||||
|
"properties": {
|
||||||
|
"interfaces": [
|
||||||
|
],
|
||||||
|
"ports_mapping": [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"symbol": ":/symbols/cloud.svg",
|
||||||
|
"x": -144,
|
||||||
|
"y": -135,
|
||||||
|
"z": 1
|
||||||
|
},
|
||||||
|
{"name": "core-1", "first_port_name": null, "symbol": ":/symbols/cloud.svg", "node_type": "nat", "label": {"style": "font-family: TypeWriter;font-size: 10;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "rotation": 0, "y": -25, "x": 10, "text": "core-1"}, "console_type": null, "port_name_format": "Ethernet{0}", "node_id": "c6de0f4e-101d-4c4f-b5a0-47df57e8a893", "y": 0, "z": 1, "compute_id": "local", "properties": {"ports": [{"name": "nat0", "type": "ethernet", "interface": "eth1", "port_number": 0}]}, "port_segment_size": 0, "console": null, "x": 72}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"type": "topology",
|
||||||
|
"version": "ANYSTR"
|
||||||
|
}
|
116
tests/topologies/1_5_cloud_nat/before/1_5_cloud_nat.gns3
Normal file
116
tests/topologies/1_5_cloud_nat/before/1_5_cloud_nat.gns3
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
{
|
||||||
|
"auto_start": false,
|
||||||
|
"name": "untitled",
|
||||||
|
"project_id": "63c75180-b540-4389-94cd-62f4bc6a5e2b",
|
||||||
|
"revision": 4,
|
||||||
|
"topology": {
|
||||||
|
"links": [
|
||||||
|
{
|
||||||
|
"description": "Link from core-1 port Ethernet0 to Cloud 2 port nio_nat:42",
|
||||||
|
"destination_node_id": 3,
|
||||||
|
"destination_port_id": 3,
|
||||||
|
"id": 3,
|
||||||
|
"source_node_id": 7,
|
||||||
|
"source_port_id": 21
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"description": "Cloud",
|
||||||
|
"id": 3,
|
||||||
|
"label": {
|
||||||
|
"color": "#ff000000",
|
||||||
|
"font": "TypeWriter,10,-1,5,75,0,0,0,0,0",
|
||||||
|
"text": "Cloud 2",
|
||||||
|
"x": 55.6015625,
|
||||||
|
"y": -25.0
|
||||||
|
},
|
||||||
|
"ports": [
|
||||||
|
{
|
||||||
|
"description": "connected to core-1 on port Ethernet0",
|
||||||
|
"id": 3,
|
||||||
|
"link_id": 3,
|
||||||
|
"name": "nio_nat:42",
|
||||||
|
"nio": "NIO_NAT",
|
||||||
|
"stub": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"name": "Cloud 2",
|
||||||
|
"nios": [
|
||||||
|
"nio_nat:42"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"server_id": 1,
|
||||||
|
"type": "Cloud",
|
||||||
|
"x": -144.5,
|
||||||
|
"y": -135.0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "QEMU VM",
|
||||||
|
"id": 7,
|
||||||
|
"label": {
|
||||||
|
"color": "#ff000000",
|
||||||
|
"font": "TypeWriter,10,-1,5,75,0,0,0,0,0",
|
||||||
|
"text": "core-1",
|
||||||
|
"x": 10.9765625,
|
||||||
|
"y": -25.0
|
||||||
|
},
|
||||||
|
"linked_clone": true,
|
||||||
|
"port_name_format": "Ethernet{0}",
|
||||||
|
"ports": [
|
||||||
|
{
|
||||||
|
"adapter_number": 0,
|
||||||
|
"description": "connected to Cloud 2 on port nio_nat:42",
|
||||||
|
"id": 21,
|
||||||
|
"link_id": 3,
|
||||||
|
"name": "Ethernet0",
|
||||||
|
"nio": "NIO_NAT",
|
||||||
|
"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:5e:2b:a8:93:00",
|
||||||
|
"name": "core-1",
|
||||||
|
"options": "-nographic",
|
||||||
|
"platform": "x86_64",
|
||||||
|
"process_priority": "normal",
|
||||||
|
"qemu_path": "/usr/local/bin/qemu-system-x86_64",
|
||||||
|
"ram": 256
|
||||||
|
},
|
||||||
|
"server_id": 1,
|
||||||
|
"type": "QemuVM",
|
||||||
|
"vm_id": "c6de0f4e-101d-4c4f-b5a0-47df57e8a893",
|
||||||
|
"x": 72.5,
|
||||||
|
"y": -0.5
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"host": "127.0.0.1",
|
||||||
|
"id": 1,
|
||||||
|
"local": true,
|
||||||
|
"port": 3080,
|
||||||
|
"protocol": "http",
|
||||||
|
"vm": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"type": "topology",
|
||||||
|
"version": "1.5.3dev2"
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user