Esempio n. 1
0
def test_get_application_id_no_id_available(loop, project, port_manager):
    # Cleanup the IOU object
    IOU._instance = None
    iou = IOU.instance()
    iou.port_manager = port_manager
    with pytest.raises(IOUError):
        for i in range(1, 513):
            vm_id = str(uuid.uuid4())
            loop.run_until_complete(iou.create_vm("PC {}".format(i), project.id, vm_id))
            assert iou.get_application_id(vm_id) == i
Esempio n. 2
0
def test_get_application_id_no_id_available(loop, project, port_manager):
    # Cleanup the IOU object
    IOU._instance = None
    iou = IOU.instance()
    iou.port_manager = port_manager
    with pytest.raises(IOUError):
        for i in range(1, 513):
            vm_id = str(uuid.uuid4())
            loop.run_until_complete(iou.create_vm("PC {}".format(i), project.id, vm_id))
            assert iou.get_application_id(vm_id) == i
Esempio n. 3
0
def test_get_application_id_multiple_project(loop, port_manager):
    # Cleanup the IOU object
    IOU._instance = None
    iou = IOU.instance()
    iou.port_manager = port_manager
    vm1_id = str(uuid.uuid4())
    vm2_id = str(uuid.uuid4())
    vm3_id = str(uuid.uuid4())
    project1 = ProjectManager.instance().create_project()
    project2 = ProjectManager.instance().create_project()
    loop.run_until_complete(iou.create_vm("PC 1", project1.id, vm1_id))
    loop.run_until_complete(iou.create_vm("PC 2", project1.id, vm2_id))
    loop.run_until_complete(iou.create_vm("PC 2", project2.id, vm3_id))
    assert iou.get_application_id(vm1_id) == 1
    assert iou.get_application_id(vm2_id) == 2
    assert iou.get_application_id(vm3_id) == 3
Esempio n. 4
0
def test_get_application_id(loop, project, port_manager):
    # Cleanup the IOU object
    IOU._instance = None
    iou = IOU.instance()
    iou.port_manager = port_manager
    vm1_id = str(uuid.uuid4())
    vm2_id = str(uuid.uuid4())
    vm3_id = str(uuid.uuid4())
    loop.run_until_complete(iou.create_vm("PC 1", project.id, vm1_id))
    loop.run_until_complete(iou.create_vm("PC 2", project.id, vm2_id))
    assert iou.get_application_id(vm1_id) == 1
    assert iou.get_application_id(vm1_id) == 1
    assert iou.get_application_id(vm2_id) == 2
    loop.run_until_complete(iou.delete_vm(vm1_id))
    loop.run_until_complete(iou.create_vm("PC 3", project.id, vm3_id))
    assert iou.get_application_id(vm3_id) == 1
Esempio n. 5
0
def test_get_application_id_multiple_project(loop, port_manager):
    # Cleanup the IOU object
    IOU._instance = None
    iou = IOU.instance()
    iou.port_manager = port_manager
    vm1_id = str(uuid.uuid4())
    vm2_id = str(uuid.uuid4())
    vm3_id = str(uuid.uuid4())
    project1 = ProjectManager.instance().create_project()
    project2 = ProjectManager.instance().create_project()
    loop.run_until_complete(iou.create_vm("PC 1", project1.id, vm1_id))
    loop.run_until_complete(iou.create_vm("PC 2", project1.id, vm2_id))
    loop.run_until_complete(iou.create_vm("PC 2", project2.id, vm3_id))
    assert iou.get_application_id(vm1_id) == 1
    assert iou.get_application_id(vm2_id) == 2
    assert iou.get_application_id(vm3_id) == 3
Esempio n. 6
0
def test_get_application_id(loop, project, port_manager):
    # Cleanup the IOU object
    IOU._instance = None
    iou = IOU.instance()
    iou.port_manager = port_manager
    vm1_id = str(uuid.uuid4())
    vm2_id = str(uuid.uuid4())
    vm3_id = str(uuid.uuid4())
    loop.run_until_complete(iou.create_vm("PC 1", project.id, vm1_id))
    loop.run_until_complete(iou.create_vm("PC 2", project.id, vm2_id))
    assert iou.get_application_id(vm1_id) == 1
    assert iou.get_application_id(vm1_id) == 1
    assert iou.get_application_id(vm2_id) == 2
    loop.run_until_complete(iou.delete_vm(vm1_id))
    loop.run_until_complete(iou.create_vm("PC 3", project.id, vm3_id))
    assert iou.get_application_id(vm3_id) == 1
Esempio n. 7
0
def manager(port_manager):
    m = IOU.instance()
    m.port_manager = port_manager
    return m
Esempio n. 8
0
def manager(port_manager):
    m = IOU.instance()
    m.port_manager = port_manager
    return m
def iou(port_manager):
    # Cleanup the IOU object
    IOU._instance = None
    iou = IOU.instance()
    iou.port_manager = port_manager
    return iou
Esempio n. 10
0
def iou(port_manager):
    # Cleanup the IOU object
    IOU._instance = None
    iou = IOU.instance()
    iou.port_manager = port_manager
    return iou
Esempio n. 11
0
def iou(port_manager):
    IOU._instance = None
    iou = IOU.instance()
    iou.port_manager = port_manager
    return iou