Fix typo and add subscription docs

This commit fix a typo in the destination parameter
in tests and in doc, also including documentation
abou the subscription methods available via
vendor passthru.

Change-Id: Ifa82562d2ce8f34bd90dc5897a3b83fe9e8eb88b
This commit is contained in:
Iury Gregory Melo Ferreira 2021-09-02 22:02:09 +02:00
parent df92f8089e
commit b7ad3f51a1
3 changed files with 78 additions and 2 deletions
doc/source/admin/drivers
ironic
drivers/modules/redfish
tests/unit/drivers/modules/redfish

@ -502,6 +502,82 @@ settings. The following fields will be returned in the BIOS API
"``unique``", "The setting is specific to this node"
"``reset_required``", "After changing this setting a node reboot is required"
Node Vendor Passthru Methods
============================
.. csv-table::
:header: "Method", "Description"
:widths: 25, 120
"``create_subscription``", "Create a new subscription on the Node"
"``delete_subscription``", "Delete a subscription of a Node"
"``get_all_subscriptions``", "List all subscriptions of a Node"
"``get_subscription``", "Show a single subscription of a Node"
Create Subscription
~~~~~~~~~~~~~~~~~~~
.. csv-table:: Request
:header: "Name", "In", "Type", "Description"
:widths: 25, 15, 15, 90
"Destination", "body", "string", "The URI of the destination Event Service"
"EventTypes (optional)", "body", "array", "List of ypes of events that shall be sent to the destination"
"Context (optional)", "body", "string", "A client-supplied string that is stored with the event destination
subscription"
"Protocol (optional)", "body", "string", "The protocol type that the event will use for sending
the event to the destination"
Example JSON to use in ``create_subscription``::
{
"Destination": "https://someurl",
"EventTypes": ["Alert"],
"Context": "MyProtocol",
"args": "Redfish"
}
Delete Subscription
~~~~~~~~~~~~~~~~~~~
.. csv-table:: Request
:header: "Name", "In", "Type", "Description"
:widths: 21, 21, 21, 37
"id", "body", "string", "The Id of the subscription generated by the BMC "
Example JSON to use in ``delete_subscription``::
{
"id": "<id of the subscription generated by the BMC>"
}
Get Subscription
~~~~~~~~~~~~~~~~
.. csv-table:: Request
:header: "Name", "In", "Type", "Description"
:widths: 21, 21, 21, 37
"id", "body", "string", "The Id of the subscription generated by the BMC "
Example JSON to use in ``get_subscription``::
{
"id": "<id of the subscription generated by the BMC>"
}
Get All Subscriptions
~~~~~~~~~~~~~~~~~~~~~
The ``get_all_subscriptions`` doesn't require any parameters.
.. _Redfish: http://redfish.dmtf.org/
.. _Sushy: https://opendev.org/openstack/sushy
.. _TLS: https://en.wikipedia.org/wiki/Transport_Layer_Security

@ -161,7 +161,7 @@ class RedfishVendorPassthru(base.VendorInterface):
@base.passthru(['POST'], async_call=False,
description=_("Creates a subscription on a node. "
"Required argument: a dictionary of "
"{'destination': 'destination_url'}"))
"{'Destination': 'destination_url'}"))
def create_subscription(self, task, **kwargs):
"""Creates a subscription.

@ -254,7 +254,7 @@ class RedfishVendorPassthruTestCase(db_base.DbTestCase):
subscription = mock.MagicMock()
subscription.json.return_value = subscription_json
mock_event_service.subscriptions.create = subscription
kwargs = {'destination': 'https://someurl'}
kwargs = {'Destination': 'https://someurl'}
with task_manager.acquire(self.context, self.node.uuid,
shared=True) as task: