Commit Graph

10 Commits

Author SHA1 Message Date
Dmitry Tantsur 559e3ed4c4 Migrate common constants to enums
The new enums are generated by a new script that reads the DMTF
definitions and produced Python code in stdout. Missing items
and docstrings are added because of that.

The change migrates everything from sushy.resources.constants except for
ProtocolType, which has to be untangled from other protocol-related
enums.

This change also misses a release note. The intention is to create one
final release note before the next release.

Change-Id: I863fad54a9703c88aa92993ad0d48d18c50e492a
2021-10-27 11:09:56 +02:00
Aija Jauntēva 564549764f Add resource root property
Pass down to all resources where redfish_version and registries
currently used.

Story: 2009017
Task: 42737
Change-Id: Ibc6e735f3a2209e9b76e2ac00d7c9347b395c163
2021-07-06 08:48:39 -04:00
Sean McGinnis 010a288b15
Use unittest.mock instead of third party mock
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.

Change-Id: Ide81a721c5a0f14250250fa82925bf300ba72c31
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2020-04-18 12:00:45 -05:00
Ilya Etingof e03caca38f Change OEM extensions architecture
This patch radically changes OEM extensions architecture in a
backward-incompatible manner. /o\

The rationale is that, prior to this change, it was impossible to
model non-leaf subresources in OEM subtree such as `Links` or
`Actions`. The reason is that OEM objects were lacking BMC connection
context to doing anything beyond just sitting on the parent resource
JSON they were once given.

Technically, this change rebases originally base
`OEMExtensionResourceBase` class on top of universal `ResourceBase`
overriding its JSON parsing logic. That gives all the benefits and
features of `ResourceBase` implementation, including BMC connection
context, message registries etc.

The other conceptual (and breaking!) change is that the OEM extension
should now expose a callable that returns `OEMResourceBase` class, as
opposed to class instance as it used to be. Besides technical reasons
(preserving base class constructor signature), it seems that decoupling
implementation loader from initialization would give us more
flexibility going forward (e.g. sushy could sense what's being
exposed and initialize it differently).

Change-Id: I6c981bc1b2524d0a39a09ed8f0479b06045a1c4e
Story: 2006471
Task: 36402
2019-08-28 15:44:24 +02:00
Ilya Etingof 9351999582 Make message registries available to all resources
This patch makes parsed message registries accessible to all sushy
resource objects for consumption. Prior to that, only System resource
had access to message registries what proved insufficient.

Change-Id: Ib1e24ea0b2ab81a4dad207ef8f76f1cef3a799c3
Co-Authored-By: Richard.Pioso@dell.com
2019-07-22 09:55:51 +02:00
Debayan Ray 27c725cbb8 Introduce ``cache_it`` and ``cache_clear``
Right now the nested resource property methods contain a lot of
repetitive code for caching purpose. This utility decorator
``cache_it`` with its complimentary ``cache_clear`` method
attempt to reduce that code bloat.

Change-Id: I7404a15beb029cb282ac6b84bb8b8fdb97ebcd4c
2018-10-22 07:20:19 +00:00
Debayan Ray d44059483c Add system simple storage resource support
Adds the simple storage resource of Redfish standard schema.
This new resource represents the properties of a storage
controller and its directly-attached devices. This patch
introduces the property ``max_size_bytes`` of
SimpleStorageCollection resource to expose the size of the
largest storage size available among all directly attached
devices available to the System.

Also brought in the common 'Status' (comprising of Health,
HealthRollup and State sub-fields) field and refactored the code
base to use that field across all the Redfish resources.

Story: 1668487
Task: 23041

Change-Id: I512c2507bf78f4a9cf1e2525fd685836387a7581
2018-07-19 07:43:31 +00:00
Aija Jaunteva 33c4635ff3 Cleanup unittest file loading
Followup patch to update how test files are loaded accross all project:
- don't specify 'r' when opening a file as it is default mode
- use json.load(file) instead of json.loads(string)
- in some cases use file path inline instead of defining new var
- use loops to load several related files to avoid repetitive code

Change-Id: Ib4a66a4d97e7025849e3f84fc489fa1fa98af327
2018-07-11 12:21:19 +03:00
Nisha Agarwal 2f746cbdad Follow-up patch for 8fe2904a62
This addresses the nit comments left over
from the parent patch 8fe2904a62.
Adds the missing test case from the parent patch.

Change-Id: Ic60235834284302331e29122417d6490a3207bf8
2017-11-23 21:19:24 -08:00
Nisha Agarwal 8fe2904a62 Adds EthernetInterface to the library
This commit adds the EthernetInterface to the library.
This returns the MAC addresses and its status as a dictionary to
its caller.

This has been tested on HPE Redfish hardware.

Change-Id: If57184d71d244cdc6f04d3f66d56c374d4336d24
2017-10-06 00:41:11 -07:00