diff --git a/robottelo/utils/virtwho.py b/robottelo/utils/virtwho.py index a6f638b2f21..279ad2acee2 100644 --- a/robottelo/utils/virtwho.py +++ b/robottelo/utils/virtwho.py @@ -600,3 +600,51 @@ def vw_run_option(option): runcmd('systemctl stop virt-who') runcmd('pkill -9 virt-who') runcmd(f'virt-who -{option}') + + +def hypervisor_guest_mapping_check_legacy_ui( + org_session, form_data_ui, default_location, hypervisor_name, guest_name +): + # Check virt-who config status + assert org_session.virtwho_configure.search(form_data_ui['name'])[0]['Status'] == 'ok' + # Check Hypervisor host subscription status and hypervisor host and virtual guest mapping in Legacy UI + org_session.location.select(default_location.name) + hypervisor_display_name = org_session.contenthost.search(hypervisor_name)[0]['Name'] + hypervisorhost = org_session.contenthost.read_legacy_ui(hypervisor_display_name) + assert hypervisorhost['details']['subscription_status'] == 'Simple Content Access' + assert hypervisorhost['details']['virtual_guest'] == '1 Content Host' + # Check virtual guest subscription status and hypervisor host and virtual guest mapping in Legacy UI + virtualguest = org_session.contenthost.read_legacy_ui(guest_name) + assert virtualguest['details']['subscription_status'] == 'Simple Content Access' + assert virtualguest['details']['virtual_host'] == hypervisor_display_name + + +def hypervisor_guest_mapping_newcontent_ui(org_session, hypervisor_name, guest_name): + hypervisor_display_name = org_session.contenthost.search(hypervisor_name)[0]['Name'] + hypervisorhost_new_overview = org_session.host_new.get_details( + hypervisor_display_name, 'overview' + ) + assert hypervisorhost_new_overview['overview']['host_status']['status_success'] == '2' + # hypervisor host Check details + hypervisorhost_new_detais = org_session.host_new.get_details(hypervisor_display_name, 'details') + assert ( + hypervisorhost_new_detais['details']['system_properties']['sys_properties']['virtual_host'] + == hypervisor_display_name + ) + assert ( + hypervisorhost_new_detais['details']['system_properties']['sys_properties']['name'] + == guest_name + ) + # Check guest overview + guest_new_overview = org_session.host_new.get_details(guest_name, 'overview') + assert guest_new_overview['overview']['host_status']['status_success'] == '2' + # Check guest details + virtualguest_new_detais = org_session.host_new.get_details(guest_name, 'details') + assert ( + virtualguest_new_detais['details']['system_properties']['sys_properties']['virtual_host'] + == hypervisor_display_name + ) + assert ( + virtualguest_new_detais['details']['system_properties']['sys_properties']['name'] + == guest_name + ) diff --git a/tests/foreman/virtwho/ui/test_esx_sca.py b/tests/foreman/virtwho/ui/test_esx_sca.py index 9bbeb9597cd..26731db8d44 100644 --- a/tests/foreman/virtwho/ui/test_esx_sca.py +++ b/tests/foreman/virtwho/ui/test_esx_sca.py @@ -29,6 +29,8 @@ get_configure_id, get_configure_option, get_virtwho_status, + hypervisor_guest_mapping_check_legacy_ui, + hypervisor_guest_mapping_newcontent_ui, restart_virtwho_service, update_configure_option, ) @@ -51,23 +53,22 @@ def test_positive_deploy_configure_by_id_script( 2. No error msg in /var/log/rhsm/rhsm.log 3. Report is sent to satellite 4. Subscription Status set to 'Simple Content Access', and generate mapping in Legacy UI - 5. Config can be deleted + 5. Check Hypervisor host subscription status and hypervisor host and virtual guest mapping in UI + 6. Config can be deleted :CaseImportance: High """ hypervisor_name, guest_name = deploy_type_ui - # Check virt-wh oconfig status + # Check virt-who config status assert org_session.virtwho_configure.search(form_data_ui['name'])[0]['Status'] == 'ok' + # Check Hypervisor host subscription status and hypervisor host and virtual guest mapping in Legacy UI - org_session.location.select(default_location.name) - hypervisor_display_name = org_session.contenthost.search(hypervisor_name)[0]['Name'] - hypervisorhost = org_session.contenthost.read_legacy_ui(hypervisor_display_name) - assert hypervisorhost['details']['subscription_status'] == 'Simple Content Access' - assert hypervisorhost['details']['virtual_guest'] == '1 Content Host' - # Check virtual guest subscription status and hypervisor host and virtual guest mapping in Legacy UI - virtualguest = org_session.contenthost.read_legacy_ui(guest_name) - assert virtualguest['details']['subscription_status'] == 'Simple Content Access' - assert virtualguest['details']['virtual_host'] == hypervisor_display_name + hypervisor_guest_mapping_check_legacy_ui( + org_session, form_data_ui, default_location, hypervisor_name, guest_name + ) + + # Check Hypervisor host subscription status and hypervisor host and virtual guest mapping in UI + hypervisor_guest_mapping_newcontent_ui(org_session, hypervisor_name, guest_name) @pytest.mark.tier2 def test_positive_debug_option( diff --git a/tests/foreman/virtwho/ui/test_hyperv_sca.py b/tests/foreman/virtwho/ui/test_hyperv_sca.py index d0b2062677a..657a84c9d1b 100644 --- a/tests/foreman/virtwho/ui/test_hyperv_sca.py +++ b/tests/foreman/virtwho/ui/test_hyperv_sca.py @@ -18,6 +18,8 @@ get_configure_file, get_configure_id, get_configure_option, + hypervisor_guest_mapping_check_legacy_ui, + hypervisor_guest_mapping_newcontent_ui, ) @@ -36,23 +38,22 @@ def test_positive_deploy_configure_by_id_script( 2. No error msg in /var/log/rhsm/rhsm.log 3. Report is sent to satellite 4. Subscription Status set to 'Simple Content Access', and generate mapping in Legacy UI - 5. Config can be deleted + 5. Check Hypervisor host subscription status and hypervisor host and virtual guest mapping in UI + 6. Config can be deleted :CaseImportance: High """ hypervisor_name, guest_name = deploy_type_ui - # Check virt-wh oconfig status + # Check virt-who config status assert org_session.virtwho_configure.search(form_data_ui['name'])[0]['Status'] == 'ok' + # Check Hypervisor host subscription status and hypervisor host and virtual guest mapping in Legacy UI - org_session.location.select(default_location.name) - hypervisor_display_name = org_session.contenthost.search(hypervisor_name)[0]['Name'] - hypervisorhost = org_session.contenthost.read_legacy_ui(hypervisor_display_name) - assert hypervisorhost['details']['subscription_status'] == 'Simple Content Access' - assert hypervisorhost['details']['virtual_guest'] == '1 Content Host' - # Check virtual guest subscription status and hypervisor host and virtual guest mapping in Legacy UI - virtualguest = org_session.contenthost.read_legacy_ui(guest_name) - assert virtualguest['details']['subscription_status'] == 'Simple Content Access' - assert virtualguest['details']['virtual_host'] == hypervisor_display_name + hypervisor_guest_mapping_check_legacy_ui( + org_session, form_data_ui, default_location, hypervisor_name, guest_name + ) + + # Check Hypervisor host subscription status and hypervisor host and virtual guest mapping in UI + hypervisor_guest_mapping_newcontent_ui(org_session, hypervisor_name, guest_name) @pytest.mark.tier2 def test_positive_hypervisor_id_option( diff --git a/tests/foreman/virtwho/ui/test_kubevirt_sca.py b/tests/foreman/virtwho/ui/test_kubevirt_sca.py index 928243755d5..1696337f804 100644 --- a/tests/foreman/virtwho/ui/test_kubevirt_sca.py +++ b/tests/foreman/virtwho/ui/test_kubevirt_sca.py @@ -18,6 +18,8 @@ get_configure_file, get_configure_id, get_configure_option, + hypervisor_guest_mapping_check_legacy_ui, + hypervisor_guest_mapping_newcontent_ui, ) @@ -36,23 +38,22 @@ def test_positive_deploy_configure_by_id_script( 2. No error msg in /var/log/rhsm/rhsm.log 3. Report is sent to satellite 4. Subscription Status set to 'Simple Content Access', and generate mapping in Legacy UI - 5. Config can be deleted + 5. Check Hypervisor host subscription status and hypervisor host and virtual guest mapping in UI + 6. Config can be deleted :CaseImportance: High """ hypervisor_name, guest_name = deploy_type_ui - # Check virt-wh oconfig status + # Check virt-who config status assert org_session.virtwho_configure.search(form_data_ui['name'])[0]['Status'] == 'ok' + # Check Hypervisor host subscription status and hypervisor host and virtual guest mapping in Legacy UI - org_session.location.select(default_location.name) - hypervisor_display_name = org_session.contenthost.search(hypervisor_name)[0]['Name'] - hypervisorhost = org_session.contenthost.read_legacy_ui(hypervisor_display_name) - assert hypervisorhost['details']['subscription_status'] == 'Simple Content Access' - assert hypervisorhost['details']['virtual_guest'] == '1 Content Host' - # Check virtual guest subscription status and hypervisor host and virtual guest mapping in Legacy UI - virtualguest = org_session.contenthost.read_legacy_ui(guest_name) - assert virtualguest['details']['subscription_status'] == 'Simple Content Access' - assert virtualguest['details']['virtual_host'] == hypervisor_display_name + hypervisor_guest_mapping_check_legacy_ui( + org_session, form_data_ui, default_location, hypervisor_name, guest_name + ) + + # Check Hypervisor host subscription status and hypervisor host and virtual guest mapping in UI + hypervisor_guest_mapping_newcontent_ui(org_session, hypervisor_name, guest_name) @pytest.mark.tier2 def test_positive_hypervisor_id_option( diff --git a/tests/foreman/virtwho/ui/test_libvirt_sca.py b/tests/foreman/virtwho/ui/test_libvirt_sca.py index e0d4d67db7c..61d81245dcd 100644 --- a/tests/foreman/virtwho/ui/test_libvirt_sca.py +++ b/tests/foreman/virtwho/ui/test_libvirt_sca.py @@ -18,6 +18,8 @@ get_configure_file, get_configure_id, get_configure_option, + hypervisor_guest_mapping_check_legacy_ui, + hypervisor_guest_mapping_newcontent_ui, ) @@ -36,23 +38,22 @@ def test_positive_deploy_configure_by_id_script( 2. No error msg in /var/log/rhsm/rhsm.log 3. Report is sent to satellite 4. Subscription Status set to 'Simple Content Access', and generate mapping in Legacy UI - 5. Config can be deleted + 5. Check Hypervisor host subscription status and hypervisor host and virtual guest mapping in UI + 6. Config can be deleted :CaseImportance: High """ hypervisor_name, guest_name = deploy_type_ui - # Check virt-wh oconfig status + # Check virt-who config status assert org_session.virtwho_configure.search(form_data_ui['name'])[0]['Status'] == 'ok' + # Check Hypervisor host subscription status and hypervisor host and virtual guest mapping in Legacy UI - org_session.location.select(default_location.name) - hypervisor_display_name = org_session.contenthost.search(hypervisor_name)[0]['Name'] - hypervisorhost = org_session.contenthost.read_legacy_ui(hypervisor_display_name) - assert hypervisorhost['details']['subscription_status'] == 'Simple Content Access' - assert hypervisorhost['details']['virtual_guest'] == '1 Content Host' - # Check virtual guest subscription status and hypervisor host and virtual guest mapping in Legacy UI - virtualguest = org_session.contenthost.read_legacy_ui(guest_name) - assert virtualguest['details']['subscription_status'] == 'Simple Content Access' - assert virtualguest['details']['virtual_host'] == hypervisor_display_name + hypervisor_guest_mapping_check_legacy_ui( + org_session, form_data_ui, default_location, hypervisor_name, guest_name + ) + + # Check Hypervisor host subscription status and hypervisor host and virtual guest mapping in UI + hypervisor_guest_mapping_newcontent_ui(org_session, hypervisor_name, guest_name) @pytest.mark.tier2 def test_positive_hypervisor_id_option( diff --git a/tests/foreman/virtwho/ui/test_nutanix_sca.py b/tests/foreman/virtwho/ui/test_nutanix_sca.py index e98c9ba809b..3850b5feaeb 100644 --- a/tests/foreman/virtwho/ui/test_nutanix_sca.py +++ b/tests/foreman/virtwho/ui/test_nutanix_sca.py @@ -22,6 +22,8 @@ get_configure_id, get_configure_option, get_hypervisor_ahv_mapping, + hypervisor_guest_mapping_check_legacy_ui, + hypervisor_guest_mapping_newcontent_ui, ) @@ -40,23 +42,22 @@ def test_positive_deploy_configure_by_id_script( 2. No error msg in /var/log/rhsm/rhsm.log 3. Report is sent to satellite 4. Subscription Status set to 'Simple Content Access', and generate mapping in Legacy UI - 5. Config can be deleted + 5. Check Hypervisor host subscription status and hypervisor host and virtual guest mapping in UI + 6. Config can be deleted :CaseImportance: High """ hypervisor_name, guest_name = deploy_type_ui - # Check virt-wh oconfig status + # Check virt-who config status assert org_session.virtwho_configure.search(form_data_ui['name'])[0]['Status'] == 'ok' + # Check Hypervisor host subscription status and hypervisor host and virtual guest mapping in Legacy UI - org_session.location.select(default_location.name) - hypervisor_display_name = org_session.contenthost.search(hypervisor_name)[0]['Name'] - hypervisorhost = org_session.contenthost.read_legacy_ui(hypervisor_display_name) - assert hypervisorhost['details']['subscription_status'] == 'Simple Content Access' - assert hypervisorhost['details']['virtual_guest'] == '1 Content Host' - # Check virtual guest subscription status and hypervisor host and virtual guest mapping in Legacy UI - virtualguest = org_session.contenthost.read_legacy_ui(guest_name) - assert virtualguest['details']['subscription_status'] == 'Simple Content Access' - assert virtualguest['details']['virtual_host'] == hypervisor_display_name + hypervisor_guest_mapping_check_legacy_ui( + org_session, form_data_ui, default_location, hypervisor_name, guest_name + ) + + # Check Hypervisor host subscription status and hypervisor host and virtual guest mapping in UI + hypervisor_guest_mapping_newcontent_ui(org_session, hypervisor_name, guest_name) @pytest.mark.tier2 def test_positive_hypervisor_id_option(