DMTF / Redfishtool

A Python34 program that implements a command line tool for accessing the Redfish API.
Other
232 stars 69 forks source link

cannot read metadata and odata from Redfish official mockup #16

Closed wkevils closed 7 years ago

wkevils commented 7 years ago

I had installed nginx web server on a linux machine, and deployed a mockup from redfish site http://www.dmtf.org/sites/default/files/standards/documents/DSP2043_1.1.0.zip

I can run many queries successfully with this setup, like querying for Systems and Managers (see later on the output, which is OK). However, for metadat and odata I get 404 error:

python ./redfishtool.py -S Never -r 127.0.0.1 metadata redfishtool: Transport: Response Error: status_code: 404 -- Not Found

python ./redfishtool.py -S Never -r 127.0.0.1 odata redfishtool: Transport: Response Error: status_code: 404 -- Not Found

And with verbosity of 6, this is what I get: python ./redfishtool.py -vvvvvv -S Never -r 127.0.0.1 metadata

DB5: Main: subcmd: metadata, subCmdArgs:['metadata']

DB5: Main: verbose=5, status=0, user=, password=, rhost=127.0.0.1

DB5: Main: token=None, RedfishVersion=v1, Auth=Basic, Timeout=10

DB5: Main: prop=None, Id=None, Match=None:None, First=False, -1=False, Link=None

DB5: Main: gotIdOptn=False, IdOptnCount=0, gotPropOptn=False, gotMatchOptn=False

DB5: Main: 2nd-Level Collection Member reference options: -i=None, -m=None:None, -l=None -all=False

DB5: Main: 2nd-level Collection Member parsing: gotIdLevel2Optn=False, gotMatchLevel2Optn=False, IdLevel2OptnCount=0

DB5: Main: configFile=, Secure=Never, waitNum:waitTime=1:3, Degug=00000000

DB5: Main: Headers=None

DB5: Main: options parsed. Now lookup subcommand and execute it

DB5: runSubCmd: subcmd: metadata

DB5: runSubCmd: argvs: ['metadata']

DB5: runSubCmd: found SubCmd: metadata in table. executing

DB4: ServiceRoot: in getOdataMetadataDocument

DB5: getVersionsAndRootPath: read versions from rhost

DB5: Transport.getRootPath: protocolVer to use=v1, rootPath=/redfish/v1/

DB5: Transport.rftProcessRequest: method=GET, baseUrl=http://127.0.0.1/redfish/v1/, rpath=/redfish/v1/$metadata

DB5: Transport.rftProcessRequest: apiType=1

DB5: Transport.ProcessRequest: url=http://127.0.0.1/redfish/v1/$metadata

REQUEST: Transport:SendRecv: GET http://127.0.0.1/redfish/v1/$metadata

redfishtool: Transport: Response Error: status_code: 404 -- Not Found

DB5: #DB4:Main: subcommand returned with error: rc=5

Main: Error: rc=5

DB5: Response status code:404

DB5: Response headers: {'Date': 'Thu, 06 Jul 2017 10:58:23 GMT', 'Server': 'nginx/1.10.3 (Ubuntu)', 'Content-Type': 'text/html', 'Connection': 'keep-alive', 'Content-Length': '178'}

DB5: rfCleanup:Cleaningup session: None

python ./redfishtool.py -vvvvvv -S Never -r 127.0.0.1 odata

DB5: Main: subcmd: odata, subCmdArgs:['odata']

DB5: Main: verbose=5, status=0, user=, password=, rhost=127.0.0.1

DB5: Main: token=None, RedfishVersion=v1, Auth=Basic, Timeout=10

DB5: Main: prop=None, Id=None, Match=None:None, First=False, -1=False, Link=None

DB5: Main: gotIdOptn=False, IdOptnCount=0, gotPropOptn=False, gotMatchOptn=False

DB5: Main: 2nd-Level Collection Member reference options: -i=None, -m=None:None, -l=None -all=False

DB5: Main: 2nd-level Collection Member parsing: gotIdLevel2Optn=False, gotMatchLevel2Optn=False, IdLevel2OptnCount=0

DB5: Main: configFile=, Secure=Never, waitNum:waitTime=1:3, Degug=00000000

DB5: Main: Headers=None

DB5: Main: options parsed. Now lookup subcommand and execute it

DB5: runSubCmd: subcmd: odata

DB5: runSubCmd: argvs: ['odata']

DB5: runSubCmd: found SubCmd: odata in table. executing

DB4: ServiceRoot: in getOdataServiceDocument

DB5: getVersionsAndRootPath: read versions from rhost

DB5: Transport.getRootPath: protocolVer to use=v1, rootPath=/redfish/v1/

DB5: Transport.rftProcessRequest: method=GET, baseUrl=http://127.0.0.1/redfish/v1/, rpath=/redfish/v1/odata

DB5: Transport.rftProcessRequest: apiType=1

DB5: Transport.ProcessRequest: url=http://127.0.0.1/redfish/v1/odata

REQUEST: Transport:SendRecv: GET http://127.0.0.1/redfish/v1/odata

redfishtool: Transport: Response Error: status_code: 404 -- Not Found

DB5: #DB4:Main: subcommand returned with error: rc=5

Main: Error: rc=5

DB5: Response status code:404

DB5: Response headers: {'Date': 'Thu, 06 Jul 2017 10:59:11 GMT', 'Content-Type': 'text/html', 'Connection': 'keep-alive', 'Content-Length': '178', 'Server': 'nginx/1.10.3 (Ubuntu)'}

DB5: rfCleanup:Cleaningup session: None

Any idea what can be the problem here?

As mentioned earlier, this is what I get with Systems and Managers (which seems ok)

For example python ./redfishtool.py -S Never -r 127.0.0.1 Systems { "@Redfish.Copyright": "Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright.", "Name": "Computer System Collection", "Members": [ { "@odata.id": "/redfish/v1/Systems/437XR1138R2" } ], "@odata.id": "/redfish/v1/Systems", "Members@odata.count": 1, "@odata.context": "/redfish/v1/$metadata#Systems", "@odata.type": "#ComputerSystemCollection.ComputerSystemCollection" }

python ./redfishtool.py -S Never -r 127.0.0.1 Managers { "@odata.context": "/redfish/v1/$metadata#Managers", "Name": "Manager Collection", "@Redfish.Copyright": "Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright.", "Members": [ { "@odata.id": "/redfish/v1/Managers/BMC" } ], "@odata.id": "/redfish/v1/Managers", "Oem": {}, "@odata.type": "#ManagerCollection.ManagerCollection", "Members@odata.count": 1 }

mraineri commented 7 years ago

The problem is those mockups (with the exception of public-catfish) do not contain the $metadata or odata resources, so it would be impossible to ever read them. From the response you posted, it looks like you're running the public-rackmount1 mockup. Could you try this again with the public-catfish mockup?

In the end, we'll have to take this internal to refresh the mockups to contain the $metadata and odata resources.

wkevils commented 7 years ago

I tried with public-catfish (downloaded from https://github.com/openstack/python-redfish/blob/master/dmtf/DSP2043_1.1.0.zip) installed it and restated the nginx service.

python redfishtool.py -S Never -r 127.0.0.1 metadata redfishtool: Transport: Response Error: status_code: 403 -- Forbidden--user not authorized to perform action

And also (without -S Never): python redfishtool.py -r 127.0.0.1 metadata redfishtool: Transport: Response Error: status_code: 403 -- Forbidden--user not authorized to perform action

With odata it works: $python /work/src/Redfishtool/redfishtool.py -r 127.0.0.1 odata

python redfishtool.py -r 127.0.0.1 odata { "@odata.context": "/redfish/v1/$metadata", "value": [ { "name": "Service", "url": "/redfish/v1/", "kind": "Singleton" }, { "name": "Systems", "url": "/redfish/v1/Systems", "kind": "Singleton" }, { "name": "Chassis", "url": "/redfish/v1/Chassis", "kind": "Singleton" }, { "name": "Managers", "url": "/redfish/v1/Managers", "kind": "Singleton" }, { "name": "AccountService", "url": "/redfish/v1/AccountService", "kind": "Singleton" }, { "name": "SessionService", "url": "/redfish/v1/SessionService", "kind": "Singleton" }, { "name": "EventService", "url": "/redfish/v1/EventService", "kind": "Singleton" }, { "name": "JsonSchemas", "url": "/redfish/v1/JsonSchemas", "kind": "Singleton" }, { "name": "Registries", "url": "/redfish/v1/Registries", "kind": "Singleton" }, { "name": "Sessions", "url": "/redfish/v1/SessionService/Sessions", "kind": "Singleton" } ], "@Redfish.Copyright": "Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright." }

Any ideas why metadata does not work? does it work for you ?

wkevils commented 7 years ago

I see that in the public-catfish mockup, there is odata/index.json, but for the $metadata folder, there is only $metadata/index.xml, (no json file). What is expected to be under $metadata so that metadata request will work ? is a json file under $metadata is expected ?

mraineri commented 7 years ago

$metadata is an XML formatted document, so the file extension is .xml. I'm thinking the mockup server may only be capable of serving .json files. Can you try changing the file extension to .json and see if that corrects it?

wkevils commented 7 years ago

Following is what I get after renaming the extension to .json (the results seems OK). I also tried to add an "index.xml" in server section of the nginx config file (/etc/nginx/sites-available/default) and having only index.xml in the $metadata directory, and it also worked.

python /work/src/Redfishtool/redfishtool.py -S Never -r 127.0.0.1 metadata <?xml version="1.0" encoding="UTF-8"?>

mraineri commented 7 years ago

Thanks; in the end, this doesn't appear to be an issue with redfishtool. We'll migrate this issue to update DSP2043 to include the missing files, and give guidance when making local mockup servers like this to include both .json and .xml files.

mraineri commented 7 years ago

Closing 7/20: not a tool issue; the DSP bundle with the mockups will be refreshed in a future release cycle and is being tracked internally