Fix conversion issue for old IOU projects

Fix https://github.com/GNS3/gns3-gui/issues/1868
This commit is contained in:
Julien Duponchelle 2017-02-20 10:48:03 +01:00
parent a730fce514
commit 7fea6f0e2e
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8
2 changed files with 10 additions and 2 deletions

View File

@ -331,6 +331,14 @@ def _convert_1_3_later(topo, topo_path):
node["symbol"] = ":/symbols/vbox_guest.svg"
elif old_node["type"] == "IOUDevice":
node["node_type"] = "iou"
node["port_name_format"] = old_node.get("port_name_format", "Ethernet{segment0}/{port0}")
node["port_segment_size"] = int(old_node.get("port_segment_size", "4"))
if node["symbol"] is None:
if "l2" in node["properties"].get("path", ""):
node["symbol"] = ":/symbols/multilayer_switch.svg"
else:
node["symbol"] = ":/symbols/router.svg"
elif old_node["type"] == "Cloud":
old_node["ports"] = _create_cloud(node, old_node, ":/symbols/cloud.svg")
elif old_node["type"] == "Host":

View File

@ -30,8 +30,8 @@
"name": "IOU1",
"node_id": "aaeb2288-a7d8-42a9-b9d8-c42ab464a390",
"node_type": "iou",
"port_name_format": "Ethernet{0}",
"port_segment_size": 0,
"port_name_format": "Ethernet{segment0}/{port0}",
"port_segment_size": 4,
"first_port_name": null,
"properties": {
"ethernet_adapters": 2,