def test_positive_create_libvirt(self): """Create a new Host on libvirt compute resource @Feature: Host - Positive create @Assert: Host is created """ resource = u'{0} (Libvirt)'.format(self.computeresource.name) root_pwd = gen_string('alpha', 15) with Session(self.browser) as session: make_host( session, name=self.hostname, org=self.org_name, parameters_list=[ ['Host', 'Organization', self.org_name], ['Host', 'Location', self.loc_name], ['Host', 'Host group', self.host_group.name], ['Host', 'Deploy on', resource], ['Virtual Machine', 'Memory', '1 GB'], ['Operating System', 'Root password', root_pwd], ], interface_parameters=[ ['Network type', 'Physical (Bridge)'], ['Network', settings.vlan_networking.bridge], ], ) self.scroll_page() search = self.hosts.search(u'{0}.{1}'.format( self.hostname, self.domain_name)) self.assertIsNotNone(search)
def test_positive_delete_atomic_host(self): """Delete a provisioned atomic host @id: c0bcf753-8ddf-4e95-b214-42d1e077a6cf @Assert: Atomic host should be deleted successfully and shouldn't be listed under hosts/content-hosts @CaseLevel: System """ resource = u'{0} (Libvirt)'.format(self.computeresource.name) root_pwd = gen_string('alpha', 15) with Session(self.browser) as session: make_host( session, name=self.hostname, org=self.org_name, parameters_list=[ ['Host', 'Organization', self.org_name], ['Host', 'Location', self.loc_name], ['Host', 'Host group', self.host_group.name], ['Host', 'Deploy on', resource], ['Virtual Machine', 'Memory', '1 GB'], ['Operating System', 'Media', self.media.name], ['Operating System', 'Partition table', DEFAULT_PTABLE], ['Operating System', 'Root password', root_pwd], ], interface_parameters=[ ['Network type', 'Physical (Bridge)'], ['Network', settings.vlan_networking.bridge], ], ) # Delete host self.hosts.delete( u'{0}.{1}'.format(self.hostname, self.domain_name))
def test_positive_create_libvirt(self): """Create a new Host on libvirt compute resource @Feature: Host - Positive create @Assert: Host is created """ resource = u'{0} (Libvirt)'.format(self.computeresource.name) root_pwd = gen_string('alpha', 15) with Session(self.browser) as session: make_host( session, name=self.hostname, org=self.org_name, parameters_list=[ ['Host', 'Organization', self.org_name], ['Host', 'Location', self.loc_name], ['Host', 'Host group', self.host_group.name], ['Host', 'Deploy on', resource], ['Virtual Machine', 'Memory', '1 GB'], ['Operating System', 'Root password', root_pwd], ], interface_parameters=[ ['Network type', 'Physical (Bridge)'], ['Network', settings.vlan_networking.bridge], ], ) self.scroll_page() search = self.hosts.search( u'{0}.{1}'.format(self.hostname, self.domain_name) ) self.assertIsNotNone(search)
def test_positive_create_libvirt(self): """Create a new Host on libvirt compute resource @Feature: Host - Positive create @Assert: Host is created """ resource = u'{0} (Libvirt)'.format(self.computeresource.name) root_pwd = gen_string("alpha", 15) with Session(self.browser) as session: make_host( session, org=self.org_name, loc=self.loc_name, name=self.hostname, host_group=self.host_group.name, resource=resource, memory="1 GB", network_type="Physical (Bridge)", network=settings.vlan_networking.bridge, root_pwd=root_pwd, ) self.scroll_page() search = self.hosts.search( u'{0}.{1}'.format(self.hostname, self.domain_name) ) self.assertIsNotNone(search)
def test_positive_delete_atomic_host(self): """Delete a provisioned atomic host :id: c0bcf753-8ddf-4e95-b214-42d1e077a6cf :expectedresults: Atomic host should be deleted successfully and shouldn't be listed under hosts/content-hosts :CaseLevel: System """ resource = u'{0} (Libvirt)'.format(self.computeresource.name) root_pwd = gen_string('alpha', 15) with Session(self.browser) as session: make_host( session, name=self.hostname, org=self.org_name, parameters_list=[ ['Host', 'Organization', self.org_name], ['Host', 'Location', self.loc_name], ['Host', 'Host group', self.host_group.name], ['Host', 'Deploy on', resource], ['Virtual Machine', 'Memory', '1 GB'], ['Operating System', 'Media', self.media.name], ['Operating System', 'Partition table', DEFAULT_PTABLE], ['Operating System', 'Root password', root_pwd], ], interface_parameters=[ ['Network type', 'Physical (Bridge)'], ['Network', settings.vlan_networking.bridge], ], ) # Delete host self.hosts.delete(u'{0}.{1}'.format(self.hostname, self.domain_name))
def test_create_host_on_libvirt(self): """@Test: Create a new Host on libvirt compute resource @Feature: Host - Positive create @Assert: Host is created """ resource = u'{0} (Libvirt)'.format(self.computeresource.name) root_pwd = gen_string("alpha", 15) with Session(self.browser) as session: make_host( session, org=self.org_name, loc=self.loc_name, name=self.hostname, host_group=self.host_group.name, resource=resource, root_pwd=root_pwd, memory="1 GB", network_type="Virtual (NAT)", ) self.scroll_page() self.navigator.go_to_hosts() search = self.hosts.search( u'{0}.{1}'.format(self.hostname, self.domain_name) ) self.assertIsNotNone(search)
def test_positive_provision_atomic_host(self): """Provision an atomic host on libvirt and register it with satellite :id: 5ddf2f7f-f7aa-4321-8717-372c7b6e99b6 :expectedresults: Atomic host should be provisioned and listed under content-hosts/Hosts :CaseLevel: System """ resource = u'{0} (Libvirt)'.format(self.computeresource.name) root_pwd = gen_string('alpha', 15) with Session(self.browser) as session: make_host( session, name=self.hostname, org=self.org_name, parameters_list=[ ['Host', 'Organization', self.org_name], ['Host', 'Location', self.loc_name], ['Host', 'Host group', self.host_group.name], ['Host', 'Deploy on', resource], ['Virtual Machine', 'Memory', '1 GB'], ['Operating System', 'Media', self.media.name], ['Operating System', 'Partition table', DEFAULT_PTABLE], ['Operating System', 'Root password', root_pwd], ], interface_parameters=[ ['Network type', 'Physical (Bridge)'], ['Network', settings.vlan_networking.bridge], ], ) search = self.hosts.search(u'{0}.{1}'.format( self.hostname, self.domain_name)) self.assertIsNotNone(search)
def test_negative_add_contents_to_unregistered_host(self): """Perform a content action like on a host which is not registered :id: 67396c26-67fa-4cee-9937-65c2b9befabc :steps: 1. Provision a host via foreman which is not registered via rhsm 2. Try to add package from content-hosts page :expectedresults: User get a warning: This Host is not currently registered with subscription-manager. :CaseLevel: System """ host = entities.Host() host.create_missing() os_name = u'{0} {1}'.format(host.operatingsystem.name, host.operatingsystem.major) with Session(self) as session: make_host( session, name=host.name, org=host.organization.name, parameters_list=[ ['Host', 'Organization', host.organization.name], ['Host', 'Location', host.location.name], ['Host', 'Lifecycle Environment', ENVIRONMENT], ['Host', 'Content View', DEFAULT_CV], ['Host', 'Puppet Environment', host.environment.name], [ 'Operating System', 'Architecture', host.architecture.name ], ['Operating System', 'Operating system', os_name], ['Operating System', 'Media', host.medium.name], ['Operating System', 'Partition table', host.ptable.name], ['Operating System', 'Root password', host.root_pass], ], interface_parameters=[ ['Type', 'Interface'], ['MAC address', host.mac], ['Domain', host.domain.name], ['Primary', True], ], ) hostname = u'{0}.{1}'.format(host.name, host.domain.name) with self.assertRaises(UIError): self.contenthost.execute_package_action( hostname, 'Package Install', 'busybox', timeout=5, ) self.contenthost.click(tab_locators['contenthost.tab_details']) self.assertIn( ('This Host is not currently registered with' ' subscription-manager'), self.contenthost.wait_until_element( locators['contenthost.subscription_message']).text)
def test_negative_add_contents_to_unregistered_host(self): """Perform a content action like on a host which is not registered @id: 67396c26-67fa-4cee-9937-65c2b9befabc @steps: 1. Provision a host via foreman which is not registered via rhsm 2. Try to add package from content-hosts page @assert: User get a warning: This Host is not currently registered with subscription-manager. @CaseLevel: System """ host = entities.Host() host.create_missing() os_name = u'{0} {1}'.format( host.operatingsystem.name, host.operatingsystem.major) with Session(self.browser) as session: make_host( session, name=host.name, org=host.organization.name, parameters_list=[ ['Host', 'Organization', host.organization.name], ['Host', 'Location', host.location.name], ['Host', 'Lifecycle Environment', ENVIRONMENT], ['Host', 'Content View', DEFAULT_CV], ['Host', 'Puppet Environment', host.environment.name], [ 'Operating System', 'Architecture', host.architecture.name ], ['Operating System', 'Operating system', os_name], ['Operating System', 'Media', host.medium.name], ['Operating System', 'Partition table', host.ptable.name], ['Operating System', 'Root password', host.root_pass], ], interface_parameters=[ ['Type', 'Interface'], ['MAC address', host.mac], ['Domain', host.domain.name], ['Primary', True], ], ) hostname = u'{0}.{1}'.format(host.name, host.domain.name) with self.assertRaises(UIError): self.contenthost.execute_package_action( hostname, 'Package Install', 'busybox', timeout=5, ) self.assertIsNotNone( self.contenthost.wait_until_element( common_locators['alert.error']) )
def test_positive_delete_libvirt(self): """Create a new Host on libvirt compute resource and delete it afterwards :id: 6a9175e7-bb96-4de3-bc45-ba6c10dd14a4 :customerscenario: true :expectedresults: Proper warning message is displayed on delete attempt and host deleted successfully afterwards :BZ: 1243223 :CaseLevel: System """ hostname = gen_string('alpha').lower() with Session(self) as session: make_host( session, name=hostname, org=self.org_name, loc=self.loc_name, force_context=True, parameters_list=[ ['Host', 'Organization', self.org_name], ['Host', 'Location', self.loc_name], ['Host', 'Host group', self.host_group.name], ['Host', 'Deploy on', self.resource], ['Host', 'Puppet Environment', self.puppet_env.name], ['Virtual Machine', 'Memory', '1 GB'], ['Operating System', 'Root password', self.root_pwd], ], interface_parameters=[ ['Network type', 'Physical (Bridge)'], ['Network', settings.vlan_networking.bridge], ], ) name = u'{0}.{1}'.format(hostname, self.domain_name) self.assertIsNotNone(self.hosts.search(name)) self.hosts.click(common_locators['select_action_dropdown'] % name) self.hosts.click( common_locators['delete_button'] % name, wait_for_ajax=False ) text = self.hosts.get_alert_text() self.assertIn( 'This will delete the virtual machine and its disks, and is ' 'irreversible.', text ) self.hosts.handle_alert(True) self.hosts.wait_for_ajax() self.assertIsNone(self.hosts.search(name))
def test_negative_add_subs_to_unregistered_host(self): """Perform a subscription action on a host which is not registered :id: 83ebd98e-309d-4209-bf01-0547334af5af :steps: 1. Provision a host via foreman which is not registered via rhsm 2. Try to add subscription from content-hosts page :expectedresults: User get a warning: This Host is not currently registered with subscription-manager. :CaseLevel: System """ host = entities.Host() host.create_missing() os_name = u'{0} {1}'.format( host.operatingsystem.name, host.operatingsystem.major) with Session(self) as session: make_host( session, name=host.name, org=host.organization.name, parameters_list=[ ['Host', 'Organization', host.organization.name], ['Host', 'Location', host.location.name], ['Host', 'Lifecycle Environment', ENVIRONMENT], ['Host', 'Content View', DEFAULT_CV], ['Host', 'Puppet Environment', host.environment.name], [ 'Operating System', 'Architecture', host.architecture.name ], ['Operating System', 'Operating system', os_name], ['Operating System', 'Media', host.medium.name], ['Operating System', 'Partition table', host.ptable.name], ['Operating System', 'Root password', host.root_pass], ], interface_parameters=[ ['Type', 'Interface'], ['MAC address', host.mac], ['Domain', host.domain.name], ['Primary', True], ], ) hostname = u'{0}.{1}'.format(host.name, host.domain.name) with self.assertRaises(UIError): self.contenthost.update( hostname, add_subscriptions=[DEFAULT_SUBSCRIPTION_NAME], )
def test_positive_update_name(self): """Create a new Host and update its name to valid one @id: f1c19599-f613-431d-bf09-62addec1e60b @Assert: Host is updated successfully @CaseLevel: System """ host = entities.Host() host.create_missing() os_name = u'{0} {1}'.format( host.operatingsystem.name, host.operatingsystem.major) host_name = host.name with Session(self.browser) as session: make_host( session, name=host_name, org=host.organization.name, parameters_list=[ ['Host', 'Organization', host.organization.name], ['Host', 'Location', host.location.name], ['Host', 'Lifecycle Environment', ENVIRONMENT], ['Host', 'Content View', DEFAULT_CV], ['Host', 'Puppet Environment', host.environment.name], [ 'Operating System', 'Architecture', host.architecture.name], ['Operating System', 'Operating system', os_name], ['Operating System', 'Media', host.medium.name], ['Operating System', 'Partition table', host.ptable.name], ['Operating System', 'Root password', host.root_pass], ], interface_parameters=[ ['Type', 'Interface'], ['MAC address', host.mac], ['Domain', host.domain.name], ['Primary', True], ], ) # confirm the Host appears in the UI search = self.hosts.search( u'{0}.{1}'.format(host_name, host.domain.name) ) self.assertIsNotNone(search) new_name = gen_string('alpha') self.hosts.update(host_name, host.domain.name, new_name) new_host_name = ( u'{0}.{1}'.format(new_name, host.domain.name)).lower() self.assertIsNotNone(self.hosts.search(new_host_name)) self.hostname = new_name
def test_positive_update_name(self): """Create a new Host and update its name to valid one :id: f1c19599-f613-431d-bf09-62addec1e60b :expectedresults: Host is updated successfully :CaseLevel: System """ host = entities.Host() host.create_missing() os_name = u'{0} {1}'.format(host.operatingsystem.name, host.operatingsystem.major) host_name = host.name with Session(self.browser) as session: make_host( session, name=host_name, org=host.organization.name, parameters_list=[ ['Host', 'Organization', host.organization.name], ['Host', 'Location', host.location.name], ['Host', 'Lifecycle Environment', ENVIRONMENT], ['Host', 'Content View', DEFAULT_CV], ['Host', 'Puppet Environment', host.environment.name], [ 'Operating System', 'Architecture', host.architecture.name ], ['Operating System', 'Operating system', os_name], ['Operating System', 'Media', host.medium.name], ['Operating System', 'Partition table', host.ptable.name], ['Operating System', 'Root password', host.root_pass], ], interface_parameters=[ ['Type', 'Interface'], ['MAC address', host.mac], ['Domain', host.domain.name], ['Primary', True], ], ) # confirm the Host appears in the UI search = self.hosts.search(u'{0}.{1}'.format( host_name, host.domain.name)) self.assertIsNotNone(search) new_name = gen_string('alpha') self.hosts.update(host_name, host.domain.name, new_name) new_host_name = (u'{0}.{1}'.format(new_name, host.domain.name)).lower() self.assertIsNotNone(self.hosts.search(new_host_name)) self.hostname = new_name
def test_negative_add_subs_to_unregistered_host(self): """Perform a subscription action on a host which is not registered :id: 83ebd98e-309d-4209-bf01-0547334af5af :steps: 1. Provision a host via foreman which is not registered via rhsm 2. Try to add subscription from content-hosts page :expectedresults: User get a warning: This Host is not currently registered with subscription-manager. :CaseLevel: System """ host = entities.Host() host.create_missing() os_name = u'{0} {1}'.format(host.operatingsystem.name, host.operatingsystem.major) with Session(self) as session: make_host( session, name=host.name, org=host.organization.name, parameters_list=[ ['Host', 'Organization', host.organization.name], ['Host', 'Location', host.location.name], ['Host', 'Lifecycle Environment', ENVIRONMENT], ['Host', 'Content View', DEFAULT_CV], ['Host', 'Puppet Environment', host.environment.name], [ 'Operating System', 'Architecture', host.architecture.name ], ['Operating System', 'Operating system', os_name], ['Operating System', 'Media', host.medium.name], ['Operating System', 'Partition table', host.ptable.name], ['Operating System', 'Root password', host.root_pass], ], interface_parameters=[ ['Type', 'Interface'], ['MAC address', host.mac], ['Domain', host.domain.name], ['Primary', True], ], ) hostname = u'{0}.{1}'.format(host.name, host.domain.name) with self.assertRaises(UIError): self.contenthost.update( hostname, add_subscriptions=[DEFAULT_SUBSCRIPTION_NAME], )
def test_positive_provision_foreman_host(self): """Test if a foreman host can be provisioned :id: 985b4432-4d99-43a7-a304-1b93760257dd :steps: 1. Provision a host via foreman 2. View host under content hosts 3. View host under 'All Hosts' :expectedresults: Hosts provisioned via foreman should appear under 'All hosts' as well as under content-hosts. :CaseLevel: System """ host = entities.Host() host.create_missing() os_name = u'{0} {1}'.format( host.operatingsystem.name, host.operatingsystem.major) with Session(self) as session: make_host( session, name=host.name, org=host.organization.name, parameters_list=[ ['Host', 'Organization', host.organization.name], ['Host', 'Location', host.location.name], ['Host', 'Lifecycle Environment', ENVIRONMENT], ['Host', 'Content View', DEFAULT_CV], ['Host', 'Puppet Environment', host.environment.name], [ 'Operating System', 'Architecture', host.architecture.name ], ['Operating System', 'Operating system', os_name], ['Operating System', 'Media', host.medium.name], ['Operating System', 'Partition table', host.ptable.name], ['Operating System', 'Root password', host.root_pass], ], interface_parameters=[ ['Type', 'Interface'], ['MAC address', host.mac], ['Domain', host.domain.name], ['Primary', True], ], ) hostname = u'{0}.{1}'.format(host.name, host.domain.name) self.assertIsNotNone(self.contenthost.search(hostname)) self.assertIsNotNone(self.hosts.search(hostname))
def test_positive_provision_foreman_host(self): """Test if a foreman host can be provisioned :id: 985b4432-4d99-43a7-a304-1b93760257dd :steps: 1. Provision a host via foreman 2. View host under content hosts 3. View host under 'All Hosts' :expectedresults: Hosts provisioned via foreman should appear under 'All hosts' as well as under content-hosts. :CaseLevel: System """ host = entities.Host() host.create_missing() os_name = u'{0} {1}'.format(host.operatingsystem.name, host.operatingsystem.major) with Session(self) as session: make_host( session, name=host.name, org=host.organization.name, parameters_list=[ ['Host', 'Organization', host.organization.name], ['Host', 'Location', host.location.name], ['Host', 'Lifecycle Environment', ENVIRONMENT], ['Host', 'Content View', DEFAULT_CV], ['Host', 'Puppet Environment', host.environment.name], [ 'Operating System', 'Architecture', host.architecture.name ], ['Operating System', 'Operating system', os_name], ['Operating System', 'Media', host.medium.name], ['Operating System', 'Partition table', host.ptable.name], ['Operating System', 'Root password', host.root_pass], ], interface_parameters=[ ['Type', 'Interface'], ['MAC address', host.mac], ['Domain', host.domain.name], ['Primary', True], ], ) hostname = u'{0}.{1}'.format(host.name, host.domain.name) self.assertIsNotNone(self.contenthost.search(hostname)) self.assertIsNotNone(self.hosts.search(hostname))
def test_positive_create(self): """Create a new Host @id: 4821444d-3c86-4f93-849b-60460e025ba0 @Assert: Host is created @CaseLevel: System """ host = entities.Host() host.create_missing() os_name = u'{0} {1}'.format( host.operatingsystem.name, host.operatingsystem.major) with Session(self.browser) as session: make_host( session, name=host.name, org=host.organization.name, parameters_list=[ ['Host', 'Organization', host.organization.name], ['Host', 'Location', host.location.name], ['Host', 'Lifecycle Environment', ENVIRONMENT], ['Host', 'Content View', DEFAULT_CV], ['Host', 'Puppet Environment', host.environment.name], [ 'Operating System', 'Architecture', host.architecture.name ], ['Operating System', 'Operating system', os_name], ['Operating System', 'Media', host.medium.name], ['Operating System', 'Partition table', host.ptable.name], ['Operating System', 'Root password', host.root_pass], ], interface_parameters=[ ['Type', 'Interface'], ['MAC address', host.mac], ['Domain', host.domain.name], ['Primary', True], ], ) # confirm the Host appears in the UI search = self.hosts.search( u'{0}.{1}'.format(host.name, host.domain.name) ) self.assertIsNotNone(search)
def test_positive_provision_end_to_end(self): """Provision Host on libvirt compute resource :id: 2678f95f-0c0e-4b46-a3c1-3f9a954d3bde :expectedresults: Host is provisioned successfully :CaseLevel: System """ hostname = gen_string('numeric') with Session(self) as session: make_host( session, name=hostname, org=self.org_name, loc=self.loc_name, force_context=True, parameters_list=[ ['Host', 'Organization', self.org_name], ['Host', 'Location', self.loc_name], ['Host', 'Host group', self.host_group.name], ['Host', 'Deploy on', self.resource], ['Host', 'Puppet Environment', self.puppet_env.name], ['Virtual Machine', 'Memory', '1 GB'], ['Operating System', 'Root password', self.root_pwd], ], interface_parameters=[ ['Network type', 'Physical (Bridge)'], ['Network', settings.vlan_networking.bridge], ], ) name = u'{0}.{1}'.format(hostname, self.domain_name) self.assertIsNotNone(self.hosts.search(name)) self.addCleanup( host_cleanup, entities.Host().search( query={'search': 'name={}'.format(name)})[0].id) for _ in range(25): result = self.hosts.get_host_properties(name, ['Build']) if result['Build'] == 'Pending installation': sleep(30) else: break self.assertEqual(result['Build'], 'Installed')
def test_positive_delete(self): """Delete a Host @id: 13735af1-f1c7-466e-a969-80618a1d854d @Assert: Host is delete @CaseLevel: System """ host = entities.Host() host.create_missing() os_name = u'{0} {1}'.format( host.operatingsystem.name, host.operatingsystem.major) with Session(self.browser) as session: make_host( session, name=host.name, org=host.organization.name, parameters_list=[ ['Host', 'Organization', host.organization.name], ['Host', 'Location', host.location.name], ['Host', 'Lifecycle Environment', ENVIRONMENT], ['Host', 'Content View', DEFAULT_CV], ['Host', 'Puppet Environment', host.environment.name], [ 'Operating System', 'Architecture', host.architecture.name ], ['Operating System', 'Operating system', os_name], ['Operating System', 'Media', host.medium.name], ['Operating System', 'Partition table', host.ptable.name], ['Operating System', 'Root password', host.root_pass], ], interface_parameters=[ ['Type', 'Interface'], ['MAC address', host.mac], ['Domain', host.domain.name], ['Primary', True], ], ) # Delete host self.hosts.delete( u'{0}.{1}'.format(host.name, host.domain.name))
def test_positive_create(self): """Create a new Host :id: 4821444d-3c86-4f93-849b-60460e025ba0 :expectedresults: Host is created :CaseLevel: System """ host = entities.Host() host.create_missing() os_name = u'{0} {1}'.format(host.operatingsystem.name, host.operatingsystem.major) with Session(self.browser) as session: make_host( session, name=host.name, org=host.organization.name, parameters_list=[ ['Host', 'Organization', host.organization.name], ['Host', 'Location', host.location.name], ['Host', 'Lifecycle Environment', ENVIRONMENT], ['Host', 'Content View', DEFAULT_CV], ['Host', 'Puppet Environment', host.environment.name], [ 'Operating System', 'Architecture', host.architecture.name ], ['Operating System', 'Operating system', os_name], ['Operating System', 'Media', host.medium.name], ['Operating System', 'Partition table', host.ptable.name], ['Operating System', 'Root password', host.root_pass], ], interface_parameters=[ ['Type', 'Interface'], ['MAC address', host.mac], ['Domain', host.domain.name], ['Primary', True], ], ) # confirm the Host appears in the UI search = self.hosts.search(u'{0}.{1}'.format( host.name, host.domain.name)) self.assertIsNotNone(search)
def test_positive_provision_end_to_end(self): """Provision Host on libvirt compute resource :id: 2678f95f-0c0e-4b46-a3c1-3f9a954d3bde :expectedresults: Host is provisioned successfully :CaseLevel: System """ hostname = gen_string('numeric') with Session(self) as session: make_host( session, name=hostname, org=self.org_name, loc=self.loc_name, force_context=True, parameters_list=[ ['Host', 'Organization', self.org_name], ['Host', 'Location', self.loc_name], ['Host', 'Host group', self.host_group.name], ['Host', 'Deploy on', self.resource], ['Host', 'Puppet Environment', self.puppet_env.name], ['Virtual Machine', 'Memory', '1 GB'], ['Operating System', 'Root password', self.root_pwd], ], interface_parameters=[ ['Network type', 'Physical (Bridge)'], ['Network', settings.vlan_networking.bridge], ], ) name = u'{0}.{1}'.format(hostname, self.domain_name) self.assertIsNotNone(self.hosts.search(name)) self.addCleanup(host_cleanup, entities.Host().search( query={'search': 'name={}'.format(name)})[0].id) for _ in range(25): result = self.hosts.get_host_properties(name, ['Build']) if result['Build'] == 'Pending installation': sleep(30) else: break self.assertEqual(result['Build'], 'Installed')
def test_positive_delete(self): """Delete a Host :id: 13735af1-f1c7-466e-a969-80618a1d854d :expectedresults: Host is delete :CaseLevel: System """ host = entities.Host() host.create_missing() os_name = u'{0} {1}'.format(host.operatingsystem.name, host.operatingsystem.major) with Session(self.browser) as session: make_host( session, name=host.name, org=host.organization.name, parameters_list=[ ['Host', 'Organization', host.organization.name], ['Host', 'Location', host.location.name], ['Host', 'Lifecycle Environment', ENVIRONMENT], ['Host', 'Content View', DEFAULT_CV], ['Host', 'Puppet Environment', host.environment.name], [ 'Operating System', 'Architecture', host.architecture.name ], ['Operating System', 'Operating system', os_name], ['Operating System', 'Media', host.medium.name], ['Operating System', 'Partition table', host.ptable.name], ['Operating System', 'Root password', host.root_pass], ], interface_parameters=[ ['Type', 'Interface'], ['MAC address', host.mac], ['Domain', host.domain.name], ['Primary', True], ], ) # Delete host self.hosts.delete(u'{0}.{1}'.format(host.name, host.domain.name))
def test_positive_create_libvirt(self): """Create a new Host on libvirt compute resource @id: 2678f95f-0c0e-4b46-a3c1-3f9a954d3bde @Assert: Host is created @CaseLevel: System """ resource = u'{0} (Libvirt)'.format(self.computeresource.name) root_pwd = gen_string('alpha', 15) environment = entities.Environment( location=[self.loc], organization=[self.org_], ).create(True) with Session(self.browser) as session: make_host( session, name=self.hostname, org=self.org_name, parameters_list=[ ['Host', 'Organization', self.org_name], ['Host', 'Location', self.loc_name], ['Host', 'Host group', self.host_group.name], ['Host', 'Deploy on', resource], ['Host', 'Puppet Environment', environment.name], ['Virtual Machine', 'Memory', '1 GB'], ['Operating System', 'Media', self.media.name], ['Operating System', 'Partition table', DEFAULT_PTABLE], ['Operating System', 'Root password', root_pwd], ], interface_parameters=[ ['Network type', 'Physical (Bridge)'], ['Network', settings.vlan_networking.bridge], ], ) search = self.hosts.search( u'{0}.{1}'.format(self.hostname, self.domain_name) ) self.assertIsNotNone(search)
def test_positive_create_libvirt(self): """Create a new Host on libvirt compute resource :id: 2678f95f-0c0e-4b46-a3c1-3f9a954d3bde :expectedresults: Host is created :CaseLevel: System """ resource = u'{0} (Libvirt)'.format(self.computeresource.name) root_pwd = gen_string('alpha', 15) environment = entities.Environment( location=[self.loc], organization=[self.org_], ).create(True) with Session(self.browser) as session: make_host( session, name=self.hostname, org=self.org_name, parameters_list=[ ['Host', 'Organization', self.org_name], ['Host', 'Location', self.loc_name], ['Host', 'Host group', self.host_group.name], ['Host', 'Deploy on', resource], ['Host', 'Puppet Environment', environment.name], ['Virtual Machine', 'Memory', '1 GB'], ['Operating System', 'Media', self.media.name], ['Operating System', 'Partition table', DEFAULT_PTABLE], ['Operating System', 'Root password', root_pwd], ], interface_parameters=[ ['Network type', 'Physical (Bridge)'], ['Network', settings.vlan_networking.bridge], ], ) search = self.hosts.search(u'{0}.{1}'.format( self.hostname, self.domain_name)) self.assertIsNotNone(search)
def test_positive_provision_atomic_host(self): """Provision an atomic host on libvirt and register it with satellite :id: 5ddf2f7f-f7aa-4321-8717-372c7b6e99b6 :expectedresults: Atomic host should be provisioned and listed under content-hosts/Hosts :CaseLevel: System """ resource = u'{0} (Libvirt)'.format(self.computeresource.name) root_pwd = gen_string('alpha', 15) with Session(self) as session: make_host( session, name=self.hostname, org=self.org_name, loc=self.loc_name, force_context=True, parameters_list=[ ['Host', 'Organization', self.org_name], ['Host', 'Location', self.loc_name], ['Host', 'Host group', self.host_group.name], ['Host', 'Deploy on', resource], ['Virtual Machine', 'Memory', '1 GB'], ['Operating System', 'Media', self.media.name], ['Operating System', 'Partition table', DEFAULT_PTABLE], ['Operating System', 'Root password', root_pwd], ], interface_parameters=[ ['Network type', 'Physical (Bridge)'], ['Network', settings.vlan_networking.bridge], ], ) search = self.hosts.search( u'{0}.{1}'.format(self.hostname, self.domain_name) ) self.assertIsNotNone(search)
def test_positive_provision_rhev_with_compute_profile(self): """ Provision a host on rhev compute resource with compute profile default (3-Large) :id: fe4a05ef-d548-4c28-80d0-d17851fb4b03 :setup: rhev hostname ,credentials and provisioning setup. :steps: 1. Go to "Hosts --> New host". 2. Fill in the required details.(eg name,loc, org). 3. Select rhev compute resource from "Deploy on" drop down. 4. Select the "Compute profile" from the drop down. 5. Provision the host using the compute profile. :expectedresults: The host should be provisioned successfully :CaseAutomation: Automated """ hostname = gen_string('alpha', 9).lower() cr_name = gen_string('alpha', 9) cr_resource = RHEV_CR % cr_name root_pwd = gen_string('alpha', 15) with Session(self) as session: parameter_list = [ ['URL', self.rhev_url, 'field'], ['Username', self.rhev_username, 'field'], ['Password', self.rhev_password, 'field'], ['X509 Certification Authorities', self.rhev_cacert, 'field'], ['Datacenter', self.rhev_datacenter, 'special select'], ] make_resource(session, name=cr_name, provider_type=FOREMAN_PROVIDERS['rhev'], parameter_list=parameter_list, orgs=[self.org_name], org_select=True, locations=[self.loc_name], loc_select=True) self.compute_resource.set_profile_values( cr_name, COMPUTE_PROFILE_LARGE, cluster=self.rhev_datacenter, cores=2, memory=1024, network_interfaces=[ dict(name='nic1', network=settings.vlan_networking.bridge), ], storage=[ dict(size='10', storage_domain=self.rhev_storage_domain, bootable=True, preallocate_disk=False), ]) make_host( session, name=hostname, org=self.org_name, loc=self.loc_name, parameters_list=[ ['Host', 'Organization', self.org_name], ['Host', 'Location', self.loc_name], ['Host', 'Host group', self.config_env['host_group']], ['Host', 'Deploy on', cr_resource], ['Host', 'Compute profile', COMPUTE_PROFILE_LARGE], ['Operating System', 'Operating System', self.os_name], [ 'Operating System', 'Partition table', self.config_env['ptable'] ], ['Operating System', 'PXE loader', 'PXELinux BIOS'], ['Operating System', 'Root password', root_pwd], ], provisioning_method='network') vm_host_name = '{0}.{1}'.format(hostname, self.config_env['domain']) # the provisioning take some time to finish, when done will be # redirected to the created host # wait until redirected to host page self.assertIsNotNone( session.hosts.wait_until_element( locators["host.host_page_title"] % vm_host_name, timeout=60)) self.assertIsNotNone(self.hosts.search(vm_host_name)) host_ip = entities.Host().search( query={ 'search': 'name={0} and organization="{1}"'.format( vm_host_name, self.org_name) })[0].read().ip with self.assertNotRaises(ProvisioningCheckError): self.compute_resource.host_provisioning_check(host_ip)
def test_positive_check_provisioned_vm_name(self): """Provision a host on rhev compute resource and check that the hypervisor provisioned VM name is like "name.example.com" (where name is the host name and example.com the domain name). :id: 1315e36a-d7d1-4b3b-83a6-a6d622592142 :customerscenario: true :steps: 1. Prepare an RHEV compute resource. 2. Create an image. 3. Select the custom compute profile" with custom disk size, cpu count and memory. 4. Go to "Hosts --> New host". 5. Provision the host using the compute profile. 6. Check RHEV hypervisor VM name. :expectedresults: Hypervisor VM name is like name.example.com :CaseAutomation: Automated :BZ: 1317529 :CaseLevel: System """ host_name = gen_string('alpha').lower() domain_name = '{0}.{1}'.format(gen_string('alpha'), gen_string('alpha', length=3)).lower() cr_name = gen_string('alpha') cr_resource = RHEV_CR % cr_name image_name = gen_string('alpha') root_pwd = gen_string('alpha') # rhev_img_os is like "RedHat 7.4" # eg: "<os_name <os_major>.<os_minor>" _, os_version = self.rhev_img_os.split(' ') os_version_major, os_version_minor = os_version.split('.') # Get the operating system os = entities.OperatingSystem().search(query=dict( search='family="Redhat" AND major="{0}" AND minor="{1}"'.format( os_version_major, os_version_minor)))[0].read() # Get the image arch arch = entities.Architecture().search(query=dict( search='name="{0}"'.format(self.rhev_img_arch)))[0].read() # Get the default org content view content_view = entities.ContentView( name=DEFAULT_CV, organization=self.org).search()[0].read() # Get the org Library lifecycle environment lce = entities.LifecycleEnvironment( name=ENVIRONMENT, organization=self.org).search()[0].read() # Create a new org domain domain = entities.Domain( name=domain_name, location=[self.loc], organization=[self.org], ).create() # Create a new Hostgroup host_group = entities.HostGroup( architecture=arch, operatingsystem=os, domain=domain, lifecycle_environment=lce, content_view=content_view, root_pass=gen_string('alphanumeric'), organization=[self.org], location=[self.loc], ).create() with Session(self) as session: parameter_list = [ ['URL', self.rhev_url, 'field'], ['Username', self.rhev_username, 'field'], ['Password', self.rhev_password, 'field'], ['X509 Certification Authorities', self.rhev_cacert, 'field'], ['Datacenter', self.rhev_datacenter, 'special select'], ] make_resource(session, name=cr_name, provider_type=FOREMAN_PROVIDERS['rhev'], parameter_list=parameter_list, orgs=[self.org_name], org_select=True, locations=[self.loc_name], loc_select=True) parameter_list_img = [ ['Name', image_name], ['Operatingsystem', os.title], ['Architecture', arch.name], ['Username', self.rhev_img_user], ['Password', self.rhev_img_pass], ['uuid', self.rhev_img_name], ] self.compute_resource.add_image(cr_name, parameter_list_img) self.assertIn(image_name, self.compute_resource.list_images(cr_name)) self.compute_resource.set_profile_values( cr_name, COMPUTE_PROFILE_SMALL, cluster=self.rhev_datacenter, template=self.rhev_img_name, ) if bz_bug_is_open(1520382): # update the memory field as not loaded from template self.compute_resource.set_profile_values( cr_name, COMPUTE_PROFILE_SMALL, memory=1024, ) host_parameters_list = [ ['Host', 'Organization', self.org_name], ['Host', 'Location', self.loc_name], ['Host', 'Host group', host_group.name], ['Host', 'Deploy on', cr_resource], ['Host', 'Compute profile', COMPUTE_PROFILE_SMALL], ['Operating System', 'Operating System', os.title], ['Operating System', 'Root password', root_pwd], ] make_host( session, name=host_name, org=self.org_name, loc=self.loc_name, parameters_list=host_parameters_list, provisioning_method='image', ) vm_host_name = '{0}.{1}'.format(host_name, domain.name) # the provisioning take some time to finish, when done will be # redirected to the created host # wait until redirected to host page self.assertIsNotNone( session.hosts.wait_until_element( locators["host.host_page_title"] % vm_host_name, timeout=60)) host_properties = session.hosts.get_host_properties( vm_host_name, ['status', 'build']) self.assertTrue(host_properties) self.assertEqual(host_properties['status'], 'OK') self.assertEqual(host_properties['build'], 'Installed') # Query RHEV hypervisor for vm description # Using documented RHEV API access vm_host = entities.Host().search(query=dict( search='name="{0}"'.format(vm_host_name)))[0] response = client.get('{0}/vms/{1}'.format(self.rhev_url, vm_host.uuid), verify=False, auth=(self.rhev_username, self.rhev_password), headers={'Accept': 'application/json'}) self.assertTrue(response.status_code, 200) self.assertEqual(response.json()['name'], vm_host_name)
def test_positive_check_provisioned_vm_name(self): """Provision a host on rhev compute resource and check that the hypervisor provisioned VM name is like "name.example.com" (where name is the host name and example.com the domain name). :id: 1315e36a-d7d1-4b3b-83a6-a6d622592142 :customerscenario: true :steps: 1. Prepare an RHEV compute resource. 2. Create an image. 3. Select the custom compute profile" with custom disk size, cpu count and memory. 4. Go to "Hosts --> New host". 5. Provision the host using the compute profile. 6. Check RHEV hypervisor VM name. :expectedresults: Hypervisor VM name is like name.example.com :CaseAutomation: Automated :BZ: 1317529 :CaseLevel: System """ host_name = gen_string('alpha').lower() domain_name = '{0}.{1}'.format( gen_string('alpha'), gen_string('alpha', length=3)).lower() cr_name = gen_string('alpha') cr_resource = RHEV_CR % cr_name image_name = gen_string('alpha') root_pwd = gen_string('alpha') # rhev_img_os is like "RedHat 7.4" # eg: "<os_name <os_major>.<os_minor>" _, os_version = self.rhev_img_os.split(' ') os_version_major, os_version_minor = os_version.split('.') # Get the operating system os = entities.OperatingSystem().search(query=dict( search='family="Redhat" AND major="{0}" AND minor="{1}"'.format( os_version_major, os_version_minor) ))[0].read() # Get the image arch arch = entities.Architecture().search( query=dict(search='name="{0}"'.format(self.rhev_img_arch)) )[0].read() # Get the default org content view content_view = entities.ContentView( name=DEFAULT_CV, organization=self.org).search()[0].read() # Get the org Library lifecycle environment lce = entities.LifecycleEnvironment( name=ENVIRONMENT, organization=self.org).search()[0].read() # Create a new org domain domain = entities.Domain( name=domain_name, location=[self.loc], organization=[self.org], ).create() # Create a new Hostgroup host_group = entities.HostGroup( architecture=arch, operatingsystem=os, domain=domain, lifecycle_environment=lce, content_view=content_view, root_pass=gen_string('alphanumeric'), organization=[self.org], location=[self.loc], ).create() with Session(self) as session: parameter_list = [ ['URL', self.rhev_url, 'field'], ['Username', self.rhev_username, 'field'], ['Password', self.rhev_password, 'field'], ['X509 Certification Authorities', self.rhev_cacert, 'field'], ['Datacenter', self.rhev_datacenter, 'special select'], ] make_resource( session, name=cr_name, provider_type=FOREMAN_PROVIDERS['rhev'], parameter_list=parameter_list, orgs=[self.org_name], org_select=True, locations=[self.loc_name], loc_select=True ) parameter_list_img = [ ['Name', image_name], ['Operatingsystem', os.title], ['Architecture', arch.name], ['Username', self.rhev_img_user], ['Password', self.rhev_img_pass], ['uuid', self.rhev_img_name], ] self.compute_resource.add_image(cr_name, parameter_list_img) self.assertIn( image_name, self.compute_resource.list_images(cr_name) ) self.compute_resource.set_profile_values( cr_name, COMPUTE_PROFILE_SMALL, cluster=self.rhev_datacenter, template=self.rhev_img_name, ) if bz_bug_is_open(1520382): # update the memory field as not loaded from template self.compute_resource.set_profile_values( cr_name, COMPUTE_PROFILE_SMALL, memory=1024, ) host_parameters_list = [ ['Host', 'Organization', self.org_name], ['Host', 'Location', self.loc_name], ['Host', 'Host group', host_group.name], ['Host', 'Deploy on', cr_resource], ['Host', 'Compute profile', COMPUTE_PROFILE_SMALL], ['Operating System', 'Operating System', os.title], ['Operating System', 'Root password', root_pwd], ] make_host( session, name=host_name, org=self.org_name, loc=self.loc_name, parameters_list=host_parameters_list, provisioning_method='image', ) vm_host_name = '{0}.{1}'.format(host_name, domain.name) # the provisioning take some time to finish, when done will be # redirected to the created host # wait until redirected to host page self.assertIsNotNone( session.hosts.wait_until_element( locators["host.host_page_title"] % vm_host_name, timeout=60 ) ) host_properties = session.hosts.get_host_properties( vm_host_name, ['status', 'build']) self.assertTrue(host_properties) self.assertEqual(host_properties['status'], 'OK') self.assertEqual(host_properties['build'], 'Installed') # Query RHEV hypervisor for vm description # Using documented RHEV API access vm_host = entities.Host().search( query=dict(search='name="{0}"'.format(vm_host_name)) )[0] response = client.get( '{0}/vms/{1}'.format(self.rhev_url, vm_host.uuid), verify=False, auth=(self.rhev_username, self.rhev_password), headers={'Accept': 'application/json'} ) self.assertTrue(response.status_code, 200) self.assertEqual( response.json()['name'], vm_host_name )
def test_positive_provision_rhev_with_image(self): """ Provision a host on rhev compute resource with image based :id: 80abd6b1-31cd-4f3e-949c-f1ca608d0bbb :setup: rhev hostname and credentials. 1. Configured subnet for provisioning of the host. 2. Configured domains for the host. 3. Population of images into satellite from rhev templates. 4. Activation key and CV for the host. :steps: 1. Go to "Hosts --> New host". 2. Fill in the required details.(eg name,loc, org). 3. Select rhev compute resource from "Deploy on" drop down. 4. Associate appropriate feature capsules. 5. Go to "operating system tab". 6. Edit Provisioning Method to image based. 7. Select the appropriate image . 8. Associate the activation key and submit. :expectedresults: The host should be provisioned successfully :BZ: 1467828, 1466645, 1514885, 1467925 :CaseAutomation: Automated """ hostname = gen_string('alpha', 9).lower() cr_name = gen_string('alpha', 9) cr_resource = RHEV_CR % cr_name img_name = gen_string('alpha', 5) root_pwd = gen_string('alpha', 15) with Session(self) as session: parameter_list = [ ['URL', self.rhev_url, 'field'], ['Username', self.rhev_username, 'field'], ['Password', self.rhev_password, 'field'], ['X509 Certification Authorities', self.rhev_cacert, 'field'], ['Datacenter', self.rhev_datacenter, 'special select'], ] make_resource( session, name=cr_name, provider_type=FOREMAN_PROVIDERS['rhev'], parameter_list=parameter_list, orgs=[self.org_name], org_select=True, locations=[self.loc_name], loc_select=True ) parameter_list_img = [ ['Name', img_name], ['Operatingsystem', self.os_name], ['Architecture', self.rhev_img_arch], ['Username', self.rhev_img_user], ['Password', self.rhev_img_pass], ['uuid', self.rhev_img_name], ] self.compute_resource.add_image(cr_name, parameter_list_img) imgs = self.compute_resource.list_images(cr_name) self.assertTrue(img_name in imgs) self.compute_resource.set_profile_values( cr_name, COMPUTE_PROFILE_LARGE, cluster=self.rhev_datacenter, cores=2, memory=1024, network_interfaces=[ dict( name='nic1', network=settings.vlan_networking.bridge ), ], storage=[ dict( size='10', storage_domain=self.rhev_storage_domain, bootable=True, preallocate_disk=False ), ] ) make_host( session, name=hostname, org=self.org_name, loc=self.loc_name, parameters_list=[ ['Host', 'Organization', self.org_name], ['Host', 'Location', self.loc_name], ['Host', 'Host group', self.config_env['host_group']], ['Host', 'Deploy on', cr_resource], ['Host', 'Compute profile', COMPUTE_PROFILE_LARGE], ['Operating System', 'Operating System', self.os_name], ['Operating System', 'Partition table', self.config_env['ptable']], ['Operating System', 'PXE loader', 'PXELinux BIOS'], ['Operating System', 'Root password', root_pwd], ], provisioning_method='image', ) vm_host_name = '{0}.{1}'.format( hostname.lower(), self.config_env['domain']) # the provisioning take some time to finish, when done will be # redirected to the created host # wait until redirected to host page self.assertIsNotNone( session.hosts.wait_until_element( locators["host.host_page_title"] % vm_host_name, timeout=160 ) ) self.assertIsNotNone(self.hosts.search(vm_host_name)) host_ip = entities.Host().search(query={ 'search': 'name={0} and organization="{1}"'.format( vm_host_name, self.org_name) })[0].read().ip with self.assertNotRaises(ProvisioningCheckError): self.compute_resource.host_provisioning_check(host_ip)
def test_positive_provision_rhev_with_custom_compute_settings(self): """ Provision a host on rhev compute resource with custom disk, cpu count and memory :id: a972c095-7567-4bb0-86cb-9bd835fed7b7 :setup: rhev hostname ,credentials and provisioning setup. :steps: 1. Go to "Hosts --> New host". 2. Fill in the required details.(eg name,loc, org). 3. Select rhev custom compute resource from "Deploy on" drop down. 4. Select the custom compute profile" with custom disk size, cpu count and memory. 5. Provision the host using the compute profile. :expectedresults: The host should be provisioned with custom settings :BZ: 1467925, 1467828, 1514885 :CaseAutomation: Automated """ hostname = gen_string('alpha', 9).lower() cr_name = gen_string('alpha', 9) cr_resource = RHEV_CR % cr_name root_pwd = gen_string('alpha', 15) with Session(self) as session: parameter_list = [ ['URL', self.rhev_url, 'field'], ['Username', self.rhev_username, 'field'], ['Password', self.rhev_password, 'field'], ['X509 Certification Authorities', self.rhev_cacert, 'field'], ['Datacenter', self.rhev_datacenter, 'special select'], ] make_resource( session, name=cr_name, provider_type=FOREMAN_PROVIDERS['rhev'], parameter_list=parameter_list, orgs=[self.org_name], org_select=True, locations=[self.loc_name], loc_select=True ) self.compute_resource.set_profile_values( cr_name, COMPUTE_PROFILE_LARGE, cluster=self.rhev_datacenter, cores=2, memory=2024, network_interfaces=[ dict( name='nic1', network=settings.vlan_networking.bridge ), dict( name='nic2', network=settings.vlan_networking.bridge ), ], storage=[ dict( size='10', storage_domain=self.rhev_storage_domain, bootable=True, preallocate_disk=False ), dict( size='2', storage_domain=self.rhev_storage_domain, bootable=False, preallocate_disk=False ) ] ) make_host( session, name=hostname, org=self.org_name, loc=self.loc_name, parameters_list=[ ['Host', 'Organization', self.org_name], ['Host', 'Location', self.loc_name], ['Host', 'Host group', self.config_env['host_group']], ['Host', 'Deploy on', cr_resource], ['Host', 'Compute profile', COMPUTE_PROFILE_LARGE], ['Operating System', 'Operating System', self.os_name], ['Operating System', 'Partition table', self.config_env['ptable']], ['Operating System', 'PXE loader', 'PXELinux BIOS'], ['Operating System', 'Root password', root_pwd], ], provisioning_method='network' ) vm_host_name = '{0}.{1}'.format( hostname, self.config_env['domain']) # the provisioning take some time to finish, when done will be # redirected to the created host # wait until redirected to host page self.assertIsNotNone( session.hosts.wait_until_element( locators["host.host_page_title"] % vm_host_name, timeout=160 ) ) self.assertIsNotNone(self.hosts.search(vm_host_name)) host_ip = entities.Host().search(query={ 'search': 'name={0} and organization="{1}"'.format( vm_host_name, self.org_name) })[0].read().ip with self.assertNotRaises(ProvisioningCheckError): self.compute_resource.host_provisioning_check(host_ip)
def test_positive_check_provisioned_rhev_os(self): """Provision a host on rhev compute resource and check the hypervisor provisioned VM os type. :id: 97f66fca-50b4-42bc-b187-3b846f03ab76 :customerscenario: true :steps: 1. Prepare an RHEV compute resource. 2. Create an image. 3. Select the custom compute profile" with custom disk size, cpu count and memory. 4. Go to "Hosts --> New host". 5. Provision the host using the compute profile. 6. Check RHEV hypervisor VM OS type. :expectedresults: Hypervisor VM OS type must be the same as the one used in provisioning. :CaseAutomation: Automated :BZ: 1315281 :CaseLevel: System """ host_name = gen_string('alpha').lower() cr_name = gen_string('alpha') cr_resource = RHEV_CR % cr_name image_name = gen_string('alpha') root_pwd = gen_string('alpha') # rhev_img_os is like "RedHat 7.4" # eg: "<os_family <os_major>.<os_minor>" _, os_version = self.rhev_img_os.split(' ') os_version_major, os_version_minor = os_version.split('.') # Get the operating system os = entities.OperatingSystem().search(query=dict( search='family="Redhat" AND major="{0}" AND minor="{1}"'.format( os_version_major, os_version_minor) ))[0].read() # Get the image arch arch = entities.Architecture().search( query=dict(search='name="{0}"'.format(self.rhev_img_arch)) )[0].read() # Get the default org content view content_view = entities.ContentView( name=DEFAULT_CV, organization=self.org).search()[0].read() # Get the org Library lifecycle environment lce = entities.LifecycleEnvironment( name=ENVIRONMENT, organization=self.org).search()[0].read() # Create a new org domain domain = entities.Domain( name='{0}.{1}'.format( gen_string('alpha'), gen_string('alpha', length=3) ).lower(), location=[self.loc], organization=[self.org], ).create() # Create a new Hostgroup host_group = entities.HostGroup( architecture=arch, operatingsystem=os, domain=domain, lifecycle_environment=lce, content_view=content_view, root_pass=gen_string('alphanumeric'), organization=[self.org], location=[self.loc], ).create() with Session(self) as session: parameter_list = [ ['URL', self.rhev_url, 'field'], ['Username', self.rhev_username, 'field'], ['Password', self.rhev_password, 'field'], ['X509 Certification Authorities', self.rhev_cacert, 'field'], ['Datacenter', self.rhev_datacenter, 'special select'], ] make_resource( session, name=cr_name, provider_type=FOREMAN_PROVIDERS['rhev'], parameter_list=parameter_list, orgs=[self.org_name], org_select=True, locations=[self.loc_name], loc_select=True ) parameter_list_img = [ ['Name', image_name], ['Operatingsystem', os.title], ['Architecture', arch.name], ['Username', self.rhev_img_user], ['Password', self.rhev_img_pass], ['uuid', self.rhev_img_name], ] self.compute_resource.add_image(cr_name, parameter_list_img) self.assertIn( image_name, self.compute_resource.list_images(cr_name) ) self.compute_resource.set_profile_values( cr_name, COMPUTE_PROFILE_SMALL, cluster=self.rhev_datacenter, cores=1, memory=1024, network_interfaces=[ dict( name='nic1', network=settings.vlan_networking.bridge, ), ], storage=[ dict( size='10', storage_domain=self.rhev_storage_domain, bootable=True, preallocate_disk=True, ), ] ) host_parameters_list = [ ['Host', 'Organization', self.org_name], ['Host', 'Location', self.loc_name], ['Host', 'Host group', host_group.name], ['Host', 'Deploy on', cr_resource], ['Host', 'Compute profile', COMPUTE_PROFILE_SMALL], ['Operating System', 'Operating System', os.title], ['Operating System', 'Root password', root_pwd], ] make_host( session, name=host_name, org=self.org_name, loc=self.loc_name, parameters_list=host_parameters_list, provisioning_method='image', ) vm_host_name = '{0}.{1}'.format( host_name.lower(), domain.name) # the provisioning take some time to finish, when done will be # redirected to the created host # wait until redirected to host page self.assertIsNotNone( session.hosts.wait_until_element( locators["host.host_page_title"] % vm_host_name, timeout=60 ) ) host_properties = session.hosts.get_host_properties( vm_host_name, ['status', 'build']) self.assertTrue(host_properties) self.assertEqual(host_properties['status'], 'OK') self.assertEqual(host_properties['build'], 'Installed') # Query RHEV hypervisor for vm description vm_host = entities.Host().search( query=dict(search='name="{0}"'.format(vm_host_name)) )[0] # Using documented RHEV API access response = client.get( '{0}/vms/{1}'.format(self.rhev_url, vm_host.uuid), verify=False, auth=(self.rhev_username, self.rhev_password), headers={'Accept': 'application/json'} ) self.assertTrue(response.status_code, 200) # The VM os type looks like "rhev_<os_major>x<arch_bits>" # eg: for RHEL 7 with arch x86_64 the os type key looks like: # "rhel_7x64" self.assertEqual( response.json()['os']['type'], 'rhel_{0}x{1}'.format(os.major, arch.name.split('_')[-1]) )
def test_positive_provision_rhev_with_image(self): """ Provision a host on rhev compute resource with image based :id: 80abd6b1-31cd-4f3e-949c-f1ca608d0bbb :setup: rhev hostname and credentials. 1. Configured subnet for provisioning of the host. 2. Configured domains for the host. 3. Population of images into satellite from rhev templates. 4. Activation key and CV for the host. :steps: 1. Go to "Hosts --> New host". 2. Fill in the required details.(eg name,loc, org). 3. Select rhev compute resource from "Deploy on" drop down. 4. Associate appropriate feature capsules. 5. Go to "operating system tab". 6. Edit Provisioning Method to image based. 7. Select the appropriate image . 8. Associate the activation key and submit. :expectedresults: The host should be provisioned successfully :CaseAutomation: Automated """ hostname = gen_string('alpha', 9) cr_name = gen_string('alpha', 9) img_name = gen_string('alpha', 5) root_pwd = gen_string('alpha', 15) with Session(self) as session: parameter_list = [ ['URL', self.rhev_url, 'field'], ['Username', self.rhev_username, 'field'], ['Password', self.rhev_password, 'field'], ['Datacenter', self.rhev_datacenter, 'special select'], ] make_resource(session, name=cr_name, provider_type=FOREMAN_PROVIDERS['rhev'], parameter_list=parameter_list, orgs=[self.org_name], org_select=True, locations=[self.loc_name], loc_select=True) parameter_list_img = [ ['Name', img_name], ['Operatingsystem', self.rhev_img_os], ['Architecture', self.rhev_img_arch], ['Username', self.rhev_img_user], ['Password', self.rhev_img_pass], ['uuid', self.rhev_img_name], ] self.compute_resource.add_image(cr_name, parameter_list_img) imgs = self.compute_resource.list_images(cr_name) self.assertTrue(img_name in imgs) self.compute_resource.set_profile_values( cr_name, COMPUTE_PROFILE_LARGE, cluster=self.rhev_datacenter, cores=2, memory=1024, image=self.rhev_img_name, network_interfaces=[ dict(name='nic1', network=settings.vlan_networking.bridge), ], storage=[ dict(size='10', storage_domain=self.rhev_storage_domain, bootable=True, preallocate_disk=False), ]) make_host( session, name=hostname, org=ANY_CONTEXT['org'], loc=self.loc_name, parameters_list=[ ['Host', 'Organization', self.org_name], ['Host', 'Location', self.loc_name], ['Host', 'Host group', self.config_env['host_group']], ['Host', 'Deploy on', cr_name], ['Host', 'Compute profile', COMPUTE_PROFILE_LARGE], [ 'Host', 'Puppet Environment', self.config_env['environment'] ], ['Operating System', 'Operating System', self.rhev_img_os], [ 'Operating System', 'Partition table', self.config_env['ptable'] ], ['Operating System', 'PXE loader', 'PXELinux BIOS'], ['Operating System', 'Root password', root_pwd], ], provisioning_method='network') self.assertIsNotNone( self.hosts.search(u'{0}.{1}'.format( hostname.lower(), self.config_env['domain']))) host_ip = entities.Host().search( query={ 'search': 'name={0}.{1} and organization="{3}"'.format( hostname.lower(), self.config_env['domain'], self.org_name) })[0].read().ip with self.assertNotRaises(ProvisioningCheckError): self.compute_resource.host_provisioning_check(host_ip)
def test_positive_provision_rhev_with_custom_compute_settings(self): """ Provision a host on rhev compute resource with custom disk, cpu count and memory :id: a972c095-7567-4bb0-86cb-9bd835fed7b7 :setup: rhev hostname ,credentials and provisioning setup. :steps: 1. Go to "Hosts --> New host". 2. Fill in the required details.(eg name,loc, org). 3. Select rhev custom compute resource from "Deploy on" drop down. 4. Select the custom compute profile" with custom disk size, cpu count and memory. 5. Provision the host using the compute profile. :expectedresults: The host should be provisioned with custom settings :CaseAutomation: Automated """ hostname = gen_string('alpha', 9) cr_name = gen_string('alpha', 9) root_pwd = gen_string('alpha', 15) with Session(self) as session: parameter_list = [ ['URL', self.rhev_url, 'field'], ['Username', self.rhev_username, 'field'], ['Password', self.rhev_password, 'field'], ['Datacenter', self.rhev_datacenter, 'special select'], ] make_resource(session, name=cr_name, provider_type=FOREMAN_PROVIDERS['rhev'], parameter_list=parameter_list, orgs=[self.org_name], org_select=True, locations=[self.loc_name], loc_select=True) self.compute_resource.set_profile_values( cr_name, COMPUTE_PROFILE_LARGE, cluster=self.rhev_datacenter, cores=2, memory=2024, network_interfaces=[ dict(name='nic1', network=settings.vlan_networking.bridge), dict(name='nic2', network=settings.vlan_networking.bridge), ], storage=[ dict(size='10', storage_domain=self.rhev_storage_domain, bootable=False, preallocate_disk=True), dict(size='20', storage_domain=self.rhev_storage_domain, bootable=False, preallocate_disk=False) ]) make_host( session, name=hostname, org=ANY_CONTEXT['org'], loc=self.loc_name, parameters_list=[ ['Host', 'Organization', self.org_name], ['Host', 'Location', self.loc_name], ['Host', 'Host group', self.config_env['host_group']], ['Host', 'Deploy on', cr_name], ['Host', 'Compute profile', COMPUTE_PROFILE_LARGE], [ 'Host', 'Puppet Environment', self.config_env['environment'] ], ['Operating System', 'Operating System', self.rhev_img_os], [ 'Operating System', 'Partition table', self.config_env['ptable'] ], ['Operating System', 'PXE loader', 'PXELinux BIOS'], ['Operating System', 'Root password', root_pwd], ], provisioning_method='network') self.assertIsNotNone( self.hosts.search(u'{0}.{1}'.format( hostname.lower(), self.config_env['domain']))) host_ip = entities.Host().search( query={ 'search': 'name={0}.{1} and organization="{3}"'.format( hostname.lower(), self.config_env['domain'], self.org_name) })[0].read().ip with self.assertNotRaises(ProvisioningCheckError): self.compute_resource.host_provisioning_check(host_ip)
def test_positive_provision_rhev_with_compute_profile(self): """ Provision a host on rhev compute resource with compute profile default (3-Large) :id: fe4a05ef-d548-4c28-80d0-d17851fb4b03 :setup: rhev hostname ,credentials and provisioning setup. :steps: 1. Go to "Hosts --> New host". 2. Fill in the required details.(eg name,loc, org). 3. Select rhev compute resource from "Deploy on" drop down. 4. Select the "Compute profile" from the drop down. 5. Provision the host using the compute profile. :expectedresults: The host should be provisioned successfully :CaseAutomation: Automated """ hostname = gen_string('alpha', 9) cr_name = gen_string('alpha', 9) root_pwd = gen_string('alpha', 15) with Session(self) as session: parameter_list = [ ['URL', self.rhev_url, 'field'], ['Username', self.rhev_username, 'field'], ['Password', self.rhev_password, 'field'], ['Datacenter', self.rhev_datacenter, 'special select'], ] make_resource( session, name=cr_name, provider_type=FOREMAN_PROVIDERS['rhev'], parameter_list=parameter_list, orgs=[self.org_name], org_select=True, locations=[self.loc_name], loc_select=True ) self.compute_resource.set_profile_values( cr_name, COMPUTE_PROFILE_LARGE, cluster=self.rhev_datacenter, cores=2, memory=1024, network_interfaces=[ dict( name='nic1', network=settings.vlan_networking.bridge ), ], storage=[ dict( size='10', storage_domain=self.rhev_storage_domain, bootable=True, preallocate_disk=False ), ] ) make_host( session, name=hostname, org=ANY_CONTEXT['org'], loc=self.loc_name, parameters_list=[ ['Host', 'Organization', self.org_name], ['Host', 'Location', self.loc_name], ['Host', 'Host group', self.config_env['host_group']], ['Host', 'Deploy on', cr_name], ['Host', 'Compute profile', COMPUTE_PROFILE_LARGE], ['Host', 'Puppet Environment', self.config_env['environment']], ['Operating System', 'Operating System', self.rhev_img_os], ['Operating System', 'Partition table', self.config_env['ptable']], ['Operating System', 'PXE loader', 'PXELinux BIOS'], ['Operating System', 'Root password', root_pwd], ], provisioning_method='network' ) self.assertIsNotNone(self.hosts.search( u'{0}.{1}'.format(hostname.lower(), self.config_env['domain'] ))) host_ip = entities.Host().search(query={ 'search': 'name={0}.{1} and organization="{3}"'.format( hostname.lower(), self.config_env['domain'], self.org_name) })[0].read().ip with self.assertNotRaises(ProvisioningCheckError): self.compute_resource.host_provisioning_check(host_ip)
def test_positive_check_provisioned_rhev_os(self): """Provision a host on rhev compute resource and check the hypervisor provisioned VM os type. :id: 97f66fca-50b4-42bc-b187-3b846f03ab76 :customerscenario: true :steps: 1. Prepare an RHEV compute resource. 2. Create an image. 3. Select the custom compute profile" with custom disk size, cpu count and memory. 4. Go to "Hosts --> New host". 5. Provision the host using the compute profile. 6. Check RHEV hypervisor VM OS type. :expectedresults: Hypervisor VM OS type must be the same as the one used in provisioning. :CaseAutomation: Automated :BZ: 1315281 :CaseLevel: System """ host_name = gen_string('alpha').lower() cr_name = gen_string('alpha') cr_resource = RHEV_CR % cr_name image_name = gen_string('alpha') root_pwd = gen_string('alpha') # rhev_img_os is like "RedHat 7.4" # eg: "<os_family <os_major>.<os_minor>" _, os_version = self.rhev_img_os.split(' ') os_version_major, os_version_minor = os_version.split('.') # Get the operating system os = entities.OperatingSystem().search(query=dict( search='family="Redhat" AND major="{0}" AND minor="{1}"'.format( os_version_major, os_version_minor)))[0].read() # Get the image arch arch = entities.Architecture().search(query=dict( search='name="{0}"'.format(self.rhev_img_arch)))[0].read() # Get the default org content view content_view = entities.ContentView( name=DEFAULT_CV, organization=self.org).search()[0].read() # Get the org Library lifecycle environment lce = entities.LifecycleEnvironment( name=ENVIRONMENT, organization=self.org).search()[0].read() # Create a new org domain domain = entities.Domain( name='{0}.{1}'.format(gen_string('alpha'), gen_string('alpha', length=3)).lower(), location=[self.loc], organization=[self.org], ).create() # Create a new Hostgroup host_group = entities.HostGroup( architecture=arch, operatingsystem=os, domain=domain, lifecycle_environment=lce, content_view=content_view, root_pass=gen_string('alphanumeric'), organization=[self.org], location=[self.loc], ).create() with Session(self) as session: parameter_list = [ ['URL', self.rhev_url, 'field'], ['Username', self.rhev_username, 'field'], ['Password', self.rhev_password, 'field'], ['X509 Certification Authorities', self.rhev_cacert, 'field'], ['Datacenter', self.rhev_datacenter, 'special select'], ] make_resource(session, name=cr_name, provider_type=FOREMAN_PROVIDERS['rhev'], parameter_list=parameter_list, orgs=[self.org_name], org_select=True, locations=[self.loc_name], loc_select=True) parameter_list_img = [ ['Name', image_name], ['Operatingsystem', os.title], ['Architecture', arch.name], ['Username', self.rhev_img_user], ['Password', self.rhev_img_pass], ['uuid', self.rhev_img_name], ] self.compute_resource.add_image(cr_name, parameter_list_img) self.assertIn(image_name, self.compute_resource.list_images(cr_name)) self.compute_resource.set_profile_values( cr_name, COMPUTE_PROFILE_SMALL, cluster=self.rhev_datacenter, cores=1, memory=1024, network_interfaces=[ dict( name='nic1', network=settings.vlan_networking.bridge, ), ], storage=[ dict( size='10', storage_domain=self.rhev_storage_domain, bootable=True, preallocate_disk=True, ), ]) host_parameters_list = [ ['Host', 'Organization', self.org_name], ['Host', 'Location', self.loc_name], ['Host', 'Host group', host_group.name], ['Host', 'Deploy on', cr_resource], ['Host', 'Compute profile', COMPUTE_PROFILE_SMALL], ['Operating System', 'Operating System', os.title], ['Operating System', 'Root password', root_pwd], ] make_host( session, name=host_name, org=self.org_name, loc=self.loc_name, parameters_list=host_parameters_list, provisioning_method='image', ) vm_host_name = '{0}.{1}'.format(host_name.lower(), domain.name) # the provisioning take some time to finish, when done will be # redirected to the created host # wait until redirected to host page self.assertIsNotNone( session.hosts.wait_until_element( locators["host.host_page_title"] % vm_host_name, timeout=60)) host_properties = session.hosts.get_host_properties( vm_host_name, ['status', 'build']) self.assertTrue(host_properties) self.assertEqual(host_properties['status'], 'OK') self.assertEqual(host_properties['build'], 'Installed') # Query RHEV hypervisor for vm description vm_host = entities.Host().search(query=dict( search='name="{0}"'.format(vm_host_name)))[0] # Using documented RHEV API access response = client.get('{0}/vms/{1}'.format(self.rhev_url, vm_host.uuid), verify=False, auth=(self.rhev_username, self.rhev_password), headers={'Accept': 'application/json'}) self.assertTrue(response.status_code, 200) # The VM os type looks like "rhev_<os_major>x<arch_bits>" # eg: for RHEL 7 with arch x86_64 the os type key looks like: # "rhel_7x64" self.assertEqual( response.json()['os']['type'], 'rhel_{0}x{1}'.format(os.major, arch.name.split('_')[-1]))