Example #1
0
def devices(local_server, project):
    """
    Create two VPCS for test
    """
    device1 = VPCSNode(VPCS(), local_server, project)
    device1._vpcs_id = str(uuid.uuid4())
    device1._settings = {
        "name": "VPCS 1",
        "script_file": "",
        "console": None,
        "startup_script": None
    }
    device1.setInitialized(True)

    port = EthernetPort("E1")
    port.setAdapterNumber(0)
    port.setPortNumber(0)
    device1._ports.append(port)

    device2 = VPCSNode(VPCS(), local_server, project)
    device2._vpcs_id = str(uuid.uuid4())
    device2._settings = {
        "name": "VPCS 2",
        "script_file": "",
        "console": None,
        "startup_script": None
    }
    device2.setInitialized(True)

    port = EthernetPort("E2")
    port.setAdapterNumber(0)
    port.setPortNumber(0)
    device2._ports.append(port)

    return (device1, device2)
Example #2
0
def vpcs_device(local_server, project):

    from gns3.modules.vpcs.vpcs_device import VPCSDevice
    from gns3.modules.vpcs import VPCS

    device = VPCSDevice(VPCS(), local_server, project)
    device._vpcs_device_id = str(uuid.uuid4())
    device._settings = {"name": "VPCS 1", "script_file": "", "console": None, "startup_script": None}
    device.setInitialized(True)
    return device
Example #3
0
def test_dump_http_auth(vpcs_device, project, remote_server):

    remote_server.setUser("hello")
    remote_server.setPassword("world")

    from gns3.modules.vpcs.vpcs_device import VPCSDevice
    from gns3.modules.vpcs import VPCS

    vpcs_device = VPCSDevice(VPCS(), remote_server, project)
    vpcs_device._vpcs_device_id = str(uuid.uuid4())
    vpcs_device._settings = {
        "name": "VPCS 1",
        "script_file": "",
        "console": None,
        "startup_script": None
    }
    vpcs_device.setInitialized(True)

    topology = Topology()
    topology.project = project
    topology.addNode(vpcs_device)

    dump = topology.dump(include_gui_data=False)
    assert dict(dump) == {
        "project_id": project.id(),
        "auto_start": False,
        "name": project.name(),
        "version": __version__,
        "revision": 4,
        "topology": {
            "nodes": [{
                "description":
                "VPCS device",
                "id":
                vpcs_device.id(),
                "ports": [{
                    "id": vpcs_device.ports()[0].id(),
                    "name": "Ethernet0",
                    "port_number": 0,
                    "adapter_number": 0
                }],
                "properties": {
                    "name": vpcs_device.name()
                },
                "server_id":
                remote_server.id(),
                "type":
                "VPCSDevice",
                "vm_id":
                None
            }],
            "servers": [{
                "vm": False,
                "host": "127.0.0.1",
                "id": remote_server.id(),
                "local": False,
                "port": 8001,
                "protocol": "http",
                "ram_limit": 0,
                "user": "******"
            }]
        },
        "type": "topology"
    }
Example #4
0
CATEGORY_TO_ID = {
    "firewall": 3,
    "guest": 2,
    "switch": 1,
    "multilayer_switch": 1,
    "router": 0
}

TEMPLATE_TYPE_TO_CONFIGURATION_PAGE = {
    "ethernet_switch": Builtin.configurationPage("ethernet_switch"),
    "ethernet_hub": Builtin.configurationPage("ethernet_hub"),
    "cloud": Builtin.configurationPage("cloud"),
    "dynamips": Dynamips.configurationPage(),
    "iou": IOU.configurationPage(),
    "vpcs": VPCS.configurationPage(),
    "traceng": TraceNG.configurationPage(),
    "virtualbox": VirtualBox.configurationPage(),
    "qemu": Qemu.configurationPage(),
    "vmware": VMware.configurationPage(),
    "docker": Docker.configurationPage()
}


class NodesView(QtWidgets.QTreeWidget):
    """
    Nodes view to list the nodes.

    :param parent: parent widget
    """
    def __init__(self, parent=None):
Example #5
0
CATEGORY_TO_ID = {
    "firewall": 3,
    "guest": 2,
    "switch": 1,
    "multilayer_switch": 1,
    "router": 0
}

TEMPLATE_TYPE_TO_CONFIGURATION_PAGE = {
    "ethernet_switch": Builtin.configurationPage("ethernet_switch"),
    "ethernet_hub": Builtin.configurationPage("ethernet_hub"),
    "cloud": Builtin.configurationPage("cloud"),
    "dynamips": Dynamips.configurationPage(),
    "iou": IOU.configurationPage(),
    "vpcs": VPCS.configurationPage(),
    "traceng": TraceNG.configurationPage(),
    "virtualbox": VirtualBox.configurationPage(),
    "qemu": Qemu.configurationPage(),
    "vmware": VMware.configurationPage(),
    "docker": Docker.configurationPage()
}


class NodesView(QtWidgets.QTreeWidget):

    """
    Nodes view to list the nodes.

    :param parent: parent widget
    """