DMTF / Redfish-Service-Validator

The Redfish Service Validator is a Python3 tool for checking conformance of any "device" with a Redfish service interface against Redfish CSDL schema
Other
43 stars 34 forks source link

Exception thrown with validator #80

Closed veedu closed 7 years ago

veedu commented 7 years ago

I am getting the following exception thrown while running Redfish validator:

schema alias #ServiceRoot.v1_0_2.ServiceRoot schemauri /redfish/v1/$metadata#ServiceRoot.ServiceRoot config uri %s http://127.0.0.1:8000 refs [] ref link uri n frag /redfish/v1/$metadata ServiceRoot.ServiceRoot SchemaURI missing reference link: /redfish/v1/$metadata ServiceRoot.ServiceRoot xml %s $metadata schema location %s ./SchemaFiles/metadata schema uri %s /redfish/v1/$metadata schema alias $metadata schema alias $metadata schemauri /redfish/v1/$metadata config uri %s http://127.0.0.1:8000 refs [] schema alias None refs [] schema namespace ServiceRoot.v1_0_2 Got XML, but schema still doesn't exist...? ServiceRoot.v1_0_2, #ServiceRoot.v1_0_2.ServiceRoot Something went wrong Traceback (most recent call last): File "/home/vidhyag/Redfish-Service-Validator-master/traverseService.py", line 506, in init baseSoup, baseRefs, baseType, self.tagType, topVersion) File "/home/vidhyag/Redfish-Service-Validator-master/traverseService.py", line 549, in getTypeDetails str(refs.get(getNamespace(SchemaAlias), (getNamespace(SchemaAlias), None)))) Exception: exceptionType: Was not able to get type, is Schema in XML? ('ServiceRoot.v1_0_2', None) : Getting type failed for #ServiceRoot.v1_0_2.ServiceRoot #ServiceRoot.v1_0_2.ServiceRoot SchemaServiceURI /redfish/v1/$metadata

I have verified the contents of $metadata and it seems to be fine. Can you please elaborate on what should the directory structure to place the .xml and $metadata file as we get error with Redfish mockup server too? What should be the content of $metadata and ServiceRoot?

billdodd commented 7 years ago

Hi @veedu

Thanks for opening your issue here in the github repo. In order to help us understand what is causing the problem you are seeing, we would like to request the following additional actions and info:

  1. Based on the source code line numbers seen in the traceback you provided, it doesn't appear you are using the most recent version of the tool. Since there have been several recent fixes, could please fetch the latest version of the tool and re-run you test with that version.
  2. After the run, zip up the local directory from where you ran the tool. This zip should include the 2 output files (ComplianceLog.txt and ComplianceHtmlLog.html), your config.ini if you are using one (eliminate any passwords in the config file first) as well as the directory of local schema files if you are using local schema files. Attach that zip file in a comment here.
  3. You mentioned that you looked at your $metadata and ServiceRoot documents and they looked OK. Could you also please capture those and attach them here. We can then take a look and see if there are any problems with those that could be causing the error you are seeing.
  4. Show the exact command-line you are using for the test. Though you should leave out the password if you are using one.
  5. Share the version of beautifulsoup4 you are using. (run pip show beautifulsoup4)
  6. Share the version of python 3 you are using. (run python --version or python3 --version)

To answer your question about the directory structure for files for the mockup server: The directory structure within the directory you specify to the mockup server (for example my_mockup directory) should look something like this:

$ tree my_mockup/
my_mockup/
└── redfish
    ├── index.json
    └── v1
        ├── $metadata
        │   └── index.xml
        ├── Chassis
        │   ├── System.Embedded.1
        │   │   ├── Power
        │   │   │   └── index.json
        │   │   ├── Thermal
        │   │   │   └── index.json
        │   │   └── index.json
        │   └── index.json
...
        ├── Systems
        │   ├── System.Embedded.1
...
        │   └── index.json
        ├── TaskService
        │   ├── Tasks
        │   │   └── index.json
        │   └── index.json
        ├── index.json
        └── odata
            └── index.json
veedu commented 7 years ago

Redfish-Service-Validator-master.zip

Hi Bill,

Thanks for the response. beautifulsoup latest version is 4.6.0, I have modified the traverseService.py for expectedVersion as '4.6.0'. I have installed latest version of validator and still getting the following exception:

[root@aspenvail01 Redfish-Service-Validator-master]# python3 RedfishServiceValidator.py --ip 127.0.0.1:8000 -u root --nochkcert --nossl --service System Info: No desc RedfishServiceValidator Config details: ('http://127.0.0.1:8000', 'user:root', './SchemaFiles/metadata', 'no CheckCert', 'localOnly or service') Start time: 08/16/17 - 12:38:16

*** ServiceRoot, /redfish/v1

Traceback (most recent call last): File "RedfishServiceValidator.py", line 547, in validateSingleURI uriName, URI, expectedType, expectedSchema, expectedJson, parent) File "/home/vidhyag/newval/Redfish-Service-Validator-master/traverseService.py", line 496, in init fullType, SchemaURI=self.context) File "/usr/lib64/python3.4/functools.py", line 472, in wrapper result = user_function(*args, **kwds) File "/home/vidhyag/newval/Redfish-Service-Validator-master/traverseService.py", line 286, in getSchemaDetails soup = BeautifulSoup(data, "html.parser") File "/usr/lib/python3.4/site-packages/bs4/init.py", line 225, in init markup, from_encoding, exclude_encodings=exclude_encodings)): File "/usr/lib/python3.4/site-packages/bs4/builder/_htmlparser.py", line 205, in prepare_markup exclude_encodings=exclude_encodings) File "/usr/lib/python3.4/site-packages/bs4/dammit.py", line 352, in init markup, override_encodings, is_html, exclude_encodings) File "/usr/lib/python3.4/site-packages/bs4/dammit.py", line 228, in init self.markup, self.sniffed_encoding = self.strip_byte_order_mark(markup) File "/usr/lib/python3.4/site-packages/bs4/dammit.py", line 280, in strip_byte_order_mark if (len(data) >= 4) and (data[:2] == b'\xfe\xff') \ TypeError: unhashable type: 'slice' Elapsed time: 0:00:00 1 1 exceptionResource errors in /redfish/v1 Counter({'exceptionResource': 1}) Validation has failed: 1 problems found

[root@aspenvail01 newval]# pip show beautifulsoup4 Name: beautifulsoup4 Version: 4.6.0 Summary: Screen-scraping library Home-page: http://www.crummy.com/software/BeautifulSoup/bs4/ Author: Leonard Richardson Author-email: leonardr@segfault.org License: MIT Location: /usr/lib/python3.4/site-packages Requires:

[root@aspenvail01 newval]# python3 --version Python 3.4.5

I have the directory structure for mockup server the same way as you have mentioned. Herewith, I have attached the Redfish validator folder.

Thanks, Vidhya G

billdodd commented 7 years ago

Hi Vidhya,

Thanks for the update. The check for bs4 version 4.5.3 and under in the code is intentional because there is a known problem that the validator tool does not work with bs4 4.6.0. If you uninstall bs4 4.6.0 and install bs4 4.5.3, you should get better results.

Let us know how that goes.

Bill

mraineri commented 7 years ago

Closing; issue should be addressed by using the right version of beautifulsoup.

If the issue still persists, please file a new issue.

veedu commented 7 years ago

Hi, Sorry for the delay. The issue is resolved with bs4. Thanks for the quick reply and fix. Regards, Vidhya G