Start of support for topologies before 2.X

Missing part:
* GNS3 VM
* Cloud
* Image

Ref #564

Early support of conversion from 1.5
This commit is contained in:
Julien Duponchelle committed 2016-07-12 17:14:35 +02:00
1 parent fd0e8f89db
commit ee533943c8
26 files changed
+1860 -8

No files matched your search

+7 -2
View File
@@ -34,6 +34,7 @@ def test_project_to_topology_empty(tmpdir):
assert topo == {
"project_id": project.id,
"name": "Test",
"auto_start": False,
"revision": 5,
"topology": {
"nodes": [],
@@ -106,11 +107,15 @@ def test_load_topology_file_error_schema_error(tmpdir):
topo = load_topology(path)
def test_load_old_topology(tmpdir):
def test_load_newer_topology(tmpdir):
"""
If a topology is design for a more recent GNS3 version
we disallow the loading.
"""
data = {
"project_id": "69f26504-7aa3-48aa-9f29-798d44841211",
"name": "Test",
"revision": 4,
"revision": 42,
"topology": {
},
"type": "topology",
+111
View File
@@ -0,0 +1,111 @@
#!/usr/bin/env python
#
# Copyright (C) 2016 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# This will test the conversion from old topology format to the new
#
# Read tests/topologies/README.rst for documentation
import os
import json
import pytest
import shutil
from gns3server.controller.topology import load_topology, GNS3_FILE_FORMAT_REVISION
topologies_directory = os.path.join(os.path.dirname(os.path.realpath(__file__)), "topologies")
def topologies():
dirs = []
for directory in os.listdir(topologies_directory):
if os.path.isdir(os.path.join(topologies_directory, directory)):
dirs.append(directory)
return dirs
@pytest.mark.parametrize("directory", topologies())
def test_convert(directory, tmpdir):
before_directory = os.path.join(topologies_directory, directory, "before")
after_directory = os.path.join(topologies_directory, directory, "after")
assert os.path.exists(before_directory), "No before directory found file for {}".format(directory)
assert os.path.exists(after_directory), "No after directory found file for {}".format(directory)
gns3_file = None
for file in os.listdir(before_directory):
if file.endswith(".gns3"):
gns3_file = file
assert gns3_file, "No .gns3 found file for {}".format(before_directory)
with open(os.path.join(before_directory, gns3_file)) as f:
before_topology = json.load(f)
with open(os.path.join(after_directory, gns3_file)) as f:
after_topology = json.load(f)
# We use a temporary directory for conversion operation to not corrupt our files
work_directory = str(tmpdir / "work")
shutil.copytree(before_directory, work_directory)
work_topology = load_topology(os.path.join(work_directory, gns3_file))
assert work_topology
if "revision" not in before_topology or before_topology["revision"] < GNS3_FILE_FORMAT_REVISION:
assert os.path.exists(os.path.join(work_directory, gns3_file + ".backup"))
# We should have the same file in after directory and the work directory
for root, dirs, files in os.walk(after_directory):
for file in files:
directory = os.path.relpath(root, after_directory)
file_path = os.path.join(work_directory, directory, file)
assert os.path.exists(file_path), "{} is missing".format(os.path.join(directory, file))
# For non .gns3 file we check if the file are the same
if not file_path.endswith(".gns3"):
assert os.stat(file_path).st_size == os.stat(os.path.join(os.path.join(root, file))).st_size, "File {} is different".format(os.path.join(directory, file))
compare_dict("/", work_topology, after_topology)
def compare_dict(path, source, reference):
"""
Compare two dictionnary of a topology
"""
assert isinstance(source, dict), "Source is not a dict in {}".format(path)
for key in source:
assert key in reference, "Unexcepted {} in {} it should be {}".format(key, source, reference)
for key in sorted(reference.keys()):
val = reference[key]
assert key in source, "{} is missing in {}".format(key, source)
if isinstance(val, str) or isinstance(val, float) or isinstance(val, int) or isinstance(val, bool) or val is None:
if val == "ANYSTR":
pass
elif val == "ANYUUID" and len(source[key]) == 36:
pass
else:
assert val == source[key], "Wrong value for {}: \n{}\nit should be\n{}".format(key, source[key], val)
elif isinstance(val, dict):
compare_dict(path + key + "/", source[key], val)
elif isinstance(val, list):
assert len(val) == len(source[key]), "Not enough value in {} ({}/{}) it shoud be {} not {}".format(key, len(val), len(source[key]), val, source[key])
for idx, element in enumerate(source[key]):
compare_dict(path + key + "/", element, val[idx])
else:
assert False, "Value type for {} is not supported".format(key)
@@ -0,0 +1,197 @@
{
"name": "builtins",
"project_id": "644e3892-4a50-4457-9601-2234d4842169",
"revision": 5,
"auto_start": false,
"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": "ATM1",
"x": 6,
"y": -25
},
"name": "ATM1",
"node_id": "ANYUUID",
"node_type": "atm_switch",
"properties": {
"mappings": {
"1:0:100": "10:0:200"
}
},
"symbol": ":/symbols/atm_switch.svg",
"x": -398,
"y": -219,
"z": 1
},
{
"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": "HUB1",
"x": 17,
"y": -25
},
"name": "HUB1",
"node_id": "ANYUUID",
"node_type": "ethernet_hub",
"properties": {
"ports": [
{
"name": "Ethernet1",
"port_number": 1
},
{
"name": "Ethernet2",
"port_number": 2
},
{
"name": "Ethernet3",
"port_number": 3
},
{
"name": "Ethernet4",
"port_number": 4
},
{
"name": "Ethernet5",
"port_number": 5
},
{
"name": "Ethernet6",
"port_number": 6
},
{
"name": "Ethernet7",
"port_number": 7
},
{
"name": "Ethernet8",
"port_number": 8
}
]
},
"symbol": ":/symbols/hub.svg",
"x": -176,
"y": -209,
"z": 1
},
{
"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": "SW1",
"x": 20,
"y": -25
},
"name": "SW1",
"node_id": "ANYUUID",
"node_type": "ethernet_switch",
"properties": {
"ports": [
{
"name": "Ethernet1",
"port_number": 1,
"type": "access",
"vlan": 1
},
{
"name": "Ethernet2",
"port_number": 2,
"type": "access",
"vlan": 1
},
{
"name": "Ethernet3",
"port_number": 3,
"type": "access",
"vlan": 1
},
{
"name": "Ethernet4",
"port_number": 4,
"type": "access",
"vlan": 1
},
{
"name": "Ethernet5",
"port_number": 5,
"type": "access",
"vlan": 1
},
{
"name": "Ethernet6",
"port_number": 6,
"type": "access",
"vlan": 1
},
{
"name": "Ethernet7",
"port_number": 7,
"type": "access",
"vlan": 1
},
{
"name": "Ethernet8",
"port_number": 8,
"type": "access",
"vlan": 1
}
]
},
"symbol": ":/symbols/ethernet_switch.svg",
"x": 5,
"y": -206,
"z": 1
},
{
"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": "FR1",
"x": 11,
"y": -25
},
"name": "FR1",
"node_id": "ANYUUID",
"node_type": "frame_relay_switch",
"properties": {
"mappings": {
"1:101": "10:202"
}
},
"symbol": ":/symbols/frame_relay_switch.svg",
"x": 294,
"y": -209,
"z": 1
}
]
},
"type": "topology",
"version": "2.0.0dev1"
}
@@ -0,0 +1,204 @@
{
"auto_start": false,
"name": "builtins",
"project_id": "644e3892-4a50-4457-9601-2234d4842169",
"revision": 4,
"topology": {
"nodes": [
{
"description": "ATM switch",
"device_id": "4fed7243-cd30-4e37-bdd4-d21ed9e65c03",
"id": 1,
"label": {
"color": "#ff000000",
"font": "TypeWriter,10,-1,5,75,0,0,0,0,0",
"text": "ATM1",
"x": 6.546875,
"y": -25.0
},
"properties": {
"name": "ATM1",
"mappings": {
"1:0:100": "10:0:200"
}
},
"server_id": 3,
"type": "ATMSwitch",
"x": -398.5,
"y": -219.5
},
{
"description": "Ethernet hub",
"device_id": "40199896-fabd-42d8-9bca-4651a73159dd",
"id": 2,
"label": {
"color": "#ff000000",
"font": "TypeWriter,10,-1,5,75,0,0,0,0,0",
"text": "HUB1",
"x": 17.9765625,
"y": -25.0
},
"ports": [
{
"id": 1,
"name": "1",
"port_number": 1
},
{
"id": 2,
"name": "2",
"port_number": 2
},
{
"id": 3,
"name": "3",
"port_number": 3
},
{
"id": 4,
"name": "4",
"port_number": 4
},
{
"id": 5,
"name": "5",
"port_number": 5
},
{
"id": 6,
"name": "6",
"port_number": 6
},
{
"id": 7,
"name": "7",
"port_number": 7
},
{
"id": 8,
"name": "8",
"port_number": 8
}
],
"properties": {
"name": "HUB1"
},
"server_id": 3,
"type": "EthernetHub",
"x": -176.0,
"y": -209.0
},
{
"description": "Ethernet switch",
"device_id": "96d18119-cc78-4129-9543-932f8b202d52",
"id": 3,
"label": {
"color": "#ff000000",
"font": "TypeWriter,10,-1,5,75,0,0,0,0,0",
"text": "SW1",
"x": 20.8359375,
"y": -25.0
},
"ports": [
{
"id": 9,
"name": "1",
"port_number": 1,
"type": "access",
"vlan": 1
},
{
"id": 10,
"name": "2",
"port_number": 2,
"type": "access",
"vlan": 1
},
{
"id": 11,
"name": "3",
"port_number": 3,
"type": "access",
"vlan": 1
},
{
"id": 12,
"name": "4",
"port_number": 4,
"type": "access",
"vlan": 1
},
{
"id": 13,
"name": "5",
"port_number": 5,
"type": "access",
"vlan": 1
},
{
"id": 14,
"name": "6",
"port_number": 6,
"type": "access",
"vlan": 1
},
{
"id": 15,
"name": "7",
"port_number": 7,
"type": "access",
"vlan": 1
},
{
"id": 16,
"name": "8",
"port_number": 8,
"type": "access",
"vlan": 1
}
],
"properties": {
"name": "SW1"
},
"server_id": 3,
"type": "EthernetSwitch",
"x": 5.5,
"y": -206.0
},
{
"description": "Frame Relay switch",
"device_id": "3bb18be3-0692-47be-a98e-213fa5f1ba73",
"id": 5,
"label": {
"color": "#ff000000",
"font": "TypeWriter,10,-1,5,75,0,0,0,0,0",
"text": "FR1",
"x": 11.890625,
"y": -25.0
},
"properties": {
"name": "FR1",
"mappings": {
"1:101": "10:202"
}
},
"server_id": 3,
"type": "FrameRelaySwitch",
"x": 294.5,
"y": -209.5
}
],
"servers": [
{
"host": "127.0.0.1",
"id": 3,
"local": true,
"port": 3080,
"protocol": "http",
"vm": false
}
]
},
"type": "topology",
"version": "1.5.1dev1"
}
@@ -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"
}
@@ -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": [
@@ -55,4 +55,4 @@
},
"type": "topology",
"version": "1.5.1dev1"
}
}
@@ -0,0 +1,40 @@
{
"auto_start": false,
"name": "1_5_drawing",
"project_id": "ANYUUID",
"revision": 5,
"topology": {
"computes": [
],
"drawings": [
{
"drawing_id": "ANYUUID",
"rotation": 0,
"svg": "<svg height=\"200\" width=\"200\"><ellipse cx=\"100\" cy=\"100\" fill=\"#ffffff\" fill-opacity=\"1.0\" rx=\"100\" ry=\"100\" stroke-dasharray=\"25, 25\" stroke=\"#000000\" stroke-width=\"2\" /></svg>",
"x": 179,
"y": -44,
"z": 0
},
{
"drawing_id": "ANYUUID",
"rotation": 0,
"svg": "<svg height=\"20\" width=\"40\"><text fill=\"#000000\" fill-opacity=\"1.0\" font-family=\"TypeWriter\" font-size=\"10\" font-weight=\"bold\" font-style=\"italic\">Test</text></svg>",
"x": -151,
"y": 93,
"z": 0
},
{
"drawing_id": "ANYUUID",
"rotation": 0,
"svg": "<svg height=\"100\" width=\"200\"><rect fill=\"#18ffff\" fill-opacity=\"1.0\" height=\"100\" width=\"200\" stroke=\"#c80000\" stroke-width=\"2\" /></svg>",
"x": -210,
"y": -108,
"z": 0
}
],
"links": [],
"nodes": []
},
"type": "topology",
"version": "2.0.0dev1"
}
@@ -0,0 +1,38 @@
{
"auto_start": false,
"name": "1_5_drawing",
"project_id": null,
"revision": 4,
"topology": {
"ellipses": [
{
"border_style": 2,
"height": 200.0,
"width": 200.0,
"x": 179.0,
"y": -44.0
}
],
"notes": [
{
"color": "#ff000000",
"font": "TypeWriter,10,-1,5,75,1,0,0,0,0",
"text": "Test",
"x": -151.0,
"y": 93.0
}
],
"rectangles": [
{
"border_color": "#c80000",
"color": "#18ffff",
"height": 100.0,
"width": 200.0,
"x": -210.0,
"y": -108.0
}
]
},
"type": "topology",
"version": "1.5.1dev1"
}
@@ -0,0 +1,109 @@
{
"auto_start": false,
"name": "1_5_dynamips",
"project_id": "62f389c0-f26d-43b7-ab29-e4d306b29c07",
"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": 5000,
"console_type": "telnet",
"label": {
"rotation": 0,
"style": "font-family: TypeWriter;font-size: 10;font-weight: bold;fill: #000000;fill-opacity: 1.0;",
"text": "R1",
"x": 22,
"y": -25
},
"name": "R1",
"node_id": "11845dea-f175-495b-9fc5-bf20a2262016",
"node_type": "dynamips",
"properties": {
"auto_delete_disks": true,
"clock_divisor": 8,
"disk0": 0,
"disk1": 0,
"dynamips_id": 1,
"exec_area": 64,
"idlemax": 500,
"idlepc": "0x60aa1da0",
"idlesleep": 30,
"image": "c3745-adventerprisek9-mz.124-25d.image",
"image_md5sum": "ddbaf74274822b50fa9670e10c75b08f",
"iomem": 5,
"mac_addr": "c401.6b0f.0000",
"mmap": true,
"nvram": 256,
"platform": "c3745",
"ram": 256,
"slot0": "GT96100-FE",
"sparsemem": true,
"startup_config": "configs/i1_startup-config.cfg",
"system_id": "FTX0945W0MY"
},
"symbol": ":/symbols/router.svg",
"x": -112,
"y": -46,
"z": 1
},
{
"compute_id": "local",
"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": "ESW1",
"x": 7,
"y": -25
},
"name": "ESW1",
"node_id": "4478a968-72a1-4722-9039-db7561c717c4",
"node_type": "dynamips",
"properties": {
"auto_delete_disks": false,
"chassis": "3660",
"clock_divisor": 4,
"disk0": 1,
"disk1": 0,
"dynamips_id": 2,
"exec_area": 64,
"idlemax": 500,
"idlepc": "0x6076e0b4",
"idlesleep": 30,
"image": "c3660-a3jk9s-mz.124-15.T14.image",
"image_md5sum": "daed99f508fd42dbaacf711e560643ed",
"iomem": 5,
"mac_addr": "cc02.6b5c.0000",
"mmap": true,
"nvram": 256,
"platform": "c3600",
"ram": 192,
"slot0": "Leopard-2FE",
"slot1": "NM-16ESW",
"sparsemem": true,
"startup_config": "configs/i2_startup-config.cfg",
"system_id": "FTX0945W0MY"
},
"symbol": ":/symbols/multilayer_switch.svg",
"x": 55,
"y": -76,
"z": 1
}
]
},
"type": "topology",
"version": "2.0.0dev1"
}
@@ -0,0 +1,231 @@
{
"auto_start": false,
"name": "1_5_dynamips",
"project_id": "62f389c0-f26d-43b7-ab29-e4d306b29c07",
"revision": 4,
"topology": {
"nodes": [
{
"description": "Router c3745",
"dynamips_id": 1,
"id": 1,
"label": {
"color": "#ff000000",
"font": "TypeWriter,10,-1,5,75,0,0,0,0,0",
"text": "R1",
"x": 22.2578125,
"y": -25.0
},
"ports": [
{
"adapter_number": 0,
"id": 1,
"name": "FastEthernet0/0",
"port_number": 0
},
{
"adapter_number": 0,
"id": 2,
"name": "FastEthernet0/1",
"port_number": 1
}
],
"properties": {
"auto_delete_disks": true,
"clock_divisor": 8,
"console": 5000,
"disk0": 0,
"disk1": 0,
"exec_area": 64,
"idlemax": 500,
"idlepc": "0x60aa1da0",
"idlesleep": 30,
"image": "c3745-adventerprisek9-mz.124-25d.image",
"image_md5sum": "ddbaf74274822b50fa9670e10c75b08f",
"iomem": 5,
"mac_addr": "c401.6b0f.0000",
"mmap": true,
"name": "R1",
"nvram": 256,
"platform": "c3745",
"ram": 256,
"slot0": "GT96100-FE",
"sparsemem": true,
"startup_config": "configs/i1_startup-config.cfg",
"system_id": "FTX0945W0MY"
},
"server_id": 3,
"type": "C3745",
"vm_id": "11845dea-f175-495b-9fc5-bf20a2262016",
"x": -112.19595949289331,
"y": -46.04163056034261
},
{
"description": "Router c3600",
"dynamips_id": 2,
"id": 2,
"label": {
"color": "#ff000000",
"font": "TypeWriter,10,-1,5,75,0,0,0,0,0",
"text": "ESW1",
"x": 7.8359375,
"y": -25.0
},
"ports": [
{
"adapter_number": 0,
"id": 3,
"name": "FastEthernet0/0",
"port_number": 0
},
{
"adapter_number": 0,
"id": 4,
"name": "FastEthernet0/1",
"port_number": 1
},
{
"adapter_number": 1,
"id": 5,
"name": "FastEthernet1/0",
"port_number": 0
},
{
"adapter_number": 1,
"id": 6,
"name": "FastEthernet1/1",
"port_number": 1
},
{
"adapter_number": 1,
"id": 7,
"name": "FastEthernet1/2",
"port_number": 2
},
{
"adapter_number": 1,
"id": 8,
"name": "FastEthernet1/3",
"port_number": 3
},
{
"adapter_number": 1,
"id": 9,
"name": "FastEthernet1/4",
"port_number": 4
},
{
"adapter_number": 1,
"id": 10,
"name": "FastEthernet1/5",
"port_number": 5
},
{
"adapter_number": 1,
"id": 11,
"name": "FastEthernet1/6",
"port_number": 6
},
{
"adapter_number": 1,
"id": 12,
"name": "FastEthernet1/7",
"port_number": 7
},
{
"adapter_number": 1,
"id": 13,
"name": "FastEthernet1/8",
"port_number": 8
},
{
"adapter_number": 1,
"id": 14,
"name": "FastEthernet1/9",
"port_number": 9
},
{
"adapter_number": 1,
"id": 15,
"name": "FastEthernet1/10",
"port_number": 10
},
{
"adapter_number": 1,
"id": 16,
"name": "FastEthernet1/11",
"port_number": 11
},
{
"adapter_number": 1,
"id": 17,
"name": "FastEthernet1/12",
"port_number": 12
},
{
"adapter_number": 1,
"id": 18,
"name": "FastEthernet1/13",
"port_number": 13
},
{
"adapter_number": 1,
"id": 19,
"name": "FastEthernet1/14",
"port_number": 14
},
{
"adapter_number": 1,
"id": 20,
"name": "FastEthernet1/15",
"port_number": 15
}
],
"properties": {
"auto_delete_disks": false,
"chassis": "3660",
"clock_divisor": 4,
"console": 5001,
"disk0": 1,
"disk1": 0,
"exec_area": 64,
"idlemax": 500,
"idlepc": "0x6076e0b4",
"idlesleep": 30,
"image": "c3660-a3jk9s-mz.124-15.T14.image",
"image_md5sum": "daed99f508fd42dbaacf711e560643ed",
"iomem": 5,
"mac_addr": "cc02.6b5c.0000",
"mmap": true,
"name": "ESW1",
"nvram": 256,
"platform": "c3600",
"ram": 192,
"slot0": "Leopard-2FE",
"slot1": "NM-16ESW",
"sparsemem": true,
"startup_config": "configs/i2_startup-config.cfg",
"system_id": "FTX0945W0MY"
},
"server_id": 3,
"symbol": ":/symbols/multilayer_switch.svg",
"type": "C3600",
"vm_id": "4478a968-72a1-4722-9039-db7561c717c4",
"x": 55,
"y": -76
}
],
"servers": [
{
"host": "127.0.0.1",
"id": 3,
"local": true,
"port": 3080,
"protocol": "http",
"vm": false
}
]
},
"type": "topology",
"version": "1.5.1dev1"
}
@@ -0,0 +1,63 @@
{
"name": "testqemu",
"project_id": "a3ca8a82-6b11-4c8e-b20d-c9e94286054c",
"revision": 5,
"auto_start": false,
"topology": {
"computes": [
{
"compute_id": "local",
"host": "127.0.0.1",
"name": "Local",
"port": 3080,
"protocol": "http"
}
],
"drawings": [],
"links": [],
"nodes": [
{
"compute_id": "local",
"console": 5000,
"console_type": "telnet",
"label": {
"rotation": 0,
"style": "font-family: TypeWriter;font-size: 10;font-weight: bold;fill: #000000;fill-opacity: 1.0;",
"text": "MicroCore-1",
"x": -4,
"y": -25
},
"name": "MicroCore-1",
"node_id": "426face4-7f73-436b-88fa-050e3ee101e9",
"node_type": "qemu",
"properties": {
"acpi_shutdown": false,
"adapter_type": "e1000",
"adapters": 1,
"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_interface": "ide",
"hdb_disk_interface": "ide",
"hdc_disk_interface": "ide",
"hdd_disk_interface": "ide",
"legacy_networking": false,
"mac_address": "00:05:4c:01:e9:00",
"options": "-nographic",
"platform": "x86_64",
"process_priority": "normal",
"qemu_path": "/usr/local/bin/qemu-system-x86_64",
"ram": 256
},
"symbol": ":/symbols/qemu_guest.svg",
"x": -88,
"y": -102,
"z": 1
}
]
},
"type": "topology",
"version": "2.0.0dev1"
}
@@ -0,0 +1,72 @@
{
"auto_start": false,
"name": "testqemu",
"project_id": "a3ca8a82-6b11-4c8e-b20d-c9e94286054c",
"revision": 4,
"topology": {
"nodes": [
{
"description": "QEMU VM",
"id": 1,
"label": {
"color": "#ff000000",
"font": "TypeWriter,10,-1,5,75,0,0,0,0,0",
"text": "MicroCore-1",
"x": -4.1875,
"y": -25.0
},
"linked_clone": true,
"port_name_format": "Ethernet{0}",
"ports": [
{
"adapter_number": 0,
"id": 1,
"name": "Ethernet0",
"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:05:4c:01:e9:00",
"name": "MicroCore-1",
"options": "-nographic",
"platform": "x86_64",
"process_priority": "normal",
"qemu_path": "/usr/local/bin/qemu-system-x86_64",
"ram": 256
},
"server_id": 3,
"type": "QemuVM",
"vm_id": "426face4-7f73-436b-88fa-050e3ee101e9",
"x": -88.5,
"y": -102.5
}
],
"servers": [
{
"host": "127.0.0.1",
"id": 3,
"local": true,
"port": 3080,
"protocol": "http",
"vm": false
}
]
},
"type": "topology",
"version": "1.5.1dev1"
}
@@ -0,0 +1,52 @@
{
"auto_start": false,
"name": "1_5_virtualbox",
"project_id": "bf00c459-05a5-45c0-950c-3f6150a20703",
"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": 5000,
"console_type": "telnet",
"label": {
"rotation": 0,
"style": "font-family: TypeWriter;font-size: 10;font-weight: bold;fill: #000000;fill-opacity: 1.0;",
"text": "debian",
"x": 11,
"y": -25
},
"name": "debian",
"node_id": "af5fa728-85da-44f1-b17a-e99a65a7037e",
"node_type": "virtualbox",
"properties": {
"acpi_shutdown": false,
"adapter_type": "Intel PRO/1000 MT Desktop (82540EM)",
"adapters": 1,
"enable_remote_console": false,
"headless": false,
"ram": 512,
"use_any_adapter": false,
"vmname": "debian"
},
"symbol": ":/symbols/vbox_guest.svg",
"x": -48,
"y": -43,
"z": 1
}
]
},
"type": "topology",
"version": "2.0.0dev1"
}
@@ -0,0 +1,60 @@
{
"auto_start": false,
"name": "1_5_virtualbox",
"project_id": "bf00c459-05a5-45c0-950c-3f6150a20703",
"revision": 4,
"topology": {
"nodes": [
{
"description": "VirtualBox VM",
"id": 1,
"label": {
"color": "#ff000000",
"font": "TypeWriter,10,-1,5,75,0,0,0,0,0",
"text": "debian",
"x": 11.1015625,
"y": -25.0
},
"linked_clone": false,
"port_name_format": "Ethernet{0}",
"ports": [
{
"adapter_number": 0,
"id": 1,
"name": "Ethernet0",
"port_number": 0
}
],
"properties": {
"acpi_shutdown": false,
"adapter_type": "Intel PRO/1000 MT Desktop (82540EM)",
"adapters": 1,
"console": 5000,
"enable_remote_console": false,
"headless": false,
"name": "debian",
"ram": 512,
"use_any_adapter": false,
"vmname": "debian"
},
"server_id": 3,
"type": "VirtualBoxVM",
"vm_id": "af5fa728-85da-44f1-b17a-e99a65a7037e",
"x": -48.5,
"y": -43.5
}
],
"servers": [
{
"host": "127.0.0.1",
"id": 3,
"local": true,
"port": 3080,
"protocol": "http",
"vm": false
}
]
},
"type": "topology",
"version": "1.5.1dev1"
}
@@ -0,0 +1,51 @@
{
"name": "1_5_vmware",
"project_id": "4be1f3e5-76e5-4223-93b7-f37f4091549e",
"revision": 5,
"auto_start": false,
"topology": {
"computes": [
{
"compute_id": "local",
"host": "127.0.0.1",
"name": "Local",
"port": 3080,
"protocol": "http"
}
],
"drawings": [],
"links": [],
"nodes": [
{
"compute_id": "local",
"console": 2000,
"console_type": "telnet",
"label": {
"rotation": 0,
"style": "font-family: TypeWriter;font-size: 10;font-weight: bold;fill: #000000;fill-opacity: 1.0;",
"text": "GNS3 VM",
"x": 5,
"y": -25
},
"name": "GNS3 VM",
"node_id": "9e06d0ce-e8df-4f38-bdfa-7c83e19a91c1",
"node_type": "vmware",
"properties": {
"acpi_shutdown": false,
"adapter_type": "e1000",
"adapters": 1,
"enable_remote_console": false,
"headless": false,
"use_any_adapter": false,
"vmx_path": "/Users/bob/Documents/Virtual Machines.localized/GNS3 VM.vmwarevm/GNS3 VM.vmx"
},
"symbol": ":/symbols/vmware_guest.svg",
"x": 7,
"y": 8,
"z": 1
}
]
},
"type": "topology",
"version": "2.0.0dev1"
}
@@ -0,0 +1,60 @@
{
"auto_start": false,
"name": "1_5_vmware",
"project_id": "4be1f3e5-76e5-4223-93b7-f37f4091549e",
"revision": 4,
"topology": {
"nodes": [
{
"description": "VMware VM",
"id": 1,
"label": {
"color": "#ff000000",
"font": "TypeWriter,10,-1,5,75,0,0,0,0,0",
"text": "GNS3 VM",
"x": 5.125,
"y": -25.0
},
"linked_clone": false,
"port_name_format": "Ethernet{0}",
"ports": [
{
"adapter_number": 0,
"id": 1,
"name": "Ethernet0",
"port_number": 0
}
],
"properties": {
"acpi_shutdown": false,
"adapter_type": "e1000",
"adapters": 1,
"console": 2000,
"enable_remote_console": false,
"headless": false,
"name": "GNS3 VM",
"use_any_adapter": false,
"use_ubridge": true,
"vmx_path": "/Users/bob/Documents/Virtual Machines.localized/GNS3 VM.vmwarevm/GNS3 VM.vmx"
},
"server_id": 3,
"type": "VMwareVM",
"vm_id": "9e06d0ce-e8df-4f38-bdfa-7c83e19a91c1",
"x": 7,
"y": 8
}
],
"servers": [
{
"host": "127.0.0.1",
"id": 3,
"local": true,
"port": 3080,
"protocol": "http",
"vm": false
}
]
},
"type": "topology",
"version": "1.5.1dev1"
}
@@ -0,0 +1,83 @@
{
"auto_start": false,
"name": "1_5_vpcs",
"project_id": "62fc7a04-ae65-4003-a9e6-a046b1996f0e",
"revision": 5,
"topology": {
"computes": [
{
"compute_id": "local",
"host": "127.0.0.1",
"name": "Local",
"port": 3080,
"protocol": "http"
}
],
"drawings": [],
"links": [
{
"link_id": "ANYUUID",
"nodes": [
{
"adapter_number": 0,
"node_id": "b570a150-c09f-47d9-8d32-9ca5b03234d6",
"port_number": 0
},
{
"adapter_number": 0,
"node_id": "0fd3dd4d-dc93-4a04-a9b9-7396a9e22e8b",
"port_number": 0
}
]
}
],
"nodes": [
{
"compute_id": "local",
"console": 5000,
"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": "0fd3dd4d-dc93-4a04-a9b9-7396a9e22e8b",
"node_type": "vpcs",
"properties": {
"startup_script_path": "startup.vpc"
},
"symbol": ":/symbols/vpcs_guest.svg",
"x": -87,
"y": -65,
"z": 1
},
{
"compute_id": "local",
"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": "PC2",
"x": 18,
"y": -25
},
"name": "PC2",
"node_id": "b570a150-c09f-47d9-8d32-9ca5b03234d6",
"node_type": "vpcs",
"properties": {
"startup_script_path": "startup.vpc"
},
"symbol": ":/symbols/vpcs_guest.svg",
"x": 123,
"y": -65,
"z": 1
}
]
},
"type": "topology",
"version": "ANYSTR"
}
@@ -0,0 +1,98 @@
{
"auto_start": false,
"name": "1_5_vpcs",
"project_id": "62fc7a04-ae65-4003-a9e6-a046b1996f0e",
"revision": 4,
"topology": {
"links": [
{
"description": "Link from PC2 port Ethernet0 to PC1 port Ethernet0",
"destination_node_id": 1,
"destination_port_id": 1,
"id": 1,
"source_node_id": 2,
"source_port_id": 2
}
],
"nodes": [
{
"description": "VPCS device",
"id": 1,
"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 PC2 on port Ethernet0",
"id": 1,
"link_id": 1,
"name": "Ethernet0",
"nio": "NIO_UDP",
"port_number": 0
}
],
"properties": {
"console": 5000,
"name": "PC1",
"startup_script_path": "startup.vpc"
},
"server_id": 3,
"symbol": ":/symbols/vpcs_guest.svg",
"type": "VPCSDevice",
"vm_id": "0fd3dd4d-dc93-4a04-a9b9-7396a9e22e8b",
"x": -87.5,
"y": -65.5
},
{
"description": "VPCS device",
"id": 2,
"label": {
"color": "#ff000000",
"font": "TypeWriter,10,-1,5,75,0,0,0,0,0",
"text": "PC2",
"x": 18.5859375,
"y": -25.0
},
"ports": [
{
"adapter_number": 0,
"description": "connected to PC1 on port Ethernet0",
"id": 2,
"link_id": 1,
"name": "Ethernet0",
"nio": "NIO_UDP",
"port_number": 0
}
],
"properties": {
"console": 5001,
"name": "PC2",
"startup_script_path": "startup.vpc"
},
"server_id": 3,
"symbol": ":/symbols/vpcs_guest.svg",
"type": "VPCSDevice",
"vm_id": "b570a150-c09f-47d9-8d32-9ca5b03234d6",
"x": 123.5,
"y": -65.5
}
],
"servers": [
{
"host": "127.0.0.1",
"id": 3,
"local": true,
"port": 3080,
"protocol": "http",
"vm": false
}
]
},
"type": "topology",
"version": "1.5.1dev1"
}
+30
View File
@@ -0,0 +1,30 @@
This directories contain topologies made for previous version of GNS3
Each directory is a GNS3 project. You have two directory inside:
* before
* after
Before is the state of the project before conversion and after
is the reference for checking if conversion is a success.
To check if file are the same we check the file size except
for .gns3
.gns3 check
###########
The .gns3 json is loaded and compare to the reference project.
You have some special value in the after project:
* "ANYSTR" allow for any string to match
* "ANYUUID" allow for any uuid to match
Run the tests
###############
You can run the tests with:
.. code:: bash
py.test -vv -x tests/test_topologies.py