Git Product home page Git Product logo

redfishtool's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

redfishtool's Issues

Query regarding fetching the data for Chassis member

Hi Team,

I am a newbie to Redfish. I have created a RedfishMockServer using and RedfishMockupCreator and the server is up.

I wanted to use redfishtool to fetch the data "http://10.XXX.XXX.XXX:8000/redfish/v1/Chassis/1U/Power/" ?

Can someone give me some points to fetch the "/redfish/v1/Chassis/1U/power " data please ?

I am able to fetch the chassis data successfully using the following command:

python3 redfishtool.py -r 10.XXX.XXX.XXX:8000 -u root -p 0penBmc1 Chassis

Also i tried to fetch the "1U" data using the following command but no luck:
python3 redfishtool.py -r 10.138.129.156:8000 -u root -p 0penBmc1 Chassis -I "1U"

Can someone give me pointers to fetch the "/redfish/v1/Chassis/1U/Power/" data.

Thanks & Regards,
Khader B Shaik

Error 405 -- Method Not Allowed

Not sure if this is appropriate question it may be more of an HP DL360 question but...

I am trying to use redfishtool to change a BIOS setting on an HP DL360. I am using the same general technique that I used on other Redfish implementations (like supermicro) and it worked fine there.

python3 redfishtool.py -r ilomxq61101ng -u name -p password raw PATCH -d '{"ProcHyperthreading": "Disabled"}' /redfish/v1/systems/1/bios

but on the DL360 this gives:
redfishtool: Transport: Response Error: status_code: 405 -- Method Not Allowed

Should I be able to change a BIOS setting in this way on that system?

Bad request syntax when using Redfish-Profile-Simulator

All commands that I submit through the redfishtool are met with bad request syntax error on the simulator side.

For example:

python redfishtool.py --user=root --password=password123456 --rhost=127.0.0.1:5000 Chassis list

Response is:

127.0.0.1 - - [15/Aug/2017 13:11:09] "GET /redfish/v1/ HTTP/1.1" 200 -
127.0.0.1 - - [15/Aug/2017 13:11:09] code 400, message Bad request syntax ('\x16\x03\x01\x02\x00\x01\x00\x01\xfc\x03\x03\x8b"\xe4\xb7\xbb?v\x8eh\xaek\xca\'\x80{R\x13\xde-\xb3\x18\xa9\x83\\\x80\x04kTV.\xb57\x00\x00n\xc00\xc0,\xc02\xc0.\xc0/\xc0+\xc01\xc0-\x00\xa5\x00\xa3\x00\xa1\x00\x9f\x00\xa4\x00\xa2\x00\xa0\x00\x9e\xc0(\xc0$\xc0\x14\xc0')
127.0.0.1 - - [15/Aug/2017 13:11:09] "��"䷻?v�h�k�'�{R�-���\�kTV.�7n�0�,�2�.�/�+�1�-���������(�$��" 400 -

The simulator was started using the command: python redfishProfileSimulatorMain.py

Am I missing some configuration or is this a bug?

Request for "Broker" Redfish API

Hi Dell,
Could you design a centralized "Brokers" redfish API to consolidate the sensor readings?
If I want to get power consumption, thermal, Intel ME readings... etc., I have to invoke the Systems or Chassis API subcomponent many times. Is it possible to design a "broker" settings to deliver sensor reading value for management software in the future? It will be more convenient to monitor servers.
Sorry for that I don't know how to give feedback to DMTF, so I leave my message here.

Sincerely,
John

Can't run redfishtool.py (in virtualenv?)

(redfishtool-virtualenv) installer@xxx:~$ redfishtool.py 
Traceback (most recent call last):
  File "/home/installer/redfishtool-virtualenv/bin/redfishtool.py", line 4, in <module>
    __import__('pkg_resources').run_script('redfishtool==1.0.0', 'redfishtool.py')
  File "/home/installer/redfishtool-virtualenv/lib/python3.5/site-packages/pkg_resources/__init__.py", line 719, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/home/installer/redfishtool-virtualenv/lib/python3.5/site-packages/pkg_resources/__init__.py", line 1511, in run_script
    exec(script_code, namespace, namespace)
  File "/home/installer/redfishtool-virtualenv/lib/python3.5/site-packages/redfishtool-1.0.0-py3.5.egg/EGG-INFO/scripts/redfishtool.py", line 14, in <module>
  File "/home/installer/redfishtool-virtualenv/bin/redfishtool.py", line 4, in <module>
    __import__('pkg_resources').run_script('redfishtool==1.0.0', 'redfishtool.py')
  File "/home/installer/redfishtool-virtualenv/lib/python3.5/site-packages/pkg_resources/__init__.py", line 719, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/home/installer/redfishtool-virtualenv/lib/python3.5/site-packages/pkg_resources/__init__.py", line 1511, in run_script
    exec(script_code, namespace, namespace)
  File "/home/installer/redfishtool-virtualenv/lib/python3.5/site-packages/redfishtool-1.0.0-py3.5.egg/EGG-INFO/scripts/redfishtool.py", line 14, in <module>
ImportError: cannot import name 'main'
(redfishtool-virtualenv) installer@xxx:~$ python --version
Python 3.5.2
(redfishtool-virtualenv) installer@xxx:~$ pip list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
certifi (2017.4.17)
chardet (3.0.4)
idna (2.5)
pip (9.0.1)
pkg-resources (0.0.0)
redfishtool (1.0.0)
requests (2.17.3)
setuptools (36.0.1)
urllib3 (1.21.1)
wheel (0.30.0a0)
(redfishtool-virtualenv) installer@xxx:~$ 

If I rename $venv/bin/redfishtool.py to $venv/bin/redfishtool all works ok.

The problem is that $venv/bin/redfishtool.py is imported by pkg_resources and main() is searched in there instead of redfishtool package.

redfishtool: getCollection: Error getting service root, aborting

While running the redfish utility i am getting the following error:-

$python3 redfishtool -r ########### -u ######### -p ####### Systems list

ERROR LOG :-

/home/vkchlt0163/.local/lib/python3.5/site-packages/requests/init.py:91: RequestsDependencyWarning: urllib3 (1.25.2) or chardet (3.0.4) doesn't match a supported version!
RequestsDependencyWarning)
redfishtool: getCollection: Error getting service root, aborting

Can anyone please help me out

Managers setTimeOffset usage error and offset parsing issue

Redfishtool Managers setTimeOffset offset=<offsetString> has two issues:

  1. the main usage in Managers -h has wrong format. left off the offset=
    but the error message usage prints have it correct
  2. the parser is not parsing offset=
    .
    Note that the form offset=<offsetString> was used because offsetString cant be a normal commandline argument since it can start with a - char. so intent had been to pass in with offset=<offsetString> all along as indicated by the error messages.
    .
    See Pull Request to fix

Redfishtool - assume command targets on collections with one member

Per discussion in the Legacy Removal TF, one of the commonly-stated barriers to Redfish usage is the difficulty in dealing with the hypermedia URIs (i.e. "no fixed URIs"). With v1.6 we fixed much of this, but users still need to know the "Id" value for each Resource Collection. However, for the vast majority of users today, the primary collections (Systems, Chassis, Managers) have exactly one member. But we can't assume the Id value (nor do we want to open that can of worms again), so the user has to learn that Id by first reading the collection resource.

To improve this experience for most users, we should enhance Redfishtool to assume the URI / ID target for most commands if it is not specified, using the following rules:

  • Traverse each Collection using the "only" query parameter (to show this usage in the code!) to determine if there is exactly one member in the collection.
  • If only one member exists, use that ID value to execute the command, and output the ID value with messages to explain how to use it. Example: "No ID specified, found Systems ID '234z343' to apply".
  • If multiple members exist, fail the command and display all of the ID values found with any useful context and explain proper usage to specify which target. Example: "No ID target specified, found multiple Chassis IDs: '1', '2', '3', 'enclosure', 'pwrshelf'. Re-issue command with -I to select target.

Read password from file (or prompt for it)

AFAICT, Redfishtool currently requires that the Redfish password be passed as a command-line argument. This is a well known anti-pattern, as it potentially allows anyone who can view the process list on the system to view the password.

At a minimum, Redfish tool should be able to read the password from a file, which is useful for scripting. It would be nice if it were able to prompt for the password, for more "one off" usage.

Incorrect help output for "raw" subcommand

$ python3 redfishtool.py raw -h
...
     GET             -- HTTP GET method
     PATCH           -- HTTP GET method
     POST            -- HTTP GET method
     DELETE          -- HTTP GET method
     HEAD            -- HTTP GET method
     PUT             -- HTTP GET method
...

how do we send multipart/form-data and file information via redfishtool.py ?

via redfishtool.py, I would like to send content-type as multipart/form-data and file information. I have this command via CURL, but how can we send this via redfishtool.py ?

time curl -k -u Administrator:superuser -X POST -H 'content-type: multipart/form-data' -F 
image_file=@$(pwd)/afile-v130.tgz 
https://<IP>/redfish/v1/UpdateService/Actions/Oem/UpdateService.FwUpldBundle

python-redfish installation issue

sudo pip install --upgrade setuptoolsDownloading/unpacking setuptools from https://files.pythonhosted.org/packages/ec/51/f45cea425fd5cb0b0380f5b0f048ebc1da5b417e48d304838c02d6288a1e/setuptools-41.0.1-py2.py3-none-any.whl#sha256=c7769ce668c7a333d84e17fe8b524b1c45e7ee9f7908ad0a73e1eda7e6a5aebf
Downloading setuptools-41.0.1-py2.py3-none-any.whl (575kB): 575kB downloaded
Installing collected packages: setuptools
Found existing installation: setuptools 3.3
Not uninstalling setuptools at /usr/lib/python2.7/dist-packages, owned by OS
Successfully installed setuptools
Cleaning up...
(redfish)chandra@chandra-OptiPlex-3020:~$ sudo pip install python-redfish
Downloading/unpacking python-redfish
Downloading python-redfish-0.4.1.tar.gz (6.0MB): 6.0MB downloaded
Running setup.py (path:/tmp/pip_build_root/python-redfish/setup.py) egg_info for package python-redfish
{ 'conf': { u'dst': u'etc',
u'fdst': [u'/usr/local/etc/redfish-client.conf'],
u'src': [u'redfish-client/etc/redfish-client.conf']},
'rccusage': { u'dst': u'share/redfish-client/',
u'fdst': [ u'/usr/local/share/redfish-client/redfish-check-cartridge_usage.txt'],
u'src': [ u'redfish-client/redfish-check-cartridge_usage.txt']},
'rfcusage': { u'dst': u'share/redfish-client/',
u'fdst': [ u'/usr/local/share/redfish-client/redfish-client_usage.txt'],
u'src': [u'redfish-client/redfish-client_usage.txt']},
u'script': { u'dst': u'bin',
u'fdst': [ u'/usr/local/bin/redfish-client',
u'/usr/local/bin/redfish-check-cartridge'],
u'src': [ u'redfish-client/redfish-client',
u'redfish-client/redfish-check-cartridge']},
'templates': { u'dst': u'share/redfish-client/templates',
u'fdst': [ u'/usr/local/share/redfish-client/templates/manager_info.template',
u'/usr/local/share/redfish-client/templates/chassis_info.template',
u'/usr/local/share/redfish-client/templates/system_info.template'],
u'src': [ u'redfish-client/templates/manager_info.template',
u'redfish-client/templates/chassis_info.template',
u'redfish-client/templates/system_info.template']}}
Searching for pbr
Reading https://pypi.python.org/simple/pbr/
Best match: pbr 5.1.3
Downloading https://files.pythonhosted.org/packages/97/76/c151aa4a3054ce63bb6bbd32f3541e4ae068534ed8b74ee2687f6773b013/pbr-5.1.3.tar.gz#sha256=8c361cc353d988e4f5b998555c88098b9d5964c2e11acf7b0d21925a66bb5824
Processing pbr-5.1.3.tar.gz
Writing /tmp/easy_install-LgPZk8/pbr-5.1.3/setup.cfg
Running pbr-5.1.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-LgPZk8/pbr-5.1.3/egg-dist-tmp-D47MbA
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'long_description_content_type'
warnings.warn(msg)
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'project_urls'
warnings.warn(msg)

Installed /tmp/pip_build_root/python-redfish/pbr-5.1.3-py2.7.egg
Marker evaluation failed, see the following error.  For more information see: http://docs.openstack.org/pbr/latest/user/using.html#environment-markers
ERROR:root:Error parsing
Traceback (most recent call last):
  File "/tmp/pip_build_root/python-redfish/pbr-5.1.3-py2.7.egg/pbr/core.py", line 96, in pbr
    attrs = util.cfg_to_args(path, dist.script_args)
  File "/tmp/pip_build_root/python-redfish/pbr-5.1.3-py2.7.egg/pbr/util.py", line 258, in cfg_to_args
    kwargs = setup_cfg_to_setup_kwargs(config, script_args)
  File "/tmp/pip_build_root/python-redfish/pbr-5.1.3-py2.7.egg/pbr/util.py", line 456, in setup_cfg_to_setup_kwargs
    if pkg_resources.evaluate_marker('(%s)' % env_marker):
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1271, in evaluate_marker
    return cls.interpret(parser.expr(text).totuple(1)[1])
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1306, in interpret
    return op(nodelist)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1223, in atom
    return cls.interpret(nodelist[2])
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1306, in interpret
    return op(nodelist)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1241, in comparison
    raise SyntaxError(repr(cop)+" operator not allowed in environment markers")
SyntaxError: '<' operator not allowed in environment markers
error in setup command: Error parsing /tmp/pip_build_root/python-redfish/setup.cfg: SyntaxError: '<' operator not allowed in environment markers
Complete output from command python setup.py egg_info:
{   'conf': {   u'dst': u'etc',

            u'fdst': [u'/usr/local/etc/redfish-client.conf'],

            u'src': [u'redfish-client/etc/redfish-client.conf']},

'rccusage': {   u'dst': u'share/redfish-client/',

                u'fdst': [   u'/usr/local/share/redfish-client/redfish-check-cartridge_usage.txt'],

                u'src': [   u'redfish-client/redfish-check-cartridge_usage.txt']},

'rfcusage': {   u'dst': u'share/redfish-client/',

                u'fdst': [   u'/usr/local/share/redfish-client/redfish-client_usage.txt'],

                u'src': [u'redfish-client/redfish-client_usage.txt']},

u'script': {   u'dst': u'bin',

               u'fdst': [   u'/usr/local/bin/redfish-client',

                            u'/usr/local/bin/redfish-check-cartridge'],

               u'src': [   u'redfish-client/redfish-client',

                           u'redfish-client/redfish-check-cartridge']},

'templates': {   u'dst': u'share/redfish-client/templates',

                 u'fdst': [   u'/usr/local/share/redfish-client/templates/manager_info.template',

                              u'/usr/local/share/redfish-client/templates/chassis_info.template',

                              u'/usr/local/share/redfish-client/templates/system_info.template'],

                 u'src': [   u'redfish-client/templates/manager_info.template',

                             u'redfish-client/templates/chassis_info.template',

                             u'redfish-client/templates/system_info.template']}}

Searching for pbr

Reading https://pypi.python.org/simple/pbr/

Best match: pbr 5.1.3

Downloading https://files.pythonhosted.org/packages/97/76/c151aa4a3054ce63bb6bbd32f3541e4ae068534ed8b74ee2687f6773b013/pbr-5.1.3.tar.gz#sha256=8c361cc353d988e4f5b998555c88098b9d5964c2e11acf7b0d21925a66bb5824

Processing pbr-5.1.3.tar.gz

Writing /tmp/easy_install-LgPZk8/pbr-5.1.3/setup.cfg

Running pbr-5.1.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-LgPZk8/pbr-5.1.3/egg-dist-tmp-D47MbA

/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'long_description_content_type'

warnings.warn(msg)

/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'project_urls'

warnings.warn(msg)

Installed /tmp/pip_build_root/python-redfish/pbr-5.1.3-py2.7.egg

Marker evaluation failed, see the following error. For more information see: http://docs.openstack.org/pbr/latest/user/using.html#environment-markers

ERROR:root:Error parsing

Traceback (most recent call last):

File "/tmp/pip_build_root/python-redfish/pbr-5.1.3-py2.7.egg/pbr/core.py", line 96, in pbr

attrs = util.cfg_to_args(path, dist.script_args)

File "/tmp/pip_build_root/python-redfish/pbr-5.1.3-py2.7.egg/pbr/util.py", line 258, in cfg_to_args

kwargs = setup_cfg_to_setup_kwargs(config, script_args)

File "/tmp/pip_build_root/python-redfish/pbr-5.1.3-py2.7.egg/pbr/util.py", line 456, in setup_cfg_to_setup_kwargs

if pkg_resources.evaluate_marker('(%s)' % env_marker):

File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1271, in evaluate_marker

return cls.interpret(parser.expr(text).totuple(1)[1])

File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1306, in interpret

return op(nodelist)

File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1223, in atom

return cls.interpret(nodelist[2])

File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1306, in interpret

return op(nodelist)

File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1241, in comparison

raise SyntaxError(repr(cop)+" operator not allowed in environment markers")

SyntaxError: '<' operator not allowed in environment markers

error in setup command: Error parsing /tmp/pip_build_root/python-redfish/setup.cfg: SyntaxError: '<' operator not allowed in environment markers


Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/python-redfish
Storing debug log for failure in /home/chandra/.pip/pip.log

skip1=False -- SyntaxError: invalid syntax

[vincentlee@on-net ~]$ redfishtool -r 10.0.0.2 -u redacted -p redacted Systems examples
Traceback (most recent call last):
  File "/usr/local/bin/redfishtool", line 14, in <module>
    from redfishtool import main
  File "/usr/local/lib/python2.7/site-packages/redfishtool/__init__.py", line 5, in <module>
    from .redfishtoolMain import main
  File "/usr/local/lib/python2.7/site-packages/redfishtool/redfishtoolMain.py", line 21, in <module>
    from .redfishtoolTransport   import RfTransport
  File "/usr/local/lib/python2.7/site-packages/redfishtool/redfishtoolTransport.py", line 723
    def printVerbose(self,v,*argv, skip1=False, printV12=True,**kwargs):
                                       ^
SyntaxError: invalid syntax

AssetTag is not a required field

redfishtool systems is expecting "AssetTag" in Members list but it is not required filed actually. Due to this we are seeing script failures.

udock redfishtool -r -u -p --Secure=Always Systems list
{
"_Path": "/redfish/v1/Systems",
"Name": "Computer System Collection",
"[email protected]": 1,
"Members": []
}

but in Systems.py we are seeing it is looking for AssetTag and etc.

def list(self,sc,op,rft, cmdTop=False, prop=None):
rft.printVerbose(4,"{}:{}: in operation".format(rft.subcommand,sc.operation))

    # getCollection
    collName="Systems"
    rc,r,j,d=op.getCollection(sc,op, rft)
    if( rc != 0):  return(rc,r,False,None)
    #loop through the members and create the list sub-operation response
    rc,r,j,d=rft.listCollection(rft, r, d, prop="AssetTag")
    if(rc==0):
        rft.printVerbose(1," list {} Collection member info: Id, URI, AssetTag".format(collName,skip1=True, printV12=cmdTop))
    return(rc,r,j,d)

https://github.com/DMTF/Redfishtool/blob/master/redfishtool/Systems.py
In redfish systems.py code they are looking for (“Id”, “URI” and “AssetTag”).

list -- list information about the Systems collection members("Id", URI, and AssetTag)

Mockup which supports actions

Is there any mockup which supports actions ?
I try with catfish, and I get
this repsonse: redfishtool: Transport: Response Error: status_code: 404 -- Not Found
It seems to me that the reason is that the reason is that there is no "/redfish/v1/Systems/1/Actions", which is what is expected.
Here is the full log:

$python redfishtool.py -S Never -r 127.0.0.1 Systems -I 1 reset On

GET: Headers: Host: 127.0.0.1
Accept-Encoding: identity
Connection: keep-alive
OData-Version: 4.0
User-Agent: python-requests/2.9.1
Accept: application/json

False
127.0.0.1 - - [08/Jul/2017 15:39:25] "GET /redfish/v1/ HTTP/1.1" 200 -
GET: Headers: Host: 127.0.0.1
Accept-Encoding: identity
Connection: keep-alive
OData-Version: 4.0
Authorization: Basic Og==
User-Agent: python-requests/2.9.1
Accept: application/json

False
127.0.0.1 - - [08/Jul/2017 15:39:25] "GET /redfish/v1/Systems HTTP/1.1" 200 -
GET: Headers: Host: 127.0.0.1
Accept-Encoding: identity
Connection: keep-alive
OData-Version: 4.0
Authorization: Basic Og==
User-Agent: python-requests/2.9.1
Accept: application/json

False
127.0.0.1 - - [08/Jul/2017 15:39:25] "GET /redfish/v1/Systems/1 HTTP/1.1" 200 -
POST: Headers: Host: 127.0.0.1
Accept-Encoding: identity
Content-Length: 19
OData-Version: 4.0
User-Agent: python-requests/2.9.1
Accept: application/json
Connection: keep-alive
Authorization: Basic Og==
Content-Type: application/json

POST: Data: {'ResetType': 'On'}
127.0.0.1 - - [08/Jul/2017 15:39:25] "POST /redfish/v1/Systems/1/Actions/ComputerSystem.Reset HTTP/1.1" 404 -
redfishtool: Transport: Response Error: status_code: 404 -- Not Found

SetIpAddress

Hi All,

Interested in implementing setIpAddress command.
Please let me know if anyone is working/designing on it.

Thanks

Suggestion: add wheel package

Wheel package is installable for both Linux and Windows users.
I confirmed that a wheel package which created from the redfishtool repository can be also installed on Windows environments:

Redfishtool\dist>pip install redfishtool-1.0.5-py3-none-any.whl
Processing g:\workspace\githubdesktop\redfishtool\dist\redfishtool-1.0.5-py3-none-any.whl
Requirement already satisfied: requests in c:\python36\lib\site-packages (from redfishtool==1.0.5) (2.19.1)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\python36\lib\site-packages (from requests->redfishtool==1.0.5) (3.0.4)
Requirement already satisfied: certifi>=2017.4.17 in c:\python36\lib\site-packages (from requests->redfishtool==1.0.5) (2018.4.16)
Requirement already satisfied: idna<2.8,>=2.5 in c:\python36\lib\site-packages (from requests->redfishtool==1.0.5) (2.7)
Requirement already satisfied: urllib3<1.24,>=1.21.1 in c:\python36\lib\site-packages (from requests->redfishtool==1.0.5) (1.23)
Installing collected packages: redfishtool
Successfully installed redfishtool-1.0.5

This would solve issue #28.
You may need to change the release process a little bit, for example:

$ python setup.py sdist bdist_wheel  # build packages for both tarball and wheel package
...
$ ls dist
redfishtool-1.0.5-py3-none-any.whl  redfishtool-1.0.5.tar.gz
$ twine upload dist/redfishtool-1.0.5-py3-none-any.whl dist/redfishtool-1.0.5.tar.gz  # upload for both packages

Keep upgrading or obsoleted?

Hi,

I am seeking for a fundamental lib/tool to build my script, the Redfishtool is a wonderful one that suits me.
But I noticed the last commit is 7 months ago, the RedFish spec and Schema spec is evolving, I worry if this tool is still maintained.
Another question is: do you have plan to update the coding style to meet Python PEP 8?

Thanks,
Sea

cannot read metadata and odata from Redfish official mockup

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",
"[email protected]": 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",
"[email protected]": 1
}

Enhancements to Redfishtool to support Sensor and Inventory listing

We are looking to enhance redfishtool to add support for additional functions since these functions are either not supported, or require multiple commands to get this data or the output is not very user friendly.

For example:

  • single option to list all sensors
  • single option to list all inventory
  • list error logs (enhance output format)
  • Create, list, delete and extract dumps

Why Redfish?

Why is there a need for this Redfish when we already have similar technologies like REST,..etc?

Redfishtool not working:

Hello!
I would like to get the power consumption of my server through redfishtool but whatever the command i run, i get this error message. Before i get the following message i ran "python redfishtool.py -h".
I have no knowledge of python language. Please could you help me fix this problem?
Regards

Traceback (most recent call last):
File "redfishtool.py", line 14, in
from redfishtool import main
File "/home/noemie/Documents/Redfishtool-master/redfishtool/init.py", line 5, in
from .redfishtoolMain import main
File "/home/noemie/Documents/Redfishtool-master/redfishtool/redfishtoolMain.py", line 21, in
from .redfishtoolTransport import RfTransport
File "/home/noemie/Documents/Redfishtool-master/redfishtool/redfishtoolTransport.py", line 716
def printVerbose(self,v,*argv, skip1=False, printV12=True,**kwargs):
^
SyntaxError: invalid syntax

Redfishtool is easy to come up error "Execution timeout" and " redfishtool: raw: Error getting response"

Hi,
Could you help me sloved the redfishtool bug? It is very easy to come up error "Execution timeout" or " redfishtool: raw: Error getting response", but curl tool would not come up.
For example1 :
Execution timeout! Command [redfishtool -sssss -r [redacted IP address] -u admin -p [redacted password] -T 90 -S Always raw GET /redfish/v1/UpdateService] doesn't finish in 90sec:

redfishtool: raw: Error getting response
[root@OrcOgrim ~]# redfishtool -sssss -r [redacted IP address] -u admin -p [redacted password] -T 90 -S Always raw GET /redfish/v1/UpdateService


For example2 :
Execution timeout! Command [redfishtool -sssss -r [redacted IP address] -u admin -p [redacted password] -T 30 -S Always raw GET /redfish/v1/Chassis/Self] doesn't finish in 30sec: --- redfishtool -sssss -r [redacted IP address] -u admin -p [redacted password] -T 30 -S Always raw GET /redfish/v1/Chassis/Self ---

--match opt does not parse MAC address correctly

When parsing "key:value" from a -m/--match opt, it should read the key as the value up to the first ":", not the last one. Otherwise, you get this behavior when trying to match a MAC address:

python3 redfishtool.py ... EthernetInterfaces -m "MACAddress:08:00:69:17:A1:1B"
Traceback (most recent call last):
  File "redfishtool.py", line 18, in <module>
    main(sys.argv)
  File "/root/Redfishtool/redfishtool/redfishtoolMain.py", line 362, in main
    rc,r,j,d=runSubCmd(rft)
  File "/root/Redfishtool/redfishtool/redfishtoolMain.py", line 439, in runSubCmd
    rc,r,j,d=subCmdTable[rft.subcommand](rft,cmdTop=True)
  File "/root/Redfishtool/redfishtool/Managers.py", line 159, in ManagersMain
    rc,r,j,d = self.runOperation(rft)
  File "/root/Redfishtool/redfishtool/Managers.py", line 116, in runOperation
    rc,r,j,d=operationTable[self.operation](self, op, rft, cmdTop=True)
  File "/root/Redfishtool/redfishtool/Managers.py", line 521, in getEnetInterfaces
    path2,rc,r,j,d=rft.getLevel2ResourceById(rft,r,d)
  File "/root/Redfishtool/redfishtool/redfishtoolTransport.py", line 964, in getLevel2ResourceById
    if( d[rft.matchLevel2Prop] == rft.matchLevel2Value ):
KeyError: 'MACAddress:08:00:69:17:A1'

From the above stack trace, it appears that from MACAddress:08:00:69:17:A1:1B it reads "1B" as the value and all before that as the key.

Raw patch is failing on JSON input data

I was trying to change password on HP Proliant G9 (server supporting Redfish API) because builtin functionality - AccountService is not working (another possible candidate for an issue).
I followed HP Redfish API data model and constructed raw call with JSON data {'Password': 'TEST123'} (in quotes in the shell command).
However I'm getting JSON error about NoneType when loading the string to patchData variable:

redfishtool.py --Secure=Always -v -r 172.12.3.45 -u Admin -p ABCDEFG raw PATCH '/rest/v1/AccountService/Accounts/1' '{"Password": "TEST123"}' Traceback (most recent call last): File "/home/lubos/Redfishtool/redfishtool.py", line 19, in <module> main(sys.argv) File "/home/lubos/Redfishtool/redfishtool/redfishtoolMain.py", line 372, in main rc,r,j,d=runSubCmd(rft) File "/home/lubos/Redfishtool/redfishtool/redfishtoolMain.py", line 449, in runSubCmd rc,r,j,d=subCmdTable[rft.subcommand](rft,cmdTop=True) File "/home/lubos/Redfishtool/redfishtool/raw.py", line 146, in RawMain rc,r,j,d = self.runOperation(rft) File "/home/lubos/Redfishtool/redfishtool/raw.py", line 105, in runOperation rc,r,j,d=operationTable[self.operation](self, op, rft, cmdTop=True) File "/home/lubos/Redfishtool/redfishtool/raw.py", line 241, in httpPatch patchData=json.loads(rft.requestData) File "/usr/lib/python3.5/json/__init__.py", line 312, in loads s.__class__.__name__)) TypeError: the JSON object must be str, not 'NoneType'

SessionService logout fails if given no response body

"SessionService logout" fails with "Transport: Error loading Data" if the session deletion response does not include a body. But it is valid for a redfish session deletion to have no response body. See section 6.4.4.4 in the spec:

6.4.4.4. Delete (DELETE)
The DELETE method is used to remove a resource.

  • Services shall support the DELETE method for resources that can be deleted. If the resource can never be deleted, status code 405 shall be returned.
  • Services may return a representation of the just deleted resource in the response body.

Enhancement: --no-proxy option

Proposed enhancement:

It could be interesting to have an option ignoring network proxy configuration. At least a simple option like the --no-proxy option of wget.

I'd love to implement it, but I am not a programmer at all :-(

How to run redfishtool locally without a network cable connection?

ipmitool can be run locally without setting up a BMC network.
Does redfishtool have the same function?

Example>
Condition : DONOT set BMC network or if set, the BMC network cable is not connected.
[ok] ipmitool -I open sel list or ipmitool sel list
[ok] ipmitool -I lanplus -H BMC_LOCAL_IP -U USER -P PASSWORD sel list
[Failed] redfishtool -r BMC_LOCAL_IP -U USER -P PASSWORD raw GET /redfish/v1/Systems/1

setIndicatorLed fails with public-catfist mockup

It seems that setIndicatorLed does not work (I am trying with the public-catfish mockup)

I do get the following when reading Systems/1:
python /work/src/Redfishtool/redfishtool.py -S Never -r 127.0.0.1 Systems -I 1
{
"AssetTag": "CATFISHASSETTAG",
"HostName": "catfishHostname",
"IndicatorLED": "Off",
"SystemType": "Physical",
"Actions": {
"#ComputerSystem.Reset": {
"target": "/redfish/v1/Systems/1/Actions/ComputerSystem.Reset",
"[email protected]": [
"On",
"ForceOff",
"GracefulShutdown",
"ForceRestart",
"Nmi",
"GracefulRestart",
"ForceOn"
]
}
},
"Status": {
"Health": "OK",
"State": "Enabled"
},
"LogServices": {
"@odata.id": "/redfish/v1/Systems/1/LogServices"
},
"PartNumber": "",
"PowerState": "On",
"@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.",
"UUID": "00000000-0000-0000-0000-000000000000",
"@odata.type": "#ComputerSystem.v1_1_0.ComputerSystem",
"SerialNumber": "2M220100SL",
"Model": "YellowCat1000",
"Description": "Catfish Implementation Recipe of simple scale-out monolithic server",
"BiosVersion": "X00.1.2.3.4(build-23)",
"@odata.id": "/redfish/v1/Systems/1",
"@odata.context": "/redfish/v1/$metadata#ComputerSystem.ComputerSystem",
"SKU": "",
"Links": {
"ManagedBy": [
{
"@odata.id": "/redfish/v1/Managers/bmc"
}
],
"Chassis": [
{
"@odata.id": "/redfish/v1/Chassis/1"
}
],
"Oem": {}
},
"Manufacturer": "CatfishManufacturer",
"Name": "Catfish System",
"Id": "1",
"Boot": {
"BootSourceOverrideEnabled": "Once",
"BootSourceOverrideTarget": "Pxe",
"BootSourceOverrideMode": "UEFI",
"UefiTargetBootSourceOverride": "uefiDevicePath",
"[email protected]": [
"None",
"Pxe",
"Usb",
"Hdd",
"BiosSetup",
"UefiTarget",
"UefiHttp"
]
}
}

But when I am trying:
python -S Never -r 127.0.0.1 Systems -I 1 setIndicatorLed Lit
I get:
redfishtool: Transport: Response Error: status_code: 405 -- Method Not Allowed

And with debug verbosity of 6, I get:

python redfishtool.py -vvvvvv -S Never -r 127.0.0.1 Systems -I 1 setIndicatorLed Lit
#DB5: Main: subcmd: Systems, subCmdArgs:['Systems', 'setIndicatorLed', 'Lit']
#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=1, Match=Id:1, First=True, -1=False, Link=None
#DB5: Main: gotIdOptn=True, IdOptnCount=1, gotPropOptn=False, gotMatchOptn=True
#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: Systems
#DB5: runSubCmd: argvs: ['Systems', 'setIndicatorLed', 'Lit']
#DB5: runSubCmd: found SubCmd: Systems in table. executing
#DB4: SystemsMain: subcommand: Systems
#DB5: Systems: operation=setIndicatorLed, args=['setIndicatorLed', 'Lit']
#DB5: Systems:runOperation: operation: setIndicatorLed
#DB5: Systems:runOperation: args: ['setIndicatorLed', 'Lit']
#DB5: Systems:runOperation: found Oper: Systems in table. executing
#DB4: Systems:setIndicatorLed: in operation
#DB4: Systems:setIndicatorLed: in operation
#DB4: Systems:setIndicatorLed: in getCollection
#DB4: ServiceRoot: in getServiceRoot
#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/
#DB5: Transport.rftProcessRequest: apiType=1
#DB5: Transport.ProcessRequest: url=http://127.0.0.1/redfish/v1/
#REQUEST: Transport:SendRecv: GET http://127.0.0.1/redfish/v1/
#DB4: Systems:getCollection: link is: /redfish/v1/Systems
#DB5: Transport.rftProcessRequest: method=GET, baseUrl=http://127.0.0.1/redfish/v1/, rpath=/redfish/v1/Systems
#DB5: Transport.rftProcessRequest: apiType=2
#DB5: Transport.ProcessRequest: url=http://127.0.0.1/redfish/v1/Systems
#REQUEST: Transport:SendRecv: GET http://127.0.0.1/redfish/v1/Systems

Systems Collection:

#DB5: Transport.rftProcessRequest: method=GET, baseUrl=http://127.0.0.1/redfish/v1/Systems/, rpath=/redfish/v1/Systems/1
#DB5: Transport.rftProcessRequest: apiType=2
#DB5: Transport.ProcessRequest: url=http://127.0.0.1/redfish/v1/Systems/1
#REQUEST: Transport:SendRecv: GET http://127.0.0.1/redfish/v1/Systems/1
#DB4: SystemsOperations:get: got a path, now get entries

Systems Resource:

#DB5: Transport.rftProcessRequest: method=PATCH, baseUrl=http://127.0.0.1/redfish/v1/Systems/1/, rpath=None
#DB5: Transport.rftProcessRequest: apiType=2
#DB5: Transport.ProcessRequest: url=http://127.0.0.1/redfish/v1/Systems/1/
#REQUEST: Transport:SendRecv: PATCH http://127.0.0.1/redfish/v1/Systems/1/
redfishtool: Transport: Response Error: status_code: 405 -- Method Not Allowed
#DB5: Systems: operation returned with error: rc=5
#DB5: #DB4:Main: subcommand returned with error: rc=5

Main: Error: rc=5

#DB5: Response status code:405
#DB5: Response headers: {'Connection': 'keep-alive', 'Server': 'nginx/1.10.3 (Ubuntu)', 'Date': 'Fri, 07 Jul 2017 13:21:59 GMT', 'Content-Length': '182', 'Content-Type': 'text/html'}
#DB5: rfCleanup:Cleaningup session: None

How to send request data to file?

When sending request data(payload), I want to send it to the file specified by using @ character like curl utility.
The request data is too long when performing BIOS setup, BIOS/BMC upgrade etc.

Question: how can I use redfishtool from the code

The documentation for redfishtool very well describes how to use it as a command line utility, but there is no information how to use modules to write code. For example, if I want to get root:

`from redfishtool.ServiceRoot import RfServiceRoot

root = RfServiceRoot.getServiceRoot ()
print (root)`

Executed with an error:
root = RfServiceRoot.getServiceRoot ()
TypeError: getServiceRoot () missing 2 required positional arguments: 'self' and 'rft'
And how can I choose a port for example.
What is rft and where to take these all abbreviations. Help please start using this module

Use ActionInfo if no @Redfish.AllowableValues is present

The tool relies on @Redfish.AllowableValues in multiple cases (System/Manager ResetType, BootSourceOverrideTarget). But Redfish also allows the equivalent to be implemented as an ActionInfo (for the Reset Actions at least). The tool should be able to use ActionInfo AllowableValues if no Redfish.AllowableValues annotation is present

Unable to handle task responses to actions

If a system returns 202 to a reset action, so that the action is tracked with a task, redfishtool fails:

$ python3 redfishtool.py -S Always -r host -u user -p pass Systems -I 1 reset ForceOff
   redfishtool: Transport: processing response status codes
$ echo $?
5

Questions from a new Redfishtool user

Very nice tool. I am using it against a supermicro X11DPU system.

One thing I wanted to do thru redfishtool was to change a BIOS setting. First I want to see what all the Bios "attributes" are. Using Curl, I can do this with
GET //sysname/redfish/v1/Systems/1/Bios.

Using redfish tool, must I use the "raw" subcommand with the GET verb to accomplish this or is there a higher level way to do this?

Then I want to change one of those settings, let's say the setting for CoresEnabled. Using Curl, I can do this with

curl -sk -u ADMIN:ADMIN --data '{"CoresEnabled": 2}' -X PATCH https://sysname/redfish/v1/Systems/1/Bios 

Again, using redfishtool, am I required to use the "raw" subcommand with the PATCH verb to accomplish this?
I used this:

python3 redfishtool.py -A Basic -r sysname -u ADMIN -p ADMIN raw PATCH --data='{"CoresEnabled": 2}' /redfish/v1/Systems/1/Bios

On this particular system, the response to this command has a statuscode 202 with the JSON response as follows:

{
    "Success": {
        "Message": "Successfully Completed Request.",
        "code": "Base.v1_0_0.Success"
    }
}

redfishtool responds with
redfishtool: Transport: processing response status codes

I am not sure if this is an error, but it looks like one.

I can confirm that if I reset the system, the new BIOS settings do take effect. (Maybe that's the reason for the 202 response since they don't take effect immediately?)

Question: should 202 response be considered success in this context.

problem in work with manager

Hi, I am trying to work with manager, but I have the following errors. I would appreciate if you help me to find the problem.

python3.4 redfishtool.py -r 10.101.19.2 -ss -vvv Managers list

#REQUEST: Transport:SendRecv: GET http://10.101.19.2/redfish/v1/
redfishtool: Transport: Response Error: status_code: 404 -- Not Found
redfishtool: getCollection: Error getting service root, aborting

Main: Error: rc=5

python3.4 redfishtool.py -r 10.101.19.2 -ss -vvv Managers Logs

redfishtool: Managers: Syntax error: [-I|-M|-L|-F|-1] required for action that targets a specific Managers instance

python3.4 redfishtool.py -r 10.101.19.2 -ss -vvv Managers -1 Logs

#REQUEST: Transport:SendRecv: GET http://10.101.19.2/redfish/v1/
redfishtool: Transport: Response Error: status_code: 404 -- Not Found
redfishtool: getCollection: Error getting service root, aborting

Main: Error: rc=5

python3.4 redfishtool.py -r 10.101.19.2 -ss -vvv Managers -F Logs

#REQUEST: Transport:SendRecv: GET http://10.101.19.2/redfish/v1/
redfishtool: Transport: Response Error: status_code: 404 -- Not Found
redfishtool: getCollection: Error getting service root, aborting

Main: Error: rc=5

python3.4 redfishtool.py -r 10.101.19.2 -ss -vvv Managers -1 Logs -a

#REQUEST: Transport:SendRecv: GET http://10.101.19.2/redfish/v1/
redfishtool: Transport: Response Error: status_code: 404 -- Not Found
redfishtool: getCollection: Error getting service root, aborting

Main: Error: rc=5

Redfishtool need option to get object by odata.type

The tools has code to parse odata.type from an object (parseOdataType), but no command line option to lookup a resource by its type. This should be something like:

-o, . --Odata= -- find the resource with the specified @odata.type

This could be used in combinations with -1, -F, and -all
-o & -F == find the first instance of resource with that type
-0 & -1 == find the only instance of resource with that type, and error if there is more than 1
-o & -a == find all instances of the resource with that type

redfish tool not supporting a task

need to support tasks for "adduser" responses, when user is created using adduser we are not seeing any response due to that out scripts are failing.

udock redfishtool -r -u -p --Secure=Always AccountService adduser 'testuser' 'test_123' but when we check backend user is getting created without any response.

Enhance redfishtool to support adding user via PATCH

  • Rationale:
    IPMI systems may have a fixed set of user account slots, with the Accounts Collection populated with an account for each slot, even when many of the accounts slots may not be in use. Normally when adding an entry to a collection, a POST operation is performed. But since the account entries in an IPMI system as described already exist, they must be updated with a PATCH operation to update them with a username, password, and role. And similarly, an existing user account in a system like this would need to be updated with PATCH to effectively delete it.

    The current redfishtool supports adding accounts with POST and deleting accounts with DELETE. It would be a useful enhancement to add support for performing account add and delete using POST for IPMI systems as described.

  • Logic to use PATCH to add new user:

    • Input provided: username, role, password
    • Fetch Accounts collection
    • Search collection for username
      • If found, return error “username already in use”
    • Search collection for unused slot (UserName == “”, “Enabled” == false)
      • If found, note “@odata.id” value of the account to PATCH (this will be the URI)
      • Else return error “no unused account slots available”
    • Build PATCH data for request, for example:
      {"UserName": "newUserName", "Enabled": true, "Password": "newPassword", "RoleId": "Operator"}
    • Submit PATCH including PATCH data in body to the URI, for example:
      /redfish/v1/Managers/iDRAC.Embedded.1/Accounts/3
  • Logic to use PATCH to delete existing user:

    • Input provided: username
    • Fetch Accounts collection
    • Search collection for username
      • If found, note “@odata.id” value of the account to PATCH (this will be the URI)
      • Else return error “username not found”
    • Build PATCH data for request, for example:
      {"UserName": "", "Enabled": false, "Password": null, "RoleId": "None"}
    • Submit PATCH to URI, for example:
      /redfish/v1/Managers/iDRAC.Embedded.1/Accounts/3
  • Additional considerations:

    • Need to consider/handle ETag headers
  • Interface updates:
    The existing AccountService subcommand syntax would need to be updated. This could be handled in a few different ways:

    • Enhance one or more of the existing AccountService operations patch, useradmin, adduser, or deleteuser
    • Add new AccountService operations specifically for adding and deleting users via PATCH

I can work on this enhancement. I included a somewhat detailed description here in hopes of getting any feedback and advice from the community.

Documentation needs an ipmitool to redfishtool conversion matrix

At the moment, it's a bit confusing how to go about grabbing information with redfishtool. For example, I can access the SEL log entries via curl, but none of the sub-arguments beyond -i SEL seem to allow me to grab the entries. A table that converts between typical ipmitool commands and redfishtool commands would be very helpful. (I do recognize that not every command is convertible, but some are.)

Redfishtool pull:

zeta@testMachine:~/repos/tools/redfishtool$ python3 redfishtool.py -u Administrator -p superuser -r 192.168.4.170 Managers -1 Logs -i SEL
{
"MaxNumberOfRecords": 300,
"@odata.etag": "W/"1494005905"",
"Status": {
"Health": "OK",
"State": "Enabled"
},
"OverWritePolicy": "WrapsWhenFull",
"Name": "IPMI SEL",
"DateTimeLocalOffset": "+34:07",
"@odata.type": "#LogService.v1_0_2.LogService",
"Description": "IPMI SEL events for this manager",
"DateTime": "2017-05-05T17:38:25+34:07",
"@odata.context": "/redfish/v1/$metadata#Managers/Members/Self/LogServices/Members(DateTimeLocalOffset,Id,Status,Name,ServiceEnabled,MaxNumberOfRecords,DateTime,OverWritePolicy,Entries,Description)/$entity",
"Entries": {
"@odata.id": "/redfish/v1/Managers/Self/LogServices/SEL/Entries"
},
"Actions": {
"#LogService.ClearLog": {
"target": "/redfish/v1/Managers/Self/LogServices/SEL/Actions/LogService.ClearLog",
"[email protected]": [
"ClearAll"
]
}
},
"@odata.id": "/redfish/v1/Managers/Self/LogServices/SEL",
"ServiceEnabled": true,
"Id": "SEL"
}

Example curl pull:

zeta@testMachine:~/repos/tools/redfishtool$ curl -u Administrator:superuser -XGET 192.168.4.170/redfish/v1/Managers/Self/LogServices/SEL/Entries
{"@odata.context":"/redfish/v1/$metadata#Managers/Members/Self/LogServices/Members/SEL/Entries/$entity","@odata.etag":"W/"0"","@odata.id":"/redfish/v1/Managers/Self/LogServices/SEL/Entries","@odata.type":"#LogEntryCollection.LogEntryCollection","Description":"Collection of entries for this log service","Members":[{"@odata.id":"/redfish/v1/Managers/Self/LogServices/SEL/Entries/1","@odata.type":"#LogEntry.v1_0_2.LogEntry","Created":"2012-01-01T00:00:18-05:00","EntryCode":"Lower Critical - going low","EntryType":"SEL","Id":"1","Links":{"OriginOfCondition":{"@odata.id":"/redfish/v1/"}},"Message":"","MessageArgs":[],"MessageId":"Ipmi.2.0.GeneralEventData","Name":"SEL 13","SensorNumber":82,"SensorType":"Voltage","Severity":"OK"},{"@odata.id":"/redfish/v1/Managers/Self/LogServices/SEL/Entries/2","@odata.type":"#LogEntry.v1_0_2.LogEntry","Created":"2012-01-01T00:00:18-05:00","EntryCode":"Lower Critical - going low","EntryType":"SEL","Id":"2","Links":{"OriginOfCondition":{"@odata.id":"/redfish/v1/"}},"Message":"","MessageArgs":[],"MessageId":"Ipmi.2.0.GeneralEventData","Name":"SEL 14","SensorNumber":83,"SensorType":"Voltage","Severity":"OK"},{"@odata.id":"/redfish/v1/Managers/Self/LogServices/SEL/Entries/3","@odata.type":"#LogEntry.v1_0_2.LogEntry","Created":"2017-05-01T22:49:56+00:00","EntryCode":"Lower Critical - going low","EntryType":"SEL","Id":"3","Links":{"OriginOfCondition":{"@odata.id":"/redfish/v1/"}},"Message":"","MessageArgs":[],"MessageId":"Ipmi.2.0.GeneralEventData","Name":"SEL 15","SensorNumber":82,"SensorType":"Voltage","Severity":"OK"},{"@odata.id":"/redfish/v1/Managers/Self/LogServices/SEL/Entries/4","@odata.type":"#LogEntry.v1_0_2.LogEntry","Created":"2017-05-01T22:49:56+00:00","EntryCode":"Lower Critical - going low","EntryType":"SEL","Id":"4","Links":{"OriginOfCondition":{"@odata.id":"/redfish/v1/"}},"Message":"","MessageArgs":[],"MessageId":"Ipmi.2.0.GeneralEventData","Name":"SEL 16","SensorNumber":83,"SensorType":"Voltage","Severity":"OK"}],"[email protected]":4,"Name":"Log Service Entries Collection"}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.