Sridevi Ramesh | 0a7c0aa | 2017-06-26 13:03:02 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation This suite tests HOST watchdog timer in Open BMC. |
| 3 | |
| 4 | Resource ../lib/rest_client.robot |
| 5 | Resource ../lib/openbmc_ffdc.robot |
| 6 | Resource ../lib/utils.robot |
| 7 | Resource ../lib/resource.txt |
| 8 | Resource ../lib/boot_utils.robot |
George Keishing | 1be85f5 | 2017-10-30 00:56:17 -0500 | [diff] [blame] | 9 | Resource ../lib/state_manager.robot |
Sridevi Ramesh | 0a7c0aa | 2017-06-26 13:03:02 -0500 | [diff] [blame] | 10 | |
Steven Sombar | fac31e9 | 2017-12-15 09:40:34 -0600 | [diff] [blame] | 11 | Suite Setup Suite Setup Execution |
| 12 | Suite Teardown Suite Teardown Execution |
Sridevi Ramesh | 0a7c0aa | 2017-06-26 13:03:02 -0500 | [diff] [blame] | 13 | Test Teardown FFDC On Test Case Fail |
| 14 | |
| 15 | *** Variables *** |
| 16 | # "skip" boots that aren't needed to get to desired state. |
| 17 | ${stack_mode} skip |
| 18 | |
| 19 | *** Test Cases *** |
George Keishing | 98eaba2 | 2018-09-07 10:52:20 -0500 | [diff] [blame] | 20 | |
Sridevi Ramesh | 0a7c0aa | 2017-06-26 13:03:02 -0500 | [diff] [blame] | 21 | Verify Watchdog Setting With Watchdog Disabled |
| 22 | [Documentation] Disable watchdog timer and verify watchdog settings |
| 23 | ... i.e Enabled, Interval, TimeRemaining. |
| 24 | [Tags] Verify_Watchdog_Setting_With_Watchdog_Disabled |
| 25 | |
| 26 | ${initial_interval}= Read Attribute ${HOST_WATCH_DOG_URI} Interval |
| 27 | Set Watchdog Setting Using REST Enabled ${False} |
| 28 | |
| 29 | # Check if watchdog has default settings. |
| 30 | ${properties}= Read Properties /xyz/openbmc_project/watchdog/host0 |
George Keishing | 98eaba2 | 2018-09-07 10:52:20 -0500 | [diff] [blame] | 31 | Should Be Equal As Strings ${properties["Enabled"]} ${False} |
Sridevi Ramesh | 0a7c0aa | 2017-06-26 13:03:02 -0500 | [diff] [blame] | 32 | Should Be Equal As Strings ${properties["Interval"]} ${initial_interval} |
| 33 | Should Be Equal As Strings ${properties["TimeRemaining"]} 0 |
| 34 | |
George Keishing | 98eaba2 | 2018-09-07 10:52:20 -0500 | [diff] [blame] | 35 | |
Sridevi Ramesh | 0a7c0aa | 2017-06-26 13:03:02 -0500 | [diff] [blame] | 36 | Verify Watchdog Setting With Watchdog Enabled |
| 37 | [Documentation] Enable watchdog timer and check if host OS is rebooted |
| 38 | ... and verify hostdog settings are reset to default when |
| 39 | ... host OS is up. |
| 40 | [Tags] Verify_Watchdog_Setting_With_Watchdog_Enabled |
| 41 | |
| 42 | ${initial_interval}= Read Attribute ${HOST_WATCHDOG_URI} Interval |
| 43 | |
Sridevi Ramesh | d5f82ff | 2018-01-23 03:58:14 -0600 | [diff] [blame] | 44 | Trigger Host Watchdog Error 2000 30 |
Sridevi Ramesh | 0a7c0aa | 2017-06-26 13:03:02 -0500 | [diff] [blame] | 45 | |
George Keishing | 03c13a4 | 2017-11-24 10:52:11 -0600 | [diff] [blame] | 46 | Wait Until Keyword Succeeds 3 min 10 sec Watchdog Object Should Exist |
| 47 | |
Sridevi Ramesh | 0a7c0aa | 2017-06-26 13:03:02 -0500 | [diff] [blame] | 48 | # Verify if watchdog settings are enabled and timeremaining is reduced. |
| 49 | ${properties}= Read Properties /xyz/openbmc_project/watchdog/host0 |
George Keishing | 98eaba2 | 2018-09-07 10:52:20 -0500 | [diff] [blame] | 50 | Should Be Equal As Strings ${properties["Enabled"]} ${True} |
Sridevi Ramesh | 0a7c0aa | 2017-06-26 13:03:02 -0500 | [diff] [blame] | 51 | Should Not Be Equal As Strings ${properties["TimeRemaining"]} 0 |
| 52 | |
| 53 | Wait Until Keyword Succeeds 120 sec 20 sec Is Host Rebooted |
| 54 | Wait For Host To Ping ${OS_HOST} 5min 10 |
| 55 | Wait for OS |
| 56 | |
| 57 | # Check if watchdog settings are reset when host OS is up. |
| 58 | ${properties}= Read Properties /xyz/openbmc_project/watchdog/host0 |
George Keishing | 98eaba2 | 2018-09-07 10:52:20 -0500 | [diff] [blame] | 59 | Should Be Equal As Strings ${properties["Enabled"]} ${False} |
Sridevi Ramesh | 0a7c0aa | 2017-06-26 13:03:02 -0500 | [diff] [blame] | 60 | Should Be Equal As Strings ${properties["Interval"]} ${initial_interval} |
| 61 | Should Be Equal As Strings ${properties["TimeRemaining"]} 0 |
| 62 | |
George Keishing | 98eaba2 | 2018-09-07 10:52:20 -0500 | [diff] [blame] | 63 | |
Sridevi Ramesh | 0a7c0aa | 2017-06-26 13:03:02 -0500 | [diff] [blame] | 64 | Modify And Verify Watchdog Timer Interval |
| 65 | [Documentation] Modify and verify watchdog timer interval. |
| 66 | [Tags] Modify_And_Verify_Watchdog_Timer_Interval |
| 67 | [Teardown] Set Watchdog Setting Using REST Interval ${initial_interval} |
| 68 | |
| 69 | ${initial_interval}= Read Attribute ${HOST_WATCHDOG_URI} Interval |
| 70 | ${random_int}= Evaluate random.randint(10000, 20000) modules=random |
| 71 | Set Watchdog Setting Using REST Interval ${random_int} |
| 72 | ${modified_time_interval}= Read Attribute ${HOST_WATCHDOG_URI} Interval |
| 73 | Should Be Equal As Strings ${modified_time_interval} ${random_int} |
| 74 | |
George Keishing | 98eaba2 | 2018-09-07 10:52:20 -0500 | [diff] [blame] | 75 | |
Sridevi Ramesh | 0a7c0aa | 2017-06-26 13:03:02 -0500 | [diff] [blame] | 76 | Modify and verify Watchdog TimeRemaining |
| 77 | [Documentation] Modify and verify watchdog 'TimeRemaining'. |
| 78 | [Tags] Modify_And_Verify_Watchdog_TimeRemaining |
| 79 | |
| 80 | ${random_int}= Evaluate random.randint(10000, 20000) modules=random |
| 81 | Set Watchdog Setting Using REST TimeRemaining ${random_int} |
| 82 | ${modified_timeremain}= |
| 83 | ... Read Attribute ${HOST_WATCHDOG_URI} TimeRemaining |
| 84 | Should Not Be Equal As Strings ${random_int} ${modified_timeremain} |
| 85 | |
George Keishing | 98eaba2 | 2018-09-07 10:52:20 -0500 | [diff] [blame] | 86 | |
Sridevi Ramesh | 0a7c0aa | 2017-06-26 13:03:02 -0500 | [diff] [blame] | 87 | Verify Watchdog URL When Host Is On And Off |
| 88 | [Documentation] Verify watchdog URL when host is running |
| 89 | ... and when host is off. |
| 90 | [Tags] Verify_Watchdog_URL_When_Host_Is_On_And_Off |
| 91 | |
| 92 | ${resp}= OpenBMC Get Request ${HOST_WATCHDOG_URI} |
| 93 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 94 | |
| 95 | REST Power Off |
| 96 | ${resp}= OpenBMC Get Request ${HOST_WATCHDOG_URI} |
| 97 | Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND} |
| 98 | |
| 99 | *** Keywords *** |
| 100 | |
Steven Sombar | fac31e9 | 2017-12-15 09:40:34 -0600 | [diff] [blame] | 101 | Suite Setup Execution |
Sridevi Ramesh | 0a7c0aa | 2017-06-26 13:03:02 -0500 | [diff] [blame] | 102 | [Documentation] Do test initialization setup. |
| 103 | # Check input parameters & check if host OS is up. |
| 104 | |
| 105 | Should Not Be Empty |
| 106 | ... ${OS_HOST} msg=You must provide the host name/host IP address. |
| 107 | Should Not Be Empty |
| 108 | ... ${OS_USERNAME} msg=You must provide OS host user name. |
| 109 | Should Not Be Empty |
| 110 | ... ${OS_PASSWORD} msg=You must provide OS host user password. |
| 111 | |
| 112 | # Boot to OS. |
| 113 | REST Power On |
| 114 | |
Steven Sombar | fac31e9 | 2017-12-15 09:40:34 -0600 | [diff] [blame] | 115 | Suite Teardown Execution |
Sridevi Ramesh | 0a7c0aa | 2017-06-26 13:03:02 -0500 | [diff] [blame] | 116 | [Documentation] Restore watchdog Default setting. |
| 117 | |
| 118 | # Boot to OS. |
| 119 | REST Power On |
| 120 | Set Watchdog Setting Using REST Enabled ${False} |
| 121 | |
| 122 | Close All Connections |
| 123 | |
| 124 | Set Watchdog Setting Using REST |
| 125 | [Documentation] Set watchdog setting using REST with a given input |
| 126 | ... attribute values. |
| 127 | [Arguments] ${setting_name} ${value} |
| 128 | |
| 129 | # Description of argument(s): |
| 130 | # setting_name The name of the watchdog setting |
| 131 | # (e.g. "Enabled", "Interval", etc.). |
| 132 | # value Watchdog setting value(e.g. "Enabled":boolean, |
| 133 | # "Interval":Integer, "TimeRemaining":Integer) |
| 134 | |
| 135 | ${valueDict}= Create Dictionary data=${value} |
| 136 | ${resp}= OpenBMC Put Request ${HOST_WATCHDOG_URI}/attr/${setting_name} |
| 137 | ... data=${valueDict} |
| 138 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
George Keishing | 03c13a4 | 2017-11-24 10:52:11 -0600 | [diff] [blame] | 139 | |
| 140 | |
| 141 | Watchdog Object Should Exist |
| 142 | [Documentation] Check if watchdog object exist. |
| 143 | |
George Keishing | 98253bf | 2017-12-05 02:08:15 -0600 | [diff] [blame] | 144 | ${resp}= OpenBMC Get Request ${WATCHDOG_URI}host0 |
George Keishing | 03c13a4 | 2017-11-24 10:52:11 -0600 | [diff] [blame] | 145 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 146 | |