OpenFabrics / sunfish_library_reference

The core Sunfish implementation
BSD 3-Clause "New" or "Revised" License
2 stars 4 forks source link

Use the Context property to identify different Agents #12

Closed mgazz closed 4 months ago

mgazz commented 5 months ago

Currently at the reception of an AggregationSourceDiscovered event the library creates an AggregationSource object locally and imports a reference of the Fabrics exposed by the Agent. To trigger a crawl-out inspection of the Redfish tree, the Agent informs that a Fabric is read by sending the event ResourceCreated. The schema below show the various steps.

image

There are some design issues with the current approach:

I propose we update the current mechanism and PATCH the Subscription describing the EventDestination stored in the Agent with a Context that matches the Id of the AggregationService persistent in Sunfish.

Example of EventDestination on the Sunfish Agent where Context is the Id of the AggregationSource generated by Sunfish as part of the registration.

└❯cat EventService/Subscriptions/SunfishServer/index.json
{
    "@odata.id": "/redfish/v1/EventService/Subscriptions/SunfishServer",
    "@odata.type": "#EventDestination.EventDestination",
    "Context": "dc83fb9e-568a-468f-b2e4-df0a3892e578",
    "Destination": "http://localhost:5000/EventService",
    "EventFormatType": "Event",
    "Id": "SunfishServer",
    "OriginResources": [
        {
            "@odata.id": "/redfish/v1/Fabrics"
        }
    ],
    "Protocol": "Redfish",
    "RegistryPrefixes": [
        "Basic"
    ],
    "SubordinateResources": "True"
}

With this approach events sent to an EventDestination can report the Context, and aid Sunfish in identifying the source of the message. Example of message with Context.

{
        "@odata.type": "#Event.v1_7_0.Event",
        "Id": "2",
        "Name": "Fabric Created",
        "Context": "dc83fb9e-568a-468f-b2e4-df0a3892e578",
        "Events": [ {
          "EventType": "Other",
          "EventId": "4595",
          "Severity": "Ok",
          "Message": "New Resource Created ",
          "MessageId": "Resource.1.0.ResourceCreated",
          "MessageArgs": [],
          "OriginOfCondition": {
           "@odata.id": "/redfish/v1/Fabrics/CXL"
          }
        }]
    }