1#!/usr/bin/python
2
3r"""
4Contains xpaths and related string constants applicable to all openBMC GUI
5menus.
6"""
7
8
9class resource_variables():
10
11    xpath_textbox_hostname = "//input[@id='host']"
12    xpath_textbox_username = "//input[@id='username']"
13    xpath_textbox_password = "//input[@id='password']"
14    xpath_button_login = "//*[@id='login__submit']"
15    xpath_button_logout = '//a[contains(text(), "Log out")]'
16    xpath_yes_button = "//button[text()='Yes']"
17    xpath_power_indicator = "//*[@id='power-indicator-bar']"
18    xpath_select_button_power_on = "//*[@id='power__power-on']"
19    xpath_cancel_button = "//button[contains(text(),'Cancel')]"
20    xpath_save_setting_button = "//button[contains(text(),'Save settings')]"
21
22    xpath_select_button_warm_reboot = \
23        "//*[@id='power__warm-boot']"
24    xpath_operation_warning_message = \
25        "//*[@class='inline__confirm active']"
26    text_warm_reboot_warning_message = "warm reboot?"
27    xpath_select_button_warm_reboot_yes = \
28        "//*[@id='power-operations']" \
29        "/div[3]/div[3]/confirm/div/div[2]/button[1]"
30
31    xpath_select_button_cold_reboot = \
32        "//*[@id='power__cold-boot']"
33    text_cold_reboot_warning_message = "cold reboot?"
34    xpath_select_button_cold_reboot_yes = \
35        "//*[@id='power-operations']" \
36        "/div[3]/div[4]/confirm/div/div[2]/button[2]"
37
38    xpath_select_button_orderly_shutdown = \
39        "//*[@id='power__soft-shutdown']"
40    xpath_select_button_orderly_shutdown_button_no = \
41        "//*[@id='power-operations']/div[3]/div[5]"\
42        "/confirm/div/div[2]/button[2]"
43    text_orderly_shutdown_warning_message = "orderly shutdown?"
44    xpath_select_button_orderly_shutdown_yes = \
45        "//*[@id='power-operations']/div[3]/div[5]" \
46        "/confirm/div/div[2]/button[1]"
47
48    xpath_select_button_immediate_shutdown = \
49        "//*[@id='power__hard-shutdown']"
50    text_immediate_shutdown_warning_message = "immediate shutdown?"
51    xpath_select_button_immediate_shutdown_yes = \
52        "//*[@id='power-operations']/div[3]/div[6]" \
53        "/confirm/div/div[2]/button[1]"
54
55    obmc_off_state = "Off"
56    obmc_standby_state = "Standby"
57    obmc_running_state = "Running"
58
59    # xpath for main menu.
60    xpath_select_server_control = "//button[contains(@class,'btn-control')]"
61    xpath_select_server_configuration = "//button[contains(@class,'btn-config')]"
62
63    # xpath for sub main menu.
64    xpath_select_server_power_operations = "//a[@href='#/server-control/power-operations']"
65    xpath_select_snmp_settings = "//a[@href='#/configuration/snmp']"
66    xpath_select_manage_power_usage = "//a[@href='#/server-control/power-usage']"
67    xpath_select_virtual_media = "//a[@href='#/server-control/virtual-media']"
68    xpath_select_sol_console = "//a[@href='#/server-control/remote-console']"
69    xpath_select_reboot_bmc = "//a[@href='#/server-control/bmc-reboot']"
70    xpath_select_ldap = "//a[@href='#/access-control/ldap']"
71    xpath_select_server_health = "//a[@href='#/server-health/event-log']"
72    xpath_select_server_led = "//a[@href='#/server-control/server-led']"
73
74    # GUI header elements locators.
75    xpath_select_server_power = "//a[@href='#/server-control/power-operations']"
76
77    # Server health elements locators.
78    xpath_select_refresh_button = \
79        "//*[contains(text(),'Refresh')]"
80    xpath_event_severity_all = "//*[text()='Filter by severity']/following-sibling::button[1]"
81    xpath_event_severity_high = "//*[text()='Filter by severity']/following-sibling::button[2]"
82    xpath_event_severity_medium = "//*[text()='Filter by severity']/following-sibling::button[3]"
83    xpath_event_severity_low = "//*[text()='Filter by severity']/following-sibling::button[4]"
84    xpath_drop_down_timezone_edt = \
85        "//*[@id='event-log']/section[1]/div/div/button"
86    xpath_refresh_circle = "/html/body/main/loader/div[1]/svg/circle"
87    xpath_drop_down_timezone_utc =  \
88        "//*[@id='event-log']/section[1]/div/div/ul/li[2]/button"
89    xpath_event_filter_all = "//*[text()='All events']"
90    xpath_event_filter_resolved = "//*[text()='Resolved events']"
91    xpath_event_filter_unresolved = "//*[text()='Unresolved events']"
92    xpath_event_action_bars = \
93        "//*[@id='event__actions-bar']/div[1]/label/span"
94    xpath_event_action_delete = \
95        "//*[@id='event__actions-bar']/div[2]/div[2]/button[1]"
96    xpath_event_action_export = \
97        "//*[@id='event__actions-bar']/div[2]/div[2]/a"
98    xpath_number_of_events = \
99        "//*[@id='event__actions-bar']/div[2]/p[2]/span"
100    xpath_mark_as_resolved = \
101        "//*[@id='event__actions-bar']/div[2]/div[2]/button[2]"
102    xpath_events_export = "//*[@id='event__actions-bar']/div[2]/div[2]/a"
103    xpath_individual_event_select = "(//*[@class='control__indicator'])[2]"
104    xpath_individual_event_delete = \
105        "//*[@id='event__actions-bar']/div[2]/div[2]/button[1]"
106    xpath_second_event_select = "(//*[@class='control__indicator'])[3]"
107    xpath_individual_event_resolved = \
108        "//*[@id='event__actions-bar']/div[2]/div[2]/button[2]"
109    xpath_individual_event_export = \
110        "//*[@id='event__actions-bar']/div[2]/div[2]/a"
111    xpath_select_all_events = "(//*[@class='control__indicator'])[1]"
112