Skip to content

Commit

Permalink
Support Docker & Remote server in topo conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
julien-duponchelle committed Jul 12, 2016
1 parent fc26a96 commit 5a576f0
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 3 deletions.
3 changes: 3 additions & 0 deletions gns3server/controller/topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ def _convert_1_3_later(topo):
compute["compute_id"] = "vm"
compute["name"] = "GNS3 VM"
else:
compute["name"] = "Remote {}".format(server["id"])
compute["compute_id"] = str(uuid.uuid4())
server_id_to_compute_id[server["id"]] = compute["compute_id"]
new_topo["topology"]["computes"].append(compute)
Expand Down Expand Up @@ -170,6 +171,8 @@ def _convert_1_3_later(topo):
node["symbol"] = ":/symbols/qemu_guest.svg"
elif old_node["type"] == "DockerVM":
node["node_type"] = "docker"
if node["symbol"] is None:
node["symbol"] = ":/symbols/docker_guest.svg"
elif old_node["type"] == "ATMSwitch":
node["node_type"] = "atm_switch"
node["symbol"] = ":/symbols/atm_switch.svg"
Expand Down
50 changes: 50 additions & 0 deletions tests/topologies/1_5_docker_remote/after/1_5_docker_remote.gns3
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "1_5_docker_remote",
"project_id": "8182b710-c6bf-4e51-8e2e-213cce952797",
"revision": 5,
"auto_start": false,
"topology": {
"computes": [
{
"compute_id": "ANYUUID",
"host": "127.0.0.1",
"name": "Remote 2",
"port": 8001,
"protocol": "http"
}
],
"drawings": [],
"links": [],
"nodes": [
{
"compute_id": "ANYUUID",
"console": 6001,
"console_type": "telnet",
"label": {
"rotation": 0,
"style": "font-family: TypeWriter;font-size: 10;font-weight: bold;fill: #000000;fill-opacity: 1.0;",
"text": "remote_busybox-1",
"x": -20,
"y": -25
},
"name": "remote_busybox-1",
"node_id": "d397ef5a-84f1-4b6b-9d44-671937ec7781",
"node_type": "docker",
"properties": {
"adapters": 1,
"aux": 6002,
"console_http_path": "/",
"console_http_port": 80,
"console_resolution": "1024x768",
"image": "busybox:latest"
},
"symbol": ":/symbols/docker_guest.svg",
"x": -53,
"y": -69,
"z": 1
}
]
},
"type": "topology",
"version": "2.0.0dev1"
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"auto_start": false,
"name": "untitled",
"project_id": "926e5c9e-887c-41b2-9214-fbd5fb628fe8",
"name": "1_5_docker_remote",
"project_id": "8182b710-c6bf-4e51-8e2e-213cce952797",
"revision": 4,
"topology": {
"nodes": [
Expand Down Expand Up @@ -55,4 +55,4 @@
},
"type": "topology",
"version": "1.5.1dev1"
}
}

0 comments on commit 5a576f0

Please sign in to comment.