Redfish EventService Implementation

Ratan Gupta ratagupt at linux.vnet.ibm.com
Thu Jul 30 19:10:30 AEST 2020


Hi James,

On 7/15/20 2:38 AM, James Feist wrote:
> On 7/12/2020 11:32 PM, Ratan Gupta wrote:
>> Hi James,
>>
>> As you asked for the examples in the 
>> thread(https://lists.ozlabs.org/pipermail/openbmc/2020-June/022125.html), 
>> I have created the mapping at the following location.
>>
>> https://gist.github.com/ratagupt/0aa4da098a60d49af90a7e4a6ea6d5f2
>
> Thanks for the examples.
>
>>
>> 1) Map1: Mapping between redfish resources to Dbus resources
>
> How does this work when the mapping isn't 1:1 vs D-Bus? Most of the 
> time the enums to not match the d-bus enum, or take multiple d-bus 
> interface to distinguish what the value should be. Also how does this 
> work for discovered things, like multiple chassis?

I have not mentioned in the below use cases, but just look at the url 
https://gist.github.com/ratagupt/0aa4da098a60d49af90a7e4a6ea6d5f2#file-gistfile1-txt-L77
<https://gist.github.com/ratagupt/0aa4da098a60d49af90a7e4a6ea6d5f2#file-gistfile1-txt-L77>

There we are covering the resources which are getting added dynamically.
>
>
>> 2) Map2: Mapping between redfish resource types to the ineterested 
>> Dbus interfaces
>> 3) Map3: Mapping between Dbus resources to redfish resources
>>
>>
>> I tried to cover the following scenario in the above mapping.
>>
>> * Redfish resource is mapped to multiple Dbus Resources
>> * Redfish Property is mapped to single Dbus property
>> * Redfish Property(complex property) is mapped to multiple dbus 
>> property.
>> * Same type of Redfish Resources are mapped to different Dbus Resources
>> * Redfish node url having multiple regex : Yet to take a look on this.
>> >
>> Flow would be like as below
>>
>> => In bmcweb each Redfish node represents to a Redfish Resource.
>> => Each node will be having it's own mapping between Redfish 
>> properties and the Dbus Resources.
>>
>> => Some code on bmcweb will walkthrough on each node during startup , 
>> get this mapping from each node and generate
>>     two mappings
>>     1) Reverse mapping (Dbus Resource to Redfish Resource)(MAP3) and
>>     2) mapping between Resource Types to the interested Dbus 
>> interfaces(MAP2)
>>
>> => To start with we will support few resource types and then scale it 
>> up as needed.
>
> I think we need an idea of what the final solution will look like for 
> more complicated properties, or we'll be creating something that isn't 
> future proof.
I thought I covered the complicated one in the examples(gist link above) 
but just let me know the other redfish resource which I can take it in 
the examples.
>
>>
>> => Map2 would be used when the Redfish client subscribe for the 
>> ResourceType to get the Dbus mappings.
>>
>> => Map3 would be used when the Dbus signal gets generated and need 
>> the Redfish mappings.
>
> Why can't these be the same mapping?

To start monitoring for Dbus : We need Dbus Resource Path,

Once we get any Dbus signal, we need to send redfish event which needs 
redfish resource path hence we need reverse map

Did I get you correctly?

> I think having 3 different maps makes this very confusing. I also 
> think this is attempting to generalize the problem too early. If you 
> look at the Redfish code to determine some of the more complicated 
> properties, sometimes it takes quite a bit of logic. That logic also 
> would possibly be nice to reuse. Maybe we can take your idea of a 
> match with a callback to some of the already existing property 
> parsing? Obviously it would need some cleaning up, but I could see 
> something with a map of schemas/properties to function pointers for 
> property parsing.
>
>>
>> => Once we have all thsese mapping gets generated and loaded into the 
>> memory, bmcweb would start listening
>>     for the interfaces listed in map2.
>
> Why aren't these compiled in? I don't see why they need to be loaded, 
> could just be in code. Also, they shouldn't be added as matches until 
> there is a subscriber, or we'll add many unneeded matches.

They would be compiled in, they would be in memory(big std::map).

Agree monitoring should start only when there is a subscriber.

>
>>
>> => Once any Dbus signal gets generated map3 would be used to get the 
>> Redfish mapping.
>>
>> Please let me know if you have any concerns with this approach.
>>
>> Ratan


More information about the openbmc mailing list