From 5690e21a351a465bda1fb1115502324a48454547 Mon Sep 17 00:00:00 2001 From: Tomas Date: Thu, 2 May 2024 11:22:28 -0500 Subject: [PATCH 1/3] Added write only check for permissions such as password Signed-off-by: Tomas --- redfish_service_validator/validateRedfish.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/redfish_service_validator/validateRedfish.py b/redfish_service_validator/validateRedfish.py index 680ad7f..577bd72 100644 --- a/redfish_service_validator/validateRedfish.py +++ b/redfish_service_validator/validateRedfish.py @@ -410,7 +410,7 @@ def checkPropertyConformance(service, prop_name, prop, parent_name=None, parent_ return {prop_name: ('-', '-', 'Yes' if prop.Exists else 'No', 'OEM')}, counts # Parameter Passes - paramPass = propMandatoryPass = propNullablePass = deprecatedPassOrSinceVersion = nullValid = True + paramPass = propMandatoryPass = propNullablePass = deprecatedPassOrSinceVersion = nullValid = permissionValid = True if prop.Type.IsMandatory: propMandatoryPass = True if prop.Exists else False @@ -550,6 +550,13 @@ def checkPropertyConformance(service, prop_name, prop, parent_name=None, parent_ if prop.Exists: paramPass = propNullablePass = True + + # + if prop.Type.Permissions == "OData.Permission/Write": + if val is not None: + my_logger.error('{}: Permissions for this property are Write only, reading this property should be null!!!'.format(sub_item)) + counts['failWriteOnly'] += 1 + if val is None: if propNullable: my_logger.debug('Property {} is nullable and is null, so Nullable checking passes'.format(sub_item)) From 3a7f06c450a6128bf0d70dcd01779ea413974204 Mon Sep 17 00:00:00 2001 From: Tomas Date: Thu, 2 May 2024 11:36:56 -0500 Subject: [PATCH 2/3] Ensure table entry reads FAIL when failing write req Signed-off-by: Tomas --- redfish_service_validator/validateRedfish.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/redfish_service_validator/validateRedfish.py b/redfish_service_validator/validateRedfish.py index 577bd72..15a6834 100644 --- a/redfish_service_validator/validateRedfish.py +++ b/redfish_service_validator/validateRedfish.py @@ -555,6 +555,7 @@ def checkPropertyConformance(service, prop_name, prop, parent_name=None, parent_ if prop.Type.Permissions == "OData.Permission/Write": if val is not None: my_logger.error('{}: Permissions for this property are Write only, reading this property should be null!!!'.format(sub_item)) + permissionValid = False counts['failWriteOnly'] += 1 if val is None: @@ -584,7 +585,7 @@ def checkPropertyConformance(service, prop_name, prop, parent_name=None, parent_ # Render our result my_type = prop.Type.fulltype - if all([paramPass, propMandatoryPass, propNullablePass, excerptPass]): + if all([paramPass, propMandatoryPass, propNullablePass, excerptPass, permissionValid]): my_logger.verbose1("\tSuccess") counts['pass'] += 1 result_str = 'PASS' From 61eea6203961fc46d4501c87a70d9314a1342ce9 Mon Sep 17 00:00:00 2001 From: Mike Raineri Date: Fri, 3 May 2024 09:35:21 -0400 Subject: [PATCH 3/3] Added special 'None' permission unique for Session Signed-off-by: Mike Raineri --- redfish_service_validator/validateRedfish.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redfish_service_validator/validateRedfish.py b/redfish_service_validator/validateRedfish.py index 15a6834..8a620bd 100644 --- a/redfish_service_validator/validateRedfish.py +++ b/redfish_service_validator/validateRedfish.py @@ -552,7 +552,7 @@ def checkPropertyConformance(service, prop_name, prop, parent_name=None, parent_ paramPass = propNullablePass = True # - if prop.Type.Permissions == "OData.Permission/Write": + if prop.Type.Permissions == "OData.Permission/Write" or prop.Type.Permissions == "OData.Permission/None": if val is not None: my_logger.error('{}: Permissions for this property are Write only, reading this property should be null!!!'.format(sub_item)) permissionValid = False