chithrag | 0a8c878 | 2022-03-01 12:35:00 +0000 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
| 3 | Documentation Module to test IPMI SEL Time functionality. |
| 4 | ... Pre-requisite Condition : Client Machine and BMC should be in Same TimeZone (example : UST) |
| 5 | ... |
| 6 | ... IPMI Raw command variables are defined under ../data/ipmi_raw_command_table.py |
| 7 | ... Python basic functionalities are defined under ../lib/functions.py imported under ../lib/resource.robot |
| 8 | ... |
| 9 | ... Test the Set/Get SEL Time functionality and compare the result against BMC Native command (date). |
| 10 | ... |
| 11 | ... Set the Time Sync Mode from NTP to Manual to Set SEL Time. |
| 12 | ... Time Sync Mode change performed via REDFISH URI. |
| 13 | ... Performs the change in Time Sync Mode with Test Setup and Teardown Execution with default NETWORK_TIMEOUT provided under ../lib/resource.robot. |
| 14 | ... |
| 15 | ... NETWORK_RESTART_TIME added for Set SEL Time and Add SEL Entry as the corresponding command takes approx 5 seconds for the operation to reflect. |
| 16 | ... |
| 17 | ... Current SEL time identified via BMC Native command (date) and perform SEL Time operations. |
| 18 | ... |
| 19 | ... Script Verifies SEL Time for various scenarios such as, |
| 20 | ... Get current time from BMC and add future year and compare against BMC native command (date), |
| 21 | ... Gets BMC Current Time and Adds 15 minutes and compare against BMC native command (date), |
| 22 | ... Gets BMC Current Time and subtracts 1 day and compare against BMC native command (date), |
| 23 | ... Add SEL Entry for all the above scenarios and compare against BMC native command (date). |
| 24 | |
| 25 | Library DateTime |
| 26 | Library Collections |
| 27 | Library String |
| 28 | Library ../lib/ipmi_utils.py |
| 29 | Resource ../lib/ipmi_client.robot |
| 30 | Resource ../lib/openbmc_ffdc.robot |
| 31 | Variables ../data/ipmi_raw_cmd_table.py |
| 32 | |
| 33 | Test Setup Test Setup Execution |
| 34 | Test Teardown Test Teardown Execution |
| 35 | |
| 36 | *** Variables *** |
| 37 | |
| 38 | ${NETWORK_RESTART_TIME} 5s |
| 39 | |
| 40 | |
| 41 | *** Test Cases *** |
| 42 | |
| 43 | Verify Default Get SEL Time |
| 44 | [Documentation] Verify IPMI Get SEL Time. |
| 45 | [Tags] Verify_Default_Get_SEL_Time |
| 46 | [Setup] Printn |
| 47 | [Teardown] FFDC On Test Case Fail |
| 48 | |
| 49 | # Gets the current SEL time via Get SEL Time Command. |
| 50 | ${resp}= Get SEL Time Command |
| 51 | Should Not Be Empty ${resp} |
| 52 | |
| 53 | |
George Keishing | 70deec0 | 2022-05-04 14:23:22 -0500 | [diff] [blame] | 54 | Verify Set SEL Time On NTP Mode |
chithrag | 0a8c878 | 2022-03-01 12:35:00 +0000 | [diff] [blame] | 55 | [Documentation] IPMI Set SEL Time without NTP |
George Keishing | 70deec0 | 2022-05-04 14:23:22 -0500 | [diff] [blame] | 56 | [Tags] Verify_Set_SEL_Time_On_NTP_Mode |
chithrag | 0a8c878 | 2022-03-01 12:35:00 +0000 | [diff] [blame] | 57 | [Setup] Printn |
| 58 | [Teardown] printn |
| 59 | |
| 60 | # Get current time from BMC and add future year (here, 5years). |
| 61 | ${sel_date}= Get Specific Sel Date 5 |
| 62 | |
| 63 | # Gives Hexa decimal raw command data request with the prefix of 0x. |
| 64 | ${sel_date_raw}= Converting Date to HexaDecimal ${sel_date} |
| 65 | |
| 66 | ${Set_sel_time}= Run Keyword and Expect Error *${IPMI_RAW_CMD['SEL_entry']['Set_SEL_Time'][2]}* |
| 67 | ... Run IPMI Command ${IPMI_RAW_CMD['SEL_entry']['Set_SEL_Time'][0]} ${sel_date_raw} |
| 68 | Should Contain ${Set_sel_time} ${IPMI_RAW_CMD['SEL_entry']['Set_SEL_Time'][1]} |
| 69 | |
| 70 | |
| 71 | Verify SEL Set Time For Specific Time |
| 72 | [Documentation] Verify IPMI Set SEL Time. |
| 73 | [Tags] Verify_SEL_Set_Time_For_Specific_Time |
| 74 | |
| 75 | # Get current time from BMC and add future year (here, 5years). |
| 76 | ${sel_date}= Get Specific Sel Date 5 |
| 77 | |
| 78 | # Gives Hexa decimal raw command data request with the prefix of 0x. |
| 79 | ${sel_date_raw}= Converting Date to HexaDecimal ${sel_date} |
| 80 | |
| 81 | # Set SEL Entry command. |
| 82 | Set SEL Time Entry Via Raw Command ${sel_date_raw} |
| 83 | |
| 84 | # Get SEL Time command. |
| 85 | ${get_sel_time}= Check Current Date Time Via IPMI |
| 86 | |
| 87 | # Identify Time difference and find the difference is less than 6 seconds. |
| 88 | # Command execution may happen at the end of millisecond so considered 6 seconds as difference. |
| 89 | ${time_difference}= Get Time Difference ${get_sel_time} ${sel_date} |
| 90 | Should Be True 0<=${time_difference}<=5 |
| 91 | ... msg=Set SEL Time Not Working |
| 92 | |
| 93 | # Get BMC time (native) and compare with set sel time given. |
| 94 | ${bmc_time}= Get Current Date from BMC |
| 95 | |
| 96 | ${difference}= Get Time Difference ${bmc_time} ${sel_date} |
| 97 | Should Be True 0<=${difference}<=6 |
| 98 | |
| 99 | |
| 100 | Verify Set SEL Time With Future Date And Time |
| 101 | [Documentation] Verify IPMI Get SEL Time by adding 15 minutes from current time. |
| 102 | [Tags] Verify_Set_SEL_Time_With_Future_Date_And_Time |
| 103 | |
| 104 | # Gets BMC Current Time and Adds 15 minutes and sets the SEL Time. |
| 105 | ${sel_time} ${set_sel_time}= Identify SEL Time Future DateTime 06:15:00 |
| 106 | |
| 107 | # Set SEL Time via IPMI command. |
| 108 | Set SEL Time Via IPMI ${sel_time} |
| 109 | |
| 110 | # Get SEL Time Command. |
| 111 | ${get_sel_time}= Check Current Date Time Via IPMI |
| 112 | |
| 113 | # Difference of time between set sel time and get time. |
| 114 | ${difference}= Get Time Difference ${get_sel_time} ${set_sel_time} |
| 115 | Should Be True 0<=${difference}<=2 |
| 116 | |
| 117 | # Difference of time between BMC Date and Get SEL Time. |
| 118 | ${bmc_time}= Get Current Date from BMC |
| 119 | ${difference}= Get Time Difference ${get_sel_time} ${bmc_time} |
| 120 | Should Be True 0<=${difference}<=2 |
| 121 | |
| 122 | |
| 123 | Verify Set SEL Time With Past Date And Time |
| 124 | [Documentation] Verify IPMI Get SEL Time for yime delay of 1 day from current dat and time. |
| 125 | [Tags] Verify_Set_SEL_Time_With_Past_Date_And_Time |
| 126 | |
| 127 | # Gets BMC current time and subtracts 1 day and sets the SEL Time. |
| 128 | ${sel_time} ${set_sel_time}= Identify SEL Time DateTime Delay 1d |
| 129 | |
| 130 | ${status}= Run Keyword And Return Status Should Not Contain ${sel_time} 1969 |
| 131 | ... msg=Date cannot be less than 1970. |
| 132 | |
| 133 | IF '${status}' == '${TRUE}' |
| 134 | # Set SEL Time via IPMI command. |
| 135 | Set SEL Time Via IPMI ${sel_time} |
| 136 | # Get SEL Time Command. |
| 137 | ${get_sel_time}= Check Current Date Time Via IPMI |
| 138 | # Difference of time between set sel time and get time. |
| 139 | ${difference}= Get Time Difference ${get_sel_time} ${set_sel_time} |
| 140 | Should Be True 0<=${difference}<=2 |
| 141 | # Difference of time between BMC Date and Get SEL Time. |
| 142 | ${bmc_time}= Get Current Date from BMC |
| 143 | ${difference}= Get Time Difference ${get_sel_time} ${bmc_time} |
| 144 | Should Be True 0<=${difference}<=2 |
| 145 | ELSE |
| 146 | FAIL SEL Time cannot set Date less than 1970 |
| 147 | END |
| 148 | |
| 149 | |
| 150 | Verify SEL Set Time For Invalid Data Request |
| 151 | [Documentation] Verify IPMI Get SEL Time for invalid data request |
| 152 | [Tags] Verify_SEL_Set_Time_For_Invalid_Data_Request |
| 153 | [Setup] Printn |
| 154 | [Teardown] FFDC On Test Case Fail |
| 155 | |
| 156 | # Gets BMC current date via date command. |
| 157 | ${current_date}= Get Current Date from BMC |
| 158 | |
| 159 | # Gives hexa decimal Raw command data request with the prefix of 0x. |
| 160 | ${sel_date_raw}= Converting Date to HexaDecimal ${current_date} |
| 161 | |
| 162 | # Set Invalid SEL Time with one extra request byte. |
| 163 | ${Set_seltime_invalid}= Run Keyword and Expect Error *${IPMI_RAW_CMD['SEL_entry']['Set_SEL_Time'][4]}* |
| 164 | ... Run IPMI Command ${IPMI_RAW_CMD['SEL_entry']['Set_SEL_Time'][0]} ${sel_date_raw} 0x00 |
| 165 | Should Contain ${Set_seltime_invalid} ${IPMI_RAW_CMD['SEL_entry']['Set_SEL_Time'][3]} |
| 166 | |
| 167 | |
| 168 | Verify SEL Set Time For Incomplete Data Request |
| 169 | [Documentation] Verify IPMI Get SEL Time for invalid data with one byte less request data. |
| 170 | [Tags] Verify_SEL_Set_Time_For_Incomplete_Data_Request |
| 171 | [Setup] Printn |
| 172 | [Teardown] FFDC On Test Case Fail |
| 173 | |
| 174 | # Gets BMC current date via date command. |
| 175 | ${current_date}= Get Current Date from BMC |
| 176 | |
| 177 | # Gives hexa decimal raw command data request with the prefix of 0x. |
| 178 | ${sel_date_raw}= Converting Date to HexaDecimal ${current_date} |
| 179 | |
| 180 | # For data request less than expected byes, remove last byte. |
| 181 | ${sel_date_raw}= Split String ${sel_date_raw} |
| 182 | Remove From List ${sel_date_raw} -1 |
| 183 | ${sel_date_raw}= Evaluate " ".join(${sel_date_raw}) |
| 184 | |
| 185 | # Set incomplete SEL Time with one less request byte. |
| 186 | ${Set_seltime_incomplete}= Run Keyword and Expect Error *${IPMI_RAW_CMD['SEL_entry']['Set_SEL_Time'][4]}* |
| 187 | ... Run IPMI Command ${IPMI_RAW_CMD['SEL_entry']['Set_SEL_Time'][0]} ${sel_date_raw} |
| 188 | Should Contain ${Set_seltime_incomplete} ${IPMI_RAW_CMD['SEL_entry']['Set_SEL_Time'][3]} |
| 189 | |
| 190 | |
| 191 | Verify SEL Time In SEL Entry |
| 192 | [Documentation] Verify Configured SEL Time reflects in newly added SEL Entry. |
| 193 | [Tags] Verify_SEL_Time_In_SEL_Entry |
| 194 | |
| 195 | Clear The SEL |
| 196 | |
| 197 | # change to manual, get current time and add future year (here, 5years). |
| 198 | ${sel_date}= Get Specific Sel Date 5 |
| 199 | |
| 200 | # Gives hexa decimal raw command data request with the prefix of 0x. |
| 201 | ${sel_date_raw}= Converting Date to HexaDecimal ${sel_date} |
| 202 | |
| 203 | # Set SEL Entry Command. |
| 204 | Set SEL Time Entry Via Raw Command ${sel_date_raw} |
| 205 | |
| 206 | # Get SEL Time Command. |
| 207 | ${get_sel_time}= Check Current Date Time Via IPMI |
| 208 | |
| 209 | # Identify Time difference and find the difference is less than 6 seconds. |
| 210 | # Command execution may happen at the end of millisecond so considered 6 seconds as difference. |
| 211 | ${time_difference}= Get Time Difference ${get_sel_time} ${sel_date} |
| 212 | Should Be True 0<=${time_difference}<=5 |
| 213 | ... msg=Set SEL Time Not Working |
| 214 | |
| 215 | # Get BMC time (native) and compare with set sel time given. |
| 216 | ${bmc_time}= Get Current Date from BMC |
| 217 | |
| 218 | ${difference}= Get Time Difference ${bmc_time} ${sel_date} |
| 219 | Should Be True 0<=${difference}<=6 |
| 220 | |
| 221 | # Get any Sensor available from Sensor list. |
| 222 | ${sensor_name}= Fetch Any Sensor From Sensor List |
| 223 | |
| 224 | # Get Sensor ID from SDR Get "sensor". |
| 225 | ${sensor_data1}= Fetch Sensor Details From SDR ${sensor_name} Sensor ID |
| 226 | ${name_sensor} ${sensor_number}= Get Data And Byte From SDR Sensor ${sensor_data1} |
| 227 | |
| 228 | # Get Sensor Type from SDR Get "sensor". |
| 229 | ${sensor_data2}= Fetch Sensor Details From SDR ${sensor_name} Sensor Type (Threshold) |
| 230 | ${sensor_type} ${sensor_type_id}= Get Data And Byte From SDR Sensor ${sensor_data2} |
| 231 | |
| 232 | # Add SEL Entry. |
| 233 | ${sel_create_resp}= Create SEL ${sensor_type_id} ${sensor_number} |
| 234 | |
| 235 | # Finds the last added sel entry. |
| 236 | ${resp}= Verify Last SEL Added ${sensor_type} ${sensor_name} |
| 237 | |
| 238 | # Fetches the date of the last added SEL Entry. |
| 239 | ${sel_entry_date}= Fetch Added SEL Date ${resp} |
| 240 | |
| 241 | # Identify and find the time difference is less than 60 seconds. |
| 242 | # Finding the sensor details and execution may take up to a minute. |
| 243 | # Compare date and time of Set SEL with sel entry. |
| 244 | ${d}= Get Time Difference ${sel_entry_date} ${sel_date} |
| 245 | Should Be True 0<=${d}<=60 |
| 246 | |
| 247 | |
| 248 | Verify SEL Time In SEL Entry For Future Date and Time |
| 249 | [Documentation] Verify configured SEL Time (Future Date & Time) in added SEL Entry. |
| 250 | [Tags] Verify_SEL_Time_In_SEL_Entry_For_Future_Date_and_Time |
| 251 | |
| 252 | Clear The SEL |
| 253 | |
| 254 | # Gets BMC Current Time and Adds 15 minutes and sets the SEL Time. |
| 255 | ${sel_time} ${set_sel_time}= Identify SEL Time Future DateTime 06:15:00 |
| 256 | |
| 257 | # Set SEL Time via IPMI command. |
| 258 | Set SEL Time Via IPMI ${sel_time} |
| 259 | |
| 260 | # Get SEL Time Command. |
| 261 | ${get_sel_time}= Check Current Date Time Via IPMI |
| 262 | |
| 263 | # Difference of time between set sel time and get time. |
| 264 | ${difference}= Get Time Difference ${get_sel_time} ${set_sel_time} |
| 265 | Should Be True 0<=${difference}<=2 |
| 266 | |
| 267 | # Difference of time between BMC Date and Get SEL Time. |
| 268 | ${bmc_time}= Get Current Date from BMC |
| 269 | ${difference}= Get Time Difference ${get_sel_time} ${bmc_time} |
| 270 | Should Be True 0<=${difference}<=2 |
| 271 | |
| 272 | # Get any Sensor available from Sensor list. |
| 273 | ${sensor_name}= Fetch Any Sensor From Sensor List |
| 274 | |
| 275 | # Get Sensor ID from SDR Get "sensor". |
| 276 | ${sensor_data1}= Fetch Sensor Details From SDR ${sensor_name} Sensor ID |
| 277 | ${name_sensor} ${sensor_number}= Get Data And Byte From SDR Sensor ${sensor_data1} |
| 278 | |
| 279 | # Get Sensor Type from SDR Get "sensor". |
| 280 | ${sensor_data2}= Fetch Sensor Details From SDR ${sensor_name} Sensor Type (Threshold) |
| 281 | ${sensor_type} ${sensor_type_id}= Get Data And Byte From SDR Sensor ${sensor_data2} |
| 282 | |
| 283 | # Add SEL Entry. |
| 284 | ${sel_create_resp}= Create SEL ${sensor_type_id} ${sensor_number} |
| 285 | |
| 286 | # Finds the last added sel entry. |
| 287 | ${resp}= Verify Last SEL Added ${sensor_type} ${sensor_name} |
| 288 | |
| 289 | # Fetches the date of the last added SEL Entry. |
| 290 | ${sel_entry_date}= Fetch Added SEL Date ${resp} |
| 291 | |
| 292 | # Identify and find the time difference is less than 60 seconds. |
| 293 | # Finding the sensor details and execution may take up to a minute. |
| 294 | # Compare date and time of Set SEL with sel entry. |
| 295 | ${d}= Get Time Difference ${sel_entry_date} ${set_sel_time} |
| 296 | Should Be True 0<=${d}<=60 |
| 297 | |
| 298 | |
| 299 | Verify SEL Time In SEL Entry For Past Date And Time |
| 300 | [Documentation] Verify configured SEL Time (Past Date & Time) in added SEL Entry. |
George Keishing | 70deec0 | 2022-05-04 14:23:22 -0500 | [diff] [blame] | 301 | [Tags] Verify_SEL_Time_In_SEL_Entry_For_Past_Date_And_Time |
chithrag | 0a8c878 | 2022-03-01 12:35:00 +0000 | [diff] [blame] | 302 | |
| 303 | Clear The SEL |
| 304 | |
| 305 | # Gets BMC Current Time and subtracts 1 day and sets the SEL Time. |
| 306 | ${sel_time} ${set_sel_time}= Identify SEL Time DateTime Delay 1d |
| 307 | |
| 308 | ${status}= Run Keyword And Return Status Should Not Contain ${sel_time} 1969 |
| 309 | ... msg=Date cannot be less than 1970 |
| 310 | |
| 311 | IF '${status}' == '${TRUE}' |
| 312 | # Set SEL Time via IPMI command. |
| 313 | Set SEL Time Via IPMI ${sel_time} |
| 314 | # Get SEL Time Command. |
| 315 | ${get_sel_time}= Check Current Date Time Via IPMI |
| 316 | # Difference of time between set sel time and get time. |
| 317 | ${difference}= Get Time Difference ${get_sel_time} ${set_sel_time} |
| 318 | Should Be True 0<=${difference}<=2 |
| 319 | # Difference of time between BMC Date and Get SEL Time. |
| 320 | ${bmc_time}= Get Current Date from BMC |
| 321 | ${difference}= Get Time Difference ${get_sel_time} ${bmc_time} |
| 322 | Should Be True 0<=${difference}<=2 |
| 323 | |
| 324 | # Get any Sensor available from Sensor list. |
| 325 | ${sensor_name}= Fetch Any Sensor From Sensor List |
| 326 | # Get Sensor ID from SDR Get "sensor". |
| 327 | ${sensor_data1}= Fetch Sensor Details From SDR ${sensor_name} Sensor ID |
| 328 | ${name_sensor} ${sensor_number}= Get Data And Byte From SDR Sensor ${sensor_data1} |
| 329 | |
| 330 | # Get Sensor Type from SDR Get "sensor". |
| 331 | ${sensor_data2}= Fetch Sensor Details From SDR ${sensor_name} Sensor Type (Threshold) |
| 332 | ${sensor_type} ${sensor_type_id}= Get Data And Byte From SDR Sensor ${sensor_data2} |
| 333 | |
| 334 | # Add SEL Entry. |
| 335 | ${sel_create_resp}= Create SEL ${sensor_type_id} ${sensor_number} |
| 336 | |
| 337 | # Finds the last added sel entry. |
| 338 | ${resp}= Verify Last SEL Added ${sensor_type} ${sensor_name} |
| 339 | |
| 340 | # Fetches the date of the last added SEL Entry. |
| 341 | ${sel_entry_date}= Fetch Added SEL Date ${resp} |
| 342 | |
| 343 | # Identify and find the time difference is less than 60 seconds. |
| 344 | # Finding the sensor details and execution may take up to a minute. |
| 345 | # Compare date and time of Set SEL with sel entry. |
| 346 | ${d}= Get Time Difference ${sel_entry_date} ${set_sel_time} |
| 347 | Should Be True 0<=${d}<=60 |
| 348 | ELSE |
| 349 | FAIL SEL Time cannot set Date less than 1970. |
| 350 | END |
| 351 | |
| 352 | |
| 353 | Verify Multiple Set SEL Time With Multiple Add SEL Entry |
| 354 | [Documentation] Verify SEL time in multiple addition Of SEL entry. |
| 355 | [Tags] Verify_Multiple_Set_SEL_Time_With_Multiple_Add_SEL_Entry |
| 356 | |
| 357 | # Gets BMC Current Time and Adds 15 minutes and sets the SEL Time. |
| 358 | ${sel_time} ${set_sel_time}= Identify SEL Time Future DateTime 06:15:00 |
| 359 | |
| 360 | FOR ${i} IN RANGE 1 6 |
| 361 | |
| 362 | # Set SEL Time via IPMI command. |
| 363 | Set SEL Time Via IPMI ${sel_time} |
| 364 | |
| 365 | # Clear the SEL. |
| 366 | Clear The SEL |
| 367 | |
| 368 | # Get any Sensor available from Sensor list. |
| 369 | ${sensor_name}= Fetch Any Sensor From Sensor List |
| 370 | |
| 371 | # Get Sensor ID from SDR Get "sensor" and Identify Sensor ID. |
| 372 | ${sensor_data1}= Fetch Sensor Details From SDR ${sensor_name} Sensor ID |
| 373 | ${name_sensor} ${sensor_number}= Get Data And Byte From SDR Sensor ${sensor_data1} |
| 374 | |
| 375 | # Get Sensor Type from SDR Get "sensor" and identify Sensor Type. |
| 376 | ${sensor_data2}= Fetch Sensor Details From SDR ${sensor_name} Sensor Type (Threshold) |
| 377 | ${sensor_type} ${sensor_type_id}= Get Data And Byte From SDR Sensor ${sensor_data2} |
| 378 | |
| 379 | # Add SEL Entry. |
| 380 | ${sel_create_resp}= Create SEL ${sensor_type_id} ${sensor_number} |
| 381 | |
| 382 | # Finds the last added sel entry. |
| 383 | ${resp}= Verify Last SEL Added ${sensor_type} ${sensor_name} |
| 384 | |
| 385 | # Fetches the date of the last added SEL Entry. |
| 386 | ${sel_entry_date}= Fetch Added SEL Date ${resp} |
| 387 | |
| 388 | # Identify and find the time difference is less than 60 seconds. |
| 389 | # Finding the sensor details and execution may take up to a minute. |
| 390 | # Compare date and time of Set SEL with sel entry. |
| 391 | ${d}= Get Time Difference ${sel_entry_date} ${set_sel_time} |
| 392 | Should Be True ${d}<=60 |
| 393 | |
| 394 | END |
| 395 | |
| 396 | |
| 397 | *** Keywords *** |
| 398 | |
| 399 | Time Sync Mode Change Through Redfish |
| 400 | [Documentation] Export IP, token and change the time sync to manual. |
| 401 | [Arguments] ${value} |
| 402 | |
| 403 | # Description of argument(s): |
| 404 | # ${value} can be either ${FALSE} or ${TRUE} |
| 405 | |
| 406 | # May be changed to WebView. |
| 407 | |
| 408 | # Changing Time Sync Mode to Manual. |
| 409 | Change Time Sync Mode Via Redfish ${value} |
| 410 | |
| 411 | |
| 412 | Change Time Sync Mode Via Redfish |
| 413 | [Documentation] To change the time sync mode via Redfish. |
| 414 | [Arguments] ${value} |
| 415 | |
| 416 | # Description of argument(s): |
| 417 | # ${value} can be either ${FALSE} or ${TRUE} |
| 418 | |
| 419 | # Creates request body for Redfish url. |
| 420 | ${mode}= Create Dictionary ProtocolEnabled=${value} |
| 421 | ${data}= Create Dictionary NTP=${mode} |
| 422 | |
| 423 | # Patches the obtained body to the given url. |
| 424 | Redfish.patch ${REDFISH_NW_PROTOCOL_URI} body=&{data} |
| 425 | ... valid_status_codes=[${HTTP_NO_CONTENT}] |
| 426 | |
| 427 | Sleep ${NETWORK_RESTART_TIME} |
| 428 | |
| 429 | |
| 430 | Get SEL Time Command |
| 431 | [Documentation] Get SEL Time command. |
| 432 | |
| 433 | # The response will be 8 byte timestamp in hexadecimal. |
| 434 | # example: If current date and time is "Wed May 4 18:55:00 UTC 2022", |
| 435 | # then, ${get_sel_time} will be "07 cc 72 62". |
| 436 | ${get_sel_time}= Run IPMI Command |
| 437 | ... ${IPMI_RAW_CMD['SEL_entry']['Get_SEL_Time'][0]} |
| 438 | |
| 439 | [Return] ${get_sel_time} |
| 440 | |
| 441 | |
| 442 | Set SEL Time Entry Via Raw Command |
| 443 | [Documentation] Set SEL Time command. |
| 444 | [Arguments] ${sel_date_raw} |
| 445 | |
| 446 | # Description of argument(s): |
| 447 | # ${sel_date_raw} Time to set in hexadecimal bytes. |
| 448 | # Example: |
| 449 | # If date is 1st January 2022 12:30:00 PM, |
| 450 | # the hexadecimal timestamp is, 61D04948. |
| 451 | # then the request bytes are, |
| 452 | # ${sel_date_raw} 0x48 0x49 0xd0 0x61 |
| 453 | |
| 454 | Run IPMI Command ${IPMI_RAW_CMD['SEL_entry']['Set_SEL_Time'][0]} ${sel_date_raw} |
| 455 | Sleep ${NETWORK_RESTART_TIME} |
| 456 | |
| 457 | |
| 458 | Clear The SEL |
| 459 | [Documentation] Clear SEL Command. |
| 460 | |
| 461 | # Clear the SEL. |
| 462 | ${out}= Run IPMI Standard Command sel clear |
| 463 | Should Contain ${out} Clearing SEL |
| 464 | Sleep 2s |
| 465 | |
| 466 | |
| 467 | Verify Last SEL Added |
| 468 | [Documentation] Verify last SEL added. |
| 469 | [Arguments] ${sensor_type} ${sensor_name} |
| 470 | |
| 471 | # Description of argument(s): |
| 472 | # ${sensor_type} Type of the sensor (say Fan, Temp, etc.,). |
| 473 | # ${sensor_name} Name of the sensor. |
| 474 | |
| 475 | ${resp}= Run IPMI Standard Command sel elist last 1 |
| 476 | Run Keywords Should Contain ${resp} ${sensor_type} ${sensor_name} AND |
| 477 | ... Should Contain ${resp} Asserted msg=Add SEL Entry failed. |
| 478 | Should Not Contain ${resp} reset/cleared |
| 479 | |
| 480 | [Return] ${resp} |
| 481 | |
| 482 | |
| 483 | Check Current Date Time Via IPMI |
| 484 | [Documentation] Verify Current Date and Time Via IPMI user command. |
| 485 | |
| 486 | ${resp}= Run IPMI Standard Command sel time get |
| 487 | [Return] ${resp} |
| 488 | |
| 489 | |
| 490 | Get Specific Sel Date |
| 491 | [Documentation] Gets initial time and adds year to the current date and returns future date. |
| 492 | [Arguments] ${year} |
| 493 | |
| 494 | # Description of argument(s): |
| 495 | # ${year} Can be any number of years (say 5 year). |
| 496 | |
| 497 | ${current_date}= Get Current Date from BMC |
| 498 | |
| 499 | # Converting given years to days by multiplying with 365days and adding the days to current date. |
| 500 | ${days}= Evaluate 365*${year}+1 |
| 501 | ${date} = Add Time To Date ${current_date} ${days}d result_format=%m/%d/%Y %H:%M:%S date_format=%m/%d/%Y %H:%M:%S |
| 502 | |
| 503 | [Return] ${date} |
| 504 | |
| 505 | |
| 506 | Converting Date to HexaDecimal |
| 507 | [Documentation] Converting the date into hexa decimal values. |
| 508 | [Arguments] ${date} |
| 509 | |
| 510 | # Description of argument(s): |
| 511 | # ${date} Can be any date in format %m/%d/%Y %H:%M:%S. |
| 512 | |
| 513 | ${epoch_date}= Convert Date ${date} epoch exclude_millis=yes date_format=%m/%d/%Y %H:%M:%S |
| 514 | ${date}= Convert To Hex ${epoch_date} lowercase=yes |
| 515 | |
| 516 | # function calls from utils.py. |
| 517 | # Length of the date byte should be 8 so that each bytes are separated. |
| 518 | ${date}= Zfill Data ${date} 8 |
| 519 | # To split every two characters to form one byte each. |
| 520 | ${date}= Split String With Index ${date} 2 |
| 521 | # Prefix every list index value with 0x. |
| 522 | ${date}= Prefix Bytes ${date} |
| 523 | |
| 524 | # Reverse the bytes and join the list to form request Time stamp data. |
| 525 | Reverse List ${date} |
| 526 | ${date}= Evaluate " ".join(${date}) |
| 527 | |
| 528 | [Return] ${date} |
| 529 | |
| 530 | |
| 531 | Get Time Difference |
| 532 | [Documentation] Converting the date into hexa decimal values. |
| 533 | [Arguments] ${date1} ${date2} |
| 534 | |
| 535 | # Description of argument(s): |
| 536 | # ${date1} Can be any date in format %m/%d/%Y %H:%M:%S. |
| 537 | # ${date2} Can be any date in format %m/%d/%Y %H:%M:%S. |
| 538 | |
| 539 | ${epoch_date1}= Convert Date ${date1} epoch exclude_millis=yes date_format=%m/%d/%Y %H:%M:%S |
| 540 | ${epoch_date2}= Convert Date ${date2} epoch exclude_millis=yes date_format=%m/%d/%Y %H:%M:%S |
| 541 | |
| 542 | ${diff}= Evaluate int(${epoch_date1}) - int(${epoch_date2}) |
| 543 | |
| 544 | [Return] ${diff} |
| 545 | |
| 546 | |
| 547 | Identify SEL Time Future DateTime |
| 548 | [Documentation] Identify SEL Time Future DateTime. |
| 549 | [Arguments] ${time} |
| 550 | |
| 551 | # Description of argument(s): |
| 552 | # ${time} Can be any number of hours or minutes in format %H:%M:%S. |
| 553 | |
| 554 | # Gets BMC current date via date command. |
| 555 | ${current_date}= Get Current Date from BMC |
| 556 | |
| 557 | ${datetime} = Add Time To Date ${current_date} ${time} result_format=%m/%d/%Y %H:%M:%S date_format=%m/%d/%Y %H:%M:%S |
| 558 | |
| 559 | #Set SEL Time. |
| 560 | ${quoted_date}= Fetch Date ${datetime} |
| 561 | |
| 562 | [Return] ${quoted_date} ${datetime} |
| 563 | |
| 564 | |
| 565 | Identify SEL Time DateTime Delay |
| 566 | [Documentation] Identify SEL Time DateTime Delay by subtracting given date. |
| 567 | [Arguments] ${days} |
| 568 | |
| 569 | # Description of argument(s): |
| 570 | # ${days} Can be any days (say 3d). |
| 571 | |
| 572 | # Gets BMC current date via date command. |
| 573 | ${current_date}= Get Current Date from BMC |
| 574 | |
| 575 | ${datetime} = Subtract Time From Date ${current_date} ${days} result_format=%m/%d/%Y %H:%M:%S date_format=%m/%d/%Y %H:%M:%S |
| 576 | |
| 577 | # Format the sel time. |
| 578 | # function call from lib/utils.py. |
| 579 | ${quoted_date}= Fetch Date ${datetime} |
| 580 | |
| 581 | [Return] ${quoted_date} ${datetime} |
| 582 | |
| 583 | |
| 584 | Set SEL Time Via IPMI |
| 585 | [Documentation] Set SEL Time for given date using IPMI. |
| 586 | [Arguments] ${date_time} |
| 587 | |
| 588 | # Description of argument(s): |
| 589 | # ${date_time} Can be any date in format %m/%d/%Y %H:%M:%S. |
| 590 | |
| 591 | ${resp}= Run IPMI Standard Command sel time set "${date_time}" |
| 592 | Should Not Contain ${resp} Unspecified error |
| 593 | |
| 594 | |
| 595 | Test Setup Execution |
| 596 | [Documentation] Test Setup Execution. |
| 597 | |
| 598 | Redfish.Login |
| 599 | # Change timesync mode to manual with timeout as per resource.robot. |
| 600 | Time Sync Mode Change Through Redfish ${FALSE} |
| 601 | Sleep ${NETWORK_TIMEOUT} |
| 602 | |
| 603 | |
| 604 | Test Teardown Execution |
| 605 | [Documentation] For execution of Test teardown. |
| 606 | |
| 607 | Clear The SEL |
| 608 | |
| 609 | # Change TimeSync mode to NTP with Timeout as per default resource.robot. |
| 610 | Time Sync Mode Change Through Redfish ${TRUE} |
| 611 | Sleep ${NETWORK_TIMEOUT} |
| 612 | Redfish.Logout |
| 613 | FFDC On Test Case Fail |