The Sunfish library offers an interface that permits to handle Redfish objects via RESTful operations (read, write, put, patch and delete), and it manage the persistency of these objects. The interface has many implementations that manage different kinds of persistency. Current available persistency implementations:
- File System (FS)
The library requires:
- Python (version>=3.9)
- Poetry
We suggest using a Python virtual environment. To install the project requirements:
pip install -r requirements.txt
From the directory sunfish_library_reference
execute the following command:
make build
To test this Library you need pytest
to be installed.
To run the tests run the command
make test
To use sunfishcorelib you need to specify the configuration parameters into the conf.json file, an example could be:
{
"storage_backend": "FS",
"redfish_root": "/redfish/v1/",
"backend_conf" : {
"fs_root": "Resources",
"subscribers_root": "EventService/Subscriptions"
},
"handlers": {
"subscription_handler": "redfish",
"event_handler": "redfish"
}
}
where:
- storage_backend specifies the persistency implementation that you want to use
- redfish_root specifies the Redfish version that must be included in all the requests
- backend_conf[fs_root] specifies the root directory of Redfish objects' file system
- subscription_handler specifies the type of handler implementation that you want to use to handle subscriptions
- event_handler specifies the type of handler implementation that you want to use to handle events
Sunfish should be installed and imported in an existing Python project. To use it:
- instantiate an object Core(conf)
- use the methods get_object, create_object, replace_object, patch_object, delete_object
- these methods will raise the exception defined in
sunfish.lib.exceptions.py
IMPORTANT: this Library assumes that the .json object are legal and well-formed according to the Redfish specification.
The code in this project is made available via the BSD 3-Clause License. See LICENSE to access the full license terms. This project adopts the Developer Certificate of Origin (DCO) to certify that each commit was written by the author, or that the author has the rights necessary to contribute the code. All commits must include a DCO which looks like this: Signed-off-by: Joe Smith [email protected]. Specifically, we utilize the [Developer Certificate of Origin Version 1.1] (https://github.com/OpenFabrics/sunfish_library_reference/blob/main/DCO). The project requires that the name used is your real name. Neither anonymous contributors nor those utilizing pseudonyms will be accepted.