Skip to content

Commit 2715666

Browse files
authored
Add Virtcard entity (#869)
* 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
1 parent 2843179 commit 2715666

File tree

3 files changed

+41
-1
lines changed

3 files changed

+41
-1
lines changed

airgun/entities/computeresource.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,13 @@ def vm_poweroff(self, entity_name, vm_name):
9191
if vm['Power'].widget.read() == 'On':
9292
vm['Actions'].widget.click(handle_alert=True)
9393

94-
def vm_import(self, entity_name, vm_name, hostgroup, location):
94+
def vm_import(self, entity_name, vm_name, hostgroup, location, org=None, name=None):
9595
"""Imports the specified VM"""
9696
view = self.navigate_to(self, 'VMImport', entity_name=entity_name, vm_name=vm_name)
97+
if name:
98+
view.fill({'host.name': name})
99+
if org:
100+
view.fill({'host.organization': org})
97101
view.fill({'host.hostgroup': hostgroup, 'host.location': location})
98102
view.submit.click()
99103

airgun/entities/host_new.py

+8
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ def get_details(self, entity_name, widget_names=None):
4040
view = self.navigate_to(self, 'NewDetails', entity_name=entity_name)
4141
view.wait_displayed()
4242
self.browser.plugin.ensure_page_safe()
43+
# Run this read twice to navigate to the page and load it before reading
44+
view.read(widget_names=widget_names)
4345
return view.read(widget_names=widget_names)
4446

4547
def edit_system_purpose(
@@ -462,6 +464,12 @@ def get_parameters(self, entity_name):
462464
self.browser.plugin.ensure_page_safe()
463465
return view.parameters.read()
464466

467+
def get_virtualization(self, entity_name):
468+
view = self.navigate_to(self, 'NewDetails', entity_name=entity_name)
469+
view.wait_displayed()
470+
self.browser.plugin.ensure_page_safe()
471+
return view.details.virtualization.read()
472+
465473
def add_new_parameter(self, entity_name, parameter_name, parameter_type, parameter_value):
466474
"""
467475
Function that adds new parameter to the host

airgun/views/host_new.py

+28
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,34 @@ class networking_interfaces(Card):
344344
class networking_interface(Card):
345345
pass
346346

347+
@View.nested
348+
class virtualization(Card):
349+
ROOT = './/article[contains(@data-ouia-component-id, "card-template-Virtualization")]'
350+
351+
datacenter = Text('.//div[contains(@class, "pf-c-description-list__group")][1]//dd')
352+
cluster = Text('.//div[contains(@class, "pf-c-description-list__group")][2]//dd')
353+
memory = Text('.//div[contains(@class, "pf-c-description-list__group")][3]//dd')
354+
public_ip_address = Text(
355+
'.//div[contains(@class, "pf-c-description-list__group")][4]//dd'
356+
)
357+
mac_address = Text('.//div[contains(@class, "pf-c-description-list__group")][5]//dd')
358+
cpus = Text('.//div[contains(@class, "pf-c-description-list__group")][6]//dd')
359+
cores_per_socket = Text(
360+
'.//div[contains(@class, "pf-c-description-list__group")][7]//dd'
361+
)
362+
firmware = Text('.//div[contains(@class, "pf-c-description-list__group")][8]//dd')
363+
hypervisor = Text('.//div[contains(@class, "pf-c-description-list__group")][9]//dd')
364+
connection_state = Text(
365+
'.//div[contains(@class, "pf-c-description-list__group")][10]//dd'
366+
)
367+
overall_status = Text(
368+
'.//div[contains(@class, "pf-c-description-list__group")][11]//dd'
369+
)
370+
annotation_notes = Text(
371+
'.//div[contains(@class, "pf-c-description-list__group")][12]//dd'
372+
)
373+
running_on = Text('.//div[contains(@class, "pf-c-description-list__group")][13]//dd')
374+
347375
@View.nested
348376
class content(Tab):
349377
# TODO Setting ROOT is just a workaround because of BZ 2119076,

0 commit comments

Comments
 (0)