blob: 0cdb4009378eb3255bd91dc407106a720837969d [file] [log] [blame]
George Keishing50cd0012017-09-14 12:23:41 -05001*** Settings ***
2Documentation Suite to test OCC power module.
3
4Resource ../lib/open_power_utils.robot
5Resource ../lib/boot_utils.robot
6Resource ../lib/state_manager.robot
7Resource ../lib/openbmc_ffdc.robot
George Keishing40588cc2017-11-22 08:13:37 -06008Resource ../lib/utils.robot
George Keishing50cd0012017-09-14 12:23:41 -05009
10Suite Setup Suite Setup Execution
11Test Teardown Test Teardown Execution
12
13*** Test Cases ***
14
15Verify OCC Object Count
16 [Documentation] Verify that OCC and inventory entries match.
17 [Tags] Verify_OCC_Object_Count
18
19 # Example:
20 # /org/open_power/control/enumerate
21 # {
22 # "/org/open_power/control/host0": {},
23 # "/org/open_power/control/occ0": {
24 # "OccActive": 0
25 # },
26 # "/org/open_power/control/occ1": {
27 # "OccActive": 0
28 # }
29 # }
30
31 # Inventory counterpart cpu's:
32 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0",
33 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1",
34
35 ${inventory_count}= Count Object Entries
36 ... ${HOST_INVENTORY_URI}system/chassis/motherboard/ cpu*
37
38 Should Be Equal ${occ_count} ${inventory_count}
39 ... msg=OCC and inventory entry counts are mismatched.
40
Sweta Potthuri9d62b502017-10-10 03:57:42 -050041Verify When Host Is Booted
42 [Documentation] Verify OCC state when host is booted.
43 [Tags] Verify_When_Host_Is_Booted
George Keishing50cd0012017-09-14 12:23:41 -050044
Sweta Potthuri9d62b502017-10-10 03:57:42 -050045 Verify OCC State ${1}
George Keishing50cd0012017-09-14 12:23:41 -050046
Sweta Potthuri9d62b502017-10-10 03:57:42 -050047Verify OCC State After Host Reboot
48 [Documentation] Verify OCC state and count after host reboot.
49 [Tags] Verify_OCC_State_After_Host_Reboot
George Keishing50cd0012017-09-14 12:23:41 -050050
Sweta Potthuri9d62b502017-10-10 03:57:42 -050051 ${occ_count_before} = Count OCC Object Entry
52 Verify OCC State ${1}
53 REST OBMC Reboot (run) stack_mode=normal quiet=1
54 Verify OCC State ${1}
55 ${occ_count_after} = Count OCC Object Entry
56 Should be Equal ${occ_count_before} ${occ_count_after}
George Keishing50cd0012017-09-14 12:23:41 -050057
Sweta Potthuri9d62b502017-10-10 03:57:42 -050058Verify OCC State After BMC Reset
59 [Documentation] Verify OCC state and count after BMC reset.
60 [Tags] Verify_OCC_State_After_BMC_Reset
61
62 ${occ_count_before} = Count OCC Object Entry
63 OBMC Reboot (run)
64 Verify OCC State ${1}
65 ${occ_count_after} = Count OCC Object Entry
66 Should be Equal ${occ_count_before} ${occ_count_after}
67
68Verify OCC State At Standby
69 [Documentation] Verify OCC state at standby.
70 [Tags] Verify_OCC_State_At_Standby
71
72 REST Power Off stack_mode=normal
73 Verify OCC State ${0}
George Keishing50cd0012017-09-14 12:23:41 -050074
75*** Keywords ***
76
77Suite Setup Execution
78 [Documentation] Do the initial test suite setup.
79 # - Power off.
80 # - Boot Host.
81
82 Smart Power Off
83 REST Power On
84 Count OCC Object Entry
85
George Keishing50cd0012017-09-14 12:23:41 -050086Count OCC Object Entry
87 [Documentation] Count OCC object entry and set count.
88
89 ${object_count}= Count Object Entries ${OPENPOWER_CONTROL} occ*
90 Set Suite Variable ${occ_count] ${object_count}
91
92
93Test Teardown Execution
94 [Documentation] Do the post test teardown.
95 # - Capture FFDC on test failure.
96 # - Delete error logs.
97 # - Close all open SSH connections.
98
99 FFDC On Test Case Fail
George Keishing40588cc2017-11-22 08:13:37 -0600100 Delete All Error Logs
George Keishing50cd0012017-09-14 12:23:41 -0500101 Close All Connections
102
Sweta Potthuri9d62b502017-10-10 03:57:42 -0500103Verify OCC State
104 [Documentation] Check OCC active state.
105 [Arguments] ${expected_occ_active}=${1}
106 # Description of Argument(s):
107 # expected_occ_active The expected occ_active value (i.e. 1/0).
108
109 # Example cpu_list data output:
110 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0
111 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1
112 ${cpu_list}= Get Endpoint Paths
113 ... ${HOST_INVENTORY_URI}system/chassis/motherboard/ cpu*
114
115 :FOR ${endpoint_path} IN @{cpu_list}
116 \ ${is_functional}= Read Object Attribute ${endpoint_path} Functional
117 \ Continue For Loop If ${is_functional} == ${0}
118 \ ${num}= Set Variable ${endpoint_path[-1]}
119 \ ${occ_active}= Get OCC Active State ${OPENPOWER_CONTROL}occ${num}
120 \ Should Be Equal ${occ_active} ${expected_occ_active} msg=OCC not in right state