Skip to content

Commit

Permalink
Fixes to entity and Oem types with collection(
Browse files Browse the repository at this point in the history
Signed-off-by: Tomas <[email protected]>
  • Loading branch information
tomasg2012 committed Nov 12, 2021
1 parent efc2c57 commit b71ce56
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 2 additions & 4 deletions common/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ def getSchemaDocByClass(self, typename):
:return: Schema Document
:rtype: SchemaDoc
"""
if 'Collection(' in typename:
typename = typename.replace('Collection(', "").replace(')', "")
typename = getNamespaceUnversioned(typename)
typename = self.alias.get(typename, typename)
if typename in self.catalog_by_class:
Expand Down Expand Up @@ -960,10 +962,6 @@ def populate(self, payload, check=False, casted=False):
rsc_type, rsc_value, odata_value = rsc
my_str = re.sub('\{|Id\}|', '', section)
sub_obj.HasValidUriStrict = sub_obj.HasValidUriStrict and rsc_type == my_str and rsc_value == odata_value
if rsc_type != my_str:
my_logger.warning('Resource tree in URI {} has incorrect typing: {} {}'.format(my_odata_id, rsc_type, my_str))
if rsc_value != odata_value:
my_logger.warning('Resource tree in URI {} has incorrect ID: {} {}'.format(my_odata_id, rsc_value, odata_value))

if sub_obj.HasValidUriStrict:
break
Expand Down
3 changes: 3 additions & 0 deletions validateRedfish.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ def validateEntity(service, prop, val, parentURI=""):
my_logger.debug('validateEntity: name = {}'.format(name))

# check for required @odata.id
if not isinstance(val, dict):
my_logger.info("{}: EntityType val is null/absent, not testing...".format(name))
return False
uri = val.get('@odata.id')
if '@odata.id' not in val:
if autoExpand: uri = parentURI + '#/{}'.format(name.replace('[', '/').strip(']'))
Expand Down

0 comments on commit b71ce56

Please sign in to comment.