[YANGTOOLS-405] Compilation error: grouping address-family and identity address-family both exist in ietf-routing.yang Created: 29/Jan/15  Updated: 10/Apr/22  Resolved: 02/Feb/15

Status: Resolved
Project: yangtools
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Minna Hu Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: Linux
Platform: PC


Issue Links:
Duplicate
duplicates MDSAL-1 Binding Specification: Grouping, data... Resolved
External issue ID: 2655

 Description   

Hi,

I tried to generate JAVA class from ietf-routing.yang (see http://www.netconfcentral.org/modules/ietf-routing), but the generated classes cannot compile, as follows.

If you already developed maven artifacts for ietf-routing, please let me know. If not, could you solve the bug? Thanks!

ietf-routing.yang:

identity address-family

{ description "Base identity from which identities describing address families are derived."; }

grouping address-family {
description
"This grouping provides a leaf identifying an address
family.";
leaf address-family {
type identityref

{ base address-family; }

mandatory true;
description "Address family.";
}
} // grouping address-family

identity ipv4 {
base address-family;
description
"This identity represents IPv4 address family.";
}

Please notice there are 2 address-family definitions in ietf-routing.yang, one is identity, the other is grouping, this will cause the problem.

The generated Ipv4 class extended an interface, so it cannot compile.

public abstract class Ipv4 extends AddressFamily
{
public static final QName QNAME = org.opendaylight.yangtools.yang.common.QName.create("urn:ietf:params:xml:ns:yang:ietf-routing","2014-05-24","ipv4");;

public Ipv4() {

}
}

public interface AddressFamily
extends
DataObject

{ public static final QName QNAME = org.opendaylight.yangtools.yang.common.QName.create("urn:ietf:params:xml:ns:yang:ietf-routing","2014-05-24","address-family");; /** * Address family. * */ java.lang.Class<? extends org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.AddressFamily> getAddressFamily(); }

 Comments   
Comment by Tony Tkacik [ 02/Feb/15 ]

this is known problem of Binding Specification v1 (MDSAL-1) which could not be addressed
without potentially breaking existing Binding Specification.

Unfortunattely this is not fixable as is, without changes of how we generate files, which could potentially affect every code generated, and this will be addressed in version 2 of Binding Specification
(currently planned for Berilium).

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