Skip to content

Commit

Permalink
Check Hypervisor host subscription status and hypervisor host and vir…
Browse files Browse the repository at this point in the history
…tual guest mapping in UI (#15288)

* Check Hypervisor host subscription status and hypervisor host and virtual guest mapping in UI

* optimize the duplicated code to method

(cherry picked from commit 8fab3b1)
  • Loading branch information
yanpliu authored and web-flow committed Jun 13, 2024
1 parent 628f04d commit 266b6fa
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 55 deletions.
48 changes: 48 additions & 0 deletions robottelo/utils/virtwho.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
23 changes: 12 additions & 11 deletions tests/foreman/virtwho/ui/test_esx_sca.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand All @@ -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(
Expand Down
23 changes: 12 additions & 11 deletions tests/foreman/virtwho/ui/test_hyperv_sca.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
get_configure_file,
get_configure_id,
get_configure_option,
hypervisor_guest_mapping_check_legacy_ui,
hypervisor_guest_mapping_newcontent_ui,
)


Expand All @@ -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(
Expand Down
23 changes: 12 additions & 11 deletions tests/foreman/virtwho/ui/test_kubevirt_sca.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
get_configure_file,
get_configure_id,
get_configure_option,
hypervisor_guest_mapping_check_legacy_ui,
hypervisor_guest_mapping_newcontent_ui,
)


Expand All @@ -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(
Expand Down
23 changes: 12 additions & 11 deletions tests/foreman/virtwho/ui/test_libvirt_sca.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
get_configure_file,
get_configure_id,
get_configure_option,
hypervisor_guest_mapping_check_legacy_ui,
hypervisor_guest_mapping_newcontent_ui,
)


Expand All @@ -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(
Expand Down
23 changes: 12 additions & 11 deletions tests/foreman/virtwho/ui/test_nutanix_sca.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)


Expand All @@ -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(
Expand Down

0 comments on commit 266b6fa

Please sign in to comment.