def test_console(project, manager):
    vm = VPCSVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", project,
                manager)
    vm.console = 5011
    assert vm.console == 5011
    vm.console = None
    assert vm.console is None
Esempio n. 2
0
def test_vm_invalid_vpcs_path(project, manager, loop):
    with pytest.raises(VPCSError):
        vm = VPCSVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0e", project, manager)
        nio = manager.create_nio(vm.vpcs_path, {"type": "nio_udp", "lport": 4242, "rport": 4243, "rhost": "127.0.0.1"})
        vm.port_add_nio_binding(0, nio)
        loop.run_until_complete(asyncio.async(vm.start()))
        assert vm.name == "test"
        assert vm.id == "00010203-0405-0607-0809-0a0b0c0d0e0e"
Esempio n. 3
0
def test_vm_invalid_vpcs_path(project, manager, loop):
    with pytest.raises(VPCSError):
        vm = VPCSVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0e", project, manager)
        nio = manager.create_nio(vm.vpcs_path, {"type": "nio_udp", "lport": 4242, "rport": 4243, "rhost": "127.0.0.1"})
        vm.port_add_nio_binding(0, nio)
        loop.run_until_complete(asyncio.async(vm.start()))
        assert vm.name == "test"
        assert vm.id == "00010203-0405-0607-0809-0a0b0c0d0e0e"
Esempio n. 4
0
def test_vm_invalid_vpcs_version(loop, project, manager):
    with asyncio_patch("gns3server.utils.asyncio.subprocess_check_output", return_value="Welcome to Virtual PC Simulator, version 0.1"):
        with pytest.raises(VPCSError):
            vm = VPCSVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", project, manager)
            nio = manager.create_nio(vm.vpcs_path, {"type": "nio_udp", "lport": 4242, "rport": 4243, "rhost": "127.0.0.1"})
            vm.port_add_nio_binding(0, nio)
            loop.run_until_complete(asyncio.async(vm.start()))
            assert vm.name == "test"
            assert vm.id == "00010203-0405-0607-0809-0a0b0c0d0e0f"
Esempio n. 5
0
def test_vm_invalid_vpcs_version(loop, project, manager):
    with asyncio_patch("gns3server.utils.asyncio.subprocess_check_output", return_value="Welcome to Virtual PC Simulator, version 0.1"):
        with pytest.raises(VPCSError):
            vm = VPCSVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", project, manager)
            nio = manager.create_nio(vm.vpcs_path, {"type": "nio_udp", "lport": 4242, "rport": 4243, "rhost": "127.0.0.1"})
            vm.port_add_nio_binding(0, nio)
            loop.run_until_complete(asyncio.async(vm.start()))
            assert vm.name == "test"
            assert vm.id == "00010203-0405-0607-0809-0a0b0c0d0e0f"
def test_allocate_aux(project, manager):
    vm = VPCSVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", project,
                manager)
    assert vm.aux is None

    # Docker has an aux port by default
    vm = DockerVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", project,
                  manager, "ubuntu")
    assert vm.aux is not None
Esempio n. 7
0
def test_vm(project, manager):
    vm = VPCSVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", project,
                manager)
    assert vm.name == "test"
    assert vm.id == "00010203-0405-0607-0809-0a0b0c0d0e0f"
Esempio n. 8
0
def vm(project, manager):
    return VPCSVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", project,
                  manager)
Esempio n. 9
0
def test_temporary_directory(project, manager):
    vm = VPCSVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", project,
                manager)
    assert isinstance(vm.temporary_directory, str)
Esempio n. 10
0
def test_console_vnc_invalid(project, manager):
    vm = VPCSVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", project,
                manager)
    vm.console_type = "vnc"
    with pytest.raises(VMError):
        vm.console = 2012
Esempio n. 11
0
def vm(project, manager):
    vm = VPCSVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", project, manager)
    vm._vpcs_version = parse_version("0.9")
    return vm
Esempio n. 12
0
def vm(project, manager):
    vm = VPCSVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", project,
                manager)
    vm._vpcs_version = parse_version("0.9")
    return vm
Esempio n. 13
0
def test_console_vnc_invalid(project, manager):
    vm = VPCSVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", project, manager)
    vm.console_type = "vnc"
    with pytest.raises(VMError):
        vm.console = 2012
Esempio n. 14
0
def test_console(project, manager):
    vm = VPCSVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", project, manager)
    vm.console = 5011
    assert vm.console == 5011
    vm.console = None
    assert vm.console is None