tail-f-systems / JNC

JNC (Java NETCONF Client) is the name of a Java library for communicating with NETCONF agents, and a plugin for pyang (http://code.google.com/p/pyang/) to generate Java classes from YANG models, to be used by the JNC library.
Other
77 stars 87 forks source link

overlapping augments get overwritten #13

Open joagre opened 11 years ago

joagre commented 11 years ago

We have an issue when different YANG modules augments a leaf with the same name into the same container in a third YANG module.

For example,

$ pyang -p ~/work/trunk/pyang/modules -f jnc --jnc-debug --jnc-output src a.yang

a.yang looks like this:

augment "/simple:hosts/simple:host" { leaf primary-port { type testType; default 2012; tailf:java-class-name bajs; } }

and src/hosts/hosts/Host.java is generated.

Then I do:

$ pyang -p ~/work/trunk/pyang/modules -f jnc --jnc-debug --jnc-output src b.yang

b.yang looks like this:

augment "/simple:hosts/simple:host" { leaf primary-port { type inet:port-number; default 2013; } leaf secondary-port { type inet:port-number; default 2014; } }

src/hosts/hosts/Host.java is regenerated.

In the end the methods to handle the primary-port leaf methods in Host.java overwrites each other.

This is bad. We need to think on this and come up with a better strategy.

It may be that I misunderstand something as well. This has been known to happen. :)

I'm looking for a solution.

/Jocke

Emil-Tail-f commented 11 years ago

What is the priority of this issue, is there someone wanting to use JNC with models having this problem? What is the preferred solution - using the tailf:java-class-name extension or something more generic (convention based) or specific to JNC (such as jnc:java-class-name, if extension-based at all)?