xref: /openbmc/openbmc-test-automation/openpower/test_occ_power.robot (revision f0e4d1f6c22b3ccec4b03e8f936086f56823b2a2)
1*** Settings ***
2Documentation   Suite to test OCC power module.
3
4Resource        ../lib/bmc_redfish_resource.robot
5Resource        ../lib/open_power_utils.robot
6Resource        ../lib/boot_utils.robot
7Resource        ../lib/state_manager.robot
8Resource        ../lib/openbmc_ffdc.robot
9Resource        ../lib/utils.robot
10
11Suite Setup     Suite Setup Execution
12Test Teardown   Test Teardown Execution
13
14Test Tags       Test_OCC_Power
15
16*** Test Cases ***
17
18Verify OCC Object Count
19    [Documentation]  Verify that OCC and inventory entries match.
20    [Tags]  Verify_OCC_Object_Count
21
22    # Example:
23    # /org/open_power/control/enumerate
24    # {
25    #    "/org/open_power/control/host0": {},
26    #    "/org/open_power/control/occ0": {
27    #       "OccActive": 0
28    #   },
29    # "/org/open_power/control/occ1": {
30    #       "OccActive": 0
31    #   }
32    # }
33
34    # Inventory counterpart cpu's:
35    # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0",
36    # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1",
37
38    ${inventory_count}=  Count Object Entries
39    ...  ${HOST_INVENTORY_URI}system/chassis/motherboard/  cpu*
40
41    Should Be Equal  ${occ_count}  ${inventory_count}
42    ...  msg=OCC and inventory entry counts are mismatched.
43
44
45Verify OCC State When Host Is Booted
46    [Documentation]  Verify OCC state when host is booted.
47    [Tags]  Verify_OCC_State_When_Host_Is_Booted
48
49    Verify OCC State  ${1}
50
51
52Verify OCC State After Host Reboot
53    [Documentation]  Verify OCC state and count after host reboot.
54    [Tags]  Verify_OCC_State_After_Host_Reboot
55
56    ${occ_count_before}=  Count OCC Object Entry
57    Verify OCC State  ${1}
58    RF SYS GracefulRestart
59    Verify OCC State  ${1}
60    ${occ_count_after}=  Count OCC Object Entry
61    Should be Equal  ${occ_count_before}  ${occ_count_after}
62
63
64Verify OCC State After BMC Reset
65    [Documentation]  Verify OCC state and count after BMC reset.
66    [Tags]  Verify_OCC_State_After_BMC_Reset
67
68    ${occ_count_before}=  Count OCC Object Entry
69    Redfish OBMC Reboot (run)
70    Verify OCC State  ${1}
71    ${occ_count_after}=  Count OCC Object Entry
72    Should be Equal  ${occ_count_before}  ${occ_count_after}
73
74
75Verify OCC State At Standby
76    [Documentation]  Verify OCC state at standby.
77    [Tags]  Verify_OCC_State_At_Standby
78
79    Redfish Power Off  stack_mode=normal
80    Verify OCC State  ${0}
81
82*** Keywords ***
83
84Suite Setup Execution
85    [Documentation]  Do the initial test suite setup.
86
87    Redfish Power On
88    Count OCC Object Entry
89
90Count OCC Object Entry
91    [Documentation]  Count OCC object entry and set count.
92
93    ${object_count}=  Count Object Entries  ${OPENPOWER_CONTROL}  occ*
94    Set Suite Variable  ${occ_count]  ${object_count}
95
96
97Test Teardown Execution
98    [Documentation]  Do the post test teardown.
99    # - Capture FFDC on test failure.
100    # - Delete error logs.
101    # - Close all open SSH connections.
102
103    FFDC On Test Case Fail
104    Redfish.Login
105    Redfish Purge Event Log
106    Close All Connections
107