Add testcode to verify telemetry report creation error

Changes: - Added test case to verify telemetry error creation
           with invalid data in 'Verify Basic Telemetry Report Creation'

Tested: - Ran the test case  from sandbox successfully.

Change-Id: I31f3973862936f2f380ca4ed6f8693a644adf82d
Signed-off-by: manashsarma <manashsarma@in.ibm.com>
diff --git a/redfish/telemetry_service/test_telemetry_report.robot b/redfish/telemetry_service/test_telemetry_report.robot
index 73f7f77..ba009a9 100644
--- a/redfish/telemetry_service/test_telemetry_report.robot
+++ b/redfish/telemetry_service/test_telemetry_report.robot
@@ -25,7 +25,7 @@
     [Tags]  Verify_Basic_Telemetry_Report_Creation
     [Template]  Create Basic Telemetry Report
 
-    # Metric definition Metric ReportDefinition Type   Report Actions       Append Limit
+    # Metric definition Metric ReportDefinition Type   Report Actions       Append Limit  Expected Result
     total_power         OnRequest         LogToMetricReportsCollection
     Battery_Voltage     Periodic          LogToMetricReportsCollection      100
     Ambient_0_Temp      OnRequest         LogToMetricReportsCollection
@@ -35,6 +35,7 @@
     Relative_Humidity   OnRequest         LogToMetricReportsCollection
     pcie_dcm0_power     Periodic          LogToMetricReportsCollection      32768
     io_dcm0_power       OnRequest         LogToMetricReportsCollection
+    invalid_value       OnRequest         LogToMetricReportsCollection      100             fail
 
 
 Verify Error After Exceeding Maximum Report Creation
@@ -86,6 +87,13 @@
 
     ${resp}=  Redfish.Get Properties
     ...  /redfish/v1/TelemetryService/MetricDefinitions/${metric_definition_name}
+    ...  valid_status_codes=[${HTTP_OK}, ${HTTP_NOT_FOUND}]
+    ${telemetry_data_unavailable}=  Run Keyword And Return Status  Should Contain  ${resp}  error
+    IF  ${telemetry_data_unavailable} == ${True}
+        ${metricProperties}=  Set Variable  ""
+    ELSE
+        ${metricProperties}=  Set Variable  ${resp["MetricProperties"]}
+    END 
     # Example of response from above Redfish GET request.
     # "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/Ambient_0_Temp",
     # "@odata.type": "#MetricDefinition.v1_0_3.MetricDefinition",
@@ -109,7 +117,7 @@
     ...  "Name": "Report",
     ...  "ReportActions":["${report_action}"],
     ...  "Metrics":[{"CollectionDuration": "PT30.000S",
-    ...  "MetricProperties":${resp["MetricProperties"]}}],
+    ...  "MetricProperties":${metricProperties}}],
     ...  "ReportUpdates": "AppendWrapsWhenFull",
     ...  "AppendLimit": ${append_limit},
     ...  "Schedule": {"RecurrenceInterval": "PT5.000S"}}