def test_negative_create_osp_with_url(self): """Attempt to create Openstack compute resource with invalid URL :id: a6be8233-2641-4c87-8563-f48d6efbb6ac :expectedresults: Compute resource is not created :CaseImportance: Critical :BZ: 1579714 """ name = gen_string('alpha') with pytest.raises(CLIReturnCodeError): ComputeResource.create({ 'name': name, 'provider': 'Openstack', 'user': OSP_SETTINGS['username'], 'password': OSP_SETTINGS['password'], 'tenant': OSP_SETTINGS['tenant'], 'url': 'invalid url', 'project-domain-id': OSP_SETTINGS['project_domain_id'], })
def test_positive_update_console_password(libvirt_url, set_console_password): """Update a compute resource with ``--set-console-password``. :id: ef09351e-dcd3-4b4f-8d3b-995e9e5873b3 :expectedresults: No error is returned. :BZ: 1100344 :CaseImportance: High :CaseLevel: Component :parametrized: yes """ cr_name = gen_string('utf8') ComputeResource.create({ 'name': cr_name, 'provider': 'Libvirt', 'url': gen_url() }) ComputeResource.update({ 'name': cr_name, 'set-console-password': set_console_password })
def test_positive_create_rhev_with_valid_name(self): """Create Compute Resource of type Rhev with valid name :id: 92a577db-144e-4761-a52e-e83887464986 :expectedresults: Compute resource is created :CaseImportance: Critical :BZ: 1602835 """ ComputeResource.create({ 'name': 'cr {}'.format(gen_string(str_type='alpha')), 'provider': 'Ovirt', 'user': self.username, 'password': self.password, 'datacenter': self.datacenter, 'url': self.current_rhev_url, })
def test_positive_update_console_password(self): """Update a compute resource with ``--set-console-password``. :id: ef09351e-dcd3-4b4f-8d3b-995e9e5873b3 :expectedresults: No error is returned. Targets BZ 1100344. :CaseImportance: Critical """ cr_name = gen_string('utf8') ComputeResource.create({ 'name': cr_name, 'provider': 'Libvirt', 'url': gen_url(), }) for set_console_password in ('true', 'false'): with self.subTest(set_console_password): ComputeResource.update({ 'name': cr_name, 'set-console-password': set_console_password, })
def test_positive_create_with_name(self): """Create Compute Resource @id: 6460bcc7-d7f7-406a-aecb-b3d54d51e697 @Assert: Compute resource is created """ ComputeResource.create({ 'name': 'cr {0}'.format(gen_string(str_type='alpha')), 'provider': 'Libvirt', 'url': self.current_libvirt_url, })
def test_positive_create_with_name(self): """Create Compute Resource @Feature: Compute Resource - Positive Create @Assert: Compute resource is created """ ComputeResource.create({ 'name': gen_string(str_type='alpha'), 'provider': 'Libvirt', 'url': self.current_libvirt_url, })
def test_create(self): """@Test: Create Compute Resource @Feature: Compute Resource - Positive Create @Assert: Compute resource is created """ ComputeResource.create({ 'name': gen_string(str_type='alpha'), 'provider': 'Libvirt', 'url': LIBVIRT_URL, })
def test_positive_create_with_name(self): """Create Compute Resource :id: 6460bcc7-d7f7-406a-aecb-b3d54d51e697 :expectedresults: Compute resource is created :CaseImportance: Critical """ ComputeResource.create({ 'name': 'cr {0}'.format(gen_string(str_type='alpha')), 'provider': 'Libvirt', 'url': self.current_libvirt_url, })
def test_negative_create_with_same_name(self): """Compute Resource negative create with the same name @Feature: Compute Resource create @Assert: Compute resource not created """ comp_res = make_compute_resource() with self.assertRaises(CLIReturnCodeError): ComputeResource.create({ u'name': comp_res['name'], u'provider': FOREMAN_PROVIDERS['libvirt'], u'url': gen_url(), })
def test_positive_create_osp_with_valid_name(self): """Create Compute Resource of type Openstack with valid name :id: 064c939f-b2da-4b49-b784-24559f296cd9 :expectedresults: Compute resource is created :CaseImportance: Critical """ name = gen_string('alpha') with self.assertNotRaises(CLIReturnCodeError): compute_resource = ComputeResource.create({ 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)
def test_negative_create_with_name_url(self): """Compute Resource negative create with invalid values @id: cd432ff3-b3b9-49cd-9a16-ed00d81679dd @Assert: Compute resource not created """ for options in invalid_create_data(): with self.subTest(options): with self.assertRaises(CLIReturnCodeError): ComputeResource.create({ u'name': options.get( 'name', gen_string(str_type='alphanumeric')), u'provider': FOREMAN_PROVIDERS['libvirt'], u'url': options.get('url', gen_url()), })
def test_set_console_password_v2(self, set_console_password): """@Test: Update a compute resource with ``--set-console-password``. @Feature: Compute Resource @Assert: No error is returned. Targets BZ 1100344. """ name = gen_string('utf8') result = ComputeResource.create({ 'name': name, 'provider': 'Libvirt', 'url': gen_url(), }) self.assertEqual(result.return_code, 0) self.assertEqual(len(result.stderr), 0) result = ComputeResource.update({ 'name': name, 'set-console-password': set_console_password, }) self.assertEqual(result.return_code, 0) self.assertEqual(len(result.stderr), 0)
def test_positive_create_with_libvirt(self): """Test Compute Resource create @Feature: Compute Resource positive create @Assert: Compute Resource created """ for options in valid_name_desc_data(): with self.subTest(options): ComputeResource.create({ u'description': options['description'], u'name': options['name'], u'provider': FOREMAN_PROVIDERS['libvirt'], u'url': gen_url(), })
def test_positive_create_with_name(libvirt_url): """Create Compute Resource :id: 6460bcc7-d7f7-406a-aecb-b3d54d51e697 :expectedresults: Compute resource is created :CaseImportance: Critical :CaseLevel: Component """ ComputeResource.create({ 'name': f'cr {gen_string("alpha")}', 'provider': 'Libvirt', 'url': libvirt_url, })
def test_positive_create_osp_with_valid_name(self): """Create Compute Resource of type Openstack with valid name :id: 064c939f-b2da-4b49-b784-24559f296cd9 :expectedresults: Compute resource is created :CaseImportance: Critical :BZ: 1579714 """ name = gen_string('alpha') compute_resource = ComputeResource.create( { '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 compute_resource['provider'] == 'RHEL OpenStack Platform' assert compute_resource['tenant'] == OSP_SETTINGS['tenant'] # List CR list_cr = ComputeResource.list() assert len([cr for cr in list_cr if cr['name'] == name]) == 1
def test_positive_create_with_libvirt(self): """Test Compute Resource create @id: adc6f4f8-6420-4044-89d1-c69e0bfeeab9 @Assert: Compute Resource created """ for options in valid_name_desc_data(): with self.subTest(options): ComputeResource.create({ u'description': options['description'], u'name': options['name'], u'provider': FOREMAN_PROVIDERS['libvirt'], u'url': gen_url(), })
def test_positive_create_with_name(self): """Create Compute Resource :id: 6460bcc7-d7f7-406a-aecb-b3d54d51e697 :expectedresults: Compute resource is created :CaseImportance: Critical :CaseLevel: Component """ ComputeResource.create({ 'name': 'cr {0}'.format(gen_string(str_type='alpha')), 'provider': 'Libvirt', 'url': self.current_libvirt_url, })
def test_negative_create_with_same_name(self): """Compute Resource negative create with the same name :id: ddb5c45b-1ea3-46d0-b248-56c0388d2e4b :expectedresults: Compute resource not created :CaseImportance: Critical """ comp_res = make_compute_resource() with self.assertRaises(CLIReturnCodeError): ComputeResource.create({ u'name': comp_res['name'], u'provider': FOREMAN_PROVIDERS['libvirt'], u'url': gen_url(), })
def test_negative_create_rhev_with_url(self): """RHEV compute resource negative create with invalid values :id: 1f318a4b-8dca-491b-b56d-cff773ed624e :expectedresults: Compute resource is not created :CaseImportance: High """ with self.assertRaises(CLIReturnCodeError): ComputeResource.create({ 'provider': 'Ovirt', 'user': self.username, 'password': self.password, 'datacenter': self.datacenter, 'url': 'invalid url', })
def test_positive_create_rhev_with_valid_name(self): """Create Compute Resource of type Rhev with valid name :id: 92a577db-144e-4761-a52e-e83887464986 :expectedresults: Compute resource is created :CaseImportance: Critical """ ComputeResource.create({ u'name': 'cr {0}'.format(gen_string(str_type='alpha')), 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_osp_with_url(self): """Attempt to create Openstack compute resource with invalid URL :id: a6be8233-2641-4c87-8563-f48d6efbb6ac :expectedresults: Compute resource is not created :CaseImportance: Critical """ with self.assertRaises(CLIReturnCodeError): ComputeResource.create({ u'provider': 'Openstack', u'user': self.username, u'password': self.password, u'tenant': self.tenant, u'url': 'invalid url' })
def test_negative_create_rhev_with_url(self): """RHEV compute resource negative create with invalid values :id: 1f318a4b-8dca-491b-b56d-cff773ed624e :expectedresults: Compute resource is not created :CaseImportance: Critical """ with self.assertRaises(CLIReturnCodeError): ComputeResource.create({ u'provider': 'Ovirt', u'user': self.username, u'password': self.passord, u'datacenter': self.datacenter, u'url': 'invalid url' })
def test_positive_create_with_libvirt(self): """Test Compute Resource create :id: adc6f4f8-6420-4044-89d1-c69e0bfeeab9 :expectedresults: Compute Resource created :CaseImportance: Critical """ for options in valid_name_desc_data(): with self.subTest(options): ComputeResource.create({ u'description': options['description'], u'name': options['name'], u'provider': FOREMAN_PROVIDERS['libvirt'], u'url': gen_url(), })
def test_positive_create_with_console_password_and_name(self): """Create a compute resource with ``--set-console-password``. @Feature: Compute Resource @Assert: No error is returned. Targets BZ 1100344. """ for set_console_password in ('true', 'false'): with self.subTest(set_console_password): ComputeResource.create({ 'name': gen_string('utf8'), 'provider': 'Libvirt', 'set-console-password': set_console_password, 'url': gen_url(), })
def test_negative_create_with_name_description_url(self): """Compute Resource negative create with invalid values @Feature: Compute Resource create @Assert: Compute resource not created """ for options in invalid_create_data(): with self.subTest(options): with self.assertRaises(CLIReturnCodeError): ComputeResource.create({ u'description': options.get('description', ''), u'name': options.get( 'name', gen_string(str_type='alphanumeric')), u'provider': FOREMAN_PROVIDERS['libvirt'], u'url': options.get('url', gen_url()), })
def test_negative_create_with_same_name(libvirt_url): """Compute Resource negative create with the same name :id: ddb5c45b-1ea3-46d0-b248-56c0388d2e4b :expectedresults: Compute resource not created :CaseImportance: High :CaseLevel: Component """ comp_res = make_compute_resource() with pytest.raises(CLIReturnCodeError): ComputeResource.create({ 'name': comp_res['name'], 'provider': FOREMAN_PROVIDERS['libvirt'], 'url': gen_url(), })
def test_positive_create_rhev_with_valid_name(rhev): """Create Compute Resource of type Rhev with valid name :id: 92a577db-144e-4761-a52e-e83887464986 :expectedresults: Compute resource is created :CaseImportance: Critical :BZ: 1602835 """ ComputeResource.create({ 'name': f'cr {gen_string(str_type="alpha")}', 'provider': 'Ovirt', 'user': rhev.username, 'password': rhev.password, 'datacenter': rhev.datacenter, 'url': rhev.hostname, })
def test_positive_create_with_libvirt(self): """Test Compute Resource create :id: adc6f4f8-6420-4044-89d1-c69e0bfeeab9 :expectedresults: Compute Resource created :CaseImportance: Critical :CaseLevel: Component """ for options in valid_name_desc_data(): with self.subTest(options): ComputeResource.create({ 'description': options['description'], 'name': options['name'], 'provider': FOREMAN_PROVIDERS['libvirt'], 'url': gen_url(), })
def test_positive_create_with_libvirt(libvirt_url, options): """Test Compute Resource create :id: adc6f4f8-6420-4044-89d1-c69e0bfeeab9 :expectedresults: Compute Resource created :CaseImportance: Critical :CaseLevel: Component :parametrized: yes """ ComputeResource.create({ 'description': options['description'], 'name': options['name'], 'provider': FOREMAN_PROVIDERS['libvirt'], 'url': gen_url(), })
def test_positive_create_with_console_password_and_name(self): """Create a compute resource with ``--set-console-password``. :id: 5b4c838a-0265-4c71-a73d-305fecbe508a :expectedresults: No error is returned. Targets BZ 1100344. :CaseImportance: Critical """ for set_console_password in ('true', 'false'): with self.subTest(set_console_password): ComputeResource.create({ 'name': gen_string('utf8'), 'provider': 'Libvirt', 'set-console-password': set_console_password, 'url': gen_url(), })
def test_negative_create_with_name_url(self): """Compute Resource negative create with invalid values :id: cd432ff3-b3b9-49cd-9a16-ed00d81679dd :expectedresults: Compute resource not created :CaseImportance: High :CaseLevel: Component """ for options in invalid_create_data(): with self.subTest(options): with self.assertRaises(CLIReturnCodeError): ComputeResource.create( { 'name': options.get('name', gen_string(str_type='alphanumeric')), 'provider': FOREMAN_PROVIDERS['libvirt'], 'url': options.get('url', gen_url()), } )
def test_negative_create_with_name_url(libvirt_url, options): """Compute Resource negative create with invalid values :id: cd432ff3-b3b9-49cd-9a16-ed00d81679dd :expectedresults: Compute resource not created :CaseImportance: High :CaseLevel: Component :parametrized: yes """ with pytest.raises(CLIReturnCodeError): ComputeResource.create( { 'name': options.get('name', gen_string(str_type='alphanumeric')), 'provider': FOREMAN_PROVIDERS['libvirt'], 'url': options.get('url', gen_url()), } )
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']))
def test_positive_update_console_password(self): """Update a compute resource with ``--set-console-password``. @id: ef09351e-dcd3-4b4f-8d3b-995e9e5873b3 @Assert: No error is returned. Targets BZ 1100344. """ cr_name = gen_string('utf8') ComputeResource.create({ 'name': cr_name, 'provider': 'Libvirt', 'url': gen_url(), }) for set_console_password in ('true', 'false'): with self.subTest(set_console_password): ComputeResource.update({ 'name': cr_name, 'set-console-password': set_console_password, })
def test_set_console_password_v2(self): """@Test: Update a compute resource with ``--set-console-password``. @Feature: Compute Resource @Assert: No error is returned. Targets BZ 1100344. """ cr_name = gen_string('utf8') ComputeResource.create({ 'name': cr_name, 'provider': 'Libvirt', 'url': gen_url(), }) for set_console_password in ('true', 'false'): with self.subTest(set_console_password): ComputeResource.update({ 'name': cr_name, 'set-console-password': set_console_password, })
def test_positive_create_with_console_password_and_name( libvirt_url, set_console_password): """Create a compute resource with ``--set-console-password``. :id: 5b4c838a-0265-4c71-a73d-305fecbe508a :expectedresults: No error is returned. :BZ: 1100344 :CaseImportance: High :CaseLevel: Component :parametrized: yes """ ComputeResource.create({ 'name': gen_string('utf8'), 'provider': 'Libvirt', 'set-console-password': set_console_password, 'url': gen_url(), })
def test_negative_create_with_name_description_url(self): """Compute Resource negative create with invalid values @Feature: Compute Resource create @Assert: Compute resource not created """ for options in invalid_create_data(): with self.subTest(options): with self.assertRaises(CLIReturnCodeError): ComputeResource.create({ u'description': options.get('description', ''), u'name': options.get('name', gen_string(str_type='alphanumeric')), u'provider': FOREMAN_PROVIDERS['libvirt'], u'url': options.get('url', gen_url()), })
def test_create_negative_2(self): """ @Test: Compute Resource negative create with the same name @Feature: Compute Resource create @Assert: Compute resource not created """ comp_res = make_compute_resource() result = ComputeResource.create({ u'name': comp_res['name'], u'provider': FOREMAN_PROVIDERS['libvirt'], u'url': orm.URLField().get_value() }) self.assertNotEquals(result.return_code, 0) self.assertNotEqual(len(result.stderr), 0)
def test_create(self): """ @Feature: Compute Resource - Positive Create @Test: Create Compute Resource @Assert: Compute reource is created """ name = generate_string("alpha", 10) result = ComputeResource.create({ 'name': name, 'provider': 'Libvirt', 'url': "qemu+tcp://%s:16509/system" % conf.properties['main.server.hostname'] }) self.assertEquals(result.return_code, 0, "ComputeResource create - exit code")
def test_create_positive_libvirt(self, options): """ @Feature: Compute Resource positive create @Test: Test Compute Resource create @Assert: Compute Resource created """ result = ComputeResource.create({ u'name': options['name'], u'url': orm.URLField().get_value(), u'provider': FOREMAN_PROVIDERS['libvirt'], u'description': options['description'] }) self.assertEqual(result.return_code, 0) self.assertEqual(len(result.stderr), 0)
def test_create(self): """@Test: Create Compute Resource @Feature: Compute Resource - Positive Create @Assert: Compute reource is created """ name = orm.StringField(str_type=('alpha',)).get_value() result = ComputeResource.create({ 'name': name, 'provider': 'Libvirt', 'url': "qemu+tcp://%s:16509/system" % conf.properties['main.server.hostname'] }) self.assertEquals(result.return_code, 0, "ComputeResource create - exit code")
def test_create_negative_1(self, options): """ @Test: Compute Resource negative create with invalid values @Feature: Compute Resource create @Assert: Compute resource not created """ result = ComputeResource.create({ u'name': options.get( 'name', orm.StringField(str_type=('alphanumeric',)).get_value() ), u'url': options.get('url', orm.URLField().get_value()), u'provider': FOREMAN_PROVIDERS['libvirt'], u'description': options.get('description', '') }) self.assertNotEqual(result.return_code, 0) self.assertNotEqual(len(result.stderr), 0)
def test_create_negative_2(self): """@Test: Compute Resource negative create with the same name @Feature: Compute Resource create @Assert: Compute resource not created """ comp_res = make_compute_resource() result = ComputeResource.create({ u'name': comp_res['name'], u'provider': FOREMAN_PROVIDERS['libvirt'], u'url': gen_url() }) self.assertNotEquals(result.return_code, 0) self.assertNotEqual(len(result.stderr), 0)
def test_positive_provision_rhev_with_host_group(self): """Provision a host on RHEV compute resource with the help of hostgroup. :Requirement: Computeresource RHV :id: ba78868f-5cff-462f-a55d-f6aa4d11db52 :setup: Hostgroup and provisioning setup like domain, subnet etc. :steps: 1. Create a RHEV compute resource. 2. Create a host on RHEV compute resource using the Hostgroup 3. Use compute-attributes parameter to specify key-value parameters regarding the virtual machine. 4. Provision the host. :expectedresults: The host should be provisioned with host group :CaseAutomation: automated """ name = gen_string('alpha') rhv_cr = ComputeResource.create({ u'name': name, u'provider': 'Ovirt', u'user': self.rhev_username, u'password': self.rhev_password, u'datacenter': self.rhev_datacenter, u'url': self.rhev_url, u'ovirt-quota': self.quota, u'organizations': self.org_name, u'locations': self.loc_name }) self.assertEquals(rhv_cr['name'], name) host_name = gen_string('alpha').lower() host = make_host({ 'name': '{0}'.format(host_name), 'root-password': gen_string('alpha'), 'organization': self.org_name, 'location': self.loc_name, 'pxe-loader': 'PXELinux BIOS', 'hostgroup': self.config_env['host_group'], 'compute-resource-id': rhv_cr.get('id'), 'compute-attributes': "cluster={0}," "cores=1," "memory=1073741824," "start=1".format(self.cluster_id), 'ip': None, 'mac': None, 'interface': "compute_name=nic1, " "compute_network={0}".format(self.network_id), 'volume': "size_gb=10," "storage_domain={0}," "bootable=True".format(self.storage_id), 'provision-method': 'build' }) hostname = '{0}.{1}'.format( host_name, self.config_env['domain']) self.assertEquals(hostname, host['name']) host_info = Host.info({'name': hostname}) host_ip = host_info.get('network').get('ipv4-address') # Check on RHV, if VM exists self.assertTrue(self.rhv_api.does_vm_exist(hostname)) # Get the information of created VM rhv_vm = self.rhv_api.get_vm(hostname) # Assert of Satellite mac address for VM and Mac of VM created is same self.assertEqual(host_info.get('network').get('mac'), rhv_vm.get_nics()[0].mac.address ) # Start to run a ping check if network was established on VM with self.assertNotRaises(ProvisioningCheckError): host_provisioning_check(ip_addr=host_ip)