xref: /openbmc/openbmc-test-automation/redfish/telemetry_service/test_telemetry_report.robot (revision 42c84ea5d0dd320e1a1d57bcba34fcb788c7788c)
1*** Settings ***
2
3Documentation       Test telemetry functionality of OpenBMC.
4
5Resource            ../../lib/bmc_redfish_resource.robot
6Resource            ../../lib/openbmc_ffdc.robot
7
8Suite Setup         Suite Setup Execution
9Suite Teardown      Redfish.Logout
10Test Teardown       Test Teardown Execution
11
12*** Variables ***
13
14${metric_definition_base_uri}  /redfish/v1/TelemetryService/MetricReportDefinitions
15${metric_report_base_uri}      /redfish/v1/TelemetryService/MetricReports
16
17*** Test Cases ***
18
19Verify Basic Telemetry Report Creation
20    [Documentation]  Verify if a telemetry basic report is created.
21    [Tags]  Verify_Basic_Telemetry_Report_Creation
22    [Teardown]  Redfish.Delete  ${metric_definition_base_uri}/${report_name}
23    ...  valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}]
24
25    ${report_name}=  Set Variable  Test_basic_report_ambient_temp
26    ${resp}=  Redfish.Get Properties
27    ...  /redfish/v1/TelemetryService/MetricDefinitions/Ambient_0_Temp
28    ${body}=  Catenate  {"Id": "${report_name}",
29    ...  "MetricReportDefinitionType": "OnRequest",
30    ...  "ReportActions":["LogToMetricReportsCollection"],
31    ...  "Metrics":[{"MetricProperties":${resp["MetricProperties"]}}]}
32    ${body}=  Replace String  ${body}  '  "
33    ${dict}  Evaluate  json.loads('''${body}''')  json
34
35    Redfish.Post  ${metric_definition_base_uri}  body=&{dict}
36     ...  valid_status_codes=[${HTTP_CREATED}]
37
38    Redfish.Get  ${metric_report_base_uri}/Test_basic_report_ambient_temp
39     ...  valid_status_codes=[${HTTP_OK}]
40
41
42Verify Basic Periodic Telemetry Report Creation
43    [Documentation]  Verify if a telemetry basic periodic report is created.
44    [Tags]  Verify_Basic_Periodic_Telemetry_Report_Creation
45    [Teardown]  Redfish.Delete  ${metric_definition_base_uri}/${report_name}
46    ...  valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}]
47
48    ${report_name}=  Set Variable  Test_basic_periodic_report_ambient_temp
49    ${resp}=  Redfish.Get Properties
50    ...  /redfish/v1/TelemetryService/MetricDefinitions/Ambient_0_Temp
51    ${body}=  Catenate  {"Id": "${report_name}",
52    ...  "MetricReportDefinitionType": "Periodic",
53    ...  "Name": "Report",
54    ...  "ReportActions":["LogToMetricReportsCollection"],
55    ...  "Metrics":[{"CollectionDuration": "PT30.000S",
56    ...  "CollectionFunction": "Average","MetricProperties":${resp["MetricProperties"]}}],
57    ...  "ReportUpdates": "AppendWrapsWhenFull",
58    ...  "AppendLimit":10,
59    ...  "Schedule": {"RecurrenceInterval": "PT5.000S"}}
60    ${body}=  Replace String  ${body}  '  "
61    ${dict}  Evaluate  json.loads('''${body}''')  json
62
63    Redfish.Post  ${metric_definition_base_uri}  body=&{dict}
64     ...  valid_status_codes=[${HTTP_CREATED}]
65
66    ${resp}=  Redfish.Get  ${metric_definition_base_uri}/${report_name}
67    Should Be True  '${resp.dict["MetricReportDefinitionType"]}' == 'Periodic'
68
69*** Keywords ***
70
71Suite Setup Execution
72    [Documentation]  Do test case setup tasks.
73
74    Redfish.Login
75
76
77Test Teardown Execution
78    [Documentation]  Do test teardown operation.
79
80    FFDC On Test Case Fail
81