gns3converter.node

This module is used for building Nodes

class gns3converter.node.Node(hypervisor, port_id)

Bases: gns3converter.interfaces.Interfaces

This class defines a node used for building the Nodes configuration

Parameters:
  • hypervisor – Hypervisor
  • port_id (int) – starting port ID for this node
add_device_items(item, device)

Add the various items from the device to the node

Parameters:
  • item (str) – item key
  • device (dict) – dictionary containing items
add_info_from_hv()

Add the information we need from the old hypervisor section

add_mapping(mapping)
add_slot_ports(slot)

Add the ports to be added for a adapter card

Parameters:slot (str) – Slot name
add_to_qemu()

Add additional parameters to a QemuVM Device that were present in its global conf section

add_to_virtualbox()

Add additional parameters that were in the VBoxDevice section or not present

add_vm_ethernet_ports()

Add ethernet ports to Virtualbox and Qemu nodes

add_wic(old_wic, wic)

Convert the old style WIC slot to a new style WIC slot and add the WIC to the node properties

Parameters:
  • old_wic (str) – Old WIC slot
  • wic (str) – WIC name
add_wic_ports(wic_slot)

Add the ports for a specific WIC to the node[‘ports’] dictionary

Parameters:wic_slot (str) – WIC Slot (wic0)
calc_cloud_connection()

Add the ports and nios for a cloud connection

Returns:None on success or RuntimeError on error

Calculate a router or VirtualBox link

calc_ethsw_port(port_num, port_def)

Split and create the port entry for an Ethernet Switch

Parameters:
  • port_num (str or int) – port number
  • port_def (str) – port definition
calc_frsw_port(port_num, port_def)

Split and create the port entry for a Frame Relay Switch

Parameters:
  • port_num (str or int) – port number
  • port_def (str) – port definition

Add a link item for processing later

Parameters:
  • src_id (int) – Source node ID
  • src_port (int) – Source port ID
  • src_port_name (str) – Source port name
  • destination (dict) – Destination
calc_mb_ports()

Add the default ports to add to a router

get_nb_added_ports(old_port_id)

Get the number of ports add to the node

Parameters:old_port_id (int) – starting port_id
Returns:number of ports added
Return type:int
process_mappings()

Process the mappings for a Frame Relay switch. Removes duplicates and adds the mappings to the node properties

set_description()

Set the node description

set_qemu_symbol()

Set the appropriate symbol for QEMU Devices

set_symbol(symbol)

Set a symbol for a device

Parameters:symbol (str) – Symbol to use
set_type()

Set the node type