1*** Settings *** 2Documentation Inventory of hardware resources under systems. 3 4Resource ../../lib/bmc_redfish_resource.robot 5Resource ../../lib/bmc_redfish_utils.robot 6Resource ../../lib/openbmc_ffdc.robot 7 8Suite Setup Suite Setup Execution 9Suite Teardown Suite Teardown Execution 10Test Teardown Test Teardown Execution 11 12*** Variables *** 13 14# The passing criteria. Must have at least this many. 15${min_count_dimm} 2 16${min_count_cpu} 1 17 18 19*** Test Cases *** 20 21Get Processor Inventory Via Redfish And Verify 22 [Documentation] Get the number of CPUs that are functional and enabled. 23 [Tags] Get_Processor_Inventory_Via_Redfish_And_Verify 24 25 ${num_cpus}= Count OK And Enabled cpu Processors 26 Rprint Vars num_cpus 27 Run Keyword If ${num_cpus} < ${min_count_cpu} 28 ... Fail msg=Insufficient CPU count. 29 30 31Get Memory Inventory Via Redfish And Verify 32 [Documentation] Get the number of DIMMs that are functional and enabled. 33 [Tags] Get_Memory_Inventory_Via_Redfish_And_Verify 34 35 ${num_dimms}= Count OK And Enabled dimm Memory 36 Rprint Vars num_dimms 37 Run Keyword If ${num_dimms} < ${min_count_dimm} 38 ... Fail msg=Insufficient DIMM count. 39 40 41*** Keywords *** 42 43 44Count OK And Enabled 45 [Documentation] Return the number of items that are OK and Enabled. 46 [Arguments] ${item} ${general_resource} 47 48 # Count the number of OK and Enabled items within a general_resource. 49 # Example: Count the number of cpus under 50 # /redfish/v1/Systems/system/Processors 51 52 # Description of Argument(s): 53 # item A hardware item within a general resource that has 54 # "Health" and "State" attributes, E.g. "cpu" or "dimm". 55 # general_resource A systems resource type that contains these items, such 56 # as "Processors", or "Memory". 57 58 ${num_items}= Set Variable 0 59 60 ${resources}= Redfish_Utils.List Request 61 ... /redfish/v1/Systems/system/${general_resource} 62 # Example response if general_resource = "Memory": 63 # /redfish/v1/Systems/system/Memory 64 # /redfish/v1/Systems/system/Memory/dimm0 65 # /redfish/v1/Systems/system/Memory/dimm1 66 # /redfish/v1/Systems/system/Memory/dimm2 67 # etc. 68 # Example response if general_resource = "Processors": 69 # /redfish/v1/Systems/system/Processors 70 # /redfish/v1/Systems/system/Processors/cpu0 71 # /redfish/v1/Systems/system/Processors/cpu1 72 73 :FOR ${resource} IN @{resources} 74 \ ${valid}= Is Item Enabled And Health Ok ${item} ${resource} 75 \ ${increment}= Run Keyword If 76 ... ${valid} Set Variable ${1} ELSE Set Variable ${0} 77 \ ${num_items}= Evaluate ${num_items}+${increment} 78 79 [Return] ${num_items} 80 81 82Is Item Enabled And Health Ok 83 [Documentation] Return ${True} if the item is OK and Enabled. 84 [Arguments] ${item} ${resource} 85 86 # Description of Argument(s): 87 # item A hardware item within a general resource that has 88 # "Health" and "State" attributes, E.g. "dimm". 89 # resource An individual resource to check, for example, 90 # "/redfish/v1/Systems/system/Memory/dimm0". 91 92 # Return if item is not in the resource string. This 93 # might be a top-level resource which is not a specific hardware item. 94 # Example: Return if resource = "/redfish/v1/Systems/system/Memory" but 95 # continue if resource = "/redfish/v1/Systems/system/Memory/dimm1". 96 ${valid_parameter}= Evaluate "${item}" in "${resource}" 97 Return From Keyword If not ${valid_parameter} ${False} 98 99 ${status_detail}= Redfish.Get 100 ... ${resource} valid_status_codes=[${HTTP_OK}] 101 102 ${health}= Set Variable ${status_detail.dict["Status"]["Health"]} 103 ${state}= Set Variable ${status_detail.dict["Status"]["State"]} 104 105 Return From Keyword If 106 ... "${health}" == "OK" and "${state}" == "Enabled" ${True} 107 108 [Return] ${False} 109 110 111Suite Teardown Execution 112 [Documentation] Do the post suite teardown. 113 114 Redfish.Logout 115 116 117Suite Setup Execution 118 [Documentation] Do test case setup tasks. 119 120 Redfish.Login 121 122 123Test Teardown Execution 124 [Documentation] Do the post test teardown. 125 126 FFDC On Test Case Fail 127