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

Validator Should Not Require a Resources Object #212

Open
rgmain opened this issue Aug 14, 2024 · 2 comments
Open

Validator Should Not Require a Resources Object #212

rgmain opened this issue Aug 14, 2024 · 2 comments

Comments

@rgmain
Copy link
Contributor

rgmain commented Aug 14, 2024

The validator fails to run when a profile does not contain a Resouces object. The Interop Profiles spec does not appear to require a Resources object.

Program finished prematurely: argument of type 'NoneType' is not iterable
Traceback (most recent call last):
  File "/root/redfish_interop/RedfishInteropValidator.py", line 10, in <module>
    status_code, lastResultsPage, exit_string = main()
  File "/root/redfish_interop/redfish_interop_validator/RedfishInteropValidator.py",
    line 229, in main 
    success, _, resultsNew, _, _ = validateURITree('/redfish/v1/', profile,
    'ServiceRoot', expectedJson=jsonData)
  File "/root/redfish_interop/redfish_interop_validator/validateResource.py", line 261,
    in validateURITree
    validateSingleURI(URI, profile, uriName, expectedType, expectedSchema, expectedJson)
  File "/root/redfish_interop/redfish_interop_validator/validateResource.py", line 128, 
    in validateSingleURI
    if SchemaType not in profile_resources:
TypeError: argument of type 'NoneType' is not iterable
Traceback (most recent call last):
  File "/root/redfish_interop/RedfishInteropValidator.py", line 10, in <module>
    status_code, lastResultsPage, exit_string = main()
  File "/root/redfish_interop/redfish_interop_validator/RedfishInteropValidator.py",
    line 229, in main
    success, _, resultsNew, _, _ = validateURITree('/redfish/v1/', profile, 'ServiceRoot',
    expectedJson=jsonData)
  File "/root/redfish_interop/redfish_interop_validator/validateResource.py", line 261,
    in validateURITree
    validateSingleURI(URI, profile, uriName, expectedType, expectedSchema, expectedJson)
  File "/root/redfish_interop/redfish_interop_validator/validateResource.py", line 128,
    in validateSingleURI
    if SchemaType not in profile_resources:
TypeError: argument of type 'NoneType' is not iterable

Use Cases

Example 1: This "base" profile only requires other profiles.

    "SchemaDefinition": "RedfishInteroperabilityProfile.v1_6_0",
    "ProfileName": "My Top-Level Profile",
    "ProfileVersion": "1.0.0",
    "RequiredProfiles": {
        "Thermal": {
            "MinVersion": "1.0.0"
        },
        "Power": {
            "MinVersion": "1.0.0"
        },
        "StorageController": {
            "MinVersion": "1.0.0"
        }
    }
}

Example 2: This profile documents required message registries. While the validator would probably not be run against this use case, it serves to illustrate why a profile might not have a Resources object.

{
    "SchemaDefinition": "RedfishInteroperabilityProfile.v1_6_0",
    "ProfileName": "My Required Message Registries",
    "ProfileVersion": "1.0.0",
    "Registries": {
        "Environmental": {
            "MinVersion": "1.0.0"
        },
        "Power": {
            "MinVersion": "1.0.0"
        },
        "StorageDevice": {
            "MinVersion": "1.1.0"
        }
    }
}

@jautor may have some input on this based on our recent conversation.

@jautor
Copy link
Member

jautor commented Aug 15, 2024

Yes, I agree this is a bug, as there is no requirement for a Resources object in a profile. Although we certainly expected it, and this is a corner case that was obviously not covered...

Note that a profile that has no resource requirements (due to a bundling of required profiles as shown in case 1 above), you could add a requirement on "ServiceRoot" and at least one required property (such as SessionService) so that the tool functions as-is, but doesn't actually create any phantom requirements (because any implementation would pass that test).

@mraineri
Copy link
Contributor

Agreed; haven't actually seen a profile yet without resources, but it is certainly valid.

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

3 participants