| George Keishing | cae6e90 | 2017-09-07 13:35:59 -0500 | [diff] [blame] | 1 | *** Settings *** | 
|  | 2 | Documentation  Open power domain keywords. | 
|  | 3 |  | 
| George Keishing | 7e825d8 | 2019-12-13 00:38:15 -0600 | [diff] [blame] | 4 | Variables      ../data/variables.py | 
| George Keishing | cae6e90 | 2017-09-07 13:35:59 -0500 | [diff] [blame] | 5 | Resource       ../lib/utils.robot | 
| Michael Shepos | d66cd55 | 2020-08-20 16:24:21 -0500 | [diff] [blame] | 6 | Resource       ../lib/connection_client.robot | 
| George Keishing | cae6e90 | 2017-09-07 13:35:59 -0500 | [diff] [blame] | 7 |  | 
|  | 8 | *** Keywords *** | 
|  | 9 |  | 
|  | 10 | Get OCC Objects | 
|  | 11 | [Documentation]  Get the OCC objects and return as a list. | 
|  | 12 |  | 
|  | 13 | # Example: | 
|  | 14 | # { | 
|  | 15 | #     "/org/open_power/control/occ0": { | 
|  | 16 | #          "OccActive": 0 | 
|  | 17 | # }, | 
|  | 18 | #     "/org/open_power/control/occ1": { | 
|  | 19 | #          "OccActive": 1 | 
|  | 20 | # } | 
|  | 21 |  | 
| George Keishing | 50cd001 | 2017-09-14 12:23:41 -0500 | [diff] [blame] | 22 | ${occ_list}=  Get Endpoint Paths  ${OPENPOWER_CONTROL}  occ* | 
| George Keishing | cae6e90 | 2017-09-07 13:35:59 -0500 | [diff] [blame] | 23 |  | 
|  | 24 | [Return]  ${occ_list} | 
|  | 25 |  | 
|  | 26 |  | 
|  | 27 | Get OCC Active State | 
|  | 28 | [Documentation]  Get the OCC "OccActive" and return the attribute value. | 
|  | 29 | [Arguments]  ${occ_object} | 
|  | 30 |  | 
|  | 31 | # Description of argument(s): | 
|  | 32 | # occ_object   OCC object path. | 
|  | 33 | #             (e.g. "/org/open_power/control/occ0"). | 
|  | 34 |  | 
|  | 35 | ${occ_attribute}=  Read Attribute  ${occ_object}  OccActive | 
|  | 36 | [Return]  ${occ_attribute} | 
| George Keishing | 50cd001 | 2017-09-14 12:23:41 -0500 | [diff] [blame] | 37 |  | 
|  | 38 |  | 
|  | 39 | Count Object Entries | 
| Gunnar Mills | 28e403b | 2017-10-25 16:16:38 -0500 | [diff] [blame] | 40 | [Documentation]  Count the occurrence number of a given object. | 
| George Keishing | 50cd001 | 2017-09-14 12:23:41 -0500 | [diff] [blame] | 41 | [Arguments]  ${object_base_uri_path}  ${object_name} | 
|  | 42 |  | 
|  | 43 | # Description of argument(s): | 
|  | 44 | # object_base_uri_path    Object base path | 
|  | 45 | #                         (e.g. "/org/open_power/control/"). | 
|  | 46 | # object_name             Object name (e.g. "occ", "cpu" etc). | 
|  | 47 |  | 
|  | 48 | ${object_list}=  Get Endpoint Paths | 
|  | 49 | ...  ${object_base_uri_path}  ${object_name} | 
|  | 50 | ${list_count}=  Get Length  ${object_list} | 
|  | 51 | [Return]  ${list_count} | 
|  | 52 |  | 
|  | 53 |  | 
|  | 54 | Read Object Attribute | 
|  | 55 | [Documentation]  Return object attribute data. | 
|  | 56 | [Arguments]  ${object_base_uri_path}  ${attribute_name} | 
|  | 57 |  | 
|  | 58 | # Description of argument(s): | 
|  | 59 | # object_base_uri_path       Object path. | 
|  | 60 | #                   (e.g. "/org/open_power/control/occ0"). | 
|  | 61 | # attribute_name    Object attribute name. | 
|  | 62 |  | 
|  | 63 | ${resp}=  OpenBMC Get Request | 
|  | 64 | ...  ${object_base_uri_path}/attr/${attribute_name}  quiet=${1} | 
|  | 65 | Return From Keyword If  ${resp.status_code} != ${HTTP_OK} | 
|  | 66 | ${content}=  To JSON  ${resp.content} | 
|  | 67 | [Return]  ${content["data"]} | 
|  | 68 |  | 
| George Keishing | 5c96d1a | 2018-02-02 10:59:58 -0600 | [diff] [blame] | 69 |  | 
|  | 70 | Verify OCC State | 
|  | 71 | [Documentation]  Check OCC active state. | 
|  | 72 | [Arguments]  ${expected_occ_active}=${1} | 
|  | 73 | # Description of Argument(s): | 
|  | 74 | # expected_occ_active  The expected occ_active value (i.e. 1/0). | 
|  | 75 |  | 
|  | 76 | # Example cpu_list data output: | 
|  | 77 | #  /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0 | 
|  | 78 | #  /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1 | 
|  | 79 | ${cpu_list}=  Get Endpoint Paths | 
|  | 80 | ...  ${HOST_INVENTORY_URI}system/chassis/motherboard/  cpu* | 
|  | 81 |  | 
| Marissa Garza | 522a0c2 | 2020-02-05 12:49:29 -0600 | [diff] [blame] | 82 | FOR  ${endpoint_path}  IN  @{cpu_list} | 
|  | 83 | ${is_functional}=  Read Object Attribute  ${endpoint_path}  Functional | 
|  | 84 | Continue For Loop If  ${is_functional} == ${0} | 
|  | 85 | ${num}=  Set Variable  ${endpoint_path[-1]} | 
|  | 86 | ${occ_active}=  Get OCC Active State  ${OPENPOWER_CONTROL}occ${num} | 
|  | 87 | Should Be Equal  ${occ_active}  ${expected_occ_active} | 
|  | 88 | ...  msg=OCC not in right state | 
|  | 89 | END | 
| George Keishing | ac51225 | 2018-02-05 02:04:30 -0600 | [diff] [blame] | 90 |  | 
|  | 91 |  | 
|  | 92 | Get Sensors Aggregation Data | 
|  | 93 | [Documentation]  Return open power sensors aggregation value list. | 
|  | 94 | [Arguments]  ${object_base_uri_path} | 
|  | 95 |  | 
|  | 96 | # Description of argument(s): | 
|  | 97 | # object_base_uri_path  An object path such as one of the elements | 
|  | 98 | #                       returned by 'Get Sensors Aggregation URL List' | 
|  | 99 | #                       (e.g. "/org/open_power/sensors/aggregation/per_30s/ps0_input_power/average"). | 
|  | 100 |  | 
|  | 101 | # Example of aggregation [epoch,time] data: | 
|  | 102 | # "Values": [ | 
|  | 103 | #    [ | 
|  | 104 | #        1517815708479,  <-- EPOCH | 
|  | 105 | #        282             <-- Power value in watts | 
|  | 106 | #    ], | 
|  | 107 | #    [ | 
|  | 108 | #        1517815678238, | 
|  | 109 | #        282 | 
|  | 110 | #    ], | 
|  | 111 | #    [ | 
|  | 112 | #        1517815648102, | 
|  | 113 | #        282 | 
|  | 114 | #    ], | 
|  | 115 | # ], | 
|  | 116 |  | 
|  | 117 | ${resp}=  Read Attribute  ${object_base_uri_path}  Values  quiet=${1} | 
|  | 118 | ${power_sensors_value_list}=  Create List | 
| Marissa Garza | 522a0c2 | 2020-02-05 12:49:29 -0600 | [diff] [blame] | 119 | FOR  ${entry}  IN  @{resp} | 
|  | 120 | Append To List  ${power_sensors_value_list}  ${entry[1]} | 
|  | 121 | END | 
| George Keishing | ac51225 | 2018-02-05 02:04:30 -0600 | [diff] [blame] | 122 | [Return]  ${power_sensors_value_list} | 
|  | 123 |  | 
|  | 124 |  | 
|  | 125 | Get Sensors Aggregation URL List | 
|  | 126 | [Documentation]  Return the open power aggregation maximum list and the | 
|  | 127 | ...  average list URIs. | 
|  | 128 | [Arguments]  ${object_base_uri_path} | 
|  | 129 |  | 
|  | 130 | # Example of the 2 lists returned by this keyword: | 
|  | 131 | # avgs: | 
|  | 132 | #   avgs[0]: /org/open_power/sensors/aggregation/per_30s/ps0_input_power/average | 
|  | 133 | #   avgs[1]: /org/open_power/sensors/aggregation/per_30s/ps1_input_power/average | 
|  | 134 | # maxs: | 
|  | 135 | #   maxs[0]: /org/open_power/sensors/aggregation/per_30s/ps1_input_power/maximum | 
|  | 136 | #   maxs[1]: /org/open_power/sensors/aggregation/per_30s/ps0_input_power/maximum | 
|  | 137 |  | 
|  | 138 | # Description of argument(s): | 
|  | 139 | # object_base_uri_path  Object path. | 
|  | 140 | #                       base path "/org/open_power/sensors/" | 
|  | 141 | #        (e.g. "base path + aggregation/per_30s/ps0_input_power/average") | 
|  | 142 |  | 
|  | 143 | # Example of open power sensor aggregation data as returned by the get | 
|  | 144 | # request: | 
|  | 145 | # /org/open_power/sensors/list | 
|  | 146 | # [ | 
|  | 147 | #    "/org/open_power/sensors/aggregation/per_30s/ps0_input_power/average", | 
|  | 148 | #    "/org/open_power/sensors/aggregation/per_30s/ps1_input_power/maximum", | 
|  | 149 | #    "/org/open_power/sensors/aggregation/per_30s/ps0_input_power/maximum", | 
|  | 150 | #    "/org/open_power/sensors/aggregation/per_30s/ps1_input_power/average" | 
|  | 151 | # ] | 
|  | 152 |  | 
|  | 153 | ${resp}=  OpenBMC Get Request  ${object_base_uri_path}list  quiet=${1} | 
|  | 154 | ${content}=  To JSON  ${resp.content} | 
|  | 155 |  | 
|  | 156 | ${power_supply_avg_list}=  Create List | 
|  | 157 | ${power_supply_max_list}=  Create List | 
|  | 158 |  | 
| Marissa Garza | 522a0c2 | 2020-02-05 12:49:29 -0600 | [diff] [blame] | 159 | FOR  ${entry}  IN  @{content["data"]} | 
|  | 160 | Run Keyword If  'average' in '${entry}'  Append To List  ${power_supply_avg_list}  ${entry} | 
|  | 161 | Run Keyword If  'maximum' in '${entry}'  Append To List  ${power_supply_max_list}  ${entry} | 
|  | 162 | END | 
| George Keishing | ac51225 | 2018-02-05 02:04:30 -0600 | [diff] [blame] | 163 |  | 
|  | 164 | [Return]  ${power_supply_avg_list}  ${power_supply_max_list} | 
| Sweta Potthuri | 3925503 | 2018-03-28 10:12:14 -0500 | [diff] [blame] | 165 |  | 
|  | 166 |  | 
|  | 167 | REST Verify No Gard Records | 
|  | 168 | [Documentation]  Verify no gard records are present. | 
|  | 169 |  | 
|  | 170 | ${resp}=  Read Properties  ${OPENPOWER_CONTROL}gard/enumerate | 
|  | 171 | Log Dictionary  ${resp} | 
|  | 172 | Should Be Empty  ${resp}  msg=Found gard records. | 
| Michael Shepos | d66cd55 | 2020-08-20 16:24:21 -0500 | [diff] [blame] | 173 |  | 
|  | 174 |  | 
|  | 175 | Inject OPAL TI | 
|  | 176 | [Documentation]  OPAL terminate immediate procedure. | 
|  | 177 | [Arguments]      ${stable_branch}=master | 
| Michael Shepos | 8381f735 | 2021-04-20 12:03:08 -0500 | [diff] [blame] | 178 | ...              ${repo_dir_path}=/tmp/repository | 
| Michael Shepos | d66cd55 | 2020-08-20 16:24:21 -0500 | [diff] [blame] | 179 | ...              ${repo_github_url}=https://github.com/open-power/op-test | 
|  | 180 |  | 
|  | 181 | # Description of arguments: | 
|  | 182 | # stable_branch    Git branch to clone. (default: master) | 
|  | 183 | # repo_dir_path    Directory path for repo tool (e.g. "op-test"). | 
|  | 184 | # repo_github_url  Github URL link (e.g. "https://github.com/open-power/op-test"). | 
|  | 185 |  | 
|  | 186 | ${value}=  Generate Random String  4  [NUMBERS] | 
|  | 187 |  | 
|  | 188 | ${cmd_buf}=  Catenate  git clone --branch ${stable_branch} ${repo_github_url} ${repo_dir_path}/${value} | 
|  | 189 | Shell Cmd  ${cmd_buf} | 
|  | 190 |  | 
|  | 191 | Open Connection for SCP | 
|  | 192 | scp.Put File  ${repo_dir_path}/${value}/test_binaries/deadbeef  /tmp | 
|  | 193 | Pdbg  -a putmem 0x300000f8 < /tmp/deadbeef | 
|  | 194 |  | 
|  | 195 | # Clean up the repo once done. | 
|  | 196 | ${cmd_buf}=  Catenate  rm -rf ${repo_dir_path}${/}${value} | 
|  | 197 | Shell Cmd  ${cmd_buf} |