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 | |
| 44 | # Verify if watchdog settings are enabled and timeremaining is reduced. |
| 45 | ${properties}= Read Properties /xyz/openbmc_project/watchdog/host0 |
| 46 | Should Be Equal As Strings ${properties["Enabled"]} 1 |
| 47 | Should Not Be Equal As Strings ${properties["TimeRemaining"]} 0 |
| 48 | |
| 49 | Wait Until Keyword Succeeds 120 sec 20 sec Is Host Rebooted |
| 50 | Wait For Host To Ping ${OS_HOST} 5min 10 |
| 51 | Wait for OS |
| 52 | |
| 53 | # Check if watchdog settings are reset when host OS is up. |
| 54 | ${properties}= Read Properties /xyz/openbmc_project/watchdog/host0 |
| 55 | Should Be Equal As Strings ${properties["Enabled"]} 0 |
| 56 | Should Be Equal As Strings ${properties["Interval"]} ${initial_interval} |
| 57 | Should Be Equal As Strings ${properties["TimeRemaining"]} 0 |
| 58 | |
| 59 | Modify And Verify Watchdog Timer Interval |
| 60 | [Documentation] Modify and verify watchdog timer interval. |
| 61 | [Tags] Modify_And_Verify_Watchdog_Timer_Interval |
| 62 | [Teardown] Set Watchdog Setting Using REST Interval ${initial_interval} |
| 63 | |
| 64 | ${initial_interval}= Read Attribute ${HOST_WATCHDOG_URI} Interval |
| 65 | ${random_int}= Evaluate random.randint(10000, 20000) modules=random |
| 66 | Set Watchdog Setting Using REST Interval ${random_int} |
| 67 | ${modified_time_interval}= Read Attribute ${HOST_WATCHDOG_URI} Interval |
| 68 | Should Be Equal As Strings ${modified_time_interval} ${random_int} |
| 69 | |
| 70 | Modify and verify Watchdog TimeRemaining |
| 71 | [Documentation] Modify and verify watchdog 'TimeRemaining'. |
| 72 | [Tags] Modify_And_Verify_Watchdog_TimeRemaining |
| 73 | |
| 74 | ${random_int}= Evaluate random.randint(10000, 20000) modules=random |
| 75 | Set Watchdog Setting Using REST TimeRemaining ${random_int} |
| 76 | ${modified_timeremain}= |
| 77 | ... Read Attribute ${HOST_WATCHDOG_URI} TimeRemaining |
| 78 | Should Not Be Equal As Strings ${random_int} ${modified_timeremain} |
| 79 | |
| 80 | Verify Watchdog URL When Host Is On And Off |
| 81 | [Documentation] Verify watchdog URL when host is running |
| 82 | ... and when host is off. |
| 83 | [Tags] Verify_Watchdog_URL_When_Host_Is_On_And_Off |
| 84 | |
| 85 | ${resp}= OpenBMC Get Request ${HOST_WATCHDOG_URI} |
| 86 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 87 | |
| 88 | REST Power Off |
| 89 | ${resp}= OpenBMC Get Request ${HOST_WATCHDOG_URI} |
| 90 | Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND} |
| 91 | |
| 92 | *** Keywords *** |
| 93 | |
| 94 | Watchdog Timer Test Setup |
| 95 | [Documentation] Do test initialization setup. |
| 96 | # Check input parameters & check if host OS is up. |
| 97 | |
| 98 | Should Not Be Empty |
| 99 | ... ${OS_HOST} msg=You must provide the host name/host IP address. |
| 100 | Should Not Be Empty |
| 101 | ... ${OS_USERNAME} msg=You must provide OS host user name. |
| 102 | Should Not Be Empty |
| 103 | ... ${OS_PASSWORD} msg=You must provide OS host user password. |
| 104 | |
| 105 | # Boot to OS. |
| 106 | REST Power On |
| 107 | |
| 108 | Restore Watchdog Default Setting |
| 109 | [Documentation] Restore watchdog Default setting. |
| 110 | |
| 111 | # Boot to OS. |
| 112 | REST Power On |
| 113 | Set Watchdog Setting Using REST Enabled ${False} |
| 114 | |
| 115 | Close All Connections |
| 116 | |
| 117 | Set Watchdog Setting Using REST |
| 118 | [Documentation] Set watchdog setting using REST with a given input |
| 119 | ... attribute values. |
| 120 | [Arguments] ${setting_name} ${value} |
| 121 | |
| 122 | # Description of argument(s): |
| 123 | # setting_name The name of the watchdog setting |
| 124 | # (e.g. "Enabled", "Interval", etc.). |
| 125 | # value Watchdog setting value(e.g. "Enabled":boolean, |
| 126 | # "Interval":Integer, "TimeRemaining":Integer) |
| 127 | |
| 128 | ${valueDict}= Create Dictionary data=${value} |
| 129 | ${resp}= OpenBMC Put Request ${HOST_WATCHDOG_URI}/attr/${setting_name} |
| 130 | ... data=${valueDict} |
| 131 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |