[SNMP-5] yang-oid-plugin generates duplicate OIDs Created: 09/Jul/15  Updated: 19/Oct/17  Resolved: 12/Jul/15

Status: Resolved
Project: snmp
Component/s: General
Affects Version/s: unspecified
Fix Version/s: None

Type: Bug
Reporter: Jon Rosenberger Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


External issue ID: 3976

 Description   

If the yang-oid-plugin is executed multiple times, it writes the same OIDs again, so there are multiple for each method. This isn't legal Java 7 syntax so it causes compile errors:

target/generated-sources/sal/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/smiv2/_if/mib/rev000614/interfaces/group/IfEntryBuilder.java:[428,9] duplicate annotation

It should just overwrite the OID so there is always one per get method.

To reproduce this, run "mvn generate-sources" in mibs-model, then examine IfEntryBuilder.java

It also happens during a normal "clean install", apparently the plugin is executed twice. Errors can be seen in the output though they don't fail the build. Other tools (such as eclipse) do fail though.



 Comments   
Comment by Jon Rosenberger [ 11/Jul/15 ]

fixed in https://git.opendaylight.org/gerrit/24022

"mvn clean install" now works in snmp for jdk 1.8

Comment by Jon Rosenberger [ 11/Jul/15 ]

Ignore that comment, this is fixed in https://git.opendaylight.org/gerrit/#/c/23963/
(In reply to Jon Rosenberger from comment #1)
> fixed in https://git.opendaylight.org/gerrit/24022
>
> "mvn clean install" now works in snmp for jdk 1.8

Comment by Adam Dierkens [ 12/Jul/15 ]

The fix was merged. Though I'm still slightly skeptical about how we got duplicate OIDs to begin with.

Unless I'm mistaken "mvn generate-sources" should also generate the Java classes from the yang models, which would give the yang-oid-plugin a clean slate to write the OID tags.

If we end up with duplicate OID tags, then either the yang-oid-plugin is being executed twice, or the Java classes generated by the yang-maven-plugin aren't overriding the already generated ones. In either case, I've got to do some digging to find the root cause of the bug.

Comment by Adam Dierkens [ 12/Jul/15 ]

The fix was merged. Though I'm still slightly skeptical about how we got duplicate OIDs to begin with.

Unless I'm mistaken "mvn generate-sources" should also generate the Java classes from the yang models, which would give the yang-oid-plugin a clean slate to write the OID tags.

If we end up with duplicate OID tags, then either the yang-oid-plugin is being executed twice, or the Java classes generated by the yang-maven-plugin aren't overriding the already generated ones. In either case, I've got to do some digging to find the root cause of the bug.

Generated at Wed Feb 07 20:39:11 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.