| manashsarma | 663c2da | 2023-05-26 06:06:14 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
| 3 | Documentation Test telemetry functionality of OpenBMC. |
| 4 | |
| 5 | Resource ../../lib/bmc_redfish_resource.robot |
| 6 | Resource ../../lib/openbmc_ffdc.robot |
| 7 | |
| 8 | Suite Setup Suite Setup Execution |
| 9 | Suite Teardown Redfish.Logout |
| manashsarma | d0cb6e1 | 2023-10-10 09:18:40 -0500 | [diff] [blame] | 10 | Test Setup Delete All Telemetry Reports |
| manashsarma | 663c2da | 2023-05-26 06:06:14 -0500 | [diff] [blame] | 11 | Test Teardown Test Teardown Execution |
| 12 | |
| Matt Fischer | 6fb70d9 | 2023-10-24 19:06:33 -0600 | [diff] [blame] | 13 | Test Tags Telemetry_Report |
| George Keishing | 5431685 | 2023-10-16 14:03:29 +0530 | [diff] [blame] | 14 | |
| manashsarma | 663c2da | 2023-05-26 06:06:14 -0500 | [diff] [blame] | 15 | *** Variables *** |
| 16 | |
| 17 | ${metric_definition_base_uri} /redfish/v1/TelemetryService/MetricReportDefinitions |
| 18 | ${metric_report_base_uri} /redfish/v1/TelemetryService/MetricReports |
| manashsarma | 20dc0fd | 2024-04-25 01:23:22 -0500 | [diff] [blame] | 19 | &{user_tele_def} ambient temperature=Ambient.*Temp pcie temperature=PCIE.*Temp |
| 20 | ... processor temperature=proc.*temp dimm temperature=dimm.*temp |
| 21 | ... battery voltage=Battery_Voltage total power=total_power |
| 22 | ... relative humidity=Relative_Humidity |
| manashsarma | 663c2da | 2023-05-26 06:06:14 -0500 | [diff] [blame] | 23 | |
| manashsarma | d0cb6e1 | 2023-10-10 09:18:40 -0500 | [diff] [blame] | 24 | |
| manashsarma | 663c2da | 2023-05-26 06:06:14 -0500 | [diff] [blame] | 25 | *** Test Cases *** |
| 26 | |
| 27 | Verify Basic Telemetry Report Creation |
| manashsarma | d0cb6e1 | 2023-10-10 09:18:40 -0500 | [diff] [blame] | 28 | [Documentation] Verify basic telemetry report creations for different metrics. |
| manashsarma | 663c2da | 2023-05-26 06:06:14 -0500 | [diff] [blame] | 29 | [Tags] Verify_Basic_Telemetry_Report_Creation |
| manashsarma | d0cb6e1 | 2023-10-10 09:18:40 -0500 | [diff] [blame] | 30 | [Template] Create Basic Telemetry Report |
| manashsarma | 663c2da | 2023-05-26 06:06:14 -0500 | [diff] [blame] | 31 | |
| manashsarma | 20dc0fd | 2024-04-25 01:23:22 -0500 | [diff] [blame] | 32 | # Metric definition Metric ReportDefinition Type Report Actions Append Limit Expected Result |
| 33 | ambient temperature OnRequest LogToMetricReportsCollection |
| 34 | processor temperature Periodic LogToMetricReportsCollection 500 |
| 35 | dimm temperature Periodic LogToMetricReportsCollection 1000 |
| 36 | total power OnRequest LogToMetricReportsCollection |
| 37 | invalid value OnRequest LogToMetricReportsCollection 100 fail |
| 38 | relative humidity OnRequest LogToMetricReportsCollection |
| 39 | battery voltage Periodic LogToMetricReportsCollection 100 |
| manashsarma | 1a0c6bf | 2023-07-27 02:27:56 -0500 | [diff] [blame] | 40 | |
| manashsarma | 46e243d | 2023-09-08 13:41:30 -0500 | [diff] [blame] | 41 | |
| 42 | Verify Error After Exceeding Maximum Report Creation |
| 43 | [Documentation] Verify error while creating telemetry report more than max report limit. |
| 44 | [Tags] Verify_Error_After_Exceeding_Maximum_Report_Creation |
| 45 | |
| 46 | ${report_name}= Set Variable Testreport |
| 47 | |
| manashsarma | 46e243d | 2023-09-08 13:41:30 -0500 | [diff] [blame] | 48 | # Create maximum number of reports. |
| 49 | ${resp}= Redfish.Get Properties /redfish/v1/TelemetryService |
| 50 | FOR ${i} IN RANGE ${resp["MaxReports"]} |
| manashsarma | 20dc0fd | 2024-04-25 01:23:22 -0500 | [diff] [blame] | 51 | Create Basic Telemetry Report total power Periodic LogToMetricReportsCollection |
| Manash Sarma | c7d333b | 2025-10-24 17:43:36 +0530 | [diff] [blame] | 52 | ... delete_report=False |
| manashsarma | 46e243d | 2023-09-08 13:41:30 -0500 | [diff] [blame] | 53 | END |
| 54 | |
| 55 | # Attempt another report creation and it should fail. |
| George Keishing | 3e469a8 | 2024-05-29 11:38:26 +0530 | [diff] [blame] | 56 | Create Basic Telemetry Report |
| 57 | ... total power Periodic LogToMetricReportsCollection expected_result=fail |
| manashsarma | 46e243d | 2023-09-08 13:41:30 -0500 | [diff] [blame] | 58 | |
| 59 | # Now delete the reports created. |
| 60 | Delete All Telemetry Reports |
| 61 | |
| manashsarma | d0cb6e1 | 2023-10-10 09:18:40 -0500 | [diff] [blame] | 62 | |
| manashsarma | 20dc0fd | 2024-04-25 01:23:22 -0500 | [diff] [blame] | 63 | Verify Basic Telemetry Report Creation For PCIE |
| 64 | [Documentation] Verify basic telemetry report creations for PCIE. |
| 65 | [Tags] Verify_Basic_Telemetry_Report_Creation_For_PCIE |
| 66 | |
| George Keishing | 3e469a8 | 2024-05-29 11:38:26 +0530 | [diff] [blame] | 67 | Create Basic Telemetry Report |
| 68 | ... pcie temperature OnRequest LogToMetricReportsCollection |
| manashsarma | 20dc0fd | 2024-04-25 01:23:22 -0500 | [diff] [blame] | 69 | |
| Nandakumar Babu | 2067a77 | 2025-12-01 11:02:16 +0530 | [diff] [blame^] | 70 | Verify Telemetry Service Unsupported Methods |
| 71 | [Documentation] Verify Telemetry Service with Unsupported methods. |
| 72 | [Tags] Verify_Telemetry_Service_Unsupported_Methods |
| 73 | |
| 74 | Verify Supported And Unsupported Methods uri=/redfish/v1/TelemetryService |
| 75 | |
| 76 | Verify Telemetry Service MetricReports Unsupported Methods |
| 77 | [Documentation] Verify Telemetry Service MetricReports with Unsupported methods. |
| 78 | [Tags] Verify_Telemetry_Service_Metric_Reports_Unsupported_Methods |
| 79 | |
| 80 | Verify Supported And Unsupported Methods uri=/redfish/v1/TelemetryService/MetricReports |
| 81 | |
| manashsarma | 20dc0fd | 2024-04-25 01:23:22 -0500 | [diff] [blame] | 82 | |
| manashsarma | 663c2da | 2023-05-26 06:06:14 -0500 | [diff] [blame] | 83 | *** Keywords *** |
| 84 | |
| Nandakumar Babu | 2067a77 | 2025-12-01 11:02:16 +0530 | [diff] [blame^] | 85 | Verify Supported And Unsupported Methods |
| 86 | [Documentation] Verify Supported And Unsupported Methods for given URI. |
| 87 | [Arguments] ${uri} |
| 88 | # Description of argument(s): |
| 89 | # uri The URI to be tested. |
| 90 | |
| 91 | # GET operation on Telemetry Service |
| 92 | Redfish.Get ${uri} |
| 93 | ... valid_status_codes=[${HTTP_OK}] |
| 94 | |
| 95 | # Put operation on Telemetry Service |
| 96 | Redfish.Put ${uri} |
| 97 | ... valid_status_codes=[${HTTP_METHOD_NOT_ALLOWED}] |
| 98 | |
| 99 | # Post operation on Telemetry Service |
| 100 | Redfish.Post ${uri} |
| 101 | ... valid_status_codes=[${HTTP_METHOD_NOT_ALLOWED}] |
| 102 | |
| 103 | # Delete operation on Telemetry Service |
| 104 | Redfish.Delete ${uri} |
| 105 | ... valid_status_codes=[${HTTP_METHOD_NOT_ALLOWED}] |
| 106 | |
| 107 | # Patch operation on Telemetry Service |
| 108 | Redfish.Patch ${uri} |
| 109 | ... valid_status_codes=[${HTTP_METHOD_NOT_ALLOWED}] |
| 110 | |
| manashsarma | 663c2da | 2023-05-26 06:06:14 -0500 | [diff] [blame] | 111 | Suite Setup Execution |
| 112 | [Documentation] Do test case setup tasks. |
| 113 | |
| 114 | Redfish.Login |
| manashsarma | d0cb6e1 | 2023-10-10 09:18:40 -0500 | [diff] [blame] | 115 | Redfish Power On stack_mode=skip |
| George Keishing | 3e469a8 | 2024-05-29 11:38:26 +0530 | [diff] [blame] | 116 | ${metric_definitions_list}= |
| 117 | ... Redfish_Utils.Get Member List /redfish/v1/TelemetryService/MetricDefinitions |
| manashsarma | 20dc0fd | 2024-04-25 01:23:22 -0500 | [diff] [blame] | 118 | |
| George Keishing | 3e469a8 | 2024-05-29 11:38:26 +0530 | [diff] [blame] | 119 | # Create a dictionary of ordinary english naming and actual naming of |
| George Keishing | 010f221 | 2025-01-08 20:25:22 +0530 | [diff] [blame] | 120 | # telemetry definition. |
| manashsarma | 20dc0fd | 2024-04-25 01:23:22 -0500 | [diff] [blame] | 121 | ${english_actual_teleDef}= Create Dictionary |
| 122 | |
| 123 | Set Suite Variable ${english_actual_teleDef} |
| 124 | Set Suite Variable ${metric_definitions_list} |
| 125 | |
| 126 | Set To Dictionary ${english_actual_teleDef} invalid value invalid_value |
| 127 | |
| 128 | # Find and collect actual telemetry definitions. |
| 129 | FOR ${key} IN @{user_tele_def.keys()} |
| 130 | Add To Telemetry definition Record ${key} ${user_tele_def['${key}']} |
| 131 | END |
| 132 | |
| 133 | |
| 134 | Add To Telemetry definition Record |
| George Keishing | 3e469a8 | 2024-05-29 11:38:26 +0530 | [diff] [blame] | 135 | [Documentation] Find actual telemetry definitions available and store. |
| 136 | ... Definitions are stored in a dictionary as key and value |
| 137 | ... as described in argument documentation. |
| manashsarma | 20dc0fd | 2024-04-25 01:23:22 -0500 | [diff] [blame] | 138 | [Arguments] ${key} ${value} |
| 139 | |
| 140 | # Description of argument(s): |
| George Keishing | 3e469a8 | 2024-05-29 11:38:26 +0530 | [diff] [blame] | 141 | # key Name of metric definition in plain english. |
| 142 | # Example: ambient temperature |
| 143 | # value Equivalent regex expression of telemetry definition. |
| 144 | # Example: Ambient.*Temp |
| manashsarma | 20dc0fd | 2024-04-25 01:23:22 -0500 | [diff] [blame] | 145 | |
| Manash Sarma | c7d333b | 2025-10-24 17:43:36 +0530 | [diff] [blame] | 146 | Set To Dictionary ${english_actual_teleDef} ${key}=Not found |
| manashsarma | 20dc0fd | 2024-04-25 01:23:22 -0500 | [diff] [blame] | 147 | FOR ${item} IN @{metric_definitions_list} |
| 148 | ${regex_matching_output}= Get Regexp Matches ${item} ${value} |
| 149 | IF ${regex_matching_output} != [] |
| 150 | Set To Dictionary ${english_actual_teleDef} ${key}=${regex_matching_output}[0] |
| Sridevi Ramesh | 6dcfc39 | 2025-05-06 11:09:43 -0500 | [diff] [blame] | 151 | BREAK |
| manashsarma | 20dc0fd | 2024-04-25 01:23:22 -0500 | [diff] [blame] | 152 | END |
| 153 | END |
| manashsarma | 663c2da | 2023-05-26 06:06:14 -0500 | [diff] [blame] | 154 | |
| 155 | |
| 156 | Test Teardown Execution |
| 157 | [Documentation] Do test teardown operation. |
| 158 | |
| 159 | FFDC On Test Case Fail |
| manashsarma | d0cb6e1 | 2023-10-10 09:18:40 -0500 | [diff] [blame] | 160 | Delete All Telemetry Reports |
| manashsarma | 46e243d | 2023-09-08 13:41:30 -0500 | [diff] [blame] | 161 | |
| 162 | |
| 163 | Create Basic Telemetry Report |
| 164 | [Documentation] Create a basic telemetry report with single metric. |
| manashsarma | d0cb6e1 | 2023-10-10 09:18:40 -0500 | [diff] [blame] | 165 | [Arguments] ${metric_definition_name} ${metric_definition_type} |
| Manash Sarma | c7d333b | 2025-10-24 17:43:36 +0530 | [diff] [blame] | 166 | ... ${report_action} ${append_limit}=10 ${expected_result}=success ${delete_report}=True |
| manashsarma | 46e243d | 2023-09-08 13:41:30 -0500 | [diff] [blame] | 167 | |
| 168 | # Description of argument(s): |
| 169 | # metric_definition_name Name of metric definition like Ambient_0_Temp. |
| manashsarma | d0cb6e1 | 2023-10-10 09:18:40 -0500 | [diff] [blame] | 170 | # metric_definition_type Name of telemetry report which needs to be created. |
| 171 | # report_action Telemetry report action. |
| George Keishing | c55a899 | 2023-11-13 12:03:43 +0530 | [diff] [blame] | 172 | # append_limit Append limit of the metric data in the report. |
| manashsarma | 46e243d | 2023-09-08 13:41:30 -0500 | [diff] [blame] | 173 | # expected_result Expected result of report creation - success or fail. |
| Manash Sarma | c7d333b | 2025-10-24 17:43:36 +0530 | [diff] [blame] | 174 | # delete_report Flag to decide if telemetry report needs to be deleted after creation. |
| manashsarma | 46e243d | 2023-09-08 13:41:30 -0500 | [diff] [blame] | 175 | |
| manashsarma | 20dc0fd | 2024-04-25 01:23:22 -0500 | [diff] [blame] | 176 | ${metric_definition_name}= Set Variable ${english_actual_teleDef}[${metric_definition_name}] |
| Manash Sarma | c7d333b | 2025-10-24 17:43:36 +0530 | [diff] [blame] | 177 | Skip If '${metric_definition_name}' == 'Not found' Metric definition is not found. |
| 178 | |
| manashsarma | 46e243d | 2023-09-08 13:41:30 -0500 | [diff] [blame] | 179 | ${resp}= Redfish.Get Properties |
| 180 | ... /redfish/v1/TelemetryService/MetricDefinitions/${metric_definition_name} |
| manashsarma | d874e9e | 2023-12-13 02:28:51 -0600 | [diff] [blame] | 181 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NOT_FOUND}] |
| 182 | ${telemetry_data_unavailable}= Run Keyword And Return Status Should Contain ${resp} error |
| 183 | IF ${telemetry_data_unavailable} == ${True} |
| 184 | ${metricProperties}= Set Variable "" |
| 185 | ELSE |
| 186 | ${metricProperties}= Set Variable ${resp["MetricProperties"]} |
| George Keishing | ee0103d | 2024-01-30 12:35:37 +0530 | [diff] [blame] | 187 | END |
| manashsarma | 46e243d | 2023-09-08 13:41:30 -0500 | [diff] [blame] | 188 | # Example of response from above Redfish GET request. |
| 189 | # "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/Ambient_0_Temp", |
| 190 | # "@odata.type": "#MetricDefinition.v1_0_3.MetricDefinition", |
| 191 | # "Id": "Ambient_0_Temp", |
| 192 | # "IsLinear": true, |
| 193 | # "MaxReadingRange": 127.0, |
| 194 | # "MetricDataType": "Decimal", |
| 195 | # "MetricProperties": [ |
| 196 | # "/redfish/v1/Chassis/chassis/Sensors/temperature_Ambient_0_Temp" |
| 197 | # ], |
| 198 | # "MetricType": "Gauge", |
| 199 | # "MinReadingRange": -128.0, |
| 200 | # "Name": "Ambient_0_Temp", |
| 201 | # "Units": "Cel" |
| 202 | |
| manashsarma | d0cb6e1 | 2023-10-10 09:18:40 -0500 | [diff] [blame] | 203 | # Report name is from random generated string with length 16 which |
| 204 | # is enough to maintain uniqueness in report name. |
| 205 | ${report_name}= Generate Random String 16 [NUMBERS]abcdef |
| manashsarma | 46e243d | 2023-09-08 13:41:30 -0500 | [diff] [blame] | 206 | ${body}= Catenate {"Id": "${report_name}", |
| manashsarma | d0cb6e1 | 2023-10-10 09:18:40 -0500 | [diff] [blame] | 207 | ... "MetricReportDefinitionType": "${metric_definition_type}", |
| 208 | ... "Name": "Report", |
| 209 | ... "ReportActions":["${report_action}"], |
| 210 | ... "Metrics":[{"CollectionDuration": "PT30.000S", |
| manashsarma | d874e9e | 2023-12-13 02:28:51 -0600 | [diff] [blame] | 211 | ... "MetricProperties":${metricProperties}}], |
| manashsarma | d0cb6e1 | 2023-10-10 09:18:40 -0500 | [diff] [blame] | 212 | ... "ReportUpdates": "AppendWrapsWhenFull", |
| 213 | ... "AppendLimit": ${append_limit}, |
| 214 | ... "Schedule": {"RecurrenceInterval": "PT5.000S"}} |
| 215 | |
| manashsarma | 46e243d | 2023-09-08 13:41:30 -0500 | [diff] [blame] | 216 | ${body}= Replace String ${body} ' " |
| 217 | ${dict} Evaluate json.loads('''${body}''') json |
| 218 | |
| 219 | ${status_code_expected}= Set Variable If |
| 220 | ... '${expected_result}' == 'success' [${HTTP_CREATED}] |
| 221 | ... '${expected_result}' == 'fail' [${HTTP_BAD_REQUEST}] |
| 222 | |
| 223 | Redfish.Post ${metric_definition_base_uri} body=&{dict} |
| 224 | ... valid_status_codes=${status_code_expected} |
| 225 | |
| manashsarma | d0cb6e1 | 2023-10-10 09:18:40 -0500 | [diff] [blame] | 226 | IF '${expected_result}' == 'success' |
| 227 | # Verify definition of report has attributes provided at the time of creation. |
| 228 | ${resp_report}= Redfish.Get ${metric_definition_base_uri}/${report_name} |
| 229 | ... valid_status_codes=[${HTTP_OK}] |
| 230 | Should Be True '${resp_report.dict["MetricReportDefinitionType"]}' == '${metric_definition_type}' |
| 231 | Should Be True '${resp_report.dict["AppendLimit"]}' == '${AppendLimit}' |
| 232 | Should Be True '${resp_report.dict["ReportActions"][0]}' == '${report_action}' |
| 233 | Should Be True |
| 234 | ... '${resp_report.dict["Metrics"]}[0][MetricProperties][0]' == '${resp["MetricProperties"][0]}' |
| 235 | END |
| 236 | |
| Manash Sarma | c7d333b | 2025-10-24 17:43:36 +0530 | [diff] [blame] | 237 | IF ${delete_report} == ${True} |
| 238 | Delete All Telemetry Reports |
| 239 | END |
| 240 | |
| manashsarma | 46e243d | 2023-09-08 13:41:30 -0500 | [diff] [blame] | 241 | |
| 242 | Delete All Telemetry Reports |
| 243 | [Documentation] Delete all existing telemetry reports. |
| 244 | |
| 245 | ${report_list}= Redfish_Utils.Get Member List /redfish/v1/TelemetryService/MetricReportDefinitions |
| 246 | FOR ${report} IN @{report_list} |
| 247 | Redfish.Delete ${report} valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] |
| 248 | END |