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