George Keishing | 678b65c | 2017-08-31 16:16:39 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Suite for testing non sensors. |
| 3 | |
| 4 | Library ../lib/state_map.py |
| 5 | Resource ../lib/utils.robot |
| 6 | Resource ../lib/boot_utils.robot |
| 7 | Resource ../lib/state_manager.robot |
| 8 | Resource ../lib/openbmc_ffdc.robot |
| 9 | |
| 10 | Test Teardown Post Test Case Execution |
| 11 | |
| 12 | *** Variables *** |
| 13 | |
| 14 | ${stack_mode} skip |
| 15 | |
| 16 | *** Test Cases *** |
| 17 | |
George Keishing | b3a4a48 | 2017-09-29 03:50:02 -0500 | [diff] [blame] | 18 | Verify Boot AttemptsLeft At Standby |
George Keishing | 678b65c | 2017-08-31 16:16:39 -0500 | [diff] [blame] | 19 | [Documentation] Verify system boot attempts on various boot states. |
George Keishing | b3a4a48 | 2017-09-29 03:50:02 -0500 | [diff] [blame] | 20 | [Tags] Verify_Boot_AttemptsLeft_At_Standby |
George Keishing | 678b65c | 2017-08-31 16:16:39 -0500 | [diff] [blame] | 21 | [Template] Validate Boot AttemptsLeft |
| 22 | |
| 23 | # Example: Expected state |
| 24 | # "data": { |
| 25 | # "/xyz/openbmc_project/state/host0": { |
| 26 | # "AttemptsLeft": 3, |
| 27 | # "BootProgress": "xyz.openbmc_project.State.Boot.Progress.ProgressStages.Unspecified", |
| 28 | # "CurrentHostState": "xyz.openbmc_project.State.Host.HostState.Off", |
| 29 | # "OperatingSystemState": "xyz.openbmc_project.State.OperatingSystem.Status.OSStatus.Inactive", |
| 30 | # "RequestedHostTransition": "xyz.openbmc_project.State.Host.Transition.Off" |
| 31 | # } |
| 32 | # } |
| 33 | |
| 34 | # System at standby AttemptsLeft |
| 35 | Reboot 3 |
George Keishing | b3a4a48 | 2017-09-29 03:50:02 -0500 | [diff] [blame] | 36 | |
| 37 | |
| 38 | Verify Boot AttemptsLeft At Host Booted |
| 39 | [Tags] Verify_Boot_AttemptsLeft_At_Host_Booted |
| 40 | [Template] Validate Boot AttemptsLeft |
| 41 | |
| 42 | # System at standby AttemptsLeft |
| 43 | Booted 3 |
| 44 | |
| 45 | |
| 46 | Verify Boot AttemptsLeft When Host Reboot |
| 47 | [Tags] Verify_Boot_AttemptsLeft_When_Host_Reboot |
| 48 | [Template] Validate Boot AttemptsLeft |
| 49 | |
| 50 | # System at standby AttemptsLeft |
| 51 | RebootHost 2 |
| 52 | |
| 53 | |
| 54 | Verify Boot AttemptsLeft When Power Off |
| 55 | [Tags] Validate Boot AttemptsLeft_When_Power_Off |
| 56 | [Template] Validate Boot AttemptsLeft |
| 57 | |
| 58 | # System at standby AttemptsLeft |
| 59 | Ready 2 |
George Keishing | 678b65c | 2017-08-31 16:16:39 -0500 | [diff] [blame] | 60 | |
| 61 | |
| 62 | Verify Boot Sensor States At Ready |
| 63 | [Documentation] Verify system boot states at "Ready" state. |
| 64 | [Tags] Verify_Boot_Sensor_States_At_Ready |
| 65 | [Template] Valid Boot States |
| 66 | |
| 67 | # Example: Expected state |
| 68 | # "data": { |
| 69 | # "/xyz/openbmc_project/state/bmc0": { |
| 70 | # "CurrentBMCState": "xyz.openbmc_project.State.BMC.BMCState.Ready", |
| 71 | # "RequestedBMCTransition": "xyz.openbmc_project.State.BMC.Transition.None" |
| 72 | # }, |
| 73 | # "/xyz/openbmc_project/state/chassis0": { |
| 74 | # "CurrentPowerState": "xyz.openbmc_project.State.Chassis.PowerState.Off", |
| 75 | # "RequestedPowerTransition": "xyz.openbmc_project.State.Chassis.Transition.Off" |
| 76 | # }, |
| 77 | # "/xyz/openbmc_project/state/host0": { |
| 78 | # "AttemptsLeft": 3, |
| 79 | # "BootProgress": "xyz.openbmc_project.State.Boot.Progress.ProgressStages.Unspecified", |
| 80 | # "CurrentHostState": "xyz.openbmc_project.State.Host.HostState.Off", |
| 81 | # "OperatingSystemState": "xyz.openbmc_project.State.OperatingSystem.Status.OSStatus.Inactive", |
| 82 | # "RequestedHostTransition": "xyz.openbmc_project.State.Host.Transition.Off" |
| 83 | # } |
| 84 | # } |
| 85 | |
| 86 | # System at standby. |
| 87 | Off |
| 88 | |
| 89 | |
| 90 | Verify Boot Sensor States On Reboot Ready |
| 91 | [Documentation] Verify system boot states at "Ready" state. |
| 92 | [Tags] Verify_Boot_Sensor_States_On_Reboot_Ready |
| 93 | [Template] Valid Boot States |
| 94 | |
| 95 | # Example: Expected state |
| 96 | # "data": { |
| 97 | # "/xyz/openbmc_project/state/bmc0": { |
| 98 | # "CurrentBMCState": "xyz.openbmc_project.State.BMC.BMCState.Ready", |
| 99 | # "RequestedBMCTransition": "xyz.openbmc_project.State.BMC.Transition.None" |
| 100 | # }, |
| 101 | # "/xyz/openbmc_project/state/chassis0": { |
| 102 | # "CurrentPowerState": "xyz.openbmc_project.State.Chassis.PowerState.Off", |
| 103 | # "RequestedPowerTransition": "xyz.openbmc_project.State.Chassis.Transition.Off" |
| 104 | # }, |
| 105 | # "/xyz/openbmc_project/state/host0": { |
| 106 | # "AttemptsLeft": 3, |
| 107 | # "BootProgress": "xyz.openbmc_project.State.Boot.Progress.ProgressStages.Unspecified", |
| 108 | # "CurrentHostState": "xyz.openbmc_project.State.Host.HostState.Off", |
| 109 | # "OperatingSystemState": "xyz.openbmc_project.State.OperatingSystem.Status.OSStatus.Inactive", |
| 110 | # "RequestedHostTransition": "xyz.openbmc_project.State.Host.Transition.Off" |
| 111 | # } |
| 112 | # } |
| 113 | |
| 114 | # BMC on reset to standby. |
| 115 | Reboot |
| 116 | |
| 117 | |
| 118 | Verify Boot Sensor States At Running |
| 119 | [Documentation] Verify system boot states at "Running" state. |
| 120 | [Tags] Verify_Boot_Sensor_States_At_Running |
| 121 | [Template] Valid Boot States |
| 122 | |
| 123 | # Example: Expected state |
| 124 | # "data": { |
| 125 | # "/xyz/openbmc_project/state/bmc0": { |
| 126 | # "CurrentBMCState": "xyz.openbmc_project.State.BMC.BMCState.Ready", |
| 127 | # "RequestedBMCTransition": "xyz.openbmc_project.State.BMC.Transition.None" |
| 128 | # }, |
| 129 | # "/xyz/openbmc_project/state/chassis0": { |
| 130 | # "CurrentPowerState": "xyz.openbmc_project.State.Chassis.PowerState.On", |
| 131 | # "RequestedPowerTransition": "xyz.openbmc_project.State.Chassis.Transition.Off" |
| 132 | # }, |
| 133 | # "/xyz/openbmc_project/state/host0": { |
| 134 | # "AttemptsLeft": 2, |
| 135 | # "BootProgress": "xyz.openbmc_project.State.Boot.Progress.ProgressStages.MotherboardInit", |
| 136 | # "CurrentHostState": "xyz.openbmc_project.State.Host.HostState.Running", |
| 137 | # "OperatingSystemState": "xyz.openbmc_project.State.OperatingSystem.Status.OSStatus.Inactive", |
| 138 | # "RequestedHostTransition": "xyz.openbmc_project.State.Host.Transition.On" |
| 139 | # } |
| 140 | # } |
| 141 | |
| 142 | # System at Running state but during initial state. |
| 143 | Running |
| 144 | |
| 145 | |
| 146 | Verify Boot Sensor States At Host Booted |
| 147 | [Documentation] Verify system boot states when host is booted. |
| 148 | [Tags] Verify_Boot_Sensor_States_At_Host_Booted |
| 149 | [Template] Valid Boot States |
| 150 | |
| 151 | # Example: Expected state |
| 152 | # "data": { |
| 153 | # "/xyz/openbmc_project/state/bmc0": { |
| 154 | # "CurrentBMCState": "xyz.openbmc_project.State.BMC.BMCState.Ready", |
| 155 | # "RequestedBMCTransition": "xyz.openbmc_project.State.BMC.Transition.None" |
| 156 | # }, |
| 157 | # "/xyz/openbmc_project/state/chassis0": { |
| 158 | # "CurrentPowerState": "xyz.openbmc_project.State.Chassis.PowerState.On", |
| 159 | # "RequestedPowerTransition": "xyz.openbmc_project.State.Chassis.Transition.Off" |
| 160 | # }, |
| 161 | # "/xyz/openbmc_project/state/host0": { |
| 162 | # "AttemptsLeft": 3, |
| 163 | # "BootProgress": "xyz.openbmc_project.State.Boot.Progress.ProgressStages.OSStart", |
| 164 | # "CurrentHostState": "xyz.openbmc_project.State.Host.HostState.Running", |
| 165 | # "OperatingSystemState": "xyz.openbmc_project.State.OperatingSystem.Status.OSStatus.BootComplete", |
| 166 | # "RequestedHostTransition": "xyz.openbmc_project.State.Host.Transition.On" |
| 167 | # } |
| 168 | # } |
| 169 | |
| 170 | # System when host is booted. |
| 171 | Booted |
| 172 | |
| 173 | |
| 174 | Verify Boot Sensor States RR on Host Booted |
| 175 | [Documentation] Verify system boot states post BMC reset. |
| 176 | [Tags] Verify_Boot_Sensor_States_RR_on_Host_Booted |
| 177 | [Template] Valid Boot States |
| 178 | |
| 179 | # Example: Expected state |
| 180 | # "data": { |
| 181 | # "/xyz/openbmc_project/state/bmc0": { |
| 182 | # "CurrentBMCState": "xyz.openbmc_project.State.BMC.BMCState.Ready", |
| 183 | # "RequestedBMCTransition": "xyz.openbmc_project.State.BMC.Transition.None" |
| 184 | # }, |
| 185 | # "/xyz/openbmc_project/state/chassis0": { |
| 186 | # "CurrentPowerState": "xyz.openbmc_project.State.Chassis.PowerState.On", |
| 187 | # "RequestedPowerTransition": "xyz.openbmc_project.State.Chassis.Transition.Off" |
| 188 | # }, |
| 189 | # "/xyz/openbmc_project/state/host0": { |
| 190 | # "AttemptsLeft": 3, |
| 191 | # "BootProgress": "xyz.openbmc_project.State.Boot.Progress.ProgressStages.OSStart", |
| 192 | # "CurrentHostState": "xyz.openbmc_project.State.Host.HostState.Running", |
| 193 | # "OperatingSystemState": "xyz.openbmc_project.State.OperatingSystem.Status.OSStatus.BootComplete", |
| 194 | # "RequestedHostTransition": "xyz.openbmc_project.State.Host.Transition.On" |
| 195 | # } |
| 196 | # } |
| 197 | |
| 198 | # System when host is booted. |
| 199 | ResetReload |
| 200 | |
| 201 | |
| 202 | *** Keywords *** |
| 203 | |
| 204 | Validate Boot AttemptsLeft |
| 205 | [Documentation] Verify boot attempts for a given system state. |
| 206 | [Arguments] ${sys_state} ${expected_attempts_left} |
| 207 | |
| 208 | # Description of argument(s): |
| 209 | # sys_state A user-defined boot state (e.g. "Off", "On", etc). |
| 210 | # See VALID_BOOT_STATES in state_map.py. |
| 211 | # expected_attempts_left Boot attempts left. |
| 212 | |
| 213 | Choose Boot And Run ${sys_state} |
| 214 | ${atempts_left}= Read Attribute ${HOST_STATE_URI} AttemptsLeft |
| 215 | Should Be True ${atempts_left} == ${expected_attempts_left} |
| 216 | |
| 217 | |
| 218 | Valid Boot States |
| 219 | [Documentation] Verify boot states for a given system state. |
| 220 | [Arguments] ${sys_state} |
| 221 | |
| 222 | # Description of argument(s): |
| 223 | # sys_state A user-defined boot state (e.g. "Off", "On", etc). |
| 224 | # See VALID_BOOT_STATES in state_map.py. |
| 225 | |
| 226 | Choose Boot And Run ${sys_state} |
| 227 | ${boot_states}= Get Boot State |
| 228 | ${valid_state}= Valid Boot State ${sys_state} ${boot_states} |
| 229 | Should Be True ${valid_state} |
| 230 | |
| 231 | |
| 232 | Choose Boot And Run |
| 233 | [Documentation] Choose system boot type. |
| 234 | [Arguments] ${option} |
| 235 | |
| 236 | # Description of argument(s): |
| 237 | # option Boot type (e.g. "Off", "On", "Reboot", etc.). |
| 238 | |
| 239 | Run Keyword If '${option}' == 'Off' |
| 240 | ... Initiate Host PowerOff |
| 241 | ... ELSE IF '${option}' == 'Reboot' |
| 242 | ... Run Keywords Initiate Host PowerOff AND Initiate BMC Reboot |
| 243 | ... AND Wait For BMC Ready |
| 244 | ... ELSE IF '${option}' == 'Running' |
| 245 | ... Power On Till Chassis Is On |
| 246 | ... ELSE IF '${option}' == 'Booted' |
| 247 | ... Initiate Host Boot |
| 248 | ... ELSE IF '${option}' == 'RebootHost' |
| 249 | ... Initiate Host Reboot |
| 250 | ... ELSE IF '${option}' == 'ResetReload' |
| 251 | ... Reboot Host And Expect Runtime |
| 252 | |
| 253 | |
| 254 | Power On Till Chassis Is On |
| 255 | [Documentation] Initiate power on and check till chassis state is just |
| 256 | ... turned "On". |
| 257 | |
| 258 | # TODO: Move to smart power off once ready. |
| 259 | Initiate Host PowerOff |
| 260 | Initiate Host Boot wait=${0} |
| 261 | Wait Until Keyword Succeeds 2 min 10 sec Is Chassis On |
| 262 | |
| 263 | # TODO: Find better mechanism instead of wait. |
| 264 | Sleep 20 Sec |
| 265 | |
| 266 | |
| 267 | Reboot Host And Expect Runtime |
| 268 | [Documentation] Initiate reset reload when host is booted. |
| 269 | |
| 270 | Initiate BMC Reboot |
| 271 | Wait Until Keyword Succeeds 10 min 10 sec Is OS Booted |
| 272 | |
| 273 | |
| 274 | Post Test Case Execution |
| 275 | [Documentation] Do the post test teardown. |
| 276 | # - Capture FFDC on test failure. |
| 277 | # - Delete error logs. |
| 278 | # - Close all open SSH connections. |
| 279 | # - Clear all REST sessions. |
| 280 | |
| 281 | FFDC On Test Case Fail |
| 282 | Delete Error Logs |
| 283 | Close All Connections |
| 284 | |