1*** Settings ***
2Documentation       Getting the systems thermal records for temperature.
3
4Resource            ../../lib/bmc_redfish_resource.robot
5Resource            ../../lib/bmc_redfish_utils.robot
6Resource            ../../lib/logging_utils.robot
7Resource            ../../lib/boot_utils.robot
8Resource            ../../lib/openbmc_ffdc.robot
9Library             ../../lib/gen_robot_valid.py
10Library             ../../lib/logging_utils.py
11
12Suite Setup         Suite Setup Execution
13Suite Teardown      Suite Teardown Execution
14Test Setup          Printn
15Test Teardown       Test Teardown Execution
16
17
18*** Test Cases ***
19
20Get Ambient Temperature Records
21    [Documentation]  Get the ambient temperature records.
22    [Tags]  Get_Ambient_Temperature_Records
23    [Template]  Get Thermal Records and Verify
24
25    # record_type   reading_type
26    Temperatures    ReadingCelsius
27
28
29Reboot And Check Ambient Temperature Records Are Valid
30    [Documentation]  Check the ambient temperature records are valid after a reboot.
31    [Tags]  Reboot_And_Check_Ambient_Temperature_Records_Are_Valid
32
33    Redfish OBMC Reboot (run)
34    Redfish.Login
35
36    Get Thermal Records and Verify  Temperatures  ReadingCelsius
37
38
39*** Keywords ***
40
41Get Thermal Records and Verify
42    [Documentation]  Get the thermal records for temperatures.
43    [Arguments]  ${record_type}  ${reading_type}
44
45    # Description of Arguments(s):
46    # record_type    The thermal record type (e.g. "Temperatures")
47    # reading_type   The thermal temperature readings (e.g. "ReadingCelsius")
48
49    ${records}=  Verify Valid Records  ${record_type}  ${REDFISH_CHASSIS_THERMAL_URI}  ${reading_type}
50
51    ${num_records}=  Get Length  ${records}
52    Rprint Vars  num_records  records
53
54    ${cmd}  Catenate  [x for x in ${records}
55    ...  if not x['LowerThresholdNonCritical'] <= x['${reading_type}'] <= x['UpperThresholdNonCritical']]
56    ${invalid_records}=  Evaluate  ${cmd}
57
58    ${num_invalid_records}=  Get Length  ${invalid_records}
59    Run Keyword If  ${num_invalid_records} > ${0}
60    ...  Rprint Vars  num_invalid_records  invalid_records
61    Valid Value   num_invalid_records  valid_values=[0]
62
63    Error Logs Should Not Exist
64
65
66Suite Teardown Execution
67    [Documentation]  Do the post suite teardown.
68
69    Redfish.Logout
70
71
72Suite Setup Execution
73    [Documentation]  Do test case setup tasks.
74
75    Printn
76    Redfish.Login
77    Redfish Purge Event Log
78
79
80Test Teardown Execution
81    [Documentation]  Do the post test teardown.
82
83    FFDC On Test Case Fail
84