def setUp(self):
        super(TestServer, self).setUp()
        self.NAME = self.getUniqueString()
        self.server = None
        self.network = None
        self.subnet = None
        self.cidr = '10.99.99.0/16'

        flavor = self.conn.compute.find_flavor(base.FLAVOR_NAME,
                                               ignore_missing=False)
        image = self.conn.compute.find_image(base.IMAGE_NAME,
                                             ignore_missing=False)
        self.network, self.subnet = test_network.create_network(
            self.conn,
            self.NAME,
            self.cidr)
        self.assertIsNotNone(self.network)

        sot = self.conn.compute.create_server(
            name=self.NAME, flavor_id=flavor.id, image_id=image.id,
            networks=[{"uuid": self.network.id}])
        self.conn.compute.wait_for_server(sot)
        assert isinstance(sot, server.Server)
        self.assertEqual(self.NAME, sot.name)
        self.server = sot
 def setUpClass(cls):
     super(TestStack, cls).setUpClass()
     if cls.conn.compute.find_keypair(cls.NAME) is None:
         cls.conn.compute.create_keypair(name=cls.NAME)
     image = next(cls.conn.image.images())
     tname = "openstack/tests/functional/orchestration/v1/hello_world.yaml"
     with open(tname) as f:
         template = f.read()
     cls.network, cls.subnet = test_network.create_network(
         cls.conn, cls.NAME)
     parameters = {
         'image': image.id,
         'key_name': cls.NAME,
         'network': cls.network.id,
     }
     sot = cls.conn.orchestration.create_stack(
         name=cls.NAME,
         parameters=parameters,
         template=template,
     )
     assert isinstance(sot, stack.Stack)
     cls.assertIs(True, (sot.id is not None))
     cls.stack = sot
     cls.assertIs(cls.NAME, sot.name)
     cls.conn.orchestration.wait_for_status(sot,
                                            status='CREATE_COMPLETE',
                                            failures=['CREATE_FAILED'])
 def setUpClass(cls):
     super(TestStack, cls).setUpClass()
     if cls.conn.compute.find_keypair(cls.NAME) is None:
         cls.conn.compute.create_keypair(name=cls.NAME)
     image = next(cls.conn.image.images())
     tname = "openstack/tests/functional/orchestration/v1/hello_world.yaml"
     with open(tname) as f:
         template = f.read()
     cls.network, cls.subnet = test_network.create_network(cls.conn,
                                                           cls.NAME,
                                                           cls.cidr)
     parameters = {
         'image': image.id,
         'key_name': cls.NAME,
         'network': cls.network.id,
     }
     sot = cls.conn.orchestration.create_stack(
         name=cls.NAME,
         parameters=parameters,
         template=template,
     )
     assert isinstance(sot, stack.Stack)
     cls.assertIs(True, (sot.id is not None))
     cls.stack = sot
     cls.assertIs(cls.NAME, sot.name)
     cls.conn.orchestration.wait_for_status(
         sot, status='CREATE_COMPLETE', failures=['CREATE_FAILED'])
Example #4
0
    def setUp(self):
        super(TestStack, self).setUp()
        self.require_service('orchestration')

        if self.conn.compute.find_keypair(self.NAME) is None:
            self.conn.compute.create_keypair(name=self.NAME)
        image = next(self.conn.image.images())
        tname = "openstack/tests/functional/orchestration/v1/hello_world.yaml"
        with open(tname) as f:
            template = yaml.safe_load(f)
        # TODO(mordred) Fix the need for this. We have better support in
        # the shade layer.
        template['heat_template_version'] = '2013-05-23'
        self.network, self.subnet = test_network.create_network(
            self.conn,
            self.NAME,
            self.cidr)
        parameters = {
            'image': image.id,
            'key_name': self.NAME,
            'network': self.network.id,
        }
        sot = self.conn.orchestration.create_stack(
            name=self.NAME,
            parameters=parameters,
            template=template,
        )
        assert isinstance(sot, stack.Stack)
        self.assertEqual(True, (sot.id is not None))
        self.stack = sot
        self.assertEqual(self.NAME, sot.name)
        self.conn.orchestration.wait_for_status(
            sot, status='CREATE_COMPLETE', failures=['CREATE_FAILED'])
Example #5
0
    def setUp(self):
        super(TestStack, self).setUp()
        self.require_service('orchestration')

        if self.conn.compute.find_keypair(self.NAME) is None:
            self.conn.compute.create_keypair(name=self.NAME)
        image = next(self.conn.image.images())
        tname = "openstack/tests/functional/orchestration/v1/hello_world.yaml"
        with open(tname) as f:
            template = yaml.safe_load(f)
        # TODO(mordred) Fix the need for this. We have better support in
        # the shade layer.
        template['heat_template_version'] = '2013-05-23'
        self.network, self.subnet = test_network.create_network(
            self.conn,
            self.NAME,
            self.cidr)
        parameters = {
            'image': image.id,
            'key_name': self.NAME,
            'network': self.network.id,
        }
        sot = self.conn.orchestration.create_stack(
            name=self.NAME,
            parameters=parameters,
            template=template,
        )
        assert isinstance(sot, stack.Stack)
        self.assertEqual(True, (sot.id is not None))
        self.stack = sot
        self.assertEqual(self.NAME, sot.name)
        self.conn.orchestration.wait_for_status(
            sot, status='CREATE_COMPLETE', failures=['CREATE_FAILED'],
            wait=self._wait_for_timeout)
Example #6
0
    def setUp(self):
        super(TestServer, self).setUp()
        self.NAME = self.getUniqueString()
        self.server = None
        self.network = None
        self.subnet = None
        self.cidr = '10.99.99.0/16'

        flavor = self.conn.compute.find_flavor(base.FLAVOR_NAME,
                                               ignore_missing=False)
        image = self.conn.compute.find_image(base.IMAGE_NAME,
                                             ignore_missing=False)
        self.network, self.subnet = test_network.create_network(
            self.conn, self.NAME, self.cidr)
        self.assertIsNotNone(self.network)

        sot = self.conn.compute.create_server(name=self.NAME,
                                              flavor_id=flavor.id,
                                              image_id=image.id,
                                              networks=[{
                                                  "uuid": self.network.id
                                              }])
        self.conn.compute.wait_for_server(sot, wait=self._wait_for_timeout)
        assert isinstance(sot, server.Server)
        self.assertEqual(self.NAME, sot.name)
        self.server = sot
    def setUp(self):
        super(TestStack, self).setUp()
        self.skipTest(
            'Orchestration functional tests disabled:'
            ' https://bugs.launchpad.net/python-openstacksdk/+bug/1525005')
        self.require_service('orchestration')

        if self.conn.compute.find_keypair(self.NAME) is None:
            self.conn.compute.create_keypair(name=self.NAME)
        image = next(self.conn.image.images())
        tname = "openstack/tests/functional/orchestration/v1/hello_world.yaml"
        with open(tname) as f:
            template = f.read()
        self.network, self.subnet = test_network.create_network(
            self.conn,
            self.NAME,
            self.cidr)
        parameters = {
            'image': image.id,
            'key_name': self.NAME,
            'network': self.network.id,
        }
        sot = self.conn.orchestration.create_stack(
            name=self.NAME,
            parameters=parameters,
            template=template,
        )
        assert isinstance(sot, stack.Stack)
        self.assertEqual(True, (sot.id is not None))
        self.stack = sot
        self.assertEqual(self.NAME, sot.name)
        self.conn.orchestration.wait_for_status(
            sot, status='CREATE_COMPLETE', failures=['CREATE_FAILED'])
Example #8
0
    def setUp(self):
        super(TestStack, self).setUp()
        self.require_service('orchestration')

        if self.conn.compute.find_keypair(self.NAME) is None:
            self.conn.compute.create_keypair(name=self.NAME)
        image = next(self.conn.image.images())
        tname = "openstack/tests/functional/orchestration/v1/hello_world.yaml"
        with open(tname) as f:
            template = f.read()
        self.network, self.subnet = test_network.create_network(
            self.conn,
            self.NAME,
            self.cidr)
        parameters = {
            'image': image.id,
            'key_name': self.NAME,
            'network': self.network.id,
        }
        sot = self.conn.orchestration.create_stack(
            name=self.NAME,
            parameters=parameters,
            template=template,
        )
        assert isinstance(sot, stack.Stack)
        self.assertEqual(True, (sot.id is not None))
        self.stack = sot
        self.assertEqual(self.NAME, sot.name)
        self.conn.orchestration.wait_for_status(
            sot, status='CREATE_COMPLETE', failures=['CREATE_FAILED'])
 def setUpClass(cls):
     super(TestServer, cls).setUpClass()
     flavor = default_flavor
     image = cls.conn.compute.find_image(default_image)
     cls.network, cls.subnet = test_network.create_network(cls.conn, cls.NAME)
     if cls.network:
         args = {"networks": [{"uuid": cls.network.id}]}
     else:
         args = {}
     sot = cls.conn.compute.create_server(name=cls.NAME, flavor=flavor, image=image.id, **args)
     assert isinstance(sot, server.Server)
     cls.assertIs(cls.NAME, sot.name)
     cls.server = sot
 def setUpClass(cls):
     super(TestServer, cls).setUpClass()
     # TODO(thowe): These values should be able to be set in clouds.yaml
     flavor = "4"
     image = next(cls.conn.image.images())
     cls.network, cls.subnet = test_network.create_network(cls.conn, cls.NAME)
     if cls.network:
         args = {"networks": [{"uuid": cls.network.id}]}
     else:
         args = {}
     sot = cls.conn.compute.create_server(name=cls.NAME, flavor=flavor, image=image.id, **args)
     assert isinstance(sot, server.Server)
     cls.assertIs(cls.NAME, sot.name)
     cls.ID = sot.id
Example #11
0
 def setUpClass(cls):
     super(TestServer, cls).setUpClass()
     flavor = default_flavor
     image = cls.conn.compute.find_image(default_image)
     cls.network, cls.subnet = test_network.create_network(
         cls.conn, cls.NAME)
     if cls.network:
         args = {'networks': [{"uuid": cls.network.id}]}
     else:
         args = {}
     sot = cls.conn.compute.create_server(name=cls.NAME,
                                          flavor=flavor,
                                          image=image.id,
                                          **args)
     assert isinstance(sot, server.Server)
     cls.assertIs(cls.NAME, sot.name)
     cls.server = sot
Example #12
0
 def setUpClass(cls):
     super(TestServer, cls).setUpClass()
     # TODO(thowe): These values should be able to be set in clouds.yaml
     flavor = '4'
     image = next(cls.conn.image.images())
     cls.network, cls.subnet = test_network.create_network(
         cls.conn, cls.NAME)
     if cls.network:
         args = {'networks': [{"uuid": cls.network.id}]}
     else:
         args = {}
     sot = cls.conn.compute.create_server(name=cls.NAME,
                                          flavor=flavor,
                                          image=image.id,
                                          **args)
     assert isinstance(sot, server.Server)
     cls.assertIs(cls.NAME, sot.name)
     cls.server = sot
Example #13
0
    def setUp(self):
        super(TestCluster, self).setUp()
        self.require_service('clustering')

        self.cidr = '10.99.99.0/16'

        self.network, self.subnet = test_network.create_network(
            self.conn, self.getUniqueString(), self.cidr)
        self.assertIsNotNone(self.network)

        profile_attrs = {
            'name': self.getUniqueString(),
            'spec': {
                'type': 'os.nova.server',
                'version': 1.0,
                'properties': {
                    'name': self.getUniqueString(),
                    'flavor': base.FLAVOR_NAME,
                    'image': base.IMAGE_NAME,
                    'networks': [{
                        'network': self.network.id
                    }]
                }
            }
        }

        self.profile = self.conn.clustering.create_profile(**profile_attrs)
        self.assertIsNotNone(self.profile)

        self.cluster_name = self.getUniqueString()
        cluster_spec = {
            "name": self.cluster_name,
            "profile_id": self.profile.name,
            "min_size": 0,
            "max_size": -1,
            "desired_capacity": 0,
        }

        self.cluster = self.conn.clustering.create_cluster(**cluster_spec)
        self.conn.clustering.wait_for_status(self.cluster,
                                             'ACTIVE',
                                             wait=self._wait_for_timeout)
        assert isinstance(self.cluster, cluster.Cluster)
Example #14
0
 def setUpClass(cls):
     super(TestServer, cls).setUpClass()
     flavor = cls.conn.compute.find_flavor(base.FLAVOR_NAME,
                                           ignore_missing=False)
     image = cls.conn.compute.find_image(base.IMAGE_NAME,
                                         ignore_missing=False)
     cls.network, cls.subnet = test_network.create_network(cls.conn,
                                                           cls.NAME,
                                                           cls.cidr)
     if cls.network:
         args = {'networks': [{"uuid": cls.network.id}]}
     else:
         args = {}
     sot = cls.conn.compute.create_server(
         name=cls.NAME, flavor_id=flavor.id, image_id=image.id, **args)
     cls.conn.compute.wait_for_server(sot)
     assert isinstance(sot, server.Server)
     cls.assertIs(cls.NAME, sot.name)
     cls.server = sot
 def setUpClass(cls):
     super(TestServer, cls).setUpClass()
     flavor = cls.conn.compute.find_flavor(base.FLAVOR_NAME,
                                           ignore_missing=False)
     image = cls.conn.compute.find_image(base.IMAGE_NAME,
                                         ignore_missing=False)
     cls.network, cls.subnet = test_network.create_network(
         cls.conn, cls.NAME, cls.cidr)
     if cls.network:
         args = {'networks': [{"uuid": cls.network.id}]}
     else:
         args = {}
     sot = cls.conn.compute.create_server(name=cls.NAME,
                                          flavor_id=flavor.id,
                                          image_id=image.id,
                                          **args)
     cls.conn.compute.wait_for_server(sot)
     assert isinstance(sot, server.Server)
     cls.assertIs(cls.NAME, sot.name)
     cls.server = sot
Example #16
0
    def setUp(self):
        super(TestCluster, self).setUp()
        self.require_service('clustering')

        self.cidr = '10.99.99.0/16'

        self.network, self.subnet = test_network.create_network(
            self.conn,
            self.getUniqueString(),
            self.cidr)
        self.assertIsNotNone(self.network)

        profile_attrs = {
            'name': self.getUniqueString(),
            'spec': {
                'type': 'os.nova.server',
                'version': 1.0,
                'properties': {
                    'name': self.getUniqueString(),
                    'flavor': base.FLAVOR_NAME,
                    'image': base.IMAGE_NAME,
                    'networks': [{'network': self.network.id}]
                }}}

        self.profile = self.conn.clustering.create_profile(**profile_attrs)
        self.assertIsNotNone(self.profile)

        self.cluster_name = self.getUniqueString()
        cluster_spec = {
            "name": self.cluster_name,
            "profile_id": self.profile.name,
            "min_size": 0,
            "max_size": -1,
            "desired_capacity": 0,
        }

        self.cluster = self.conn.clustering.create_cluster(**cluster_spec)
        self.conn.clustering.wait_for_status(
            self.cluster, 'ACTIVE',
            wait=self._wait_for_timeout)
        assert isinstance(self.cluster, cluster.Cluster)
    def setUpClass(cls):
        super(TestServer, cls).setUpClass()
        flavor = cls.conn.compute.find_flavor(base.FLAVOR_NAME,
                                              ignore_missing=False)
        image = cls.conn.compute.find_image(base.IMAGE_NAME,
                                            ignore_missing=False)
        cls.network, cls.subnet = test_network.create_network(cls.conn,
                                                              cls.NAME,
                                                              cls.cidr)
        if not cls.network:
            # We can't call TestCase.fail from within the setUpClass
            # classmethod, but we need to raise some exception in order
            # to get this setup to fail and thusly fail the entire class.
            raise Exception("Unable to create network for TestServer")

        sot = cls.conn.compute.create_server(
            name=cls.NAME, flavor_id=flavor.id, image_id=image.id,
            networks=[{"uuid": cls.network.id}])
        cls.conn.compute.wait_for_server(sot)
        assert isinstance(sot, server.Server)
        cls.assertIs(cls.NAME, sot.name)
        cls.server = sot
Example #18
0
    def setUpClass(cls):
        super(TestServer, cls).setUpClass()
        flavor = cls.conn.compute.find_flavor(base.FLAVOR_NAME,
                                              ignore_missing=False)
        image = cls.conn.compute.find_image(base.IMAGE_NAME,
                                            ignore_missing=False)
        cls.network, cls.subnet = test_network.create_network(
            cls.conn, cls.NAME, cls.cidr)
        if not cls.network:
            # We can't call TestCase.fail from within the setUpClass
            # classmethod, but we need to raise some exception in order
            # to get this setup to fail and thusly fail the entire class.
            raise Exception("Unable to create network for TestServer")

        sot = cls.conn.compute.create_server(name=cls.NAME,
                                             flavor_id=flavor.id,
                                             image_id=image.id,
                                             networks=[{
                                                 "uuid": cls.network.id
                                             }])
        cls.conn.compute.wait_for_server(sot)
        assert isinstance(sot, server.Server)
        cls.assertIs(cls.NAME, sot.name)
        cls.server = sot