-
Bug
-
Resolution: Cannot Reproduce
-
Medium
-
None
-
7.0.6
-
None
We are experimenting with Broadband forum yang files and noticed that yang notifications are declared in groupings. The groupings are used by containers.
The MD-SAL code generator does not create listeners for this type of yang, nor does it even recognize that notification "object" is even a notification.
Is this a bug in the mdsal code generator?
A yang file is attached, as will as an even simplified version below. We have a grouping declared with is a notification for device state changes. A container has a sub container that uses this grouping.
module test-grouping-notif-a { yang-version 1.1; namespace "urn:test:yang:grouping:notifa"; prefix test-grouping-notifa; organization "Some organization"; contact "Some contact"; description "This is a test yang created to reproduce an issue where groupings including notifications do not generate a listener from the md-sal code generator"; revision 2021-10-18 { description "test"; } grouping notification-grouping-a { description "This is a grouping which contains a notification"; notification device-state-change { description "Device state changed"; leaf event { type enumeration { enum online; enum offline; } description "events definition for device state change"; } } } container grouping-notif-a { description "Just a test yang model"; container device-notification-a { description "A notification that is wrapped in a grouping"; uses notification-grouping-a; } } }
The code generator creates a "DeviceStateChange" interface like this:
@Generated("mdsal-binding-generator") public interface DeviceStateChange extends DataObject, Augmentable<DeviceStateChange>, InstanceNotification<DeviceStateChange, DeviceNotificationA> { @Generated("mdsal-binding-generator") public interface DeviceNotificationA extends ChildOf<GroupingNotifA>, Augmentable<DeviceNotificationA>, NotificationGroupingA { @Generated("mdsal-binding-generator") public interface NotificationGroupingA extends DataObject {
So, there is no object that extends "NotificationListener" here.
The code generator is show in a snippet from a pom.xml file.
org.opendaylight.mdsal.binding.maven.api.gen.plugin.CodeGeneratorImpl version 7.0.6
pom.xml generator:
<plugin>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yang-maven-plugin</artifactId>
<version>6.0.5</version>
<dependencies>
<dependency>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>maven-sal-api-gen-plugin</artifactId>
<version>7.0.6</version>
<type>jar</type>
</dependency>
</dependencies>
<executions>
<execution>
<id>binding</id>
<goals>
<goal>generate-sources</goal>
</goals>
<configuration>
<yangFilesRootDir>${yangFilesPath}</yangFilesRootDir>
<codeGenerators>
<generator>
<codeGeneratorClass>org.opendaylight.mdsal.binding.maven.api.gen.plugin.CodeGeneratorImpl</codeGeneratorClass>
<outputBaseDir>${salGeneratorPath}</outputBaseDir>
</generator>
</codeGenerators>
<inspectDependencies>true</inspectDependencies>
</configuration>
</execution>
</executions>
</plugin>