Exemplo n.º 1
0
    def test_update_positive(self, options):
        """@Test: Compute Resource positive update

        @Feature: Compute Resource update

        @Assert: Compute Resource successfully updated

        """
        comp_res = make_compute_resource()
        options.update({
            'name': comp_res['name'],
        })

        # update Compute Resource
        result = ComputeResource.update(options)
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)

        # check updated values
        result = ComputeResource.info({'id': comp_res['id']})
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)
        self.assertEqual(result.stdout['description'],
                         options.get('description', comp_res['description']))
        self.assertEqual(result.stdout['name'],
                         options.get('new-name', comp_res['name']))
        self.assertEqual(result.stdout['url'],
                         options.get('url', comp_res['url']))
        self.assertEqual(result.stdout['provider'].lower(),
                         comp_res['provider'].lower())
Exemplo n.º 2
0
    def test_positive_update_name(self):
        """Compute Resource positive update

        @Feature: Compute Resource update

        @Assert: Compute Resource successfully updated

        """
        for options in valid_update_data():
            with self.subTest(options):
                comp_res = make_compute_resource()
                options.update({'name': comp_res['name']})
                # update Compute Resource
                ComputeResource.update(options)
                # check updated values
                result = ComputeResource.info({'id': comp_res['id']})
                self.assertEqual(
                    result['description'],
                    options.get('description', comp_res['description'])
                )
                self.assertEqual(
                    result['name'],
                    options.get('new-name', comp_res['name'])
                )
                self.assertEqual(
                    result['url'],
                    options.get('url', comp_res['url'])
                )
                self.assertEqual(
                    result['provider'].lower(),
                    comp_res['provider'].lower()
                )
Exemplo n.º 3
0
    def test_update_docker_compute_resource(self):
        """@Test: Create a Docker-based Compute Resource in the Satellite 6
        instance then edit its attributes.

        @Assert: Compute Resource can be created, listed and its attributes can
        be updated.

        @Feature: Docker

        """
        for url in (EXTERNAL_DOCKER_URL, INTERNAL_DOCKER_URL):
            with self.subTest(url):
                compute_resource = make_compute_resource({
                    'provider': DOCKER_PROVIDER,
                    'url': url,
                })
                self.assertEqual(compute_resource['url'], url)
                new_url = gen_url(subdomain=gen_alpha())
                ComputeResource.update({
                    'id': compute_resource['id'],
                    'url': new_url,
                })
                compute_resource = ComputeResource.info({
                    'id': compute_resource['id'],
                })
                self.assertEqual(compute_resource['url'], new_url)
    def test_positive_update_name(self):
        """Update Openstack compute resource name

        :id: 16eb2def-34d5-49c5-be22-88139fef7f97

        :steps:

            1. Create a osp compute resource
            2. Update the name of the created compute resource

        :expectedresults: Compute Resource name is successfully updated

        :CaseImportance: Critical
        """
        new_name = gen_string('alpha')
        comp_res = make_compute_resource({
            u'provider': 'Openstack',
            u'user': self.username,
            u'password': self.password,
            u'tenant': self.tenant,
            u'url': self.current_osp_url
        })
        self.assertTrue(comp_res['name'])
        ComputeResource.update({
            'name': comp_res['name'],
            'new-name': new_name
        })
        self.assertEqual(new_name,
                         ComputeResource.info({'id': comp_res['id']})['name'])
Exemplo n.º 5
0
    def test_positive_update_name(self):
        """RHEV compute resource positive update

        :id: 5ca29b81-d1f0-409f-843d-aa5daf957d7f

        :steps:

            1. Create a RHEV compute resource
            2. Update the name of the created compute resource

        :expectedresults: Compute Resource is successfully updated

        :CaseImportance: Critical

        :BZ: 1602835
        """
        new_name = gen_string('alpha')
        comp_res = make_compute_resource({
            'provider': 'Ovirt',
            'user': self.username,
            'password': self.password,
            'datacenter': self.datacenter,
            'url': self.current_rhev_url,
        })
        self.assertTrue(comp_res['name'])
        ComputeResource.update({
            'name': comp_res['name'],
            'new-name': new_name
        })
        self.assertEqual(new_name,
                         ComputeResource.info({'id': comp_res['id']})['name'])
Exemplo n.º 6
0
    def test_create_comp_res_with_console_password(self, console_password):
        """@Test: Create Compute Resource with different values of
        set-console-password parameter

        @Feature: Compute Resource - Set Console Password

        @Assert: Compute Resource is created and set-console-password
        parameter is set

        @BZ: 1214312

        """
        try:
            comp_resource = make_compute_resource({
                u'url': gen_url(),
                u'provider': FOREMAN_PROVIDERS['libvirt'],
                u'set-console-password': console_password,
            })
        except CLIFactoryError as err:
            self.fail(err)
        result = ComputeResource.info({'id': comp_resource['id']})
        if console_password in (u'True', u'Yes', 1):
            self.assertEqual(result.stdout['set-console-password'], u'true')
        else:
            self.assertEqual(result.stdout['set-console-password'], u'false')
Exemplo n.º 7
0
    def test_positive_update_name(self):
        """Compute Resource positive update

        @Feature: Compute Resource update

        @Assert: Compute Resource successfully updated

        """
        for options in valid_update_data():
            with self.subTest(options):
                comp_res = make_compute_resource()
                options.update({'name': comp_res['name']})
                # update Compute Resource
                ComputeResource.update(options)
                # check updated values
                result = ComputeResource.info({'id': comp_res['id']})
                self.assertEqual(
                    result['description'],
                    options.get('description', comp_res['description']))
                self.assertEqual(result['name'],
                                 options.get('new-name', comp_res['name']))
                self.assertEqual(result['url'],
                                 options.get('url', comp_res['url']))
                self.assertEqual(result['provider'].lower(),
                                 comp_res['provider'].lower())
    def test_update_positive(self, options):
        """@Test: Compute Resource positive update

        @Feature: Compute Resource update

        @Assert: Compute Resource successfully updated

        """
        comp_res = make_compute_resource()

        # update Compute Resource
        result = ComputeResource.update(
            dict({'name': comp_res['name']}, **options))
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)

        comp_res['name'] = options.get('new-name', comp_res['name'])
        comp_res.update(options)
        # check updated values
        result = ComputeResource.info({'id': comp_res['id']})
        self.assertEqual(result.return_code, 0)
        self.assertEqual(result.stdout['description'],
                         comp_res['description'])
        self.assertEqual(result.stdout['name'], comp_res['name'])
        self.assertEqual(result.stdout['provider'].lower(),
                         comp_res['provider'].lower())
        self.assertEqual(result.stdout['url'], comp_res['url'])
    def test_positive_update_name(self):
        """Update Openstack compute resource name

        :id: 16eb2def-34d5-49c5-be22-88139fef7f97

        :steps:

            1. Create a osp compute resource
            2. Update the name of the created compute resource

        :expectedresults: Compute Resource name is successfully updated

        :CaseImportance: Critical
        """
        new_name = gen_string('alpha')
        comp_res = make_compute_resource({
            u'provider': 'Openstack',
            u'user': self.username,
            u'password': self.password,
            u'tenant': self.tenant,
            u'url': self.current_osp_url
        })
        self.assertTrue(comp_res['name'])
        ComputeResource.update({
            'name': comp_res['name'],
            'new-name': new_name
        })
        self.assertEqual(
            new_name,
            ComputeResource.info({'id': comp_res['id']})['name']
        )
Exemplo n.º 10
0
    def test_positive_update_name(self):
        """Compute Resource positive update

        :id: 213d7f04-4c54-4985-8ca0-d2a1a9e3b305

        :expectedresults: Compute Resource successfully updated


        :CaseImportance: Critical
        """
        for options in valid_update_data():
            with self.subTest(options):
                comp_res = make_compute_resource()
                options.update({'name': comp_res['name']})
                # update Compute Resource
                ComputeResource.update(options)
                # check updated values
                result = ComputeResource.info({'id': comp_res['id']})
                self.assertEqual(
                    result['description'],
                    options.get('description', comp_res['description'])
                )
                self.assertEqual(
                    result['name'],
                    options.get('new-name', comp_res['name'])
                )
                self.assertEqual(
                    result['url'],
                    options.get('url', comp_res['url'])
                )
                self.assertEqual(
                    result['provider'].lower(),
                    comp_res['provider'].lower()
                )
Exemplo n.º 11
0
    def test_positive_create_with_console_password(self):
        """Create Compute Resource with different values of
        set-console-password parameter

        :id: 4531b3e3-906b-4835-a6ab-3332dc9bd636

        :expectedresults: Compute Resource is created and set-console-password
            parameter is set

        :BZ: 1214312


        :CaseImportance: Critical
        """
        for console_password in (u'True', u'Yes', 1, u'False', u'No', 0):
            with self.subTest(console_password):
                comp_resource = make_compute_resource({
                    u'provider':
                    FOREMAN_PROVIDERS['libvirt'],
                    u'set-console-password':
                    console_password,
                    u'url':
                    gen_url(),
                })
                result = ComputeResource.info({'id': comp_resource['id']})
                if console_password in (u'True', u'Yes', 1):
                    self.assertEqual(result['set-console-password'], u'true')
                else:
                    self.assertEqual(result['set-console-password'], u'false')
Exemplo n.º 12
0
    def test_positive_create_with_console_password(self):
        """Create Compute Resource with different values of
        set-console-password parameter

        :id: 4531b3e3-906b-4835-a6ab-3332dc9bd636

        :expectedresults: Compute Resource is created and set-console-password
            parameter is set

        :BZ: 1214312


        :CaseImportance: Critical
        """
        for console_password in (u'True', u'Yes', 1, u'False', u'No', 0):
            with self.subTest(console_password):
                comp_resource = make_compute_resource({
                    u'provider': FOREMAN_PROVIDERS['libvirt'],
                    u'set-console-password': console_password,
                    u'url': gen_url(),
                })
                result = ComputeResource.info({'id': comp_resource['id']})
                if console_password in (u'True', u'Yes', 1):
                    self.assertEqual(result['set-console-password'], u'true')
                else:
                    self.assertEqual(result['set-console-password'], u'false')
Exemplo n.º 13
0
    def test_positive_update_name(self):
        """Update Openstack compute resource name

        :id: 16eb2def-34d5-49c5-be22-88139fef7f97

        :steps:

            1. Create a osp compute resource
            2. Update the name of the created compute resource

        :expectedresults: Compute Resource name is successfully updated

        :CaseImportance: Critical

        :BZ: 1579714
        """
        new_name = gen_string('alpha')
        comp_res = make_compute_resource(
            {
                'provider': 'Openstack',
                'user': OSP_SETTINGS['username'],
                'password': OSP_SETTINGS['password'],
                'tenant': OSP_SETTINGS['tenant'],
                'url': OSP_SETTINGS['hostname'],
                'project-domain-id': OSP_SETTINGS['project_domain_id'],
            }
        )
        assert ComputeResource.exists(search=('name', comp_res['name']))
        ComputeResource.update({'name': comp_res['name'], 'new-name': new_name})
        assert new_name == ComputeResource.info({'id': comp_res['id']})['name']
Exemplo n.º 14
0
    def test_positive_update_name(self):
        """Compute Resource positive update

        :id: 213d7f04-4c54-4985-8ca0-d2a1a9e3b305

        :expectedresults: Compute Resource successfully updated


        :CaseImportance: Critical
        """
        for options in valid_update_data():
            with self.subTest(options):
                comp_res = make_compute_resource()
                options.update({'name': comp_res['name']})
                # update Compute Resource
                ComputeResource.update(options)
                # check updated values
                result = ComputeResource.info({'id': comp_res['id']})
                self.assertEqual(
                    result['description'],
                    options.get('description', comp_res['description']))
                self.assertEqual(result['name'],
                                 options.get('new-name', comp_res['name']))
                self.assertEqual(result['url'],
                                 options.get('url', comp_res['url']))
                self.assertEqual(result['provider'].lower(),
                                 comp_res['provider'].lower())
Exemplo n.º 15
0
    def test_positive_create_with_console_password(self):
        """Create Compute Resource with different values of
        set-console-password parameter

        @Feature: Compute Resource - Set Console Password

        @Assert: Compute Resource is created and set-console-password
        parameter is set

        @BZ: 1214312

        """
        for console_password in (u'True', u'Yes', 1, u'False', u'No', 0):
            with self.subTest(console_password):
                comp_resource = make_compute_resource({
                    u'provider':
                    FOREMAN_PROVIDERS['libvirt'],
                    u'set-console-password':
                    console_password,
                    u'url':
                    gen_url(),
                })
                result = ComputeResource.info({'id': comp_resource['id']})
                if console_password in (u'True', u'Yes', 1):
                    self.assertEqual(result['set-console-password'], u'true')
                else:
                    self.assertEqual(result['set-console-password'], u'false')
Exemplo n.º 16
0
    def test_positive_update_name(self):
        """RHEV compute resource positive update

        :id: 5ca29b81-d1f0-409f-843d-aa5daf957d7f

        :steps:

            1. Create a RHEV compute resource
            2. Update the name of the created compute resource

        :expectedresults: Compute Resource is successfully updated

        :CaseImportance: Critical
        """
        new_name = gen_string('alpha')
        comp_res = make_compute_resource({
            u'provider': 'Ovirt',
            u'user': self.username,
            u'password': self.passord,
            u'datacenter': self.datacenter,
            u'url': self.current_rhev_url
        })
        self.assertTrue(comp_res['name'])
        ComputeResource.update({
            'name': comp_res['name'],
            'new-name': new_name
        })
        self.assertEqual(
            new_name,
            ComputeResource.info({'id': comp_res['id']})['name']
        )
Exemplo n.º 17
0
    def test_delete_docker_compute_resource(self):
        """@Test: Create a Docker-based Compute Resource then delete it.

        @Assert: Compute Resource can be created, listed and deleted.

        @Feature: Docker

        """
        for url in (EXTERNAL_DOCKER_URL, INTERNAL_DOCKER_URL):
            with self.subTest(url):
                compute_resource = make_compute_resource({
                    'provider': DOCKER_PROVIDER,
                    'url': url,
                })
                self.assertEqual(compute_resource['url'], url)
                self.assertEqual(compute_resource['provider'], DOCKER_PROVIDER)
                ComputeResource.delete({'id': compute_resource['id']})
                with self.assertRaises(CLIReturnCodeError):
                    ComputeResource.info({'id': compute_resource['id']})
Exemplo n.º 18
0
    def test_positive_crud_azurerm_cr(self, module_org, module_location, azurerm_settings):
        """Create, Read, Update and Delete AzureRm compute resources

        :id: 776243ac-1666-4d9b-b99c-f0cadb19b06e

        :expectedresults: Compute resource should be created, read, updated and deleted

        :CaseImportance: Critical

        :CaseLevel: Component
        """
        # Create CR
        cr_name = gen_string('alpha')
        compresource = ComputeResource.create(
            {
                'name': cr_name,
                'provider': 'AzureRm',
                'app-ident': azurerm_settings['app_ident'],
                'secret-key': azurerm_settings['secret'],
                'tenant': azurerm_settings['tenant'],
                'sub-id': azurerm_settings['sub_id'],
                'region': azurerm_settings['region'],
                'organization-id': module_org.id,
                'location-id': module_location.id,
            }
        )
        assert compresource['name'] == cr_name
        assert compresource['provider'] == 'Azure Resource Manager'
        assert compresource['tenant'] == azurerm_settings['tenant']
        assert compresource['app_ident'] == azurerm_settings['app_ident']
        assert compresource['sub_id'] == azurerm_settings['sub_id']
        assert compresource['region'] == azurerm_settings['region']
        assert module_org.name in compresource['organizations']
        assert module_location.name in compresource['locations']

        # List CR
        list_cr = ComputeResource.list()
        assert len([cr for cr in list_cr if cr['name'] == cr_name]) == 1

        # Update CR
        new_cr_name = gen_string('alpha')
        description = gen_string('utf8')
        ComputeResource.update({'name': cr_name, 'new-name': new_cr_name})
        ComputeResource.update({'name': new_cr_name, 'description': description})
        # check updated values
        result = ComputeResource.info({'id': compresource['id']})
        assert result['name'] == new_cr_name
        assert result['description'] == description

        # Delete CR
        ComputeResource.delete({'name': result['name']})
        assert not ComputeResource.exists(search=('name', result['name']))
Exemplo n.º 19
0
 def test_info(self):
     """
     @Feature: Compute Resource - Info
     @Test: Test Compute Resource Info
     @Assert: Compute resource Info is displayed
     """
     result_create = make_compute_resource({
         'provider': FOREMAN_PROVIDERS['libvirt'],
         'url': "qemu+tcp://%s:16509/system" %
         conf.properties['main.server.hostname']})
     self.assertTrue(result_create['name'],
                     "ComputeResource create - has name")
     result_info = ComputeResource.info({'name': result_create['name']})
     self.assertEquals(result_info.return_code, 0,
                       "ComputeResource info - exit code")
     self.assertEquals(result_info.stdout['name'], result_create['name'],
                       "ComputeResource info - check name")
Exemplo n.º 20
0
 def test_info(self):
     """
     @Feature: Compute Resource - Info
     @Test: Test Compute Resource Info
     @Assert: Compute resource Info is displayed
     """
     result_create = make_compute_resource({
         'provider':
         FOREMAN_PROVIDERS['libvirt'],
         'url':
         "qemu+tcp://%s:16509/system" %
         conf.properties['main.server.hostname']
     })
     self.assertTrue(result_create['name'],
                     "ComputeResource create - has name")
     result_info = ComputeResource.info({'name': result_create['name']})
     self.assertEquals(result_info.return_code, 0,
                       "ComputeResource info - exit code")
     self.assertEquals(result_info.stdout['name'], result_create['name'],
                       "ComputeResource info - check name")
Exemplo n.º 21
0
    def test_negative_update(self):
        """Compute Resource negative update

        @Feature: Compute Resource update

        @Assert: Compute Resource not updated

        """
        for options in invalid_update_data():
            with self.subTest(options):
                comp_res = make_compute_resource()
                with self.assertRaises(CLIReturnCodeError):
                    ComputeResource.update(
                        dict({'name': comp_res['name']}, **options))
                result = ComputeResource.info({'id': comp_res['id']})
                # check attributes have not changed
                self.assertEqual(result['name'], comp_res['name'])
                options.pop('new-name', None)
                for key in options.keys():
                    self.assertEqual(comp_res[key], result[key])
Exemplo n.º 22
0
    def test_negative_update(self):
        """Compute Resource negative update

        @Feature: Compute Resource update

        @Assert: Compute Resource not updated

        """
        for options in invalid_update_data():
            with self.subTest(options):
                comp_res = make_compute_resource()
                with self.assertRaises(CLIReturnCodeError):
                    ComputeResource.update(
                        dict({'name': comp_res['name']}, **options))
                result = ComputeResource.info({'id': comp_res['id']})
                # check attributes have not changed
                self.assertEqual(result['name'], comp_res['name'])
                options.pop('new-name', None)
                for key in options.keys():
                    self.assertEqual(comp_res[key], result[key])
Exemplo n.º 23
0
    def test_update_negative(self, options):
        """
        @Test: Compute Resource negative update
        @Feature: Compute Resource update
        @Assert: Compute Resource not updated
        """
        comp_res = make_compute_resource()

        result = ComputeResource.update(
            dict({'name': comp_res['name']}, **options))

        self.assertNotEqual(result.return_code, 0)
        self.assertGreater(len(result.stderr), 0)

        result = ComputeResource.info({'id': comp_res['id']})
        self.assertEqual(result.return_code, 0)
        # check attributes have not changed
        self.assertEqual(result.stdout['name'], comp_res['name'])
        for key in options.keys():
            self.assertEqual(comp_res[key], result.stdout[key])
Exemplo n.º 24
0
    def test_negative_update(self):
        """Compute Resource negative update

        :id: e7aa9b39-dd01-4f65-8e89-ff5a6f4ee0e3

        :expectedresults: Compute Resource not updated


        :CaseImportance: Critical
        """
        for options in invalid_update_data():
            with self.subTest(options):
                comp_res = make_compute_resource()
                with self.assertRaises(CLIReturnCodeError):
                    ComputeResource.update(
                        dict({'name': comp_res['name']}, **options))
                result = ComputeResource.info({'id': comp_res['id']})
                # check attributes have not changed
                self.assertEqual(result['name'], comp_res['name'])
                options.pop('new-name', None)
                for key in options.keys():
                    self.assertEqual(comp_res[key], result[key])
Exemplo n.º 25
0
    def test_negative_update(self):
        """Compute Resource negative update

        :id: e7aa9b39-dd01-4f65-8e89-ff5a6f4ee0e3

        :expectedresults: Compute Resource not updated


        :CaseImportance: Critical
        """
        for options in invalid_update_data():
            with self.subTest(options):
                comp_res = make_compute_resource()
                with self.assertRaises(CLIReturnCodeError):
                    ComputeResource.update(
                        dict({'name': comp_res['name']}, **options))
                result = ComputeResource.info({'id': comp_res['id']})
                # check attributes have not changed
                self.assertEqual(result['name'], comp_res['name'])
                options.pop('new-name', None)
                for key in options.keys():
                    self.assertEqual(comp_res[key], result[key])
Exemplo n.º 26
0
def test_negative_update(libvirt_url, options):
    """Compute Resource negative update

    :id: e7aa9b39-dd01-4f65-8e89-ff5a6f4ee0e3

    :expectedresults: Compute Resource not updated

    :CaseImportance: High

    :CaseLevel: Component

    :parametrized: yes
    """
    comp_res = make_compute_resource()
    with pytest.raises(CLIReturnCodeError):
        ComputeResource.update(dict({'name': comp_res['name']}, **options))
    result = ComputeResource.info({'id': comp_res['id']})
    # check attributes have not changed
    assert result['name'] == comp_res['name']
    options.pop('new-name', None)
    for key in options.keys():
        assert comp_res[key] == result[key]
Exemplo n.º 27
0
    def test_update_negative(self, options):
        """@Test: Compute Resource negative update

        @Feature: Compute Resource update

        @Assert: Compute Resource not updated

        """
        comp_res = make_compute_resource()

        result = ComputeResource.update(
            dict({'name': comp_res['name']}, **options))

        self.assertNotEqual(result.return_code, 0)
        self.assertGreater(len(result.stderr), 0)

        result = ComputeResource.info({'id': comp_res['id']})
        self.assertEqual(result.return_code, 0)
        # check attributes have not changed
        self.assertEqual(result.stdout['name'], comp_res['name'])
        options.pop('new-name', None)
        for key in options.keys():
            self.assertEqual(comp_res[key], result.stdout[key])
Exemplo n.º 28
0
def test_positive_update_name(libvirt_url, options):
    """Compute Resource positive update

    :id: 213d7f04-4c54-4985-8ca0-d2a1a9e3b305

    :expectedresults: Compute Resource successfully updated

    :CaseImportance: Critical

    :CaseLevel: Component

    :parametrized: yes
    """
    comp_res = make_compute_resource()
    options.update({'name': comp_res['name']})
    # update Compute Resource
    ComputeResource.update(options)
    # check updated values
    result = ComputeResource.info({'id': comp_res['id']})
    assert result['description'] == options.get('description', comp_res['description'])
    assert result['name'] == options.get('new-name', comp_res['name'])
    assert result['url'] == options.get('url', comp_res['url'])
    assert result['provider'].lower() == comp_res['provider'].lower()
Exemplo n.º 29
0
    def test_positive_create_with_console_password(self):
        """Create Compute Resource with different values of
        set-console-password parameter

        @Feature: Compute Resource - Set Console Password

        @Assert: Compute Resource is created and set-console-password
        parameter is set

        @BZ: 1214312

        """
        for console_password in (u'True', u'Yes', 1, u'False', u'No', 0):
            with self.subTest(console_password):
                comp_resource = make_compute_resource({
                    u'provider': FOREMAN_PROVIDERS['libvirt'],
                    u'set-console-password': console_password,
                    u'url': gen_url(),
                })
                result = ComputeResource.info({'id': comp_resource['id']})
                if console_password in (u'True', u'Yes', 1):
                    self.assertEqual(result['set-console-password'], u'true')
                else:
                    self.assertEqual(result['set-console-password'], u'false')
Exemplo n.º 30
0
    def test_crud_and_duplicate_name(self, request, id_type):
        """Create, list, update and delete Openstack compute resource

        :id: caf60bad-999d-483e-807f-95f52f35085d

        :expectedresults: OSP Compute resource can be created updated and deleted

        :CaseImportance: Critical

        :parametrized: yes

        :BZ: 1579714
        """
        # create
        name = gen_string('alpha')
        compute_resource = make_compute_resource({
            'name':
            name,
            'provider':
            'Openstack',
            'user':
            OSP_SETTINGS['username'],
            'password':
            OSP_SETTINGS['password'],
            'tenant':
            OSP_SETTINGS['tenant'],
            'url':
            OSP_SETTINGS['hostname'],
            'project-domain-id':
            OSP_SETTINGS['project_domain_id'],
        })
        request.addfinalizer(lambda: self.cr_cleanup(compute_resource['id']))
        assert compute_resource['name'] == name
        assert ComputeResource.exists(search=(id_type,
                                              compute_resource[id_type]))

        # negative create with same name
        with pytest.raises(CLIFactoryError):
            make_compute_resource({
                'name':
                name,
                'provider':
                'Openstack',
                'user':
                OSP_SETTINGS['username'],
                'password':
                OSP_SETTINGS['password'],
                'tenant':
                OSP_SETTINGS['tenant'],
                'url':
                OSP_SETTINGS['hostname'],
                'project-domain-id':
                OSP_SETTINGS['project_domain_id'],
            })
        # update
        new_name = gen_string('alpha')
        ComputeResource.update({
            id_type: compute_resource[id_type],
            'new-name': new_name
        })
        if id_type == 'name':
            compute_resource = ComputeResource.info({'name': new_name})
        else:
            compute_resource = ComputeResource.info(
                {'id': compute_resource['id']})
        assert new_name == compute_resource['name']
        ComputeResource.delete({id_type: compute_resource[id_type]})
        assert not ComputeResource.exists(search=(id_type,
                                                  compute_resource[id_type]))