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    xpath_select_access_control = "//button[contains(@class,'btn-access-control')]"
63
64    # xpath for sub main menu.
65    xpath_select_server_power_operations = "//a[@href='#/server-control/power-operations']"
66    xpath_select_snmp_settings = "//a[@href='#/configuration/snmp']"
67    xpath_select_manage_power_usage = "//a[@href='#/server-control/power-usage']"
68    xpath_select_virtual_media = "//a[@href='#/server-control/virtual-media']"
69    xpath_select_sol_console = "//a[@href='#/server-control/remote-console']"
70    xpath_select_reboot_bmc = "//a[@href='#/server-control/bmc-reboot']"
71    xpath_select_ldap = "//a[@href='#/access-control/ldap']"
72    xpath_select_server_health = "//a[@href='#/server-health/event-log']"
73    xpath_select_server_led = "//a[@href='#/server-control/server-led']"
74    xpath_select_date_time_settings = "//a[@href='#/configuration/date-time']"
75
76    # GUI header elements locators.
77    xpath_select_server_power = "//a[@href='#/server-control/power-operations']"
78
79    # Server health elements locators.
80    xpath_select_refresh_button = \
81        "//*[contains(text(),'Refresh')]"
82    xpath_event_severity_all = "//*[text()='Filter by severity']/following-sibling::button[1]"
83    xpath_event_severity_high = "//*[text()='Filter by severity']/following-sibling::button[2]"
84    xpath_event_severity_medium = "//*[text()='Filter by severity']/following-sibling::button[3]"
85    xpath_event_severity_low = "//*[text()='Filter by severity']/following-sibling::button[4]"
86    xpath_drop_down_timezone_edt = \
87        "//*[@id='event-log']/section[1]/div/div/button"
88    xpath_refresh_circle = "/html/body/main/loader/div[1]/svg/circle"
89    xpath_drop_down_timezone_utc =  \
90        "//*[@id='event-log']/section[1]/div/div/ul/li[2]/button"
91    xpath_event_filter_all = "//*[text()='All events']"
92    xpath_event_filter_resolved = "//*[text()='Resolved events']"
93    xpath_event_filter_unresolved = "//*[text()='Unresolved events']"
94    xpath_event_action_bars = \
95        "//*[@id='event__actions-bar']/div[1]/label/span"
96    xpath_event_action_delete = \
97        "//*[@id='event__actions-bar']/div[2]/div[2]/button[1]"
98    xpath_event_action_export = \
99        "//*[@id='event__actions-bar']/div[2]/div[2]/a"
100    xpath_number_of_events = \
101        "//*[@id='event__actions-bar']/div[2]/p[2]/span"
102    xpath_mark_as_resolved = \
103        "//*[@id='event__actions-bar']/div[2]/div[2]/button[2]"
104    xpath_events_export = "//*[@id='event__actions-bar']/div[2]/div[2]/a"
105    xpath_individual_event_select = "(//*[@class='control__indicator'])[2]"
106    xpath_individual_event_delete = \
107        "//*[@id='event__actions-bar']/div[2]/div[2]/button[1]"
108    xpath_second_event_select = "(//*[@class='control__indicator'])[3]"
109    xpath_individual_event_resolved = \
110        "//*[@id='event__actions-bar']/div[2]/div[2]/button[2]"
111    xpath_individual_event_export = \
112        "//*[@id='event__actions-bar']/div[2]/div[2]/a"
113    xpath_select_all_events = "(//*[@class='control__indicator'])[1]"
114