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