DMTF/Redfish-Mockup-Creator

JSON schema files treated as Redfish resources

jautor opened this issue · 1 comments

The tool will copy JSON schema files hosted on a Service and populated in the JsonSchemaFile collection. However, it treats those files, pointed to by the Location property, as if they were Redfish JSON resources, not JSON schema files. Depending on the contents of the schema, this causes the tool to crash.

Items referenced by Location properties should be simply downloaded and populated in the resulting mockup, but should not be parsed as if they were Redfish resources.

Log from issue.

C:\git\Redfish-Mockup-Creator>python --version
Python 3.7.1

C:\git\Redfish-Mockup-Creator>git show --stat
commit 18549ddc804d9d8b2d151ccd0acfa25924c44228 (HEAD -> master, tag: 1.0.4, origin/master, origin/HEAD)
Merge: aa190ee 2f87eb6
Author: Mike Raineri <michael.raineri@dell.com>
Date:   Fri Jun 21 09:52:58 2019 -0400

    Merge pull request #44 from DMTF/1.0.4-Tagging

    1.0.4 Versioning

 CHANGELOG.md           | 3 +++
 redfishMockupCreate.py | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)



python redfishMockupCreate.py  -vv

#    Creating resource at: /redfish/v1/JsonSchemas
#REQUEST: Transport:SendRecv:    GET https://172.20.25.6/redfish/v1/JsonSchemas
#    Checking for nav properties in item with k = @odata.context, v = /redfish/v1/$metadata#JsonSchemaFileCollection.JsonSchemaFileCollection
#    Checking for nav properties in item with k = @odata.etag, v = W/"1563894241"
#    Checking for nav properties in item with k = @odata.id, v = /redfish/v1/JsonSchemas
#    Checking for nav properties in item with k = @odata.type, v = #JsonSchemaFileCollection.JsonSchemaFileCollection
#    Checking for nav properties in item with k = Description, v = List of JSON Oem schemas and Extensions.
#    Checking for nav properties in item with k = @odata.id, v = /redfish/v1/JsonSchemas/BiosStaticFile.v1_0_0
#    Checking for nav properties in item with k = @odata.id, v = /redfish/v1/JsonSchemas/BiosStaticFileCollection
#    Checking for nav properties in item with k = @odata.id, v = /redfish/v1/JsonSchemas/ChangePassword.v1_0_0
#    Checking for nav properties in item with k = @odata.id, v = /redfish/v1/JsonSchemas/DynamicExtension.v1_0_0
#    Checking for nav properties in item with k = @odata.id, v = /redfish/v1/JsonSchemas/DynamicExtensionCollection
#    Checking for nav properties in item with k = @odata.id, v = /redfish/v1/JsonSchemas/DynamicExtensionRoot.v1_0_0
#    Checking for nav properties in item with k = @odata.id, v = /redfish/v1/JsonSchemas/ResetBios.v1_0_0
#    Checking for nav properties in item with k = Members, v = [{'@odata.id': '/redfish/v1/JsonSchemas/BiosStaticFile.v1_0_0'}, {'@odata.id': '/redfish/v1/JsonSchemas/BiosStaticFileCollection'}, {'@odata.id': '/redfish/v1/JsonSchemas/ChangePassword.v1_0_0'}, {'@odata.id': '/redfish/v1/JsonSchemas/DynamicExtension.v1_0_0'}, {'@odata.id': '/redfish/v1/JsonSchemas/DynamicExtensionCollection'}, {'@odata.id': '/redfish/v1/JsonSchemas/DynamicExtensionRoot.v1_0_0'}, {'@odata.id': '/redfish/v1/JsonSchemas/ResetBios.v1_0_0'}]
#    Checking for nav properties in item with k = Members@odata.count, v = 7
#    Checking for nav properties in item with k = Name, v = Schema Repository
#    Creating resource at: /redfish/v1/JsonSchemas/BiosStaticFile.v1_0_0
#REQUEST: Transport:SendRecv:    GET https://172.20.25.6/redfish/v1/JsonSchemas/BiosStaticFile.v1_0_0
#    Checking for nav properties in item with k = @odata.context, v = /redfish/v1/$metadata#JsonSchemaFile.JsonSchemaFile
#    Checking for nav properties in item with k = @odata.etag, v = W/"1563894241"
#    Checking for nav properties in item with k = @odata.id, v = /redfish/v1/JsonSchemas/BiosStaticFile.v1_0_0
#    Checking for nav properties in item with k = @odata.type, v = #JsonSchemaFile.v1_1_0.JsonSchemaFile
#    Checking for nav properties in item with k = Description, v = BiosStaticFile.v1_0_0 schema
#    Checking for nav properties in item with k = Id, v = BiosStaticFile.v1_0_0
#    Checking for nav properties in item with k = Languages, v = ['en']
#    Checking for nav properties in item with k = Language, v = en
#    Checking for nav properties in item with k = Uri, v = /redfish/v1/JsonSchemas/BiosStaticFile.v1_0_0.json
#    Checking for nav properties in item with k = Location, v = [{'Language': 'en', 'Uri': '/redfish/v1/JsonSchemas/BiosStaticFile.v1_0_0.json'}]
#    Processing location resource {'Language': 'en', 'Uri': '/redfish/v1/JsonSchemas/BiosStaticFile.v1_0_0.json'}
#    Found Location Uri /redfish/v1/JsonSchemas/BiosStaticFile.v1_0_0.json in resource
#    Appending {'@odata.id': '/redfish/v1/JsonSchemas/BiosStaticFile.v1_0_0.json'} to nav_list
#    Checking for nav properties in item with k = Name, v = BiosStaticFile.v1_0_0 schema
#    Checking for nav properties in item with k = Schema, v = BiosStaticFile.v1_0_0.BiosStaticFile
#    Creating resource at: /redfish/v1/JsonSchemas/BiosStaticFile.v1_0_0.json
#REQUEST: Transport:SendRecv:    GET https://172.20.25.6/redfish/v1/JsonSchemas/BiosStaticFile.v1_0_0.json
#    Checking for nav properties in item with k = $schema, v = http://redfish.dmtf.org/schemas/v1/redfish-schema.v1_2_0.json
#    Checking for nav properties in item with k = @odata.context, v = /redfish/v1/$metadata#BiosStaticFile.BiosStaticFile
#    Checking for nav properties in item with k = @odata.etag, v = W/"1563894241"
#    Checking for nav properties in item with k = @odata.id, v = /redfish/v1/JsonSchemas/BiosStaticFile.v1_0_0.json
#    Checking for nav properties in item with k = @odata.type, v = #BiosStaticFile.v1_0_0.BiosStaticFile
#    Checking for nav properties in item with k = copyright, v = Copyright 2014-2017 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright
#    Checking for nav properties in item with k = additionalProperties, v = False
#    Checking for nav properties in item with k = description, v = This is the root for dynamic extensions information.
#    Checking for nav properties in item with k = longDescription, v = This is the root for dynamic extensions information.
#    Checking for nav properties in item with k = description, v = This property shall specify a valid odata or Redfish property.
#    Checking for nav properties in item with k = type, v = ['array', 'boolean', 'number', 'null', 'object', 'string']
#    Checking for nav properties in item with k = ^([a-zA-Z_][a-zA-Z0-9_]*)?@(odata|Redfish|Message|Privileges)\.[a-zA-Z_][a-zA-Z0-9_.]+$, v = {'description': 'This property shall specify a valid odata or Redfish property.', 'type': ['array', 'boolean', 'number', 'null', 'object', 'string']}
#    Checking for nav properties in item with k = patternProperties, v = {'^([a-zA-Z_][a-zA-Z0-9_]*)?@(odata|Redfish|Message|Privileges)\\.[a-zA-Z_][a-zA-Z0-9_.]+$': {'description': 'This property shall specify a valid odata or Redfish property.', 'type': ['array', 'boolean', 'number', 'null', 'object', 'string']}}
#    Checking for nav properties in item with k = $ref, v = http://redfish.dmtf.org/schemas/v1/odata.4.0.0.json#/definitions/context
#    Checking for nav properties in item with k = @odata.context, v = {'$ref': 'http://redfish.dmtf.org/schemas/v1/odata.4.0.0.json#/definitions/context'}
#    Checking for nav properties in item with k = $ref, v = http://redfish.dmtf.org/schemas/v1/odata.4.0.0.json#/definitions/id
#    Checking for nav properties in item with k = @odata.id, v = {'$ref': 'http://redfish.dmtf.org/schemas/v1/odata.4.0.0.json#/definitions/id'}
#    Checking for nav properties in item with k = $ref, v = http://redfish.dmtf.org/schemas/v1/odata.4.0.0.json#/definitions/type
#    Checking for nav properties in item with k = @odata.type, v = {'$ref': 'http://redfish.dmtf.org/schemas/v1/odata.4.0.0.json#/definitions/type'}
#    Checking for nav properties in item with k = description, v = This represents when the extension was created.
#    Checking for nav properties in item with k = format, v = date-time
#    Checking for nav properties in item with k = longDescription, v = This represents when the extension was created.
#    Checking for nav properties in item with k = readonly, v = True
#    Checking for nav properties in item with k = type, v = string
#    Checking for nav properties in item with k = Created, v = {'description': 'This represents when the extension was created.', 'format': 'date-time', 'longDescription': 'This represents when the extension was created.', 'readonly': True, 'type': 'string'}
#    Checking for nav properties in item with k = $ref, v = http://redfish.dmtf.org/schemas/v1/Resource.json#/definitions/Description
#    Checking for nav properties in item with k = type, v = null
#    Checking for nav properties in item with k = anyOf, v = [{'$ref': 'http://redfish.dmtf.org/schemas/v1/Resource.json#/definitions/Description'}, {'type': 'null'}]
#    Checking for nav properties in item with k = readonly, v = True
#    Checking for nav properties in item with k = Description, v = {'anyOf': [{'$ref': 'http://redfish.dmtf.org/schemas/v1/Resource.json#/definitions/Description'}, {'type': 'null'}], 'readonly': True}
#    Checking for nav properties in item with k = $ref, v = http://redfish.dmtf.org/schemas/v1/Resource.json#/definitions/Id
#    Checking for nav properties in item with k = readonly, v = True
#    Checking for nav properties in item with k = Id, v = {'$ref': 'http://redfish.dmtf.org/schemas/v1/Resource.json#/definitions/Id', 'readonly': True}
#    Checking for nav properties in item with k = $ref, v = http://redfish.dmtf.org/schemas/v1/Resource.json#/definitions/Name
#    Checking for nav properties in item with k = readonly, v = True
#    Checking for nav properties in item with k = Name, v = {'$ref': 'http://redfish.dmtf.org/schemas/v1/Resource.json#/definitions/Name', 'readonly': True}
#    Checking for nav properties in item with k = properties, v = {'@odata.context': {'$ref': 'http://redfish.dmtf.org/schemas/v1/odata.4.0.0.json#/definitions/context'}, '@odata.id': {'$ref': 'http://redfish.dmtf.org/schemas/v1/odata.4.0.0.json#/definitions/id'}, '@odata.type': {'$ref': 'http://redfish.dmtf.org/schemas/v1/odata.4.0.0.json#/definitions/type'}, 'Created': {'description': 'This represents when the extension was created.', 'format': 'date-time', 'longDescription': 'This represents when the extension was created.', 'readonly': True, 'type': 'string'}, 'Description': {'anyOf': [{'$ref': 'http://redfish.dmtf.org/schemas/v1/Resource.json#/definitions/Description'}, {'type': 'null'}], 'readonly': True}, 'Id': {'$ref': 'http://redfish.dmtf.org/schemas/v1/Resource.json#/definitions/Id', 'readonly': True}, 'Name': {'$ref': 'http://redfish.dmtf.org/schemas/v1/Resource.json#/definitions/Name', 'readonly': True}}
Traceback (most recent call last):
  File "redfishMockupCreate.py", line 816, in <module>
    main(sys.argv)
  File "redfishMockupCreate.py", line 559, in main
    addCopyright, addHeaders, addTime, exceptionList)
  File "redfishMockupCreate.py", line 596, in recursive_call
    addCopyright, addHeaders, addTime, exceptionList)
  File "redfishMockupCreate.py", line 596, in recursive_call
    addCopyright, addHeaders, addTime, exceptionList)
  File "redfishMockupCreate.py", line 596, in recursive_call
    addCopyright, addHeaders, addTime, exceptionList)
  [Previous line repeated 8 more times]
  File "redfishMockupCreate.py", line 575, in recursive_call
    d = get_nav_and_collection_properties(rft, rs, exceptionList)
  File "redfishMockupCreate.py", line 675, in get_nav_and_collection_properties
    ns, ver, resType = rft.parseOdataType(rft, v)
  File "C:\git\Redfish-Mockup-Creator\redfishtoollib\redfishtoolTransport.py", line 1142, in parseOdataType
    resourceMatch = re.match(odataTypeMatch, resourceOdataType)
  File "C:\Python37\lib\re.py", line 173, in match
    return _compile(pattern, flags).match(string)
TypeError: expected string or bytes-like object