1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-29 18:28:11 +00:00

Support Host node from 1.X topologies

Fix #626
This commit is contained in:
Julien Duponchelle 2016-07-26 21:40:11 +02:00
parent c96bd5f2a9
commit 0be973f2c5
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8
3 changed files with 125 additions and 3 deletions

View File

@ -230,7 +230,9 @@ def _convert_1_3_later(topo, topo_path):
elif old_node["type"] == "IOUDevice":
node["node_type"] = "iou"
elif old_node["type"] == "Cloud":
_create_cloud(node, old_node)
_create_cloud(node, old_node, ":/symbols/cloud.svg")
elif old_node["type"] == "Host":
_create_cloud(node, old_node, ":/symbols/computer.svg")
else:
raise NotImplementedError("Conversion of {} is not supported".format(old_node["type"]))
@ -418,9 +420,9 @@ def _convert_label(label):
}
def _create_cloud(node, old_node):
def _create_cloud(node, old_node, icon):
node["node_type"] = "cloud"
node["symbol"] = ":/symbols/cloud.svg"
node["symbol"] = icon
node["console_type"] = None
node["console"] = None
del old_node["properties"]["nios"]

View File

@ -0,0 +1,52 @@
{
"auto_start": false,
"name": "1_5_host",
"project_id": "ce17e635-bc1b-44df-946c-149e938dedc4",
"revision": 5,
"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,
"label": {
"rotation": 0,
"style": "font-family: TypeWriter;font-size: 10;font-weight: bold;fill: #000000;fill-opacity: 1.0;",
"text": "Host 1",
"x": 13,
"y": -25
},
"name": "Host 1",
"node_id": "ANYUUID",
"node_type": "cloud",
"properties": {
"interfaces": [
],
"ports": [
{"interface": "bridge0", "port_number": 1, "type": "ethernet", "name": "bridge0"},
{"interface": "en0", "port_number": 2, "type": "ethernet", "name": "en0"},
{"interface": "en1", "port_number": 3, "type": "ethernet", "name": "en1"},
{"interface": "en2", "port_number": 4, "type": "ethernet", "name": "en2"}
]
},
"symbol": ":/symbols/computer.svg",
"x": -69,
"y": -82,
"z": 1
}
]
},
"type": "topology",
"version": "ANYSTR"
}

View File

@ -0,0 +1,68 @@
{
"auto_start": false,
"name": "1_5_host",
"project_id": "ce17e635-bc1b-44df-946c-149e938dedc4",
"revision": 4,
"topology": {
"nodes": [
{
"description": "Host",
"id": 1,
"label": {
"color": "#ff000000",
"font": "TypeWriter,10,-1,5,75,0,0,0,0,0",
"text": "Host 1",
"x": 13.2734375,
"y": -25.0
},
"ports": [
{
"id": 1,
"name": "nio_gen_eth:bridge0",
"stub": true
},
{
"id": 2,
"name": "nio_gen_eth:en0",
"stub": true
},
{
"id": 3,
"name": "nio_gen_eth:en1",
"stub": true
},
{
"id": 4,
"name": "nio_gen_eth:en2",
"stub": true
}
],
"properties": {
"name": "Host 1",
"nios": [
"nio_gen_eth:bridge0",
"nio_gen_eth:en0",
"nio_gen_eth:en1",
"nio_gen_eth:en2"
]
},
"server_id": 1,
"type": "Host",
"x": -69.5,
"y": -82.5
}
],
"servers": [
{
"host": "127.0.0.1",
"id": 1,
"local": true,
"port": 3080,
"protocol": "http",
"vm": false
}
]
},
"type": "topology",
"version": "1.5.1"
}