def test_rename_router(hypervisor): router = Router(hypervisor, "my router to rename") assert router.name == "my router to rename" router.name = "my_router" assert router.name == "my_router" router.delete()
def test_unallocate_hypervisor_for_router(hypervisor_manager): assert len(hypervisor_manager.hypervisors) == 2 hypervisor = hypervisor_manager.hypervisors[0] assert hypervisor.memory_load == 768 router = Router(hypervisor, "router", "c3725") # default is 128MB of RAM hypervisor_manager.unallocate_hypervisor_for_router(router) assert hypervisor.memory_load == 640 hypervisor.decrease_memory_load(512) # forces memory load down to 128 assert hypervisor.memory_load == 128 router.delete() hypervisor_manager.unallocate_hypervisor_for_router(router) # router is deleted and memory load to 0 now, one hypervisor must # have been shutdown assert len(hypervisor_manager.hypervisors) == 1
def test_create_and_delete_router(hypervisor): router = Router(hypervisor, "test my router") assert router.id >= 0 assert router.name == "test my router" assert router.platform == "c7200" # default platform assert not router.is_running() router.delete() with pytest.raises(DynamipsError): router.get_status()
def router(request, hypervisor): router = Router(hypervisor, "router", platform="c3725") request.addfinalizer(router.delete) return router