Sushil Singh | 8023a8c | 2020-03-16 05:56:39 -0500 | [diff] [blame] | 1 | *** Settings *** |
Sushil Singh | c5e9ebc | 2020-04-09 03:32:57 -0500 | [diff] [blame] | 2 | Documentation Test to discover the BMC. Before running suit, |
| 3 | ... check BMC and Avahi browse machine should be in same subnet. |
Sushil Singh | 8023a8c | 2020-03-16 05:56:39 -0500 | [diff] [blame] | 4 | |
| 5 | Variables ../../data/variables.py |
| 6 | Library SSHLibrary |
| 7 | Library ../../lib/external_intf/management_console_utils.py |
| 8 | Library ../../lib/gen_robot_print.py |
| 9 | Library ../../lib/gen_print.py |
Sushil Singh | c5e9ebc | 2020-04-09 03:32:57 -0500 | [diff] [blame] | 10 | Library ../../lib/gen_misc.py |
| 11 | Resource ../../lib/external_intf/management_console_utils.robot |
Sushil Singh | a2bf3f3 | 2020-04-15 05:23:57 -0500 | [diff] [blame] | 12 | Resource ../../lib/redfish_code_update_utils.robot |
Sushil Singh | c5e9ebc | 2020-04-09 03:32:57 -0500 | [diff] [blame] | 13 | Resource ../../lib/boot_utils.robot |
Sushil Singh | 8023a8c | 2020-03-16 05:56:39 -0500 | [diff] [blame] | 14 | Resource ../../syslib/utils_os.robot |
Sushil Singh | a313c97 | 2020-05-12 09:04:48 -0500 | [diff] [blame] | 15 | Resource ../../lib/code_update_utils.robot |
Sushil Singh | 8023a8c | 2020-03-16 05:56:39 -0500 | [diff] [blame] | 16 | |
| 17 | Suite Setup Suite Setup Execution |
Sushil Singh | 51be134 | 2020-05-05 00:19:40 -0500 | [diff] [blame] | 18 | Suite Teardown Redfish.Logout |
| 19 | Test Setup Printn |
Sushil Singh | a2bf3f3 | 2020-04-15 05:23:57 -0500 | [diff] [blame] | 20 | Test Teardown FFDC On Test Case Fail |
Sushil Singh | 8023a8c | 2020-03-16 05:56:39 -0500 | [diff] [blame] | 21 | |
| 22 | *** Test Cases *** |
| 23 | |
| 24 | Discover BMC With Different Service Type |
| 25 | [Documentation] Discover all the BMC with different service type support. |
| 26 | [Tags] Discover_BMC_With_Different_Service_Type |
| 27 | [Template] Discover BMC With Service Type |
| 28 | |
| 29 | # Service type |
| 30 | _obmc_rest._tcp |
| 31 | _obmc_redfish._tcp |
| 32 | |
| 33 | |
Sushil Singh | e6edfad | 2020-04-13 07:45:03 -0500 | [diff] [blame] | 34 | Discover BMC Pre And Post Reboot |
| 35 | [Documentation] Discover BMC before and after reboot. |
| 36 | [Tags] Discover_BMC_Pre_And_Post_Reboot |
| 37 | [Template] Set Daemon And Discover BMC After Reboot |
Sushil Singh | c5e9ebc | 2020-04-09 03:32:57 -0500 | [diff] [blame] | 38 | |
| 39 | # Service type |
| 40 | _obmc_rest._tcp |
| 41 | _obmc_redfish._tcp |
| 42 | |
Sushil Singh | e6edfad | 2020-04-13 07:45:03 -0500 | [diff] [blame] | 43 | |
| 44 | Disable AvahiDaemon And Discover BMC After Reboot |
George Keishing | e20f82c | 2020-05-13 10:51:02 -0500 | [diff] [blame] | 45 | [Documentation] BMC should be discoverable in next reboot even after disabling Avahi daemon. |
Sushil Singh | e6edfad | 2020-04-13 07:45:03 -0500 | [diff] [blame] | 46 | [Tags] Disable_AvahiDaemon_And_Discover_BMC_After_Reboot |
| 47 | [Template] Set Daemon And Discover BMC After Reboot |
| 48 | |
| 49 | # Service type skip |
| 50 | _obmc_rest._tcp True |
| 51 | _obmc_redfish._tcp True |
| 52 | |
Sushil Singh | a2bf3f3 | 2020-04-15 05:23:57 -0500 | [diff] [blame] | 53 | |
Sushil Singh | e46ba2d | 2020-05-07 07:39:34 -0500 | [diff] [blame] | 54 | Discover BMC Pre And Post Firmware Update Of Same Release |
| 55 | [Documentation] Discover BMC, when firmware update occurs for same release. |
| 56 | [Tags] Discover_BMC_Pre_And_Post_Firmware_Update_Of_Same_Release |
Sushil Singh | a2bf3f3 | 2020-04-15 05:23:57 -0500 | [diff] [blame] | 57 | [Template] Discover BMC Pre And Post Firmware Update |
| 58 | |
Sushil Singh | e46ba2d | 2020-05-07 07:39:34 -0500 | [diff] [blame] | 59 | # Service type Service type status |
| 60 | _obmc_rest._tcp _obmc_redfish._tcp True |
Sushil Singh | a2bf3f3 | 2020-04-15 05:23:57 -0500 | [diff] [blame] | 61 | |
Sushil Singh | 6a8cb08 | 2020-04-15 06:50:28 -0500 | [diff] [blame] | 62 | |
Sushil Singh | e46ba2d | 2020-05-07 07:39:34 -0500 | [diff] [blame] | 63 | Discover BMC Pre And Post Firmware Update Of Different Release |
| 64 | [Documentation] Discover BMC, when firmware update occurs for different release. |
| 65 | [Tags] Discover_BMC_Pre_And_Post_Firmware_Update_Of_Different_Release |
Sushil Singh | 6a8cb08 | 2020-04-15 06:50:28 -0500 | [diff] [blame] | 66 | [Template] Discover BMC Pre And Post Firmware Update |
| 67 | |
Sushil Singh | e46ba2d | 2020-05-07 07:39:34 -0500 | [diff] [blame] | 68 | # Service type Service type status |
| 69 | _obmc_rest._tcp _obmc_redfish._tcp True |
Sushil Singh | 6a8cb08 | 2020-04-15 06:50:28 -0500 | [diff] [blame] | 70 | |
Sushil Singh | 51be134 | 2020-05-05 00:19:40 -0500 | [diff] [blame] | 71 | |
Sushil Singh | e46ba2d | 2020-05-07 07:39:34 -0500 | [diff] [blame] | 72 | Discover BMC Fail After Firmware Update Of Different Release |
| 73 | [Documentation] Discover BMC fail, when firmware update occurs for different release. |
| 74 | [Tags] Discover_BMC_Fail_After_Firmware_Update_Of_Different_Release |
| 75 | [Template] Discover BMC Pre And Post Firmware Update |
| 76 | |
| 77 | # Service type Service type status |
| 78 | _obmc_rest._tcp _obmc_redfish._tcp False |
| 79 | |
| 80 | |
| 81 | Discover BMC Pre And Post When Host Boot InProgress |
| 82 | [Documentation] Discover BMC, when Host boot in progress. |
| 83 | [Tags] Discover_BMC_Pre_And_Post_When_Host_Boot_InProgress |
| 84 | [Template] Discover BMC Pre And Post When Host Boot |
Sushil Singh | 51be134 | 2020-05-05 00:19:40 -0500 | [diff] [blame] | 85 | |
| 86 | # Service type Service type |
| 87 | _obmc_rest._tcp _obmc_redfish._tcp |
| 88 | |
Sushil Singh | 8023a8c | 2020-03-16 05:56:39 -0500 | [diff] [blame] | 89 | *** Keywords *** |
| 90 | |
| 91 | Suite Setup Execution |
| 92 | [Documentation] Do the suite setup. |
| 93 | |
| 94 | Should Not Be Empty ${AVAHI_CLIENT} |
| 95 | Should Not Be Empty ${AVAHI_CLIENT_USERNAME} |
| 96 | Should Not Be Empty ${AVAHI_CLIENT_PASSWORD} |
| 97 | Login To OS ${AVAHI_CLIENT} ${AVAHI_CLIENT_USERNAME} ${AVAHI_CLIENT_PASSWORD} |
| 98 | Check Avahi Package |
Sushil Singh | 51be134 | 2020-05-05 00:19:40 -0500 | [diff] [blame] | 99 | Redfish.Login |
Sushil Singh | 8023a8c | 2020-03-16 05:56:39 -0500 | [diff] [blame] | 100 | |
| 101 | |
| 102 | Check Avahi Package |
| 103 | [Documentation] To check for avahi-tools package. |
| 104 | |
| 105 | # Expected command output as below. |
| 106 | # avahi-tools-0.6.31-19.el7.x86_64 |
| 107 | |
| 108 | ${command}= Set Variable rpm -qa | grep avahi-tools |
| 109 | ${resp_rpm} ${stderr}= Execute Command ${command} return_stderr=True |
| 110 | Should Be Empty ${stderr} |
| 111 | Should Contain ${resp_rpm} avahi-tools ignore_case=True msg=avahi-tools is not available. |
| 112 | |
| 113 | |
| 114 | Discover BMC With Service Type |
| 115 | [Documentation] To get the discoverd BMC list. |
| 116 | [Arguments] ${service_type} |
| 117 | |
| 118 | # Description of argument(s): |
Sushil Singh | c5e9ebc | 2020-04-09 03:32:57 -0500 | [diff] [blame] | 119 | # service_type BMC service type e.g. |
| 120 | # (REST Service = _obmc_rest._tcp, Redfish Service = _obmc_redfish._tcp). |
Sushil Singh | 8023a8c | 2020-03-16 05:56:39 -0500 | [diff] [blame] | 121 | |
| 122 | # bmc_list: |
| 123 | # [1]: |
| 124 | # [service]: _obmc_XXXX._tcp |
| 125 | # [hostname]: System Name |
| 126 | # [address]: XXX.XXX.XXX.XXX |
| 127 | # [port]: XXX |
| 128 | # [txt]: |
| 129 | # [2]: |
| 130 | # [service]: _obmc_XXXX._tcp |
| 131 | # [hostname]: System Name |
| 132 | # [address]: XXX.XXX.XXX.XXX |
| 133 | # [port]: XXX |
| 134 | # [txt]: |
| 135 | |
| 136 | ${resp_service} ${stderr}= Execute Command avahi-browse -rt ${service_type} return_stderr=True |
| 137 | ${bmc_list} ${exc_msg}= Get BMC Records ${service_type} ${resp_service} |
| 138 | Print Timen Exception message is ${exc_msg} |
| 139 | Should Not Be Empty ${bmc_list} |
| 140 | Rprint Vars bmc_list |
Sushil Singh | c5e9ebc | 2020-04-09 03:32:57 -0500 | [diff] [blame] | 141 | [Return] ${bmc_list} |
| 142 | |
| 143 | |
| 144 | Verify Existence Of BMC Record From List |
| 145 | [Documentation] Verify the existence of BMC record from list of BMC records. |
| 146 | [Arguments] ${service_type} |
| 147 | |
| 148 | # Description of argument(s): |
| 149 | # service_type BMC service type e.g. |
| 150 | # (REST Service = _obmc_rest._tcp, Redfish Service = _obmc_redfish._tcp). |
| 151 | |
| 152 | ${bmc_list}= Discover BMC With Service Type ${service_type} |
| 153 | ${openbmc_host_name} ${openbmc_ip}= Get Host Name IP host=${OPENBMC_HOST} |
| 154 | ${resp}= Check BMC Record Exists ${bmc_list} ${openbmc_ip} |
| 155 | Should Be True 'True' == '${resp}' |
| 156 | |
| 157 | |
Sushil Singh | e6edfad | 2020-04-13 07:45:03 -0500 | [diff] [blame] | 158 | Set Daemon And Discover BMC After Reboot |
Sushil Singh | c5e9ebc | 2020-04-09 03:32:57 -0500 | [diff] [blame] | 159 | [Documentation] Discover BMC After reboot. |
Sushil Singh | e6edfad | 2020-04-13 07:45:03 -0500 | [diff] [blame] | 160 | [Arguments] ${service_type} ${skip}=False |
Sushil Singh | c5e9ebc | 2020-04-09 03:32:57 -0500 | [diff] [blame] | 161 | |
| 162 | # Description of argument(s): |
| 163 | # service_type BMC service type e.g. |
| 164 | # (REST Service = _obmc_rest._tcp, Redfish Service = _obmc_redfish._tcp). |
Sushil Singh | e6edfad | 2020-04-13 07:45:03 -0500 | [diff] [blame] | 165 | # skip Default value set to False. |
| 166 | # If the value is True, Disable the AvahiDaemon. |
| 167 | # If the value is False, skip the step to disable the AvahiDaemon. |
Sushil Singh | c5e9ebc | 2020-04-09 03:32:57 -0500 | [diff] [blame] | 168 | |
Sushil Singh | e6edfad | 2020-04-13 07:45:03 -0500 | [diff] [blame] | 169 | Verify Existence Of BMC Record From List ${service_type} |
| 170 | Run Keyword If '${skip}' == 'True' Set AvahiDaemon Service command=stop |
Sushil Singh | c5e9ebc | 2020-04-09 03:32:57 -0500 | [diff] [blame] | 171 | Redfish OBMC Reboot (off) |
| 172 | Verify AvahiDaemon Service Status message=start |
| 173 | Login To OS ${AVAHI_CLIENT} ${AVAHI_CLIENT_USERNAME} ${AVAHI_CLIENT_PASSWORD} |
| 174 | Wait Until Keyword Succeeds 2 min 30 sec |
| 175 | ... Verify Existence Of BMC Record From List ${service_type} |
Sushil Singh | a2bf3f3 | 2020-04-15 05:23:57 -0500 | [diff] [blame] | 176 | |
| 177 | |
Sushil Singh | a313c97 | 2020-05-12 09:04:48 -0500 | [diff] [blame] | 178 | Redfish Update Firmware |
| 179 | [Documentation] Update the BMC firmware via redfish interface and verify the bmc version |
| 180 | ... and apply time. |
| 181 | [Arguments] ${apply_time} |
| 182 | |
| 183 | # Description of argument(s): |
| 184 | # apply_time ApplyTime allowed values (e.g. "OnReset", "Immediate"). |
| 185 | |
| 186 | ${post_code_update_actions}= Get Post Boot Action |
| 187 | ${state}= Get Pre Reboot State |
| 188 | Rprint Vars state |
| 189 | Set ApplyTime policy=${apply_Time} |
| 190 | Redfish Upload Image And Check Progress State |
| 191 | Run Key ${post_code_update_actions['BMC image']['${apply_time}']} |
| 192 | Redfish.Login |
| 193 | Redfish Verify BMC Version ${IMAGE_FILE_PATH} |
| 194 | Verify Get ApplyTime ${apply_time} |
| 195 | |
| 196 | |
Sushil Singh | a2bf3f3 | 2020-04-15 05:23:57 -0500 | [diff] [blame] | 197 | Discover BMC Pre And Post Firmware Update |
| 198 | [Documentation] Discover BMC, After code update. |
Sushil Singh | a313c97 | 2020-05-12 09:04:48 -0500 | [diff] [blame] | 199 | [Arguments] ${service_type1} ${service_type2} ${status} |
Sushil Singh | a2bf3f3 | 2020-04-15 05:23:57 -0500 | [diff] [blame] | 200 | |
| 201 | # Description of argument(s): |
Sushil Singh | 51be134 | 2020-05-05 00:19:40 -0500 | [diff] [blame] | 202 | # service_type BMC service type e.g. |
| 203 | # (REST Service = _obmc_rest._tcp, Redfish Service = _obmc_redfish._tcp). |
Sushil Singh | a313c97 | 2020-05-12 09:04:48 -0500 | [diff] [blame] | 204 | # status True or False |
Sushil Singh | a2bf3f3 | 2020-04-15 05:23:57 -0500 | [diff] [blame] | 205 | |
| 206 | Valid File Path IMAGE_FILE_PATH |
| 207 | Verify Existence Of BMC Record From List ${service_type1} |
| 208 | Verify Existence Of BMC Record From List ${service_type2} |
Sushil Singh | a313c97 | 2020-05-12 09:04:48 -0500 | [diff] [blame] | 209 | Redfish Update Firmware apply_time=Immediate |
Sushil Singh | e46ba2d | 2020-05-07 07:39:34 -0500 | [diff] [blame] | 210 | ${keyword_status}= Run Keyword And Return Status |
| 211 | ... Verify Existence Of BMC Record From List ${service_type1} |
| 212 | Should Be Equal '${status}' '${keyword_status}' |
| 213 | ${keyword_status}= Run Keyword And Return Status |
| 214 | ... Verify Existence Of BMC Record From List ${service_type2} |
| 215 | Should Be Equal '${status}' '${keyword_status}' |
Sushil Singh | 51be134 | 2020-05-05 00:19:40 -0500 | [diff] [blame] | 216 | |
| 217 | |
Sushil Singh | e46ba2d | 2020-05-07 07:39:34 -0500 | [diff] [blame] | 218 | Discover BMC Pre And Post When Host Boot |
Sushil Singh | a313c97 | 2020-05-12 09:04:48 -0500 | [diff] [blame] | 219 | [Documentation] Discover BMC, when host boot in progress. |
Sushil Singh | 51be134 | 2020-05-05 00:19:40 -0500 | [diff] [blame] | 220 | [Arguments] ${service_type1} ${service_type2} |
| 221 | |
| 222 | # Description of argument(s): |
| 223 | # service_type BMC service type e.g. |
| 224 | # (REST Service = _obmc_rest._tcp, Redfish Service = _obmc_redfish._tcp). |
| 225 | |
| 226 | Verify Existence Of BMC Record From List ${service_type1} |
| 227 | Verify Existence Of BMC Record From List ${service_type2} |
| 228 | Redfish Power Off stack_mode=skip |
| 229 | Get Host Power State |
| 230 | Redfish Power Operation reset_type=On |
| 231 | Sleep 15s |
| 232 | Login To OS ${AVAHI_CLIENT} ${AVAHI_CLIENT_USERNAME} ${AVAHI_CLIENT_PASSWORD} |
| 233 | FOR ${index} IN RANGE 10 |
| 234 | Sleep 3s |
| 235 | Verify Existence Of BMC Record From List ${service_type1} |
| 236 | Verify Existence Of BMC Record From List ${service_type2} |
| 237 | END |
| 238 | Wait Until Keyword Succeeds 10 min 10 sec Is OS Booted |