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