gns3_worker

gns3_worker.py

Creates project and nodes on GNS3 server and then populates their configuration.

Functions

invoker(servername_in, gns3_url_in, sw_vals_in, ...)

Add nodes to the new GNS3 project and push a copy of the configuration files

gns3_nodes_create_async(servername_in, gns3_url_in, ...)

Add nodes to the new GNS3 project and push a copy of the configuration files

gns3_connx_create_async(servername_in, gns3_url_in, ...)

Add nodes to the new GNS3 project and push a copy of the configuration files

gns3_post(session_in, url_in, method, **kwargs)

Send an async POST request to GNS3 server.

Module Contents

gns3_worker.invoker(servername_in, gns3_url_in, sw_vals_in, allconf_in, prj_id_in, connx_in)

Add nodes to the new GNS3 project and push a copy of the configuration files to their substrate docker containers. Use asyncio/aoihttp to let post requests with long completion time run in the background usign cooperative multitasking

Parameters:
  • servername_in (str) – The name of the aiohttp.ClientSession object used for the connections

  • gns3_url_in (str) – The URL to be posted to the GNS3 server

  • sw_vals_in (list) – List of needed data about the switches to be emulated

  • all_conf_in (list) – List-of-lists holding all of the switch’s configurations

  • connx_in (list) – List of connections we need to make between the GNS3 nodes we’re creating

  • allconf_in (list)

  • prj_id_in (str)

async gns3_worker.gns3_nodes_create_async(servername_in, gns3_url_in, sw_vals_in, allconf_in, prj_id_in)

Add nodes to the new GNS3 project and push a copy of the configuration files to their substrate docker containers.

Parameters:
  • servername_in (str) – The name of the aiohttp.ClientSession object used for the connections

  • gns3_url_in (str) – The URL to be posted to the GNS3 server

  • sw_vals_in (list) – List of needed data about the switches to be emulated

  • all_conf_in (list) – List-of-lists holding all of the switch’s configurations

  • allconf_in (list)

  • prj_id_in (str)

async gns3_worker.gns3_connx_create_async(servername_in, gns3_url_in, sw_vals_new, connx_in, prj_id_in)

Add nodes to the new GNS3 project and push a copy of the configuration files to their substrate docker containers.

Parameters:
  • servername_in (str) – The name of the aiohttp.ClientSession object used for the connections

  • gns3_url_in (str) – The URL to be posted to the GNS3 server

  • sw_vals_new (list) – List of needed data about the switches to be emulated. GNS3 node IDs were added by the gns3_nodes_create function.

  • connx_in (list) – List of node-to-node connections that we want to create in the GNS3 project

  • prj_id_in (str)

async gns3_worker.gns3_post(session_in, url_in, method, **kwargs)

Send an async POST request to GNS3 server.

Parameters:
  • session_in (str) – The name of the aiohttp.ClientSession object used for the connections

  • url_in (str) – The URL to be posted to the GNS3 server (includes project ID and node ID)

  • method (str) – The HTTP method (get, put, post) to be used in the request

  • jsondata (str) – Optional. Any JSON to be included with the HTTP request

Return type:

str