1*** Settings ***
2Documentation       BMC server health, collect VPD and hardware status.
3
4# Test Parameters:
5# OPENBMC_HOST      The BMC host name or IP address.
6
7Resource            ../../lib/bmc_redfish_resource.robot
8Resource            ../../lib/openbmc_ffdc.robot
9
10Suite Setup         Suite Setup Execution
11Suite Teardown      Suite Teardown Execution
12Test Setup          Printn
13
14*** Variables ***
15${QUIET}  ${1}
16${rest_collected_values}  Rest collection excluded
17${redfish_collected_values}  Redfish collection excluded
18
19*** Test Cases ***
20
21Rest Collect VPD And Hardware Status
22    [Documentation]  Collect VPD and hardware status using the OpenBMC Rest API.
23    [Tags]  Rest_Collect_VPD_And_Hardware_Status  rest
24    [Teardown]  FFDC On Test Case Fail
25
26    ${system_properties}=  OpenBMC Get Request  ${HOST_INVENTORY_URI}system
27    ${system_properties}=  Evaluate  $system_properties.json()
28    ${Type}=  Read Attribute  ${CHASSIS_INVENTORY_URI}  Type
29    ${WaterCooled}=  Read Attribute  ${CHASSIS_INVENTORY_URI}  WaterCooled
30    ${AirCooled}=  Read Attribute  ${CHASSIS_INVENTORY_URI}  AirCooled
31    ${system_chassis}=  OpenBMC Get Request  ${MOTHERBOARD_INVENTORY_URI}enumerate
32    ${system_chassis}=  Evaluate  $system_chassis.json()
33    Rprint Vars  system_properties  Type  WaterCooled  AirCooled  system_chassis
34    ${rest_collected_values}=  gen_robot_print.Sprint Vars
35    ...  system_properties  Type  WaterCooled  AirCooled  system_chassis
36    Set Global Variable  ${rest_collected_values}
37
38
39Redfish Collect VPD And Hardware Status
40    [Documentation]  Collect VPD and hardware status using Redfish.
41    [Tags]  Redfish_Collect_VPD_And_Hardware_Status  redfish
42    [Setup]  Redfish.Login
43    [Teardown]  Redfish Test Teardown Execution
44
45    ${system_properties}=  Redfish_Utils.Get Properties  ${SYSTEM_BASE_URI}
46    ${system_memory_info}=  Redfish_Utils.Enumerate Request  ${SYSTEM_BASE_URI}/Memory
47    ${system_processors_info}=  Redfish_Utils.Enumerate Request  ${SYSTEM_BASE_URI}/Processors
48    ${system_fans_info}=  Redfish_Utils.Get Attribute  ${REDFISH_CHASSIS_THERMAL_URI}  Fans
49    Rprint Vars  system_properties  system_memory_info  system_processors_info  system_fans_info
50    ${redfish_collected_values}=  gen_robot_print.Sprint Vars
51    ...  system_properties  system_memory_info  system_processors_info  system_fans_info
52    Set Global Variable  ${redfish_collected_values}
53
54
55*** Keywords ***
56
57Suite Setup Execution
58    [Documentation]  Do test case setup tasks.
59
60    Set Log Level  DEBUG
61    REST Power On  stack_mode=skip
62
63
64Suite Teardown Execution
65    [Documentation]  Do suite teardown tasks. Log values and data collected.
66
67    Log  Rest collected values:${\n}${rest_collected_values}
68    Log  Redfish collected values:${\n}${redfish_collected_values}
69
70
71Redfish Test Teardown Execution
72    [Documentation]  Do the post test teardown for redfish.
73
74    Redfish.Logout
75    FFDC On Test Case Fail
76