gns3converter.main¶
- gns3converter.main.copy_configs(configs, source, target)¶
Copy dynamips configs to converted topology
Parameters: - configs – Configs to copy
- source (str) – Source topology directory
- target (str) – Target topology files directory
Returns: True when a config cannot be found, otherwise false
Return type: bool
- gns3converter.main.copy_images(images, source, target)¶
Copy images to converted topology
Parameters: - images – Images to copy
- source – Old Topology Directory
- target – Target topology files directory
Returns: True when an image cannot be found, otherwise false
Return type: bool
- gns3converter.main.copy_instructions(source_project, dest_project)¶
- gns3converter.main.copy_topology_image(source, target)¶
Copy any images of the topology to the converted topology
Parameters: - source (str) – Source topology directory
- target (str) – Target Directory
- gns3converter.main.copy_vpcs_configs(source, target)¶
Copy any VPCS configs to the converted topology
Parameters: - source (str) – Source topology directory
- target (str) – Target topology files directory
- gns3converter.main.do_conversion(topology_def, topology_name, output_dir=None, debug=False, quiet=False)¶
Convert the topology
Parameters: - topology_def (dict) – Dict containing topology file and snapshot bool. For example: {'file': filename, 'snapshot': False}
- topology_name (str) – The name of the topology
- output_dir (str) – The directory in which to output the topology. (Default: None)
- debug (bool) – Enable debugging (Default: False)
- gns3converter.main.get_snapshots(topology)¶
Return the paths of any snapshot topologies
Parameters: topology (str) – topology file Returns: list of dicts containing snapshot topologies Return type: list
- gns3converter.main.main()¶
Entry point for gns3-converter
- gns3converter.main.make_qemu_dirs(max_qemu_id, output_dir, topology_name)¶
Create Qemu VM working directories if required
Parameters: - max_qemu_id (int) – Number of directories to create
- output_dir (str) – Output directory
- topology_name (str) – Topology name
- gns3converter.main.make_vbox_dirs(max_vbox_id, output_dir, topology_name)¶
Create VirtualBox working directories if required
Parameters: - max_vbox_id (int) – Number of directories to create
- output_dir (str) – Output directory
- topology_name (str) – Topology name
- gns3converter.main.name(topology_file, topology_name=None)¶
Calculate the name to save the converted topology as using either either a specified name or the directory name of the current project
Parameters: - topology_file (str) – Topology filename
- topology_name (str or None) – Optional topology name (Default: None)
Returns: new topology name
Return type: str
- gns3converter.main.save(output_dir, converter, json_topology, snapshot, quiet)¶
Save the converted topology
Parameters: - output_dir (str) – Output Directory
- converter (Converter) – Converter instance
- json_topology (JSONTopology) – JSON topology layout
- snapshot (bool) – Is this a snapshot?
- quiet (bool) – No console printing
- gns3converter.main.setup_argparse()¶
Setup the argparse argument parser
Returns: instance of argparse Return type: ArgumentParser
- gns3converter.main.snapshot_name(topo_name)¶
Get the snapshot name
Parameters: topo_name (str) – topology file location. The name is taken from the directory containing the topology file using the following format: topology_NAME_snapshot_DATE_TIME Returns: snapshot name Raises ConvertError: when unable to determine the snapshot name
- gns3converter.main.topology_abspath(topology)¶
Get the absolute path of the topology file
Parameters: topology (str) – Topology file Returns: Absolute path of topology file Return type: str
- gns3converter.main.topology_dirname(topology)¶
Get the directory containing the topology file
Parameters: topology (str) – topology file Returns: directory which contains the topology file Return type: str