88 Commits

Author SHA1 Message Date
Bruno Cornec
b0ff208138 Add the monitor command
- monitor command role is to print on a regular base the values of
variable constants (Temperature, power, Fans, ...)
- new monitor_loop parameter (wait time between queries)
- new monitor_info.template
- get_power has been renamed to get_powerstate to avoid confusion with
Power measures and moved to the Device class as well as get_description
- More genericity for the Power and Thermal classes (moved into types.py)
- Build process amended (0.4.3 is the next version, repo are generic and
in line with pb 0.15

Change-Id: I05016b2557b2f7638e1ea22a89dcf91ebae1066f
2019-10-14 12:32:22 +02:00
Bruno Cornec
9e20fd158b Gen-Z support
Fix for Gen-Z simulator which doesn't provide the SessionService entrypoint

Change-Id: I3b17c9db8c12605cd70c1034bbb138743325dbd1
2019-08-29 01:46:15 +02:00
Bruno Cornec
b84dd6d2d9 Add a getserial command to redfish-client
- print Part or Serial numbers of Chassis and Systems
  using a specific jinja2 template
- for HPE servers, print them for NICs and SmartArrays, and Physical
  drives behind (not seen with calls on standard components)

Change-Id: I741c97847a07e126d7f34ceaa4695f9a8cdcec2b
2019-03-30 03:04:16 +01:00
Bruno Cornec
520bdc5605 Both Hpe and Hp should be considered for Oem entries
Change-Id: Ia9ca019d176fd72a9002a377707fae66268c83fa
2019-03-30 01:54:00 +01:00
Bruno Cornec
b80503b10d Oem entry for HPE is now Hpe not Hp anymore
Change-Id: Icec33d4f5d1923acd95eccb8e787cb0deca66a59
2019-03-20 02:09:01 +01:00
wangqi
6c23014723 delete useless globe variables
Change-Id: Ie9a44dd91764bc484739a918b4f42869cfaf1f3e
2018-02-28 09:30:40 +00:00
Madhuri Kumari
7331f6e267 Trivial: Fix a spelling mistake in exception.py
Change-Id: If901add01f156923b1a27eb24267b63700d81b39
2017-03-07 07:45:24 +00:00
yufei
dc9e0b74ee Recover the lost fix
The change on commit I319376f818b532a1511248a9f17ecd0a41540e88 is
reverse by Id13e94d75f85fec7d98f1fa005c37836c244e08a recently

Change-Id: Ibf8cd587bbbc2d01614e677721f5d80fce06e1fa
2017-03-03 08:46:42 +00:00
Uggla
a77d9ba0e4 Fix for Oem data
- Set Oem data to none to avoid client exceptions.

Change-Id: I24274e86bfe7f49e41ff57e17deabb526d5106a0
2017-02-24 11:13:38 +01:00
Uggla
d4b3f046e9 Fix urllib import that prevent clients to run with python2
Change-Id: I62992b38b294d8a643f96e14677d1f998a8128d3
2017-02-04 20:11:11 +01:00
Uggla
abd3012ec0 Moonshot add on
- Add redfish-check-cartridge to check cartridge changes into a HPE Moonshot
  chassis.
- Fix for m510 cartridges with first revision of firmware that do not
  have Manager and Chassis data.
- Various updates to be pep8 compliant.

Change-Id: Ie38cc5539e71aaf1041394fbbc6596c313f9bb47
2017-02-04 19:56:19 +01:00
Uggla
905a36d660 Add oem data
- Add oem structure
    - Add oem as a redfish submodule.
    - Modify code and files to avoid circular imports :
        - types.py contains the Base, BaseCollection and Device class on
          which all standard and oem classes are inherited.
       	- standard.py will contain the redfish standard classes.
        - oem/<oem_name> will contains specific classes for <oem_name>.
          so oem/hpe will contains hpe specific classes.
  Note: the goal of python-redfish is not to deal with oem part.
  So oem will be kept as minimal as possible, however currently
  some critical hardware characteristics are only available into the oem
  part that's the reason why we are implementing it.

- Add oem class NetworkAdapter
    - This is mainly to extract mac@ with function get_mac().
- Add classes SmartStorage, ArrayControllersCollection,
  ArrayControllers, LogicalDrivesCollection, LogicalDrives.
    - Add Logical drives methods get_capacity(), get_raid.

- Improve system template and add a couple of function.
    - Add get_structured_name().
    - Add get_uefi_path().
    - However this 2 functions provide invalid content due to the firmware.

- Review and inherit from device instead of base for some components.

Change-Id: Id13e94d75f85fec7d98f1fa005c37836c244e08a
2017-01-28 12:54:57 +01:00
Jenkins
c020f909de Merge "Fix wrong payload in set boot source" 2017-01-25 23:54:16 +00:00
Jenkins
5773dfb974 Merge "Avoid TypeError after _replace when user post a str url" 2017-01-25 15:17:01 +00:00
Uggla
139044083a Fix jenkins tests to allow commits
- Do not pass tests on redfish-client
  Currently tests are using a local docker container. We remove them to
  allow jenkins tests to pass.

- Move programme usage in a separate file to get rid of pep8 issue.

- Fix tox venv usage

- Add flake8 test dependency

Change-Id: I12f3a567f3ff83c34c3832a544ef547372857161
2017-01-23 17:37:22 +01:00
Yufei
98ec299fa6 Avoid TypeError after _replace when user post a str url
function geturl will rasie a TypeError if we specify a str url and
replace the scheme value with a unicode value. In order to work with
both string redfish url and unicode redfish url, we need to convert
the "https" to the scheme's type.

This bug canbe reproduced with:

from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from builtins import object

import json
from urllib.parse import urlparse, urljoin, urlunparse

url=urlparse(unicode("http://127.0.0.1"))
url._replace(scheme="https").geturl()
url=urlparse(str("http://127.0.0.1"))
url._replace(scheme="https").geturl()

Change-Id: I1aa0f173a7b843c2bdf3eba8425ff794778b74da
2017-01-16 10:05:23 +08:00
Yufei
3915eaad8e Fix wrong payload in set boot source
The vaild boot source parameter is:
'{"Boot": {"BootSourceOverrideTarget": "Pxe",
"BootSourceOverrideEnabled" : "Once"}}'

not:
'{"Boot": {"BootSourceOverrideTarget": "Pxe"},
{"BootSourceOverrideEnabled" : "Once"}}'

Change-Id: I319376f818b532a1511248a9f17ecd0a41540e88
2017-01-16 10:03:57 +08:00
Uggla
c85f2a56f0 Remove not working tests 2016-04-06 19:25:55 +02:00
Uggla
f1dfdf4b7b Nicer import 2016-04-06 18:32:22 +02:00
Uggla
dae27b4a72 Fix missing home message 2016-04-06 18:32:22 +02:00
Uggla
2f40ce5d24 PEP8 fixes 2016-04-06 18:32:22 +02:00
Uggla
92d4aa880a Improve debug readability
- Pretty print data returned, so humans can read them.
- Cosmetic fixes.
2016-04-06 18:32:22 +02:00
Uggla
45fdc2819e Remove socket module finally not needed 2016-04-06 18:32:22 +02:00
Uggla
d940d11af4 Add Thermal, Power classes and review get_type() 2016-04-06 18:32:22 +02:00
Uggla
6b4450565e Fix #53, handle MacAddress and MACAddress keys
- Proliant firmware uses MacAddress but the standard is MACAddress.
2016-04-06 18:32:22 +02:00
Uggla
14314c99ab Add ChassisCollection, Chassis classes and chassis template 2016-04-06 18:32:22 +02:00
Uggla
3a60af5373 Add SimpleStorageCollection and SimpleStorage classes 2016-04-06 18:32:21 +02:00
Uggla
cf12504b66 Add ProcessorsCollection and Processors classes 2016-04-06 18:32:21 +02:00
Uggla
25a5f12287 Improve systems class and template
- Add new functions.
2016-04-06 18:32:21 +02:00
Uggla
983720d444 Introduce Device class to factorize common methods
- Factorize common methods between System, Chassis, Manager.
2016-04-06 18:32:21 +02:00
Bruno Cornec
9a7e7a3905 Merge pull request #62 from uggla/fixmoonshot
Fix for Moonshot platform
2016-04-06 01:45:50 +02:00
Uggla
0480f72fda Fix for Moonshot platform
- Fix to not crash although Moonshot Redfish is 0.95 even with firmware
  1.41
2016-04-05 19:31:24 +02:00
Uggla
844b2e898b Fix #16, use standard redfish headers
- Manager header into ConnectionParameters class.
- Fix all header requests into main.
- Fix all header requests into types.py.
- PEP8 fixes.
2016-04-05 16:32:00 +02:00
Bruno Cornec
8aa83c50ee Improve #39
- manage variable expanion for logfiles
- improve inventory handling
- remove now useless checks for HOME
2016-04-04 21:24:06 +02:00
Bruno Cornec
65c8ac92e1 Fix #39 with new log files management
- Default location for log files is now under the HOME directory of the
  user instead of /var/log
- Create that default .redfish dir if not already existing
- Adapt error messages
2016-04-04 20:40:10 +02:00
Uggla
30565317cc Fix invalid login using redfish url.
- Login using https://<manager>/redfish/v1 raised an error, which was
  not the case using https://<manager>/rest/v1.
  This was due to a '/' appended to the Sessions url ending to a '//' in
  the target url. Fix by using urlparse.urljoin to fix that issue.
2016-03-20 19:01:51 +01:00
Uggla
66cb53df4e Add tests to validate python-redfish is working with python3
- Update setuptools within dockerfiles to support requirements.txt syntax.
- Check that tests can be run with Python2 and 3.
2016-03-07 11:15:32 +01:00
Uggla
d09a63a4c6 Review connection error handling due to python3 backports
- Inclusion on future module might have changed some exception behaviors. So
  code changed following python2/3 tests.
2016-03-07 11:15:32 +01:00
Uggla
9094675555 Manage python3 compatibility
- Use future module to allow python2/3 compatibility.
- New dependencies added future and configparser.
2016-03-07 11:15:32 +01:00
Uggla
9a5e417980 Improve logging
- Check log directory existence and provide intruction to create it.
- Client log is in the log dir now.
- Improve error messages.
2016-03-05 15:39:03 +01:00
Uggla
92bcc48f97 Fix installation of data_files
1- Get target prefix
2- if prefix == '/usr' --> Force configuration file location to /etc
3- else --> set file location relative to the prefix
   ex : prefix/bin, prefix/share, prefix/etc
4- Update conf file content with the template path location
5- Update script file content with version and configuration file
   location
2016-03-04 12:02:13 +01:00
Uggla
59f5007787 Fix pbr if running without git or sdist 2016-02-13 19:59:17 +01:00
Uggla
f0c9439947 Add advices to connection failure 2016-02-13 19:59:17 +01:00
Uggla
4f8403b251 Pypi distribution
- Modify sources to allow Pypi distribution
2016-02-13 19:59:17 +01:00
Uggla
e699acf328 Some PEP8 cleanup 2016-02-13 19:55:34 +01:00
Uggla
89ae5f7d76 Add reset method for manager 2016-02-13 19:55:34 +01:00
Uggla
a2cafc9802 Change SystemCollection from list to dict
- Change systems_list to systems_dict["<index>"] .
  The systems_dict will contain system objects, <index> is
  the redfish <index> as reported inside url.
2016-02-13 19:55:34 +01:00
Uggla
c34d85fbc5 Documentation update
- Put in place sphinx mechanism to build documentation.
  Most of the documentation is generated from python docstrings.
- redfish-client.py usage is a bit modified to display a decent
  documentation.
- A link rfclient.py to redfish-client.py was created to allow sphinx
  parsing. The '-' char is not allowed for module and so sphinx autodoc
  module.
- Note : Copyright may need to be reviewed as well as main.py.
2016-02-11 16:20:00 +01:00
Uggla
173e7798cf Use Jinja2 template system to display manager info
- Use templating system, so user will be able to customize output.
- This could be use later to propose output in various format (html,
  xml, json).
- Undefined EthernetInterfacesCollection in case of failure. So it
  allows to test definition in the template or elsewhere.
2016-01-14 00:36:23 +01:00
Uggla
6ffbd4aec8 Add manager functions
- Add function get_managed_chassis.
- Add function get_managed_systems.
- Modiy mapping to handle proliant fw 2.40 bugs reporting :
  - links instead of Links.
  - href instead of @odata.id.
- I'll report this bug to redfish folks.
- Various PEP8 cleans.
2016-01-09 19:12:27 +01:00