1*** Settings ***
2Documentation       Inventory of hardware FRUs under redfish/systems.
3
4Resource            ../../lib/bmc_redfish_resource.robot
5Resource            ../../lib/bmc_redfish_utils.robot
6Resource            ../../lib/openbmc_ffdc.robot
7Library             ../../lib/gen_robot_valid.py
8
9Suite Setup         Suite Setup Execution
10Suite Teardown      Suite Teardown Execution
11Test Teardown       Test Teardown Execution
12
13*** Variables ***
14
15# The passing criteria.  Must have at least this many.
16${min_num_dimms}   2
17${min_num_cpus}    1
18
19
20*** Test Cases ***
21
22Get Processor Inventory Via Redfish And Verify
23    [Documentation]  Get the number of CPUs that are functional and enabled.
24    [Tags]  Get_Processor_Inventory_Via_Redfish_And_Verify
25
26    Verify FRU Inventory Minimums  Processors  ${min_num_cpus}
27
28
29Get Memory Inventory Via Redfish And Verify
30    [Documentation]  Get the number of DIMMs that are functional and enabled.
31    [Tags]  Get_Memory_Inventory_Via_Redfish_And_Verify
32
33    Verify FRU Inventory Minimums  Memory  ${min_num_dimms}
34
35
36Get Serial And Verify Populated
37    [Documentation]  Check that the SerialNumber is non-blank.
38    [Tags]  Get_Serial_And_Verify_Populated
39
40    ${serial_number}=  Redfish.Get Attribute  ${SYSTEM_BASE_URI}  SerialNumber
41    Rvalid Value  serial_number
42    Rprint Vars  serial_number
43
44
45Get Model And Verify Populated
46    [Documentation]  Check that the Model is non-blank.
47    [Tags]  Get_Model_And_Verify_Populated
48
49    ${model}=  Redfish.Get Attribute  ${SYSTEM_BASE_URI}  Model
50    Rvalid Value  model
51    Rprint Vars  model
52
53
54*** Keywords ***
55
56
57Verify FRU Inventory Minimums
58    [Documentation]  Verify a minimum number of FRUs.
59    [Arguments]  ${fru_type}  ${min_num_frus}
60
61    # Description of Argument(s):
62    # fru_type      The type of FRU (e.g. "Processors", "Memory", etc.).
63    # min_num_frus  The minimum acceptable number of FRUs found.
64
65    # A valid FRU  will have a "State" key of "Enabled" and a "Health" key
66    # of "OK".
67
68    ${status}  ${num_valid_frus}=  Run Key U  Get Num Valid FRUs \ ${fru_type}
69
70    Return From Keyword If  ${num_valid_frus} >= ${min_num_frus}
71    Fail  Too few "${fru_type}" FRUs found, found only ${num_valid_frus}.
72
73
74Suite Teardown Execution
75    [Documentation]  Do the post suite teardown.
76
77    Redfish.Logout
78
79
80Suite Setup Execution
81    [Documentation]  Do test case setup tasks.
82
83    Redfish.Login
84    Printn
85
86
87Test Teardown Execution
88    [Documentation]  Do the post test teardown.
89
90    FFDC On Test Case Fail
91