[MDSAL-282] Notification - eventTime is missing in the generated Java POJO classes Created: 01/Aug/17 Updated: 25/Apr/23 Resolved: 30/Apr/19 |
|
| Status: | Resolved |
| Project: | mdsal |
| Component/s: | Binding API, Binding runtime |
| Affects Version/s: | None |
| Fix Version/s: | 4.0.1 |
| Type: | New Feature | ||
| Reporter: | Senthilkumar Jayakumar | Assignee: | Robert Varga |
| Resolution: | Done | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Operating System: Linux |
||
| Attachments: |
|
||||||||||||||||
| Issue Links: |
|
||||||||||||||||
| Description |
|
In BORON-SR3, I have found that the eventTime is missing in the generated Java POJO classes. Some of the issue faces are listed below: 1) Firstly, the NETCONF notification object doesn't have the generated event time there is an issue for the NBI systems in replaying the missed events. note: The received notification (both Alarm and event) has the <eventTime> but the generated notification listener doesn't seem to have reference to the eventTime leaf attribute. Please find the karaf log with trace level set and the generated POJO class file. |
| Comments |
| Comment by Senthilkumar Jayakumar [ 01/Aug/17 ] |
|
Attachment eventTime_logs_and_generated_pojo.zip has been added with description: Karaf logs and generated POJO classes from the yang model |
| Comment by Robert Varga [ 01/Aug/17 ] |
|
I do not believe this is either a yangtools not an mdsal codegen issue. To elaborate, 'notification' defines a YANG notification, which is the contents of the event, not its metadata (like eventTime, which really is NETCONF-specific metadata). Can you describe the specific use case? |
| Comment by Senthilkumar Jayakumar [ 02/Aug/17 ] |
|
RFC 5277 mandates eventTime to be part of every notification content and it is not merely metadata. My use case was to be able to subscribe for NETCONF notifications and further process/act upon based on the severity. -------------------------------------------------------------------------- 2.2. Sending Event Notifications Once the subscription has been set up, the NETCONF server sends the 2.2.1. <notification> Description: An event notification is sent to the client who initiated a Parameters: eventTime The time the event was generated by the event source. This Also contains notification-specific tagged content, if any. With -------------------------------------------------------------------------- |
| Comment by Robert Varga [ 17/Aug/17 ] |
|
Right, but RFC5277 is NETCONF notifications, not YANG notifications. Codegen works on top of RFC6020/7950, without access-protocol-specific metadata. |
| Comment by Karthik Holla [ 26/Oct/17 ] |
|
Hi Robert, I was looking into the code, Class NetconfMessageTransformer { } |
| Comment by Robert Varga [ 08/Nov/17 ] |
|
Right, because that is a detail is part of metadata, not the actual notification data. I am not sure how to map this – perhaps RFC7952 is part of the solution, somehow. Sorry, I do not have this problem domain loaded, so cannot really wrap my mind about end to end implications |
| Comment by Robert Varga [ 13/Nov/17 ] |
|
After thinking about this a bit more, there are essentially two approaches we can take: In either case we need to generate container classes for each md:annotation use in models, such that metadata type is properly captured (yangtools.rfc7952.model.api.Annotation gives us everything we need). I think I like approach 2) better, as it allows for proper forwarding without losing metadata. Also, we need someone to define event-time annotation – I am not sure if there is an IETF RFC/draft that does that. |
| Comment by OpenDaylight Release [ 03/May/18 ] |
|
Karthik, for now I'm assigning this to you. Please decide update who should handle this issue. |
| Comment by Robert Varga [ 18/Mar/19 ] |
|
Actually eventTime is not metadata, nor should it be attached to the notification directly, as it is data from the "Messages" layer of NETCONF, https://tools.ietf.org/html/rfc6241#section-1.2 , hence it is part of notification envelope. From that perspective option 1) is correct, as there are two distinct cases here:
The envelope approach is interesting in that an envelope can actually contain more than eventTime and 2) may want to modify other things (like record forwarding). |
| Comment by Robert Varga [ 26/Mar/19 ] |
|
I think we should take a lesson from DOM world here, where DOMNotification and DOMEvent are completely separate interfaces composed by implementation. The same approach can be taken in Binding world, where we lack the equivalent of DOMEvent – which should be defined in Binding API, not binding spec, let's say EventInstantAware. The design of that interface needs to take into account the binding spec and its method must not overlap with user-generated methods (hence no 'get' method prefix!). binding-dom-adapter would be tagging incoming Notification instances with current time, forwarding them to DOMNotificationRouter as proper DOMEvents, by subclassing LazySerializedDOMNotification. On the receiving end, binding-dom-codec needs to grow a subclass of LazyDataObject, which will, in addition to the normal interface, implement EventInstantAware. Users can then query their incoming notifications for EventInstantAware, and if it is available it will be presented to them. |