Esempio n. 1
0
class CreateRouterSharedNetworksTests(OSIntegrationTestCase):
    """
    Class for testing routers external and/or shared networks
    """
    def setUp(self):
        """
        Initializes objects used for router testing
        """
        super(self.__class__, self).__start__()

        self.guid = self.__class__.__name__ + '-' + str(uuid.uuid4())
        self.router_creator = None

        ext_network_settings = NetworkConfig(
            name=self.guid + '-ext-net',
            external=True,
            subnet_settings=[
                create_network.SubnetConfig(cidr=cidr1,
                                            name=self.guid + '-ext-subnet1')
            ])
        self.ext_network_creator = OpenStackNetwork(self.admin_os_creds,
                                                    ext_network_settings)
        self.ext_network_creator.create()

        shared_network_settings = NetworkConfig(
            name=self.guid + '-shared-net',
            shared=True,
            subnet_settings=[
                create_network.SubnetConfig(cidr=cidr2,
                                            name=self.guid + '-shared-subnet1')
            ])
        self.shared_network_creator = OpenStackNetwork(
            self.admin_os_creds, shared_network_settings)
        self.shared_network_creator.create()

        overlay_network_settings = NetworkConfig(
            name=self.guid + '-overlay-net',
            subnet_settings=[
                create_network.SubnetConfig(cidr=cidr3,
                                            name=self.guid +
                                            '-overlay-subnet1')
            ])
        self.overlay_network_creator = OpenStackNetwork(
            self.os_creds, overlay_network_settings)
        self.overlay_network_creator.create()

        self.neutron = neutron_utils.neutron_client(self.os_creds,
                                                    self.os_session)

    def tearDown(self):
        """
        Cleans the remote OpenStack objects used for router testing
        """
        if self.router_creator:
            self.router_creator.clean()

        if self.overlay_network_creator:
            self.overlay_network_creator.clean()

        if self.shared_network_creator:
            self.shared_network_creator.clean()

        if self.ext_network_creator:
            self.ext_network_creator.clean()

        super(self.__class__, self).__clean__()

    def test_create_router_external(self):
        """
        Test creation of a router with a custom external network created by
        admin.
        """
        router_settings = RouterConfig(
            name=self.guid + '-pub-router',
            external_gateway=self.ext_network_creator.get_network().name)
        self.router_creator = create_router.OpenStackRouter(
            self.os_creds, router_settings)
        self.router_creator.create()

    def test_create_router_port_external(self):
        """
        Test creation of a router with a port to an custom external network
        created by admin.
        """
        router_settings = RouterConfig(
            name=self.guid + '-pub-router',
            network_name=self.ext_network_creator.get_network().name)
        self.router_creator = create_router.OpenStackRouter(
            self.os_creds, router_settings)
        self.router_creator.create()

    def test_create_router_port_shared(self):
        """
        Test creation of a router with a port to an custom shared network
        created by admin.
        """
        port_settings = [
            create_network.PortConfig(
                name=self.guid + '-port1',
                network_name=self.shared_network_creator.get_network().name)
        ]

        router_settings = RouterConfig(name=self.guid + '-pub-router',
                                       port_settings=port_settings)
        self.router_creator = create_router.OpenStackRouter(
            self.os_creds, router_settings)
        self.router_creator.create()
Esempio n. 2
0
class CreateMultipleRouterTests(OSIntegrationTestCase):
    """
    Test for the OpenStackRouter class and how it interacts with routers
    groups within other projects with the same name
    """
    def setUp(self):
        """
        Initializes objects used for router testing
        """
        super(self.__class__, self).__start__()

        self.guid = self.__class__.__name__ + '-' + str(uuid.uuid4())
        self.admin_router_creator = None
        self.proj_router_creator = None
        self.neutron = neutron_utils.neutron_client(self.os_creds,
                                                    self.os_session)

        network_settings = NetworkConfig(
            name=self.guid + '-pub-net',
            shared=True,
            subnet_settings=[
                create_network.SubnetConfig(cidr=cidr1,
                                            name=self.guid + '-pub-subnet',
                                            gateway_ip=static_gateway_ip1)
            ])

        self.network_creator = OpenStackNetwork(self.admin_os_creds,
                                                network_settings)
        self.network_creator.create()

    def tearDown(self):
        """
        Cleans the remote OpenStack objects used for router testing
        """
        if self.admin_router_creator:
            self.admin_router_creator.clean()

        if self.proj_router_creator:
            self.proj_router_creator.clean()

        if self.network_creator:
            self.network_creator.clean()

        super(self.__class__, self).__clean__()

    def test_router_same_name_diff_proj(self):
        """
        Tests the creation of an OpenStackNetwork with the same name
        within a different project/tenant when not configured but implied by
        the OSCreds.
        """
        # Create Router

        router_config = RouterConfig(name=self.guid + '-router')
        self.admin_router_creator = OpenStackRouter(self.admin_os_creds,
                                                    router_config)
        self.admin_router_creator.create()

        self.proj_router_creator = OpenStackRouter(self.os_creds,
                                                   router_config)
        self.proj_router_creator.create()

        self.assertNotEqual(self.admin_router_creator.get_router().id,
                            self.proj_router_creator.get_router().id)

        admin_creator2 = OpenStackRouter(self.admin_os_creds, router_config)
        admin_creator2.create()
        self.assertEqual(self.admin_router_creator.get_router(),
                         admin_creator2.get_router())

        proj_creator2 = OpenStackRouter(self.os_creds, router_config)
        proj_creator2.create()
        self.assertEqual(self.proj_router_creator.get_router(),
                         proj_creator2.get_router())

    def test_router_create_by_admin_to_different_project(self):
        """
        Tests the creation of an OpenStackRouter by the admin user and
        initialize again with tenant credentials.
        """
        # Create Network

        admin_router_config = RouterConfig(
            name=self.guid + '-router',
            project_name=self.os_creds.project_name)

        self.admin_router_creator = OpenStackRouter(self.admin_os_creds,
                                                    admin_router_config)
        self.admin_router_creator.create()

        proj_router_config = RouterConfig(
            name=self.guid + '-router',
            project_name=self.os_creds.project_name)

        self.proj_router_creator = OpenStackRouter(self.os_creds,
                                                   proj_router_config)
        self.proj_router_creator.create()

        self.assertEqual(self.admin_router_creator.get_router().id,
                         self.proj_router_creator.get_router().id)
Esempio n. 3
0
File: demo.py Progetto: opnfv/snaps
                                 subnet_settings=[subnet_settings])
network = OpenStackNetwork(os_creds, network_settings)
network.create()

# Flavors
from snaps.config.flavor import FlavorConfig
from snaps.openstack.create_flavor import OpenStackFlavor

flavor_settings = FlavorConfig(name='test-flavor', ram=256, disk=10, vcpus=2)
flavor = OpenStackFlavor(os_creds, flavor_settings)
flavor.create()

# Instances
from snaps.config.network import PortConfig
from snaps.openstack.create_instance import OpenStackVmInstance

port_settings = PortConfig(name='test-port',
                           network_name=network_settings.name)
instance_settings = VmInstanceConfig(name='test-inst',
                                     flavor=flavor_settings.name,
                                     port_settings=[port_settings])

vm_inst = OpenStackVmInstance(os_creds, instance_settings, image_settings)
vm_inst.create(block=True)

# Cleanup
vm_inst.clean()
flavor.clean()
network.clean()
image.clean()
Esempio n. 4
0
class CreateNetworkSuccessTests(OSIntegrationTestCase):
    """
    Test for the CreateNetwork class defined in create_nework.py
    """

    def setUp(self):
        """
        Sets up object for test
        """
        super(self.__class__, self).__start__()

        guid = self.__class__.__name__ + '-' + str(uuid.uuid4())
        self.net_config = openstack_tests.get_pub_net_config(
            project_name=self.os_creds.project_name,
            net_name="{}-{}".format(guid, 'pub-net'), mtu=999,
            subnet_name="{}-{}".format(guid, 'pub-subnet'),
            router_name="{}-{}".format(guid, 'pub-router'),
            external_net=self.ext_net_name,
            netconf_override=self.netconf_override)

        self.neutron = neutron_utils.neutron_client(
            self.os_creds, self.os_session)

        # Initialize for cleanup
        self.net_creator = None
        self.router_creator = None

    def tearDown(self):
        """
        Cleans the network
        """
        if self.router_creator:
            self.router_creator.clean()

        if self.net_creator:
            self.net_creator.clean()

        super(self.__class__, self).__clean__()

    def test_create_network_without_router(self):
        """
        Tests the creation of an OpenStack network without a router.
        """
        # Create Network
        self.net_creator = OpenStackNetwork(
            self.os_creds, self.net_config.network_settings)
        network = self.net_creator.create()

        # Validate network was created
        self.assertTrue(neutron_utils_tests.validate_network(
            self.neutron, self.keystone,
            self.net_creator.network_settings.name, True,
            self.os_creds.project_name, mtu=999))

        # Validate subnets
        self.assertTrue(neutron_utils_tests.validate_subnet(
            self.neutron, network,
            self.net_creator.network_settings.subnet_settings[0].name,
            self.net_creator.network_settings.subnet_settings[0].cidr, True))

    def test_create_delete_network(self):
        """
        Tests the creation of an OpenStack network, it's deletion, then cleanup
        """
        # Create Network
        self.net_creator = OpenStackNetwork(
            self.os_creds, self.net_config.network_settings)
        self.net_creator.create()

        # Validate network was created
        self.assertTrue(neutron_utils_tests.validate_network(
            self.neutron, self.keystone,
            self.net_creator.network_settings.name, True,
            self.os_creds.project_name, mtu=999))

        neutron_utils.delete_network(
            self.neutron, self.net_creator.get_network())
        self.assertIsNone(neutron_utils.get_network(
            self.neutron, self.keystone,
            network_settings=self.net_creator.network_settings,
            project_name=self.os_creds.project_name))

        # This shall not throw an exception here
        self.net_creator.clean()

    def test_create_network_with_router(self):
        """
        Tests the creation of an OpenStack network with a router.
        """
        # Create Network
        self.net_creator = OpenStackNetwork(
            self.os_creds, self.net_config.network_settings)
        network = self.net_creator.create()

        # Create Router
        self.router_creator = create_router.OpenStackRouter(
            self.os_creds, self.net_config.router_settings)
        self.router_creator.create()

        # Validate network was created
        self.assertTrue(neutron_utils_tests.validate_network(
            self.neutron, self.keystone,
            self.net_creator.network_settings.name, True,
            self.os_creds.project_name, mtu=999))

        # Validate subnets
        self.assertTrue(neutron_utils_tests.validate_subnet(
            self.neutron, network,
            self.net_creator.network_settings.subnet_settings[0].name,
            self.net_creator.network_settings.subnet_settings[0].cidr, True))

        # Validate routers
        neutron_utils_tests.validate_router(
            self.neutron, self.keystone,
            self.router_creator.router_settings.name,
            self.os_creds.project_name, True)

        neutron_utils_tests.validate_interface_router(
            self.router_creator.get_internal_router_interface(),
            self.router_creator.get_router(),
            self.net_creator.get_network().subnets[0])

    def test_create_networks_same_name(self):
        """
        Tests the creation of an OpenStack network and ensures that the
        OpenStackNetwork object will not create a second.
        """
        # Create Network
        self.net_creator = OpenStackNetwork(
            self.os_creds, self.net_config.network_settings)
        self.net_creator.create()

        self.net_creator2 = OpenStackNetwork(
            self.os_creds, self.net_config.network_settings)
        self.net_creator2.create()

        self.assertEqual(self.net_creator.get_network().id,
                         self.net_creator2.get_network().id)

    def test_create_network_router_admin_user_to_new_project(self):
        """
        Tests the creation of an OpenStack network to the the current using
        the credentials to the admin project.
        """
        # Create Network/Subnet where the project names have been changed
        project_name = self.os_creds.project_name
        config = self.net_config.network_settings
        config.project_name = project_name
        config.subnet_settings[0].project_name = project_name

        self.net_creator = OpenStackNetwork(self.admin_os_creds, config)
        self.net_creator.create()

        retrieved_net = neutron_utils.get_network(
            self.neutron, self.keystone,
            network_name=self.net_config.network_settings.name,
            project_name=self.os_creds.project_name)

        self.assertEqual(self.net_creator.get_network().id, retrieved_net.id)

        # Initialize with actual credentials
        config.project_name = None
        config.subnet_settings[0].project_name = None
        proj_net_creator = OpenStackNetwork(self.os_creds, config)
        proj_net = proj_net_creator.create()
        self.assertEqual(retrieved_net, proj_net)

        # Create Router
        self.net_config.router_settings.project_name = project_name
        self.router_creator = create_router.OpenStackRouter(
            self.admin_os_creds, self.net_config.router_settings)
        self.router_creator.create()

        retrieved_router = neutron_utils.get_router(
            self.neutron, self.keystone,
            router_settings=self.router_creator.router_settings,
            project_name=self.os_creds.project_name)
        self.assertEqual(
            self.router_creator.get_router().id, retrieved_router.id)

    def test_create_network_router_new_user_to_admin_project(self):
        """
        Tests the creation of an OpenStack network and router with the admin
        user to the new project.
        """
        # Create Network/Subnet where the project names have been changed
        new_project_name = self.os_creds.project_name
        self.net_config.network_settings.project_name = new_project_name
        self.net_config.network_settings.subnet_settings[0].project_name = \
            new_project_name
        self.net_creator = OpenStackNetwork(
            self.admin_os_creds, self.net_config.network_settings)
        self.net_creator.create()

        retrieved_net = neutron_utils.get_network(
            self.neutron, self.keystone,
            network_settings=self.net_config.network_settings,
            project_name=self.os_creds.project_name)

        self.assertEqual(self.net_creator.get_network().id, retrieved_net.id)

        # Create Router
        self.net_config.router_settings.project_name = new_project_name
        self.router_creator = create_router.OpenStackRouter(
            self.admin_os_creds, self.net_config.router_settings)
        self.router_creator.create()

        retrieved_router = neutron_utils.get_router(
            self.neutron, self.keystone,
            router_settings=self.router_creator.router_settings,
            project_name=self.os_creds.project_name)
        self.assertEqual(
            self.router_creator.get_router().id, retrieved_router.id)
Esempio n. 5
0
class NovaUtilsInstanceVolumeTests(OSComponentTestCase):
    """
    Tests the creation of VM instances via nova_utils.py
    """

    def setUp(self):
        """
        Setup objects required by VM instances
        :return:
        """

        guid = self.__class__.__name__ + '-' + str(uuid.uuid4())

        self.nova = nova_utils.nova_client(self.os_creds, self.os_session)
        self.cinder = cinder_utils.cinder_client(
            self.os_creds, self.os_session)

        self.image_creator = None
        self.network_creator = None
        self.flavor_creator = None
        self.volume_creator = None
        self.instance_creator = None

        try:
            image_settings = openstack_tests.cirros_image_settings(
                name=guid + '-image', image_metadata=self.image_metadata)
            self.image_creator = OpenStackImage(
                self.os_creds, image_settings=image_settings)
            self.image_creator.create()

            network_settings = openstack_tests.get_priv_net_config(
                project_name=self.os_creds.project_name,
                net_name="{}-{}".format(guid, 'net'),
                subnet_name="{}-{}".format(guid, 'subnet')).network_settings

            self.network_creator = OpenStackNetwork(
                self.os_creds, network_settings)
            self.network_creator.create()

            flavor_settings = openstack_tests.get_flavor_config(
                name=guid + '-flavor', ram=256, disk=10, vcpus=1,
                metadata=self.flavor_metadata)
            self.flavor_creator = OpenStackFlavor(
                self.os_creds, flavor_settings)
            self.flavor_creator.create()

            # Create Volume
            volume_settings = VolumeConfig(
                name=self.__class__.__name__ + '-' + str(guid))
            self.volume_creator = OpenStackVolume(
                self.os_creds, volume_settings)
            self.volume_creator.create(block=True)

            port_settings = PortConfig(
                name=guid + '-port', network_name=network_settings.name)
            instance_settings = VmInstanceConfig(
                name=guid + '-vm_inst',
                flavor=self.flavor_creator.flavor_settings.name,
                port_settings=[port_settings])
            self.instance_creator = OpenStackVmInstance(
                self.os_creds, instance_settings, image_settings)
            self.instance_creator.create(block=True)
        except:
            self.tearDown()
            raise

    def tearDown(self):
        """
        Cleanup deployed resources
        :return:
        """
        if self.instance_creator:
            try:
                self.instance_creator.clean()
            except:
                pass
        if self.volume_creator:
            try:
                self.volume_creator.clean()
            except:
                pass
        if self.flavor_creator:
            try:
                self.flavor_creator.clean()
            except:
                pass
        if self.network_creator:
            try:
                self.network_creator.clean()
            except:
                pass
        if self.image_creator:
            try:
                self.image_creator.clean()
            except:
                pass

        super(self.__class__, self).__clean__()

    def test_add_remove_volume(self):
        """
        Tests the nova_utils.attach_volume() and detach_volume functions with
        a timeout value
        :return:
        """

        self.assertIsNotNone(self.volume_creator.get_volume())
        self.assertEqual(0, len(self.volume_creator.get_volume().attachments))

        # Attach volume to VM
        neutron = neutron_utils.neutron_client(
            self.os_creds, self.os_session)
        keystone = keystone_utils.keystone_client(
            self.os_creds, self.os_session)
        self.assertIsNotNone(nova_utils.attach_volume(
            self.nova, neutron, keystone, self.instance_creator.get_vm_inst(),
            self.volume_creator.get_volume(), self.os_creds.project_name))

        vol_attach = None
        vol_detach = None
        attached = False
        start_time = time.time()
        while time.time() < start_time + 120:
            vol_attach = cinder_utils.get_volume_by_id(
                self.cinder, self.volume_creator.get_volume().id)

            if len(vol_attach.attachments) > 0:
                attached = True
                break

            time.sleep(3)

        self.assertTrue(attached)
        self.assertIsNotNone(vol_attach)

        keystone = keystone_utils.keystone_client(
            self.os_creds, self.os_session)
        vm_attach = nova_utils.get_server_object_by_id(
            self.nova, neutron, keystone,
            self.instance_creator.get_vm_inst().id, self.os_creds.project_name)

        # Validate Attachment
        self.assertIsNotNone(vol_attach)
        self.assertEqual(self.volume_creator.get_volume().id, vol_attach.id)
        self.assertEqual(1, len(vol_attach.attachments))
        self.assertEqual(vm_attach.volume_ids[0]['id'],
                         vol_attach.attachments[0]['volume_id'])

        # Detach volume to VM
        self.assertIsNotNone(nova_utils.detach_volume(
            self.nova, neutron, keystone, self.instance_creator.get_vm_inst(),
            self.volume_creator.get_volume(), self.os_creds.project_name))

        start_time = time.time()
        while time.time() < start_time + 120:
            vol_detach = cinder_utils.get_volume_by_id(
                self.cinder, self.volume_creator.get_volume().id)
            if len(vol_detach.attachments) == 0:
                attached = False
                break

            time.sleep(3)

        self.assertFalse(attached)
        self.assertIsNotNone(vol_detach)

        vm_detach = nova_utils.get_server_object_by_id(
            self.nova, neutron, keystone,
            self.instance_creator.get_vm_inst().id, self.os_creds.project_name)

        # Validate Detachment
        self.assertIsNotNone(vol_detach)
        self.assertEqual(self.volume_creator.get_volume().id, vol_detach.id)

        self.assertEqual(0, len(vol_detach.attachments))
        self.assertEqual(0, len(vm_detach.volume_ids))

    def test_attach_volume_nowait(self):
        """
        Tests the nova_utils.attach_volume() with a timeout value that is too
        small to have the volume attachment data to be included on the VmInst
        object that was supposed to be returned
        """

        self.assertIsNotNone(self.volume_creator.get_volume())
        self.assertEqual(0, len(self.volume_creator.get_volume().attachments))

        # Attach volume to VM
        neutron = neutron_utils.neutron_client(self.os_creds, self.os_session)
        keystone = keystone_utils.keystone_client(
            self.os_creds, self.os_session)
        with self.assertRaises(NovaException):
            nova_utils.attach_volume(
                self.nova, neutron, keystone,
                self.instance_creator.get_vm_inst(),
                self.volume_creator.get_volume(), self.os_creds.project_name,
                0)

    def test_detach_volume_nowait(self):
        """
        Tests the nova_utils.detach_volume() with a timeout value that is too
        small to have the volume attachment data to be included on the VmInst
        object that was supposed to be returned
        """

        self.assertIsNotNone(self.volume_creator.get_volume())
        self.assertEqual(0, len(self.volume_creator.get_volume().attachments))

        # Attach volume to VM
        neutron = neutron_utils.neutron_client(self.os_creds, self.os_session)
        keystone = keystone_utils.keystone_client(
            self.os_creds, self.os_session)
        nova_utils.attach_volume(
            self.nova, neutron, keystone, self.instance_creator.get_vm_inst(),
            self.volume_creator.get_volume(), self.os_creds.project_name)

        # Check VmInst for attachment
        keystone = keystone_utils.keystone_client(
            self.os_creds, self.os_session)
        latest_vm = nova_utils.get_server_object_by_id(
            self.nova, neutron, keystone,
            self.instance_creator.get_vm_inst().id, self.os_creds.project_name)
        self.assertEqual(1, len(latest_vm.volume_ids))

        # Check Volume for attachment
        vol_attach = None
        attached = False
        start_time = time.time()
        while time.time() < start_time + 120:
            vol_attach = cinder_utils.get_volume_by_id(
                self.cinder, self.volume_creator.get_volume().id)

            if len(vol_attach.attachments) > 0:
                attached = True
                break

            time.sleep(3)

        self.assertTrue(attached)
        self.assertIsNotNone(vol_attach)

        # Detach volume
        with self.assertRaises(NovaException):
            nova_utils.detach_volume(
                self.nova, neutron, keystone,
                self.instance_creator.get_vm_inst(),
                self.volume_creator.get_volume(), self.os_creds.project_name,
                0)
Esempio n. 6
0
class NovaUtilsInstanceTests(OSComponentTestCase):
    """
    Tests the creation of VM instances via nova_utils.py
    """

    def setUp(self):
        """
        Setup objects required by VM instances
        :return:
        """

        guid = self.__class__.__name__ + '-' + str(uuid.uuid4())

        self.nova = nova_utils.nova_client(
            self.os_creds, self.os_session)
        self.keystone = keystone_utils.keystone_client(
            self.os_creds, self.os_session)
        self.neutron = neutron_utils.neutron_client(
            self.os_creds, self.os_session)
        self.glance = glance_utils.glance_client(
            self.os_creds, self.os_session)

        self.image_creator = None
        self.network_creator = None
        self.flavor_creator = None
        self.port = None
        self.vm_inst = None

        try:
            image_settings = openstack_tests.cirros_image_settings(
                name=guid + '-image', image_metadata=self.image_metadata)
            self.image_creator = OpenStackImage(
                self.os_creds, image_settings=image_settings)
            self.image_creator.create()

            network_settings = openstack_tests.get_priv_net_config(
                project_name=self.os_creds.project_name,
                net_name="{}-{}".format(guid, 'net'),
                subnet_name="{}-{}".format(guid, 'subnet')).network_settings
            self.network_creator = OpenStackNetwork(
                self.os_creds, network_settings)
            self.network_creator.create()

            flavor_config = openstack_tests.get_flavor_config(
                name="{}-{}".format(guid, 'flavor-name'), ram=256, disk=10,
                vcpus=1, metadata=self.flavor_metadata)
            self.flavor_creator = OpenStackFlavor(self.os_creds, flavor_config)
            self.flavor_creator.create()

            port_settings = PortConfig(
                name=guid + '-port', network_name=network_settings.name)
            self.port = neutron_utils.create_port(
                self.neutron, self.os_creds, port_settings)

            self.instance_settings = VmInstanceConfig(
                name=guid + '-vm_inst',
                flavor=self.flavor_creator.flavor_settings.name,
                port_settings=[port_settings])
        except:
            self.tearDown()
            raise

    def tearDown(self):
        """
        Cleanup deployed resources
        :return:
        """
        if self.vm_inst:
            try:
                nova_utils.delete_vm_instance(self.nova, self.vm_inst)
            except:
                pass
        if self.port:
            try:
                neutron_utils.delete_port(self.neutron, self.port)
            except:
                pass
        if self.flavor_creator:
            try:
                self.flavor_creator.clean()
            except:
                pass
        if self.network_creator:
            try:
                self.network_creator.clean()
            except:
                pass
        if self.image_creator:
            try:
                self.image_creator.clean()
            except:
                pass

        super(self.__class__, self).__clean__()

    def test_create_instance(self):
        """
        Tests the nova_utils.create_server() method
        :return:
        """

        self.vm_inst = nova_utils.create_server(
            self.nova, self.keystone, self.neutron, self.glance,
            self.instance_settings, self.image_creator.image_settings,
            self.os_creds.project_name)

        self.assertIsNotNone(self.vm_inst)

        # Wait until instance is ACTIVE
        iters = 0
        active = False
        status = None
        while iters < 60:
            status = nova_utils.get_server_status(self.nova, self.vm_inst)
            if create_instance.STATUS_ACTIVE == status:
                active = True
                break

            time.sleep(3)
            iters += 1

        self.assertTrue(active, msg='VM {} status {} is not {}'.format(
            self.vm_inst.name, status, create_instance.STATUS_ACTIVE))
        vm_inst = nova_utils.get_latest_server_object(
            self.nova, self.neutron, self.keystone, self.vm_inst,
            self.os_creds.project_name)

        self.assertEqual(self.vm_inst.name, vm_inst.name)
        self.assertEqual(self.vm_inst.id, vm_inst.id)