def setUpClass(cls): """setup virt-who virtual machine""" super(VirtWhoConfigDeployedTestCase, cls).setUpClass() cls.lce = entities.LifecycleEnvironment( organization=cls.session_org).create() cls.hypervisor_hostname = settings.compute_resources.libvirt_hostname # Create a new virt-who config virt_who_config = make_virt_who_config({ 'organization-id': cls.session_org.id, 'hypervisor-type': VIRT_WHO_HYPERVISOR_TYPES['libvirt'], 'hypervisor-server': 'qemu+ssh://{0}/system'.format( cls.hypervisor_hostname), 'hypervisor-username': '******', }) cls.virt_who_vm = VirtualMachine() cls.virt_who_vm.create() # configure virtual machine and setup virt-who service cls.virt_who_data = virt_who_hypervisor_config( virt_who_config['general-information']['id'], cls.virt_who_vm, org_id=cls.session_org.id, lce_id=cls.lce.id, hypervisor_hostname=cls.hypervisor_hostname, configure_ssh=True, subscription_name=VDC_SUBSCRIPTION_NAME, exec_one_shot=True, ) cls.virt_who_hypervisor_host = entities.Host( id=cls.virt_who_data['virt_who_hypervisor_host']['id']).read()
def setUpClass(cls): """setup virt-who virtual machine""" super(VirtWhoConfigDeployedTestCase, cls).setUpClass() cls.lce = entities.LifecycleEnvironment( organization=cls.session_org).create() cls.hypervisor_hostname = settings.compute_resources.libvirt_hostname # Create a new virt-who config virt_who_config = make_virt_who_config({ 'organization-id': cls.session_org.id, 'hypervisor-type': VIRT_WHO_HYPERVISOR_TYPES['libvirt'], 'hypervisor-server': 'qemu+ssh://{0}/system'.format(cls.hypervisor_hostname), 'hypervisor-username': '******', }) cls.virt_who_vm = VirtualMachine() cls.virt_who_vm.create() # configure virtual machine and setup virt-who service cls.virt_who_data = virt_who_hypervisor_config( virt_who_config['general-information']['id'], cls.virt_who_vm, org_id=cls.session_org.id, lce_id=cls.lce.id, hypervisor_hostname=cls.hypervisor_hostname, configure_ssh=True, subscription_name=VDC_SUBSCRIPTION_NAME, ) cls.virt_who_hypervisor_host = entities.Host( id=cls.virt_who_data['virt_who_hypervisor_host']['id']).read()
def test_positive_virt_who_hypervisor_subscription_status(session): """Check that virt-who hypervisor shows the right subscription status without and with attached subscription. :id: 8b2cc5d6-ac85-463f-a973-f4818c55fb37 :customerscenario: true :expectedresults: 1. With subscription not attached, Subscription status is "Unsubscribed hypervisor" and represented by a yellow icon in content hosts list. 2. With attached subscription, Subscription status is "Fully entitled" and represented by a green icon in content hosts list. :BZ: 1336924 :CaseLevel: System """ org = entities.Organization().create() lce = entities.LifecycleEnvironment(organization=org).create() provisioning_server = settings.compute_resources.libvirt_hostname # Create a new virt-who config virt_who_config = make_virt_who_config({ 'organization-id': org.id, 'hypervisor-type': VIRT_WHO_HYPERVISOR_TYPES['libvirt'], 'hypervisor-server': 'qemu+ssh://{0}/system'.format(provisioning_server), 'hypervisor-username': '******', }) # create a virtual machine to host virt-who service with VirtualMachine() as virt_who_vm: # configure virtual machine and setup virt-who service # do not supply subscription to attach to virt_who hypervisor virt_who_data = virt_who_hypervisor_config( virt_who_config['general-information']['id'], virt_who_vm, org_id=org.id, lce_id=lce.id, hypervisor_hostname=provisioning_server, configure_ssh=True, ) virt_who_hypervisor_host = virt_who_data[ 'virt_who_hypervisor_host'] with session: session.organization.select(org.name) assert session.contenthost.search( virt_who_hypervisor_host['name'])[0]['Subscription Status'] == 'yellow' chost = session.contenthost.read(virt_who_hypervisor_host['name']) assert chost['details']['subscription_status'] == 'Unsubscribed hypervisor' session.contenthost.add_subscription( virt_who_hypervisor_host['name'], VDC_SUBSCRIPTION_NAME) assert session.contenthost.search( virt_who_hypervisor_host['name'])[0]['Subscription Status'] == 'green' chost = session.contenthost.read(virt_who_hypervisor_host['name']) assert chost['details']['subscription_status'] == 'Fully entitled'
def test_positive_view_vdc_guest_subscription_products(session, rhel7_contenthost): """Ensure that Virtual Data Centers guest subscription Provided Products and Content Products are not empty. :id: 4a6f6933-8e26-4c47-b544-a300e11a8454 :customerscenario: true :steps: 1. Upload a manifest with Virtual Datacenters subscription 2. Config a virtual machine virt-who service for a hypervisor 3. Ensure virt-who hypervisor host exist 4. Attach Virtual Datacenters subscription to the virt-who hypervisor 5. Go to Content -> Red Hat Subscription 6. Select Virtual Datacenters subscription with type Guests of virt-who hypervisor :expectedresults: 1. The Virtual Data Centers guests subscription Provided Products is not empty and one of the provided products exist 2. The Virtual Data Centers guests subscription Product Content is not empty and one of the consumed products exist :BZ: 1395788, 1506636, 1487317 :CaseLevel: System """ org = entities.Organization().create() lce = entities.LifecycleEnvironment(organization=org).create() provisioning_server = settings.compute_resources.libvirt_hostname rh_product_repository = RHELAnsibleEngineRepository(cdn=True) product_name = rh_product_repository.data['product'] # Create a new virt-who config virt_who_config = make_virt_who_config({ 'organization-id': org.id, 'hypervisor-type': VIRT_WHO_HYPERVISOR_TYPES['libvirt'], 'hypervisor-server': f'qemu+ssh://{provisioning_server}/system', 'hypervisor-username': '******', }) # configure virtual machine and setup virt-who service virt_who_data = rhel7_contenthost.virt_who_hypervisor_config( virt_who_config['general-information']['id'], org_id=org.id, lce_id=lce.id, hypervisor_hostname=provisioning_server, configure_ssh=True, subscription_name=VDC_SUBSCRIPTION_NAME, extra_repos=[rh_product_repository.data], ) virt_who_hypervisor_host = virt_who_data['virt_who_hypervisor_host'] with session: session.organization.select(org.name) # ensure that VDS subscription is assigned to virt-who hypervisor content_hosts = session.contenthost.search( f'subscription_name = "{VDC_SUBSCRIPTION_NAME}" ' f'and name = "{virt_who_hypervisor_host["name"]}"') assert content_hosts and content_hosts[0][ 'Name'] == virt_who_hypervisor_host['name'] # ensure that hypervisor guests subscription provided products list is not empty and # that the product is in provided products. provided_products = session.subscription.provided_products( VDC_SUBSCRIPTION_NAME, virt_who=True) assert product_name in provided_products # ensure that hypervisor guests subscription content products list is not empty and # that product is in content products. content_products = session.subscription.content_products( VDC_SUBSCRIPTION_NAME, virt_who=True) assert product_name in content_products
def test_positive_view_VDC_guest_subscription_products(self): """Ensure that Virtual Data Centers guest subscription Provided Products and Content Products are not empty. :id: 4a6f6933-8e26-4c47-b544-a300e11a8454 :customerscenario: true :steps: 1. Upload a manifest with Virtual Datacenters subscription 2. Config a virtual machine virt-who service for a hypervisor 3. Ensure virt-who hypervisor host exist 4. Attach Virtual Datacenters subscription to the virt-who hypervisor 5. Go to Content -> Red Hat Subscription 6. Select Virtual Datacenters subscription with type Guests of virt-who hypervisor :expectedresults: 1. The Virtual Data Centers guests subscription Provided Products is not empty and one of the provided products exist 2. The Virtual Data Centers guests subscription Product Content is not empty and one of the consumed products exist :BZ: 1395788, 1506636, 1487317 :CaseLevel: System """ # create a new organization and lifecycle environment org = entities.Organization().create() lce = entities.LifecycleEnvironment(organization=org).create() provisioning_server = settings.compute_resources.libvirt_hostname # Create a new virt-who config virt_who_config = make_virt_who_config({ 'organization-id': org.id, 'hypervisor-type': VIRT_WHO_HYPERVISOR_TYPES['libvirt'], 'hypervisor-server': 'qemu+ssh://{0}/system'.format(provisioning_server), 'hypervisor-username': '******', }) # create a virtual machine to host virt-who service with VirtualMachine() as virt_who_vm: # configure virtual machine and setup virt-who service virt_who_data = virt_who_hypervisor_config( virt_who_config['general-information']['id'], virt_who_vm, org_id=org.id, lce_id=lce.id, hypervisor_hostname=provisioning_server, configure_ssh=True, subscription_name=VDC_SUBSCRIPTION_NAME, ) virt_who_hypervisor_host = virt_who_data[ 'virt_who_hypervisor_host'] # RHEL is a content product in this organization (as per virt-who # config setup) and also provided by Virtual datacenters # subscription then it must exist in provided and content products rhel_product_name = PRDS['rhel'] with Session(self) as session: set_context(session, org=org.name) # ensure that VDS subscription is assigned to virt-who # hypervisor self.contenthost.search_and_click( virt_who_hypervisor_host['name']) self.contenthost.click( tab_locators['contenthost.tab_subscriptions']) self.contenthost.click( tab_locators['contenthost.tab_subscriptions_subscriptions'] ) self.assertIsNotNone( self.contenthost.wait_until_element( locators['contenthost.subscription_select'] % VDC_SUBSCRIPTION_NAME)) # ensure that hypervisor guests subscription provided products # is not empty provided_prd = self.subscriptions.get_guests_provided_products( VDC_SUBSCRIPTION_NAME, virt_who_hypervisor_host['name']) self.assertGreater(len(provided_prd), 0) self.assertIn(rhel_product_name, provided_prd) # ensure that hypervisor guests subscription content products # is not empty content_prd = self.subscriptions.get_guests_content_products( VDC_SUBSCRIPTION_NAME, virt_who_hypervisor_host['name']) self.assertGreater(len(content_prd), 0) self.assertIn(rhel_product_name, content_prd)
def test_positive_view_VDC_guest_subscription_products(self): """Ensure that Virtual Data Centers guest subscription Provided Products and Content Products are not empty. :id: 4a6f6933-8e26-4c47-b544-a300e11a8454 :customerscenario: true :steps: 1. Upload a manifest with Virtual Datacenters subscription 2. Config a virtual machine virt-who service for a hypervisor 3. Ensure virt-who hypervisor host exist 4. Attach Virtual Datacenters subscription to the virt-who hypervisor 5. Go to Content -> Red Hat Subscription 6. Select Virtual Datacenters subscription with type Guests of virt-who hypervisor :expectedresults: 1. The Virtual Data Centers guests subscription Provided Products is not empty and one of the provided products exist 2. The Virtual Data Centers guests subscription Product Content is not empty and one of the consumed products exist :BZ: 1395788, 1506636, 1487317 :CaseLevel: System """ # create a new organization and lifecycle environment org = entities.Organization().create() lce = entities.LifecycleEnvironment(organization=org).create() provisioning_server = settings.compute_resources.libvirt_hostname # Create a new virt-who config virt_who_config = make_virt_who_config({ 'organization-id': org.id, 'hypervisor-type': VIRT_WHO_HYPERVISOR_TYPES['libvirt'], 'hypervisor-server': 'qemu+ssh://{0}/system'.format( provisioning_server), 'hypervisor-username': '******', }) # create a virtual machine to host virt-who service with VirtualMachine() as virt_who_vm: # configure virtual machine and setup virt-who service virt_who_data = virt_who_hypervisor_config( virt_who_config['general-information']['id'], virt_who_vm, org_id=org.id, lce_id=lce.id, hypervisor_hostname=provisioning_server, configure_ssh=True, subscription_name=VDC_SUBSCRIPTION_NAME, ) virt_who_hypervisor_host = virt_who_data[ 'virt_who_hypervisor_host'] # RHEL is a content product in this organization (as per virt-who # config setup) and also provided by Virtual datacenters # subscription then it must exist in provided and content products rhel_product_name = PRDS['rhel'] with Session(self) as session: set_context(session, org=org.name) # ensure that VDS subscription is assigned to virt-who # hypervisor self.contenthost.search_and_click( virt_who_hypervisor_host['name']) self.contenthost.click( tab_locators['contenthost.tab_subscriptions']) self.contenthost.click( tab_locators['contenthost.tab_subscriptions_subscriptions'] ) self.assertIsNotNone( self.contenthost.wait_until_element( locators['contenthost.subscription_select'] % VDC_SUBSCRIPTION_NAME) ) # ensure that hypervisor guests subscription provided products # is not empty provided_prd = self.subscriptions.get_guests_provided_products( VDC_SUBSCRIPTION_NAME, virt_who_hypervisor_host['name']) self.assertGreater(len(provided_prd), 0) self.assertIn(rhel_product_name, provided_prd) # ensure that hypervisor guests subscription content products # is not empty content_prd = self.subscriptions.get_guests_content_products( VDC_SUBSCRIPTION_NAME, virt_who_hypervisor_host['name']) self.assertGreater(len(content_prd), 0) self.assertIn(rhel_product_name, content_prd)
def test_positive_view_vdc_guest_subscription_products(session): """Ensure that Virtual Data Centers guest subscription Provided Products and Content Products are not empty. :id: 4a6f6933-8e26-4c47-b544-a300e11a8454 :customerscenario: true :steps: 1. Upload a manifest with Virtual Datacenters subscription 2. Config a virtual machine virt-who service for a hypervisor 3. Ensure virt-who hypervisor host exist 4. Attach Virtual Datacenters subscription to the virt-who hypervisor 5. Go to Content -> Red Hat Subscription 6. Select Virtual Datacenters subscription with type Guests of virt-who hypervisor :expectedresults: 1. The Virtual Data Centers guests subscription Provided Products is not empty and one of the provided products exist 2. The Virtual Data Centers guests subscription Product Content is not empty and one of the consumed products exist :BZ: 1395788, 1506636, 1487317 :CaseLevel: System """ org = entities.Organization().create() lce = entities.LifecycleEnvironment(organization=org).create() provisioning_server = settings.compute_resources.libvirt_hostname rh_product_repository = RHELAnsibleEngineRepository(cdn=True) product_name = rh_product_repository.data['product'] # Create a new virt-who config virt_who_config = make_virt_who_config({ 'organization-id': org.id, 'hypervisor-type': VIRT_WHO_HYPERVISOR_TYPES['libvirt'], 'hypervisor-server': 'qemu+ssh://{0}/system'.format(provisioning_server), 'hypervisor-username': '******', }) # create a virtual machine to host virt-who service with VirtualMachine() as virt_who_vm: # configure virtual machine and setup virt-who service virt_who_data = virt_who_hypervisor_config( virt_who_config['general-information']['id'], virt_who_vm, org_id=org.id, lce_id=lce.id, hypervisor_hostname=provisioning_server, configure_ssh=True, subscription_name=VDC_SUBSCRIPTION_NAME, extra_repos=[rh_product_repository.data] ) virt_who_hypervisor_host = virt_who_data['virt_who_hypervisor_host'] with session: session.organization.select(org.name) # ensure that VDS subscription is assigned to virt-who hypervisor content_hosts = session.contenthost.search( 'subscription_name = "{0}" and name = "{1}"'.format( VDC_SUBSCRIPTION_NAME, virt_who_hypervisor_host['name']) ) assert content_hosts and content_hosts[0]['Name'] == virt_who_hypervisor_host['name'] # ensure that hypervisor guests subscription provided products list is not empty and # that the product is in provided products. provided_products = session.subscription.provided_products( VDC_SUBSCRIPTION_NAME, virt_who=True) assert provided_products and product_name in provided_products # ensure that hypervisor guests subscription content products list is not empty and # that product is in content products. content_products = session.subscription.content_products( VDC_SUBSCRIPTION_NAME, virt_who=True) assert content_products and product_name in content_products