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