blob: 3c5425f3d36644f96e9aa6ce5f1e45090d3fcb9b [file] [log] [blame]
Steven Sombarfc4d5752017-11-28 11:56:35 -06001*** Settings ***
2Documentation Energy scale base tests.
3
4
5# Test Parameters:
6# OPENBMC_HOST The BMC host name or IP address.
7
8
9Resource ../lib/energy_scale_utils.robot
10Resource ../lib/openbmc_ffdc.robot
Steven Sombarc9b30672018-03-26 14:25:27 -050011Resource ../lib/utils.robot
12Resource ../lib/logging_utils.robot
13Library ../lib/logging_utils.py
Steven Sombarfc4d5752017-11-28 11:56:35 -060014
15
16Suite Setup Suite Setup Execution
17Test Teardown Test Teardown Execution
18
19
Steven Sombarfc4d5752017-11-28 11:56:35 -060020*** Variables ****
21
Steven Sombarc9b30672018-03-26 14:25:27 -050022${over_max_power} 3500
Steven Sombarfc4d5752017-11-28 11:56:35 -060023${max_power} 3050
24${mid_power} 1950
Steven Sombarc9b30672018-03-26 14:25:27 -050025${min_power} 600
Steven Sombarfc4d5752017-11-28 11:56:35 -060026${below_min_power} 499
27${zero_power} 0
Steven Sombarc9b30672018-03-26 14:25:27 -050028# The power limits are documented in
Steven Sombarfc4d5752017-11-28 11:56:35 -060029# open-power/witherspoon-xml/master/witherspoon.xml.
30
31
Steven Sombarfc4d5752017-11-28 11:56:35 -060032*** Test Cases ***
33
34
35Escale Base Test Inactive Monitoring
36 [Documentation] Run base power tests with DCMI power montoring off.
37 [Tags] Escale_Base_Test_Deactive_Monitoring
38
39 Deactivate DCMI Power And Verify
40 Verify Power Limits
41
42
43Escale Base Test Active Monitoring
Steven Sombarc4351022018-01-15 13:47:38 -060044 [Documentation] Run base power tests with DCMI power monitoring on.
Steven Sombarfc4d5752017-11-28 11:56:35 -060045 [Tags] Escale_Base_Test_Active_Monitoring
46
47 Activate DCMI Power And Verify
48 Verify Power Limits
49
50
Steven Sombarc4351022018-01-15 13:47:38 -060051Escale Power Setting Via REST And Verify
52 [Documentation] Set power via REST and check using IPMI.
53 [Tags] Escale_Power_Setting_Via_REST_And_Verify
54
55 # A convenient power level bewtwwn maximum and minimum.
56 ${test_power}= Set Variable 1700
57
58 # Set the power limit via REST.
59 Set DCMI Power Limit Via REST ${test_power}
60
61 # Read the power limit using IPMI.
62 ${power_limit}= Get DCMI Power Limit
63 Should Be True ${power_limit} == ${test_power}
64 ... msg=Reading Power limit with IPMI failed after setting it with REST.
65
66
67Escale Power Setting Via IPMI And Verify
68 [Documentation] Set power via IPMI then check via REST.
69 [Tags] Escale_Power_Setting_Via_IPMI_And_Verify
70
71 # A convenient power level bewtwwn maximum and minimum.
72 ${test_power}= Set Variable 2200
73
74 # Set DCMI Power via IPMI.
75 Set DCMI Power Limit And Verify ${test_power}
76
77 # Read the limit via REST.
78 ${power_limit}= Get DCMI Power Limit Via REST
79 Should Be True ${power_limit} == ${test_power}
80 ... msg=Reading power limit with REST failed after setting it with IPMI.
81
82
83Escale Activation Test Via REST
84 [Documentation] Activate power monitoring via REST then check via IPMI.
85 [Tags] Escale_Activation_Test_Via_REST
86
87 Activate DCMI Power Via REST
88 # Confirm activation state using IPMI.
89 Fail If DCMI Power Is Not Activated
90
91
92Escale Dectivation Test Via REST
93 [Documentation] Deactivate power monitoring via REST and check via IPMI.
94 [Tags] Escale_Deactivation_Test_Via_REST
95
96 Deactivate DCMI Power Via REST
97 # Confirm activation state using IPMI.
98 Fail If DCMI Power Is Not Deactivated
99
Steven Sombarfc4d5752017-11-28 11:56:35 -0600100
101*** Keywords ***
102
103
104Verify Power Limits
105 [Documentation] Set power levels and verify limits.
106
107 Set DCMI Power Limit And Verify ${mid_power}
108 Test Power Limit ${min_power} ${below_min_power}
109 Test Power Limit ${min_power} ${zero_power}
110 Test Power Limit ${max_power} ${over_max_power}
111
Steven Sombarc9b30672018-03-26 14:25:27 -0500112 # There should be one error log entry for each attempt to set
113 # a power limit out of range.
114 ${error_logs}= Get Error Logs
115 ${num_logs}= Get Length ${error_logs}
116 Run Keyword If ${num_logs} != 3 Run Keywords
117 ... Print Error Logs ${error_logs}
118 ... AND Fail msg=Unexpected number of error logs.
119
George Keishingfd0c20a2018-06-18 12:23:51 -0500120 Delete All Error Logs
Steven Sombarc9b30672018-03-26 14:25:27 -0500121
Steven Sombarfc4d5752017-11-28 11:56:35 -0600122
123Test Power Limit
124 [Documentation] Set power and check limit.
125 [Arguments] ${good_power} ${outside_bounds_power}
126
127 # Description of argument(s):
128 # good_power A valid power setting, usually at a limit.
129 # outside_bounds_power A power level that is beyond the limit.
130
131 Set DCMI Power Limit And Verify ${good_power}
132
Steven Sombarc9b30672018-03-26 14:25:27 -0500133 # Attempt set power limit out of range.
134 ${data}= Create Dictionary data=${outside_bounds_power}
135 Write Attribute ${CONTROL_HOST_URI}power_cap PowerCap data=${data}
Steven Sombarfc4d5752017-11-28 11:56:35 -0600136
137
138Suite Setup Execution
139 [Documentation] Do test setup initialization.
140
141 # Save the deactivation/activation setting.
142 ${cmd}= Catenate dcmi power get_limit | grep State
143 ${resp}= Run External IPMI Standard Command ${cmd}
144 # Response is either "Power Limit Active" or "No Active Power Limit".
145 ${initial_deactivation}= Get Count ${resp} No
146 # If deactivated: initial_deactivation = 1, 0 otherwise.
147 Set Suite Variable ${initial_deactivation} children=true
148
149 # Save the power limit setting.
150 ${initial_power_setting}= Get DCMI Power Limit
151 Set Suite Variable ${initial_power_setting} children=true
152
George Keishingfd0c20a2018-06-18 12:23:51 -0500153 Delete All Error Logs
Steven Sombarc9b30672018-03-26 14:25:27 -0500154
Steven Sombarfc4d5752017-11-28 11:56:35 -0600155
156Test Teardown Execution
157 [Documentation] Do the post test teardown.
158
159 FFDC On Test Case Fail
160
Gunnar Mills948e2e22018-03-23 12:54:27 -0500161 # Restore the system's initial power limit setting.
Steven Sombarfc4d5752017-11-28 11:56:35 -0600162 Run Keyword If '${initial_power_setting}' != '${0}'
163 ... Set DCMI Power Limit And Verify ${initial_power_setting}
164
Gunnar Mills948e2e22018-03-23 12:54:27 -0500165 # Restore the system's initial deactivation/activation setting.
Steven Sombarfc4d5752017-11-28 11:56:35 -0600166 Run Keyword If '${initial_deactivation}' == '${1}'
167 ... Deactivate DCMI Power And Verify ELSE Activate DCMI Power And Verify