Skip to content

Commit 42fa163

Browse files
authored
Merge pull request #225 from ArnoldTchegou/fix-wildcard-validation-in-URIs
fixed wildcard substitution for URIs validation in UseCase
2 parents f9f8849 + 87d052f commit 42fa163

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

redfish_interop_validator/interop.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -764,18 +764,18 @@ def validateActionRequirement(profile_entry, rf_payload_tuple, actionname):
764764
return msgs, counts
765765

766766

767-
URI_ID_REGEX = '\{[A-Za-z0-9]*Id\}'
767+
URI_ID_REGEX = '\{[A-Za-z0-9]+\}'
768768

769-
VALID_ID_REGEX = '([A-Za-z0-9.!#$&-;=?\[\]_~])+'
769+
VALID_ID_REGEX = '[A-Za-z0-9.!#$&-;=?\[\]_~]+'
770770

771771

772772
def compareRedfishURI(expected_uris, uri):
773773
success = False
774774
# If we have our URIs
775775
if expected_uris is not None:
776-
my_uri_regex = "^{}$".format("|".join(expected_uris))
777-
my_uri_regex = re.sub(URI_ID_REGEX, VALID_ID_REGEX, my_uri_regex)
778-
success = re.fullmatch(my_uri_regex, uri) is not None
776+
regex_pattern = "^{}$".format("|".join(expected_uris))
777+
regex_pattern = re.sub(URI_ID_REGEX, VALID_ID_REGEX, regex_pattern)
778+
success = re.fullmatch(regex_pattern, uri) is not None
779779
else:
780780
success = True
781781
return success

0 commit comments

Comments
 (0)