DMTF / Redfish-Service-Validator

The Redfish Service Validator is a Python3 tool for checking conformance of any "device" with a Redfish service interface against Redfish CSDL schema
Other
38 stars 33 forks source link

Redfish service validator execution exit out with error "AttributeError: 'RedfishProperty' object has no attribute 'Exists'" #505

Closed sukhwinder20 closed 1 year ago

sukhwinder20 commented 1 year ago

Redfish service validator was run and it exit out with below error. Expected is that it should continue with errors and generate report .

Error message:

*** /redfish/v1/TelemetryService/MetricDefinitions Type (MetricDefinitionCollection.MetricDefinitionCollection), GET SUCCESS (time: 0:00:00.665712) Attempt 1 of /redfish/v1/TelemetryService/MetricDefinitions/CPUUtil Response Time for GET to /redfish/v1/TelemetryService/MetricDefinitions/CPUUtil: 0.5571137461811304 seconds. Attempt 1 of /redfish/v1/TelemetryService/MetricDefinitions/MemoryBusUtil Response Time for GET to /redfish/v1/TelemetryService/MetricDefinitions/MemoryBusUtil: 0.67026811465621 seconds. Attempt 1 of /redfish/v1/TelemetryService/MetricDefinitions/IOBusUtil Response Time for GET to /redfish/v1/TelemetryService/MetricDefinitions/IOBusUtil: 0.6353089399635792 seconds. Attempt 1 of /redfish/v1/TelemetryService/MetricDefinitions/CPUICUtil Response Time for GET to /redfish/v1/TelemetryService/MetricDefinitions/CPUICUtil: 0.5414357762783766 seconds. Attempt 1 of /redfish/v1/TelemetryService/MetricDefinitions/JitterCount Response Time for GET to /redfish/v1/TelemetryService/MetricDefinitions/JitterCount: 0.6452588718384504 seconds. Attempt 1 of /redfish/v1/TelemetryService/MetricDefinitions/AvgCPU0Freq Response Time for GET to /redfish/v1/TelemetryService/MetricDefinitions/AvgCPU0Freq: 0.6626146137714386 seconds. Attempt 1 of /redfish/v1/TelemetryService/MetricDefinitions/CPU0Power Response Time for GET to /redfish/v1/TelemetryService/MetricDefinitions/CPU0Power: 0.6286403555423021 seconds. Attempt 1 of /redfish/v1/TelemetryService/MetricDefinitions/AvgCPU1Freq Response Time for GET to /redfish/v1/TelemetryService/MetricDefinitions/AvgCPU1Freq: 0.5885633565485477 seconds. Attempt 1 of /redfish/v1/TelemetryService/MetricDefinitions/CPU1Power Response Time for GET to /redfish/v1/TelemetryService/MetricDefinitions/CPU1Power: 0.617467112839222 seconds. Capabilities: Value of Collection property is null but Collections cannot be null, only their entries @odata.type: Expected format is #Namespace.Type, but received: @Redfish.CollectionCapabilities: Could not finish check on this property ('failPayloadError.complex') FAIL... Traceback (most recent call last): File "RedfishServiceValidator.py", line 250, in status_code, lastResultsPage, exit_string = main() File "RedfishServiceValidator.py", line 189, in main success, counts, results, xlinks, topobj = validateURITree(currentService, '/redfish/v1/', 'ServiceRoot', expectedJson=jsonData) File "/home/bruce/validator/Redfish-Service-Validator/validateResource.py", line 344, in validateURITree returnVal = validateURITree(service, link_destination, uriName + ' -> ' + link.Name, parent=parent, allLinks=allLinks, inAnnotation=link.InAnnotation) File "/home/bruce/validator/Redfish-Service-Validator/validateResource.py", line 344, in validateURITree returnVal = validateURITree(service, link_destination, uriName + ' -> ' + link.Name, parent=parent, allLinks=allLinks, inAnnotation=link.InAnnotation) File "/home/bruce/validator/Redfish-Service-Validator/validateResource.py", line 284, in validateURITree validateSuccess, counts, results, links, thisobj = validateSingleURI(service, URI, uriName, expectedType, expectedJson, parent) File "/home/bruce/validator/Redfish-Service-Validator/validateResource.py", line 265, in validateSingleURI my_logger.debug(redfish_obj.getLinks()) File "/home/bruce/validator/Redfish-Service-Validator/common/catalog.py", line 1074, in getLinks my_links = sub.getLinks() File "/home/bruce/validator/Redfish-Service-Validator/common/catalog.py", line 1074, in getLinks my_links = sub.getLinks() File "/home/bruce/validator/Redfish-Service-Validator/common/catalog.py", line 1053, in getLinks if not item.Exists: continue AttributeError: 'RedfishProperty' object has no attribute 'Exists'

mraineri commented 1 year ago

Could you add --debugging to the CLI of the tool and provide the debug txt file produced?

sukhwinder20 commented 1 year ago

ConformanceLog_07_15_2022_001835.txt

Attaching the text file.

mraineri commented 1 year ago

There are issues with the service in terms of how it's using @Redfish.CollectionCapabilities. I'm seeing this as the value in the debug output:

{
    "@Redfish.CollectionCapabilities": {
        "@odata.type":"",
        "Capabilities":null
    }
}

@odata.type cannot be an empty string; this needs to point to a schema definition in the form #Namespace.Type. Capabilities cannot be null; it can be an empty array though (but realistically this should have members populated that describe how a client can POST to the collection).

However, those types of issues should be caught and flagged as conformance errors rather than crashes to the tools. I'll see if I can use this info to make a local mockup to debug the issue further.

tomasg2012 commented 1 year ago

As a recommendation, maybe the tool should be patched up, such that the RedfishObject doesn't have inconsistent behavior with "exists" or "value". Those two properties and others ought to have getter functions (@property decorator) that display messages/error when accessing it while the object is Not populated.