Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect DataSourceUri of FanSpeedsPercent collection in EnvironmentMetrics not caught #598

Open
jeaaustx opened this issue Jul 29, 2024 · 3 comments

Comments

@jeaaustx
Copy link

The 2.4.8 version of the Redfish Validator does not find an error in the path DataSourceUri property of a FanSpeedsPercent collection in EnvironmentMetrics. The validator does not visit the DataSourceUri path during the validation.

The validator reports success even though 404 is returned for the DataSourceUri.

Following are excerpts from the log file showing the issue:

INFO - Redfish Service Validator, version 2.4.8
INFO - Attempt 1 of /redfish/v1/Chassis/chassis/EnvironmentMetrics 
Body Response of /redfish/v1/Chassis/chassis/EnvironmentMetrics: b'{\n  "@odata.id": "/redfish/v1/Chassis/chassis/EnvironmentMetrics",\n  "@odata.type": "#EnvironmentMetrics.v1_3_0.EnvironmentMetrics",\n  "FanSpeedsPercent": [\n    {\n      "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fan0_0",\n      "DeviceName": "Chassis #fan0_0",\n      "SpeedRPM": 18000.0\n    },\n    {\n      "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fan0_1",\n      "DeviceName": "Chassis #fan0_1",\n      "SpeedRPM": 12036.0\n    },\n    {\n      "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fan1_0",\n      "DeviceName": "Chassis #fan1_0",\n      "SpeedRPM": 18000.0\n    },\n    {\n      "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fan1_1",\n      "DeviceName": "Chassis #fan1_1",\n      "SpeedRPM": 12036.0\n    },\n    {\n      "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fan2_0",\n      "DeviceName": "Chassis #fan2_0",\n      "SpeedRPM": 18000.0\n    },\n    {\n      "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fan2_1",\n      "DeviceName": "Chassis #fan2_1",\n      "SpeedRPM": 12036.0\n    },\n    {\n      "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fan3_0",\n      "DeviceName": "Chassis #fan3_0",\n      "SpeedRPM": 18000.0\n    },\n    {\n      "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fan3_1",\n      "DeviceName": "Chassis #fan3_1",\n      "SpeedRPM": 12036.0\n    },\n    {\n      "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fan4_0",\n      "DeviceName": "Chassis #fan4_0",\n      "SpeedRPM": 18000.0\n    },\n    {\n      "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fan4_1",\n      "DeviceName": "Chassis #fan4_1",\n      "SpeedRPM": 12036.0\n    },\n    {\n      "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fan5_0",\n      "DeviceName": "Chassis #fan5_0",\n      "SpeedRPM": 18000.0\n    },\n    {\n      "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fan5_1",\n      "DeviceName": "Chassis #fan5_1",\n      "SpeedRPM": 12036.0\n    }\n  ],\n  "[email protected]": 12,\n  "Id": "EnvironmentMetrics",\n  "Name": "Chassis Environment Metrics"\n}'
VERBOSE1 - FanSpeedsPercent
VERBOSE1 -      value: [{'DataSourceUri': '/redfish/v1/Chassis/chassis/Sensors/fan0_0', 'DeviceName': 'Chassis #fan0_0', 'SpeedRPM': 18000.0}, {'DataSourceUri': '/redfish/v1/Chassis/chassis/Sensors/fan0_1', 'DeviceName': 'Chassis #fan0_1', 'SpeedRPM': 12036.0}, {'DataSourceUri': '/redfish/v1/Chassis/chassis/Sensors/fan1_0', 'DeviceName': 'Chassis #fan1_0', 'SpeedRPM': 18000.0}, {'DataSourceUri': '/redfish/v1/Chassis/chassis/Sensors/fan1_1', 'DeviceName': 'Chassis #fan1_1', 'SpeedRPM': 12036.0}, {'DataSourceUri': '/redfish/v1/Chassis/chassis/Sensors/fan2_0', 'DeviceName': 'Chassis #fan2_0', 'SpeedRPM': 18000.0}, {'DataSourceUri': '/redfish/v1/Chassis/chassis/Sensors/fan2_1', 'DeviceName': 'Chassis #fan2_1', 'SpeedRPM': 12036.0}, {'DataSourceUri': '/redfish/v1/Chassis/chassis/Sensors/fan3_0', 'DeviceName': 'Chassis #fan3_0', 'SpeedRPM': 18000.0}, {'DataSourceUri': '/redfish/v1/Chassis/chassis/Sensors/fan3_1', 'DeviceName': 'Chassis #fan3_1', 'SpeedRPM': 12036.0}, {'DataSourceUri': '/redfish/v1/Chassis/chassis/Sensors/fan4_0', 'DeviceName': 'Chassis #fan4_0', 'SpeedRPM': 18000.0}, {'DataSourceUri': '/redfish/v1/Chassis/chassis/Sensors/fan4_1', 'DeviceName': 'Chassis #fan4_1', 'SpeedRPM': 12036.0}, {'DataSourceUri': '/redfish/v1/Chassis/chassis/Sensors/fan5_0', 'DeviceName': 'Chassis #fan5_0', 'SpeedRPM': 18000.0}, {'DataSourceUri': '/redfish/v1/Chassis/chassis/Sensors/fan5_1', 'DeviceName': 'Chassis #fan5_1', 'SpeedRPM': 12036.0}] <class 'list'>
VERBOSE1 -      is Optional
VERBOSE1 -      is Collection
DEBUG - displayType: (Collection(Sensor.Sensor), entity) -> links: Sensor
VERBOSE1 - ('Morphing Complex', 'Sensor.v1_10_0', 'Sensor', 'v9_9_9')
DEBUG - (Collection(Sensor.Sensor), {'DataSourceUri': '/redfish/v1/Chassis/chassis/Sensors/fan0_0', 'DeviceName': 'Chassis #fan0_0', 'SpeedRPM': 18000.0}, 'Collection(Sensor.Sensor)', 'NavigationProperty', 'Collection(Sensor.Sensor)')
DEBUG - (Sensor.Sensor, {'DataSourceUri': '/redfish/v1/Chassis/chassis/Sensors/fan0_0', 'DeviceName': 'Chassis #fan0_0', 'SpeedRPM': 18000.0}, 'Sensor.Sensor', 'EntityType', 'Resource.v1_0_0.Resource')
DEBUG - validateEntity: name = FanSpeedsPercent
VERBOSE1 -      Success
DEBUG - displayValue: {'DataSourceUri': '/redfish/v1/Chassis/chassis/Sensors/fan0_0', 'DeviceName': 'Chassis #fan0_0', 'SpeedRPM': 18000.0} -> [JSON Object]
DEBUG - displayType: (Collection(Sensor.Sensor), entity) -> link: Sensor
VERBOSE1 - ('Morphing Complex', 'Sensor.v1_10_0', 'Sensor', 'v9_9_9')
DEBUG - (Collection(Sensor.Sensor), {'DataSourceUri': '/redfish/v1/Chassis/chassis/Sensors/fan0_1', 'DeviceName': 'Chassis #fan0_1', 'SpeedRPM': 12036.0}, 'Collection(Sensor.Sensor)', 'NavigationProperty', 'Collection(Sensor.Sensor)')
DEBUG - (Sensor.Sensor, {'DataSourceUri': '/redfish/v1/Chassis/chassis/Sensors/fan0_1', 'DeviceName': 'Chassis #fan0_1', 'SpeedRPM': 12036.0}, 'Sensor.Sensor', 'EntityType', 'Resource.v1_0_0.Resource')
DEBUG - validateEntity: name = FanSpeedsPercent
VERBOSE1 -      Success
DEBUG - displayValue: {'DataSourceUri': '/redfish/v1/Chassis/chassis/Sensors/fan0_1', 'DeviceName': 'Chassis #fan0_1', 'SpeedRPM': 12036.0} -> [JSON Object]
DEBUG - displayType: (Collection(Sensor.Sensor), entity) -> link: Sensor
// Repeated for each member in collection

VERBOSE1 - Target, EnvironmentMetrics.v1_3_0, EnvironmentMetrics
VERBOSE1 - @odata.id                                               PASS
VERBOSE1 - @odata.type                                             PASS
VERBOSE1 - FanSpeedsPercent                                         ...
VERBOSE1 - [email protected]                            PASS
VERBOSE1 - Id                                                      PASS
VERBOSE1 - Name                                                    PASS
VERBOSE1 - AbsoluteHumidity                                    Optional
VERBOSE1 - EnergyJoules                                        Optional
VERBOSE1 - PowerLoadPercent                                    Optional
VERBOSE1 - PowerLimitWatts                                     Optional
VERBOSE1 - DewPointCelsius                                     Optional
VERBOSE1 - TemperatureCelsius                                  Optional
VERBOSE1 - HumidityPercent                                     Optional
VERBOSE1 - FanSpeedsPercent[0]                                     PASS
VERBOSE1 - FanSpeedsPercent[1]                                     PASS
VERBOSE1 - FanSpeedsPercent[2]                                     PASS
VERBOSE1 - FanSpeedsPercent[3]                                     PASS
VERBOSE1 - FanSpeedsPercent[4]                                     PASS
VERBOSE1 - FanSpeedsPercent[5]                                     PASS
VERBOSE1 - FanSpeedsPercent[6]                                     PASS
VERBOSE1 - FanSpeedsPercent[7]                                     PASS
VERBOSE1 - FanSpeedsPercent[8]                                     PASS
VERBOSE1 - FanSpeedsPercent[9]                                     PASS
VERBOSE1 - FanSpeedsPercent[10]                                    PASS
VERBOSE1 - FanSpeedsPercent[11]                                    PASS
VERBOSE1 - PowerWatts                                          Optional
VERBOSE1 - EnergykWh                                           Optional
VERBOSE1 - Actions                                             Optional
VERBOSE1 - Description                                         Optional
VERBOSE1 - Oem                                                 Optional
INFO -   PASS
VERBOSE1 - EnvironmentMetrics.v1_3_0.EnvironmentMetrics, Counter({'pass': 14, 'skipOptional': 12, 'passGet': 1, 'passRedfishUri': 1})

INFO - metadataNamespaces: 4292
pass: 14
passGet: 1
passRedfishUri: 1
skipOptional: 12
DEBUG - getSchemaDetails() -> CacheInfo(hits=0, misses=4404, maxsize=64, currsize=64)
DEBUG - callResourceURI() -> ['/redfish/v1/$metadata', '/redfish/v1/schema/RedfishExtensions_v1.xml', '/redfish/v1', '/redfish/v1/Chassis/chassis/EnvironmentMetrics']
INFO - Validation has succeeded.

Example showing error with DataSourceUri that is not found by validator:

$ curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Chassis/chassis/Sensors/fan0_0
{
  "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/fan0_0",
  "error": {
    "@Message.ExtendedInfo": [
      {
        "@odata.type": "#Message.v1_1_1.Message",
        "Message": "The requested resource of type fan0_0 named 'Sensor' was not found.",
        "MessageArgs": [
          "fan0_0",
          "Sensor"
        ],
        "MessageId": "Base.1.18.1.ResourceNotFound",
        "MessageSeverity": "Critical",
        "Resolution": "Provide a valid resource identifier and resubmit the request."
      }
    ],
    "code": "Base.1.18.1.ResourceNotFound",
    "message": "The requested resource of type fan0_0 named 'Sensor' was not found."
  }
}

I also ran the validator with --uricheck and no problems were reported for the DataSourceUri in that case either.

@mraineri
Copy link
Contributor

mraineri commented Aug 2, 2024

It's possible the tool isn't stepping into DataSourceUri since it's not a typical reference link (with @odata.id), so it may just be performing basic string validation.

If this is the case, I think we should add a check specifically for DataSourceUri in the similar manner we added one for "Uri" in MessageRegistryFile to inspect the referenced registry.

@mraineri
Copy link
Contributor

mraineri commented Aug 2, 2024

While we're adding this, we may want to consider adding "TargetComponentURI" from ComponentIntegrity since it would have a similar issue.

@jeaaustx
Copy link
Author

jeaaustx commented Sep 5, 2024

Similar issue also exists for the /redfish/v1/Chassis//ThermalSubsystem/ThermalMetrics URI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants