Skip to content

Commit

Permalink
Add Virtcard entity (#869)
Browse files Browse the repository at this point in the history
* Rework virtcard to match RHV type

* Rework card to use VMware, and not RHEV

* Rework model to use VMware, adjust import_vm helper method

* Add sleep to give time for virt card to display

* Add duplicate call and sleep to attempt to increase change of reading card

* Remove sleep, see if navigating twice is enough

(cherry picked from commit 2715666)
  • Loading branch information
sambible authored and web-flow committed Jun 28, 2023
1 parent 03d1201 commit cb48b25
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
6 changes: 5 additions & 1 deletion airgun/entities/computeresource.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,13 @@ def vm_poweroff(self, entity_name, vm_name):
if vm['Power'].widget.read() == 'On':
vm['Actions'].widget.click(handle_alert=True)

def vm_import(self, entity_name, vm_name, hostgroup, location):
def vm_import(self, entity_name, vm_name, hostgroup, location, org=None, name=None):
"""Imports the specified VM"""
view = self.navigate_to(self, 'VMImport', entity_name=entity_name, vm_name=vm_name)
if name:
view.fill({'host.name': name})
if org:
view.fill({'host.organization': org})
view.fill({'host.hostgroup': hostgroup, 'host.location': location})
view.submit.click()

Expand Down
8 changes: 8 additions & 0 deletions airgun/entities/host_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ def get_details(self, entity_name, widget_names=None):
view = self.navigate_to(self, 'NewDetails', entity_name=entity_name)
view.wait_displayed()
self.browser.plugin.ensure_page_safe()
# Run this read twice to navigate to the page and load it before reading
view.read(widget_names=widget_names)
return view.read(widget_names=widget_names)

def edit_system_purpose(
Expand Down Expand Up @@ -462,6 +464,12 @@ def get_parameters(self, entity_name):
self.browser.plugin.ensure_page_safe()
return view.parameters.read()

def get_virtualization(self, entity_name):
view = self.navigate_to(self, 'NewDetails', entity_name=entity_name)
view.wait_displayed()
self.browser.plugin.ensure_page_safe()
return view.details.virtualization.read()

def add_new_parameter(self, entity_name, parameter_name, parameter_type, parameter_value):
"""
Function that adds new parameter to the host
Expand Down
28 changes: 28 additions & 0 deletions airgun/views/host_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,34 @@ class networking_interfaces(Card):
class networking_interface(Card):
pass

@View.nested
class virtualization(Card):
ROOT = './/article[contains(@data-ouia-component-id, "card-template-Virtualization")]'

datacenter = Text('.//div[contains(@class, "pf-c-description-list__group")][1]//dd')
cluster = Text('.//div[contains(@class, "pf-c-description-list__group")][2]//dd')
memory = Text('.//div[contains(@class, "pf-c-description-list__group")][3]//dd')
public_ip_address = Text(
'.//div[contains(@class, "pf-c-description-list__group")][4]//dd'
)
mac_address = Text('.//div[contains(@class, "pf-c-description-list__group")][5]//dd')
cpus = Text('.//div[contains(@class, "pf-c-description-list__group")][6]//dd')
cores_per_socket = Text(
'.//div[contains(@class, "pf-c-description-list__group")][7]//dd'
)
firmware = Text('.//div[contains(@class, "pf-c-description-list__group")][8]//dd')
hypervisor = Text('.//div[contains(@class, "pf-c-description-list__group")][9]//dd')
connection_state = Text(
'.//div[contains(@class, "pf-c-description-list__group")][10]//dd'
)
overall_status = Text(
'.//div[contains(@class, "pf-c-description-list__group")][11]//dd'
)
annotation_notes = Text(
'.//div[contains(@class, "pf-c-description-list__group")][12]//dd'
)
running_on = Text('.//div[contains(@class, "pf-c-description-list__group")][13]//dd')

@View.nested
class content(Tab):
# TODO Setting ROOT is just a workaround because of BZ 2119076,
Expand Down

0 comments on commit cb48b25

Please sign in to comment.