def test_positive_create_1(self): """@test: A host can be created with a random name @feature: Hosts @assert: A host is created and the name matches """ # Use the default installation smart proxy result = Proxy.list() self.assertEqual(result.return_code, 0) self.assertEqual(len(result.stderr), 0) self.assertGreater(len(result.stdout), 0) puppet_proxy = result.stdout[0] host_name = gen_string(str_type='alpha', length=gen_integer(1, 10)) try: # Creating dependent objects architecture = make_architecture() domain = make_domain() environment = make_environment() location = make_location() medium = make_medium() ptable = make_partition_table() organization = make_org(cached=True) os = make_os({ u'architecture-ids': architecture['id'], u'medium-ids': medium['id'], u'ptable-ids': ptable['id'], }) host = make_host({ u'architecture-id': architecture['id'], u'domain-id': domain['id'], u'environment-id': environment['id'], u'location-id': location['id'], u'medium-id': medium['id'], u'name': host_name, u'operatingsystem-id': os['id'], u'organization-id': organization['id'], u'partition-table-id': ptable['id'], u'puppet-proxy-id': puppet_proxy['id'], }) except CLIFactoryError as err: self.fail(err) name = '{0}.{1}'.format(host_name, domain['name']).lower() self.assertEqual(host['name'], name)
def test_positive_create_1(self): """@test: A host can be created with a random name @feature: Hosts @assert: A host is created and the name matches """ # Use the default installation smart proxy result = Proxy.list() self.assertEqual(result.return_code, 0) self.assertEqual(len(result.stderr), 0) self.assertGreater(len(result.stdout), 0) puppet_proxy = result.stdout[0] host_name = gen_string(str_type='alpha', length=gen_integer(1, 10)) try: # Creating dependent objects architecture = make_architecture() domain = make_domain() environment = make_environment() location = make_location() medium = make_medium() ptable = make_partition_table() organization = make_org(cached=True) os = make_os({ u'architecture-ids': architecture['id'], u'medium-ids': medium['id'], u'partition-table-ids': ptable['id'], }) host = make_host({ u'architecture-id': architecture['id'], u'domain-id': domain['id'], u'environment-id': environment['id'], u'location-id': location['id'], u'medium-id': medium['id'], u'name': host_name, u'operatingsystem-id': os['id'], u'organization-id': organization['id'], u'partition-table-id': ptable['id'], u'puppet-proxy-id': puppet_proxy['id'], }) except CLIFactoryError as err: self.fail(err) name = '{0}.{1}'.format(host_name, domain['name']).lower() self.assertEqual(host['name'], name)
def test_positive_validate_inherited_cv_lce(session, module_host_template): """Create a host with hostgroup specified via CLI. Make sure host inherited hostgroup's lifecycle environment, content view and both fields are properly reflected via WebUI. :id: c83f6819-2649-4a8b-bb1d-ce93b2243765 :expectedresults: Host's lifecycle environment and content view match the ones specified in hostgroup. :CaseLevel: Integration :BZ: 1391656 """ lce = make_lifecycle_environment({'organization-id': module_host_template.organization.id}) content_view = make_content_view({'organization-id': module_host_template.organization.id}) ContentView.publish({'id': content_view['id']}) version_id = ContentView.version_list({'content-view-id': content_view['id']})[0]['id'] ContentView.version_promote({ 'id': version_id, 'to-lifecycle-environment-id': lce['id'], 'organization-id': module_host_template.organization.id, }) hostgroup = make_hostgroup({ 'content-view-id': content_view['id'], 'lifecycle-environment-id': lce['id'], 'organization-ids': module_host_template.organization.id, }) puppet_proxy = Proxy.list({'search': 'name = {0}'.format(settings.server.hostname)})[0] host = make_host({ 'architecture-id': module_host_template.architecture.id, 'domain-id': module_host_template.domain.id, 'environment-id': module_host_template.environment.id, 'hostgroup-id': hostgroup['id'], 'location-id': module_host_template.location.id, 'medium-id': module_host_template.medium.id, 'operatingsystem-id': module_host_template.operatingsystem.id, 'organization-id': module_host_template.organization.id, 'partition-table-id': module_host_template.ptable.id, 'puppet-proxy-id': puppet_proxy['id'], }) with session: values = session.host.read(host['name'], ['host.lce', 'host.content_view']) assert values['host']['lce'] == lce['name'] assert values['host']['content_view'] == content_view['name']
def test_positive_provision_vmware_with_host_group(self, vmware, provisioning): """Provision a host on vmware compute resource with the help of hostgroup. :Requirement: Computeresource Vmware :CaseComponent: ComputeResources-VMWare :id: ae4d5949-f0e6-44ca-93b6-c5241a02b64b :setup: 1. Vaild vmware hostname ,credentials. 2. Configure provisioning setup. 3. Configure host group setup. :steps: 1. Go to "Hosts --> New host". 2. Assign the host group to the host. 3. Select the Deploy on as vmware Compute Resource. 4. Provision the host. :expectedresults: The host should be provisioned with host group :CaseAutomation: Automated :CaseLevel: System """ cr_name = gen_string('alpha') vmware_cr = make_compute_resource( { 'name': cr_name, 'organizations': provisioning['org_name'], 'locations': provisioning['loc_name'], 'provider': FOREMAN_PROVIDERS['vmware'], 'server': vmware['vmware_server'], 'user': vmware['vmware_username'], 'password': vmware['vmware_password'], 'datacenter': vmware['vmware_datacenter'], } ) assert vmware_cr['name'] == cr_name host_name = gen_string('alpha').lower() host = make_host( { 'name': f'{host_name}', 'root-password': gen_string('alpha'), 'organization': provisioning['org_name'], 'location': provisioning['loc_name'], 'hostgroup': provisioning['config_env']['host_group'], 'pxe-loader': 'PXELinux BIOS', 'compute-resource-id': vmware_cr.get('id'), 'compute-attributes': "cpus=2," "corespersocket=2," "memory_mb=4028," "cluster={}," "path=/Datacenters/{}/vm/QE," "guest_id=rhel7_64Guest," "scsi_controller_type=VirtualLsiLogicController," "hardware_version=Default," "start=1".format(VMWARE_CONSTANTS['cluster'], vmware['vmware_datacenter']), 'ip': None, 'mac': None, 'interface': "compute_network={}," "compute_type=VirtualVmxnet3".format(vmware['vmware_net_id']), 'volume': "name=Hard disk," "size_gb=10," "thin=true," "eager_zero=false," "datastore={}".format(VMWARE_CONSTANTS['datastore'].split()[0]), 'provision-method': 'build', } ) hostname = '{}.{}'.format(host_name, provisioning['config_env']['domain']) assert hostname == host['name'] # Check on Vmware, if VM exists assert vmware['vmware_api'].does_vm_exist(hostname) host_info = Host.info({'name': hostname}) host_ip = host_info.get('network').get('ipv4-address') # Start to run a ping check if network was established on VM host_provisioning_check(ip_addr=host_ip)
def test_positive_provision_rhev_with_host_group(self, rhev, provisioning): """Provision a host on RHEV compute resource with the help of hostgroup. :Requirement: Computeresource RHV :CaseComponent: ComputeResources-RHEV :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( { 'name': name, 'provider': 'Ovirt', 'user': rhev['rhev_username'], 'password': rhev['rhev_password'], 'datacenter': rhev['rhev_datacenter'], 'url': rhev['rhev_url'], 'ovirt-quota': rhev['quota'], 'organizations': provisioning['org_name'], 'locations': provisioning['loc_name'], } ) assert rhv_cr['name'] == name host_name = gen_string('alpha').lower() host = make_host( { 'name': f'{host_name}', 'root-password': gen_string('alpha'), 'organization': provisioning['org_name'], 'location': provisioning['loc_name'], 'pxe-loader': 'PXELinux BIOS', 'hostgroup': provisioning['config_env']['host_group'], 'compute-resource-id': rhv_cr.get('id'), 'compute-attributes': "cluster={}," "cores=1," "memory=1073741824," "start=1".format(rhev['cluster_id']), 'ip': None, 'mac': None, 'interface': f"compute_name=nic1, compute_network={rhev['network_id']}", 'volume': "size_gb=10," "storage_domain={}," "bootable=True".format(rhev['storage_id']), 'provision-method': 'build', } ) hostname = '{}.{}'.format(host_name, provisioning['config_env']['domain']) assert hostname == host['name'] host_info = Host.info({'name': hostname}) host_ip = host_info.get('network').get('ipv4-address') # Check on RHV, if VM exists assert rhev['rhv_api'].does_vm_exist(hostname) # Get the information of created VM rhv_vm = rhev['rhv_api'].get_vm(hostname) # Assert of Satellite mac address for VM and Mac of VM created is same assert 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 host_provisioning_check(ip_addr=host_ip)
def test_positive_validate_inherited_cv_lce(self): """Create a host with hostgroup specified via CLI. Make sure host inherited hostgroup's lifecycle environment, content view and both fields are properly reflected via WebUI :id: c83f6819-2649-4a8b-bb1d-ce93b2243765 :expectedresults: Host's lifecycle environment and content view match the ones specified in hostgroup :CaseLevel: Integration :BZ: 1391656 """ host = entities.Host() host.create_missing() new_lce = cli_factory.make_lifecycle_environment( {'organization-id': host.organization.id}) new_cv = cli_factory.make_content_view( {'organization-id': host.organization.id}) cli_ContentView.publish({'id': new_cv['id']}) version_id = cli_ContentView.version_list({ 'content-view-id': new_cv['id'], })[0]['id'] cli_ContentView.version_promote({ 'id': version_id, 'to-lifecycle-environment-id': new_lce['id'], 'organization-id': host.organization.id, }) hostgroup = cli_factory.make_hostgroup({ 'content-view-id': new_cv['id'], 'lifecycle-environment-id': new_lce['id'], 'organization-ids': host.organization.id, }) puppet_proxy = cli_Proxy.list({ 'search': 'url = https://{0}:9090'.format(settings.server.hostname) })[0] cli_factory.make_host({ 'architecture-id': host.architecture.id, 'domain-id': host.domain.id, 'environment-id': host.environment.id, 'hostgroup-id': hostgroup['id'], 'location-id': host.location.id, 'medium-id': host.medium.id, 'name': host.name, 'operatingsystem-id': host.operatingsystem.id, 'organization-id': host.organization.id, 'partition-table-id': host.ptable.id, 'puppet-proxy-id': puppet_proxy['id'], }) with Session(self.browser) as session: set_context(session, host.organization.name, host.location.name) result = self.hosts.fetch_host_parameters( host.name, host.domain.name, [['Host', 'Lifecycle Environment'], ['Host', 'Content View']], ) self.assertEqual(result['Lifecycle Environment'], new_lce['name']) self.assertEqual(result['Content View'], new_cv['name'])
def test_positive_validate_inherited_cv_lce(self): """Create a host with hostgroup specified via CLI. Make sure host inherited hostgroup's lifecycle environment, content view and both fields are properly reflected via WebUI @id: c83f6819-2649-4a8b-bb1d-ce93b2243765 @Assert: Host's lifecycle environment and content view match the ones specified in hostgroup @CaseLevel: Integration @BZ: 1391656 """ host = entities.Host() host.create_missing() new_lce = cli_factory.make_lifecycle_environment({ 'organization-id': host.organization.id}) new_cv = cli_factory.make_content_view({ 'organization-id': host.organization.id}) cli_ContentView.publish({'id': new_cv['id']}) version_id = cli_ContentView.version_list({ 'content-view-id': new_cv['id'], })[0]['id'] cli_ContentView.version_promote({ 'id': version_id, 'to-lifecycle-environment-id': new_lce['id'], 'organization-id': host.organization.id, }) hostgroup = cli_factory.make_hostgroup({ 'content-view-id': new_cv['id'], 'lifecycle-environment-id': new_lce['id'], 'organization-ids': host.organization.id, }) puppet_proxy = cli_Proxy.list({ 'search': 'url = https://{0}:9090'.format(settings.server.hostname) })[0] cli_factory.make_host({ 'architecture-id': host.architecture.id, 'domain-id': host.domain.id, 'environment-id': host.environment.id, 'hostgroup-id': hostgroup['id'], 'location-id': host.location.id, 'medium-id': host.medium.id, 'name': host.name, 'operatingsystem-id': host.operatingsystem.id, 'organization-id': host.organization.id, 'partition-table-id': host.ptable.id, 'puppet-proxy-id': puppet_proxy['id'], }) with Session(self.browser) as session: set_context(session, host.organization.name, host.location.name) result = self.hosts.fetch_host_parameters( host.name, host.domain.name, [['Host', 'Lifecycle Environment'], ['Host', 'Content View']], ) self.assertEqual(result['Lifecycle Environment'], new_lce['name']) self.assertEqual(result['Content View'], new_cv['name'])
def test_positive_provision_vmware_with_host_group_bootdisk( vmware, provisioning, tear_down, vmware_cr): """Provision a bootdisk based host on VMWare compute resource. :Requirement: Computeresource Vmware :CaseComponent: ComputeResources-VMWare :id: bc5f457d-c29a-4c62-bbdc-af8f4f813519 :bz: 1679225 :setup: 1. Vaild VMWare hostname, credentials. 2. Configure provisioning setup. 3. Configure host group setup. :steps: Using Hammer CLI, Provision a VM on VMWare with hostgroup and provisioning method as `bootdisk`. :expectedresults: The host should be provisioned with provisioning type bootdisk :CaseAutomation: Automated :CaseLevel: System """ host_name = gen_string('alpha').lower() host = make_host({ 'name': f'{host_name}', 'root-password': gen_string('alpha'), 'organization': provisioning.org_name, 'location': provisioning.loc_name, 'hostgroup': provisioning.config_env['host_group'], 'pxe-loader': 'PXELinux BIOS', 'compute-resource-id': vmware_cr.get('id'), 'content-source-id': '1', 'compute-attributes': "cpus=2," "corespersocket=2," "memory_mb=4028," "cluster={}," "path=/Datacenters/{}/vm/QE," "guest_id=rhel7_64Guest," "scsi_controllers=`type=VirtualLsiLogicController,key=1000'," "hardware_version=Default," "start=1".format(VMWARE_CONSTANTS['cluster'], vmware.vmware_datacenter), "ip": None, "mac": None, 'interface': "compute_network={}," "compute_type=VirtualVmxnet3".format(vmware.vmware_net_id), 'volume': "name=Hard disk," "size_gb=10," "thin=true," "eager_zero=false," "datastore={}".format(VMWARE_CONSTANTS['datastore'].split()[0]), 'provision-method': 'bootdisk', }) hostname = '{}.{}'.format(host_name, provisioning.config_env['domain']) assert hostname == host['name'] # Check on Vmware, if VM exists assert vmware.vmware_api.does_vm_exist(hostname) host_info = Host.info({'name': hostname}) host_ip = host_info.get('network').get('ipv4-address') # Start to run a ping check if network was established on VM host_provisioning_check(ip_addr=host_ip)
def test_positive_provision_vmware_with_host_group(self): """ Provision a host on vmware compute resource with the help of hostgroup. :Requirement: Computeresource Vmware :id: ae4d5949-f0e6-44ca-93b6-c5241a02b64b :setup: 1. Vaild vmware hostname ,credentials. 2. Configure provisioning setup. 3. Configure host group setup. :steps: 1. Go to "Hosts --> New host". 2. Assign the host group to the host. 3. Select the Deploy on as vmware Compute Resource. 4. Provision the host. :expectedresults: The host should be provisioned with host group :CaseAutomation: Automated :CaseLevel: System """ cr_name = gen_string('alpha') vmware_cr = make_compute_resource({ 'name': cr_name, 'organizations': self.org_name, 'locations': self.loc_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) 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, 'hostgroup': self.config_env['host_group'], 'pxe-loader': 'PXELinux BIOS', 'compute-resource-id': vmware_cr.get('id'), 'compute-attributes': "cpus=2," "corespersocket=2," "memory_mb=4028," "cluster={0}," "path=/Datacenters/{1}/vm/QE," "guest_id=rhel7_64Guest," "scsi_controller_type=VirtualLsiLogic," "hardware_version=Default," "start=1".format(VMWARE_CONSTANTS['cluster'], self.vmware_datacenter ), 'ip': None, 'mac': None, 'interface': "compute_network={0}," "compute_type=VirtualVmxnet3".format( self.vmware_net_id), 'volume': "name=Hard disk," "size_gb=10," "thin=true," "eager_zero=false," "datastore={0}".format( VMWARE_CONSTANTS['datastore'].split()[0] ), 'provision-method': 'build' }) hostname = '{0}.{1}'.format( host_name, self.config_env['domain']) self.assertEquals(hostname, host['name']) # Check on Vmware, if VM exists self.assertTrue(self.vmware_api.does_vm_exist(hostname)) host_info = Host.info({'name': hostname}) host_ip = host_info.get('network').get('ipv4-address') # Start to run a ping check if network was established on VM with self.assertNotRaises(ProvisioningCheckError): host_provisioning_check(ip_addr=host_ip)
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)
def test_positive_provision_rhev_image_based_and_disassociate( provisioning, rhev, tear_down, setting_update): """Provision a host on RHEV compute resource using image-based provisioning :Requirement: Computeresource RHV :CaseComponent: ComputeResources-RHEV :Assignee: lhellebr :id: ba78858f-5cff-462e-a35d-f5aa4d11db52 :parametrized: yes :customerscenario: true :BZ: 1356126 :setup: RHEV with a template on it :steps: 1. Create a RHEV CR 1. Create an image on that CR 2. Create a new host using that CR and image 3. Disassociate the host from the CR :expectedresults: Host should be provisioned with image, associated to CR, then disassociated :CaseAutomation: Automated """ try: name = gen_string('alpha') rhv_cr = ComputeResource.create({ 'name': name, 'provider': 'Ovirt', 'user': rhev.username, 'password': rhev.password, 'datacenter': rhev.datacenter, 'url': rhev.hostname, 'ovirt-quota': rhev.quota, 'organizations': provisioning.org_name, 'locations': provisioning.loc_name, }) assert rhv_cr['name'] == name host_name = gen_string('alpha').lower() # use some RHEL (usually latest) os = (entities.OperatingSystem().search( query={ 'search': f'name="RedHat" AND (major="{RHEL_6_MAJOR_VERSION}" OR ' f'major="{RHEL_7_MAJOR_VERSION}")' })[0].read()) image = ComputeResource.image_create({ 'compute-resource': rhv_cr['name'], 'name': f'img {gen_string(str_type="alpha")}', 'uuid': rhev.image_uuid, 'operatingsystem-id': os.id, 'architecture': rhev.image_arch, 'username': '******', 'password': rhev.image_password, 'user-data': 'yes', # so finish template won't be used }) host = make_host({ 'name': f'{host_name}', 'organization': provisioning.org_name, 'domain': provisioning.config_env['domain'], 'subnet': provisioning.config_env['subnet'], 'location': provisioning.loc_name, 'compute-resource-id': rhv_cr.get('id'), 'compute-attributes': f"cluster={rhev.cluster_id}," "cores=1," "memory=1073741824," "start=0", 'ip': None, 'mac': None, 'interface': f"compute_name=nic1, compute_network={rhev.network_id}", 'provision-method': 'image', 'operatingsystem-id': os.id, 'architecture': rhev.image_arch, 'image-id': f'{image[0]["id"]}', }) hostname = f'{host_name}.{provisioning.config_env["domain"]}' assert hostname == host['name'] host_info = Host.info({'name': hostname}) # Check on RHV, if VM exists assert rhev.rhv_api.does_vm_exist(hostname) # Get the information of created VM rhv_vm = rhev.rhv_api.get_vm(hostname) # Assert of Satellite mac address for VM and Mac of VM created is same assert host_info.get('network').get( 'mac') == rhv_vm.get_nics()[0].mac.address # Check the host is associated to the CR assert 'compute-resource' in host_info assert host_info['compute-resource'] == name # Done. Do not try to SSH, this image-based test should work even without # being in the same network as RHEV. We checked the VM exists and # that's enough. # Disassociate the host from the CR, check it's disassociated Host.disassociate({'name': hostname}) host_info = Host.info({'name': hostname}) assert 'compute-resource' not in host_info finally: # Now, let's just remove the host Host.delete({'id': host['id']}) # Delete the VM since the disassociated VM won't get deleted rhv_vm.delete()
def test_positive_provision_rhev_with_host_group(rhev, provisioning, tear_down): """Provision a host on RHEV compute resource with the help of hostgroup. :Requirement: Computeresource RHV :CaseComponent: ComputeResources-RHEV :Assignee: lhellebr :id: 97908521-3f4d-4207-93a3-23588b5a0a53 :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 :BZ: 1777992 :customerscenario: true :CaseAutomation: Automated """ name = gen_string('alpha') rhv_cr = ComputeResource.create({ 'name': name, 'provider': 'Ovirt', 'user': rhev.username, 'password': rhev.password, 'datacenter': rhev.datacenter, 'url': rhev.hostname, 'ovirt-quota': rhev.quota, 'organizations': provisioning.org_name, 'locations': provisioning.loc_name, }) assert rhv_cr['name'] == name host_name = gen_string('alpha').lower() host = make_host({ 'name': f'{host_name}', 'root-password': gen_string('alpha'), 'organization': provisioning.org_name, 'location': provisioning.loc_name, 'pxe-loader': 'PXELinux BIOS', 'hostgroup': provisioning.config_env['host_group'], 'compute-resource-id': rhv_cr.get('id'), 'compute-attributes': f"cluster={rhev.cluster_id}," "cores=1," "memory=1073741824," "start=1", 'ip': None, 'mac': None, 'interface': f"compute_name=nic1, compute_network={rhev.network_id}", 'volume': f"size_gb=10,storage_domain={rhev.storage_id},bootable=True", 'provision-method': 'build', }) hostname = f'{host_name}.{provisioning.config_env["domain"]}' assert hostname == host['name'] host_info = Host.info({'name': hostname}) host_ip = host_info.get('network', {}).get('ipv4-address') # Check on RHV, if VM exists assert rhev.rhv_api.does_vm_exist(hostname) # Get the information of created VM rhv_vm = rhev.rhv_api.get_vm(hostname) # Assert of Satellite mac address for VM and Mac of VM created is same assert 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 # If this fails, there's probably some issue with PXE booting or network setup in automation host_provisioning_check(ip_addr=host_ip)
def test_positive_validate_inherited_cv_lce(session, module_host_template): """Create a host with hostgroup specified via CLI. Make sure host inherited hostgroup's lifecycle environment, content view and both fields are properly reflected via WebUI. :id: c83f6819-2649-4a8b-bb1d-ce93b2243765 :expectedresults: Host's lifecycle environment and content view match the ones specified in hostgroup. :CaseLevel: Integration :BZ: 1391656 """ lce = make_lifecycle_environment( {'organization-id': module_host_template.organization.id}) content_view = make_content_view( {'organization-id': module_host_template.organization.id}) ContentView.publish({'id': content_view['id']}) version_id = ContentView.version_list( {'content-view-id': content_view['id']})[0]['id'] ContentView.version_promote({ 'id': version_id, 'to-lifecycle-environment-id': lce['id'], 'organization-id': module_host_template.organization.id, }) hostgroup = make_hostgroup({ 'content-view-id': content_view['id'], 'lifecycle-environment-id': lce['id'], 'organization-ids': module_host_template.organization.id, }) puppet_proxy = Proxy.list( {'search': 'name = {0}'.format(settings.server.hostname)})[0] host = make_host({ 'architecture-id': module_host_template.architecture.id, 'domain-id': module_host_template.domain.id, 'environment-id': module_host_template.environment.id, 'hostgroup-id': hostgroup['id'], 'location-id': module_host_template.location.id, 'medium-id': module_host_template.medium.id, 'operatingsystem-id': module_host_template.operatingsystem.id, 'organization-id': module_host_template.organization.id, 'partition-table-id': module_host_template.ptable.id, 'puppet-proxy-id': puppet_proxy['id'], }) with session: values = session.host.read(host['name'], ['host.lce', 'host.content_view']) assert values['host']['lce'] == lce['name'] assert values['host']['content_view'] == content_view['name']