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

ActionInfo passes even if there is an error #497

Closed FighterNan closed 11 months ago

FighterNan commented 2 years ago

Version

8fa8b03 (HEAD -> master, origin/master, origin/HEAD) 2.1.6 versioning

The following two payloads both PASS.

# this is wrong, Parameters shall be an array of objects
{
    "@odata.id": "/redfish/v1/Chassis/fake_chassis/ResetActionInfo",
    "@odata.type": "#ActionInfo.v1_1_2.ActionInfo",
    "Id": "ResetActionInfo",
    "Name": "Reset Action Info",
    "Parameters": {
        "AllowableValues": [
            "PowerCycle"
        ],
        "DataType": "String",
        "Name": "ResetType",
        "Required": true
    }
}

{
    "@odata.id": "/redfish/v1/Chassis/fake_chassis/ResetActionInfo",
    "@odata.type": "#ActionInfo.v1_1_2.ActionInfo",
    "Id": "ResetActionInfo",
    "Name": "Reset Action Info",
    "Parameters": [
        {
            "AllowableValues": [
                "PowerCycle"
            ],
            "DataType": "String",
            "Name": "ResetType",
            "Required": true
        }
    ]
}
jautor commented 2 years ago

Do you get an actual "pass" report for the ActionInfo resource, or is it not present? The tool may be skipping ActionInfo resources (I seem to recall this but haven't looked yet). If that's the case, it's probably time for it to actually check those...

FighterNan commented 2 years ago

Yes, I confirm they both get green "PASS" sign.

jautor commented 2 years ago

Thanks. We will need to take a look at this, but clearly a bug. I'm concerned as to how this got through the type checking since this is an array of objects vs. a single object. I'll want to make sure that isn't a data type class-level miss...

mraineri commented 2 years ago

This is not specific for ActionInfo. Any property that is defined as an array of objects will hit this issue.

I've been peeling some things apart and notice off behavior with propRealType, isCollection = prop.Type.getBaseType() found at line 418 in validateRedfish.py. Depending on the structure of the property in the live payload, it takes different code paths, which I would not expect; I would expect it to behave entirely based on schema definitions and not be affected by payloads from the service.