예제 #1
0
def do_conversion(topology_def, args):
    """
    Convert the topology

    :param dict topology_def: Dict containing topology file and snapshot bool
    """
    # Create a new instance of the the Converter
    gns3_conv = Converter(topology_def['file'], args.debug)
    # Read the old topology
    old_top = gns3_conv.read_topology()
    new_top = JSONTopology()

    # Process the sections
    (topology) = gns3_conv.process_topology(old_top)

    # Generate the nodes
    new_top.nodes = gns3_conv.generate_nodes(topology)
    # Generate the links
    new_top.links = gns3_conv.generate_links(new_top.nodes)

    new_top.notes = gns3_conv.generate_notes(topology['artwork']['NOTE'])
    new_top.shapes = gns3_conv.generate_shapes(topology['artwork']['SHAPE'])
    new_top.images = gns3_conv.generate_images(topology['artwork']['PIXMAP'])

    # Enter topology name
    new_top.name = name(args)

    # Save the new topology
    save(args, gns3_conv, new_top, topology_def['snapshot'])
예제 #2
0
def do_conversion(topology_def, args):
    """
    Convert the topology

    :param dict topology_def: Dict containing topology file and snapshot bool
    """
    # Create a new instance of the the Converter
    gns3_conv = Converter(topology_def['file'], args.debug)
    # Read the old topology
    old_top = gns3_conv.read_topology()
    new_top = JSONTopology()

    # Process the sections
    (topology) = gns3_conv.process_topology(old_top)

    # Generate the nodes
    new_top.nodes = gns3_conv.generate_nodes(topology)
    # Generate the links
    new_top.links = gns3_conv.generate_links(new_top.nodes)

    new_top.notes = gns3_conv.generate_notes(topology['artwork']['NOTE'])
    new_top.shapes = gns3_conv.generate_shapes(topology['artwork']['SHAPE'])
    new_top.images = gns3_conv.generate_images(topology['artwork']['PIXMAP'])

    # Enter topology name
    new_top.name = name(args)

    # Save the new topology
    save(args, gns3_conv, new_top, topology_def['snapshot'])
예제 #3
0
def do_conversion(topology_def,
                  topology_name,
                  output_dir=None,
                  debug=False,
                  quiet=False):
    """
    Convert the topology

    :param dict topology_def: Dict containing topology file and snapshot bool.
                              For example:
                              ``{'file': filename, 'snapshot': False}``
    :param str topology_name: The name of the topology
    :param str output_dir: The directory in which to output the topology.
                           (Default: None)
    :param bool debug: Enable debugging (Default: False)
    """
    # Create a new instance of the the Converter
    gns3_conv = Converter(topology_def['file'], debug)
    # Read the old topology
    old_top = gns3_conv.read_topology()
    new_top = JSONTopology()

    # Process the sections
    (topology) = gns3_conv.process_topology(old_top)

    # Generate the nodes
    new_top.nodes = gns3_conv.generate_nodes(topology)
    # Generate the links
    new_top.links = gns3_conv.generate_links(new_top.nodes)

    new_top.notes = gns3_conv.generate_notes(topology['artwork']['NOTE'])
    new_top.shapes = gns3_conv.generate_shapes(topology['artwork']['SHAPE'])
    new_top.images = gns3_conv.generate_images(topology['artwork']['PIXMAP'])

    # Enter topology name
    new_top.name = topology_name

    # Save the new topology
    save(output_dir, gns3_conv, new_top, topology_def['snapshot'], quiet)
예제 #4
0
파일: main.py 프로젝트: GNS3/gns3-converter
def do_conversion(topology_def, topology_name, output_dir=None, debug=False,
                  quiet=False):
    """
    Convert the topology

    :param dict topology_def: Dict containing topology file and snapshot bool.
                              For example:
                              ``{'file': filename, 'snapshot': False}``
    :param str topology_name: The name of the topology
    :param str output_dir: The directory in which to output the topology.
                           (Default: None)
    :param bool debug: Enable debugging (Default: False)
    """
    # Create a new instance of the the Converter
    gns3_conv = Converter(topology_def['file'], debug)
    # Read the old topology
    old_top = gns3_conv.read_topology()
    new_top = JSONTopology()

    # Process the sections
    (topology) = gns3_conv.process_topology(old_top)

    # Generate the nodes
    new_top.nodes = gns3_conv.generate_nodes(topology)
    # Generate the links
    new_top.links = gns3_conv.generate_links(new_top.nodes)

    new_top.notes = gns3_conv.generate_notes(topology['artwork']['NOTE'])
    new_top.shapes = gns3_conv.generate_shapes(topology['artwork']['SHAPE'])
    new_top.images = gns3_conv.generate_images(topology['artwork']['PIXMAP'])

    # Enter topology name
    new_top.name = topology_name

    # Save the new topology
    save(output_dir, gns3_conv, new_top, topology_def['snapshot'], quiet)