[Ofmfwg] [OpenFabrics/sunfish_library_reference] c1d1a8: Added support for storage backend and event handle...

Christian Pinto noreply at github.com
Fri Jul 5 01:18:30 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/OpenFabrics/sunfish_library_reference
  Commit: c1d1a8ce6e63dcdc875fa7a4e2850e11fb9d4f55
      https://github.com/OpenFabrics/sunfish_library_reference/commit/c1d1a8ce6e63dcdc875fa7a4e2850e11fb9d4f55
  Author: Christian Pinto <christian.pinto at ibm.com>
  Date:   2024-06-25 (Tue, 25 Jun 2024)

  Changed paths:
    M .gitignore
    M pyproject.toml
    R sunfish/events/redfish_event_handler.py
    M sunfish/lib/core.py
    A sunfish/models/plugins.py
    R sunfish/storage/backend_FS.py
    R sunfish/storage/utils.py
    A sunfish_plugins/event_handlers/redfish/__init__.py
    A sunfish_plugins/event_handlers/redfish/redfish_event_handler.py
    A sunfish_plugins/storage/file_system_backend/__init__.py
    A sunfish_plugins/storage/file_system_backend/backend_FS.py
    A sunfish_plugins/storage/file_system_backend/utils.py
    M tests/conf.json
    M tests/test_sunfishcore_library.py

  Log Message:
  -----------
  Added support for storage backend and event handler plugins

Signed-off-by: Christian Pinto <christian.pinto at ibm.com>


  Commit: 8c08af21d9a0e399bf97889b5d1e87108972d92f
      https://github.com/OpenFabrics/sunfish_library_reference/commit/8c08af21d9a0e399bf97889b5d1e87108972d92f
  Author: Christian Pinto <christian.pinto at ibm.com>
  Date:   2024-06-25 (Tue, 25 Jun 2024)

  Changed paths:
    M sunfish/models/plugins.py
    A tests/conf_broken_module.json
    M tests/test_sunfishcore_library.py

  Log Message:
  -----------
  added plugin loading test

Signed-off-by: Christian Pinto <christian.pinto at ibm.com>


  Commit: cfb22282650f14e68eca5a4375a104f8482e93b0
      https://github.com/OpenFabrics/sunfish_library_reference/commit/cfb22282650f14e68eca5a4375a104f8482e93b0
  Author: Christian Pinto <christian.pinto at ibm.com>
  Date:   2024-06-25 (Tue, 25 Jun 2024)

  Changed paths:
    M sunfish/events/redfish_subscription_handler.py
    M sunfish/events/subscription_handler_interface.py
    M sunfish_plugins/event_handlers/redfish/redfish_event_handler.py

  Log Message:
  -----------
  cleaning up the events handler

Signed-off-by: Christian Pinto <christian.pinto at ibm.com>


  Commit: b31c792a0ef03e5272f311d425cdca46df98f86a
      https://github.com/OpenFabrics/sunfish_library_reference/commit/b31c792a0ef03e5272f311d425cdca46df98f86a
  Author: Christian Pinto <christian.pinto at ibm.com>
  Date:   2024-06-25 (Tue, 25 Jun 2024)

  Changed paths:
    M sunfish/lib/core.py
    R sunfish/lib/object_handler.py
    A sunfish/lib/object_handler_interface.py
    R sunfish_plugins/event_handlers/redfish/__init__.py
    R sunfish_plugins/event_handlers/redfish/redfish_event_handler.py
    A sunfish_plugins/events_handlers/redfish/__init__.py
    A sunfish_plugins/events_handlers/redfish/redfish_event_handler.py
    A sunfish_plugins/objects_handlers/sunfish_server/__init__.py
    A sunfish_plugins/objects_handlers/sunfish_server/redfish_object_handler.py
    M tests/conf.json

  Log Message:
  -----------
  Plugin mechanisms for redfish objects management

Signed-off-by: Christian Pinto <christian.pinto at ibm.com>


  Commit: 1f8e8d4b8517803328955d709dd513fc6a7ad88d
      https://github.com/OpenFabrics/sunfish_library_reference/commit/1f8e8d4b8517803328955d709dd513fc6a7ad88d
  Author: Christian Pinto <christian.pinto at ibm.com>
  Date:   2024-06-26 (Wed, 26 Jun 2024)

  Changed paths:
    M sunfish/lib/core.py
    M tests/test_sunfishcore_library.py

  Log Message:
  -----------
  modified plugins loading to fallback to defaults in case of either no plugins in config or wrong config

Signed-off-by: Christian Pinto <christian.pinto at ibm.com>


  Commit: 16ed65ed15a844ddfedebc30faa4581b4e6397f6
      https://github.com/OpenFabrics/sunfish_library_reference/commit/16ed65ed15a844ddfedebc30faa4581b4e6397f6
  Author: Christian Pinto <christian.pinto at ibm.com>
  Date:   2024-07-04 (Thu, 04 Jul 2024)

  Changed paths:
    R sunfish/lib/agents_management.py
    M sunfish/lib/core.py
    M sunfish/lib/object_handler_interface.py
    A sunfish/lib/object_manager_interface.py
    M sunfish_plugins/events_handlers/redfish/redfish_event_handler.py
    M sunfish_plugins/objects_handlers/sunfish_server/redfish_object_handler.py
    A sunfish_plugins/objects_managers/sunfish_agent/__init__.py
    A sunfish_plugins/objects_managers/sunfish_agent/agents_management.py
    A sunfish_plugins/objects_managers/sunfish_agent/sunfish_agent_manager.py

  Log Message:
  -----------
  Added changes following @rherrell review

Signed-off-by: Christian Pinto <christian.pinto at ibm.com>


  Commit: c4b61f87efaf25dfda1a1ed6380a92d4f9431a1c
      https://github.com/OpenFabrics/sunfish_library_reference/commit/c4b61f87efaf25dfda1a1ed6380a92d4f9431a1c
  Author: Christian Pinto <christian.pinto at ibm.com>
  Date:   2024-07-05 (Fri, 05 Jul 2024)

  Changed paths:
    M .gitignore
    M pyproject.toml
    R sunfish/events/redfish_event_handler.py
    M sunfish/events/redfish_subscription_handler.py
    M sunfish/events/subscription_handler_interface.py
    R sunfish/lib/agents_management.py
    M sunfish/lib/core.py
    R sunfish/lib/object_handler.py
    A sunfish/lib/object_handler_interface.py
    A sunfish/lib/object_manager_interface.py
    A sunfish/models/plugins.py
    R sunfish/storage/backend_FS.py
    R sunfish/storage/utils.py
    A sunfish_plugins/events_handlers/redfish/__init__.py
    A sunfish_plugins/events_handlers/redfish/redfish_event_handler.py
    A sunfish_plugins/objects_handlers/sunfish_server/__init__.py
    A sunfish_plugins/objects_handlers/sunfish_server/redfish_object_handler.py
    A sunfish_plugins/objects_managers/sunfish_agent/__init__.py
    A sunfish_plugins/objects_managers/sunfish_agent/agents_management.py
    A sunfish_plugins/objects_managers/sunfish_agent/sunfish_agent_manager.py
    A sunfish_plugins/storage/file_system_backend/__init__.py
    A sunfish_plugins/storage/file_system_backend/backend_FS.py
    A sunfish_plugins/storage/file_system_backend/utils.py
    M tests/conf.json
    A tests/conf_broken_module.json
    M tests/test_sunfishcore_library.py

  Log Message:
  -----------
  Added support for dynamically loadable plugins (#29)

This pull request adds support for dynamically loaded plugins

The Sunfish core library uses a plugin mechanism that allows dynamic
loading of certain classes. This helps users with updating the behavior
of the sunfish library without having to modify its core classes. At the
moment we support plugins for the storage backend, for the redfish event
handlers and for the main redifsh objects handlers. Plugins are
implemented as namespaced packages and must be placed in a folder at the
top of the project named "sunfish_plugins", with subfolders named
"storage" and/or "events_handlers" and/or "objects_handlers". The python
packages defined inside each subfolder are totally user defined.

```bash
 ── sunfish_plugins
         ├── storage
         │    └──my_storage_package     <--- User defined
         │        ├── __init__.py
         │        └── my_storage_backend.py
         └── events_handlers
         │     └──my_handler_package     <--- User defined
         │         ├── __init__.py
         │         └── my_handler.py
         └── objects_handlers
              └──my_objects_handler_package     <--- User defined
                  ├── __init__.py
                  └── my_objects_handler.py
```
 
When initializing the Sunfish libraries can load their storage or event
handler plugin by specifying them in the configuration as in the below
example:
```json
"storage_backend" : {
    "module_name": "storage.my_storage_package.my_storage_backend",
    "class_name": "StorageBackend"
},
"events_handler" : {
    "module_name": "events_handlers.my_handler_package.my_handler",
    "class_name": "EventHandler"
},
"objects_handler" : {
    "module_name": "objects_handlers.my_objects_handler_package.my_objects_handler",
    "class_name": "ObjectsHandler"
},
```
In all cases "class_name" represents the name of the class that is
initialized and implements the respective interface.

The object _handler interface is not only defining which handler to
execute for each specific RedFish object but also the actions to execute
when forwarding the current request to the object manager (i.e., the
agent). The `ObjectHandlerInterface` class includes a method called
`forward_to_manager` that is used exactly for this purpose.


Compare: https://github.com/OpenFabrics/sunfish_library_reference/compare/49d8c330c0bd...c4b61f87efaf

To unsubscribe from these emails, change your notification settings at https://github.com/OpenFabrics/sunfish_library_reference/settings/notifications


More information about the Ofmfwg mailing list