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_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_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_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_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)