DMTF / Redfish-Usecase-Checkers

This is a collection of python3 tools to exercise and validate common use cases for Redfish
Other
1 stars 6 forks source link

The ErrorMessages meaning about Query Parameter Checker #58

Closed FelixD999 closed 2 years ago

FelixD999 commented 2 years ago

Hi, After run the Query Parameter Checker, all the ErrorMessages show Query ({}) expected to expand resource {} on the result.json. But I try to GET /redfish/v1/?$expand=* or other supported syntax can expand resource like below: expand resource

I'm not sure if error messages also means anything else. Could you help to explain literal meaning if I misunderstand or our respond body doesn't meet specifications. Test result and manual test respond content attached for you refer. results and manual test.zip

mraineri commented 2 years ago

The error messages indicate when the service root was requested to be expanded with the different options, the subordinate resources (like AccountService) were not expanded. At least from your screenshot, everything looks correct to me, so we'll need to see why these errors are coming up.

Can you please share the version of the python-redfish-library you have installed using this command?

pip3 show redfish

I know there have been fixes to the library to address some query parameter issues, and I'd like to rule those out if possible.

FelixD999 commented 2 years ago

Version information of the python-redfish-library attached: root@felixxx:~/Downloads/Redfish-Usecase-Checkers/query_parameters# pip3 show redfish Name: redfish Version: 3.1.1 Summary: Redfish Python Library Home-page: https://github.com/DMTF/python-redfish-library Author: DMTF, https://www.dmtf.org/standards/feedback Author-email: None License: BSD 3-clause "New" or "Revised License" Location: /usr/local/lib/python3.8/dist-packages Requires: requests-toolbelt, jsonpointer, jsonpath-rw, requests, jsonpatch Required-by: redfish-utilities

mraineri commented 2 years ago

Great, thanks! I'll do some debugging with this info.

mraineri commented 2 years ago

I am finding that the urllib3 module is percent encoding the query parameters, and I'm wondering if Postman doesn't do this. Unfortunately the service I have available seems to handle percent-encoding of query parameters, so it's been passing validation.

Could you please try modifying the request you're making in Postman to use this URI?

/redfish/v1/?%24expand=.

If this doesn't expand for you, we'll need to look further into the tools to see if we can prevent percent encoding of query parameters.

ldonova1992 commented 2 years ago

Hi All,

I am also running into this issue. I am able to expand through a browser but the test ERRORs out saying its expecting to expand the resource. I tried the following request in my browser and in Postman, and that does not expand for me.

/redfish/v1/?%24expand=.

mraineri commented 2 years ago

Thanks for that info; that's making me thing this really is a percent-encoding issue. Would like to confirm with @FelixD999 that they see the same behavior if using percent-encoded query parameters in Postman.

FelixD999 commented 2 years ago

The URI above doesn't expand in Postman. percent-encoded

mraineri commented 2 years ago

Thanks for confirming. We will need to figure out how to prevent percent-encoding of the query parameters.

mraineri commented 2 years ago

@FelixD999 there's a change to the Redfish Python library (version 3.1.6) to prevent percent encoding of certain characters. Please update your version (pip install redfish -U) and see if that resolves the issue.

One thing to note is while the library was over-using percent-encoding, it's perfectly legal to percent-encode characters. Other off-the-shelf libraries may percent-encode query parameters.

FelixD999 commented 2 years ago

Thanks for your help. The issue has been resolved. It looks good now.

mraineri commented 2 years ago

Closing; resolved with an update to the Python library