From 27841576d6239f39b3c6241d67c966b3580ea35f Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Tue, 16 Feb 2016 18:47:08 +0100 Subject: [PATCH 1/5] Docker container support --- appliances/openvswitch.gns3a | 37 ++++++++-------------------------- check.py | 39 ++++++++++++++++++------------------ prettify_appliances.py | 28 ++++++++++++++------------ schemas/appliance.json | 34 +++++++++++++++++++++++++++---- 4 files changed, 73 insertions(+), 65 deletions(-) diff --git a/appliances/openvswitch.gns3a b/appliances/openvswitch.gns3a index 35d0482..63e8d01 100644 --- a/appliances/openvswitch.gns3a +++ b/appliances/openvswitch.gns3a @@ -3,37 +3,16 @@ "category": "multilayer_switch", "description": "Open vSwitch is a production quality, multilayer virtual switch licensed under the open source Apache 2.0 license. It is designed to enable massive network automation through programmatic extension, while still supporting standard management interfaces and protocols (e.g. NetFlow, sFlow, IPFIX, RSPAN, CLI, LACP, 802.1ag). In addition, it is designed to support distribution across multiple physical servers similar to VMware's vNetwork distributed vswitch or Cisco's Nexus 1000V.", "vendor_name": "Open vSwitch", - "vendor_url": "http://openvswitch.net/", - "documentation_url": "http://openvswitch.net/support", + "vendor_url": "http://openvswitch.org/", + "documentation_url": "http://openvswitch.org/support/", "product_name": "Open vSwitch", - "registry_version": 1, + "registry_version": 3, "status": "stable", "maintainer": "GNS3 Team", "maintainer_email": "developers@gns3.net", - "qemu": { - "adapter_type": "e1000", - "adapters": 24, - "ram": 128, - "arch": "x86_64", - "console_type": "telnet", - "kvm": "allow" - }, - "images": [ - { - "filename": "openvswitch-3.16.6-tinycore64.img", - "version": "3.16.6", - "md5sum": "88b777ef930c1a3849b6a40c0d3fd102", - "filesize": 70254592, - "download_url": "https://sourceforge.net/projects/gns-3/files/Qemu%20Appliances/", - "direct_download_url": "http://downloads.sourceforge.net/project/gns-3/Qemu%20Appliances/openvswitch-3.16.6-tinycore64.img" - } - ], - "versions": [ - { - "name": "3.16.6", - "images": { - "hda_disk_image": "openvswitch-3.16.6-tinycore64.img" - } - } - ] + "usage": "By default all interfaces are connected to the br0", + "docker": { + "adapters": 16, + "image": "gns3/openvswitch" + } } diff --git a/check.py b/check.py index a48dac8..c1c6318 100644 --- a/check.py +++ b/check.py @@ -35,26 +35,27 @@ def check_appliance(appliance): appliance_json = json.load(f) jsonschema.validate(appliance_json, schema) - for image in appliance_json['images']: - if image['filename'] in images: - print('Duplicate image filename ' + image['filename']) - sys.exit(1) - if image['md5sum'] in md5sums: - print('Duplicate image md5sum ' + image['md5sum']) - sys.exit(1) - images.add(image['filename']) - md5sums.add(image['md5sum']) - - for version in appliance_json['versions']: - for image in version['images'].values(): - found = False - for i in appliance_json['images']: - if i['filename'] in image: - found = True - - if not found: - print('Missing relation ' + i['filename'] + ' ' + ' in ' + appliance) + if 'images' in appliance_json: + for image in appliance_json['images']: + if image['filename'] in images: + print('Duplicate image filename ' + image['filename']) sys.exit(1) + if image['md5sum'] in md5sums: + print('Duplicate image md5sum ' + image['md5sum']) + sys.exit(1) + images.add(image['filename']) + md5sums.add(image['md5sum']) + + for version in appliance_json['versions']: + for image in version['images'].values(): + found = False + for i in appliance_json['images']: + if i['filename'] in image: + found = True + + if not found: + print('Missing relation ' + i['filename'] + ' ' + ' in ' + appliance) + sys.exit(1) def check_packer(packer): diff --git a/prettify_appliances.py b/prettify_appliances.py index 6289a9c..64b0600 100644 --- a/prettify_appliances.py +++ b/prettify_appliances.py @@ -58,20 +58,22 @@ for appliance in glob.glob('appliances/*.gns3a'): if isinstance(val, dict): config[key] = OrderedDict(sorted(val.items(), key=lambda t: sort_key_using_schema(schema['properties'][key], t[0]))) - images = [] - for image in config['images']: - clean_urls(image) - images.append(OrderedDict(sorted(image.items(), key=lambda t: sort_key_using_schema(schema['properties']['images']['items'], t[0])))) - images = sorted(images, key=lambda t: t['version'], reverse=True) - config['images'] = images + if 'images' in config: + images = [] + for image in config['images']: + clean_urls(image) + images.append(OrderedDict(sorted(image.items(), key=lambda t: sort_key_using_schema(schema['properties']['images']['items'], t[0])))) + images = sorted(images, key=lambda t: t['version'], reverse=True) + config['images'] = images - versions = [] - for version in config['versions']: - version = OrderedDict(sorted(version.items(), key=lambda t: sort_key_using_schema(schema['properties']['versions']['items'], t[0]))) - version['images'] = OrderedDict(sorted(version['images'].items(), key=lambda t: sort_key_using_schema(schema['properties']['versions']['items']['properties']['images'], t[0]))) - versions.append(version) - versions = sorted(versions, key=lambda t: t['name'], reverse=True) - config['versions'] = versions + if 'versions' in config: + versions = [] + for version in config['versions']: + version = OrderedDict(sorted(version.items(), key=lambda t: sort_key_using_schema(schema['properties']['versions']['items'], t[0]))) + version['images'] = OrderedDict(sorted(version['images'].items(), key=lambda t: sort_key_using_schema(schema['properties']['versions']['items']['properties']['images'], t[0]))) + versions.append(version) + versions = sorted(versions, key=lambda t: t['name'], reverse=True) + config['versions'] = versions # Validate our changes jsonschema.validate(config, schema) diff --git a/schemas/appliance.json b/schemas/appliance.json index 9d91548..128b4bb 100644 --- a/schemas/appliance.json +++ b/schemas/appliance.json @@ -55,7 +55,7 @@ "title": "An optional product url on vendor website" }, "registry_version": { - "enum": [1, 2], + "enum": [1, 2, 3], "title": "Version of the registry compatible with this appliance" }, "status": { @@ -96,6 +96,34 @@ "title": "False if you don't want to use a single image for all nodes" }, + "docker": { + "type": "object", + "title": "Docker specific options", + "properties": { + "adapters": { + "type": "integer", + "title": "Number of ethernet adapters" + }, + "image": { + "type": "string", + "title": "Docker image in the Docker Hub" + }, + "start_command": { + "type": "string", + "title": "Command executed when the container start. Empty will use the default" + }, + "environment": { + "type": "string", + "title": "One KEY=VAR environment by line" + } + }, + "additionalProperties": false, + "required": [ + "adapters", + "image" + ] + }, + "iou": { "type": "object", "title": "IOU specific options", @@ -400,8 +428,6 @@ "registry_version", "status", "maintainer", - "maintainer_email", - "images", - "versions" + "maintainer_email" ] } From 5638cc271954e5733591688f1601583fcc99ba2b Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Wed, 27 Apr 2016 17:12:38 +0200 Subject: [PATCH 2/5] Add more docker appliance --- appliances/chromium.gns3a | 17 +++++++++++++++++ appliances/opendaylight.gns3a | 17 +++++++++++++++++ appliances/openvswitch-management.gns3a | 19 +++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 appliances/chromium.gns3a create mode 100644 appliances/opendaylight.gns3a create mode 100644 appliances/openvswitch-management.gns3a diff --git a/appliances/chromium.gns3a b/appliances/chromium.gns3a new file mode 100644 index 0000000..92e11f5 --- /dev/null +++ b/appliances/chromium.gns3a @@ -0,0 +1,17 @@ +{ + "name": "Chromium", + "category": "guest", + "description": "The chromium browser", + "vendor_name": "Chromium", + "vendor_url": "http://openvswitch.org/", + "product_name": "Chromium", + "registry_version": 3, + "status": "stable", + "maintainer": "GNS3 Team", + "maintainer_email": "developers@gns3.net", + "console_type": "vnc", + "docker": { + "adapters": 1, + "image": "jess/chromium" + } +} diff --git a/appliances/opendaylight.gns3a b/appliances/opendaylight.gns3a new file mode 100644 index 0000000..357554b --- /dev/null +++ b/appliances/opendaylight.gns3a @@ -0,0 +1,17 @@ +{ + "name": "OpenDaylight", + "category": "router", + "description": "OpenDaylight is an open source SDN controller", + "vendor_name": "OpenDaylight foundation", + "vendor_url": "https://www.opendaylight.org", + "documentation_url": "https://www.opendaylight.org/start", + "product_name": "OpenDaylight", + "registry_version": 3, + "status": "stable", + "maintainer": "GNS3 Team", + "maintainer_email": "developers@gns3.net", + "docker": { + "adapters": 1, + "image": "opendaylight/odl" + } +} diff --git a/appliances/openvswitch-management.gns3a b/appliances/openvswitch-management.gns3a new file mode 100644 index 0000000..c2c815d --- /dev/null +++ b/appliances/openvswitch-management.gns3a @@ -0,0 +1,19 @@ +{ + "name": "Open vSwitch management", + "category": "multilayer_switch", + "description": "Open vSwitch is a production quality, multilayer virtual switch licensed under the open source Apache 2.0 license. It is designed to enable massive network automation through programmatic extension, while still supporting standard management interfaces and protocols (e.g. NetFlow, sFlow, IPFIX, RSPAN, CLI, LACP, 802.1ag). In addition, it is designed to support distribution across multiple physical servers similar to VMware's vNetwork distributed vswitch or Cisco's Nexus 1000V. This is a version of the appliance with a management interface on eth0.", + "vendor_name": "Open vSwitch", + "vendor_url": "http://openvswitch.org/", + "documentation_url": "http://openvswitch.org/support/", + "product_name": "Open vSwitch", + "registry_version": 3, + "status": "stable", + "maintainer": "GNS3 Team", + "maintainer_email": "developers@gns3.net", + "usage": "The eth0 is the management interface. By default all other interfaces are connected to the br0", + "docker": { + "adapters": 16, + "image": "gns3/openvswitch", + "environment": "MANAGEMENT_INTERFACE=1" + } +} From 9a076d3ea5ea478d5cbf4c7b4ef812270872cc4d Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Thu, 28 Apr 2016 09:24:17 +0200 Subject: [PATCH 3/5] Use our own chromium --- appliances/chromium.gns3a | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appliances/chromium.gns3a b/appliances/chromium.gns3a index 92e11f5..ba3b326 100644 --- a/appliances/chromium.gns3a +++ b/appliances/chromium.gns3a @@ -9,9 +9,9 @@ "status": "stable", "maintainer": "GNS3 Team", "maintainer_email": "developers@gns3.net", - "console_type": "vnc", "docker": { "adapters": 1, - "image": "jess/chromium" + "console_type": "vnc", + "image": "gns3/chromium" } } From 5d626e0095d90d754f3865fcb5886019fac15346 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Thu, 28 Apr 2016 09:25:06 +0200 Subject: [PATCH 4/5] Console type allowed for docker appliance --- schemas/appliance.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/schemas/appliance.json b/schemas/appliance.json index 128b4bb..4df1c73 100644 --- a/schemas/appliance.json +++ b/schemas/appliance.json @@ -115,6 +115,10 @@ "environment": { "type": "string", "title": "One KEY=VAR environment by line" + }, + "console_type": { + "enum": ["telnet", "vnc"], + "title": "Type of console connection for the administration of the appliance" } }, "additionalProperties": false, From bdc04798d4a3c1122868a56a2d8cec76c0eca92a Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Wed, 4 May 2016 18:58:33 +0200 Subject: [PATCH 5/5] ntopng appliance --- appliances/ntopng.gns3a | 19 +++++++++++++++++++ schemas/appliance.json | 10 +++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 appliances/ntopng.gns3a diff --git a/appliances/ntopng.gns3a b/appliances/ntopng.gns3a new file mode 100644 index 0000000..97f1f26 --- /dev/null +++ b/appliances/ntopng.gns3a @@ -0,0 +1,19 @@ +{ + "name": "ntopng", + "category": "guest", + "description": "ntopng is the next generation version of the original ntop, a network traffic probe that shows the network usage, similar to what the popular top Unix command does. ntopng is based on libpcap and it has been written in a portable way in order to virtually run on every Unix platform, MacOSX and on Windows as well. ntopng users can use a a web browser to navigate through ntop (that acts as a web server) traffic information and get a dump of the network status. In the latter case, ntopng can be seen as a simple RMON-like agent with an embedded web interface.", + "vendor_name": "ntop", + "vendor_url": "http://www.ntop.org/", + "product_name": "ntopng", + "registry_version": 3, + "status": "stable", + "maintainer": "GNS3 Team", + "maintainer_email": "developers@gns3.net", + "docker": { + "adapters": 1, + "console_type": "http", + "console_http_port": 3000, + "console_http_path": "/", + "image": "lucaderi/ntopng-docker:latest" + } +} diff --git a/schemas/appliance.json b/schemas/appliance.json index 4df1c73..4f8bfb2 100644 --- a/schemas/appliance.json +++ b/schemas/appliance.json @@ -117,8 +117,16 @@ "title": "One KEY=VAR environment by line" }, "console_type": { - "enum": ["telnet", "vnc"], + "enum": ["telnet", "vnc", "http", "https"], "title": "Type of console connection for the administration of the appliance" + }, + "console_http_port": { + "description": "Internal port in the container of the HTTP server", + "type": "integer" + }, + "console_http_path": { + "description": "Path of the web interface", + "type": "string" } }, "additionalProperties": false,