示例#1
0
    def test_positive_update_from_compresources_to_compresource(self):
        """Create location with multiple (not less than three) compute
        resources assigned to it. Try to update location and overwrite all
        compute resources with a new single compute resource. Use compute
        resource id as a parameter

        :id: 3a547413-53dc-4305-84e9-8db7a6bed3b2

        :expectedresults: Location updated successfully and has correct compute
            resource assigned to it

        :CaseImportance: Critical
        """
        resources_amount = randint(3, 5)
        resources = [make_compute_resource() for _ in range(resources_amount)]
        loc = make_location({
            'compute-resource-ids': [resource['id'] for resource in resources],
        })
        self.assertEqual(len(loc['compute-resources']), resources_amount)
        for resource in resources:
            self.assertIn(resource['name'], loc['compute-resources'])

        new_resource = make_compute_resource()
        Location.update({
            'compute-resource-ids': new_resource['id'],
            'id': loc['id'],
        })

        loc = Location.info({'id': loc['id']})
        self.assertEqual(len(loc['compute-resources']), 1)
        self.assertEqual(loc['compute-resources'][0], new_resource['name'])
    def test_positive_update_from_compresources_to_compresource(self):
        """Create location with multiple (not less than three) compute
        resources assigned to it. Try to update location and overwrite all
        compute resources with a new single compute resource. Use compute
        resource id as a parameter

        @Feature: Location

        @Assert: Location updated successfully and has correct compute resource
        assigned to it

        """
        resources_amount = randint(3, 5)
        resources = [make_compute_resource() for _ in range(resources_amount)]
        loc = make_location({
            'compute-resource-ids': [resource['id'] for resource in resources],
        })
        self.assertEqual(len(loc['compute-resources']), resources_amount)
        for resource in resources:
            self.assertIn(resource['name'], loc['compute-resources'])

        new_resource = make_compute_resource()
        Location.update({
            'compute-resource-ids': new_resource['id'],
            'id': loc['id'],
        })

        loc = Location.info({'id': loc['id']})
        self.assertEqual(len(loc['compute-resources']), 1)
        self.assertEqual(loc['compute-resources'][0], new_resource['name'])
    def test_negative_create_with_same_name(self):
        """RHEV compute resource negative create with the same name

        :id: f00813ef-df31-462c-aa87-479b8272aea3

        :steps:

            1. Create a RHEV compute resource.
            2. Create another RHEV compute resource with same name.

        :expectedresults: Compute resource is not created

        :CaseImportance: Critical
        """
        name = gen_string('alpha')
        compute_resource = make_compute_resource({
            u'name': name,
            u'provider': 'Ovirt',
            u'user': self.username,
            u'password': self.passord,
            u'datacenter': self.datacenter,
            u'url': self.current_rhev_url
        })
        self.assertEquals(compute_resource['name'], name)
        with self.assertRaises(CLIFactoryError):
            make_compute_resource({
                u'name': name,
                u'provider': 'Ovirt',
                u'user': self.username,
                u'password': self.passord,
                u'datacenter': self.datacenter,
                u'url': self.current_rhev_url
            })
    def test_negative_create_with_same_name(self):
        """Attempt to create Openstack compute resource with the same name as
        an existing one

        :id: b08132fe-6081-48e9-b7fd-9da7966aef5d

        :steps:

            1. Create a osp compute resource.
            2. Create another osp compute resource with same name.

        :expectedresults: Compute resource is not created

        :CaseImportance: Critical
        """
        name = gen_string('alpha')
        compute_resource = make_compute_resource({
            u'name': name,
            u'provider': 'Openstack',
            u'user': self.username,
            u'password': self.password,
            u'tenant': self.tenant,
            u'url': self.current_osp_url
        })
        self.assertEquals(compute_resource['name'], name)
        with self.assertRaises(CLIFactoryError):
            make_compute_resource({
                u'name': name,
                u'provider': 'Openstack',
                u'user': self.username,
                u'password': self.password,
                u'tenant': self.tenant,
                u'url': self.current_osp_url
            })
示例#5
0
    def test_positive_update_from_compresources_to_compresource(self):
        """Create location with multiple (not less than three) compute
        resources assigned to it. Try to update location and overwrite all
        compute resources with a new single compute resource. Use compute
        resource id as a parameter

        :id: 3a547413-53dc-4305-84e9-8db7a6bed3b2

        :expectedresults: Location updated successfully and has correct compute
            resource assigned to it

        :CaseImportance: Critical
        """
        resources_amount = randint(3, 5)
        resources = [make_compute_resource() for _ in range(resources_amount)]
        loc = make_location({
            'compute-resource-ids': [resource['id'] for resource in resources],
        })
        self.assertEqual(len(loc['compute-resources']), resources_amount)
        for resource in resources:
            self.assertIn(resource['name'], loc['compute-resources'])

        new_resource = make_compute_resource()
        Location.update({
            'compute-resource-ids': new_resource['id'],
            'id': loc['id'],
        })

        loc = Location.info({'id': loc['id']})
        self.assertEqual(len(loc['compute-resources']), 1)
        self.assertEqual(loc['compute-resources'][0], new_resource['name'])
示例#6
0
def test_negative_create_with_same_name(rhev):
    """RHEV compute resource negative create with the same name

    :id: f00813ef-df31-462c-aa87-479b8272aea3

    :steps:

        1. Create a RHEV compute resource.
        2. Create another RHEV compute resource with same name.

    :expectedresults: Compute resource is not created

    :CaseImportance: High
    """
    name = gen_string('alpha')
    compute_resource = make_compute_resource({
        'name': name,
        'provider': 'Ovirt',
        'user': rhev.username,
        'password': rhev.password,
        'datacenter': rhev.datacenter,
        'url': rhev.hostname,
    })
    assert compute_resource['name'] == name
    with pytest.raises(CLIFactoryError):
        make_compute_resource({
            'name': name,
            'provider': 'Ovirt',
            'user': rhev.username,
            'password': rhev.password,
            'datacenter': rhev.datacenter,
            'url': rhev.hostname,
        })
示例#7
0
    def test_update_location_with_multiple_comp_resources_to_single(self):
        """@Test: Create location with multiple (not less than three) compute
        resources assigned to it. Try to update location and overwrite all
        compute resources with a new single compute resource. Use compute
        resource id as a parameter

        @Feature: Location

        @Assert: Location updated successfully and has correct compute resource
        assigned to it

        """
        resources_amount = randint(3, 5)
        resources = [make_compute_resource() for _ in range(resources_amount)]
        loc = make_location({
            'compute-resource-ids': [resource['id'] for resource in resources],
        })
        self.assertEqual(len(loc['compute-resources']), resources_amount)
        for resource in resources:
            self.assertIn(resource['name'], loc['compute-resources'])

        new_resource = make_compute_resource()
        Location.update({
            'compute-resource-ids': new_resource['id'],
            'id': loc['id'],
        })

        loc = Location.info({'id': loc['id']})
        self.assertEqual(len(loc['compute-resources']), 1)
        self.assertEqual(loc['compute-resources'][0], new_resource['name'])
    def test_negative_create_with_same_name(self):
        """Attempt to create Openstack compute resource with the same name as
        an existing one

        :id: b08132fe-6081-48e9-b7fd-9da7966aef5d

        :steps:

            1. Create a osp compute resource.
            2. Create another osp compute resource with same name.

        :expectedresults: Compute resource is not created

        :CaseImportance: Critical
        """
        name = gen_string('alpha')
        compute_resource = make_compute_resource({
            u'name': name,
            u'provider': 'Openstack',
            u'user': self.username,
            u'password': self.password,
            u'tenant': self.tenant,
            u'url': self.current_osp_url
        })
        self.assertEquals(compute_resource['name'], name)
        with self.assertRaises(CLIFactoryError):
            make_compute_resource({
                u'name': name,
                u'provider': 'Openstack',
                u'user': self.username,
                u'password': self.password,
                u'tenant': self.tenant,
                u'url': self.current_osp_url
            })
示例#9
0
    def test_negative_create_with_same_name(self):
        """RHEV compute resource negative create with the same name

        :id: f00813ef-df31-462c-aa87-479b8272aea3

        :steps:

            1. Create a RHEV compute resource.
            2. Create another RHEV compute resource with same name.

        :expectedresults: Compute resource is not created

        :CaseImportance: High
        """
        name = gen_string('alpha')
        compute_resource = make_compute_resource({
            'name': name,
            'provider': 'Ovirt',
            'user': self.username,
            'password': self.password,
            'datacenter': self.datacenter,
            'url': self.current_rhev_url,
        })
        self.assertEquals(compute_resource['name'], name)
        with self.assertRaises(CLIFactoryError):
            make_compute_resource({
                'name': name,
                'provider': 'Ovirt',
                'user': self.username,
                'password': self.password,
                'datacenter': self.datacenter,
                'url': self.current_rhev_url,
            })
示例#10
0
    def test_positive_add_and_remove_compresources(self):
        """Add and remove a compute resource from organization

        :id: 415c14ab-f879-4ed8-9ba7-8af4ada2e277

        :expectedresults: Compute resource are handled as expected

        :bz: 1395229

        :steps:
            1. Add and remove compute resource by id
            2. Add and remove compute resource by name

        :CaseLevel: Integration
        """
        org = make_org()
        compute_res_a = make_compute_resource({
            'provider': FOREMAN_PROVIDERS['libvirt'],
            'url': u'qemu+ssh://root@{0}/system'.format(
                settings.compute_resources.libvirt_hostname
            )
        })
        compute_res_b = make_compute_resource({
            'provider': FOREMAN_PROVIDERS['libvirt'],
            'url': u'qemu+ssh://root@{0}/system'.format(
                settings.compute_resources.libvirt_hostname
            )
        })
        Org.add_compute_resource({
            'compute-resource-id': compute_res_a['id'],
            'id': org['id'],
        })
        Org.add_compute_resource({
            'compute-resource': compute_res_b['name'],
            'name': org['name'],
        })
        org_info = Org.info({'id': org['id']})
        self.assertEqual(len(org_info['compute-resources']), 2,
                         "Failed to add compute resources")
        Org.remove_compute_resource({
            'compute-resource-id': compute_res_a['id'],
            'id': org['id'],
        })
        Org.remove_compute_resource({
            'compute-resource': compute_res_b['name'],
            'name': org['name'],
        })
        org_info = Org.info({'id': org['id']})
        self.assertNotIn(
            compute_res_a['name'],
            org_info['compute-resources'],
            "Failed to remove cr by id"
        )
        self.assertNotIn(
            compute_res_b['name'],
            org_info['compute-resources'],
            "Failed to remove cr by name"
        )
示例#11
0
    def test_positive_add_and_remove_compresources(self):
        """Add and remove a compute resource from organization

        :id: 415c14ab-f879-4ed8-9ba7-8af4ada2e277

        :expectedresults: Compute resource are handled as expected

        :bz: 1395229

        :steps:
            1. Add and remove compute resource by id
            2. Add and remove compute resource by name

        :CaseLevel: Integration
        """
        org = make_org()
        compute_res_a = make_compute_resource({
            'provider': FOREMAN_PROVIDERS['libvirt'],
            'url': u'qemu+ssh://root@{0}/system'.format(
                settings.compute_resources.libvirt_hostname
            )
        })
        compute_res_b = make_compute_resource({
            'provider': FOREMAN_PROVIDERS['libvirt'],
            'url': u'qemu+ssh://root@{0}/system'.format(
                settings.compute_resources.libvirt_hostname
            )
        })
        Org.add_compute_resource({
            'compute-resource-id': compute_res_a['id'],
            'id': org['id'],
        })
        Org.add_compute_resource({
            'compute-resource': compute_res_b['name'],
            'name': org['name'],
        })
        org_info = Org.info({'id': org['id']})
        self.assertEqual(len(org_info['compute-resources']), 2,
                         "Failed to add compute resources")
        Org.remove_compute_resource({
            'compute-resource-id': compute_res_a['id'],
            'id': org['id'],
        })
        Org.remove_compute_resource({
            'compute-resource': compute_res_b['name'],
            'name': org['name'],
        })
        org_info = Org.info({'id': org['id']})
        self.assertNotIn(
            compute_res_a['name'],
            org_info['compute-resources'],
            "Failed to remove cr by id"
        )
        self.assertNotIn(
            compute_res_b['name'],
            org_info['compute-resources'],
            "Failed to remove cr by name"
        )
    def test_positive_delete_by_id(self):
        """Delete the Openstack compute resource by id

        :id: f464429f-a4ac-4504-b009-5f56f9d29317

        :expectedresults: Compute resource is deleted

        :CaseImportance: Critical

        :BZ: 1579714
        """
        with self.assertNotRaises(CLIReturnCodeError):
            comp_res = make_compute_resource({
                'provider':
                'Openstack',
                'user':
                self.username,
                'password':
                self.password,
                'tenant':
                self.tenant,
                'url':
                self.current_osp_url,
                'project-domain-id':
                self.domain_id,
            })
            self.assertTrue(comp_res['name'])
            ComputeResource.delete({'id': comp_res['id']})
            result = ComputeResource.exists(search=('name', comp_res['name']))
            self.assertFalse(result)
示例#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']
    def test_positive_delete_by_name(self):
        """Delete the Openstack compute resource by name

        :id: 8c581100-4606-4d21-a286-930fb3a7ecd8

        :expectedresults: Compute resource is deleted

        :CaseImportance: Critical

        :BZ: 1579714
        """
        with self.assertNotRaises(CLIReturnCodeError):
            comp_res = make_compute_resource({
                'provider':
                'Openstack',
                'user':
                self.username,
                'password':
                self.password,
                'tenant':
                self.tenant,
                'url':
                self.current_osp_url,
                'project-domain-id':
                self.domain_id,
            })
            self.assertTrue(comp_res['name'])
            ComputeResource.delete({'name': comp_res['name']})
            result = ComputeResource.exists(search=('name', comp_res['name']))
            self.assertFalse(result)
示例#15
0
def test_negative_add_image_rhev_with_invalid_uuid(rhev, module_os):
    """Attempt to add invalid image to the RHEV compute resource

    :id: e8a653f9-9749-4c76-95ed-2411a7c0a117

    :setup: Images/templates should be present in RHEV-M itself,
        so that satellite can use them.

    :steps:

        1. Create a compute resource of type rhev.
        2. Create a image for the compute resource with invalid value for
           uuid parameter, compute-resource image create.

    :expectedresults: The image should not be added to the CR

    :BZ: 1829239
    """
    comp_res = make_compute_resource({
        'provider': 'Ovirt',
        'user': rhev.username,
        'password': rhev.password,
        'datacenter': rhev.datacenter,
        'url': rhev.hostname,
    })
    assert comp_res['name']
    with pytest.raises(CLIReturnCodeError):
        ComputeResource.image_create({
            'compute-resource': comp_res['name'],
            'name': f'img {gen_string(str_type="alpha")}',
            'uuid': f'invalidimguuid {gen_string(str_type="alpha")}',
            'operatingsystem': module_os.title,
            'architecture': rhev.image_arch,
            'username': "******",
        })
    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'])
示例#17
0
    def test_positive_osp_info(self):
        """List the info of Openstack compute resource

        :id: 8ed9f9e6-053a-402d-8f3d-3ba46300098d

        :expectedresults: OSP Compute resource Info is displayed

        :CaseImportance: Critical

        :BZ: 1579714
        """
        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'],
            }
        )

        assert compute_resource['name'] == name
        assert ComputeResource.exists(search=('id', compute_resource['id']))
    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()
                )
示例#19
0
    def test_positive_remove_compresource_by_id(self):
        """Remove a compute resource from organization by its ID

        @id: 415c14ab-f879-4ed8-9ba7-8af4ada2e277

        @Assert: Compute resource is removed from the org

        @CaseLevel: Integration
        """
        org = make_org()
        compute_res = make_compute_resource({
            'provider': FOREMAN_PROVIDERS['libvirt'],
            'url': u'qemu+ssh://root@{0}/system'.format(
                settings.compute_resources.libvirt_hostname
            )
        })
        Org.add_compute_resource({
            'compute-resource-id': compute_res['id'],
            'id': org['id'],
        })
        Org.remove_compute_resource({
            'compute-resource-id': compute_res['id'],
            'id': org['id'],
        })
        org = Org.info({'id': org['id']})
        self.assertNotIn(compute_res['name'], org['compute-resources'])
    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']
        )
示例#21
0
    def test_positive_remove_compresource_by_name(self):
        """Remove a compute resource from organization by its name

        @id: 1b1313a8-8326-4b33-8113-17c5cf0d4ffb

        @Assert: Compute resource is removed from the org

        @CaseLevel: Integration
        """
        org = make_org()
        compute_res = make_compute_resource({
            'provider': FOREMAN_PROVIDERS['libvirt'],
            'url': u'qemu+ssh://root@{0}/system'.format(
                settings.compute_resources.libvirt_hostname
            )
        })
        Org.add_compute_resource({
            'compute-resource': compute_res['name'],
            'name': org['name'],
        })
        Org.remove_compute_resource({
            'compute-resource': compute_res['name'],
            'name': org['name'],
        })
        org = Org.info({'name': org['name']})
        self.assertNotIn(compute_res['name'], org['compute-resources'])
    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')
示例#23
0
    def test_list_containers_docker_compute_resource(self):
        """@Test: Create a Docker-based Compute Resource in the Satellite 6
        instance then list its running containers.

        @Assert: Compute Resource can be created, listed and existing running
        instances can be listed.

        @Feature: Docker

        """
        for url in (EXTERNAL_DOCKER_URL, INTERNAL_DOCKER_URL):
            with self.subTest(url):
                compute_resource = make_compute_resource({
                    'organization-ids': [self.org['id']],
                    'provider': DOCKER_PROVIDER,
                    'url': url,
                })
                self.assertEqual(compute_resource['url'], url)
                result = DockerContainer.list({
                    'compute-resource-id': compute_resource['id'],
                })
                self.assertEqual(len(result), 0)
                container = make_container({
                    'compute-resource-id': compute_resource['id'],
                    'organization-ids': [self.org['id']],
                })
                result = DockerContainer.list({
                    'compute-resource-id': compute_resource['id'],
                })
                self.assertEqual(len(result), 1)
                self.assertEqual(result[0]['name'], container['name'])
示例#24
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())
    def test_positive_create_with_org(self):
        """Create VMware Compute Resource with organizations

        :id: 807a1f70-4cc3-4925-b145-0c3b26c57559

        :customerscenario: true

        :expectedresults: VMware Compute resource is created

        :BZ: 1387917

        :Caseautomation: Automated

        :CaseImportance: Critical
        """
        cr_name = gen_string('alpha')
        vmware_cr = make_compute_resource({
            'name': cr_name,
            'organization-ids': self.org['id'],
            'provider': FOREMAN_PROVIDERS['vmware'],
            'server': self.vmware_server,
            'user': self.vmware_username,
            'password': self.vmware_password,
            'datacenter': self.vmware_datacenter
        })
        self.assertEquals(vmware_cr['name'], cr_name)
    def test_positive_create_with_loc(self):
        """Create VMware Compute Resource with locations

        :id: 214a0f54-6fc2-4e7b-91ab-a45760ffb2f2

        :customerscenario: true

        :expectedresults: VMware Compute resource is created

        :BZ: 1387917

        :Caseautomation: Automated

        :CaseImportance: Critical
        """
        cr_name = gen_string('alpha')
        vmware_cr = make_compute_resource({
            'name': cr_name,
            'location-ids': self.loc['id'],
            'provider': FOREMAN_PROVIDERS['vmware'],
            'server': self.vmware_server,
            'user': self.vmware_username,
            'password': self.vmware_password,
            'datacenter': self.vmware_datacenter
        })
        self.assertEquals(vmware_cr['name'], cr_name)
示例#27
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'])
    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']
        )
示例#29
0
    def test_positive_remove_compresource_by_name(self):
        """Remove a compute resource from organization by its name

        @id: 1b1313a8-8326-4b33-8113-17c5cf0d4ffb

        @Assert: Compute resource is removed from the org

        @CaseLevel: Integration
        """
        org = make_org()
        compute_res = make_compute_resource({
            'provider': FOREMAN_PROVIDERS['libvirt'],
            'url': u'qemu+ssh://root@{0}/system'.format(
                settings.compute_resources.libvirt_hostname
            )
        })
        Org.add_compute_resource({
            'compute-resource': compute_res['name'],
            'name': org['name'],
        })
        Org.remove_compute_resource({
            'compute-resource': compute_res['name'],
            'name': org['name'],
        })
        org = Org.info({'name': org['name']})
        self.assertNotIn(compute_res['name'], org['compute-resources'])
示例#30
0
    def test_positive_create_with_org(self):
        """Create VMware Compute Resource with organizations

        :id: 807a1f70-4cc3-4925-b145-0c3b26c57559

        :customerscenario: true

        :expectedresults: VMware Compute resource is created

        :BZ: 1387917

        :CaseAutomation: Automated

        :CaseImportance: Critical
        """
        cr_name = gen_string('alpha')
        vmware_cr = make_compute_resource(
            {
                'name': cr_name,
                'organization-ids': self.org['id'],
                'provider': FOREMAN_PROVIDERS['vmware'],
                'server': self.vmware_server,
                'user': self.vmware_username,
                'password': self.vmware_password,
                'datacenter': self.vmware_datacenter,
            }
        )
        self.assertEquals(vmware_cr['name'], cr_name)
示例#31
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)
示例#32
0
    def test_positive_create_ec2_with_custom_region(self):
        """Create a new ec2 compute resource with custom region

        :id: 28eb592d-ebf0-4659-900a-87112b3b2ad7

        :customerscenario: true

        :expectedresults: ec2 compute resource is created successfully.

        :BZ: 1456942

        :CaseAutomation: Automated

        :CaseImportance: Critical
        """
        cr_name = gen_string(str_type='alpha')
        cr_description = gen_string(str_type='alpha')
        cr = make_compute_resource({
            'name': cr_name,
            'description': cr_description,
            'provider': FOREMAN_PROVIDERS['ec2'],
            'user': self.aws_access_key,
            'password': self.aws_secret_key,
            'region': EC2_REGION_CA_CENTRAL_1,
            'organizations': self.org['name'],
            'locations': self.loc['name'],
        })
        self.assertEquals(cr['name'], cr_name)
        self.assertEquals(cr['region'], EC2_REGION_CA_CENTRAL_1)
示例#33
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')
示例#34
0
    def test_positive_create_with_loc(self):
        """Create VMware Compute Resource with locations

        :id: 214a0f54-6fc2-4e7b-91ab-a45760ffb2f2

        :customerscenario: true

        :expectedresults: VMware Compute resource is created

        :BZ: 1387917

        :CaseAutomation: Automated

        :CaseImportance: Critical
        """
        cr_name = gen_string('alpha')
        vmware_cr = make_compute_resource(
            {
                'name': cr_name,
                'location-ids': self.loc['id'],
                'provider': FOREMAN_PROVIDERS['vmware'],
                'server': self.vmware_server,
                'user': self.vmware_username,
                'password': self.vmware_password,
                'datacenter': self.vmware_datacenter,
            }
        )
        self.assertEquals(vmware_cr['name'], cr_name)
示例#35
0
    def test_positive_create_with_server(self):
        """Create VMware compute resource with server field

        :id: a06b02c4-fe6a-44ef-bf61-5a28c3905527

        :customerscenario: true

        :expectedresults: Compute resource is created, server field saved
            correctly

        :BZ: 1387917

        :CaseAutomation: Automated

        :CaseImportance: Critical
        """
        cr_name = gen_string('alpha')
        vmware_cr = make_compute_resource(
            {
                'name': cr_name,
                'provider': FOREMAN_PROVIDERS['vmware'],
                'server': self.vmware_server,
                'user': self.vmware_username,
                'password': self.vmware_password,
                'datacenter': self.vmware_datacenter,
            }
        )
        self.assertEquals(vmware_cr['name'], cr_name)
        self.assertEquals(vmware_cr['server'], self.vmware_server)
示例#36
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')
示例#37
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_positive_create_with_org_and_loc(self):
        """Create VMware Compute Resource with organizations and locations

        :id: 96faae3f-bc64-4147-a9fc-09c858e0a68f

        :expectedresults: VMware Compute resource is created

        :BZ: 1387917

        :Caseautomation: Automated

        :CaseImportance: Critical
        """
        cr_name = gen_string('alpha')
        vmware_cr = make_compute_resource({
            'name': cr_name,
            'organization-ids': self.org['id'],
            'location-ids': self.loc['id'],
            'provider': FOREMAN_PROVIDERS['vmware'],
            'server': self.vmware_server,
            'user': self.vmware_username,
            'password': self.vmware_password,
            'datacenter': self.vmware_datacenter
        })
        self.assertEquals(vmware_cr['name'], cr_name)
示例#39
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_positive_osp_info(self):
        """List the info of Openstack compute resource

        :id: 8ed9f9e6-053a-402d-8f3d-3ba46300098d

        :expectedresults: OSP Compute resource Info is displayed

        :CaseImportance: Critical
        """
        name = gen_string('alpha')
        with self.assertNotRaises(CLIReturnCodeError):
            compute_resource = make_compute_resource({
                u'name':
                name,
                u'provider':
                'Openstack',
                u'user':
                self.username,
                u'password':
                self.password,
                u'tenant':
                self.tenant,
                u'url':
                self.current_osp_url
            })
            self.assertEquals(compute_resource['name'], name)
            self.assertIsNotNone(compute_resource['id'])
    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'])
    def test_positive_create_with_server(self):
        """Create VMware compute resource with server field

        :id: a06b02c4-fe6a-44ef-bf61-5a28c3905527

        :expectedresults: Compute resource is created, server field saved
            correctly

        :BZ: 1387917

        :Caseautomation: Automated

        :CaseImportance: Critical
        """
        cr_name = gen_string('alpha')
        vmware_cr = make_compute_resource({
            'name': cr_name,
            'provider': FOREMAN_PROVIDERS['vmware'],
            'server': self.vmware_server,
            'user': self.vmware_username,
            'password': self.vmware_password,
            'datacenter': self.vmware_datacenter
        })
        self.assertEquals(vmware_cr['name'], cr_name)
        self.assertEquals(vmware_cr['server'], self.vmware_server)
示例#43
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())
示例#44
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')
示例#45
0
    def test_list(self):
        """@Test: Test Compute Resource List

        @Feature: Compute Resource - List

        @Assert: Compute resource List 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_list = ComputeResource.list(
            {'search': "name=%s" % result_create['name']})
        self.assertEquals(result_list.return_code, 0,
                          "ComputeResource list - exit code")
        self.assertTrue(
            len(result_list.stdout) > 0,
            "ComputeResource list - stdout has results")
        stdout = ComputeResource.exists(search=('name',
                                                result_create['name'])).stdout
        self.assertTrue(stdout, "ComputeResource list - exists name")
示例#46
0
    def test_list(self):
        """@Test: Test Compute Resource List

        @Feature: Compute Resource - List

        @Assert: Compute resource List 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_list = ComputeResource.list({'search': "name=%s" %
                                            result_create['name']})
        self.assertEquals(result_list.return_code, 0,
                          "ComputeResource list - exit code")
        self.assertTrue(len(result_list.stdout) > 0,
                        "ComputeResource list - stdout has results")
        stdout = ComputeResource.exists(
            search=('name', result_create['name'])).stdout
        self.assertTrue(
            stdout,
            "ComputeResource list - exists name")
示例#47
0
    def test_positive_create_with_org_and_loc(self):
        """Create VMware Compute Resource with organizations and locations

        :id: 96faae3f-bc64-4147-a9fc-09c858e0a68f

        :customerscenario: true

        :expectedresults: VMware Compute resource is created

        :BZ: 1387917

        :CaseAutomation: Automated

        :CaseImportance: Critical
        """
        cr_name = gen_string('alpha')
        vmware_cr = make_compute_resource(
            {
                'name': cr_name,
                'organization-ids': self.org['id'],
                'location-ids': self.loc['id'],
                'provider': FOREMAN_PROVIDERS['vmware'],
                'server': self.vmware_server,
                'user': self.vmware_username,
                'password': self.vmware_password,
                'datacenter': self.vmware_datacenter,
            }
        )
        self.assertEquals(vmware_cr['name'], cr_name)
示例#48
0
    def test_positive_remove_compresource_by_id(self):
        """Remove a compute resource from organization by its ID

        @id: 415c14ab-f879-4ed8-9ba7-8af4ada2e277

        @Assert: Compute resource is removed from the org

        @CaseLevel: Integration
        """
        org = make_org()
        compute_res = make_compute_resource({
            'provider': FOREMAN_PROVIDERS['libvirt'],
            'url': u'qemu+ssh://root@{0}/system'.format(
                settings.compute_resources.libvirt_hostname
            )
        })
        Org.add_compute_resource({
            'compute-resource-id': compute_res['id'],
            'id': org['id'],
        })
        Org.remove_compute_resource({
            'compute-resource-id': compute_res['id'],
            'id': org['id'],
        })
        org = Org.info({'id': org['id']})
        self.assertNotIn(compute_res['name'], org['compute-resources'])
 def _init_once(self):
     """ a method invoked only once """
     self.__class__.comp_res = make_compute_resource(
         {
             "provider": FOREMAN_PROVIDERS["libvirt"],
             "url": "qemu+tcp://%s:16509/system" % conf.properties["main.server.hostname"],
         }
     )["name"]
示例#50
0
def _compute_resource(request):
    compute_resource = make_compute_resource()

    @request.addfinalizer
    def _cleanup():
        if ComputeResource.exists(search=('id', compute_resource['id'])):
            ComputeResource.delete(options={'id': compute_resource['id']})

    return compute_resource
示例#51
0
 def setUpClass(cls):
     BaseCLI.setUpClass()
     cls.compute_res_updates = make_compute_resource({
         'provider':
         FOREMAN_PROVIDERS['libvirt'],
         'url':
         "qemu+tcp://%s:16509/system" %
         conf.properties['main.server.hostname']
     })['name']
示例#52
0
    def test_negative_create_with_same_name(self):
        """Attempt to create Openstack compute resource with the same name as
        an existing one

        :id: b08132fe-6081-48e9-b7fd-9da7966aef5d

        :steps:

            1. Create a osp compute resource.
            2. Create another osp compute resource with same name.

        :expectedresults: Compute resource is not created

        :CaseImportance: Critical

        :BZ: 1579714
        """
        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'],
            }
        )
        assert ComputeResource.exists(search=('name', compute_resource['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'],
                }
            )
示例#53
0
    def test_positive_add_compresource_by_id(self):
        """Add a compute resource to organization by its ID

        @Feature: Organization

        @Assert: Compute Resource is added to the org
        """
        compute_res = make_compute_resource()
        org = make_org({'compute-resource-ids': compute_res['id']})
        self.assertEqual(len(org['compute-resources']), 1)
        self.assertEqual(org['compute-resources'][0], compute_res['name'])
示例#54
0
    def test_positive_create_with_loc(self):
        """Create Compute Resource with location

        @id: 224c7cbc-6bac-4a94-8141-d6249896f5a2

        @Assert: Compute resource is created and has location assigned

        """
        location = make_location()
        comp_resource = make_compute_resource({'location-ids': location['id']})
        self.assertEqual(1, len(comp_resource['locations']))
        self.assertEqual(comp_resource['locations'][0], location['name'])
示例#55
0
    def test_positive_create_with_loc(self):
        """Create Compute Resource with location

        @Feature: Compute Resource - Location Create

        @Assert: Compute resource is created and has location assigned

        """
        location = make_location()
        comp_resource = make_compute_resource({'location-ids': location['id']})
        self.assertEqual(1, len(comp_resource['locations']))
        self.assertEqual(comp_resource['locations'][0], location['name'])
示例#56
0
    def test_positive_create_with_compresource_by_name(self):
        """Create new location with compute resource assigned to it. Use
        compute resource name as a parameter

        @id: a849c847-bc18-4d87-a47b-43975090f509

        @Assert: Location created successfully and has correct compute resource
        assigned to it

        """
        comp_resource = make_compute_resource()
        loc = make_location({'compute-resources': comp_resource['name']})
        self.assertEqual(loc['compute-resources'][0], comp_resource['name'])
示例#57
0
    def test_positive_create_with_compresource_by_id(self):
        """Create new location with compute resource assigned to it. Use
        compute resource id as a parameter

        @id: 49c72f7d-08b7-4dd3-af7f-5b97889a4583

        @Assert: Location created successfully and has correct compute resource
        assigned to it

        """
        comp_resource = make_compute_resource()
        loc = make_location({'compute-resource-ids': comp_resource['id']})
        self.assertEqual(loc['compute-resources'][0], comp_resource['name'])
示例#58
0
    def test_positive_add_compresource_by_id(self):
        """Add a compute resource to organization by its ID

        @id: 355e20c5-ec04-49f7-a0ae-0864a3fe0f3f

        @Assert: Compute Resource is added to the org

        @CaseLevel: Integration
        """
        compute_res = make_compute_resource()
        org = make_org({'compute-resource-ids': compute_res['id']})
        self.assertEqual(len(org['compute-resources']), 1)
        self.assertEqual(org['compute-resources'][0], compute_res['name'])
 def test_list(self):
     """ `compute_resource list` basic test """
     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_list = ComputeResource().list()
     self.assertEquals(result_list.return_code, 0, "ComputeResource list - exit code")
     self.assertTrue(len(result_list.stdout) > 0, "ComputeResource list - stdout has results")
     self.assertTrue(ComputeResource().exists(("name", result_create["name"])), "ComputeResource list - exists name")