[ONOS-6939] Augment linking fix for prefix presence in self file.
Change-Id: I2505b65a612e4c8b0b4282caa274934147cd36bc
diff --git a/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/YangXpathLinker.java b/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/YangXpathLinker.java
index 1223d20..d06e3e6 100644
--- a/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/YangXpathLinker.java
+++ b/compiler/base/linker/src/main/java/org/onosproject/yang/compiler/linker/impl/YangXpathLinker.java
@@ -920,11 +920,12 @@
YangAtomicPath absPath;
String prePrefix;
String curPrefix = null;
+ String rootPrefix = getRootsPrefix(rootNode);
while (pathIterator.hasNext()) {
prePrefix = curPrefix;
absPath = pathIterator.next();
curPrefix = absPath.getNodeIdentifier().getPrefix();
- if (curPrefix != null) {
+ if (curPrefix != null && !(curPrefix.equals(rootPrefix))) {
if (!curPrefix.equals(prePrefix)) {
if (prePrefix != null) {
prefixResolverTypes.put(absPath, INTER_TO_INTER);
diff --git a/compiler/plugin/maven/src/test/resources/augwithsamename/oc/openconfig-if-ip.yang b/compiler/plugin/maven/src/test/resources/augwithsamename/oc/openconfig-if-ip.yang
index 1c7a8ce..966f599 100644
--- a/compiler/plugin/maven/src/test/resources/augwithsamename/oc/openconfig-if-ip.yang
+++ b/compiler/plugin/maven/src/test/resources/augwithsamename/oc/openconfig-if-ip.yang
@@ -10,6 +10,10 @@
prefix oc-if;
}
+ import openconfig-vlan {
+ prefix oc-vlan;
+ }
+
grouping ip-vrrp-top {
container vrrp {
list vrrp-group {
@@ -17,6 +21,11 @@
leaf virtual-router-id {
type string;
}
+ container config {
+ }
+
+ container state {
+ }
}
}
}
@@ -47,6 +56,26 @@
}
}
+ grouping ip-vrrp-ipv6-config {
+ description
+ "IPv6-specific configuration data for VRRP on IPv6
+ interfaces";
+
+ leaf virtual-link-local {
+ type string;
+ description
+ "For VRRP on IPv6 interfaces, sets the virtual link local
+ address";
+ }
+ }
+
+ grouping ip-vrrp-ipv6-state {
+ description
+ "IPv6-specific operational state for VRRP on IPv6 interfaces";
+
+ uses ip-vrrp-ipv6-config;
+ }
+
augment "/oc-if:interfaces/oc-if:interface/oc-if:subinterfaces/" +
"oc-if:subinterface" {
uses ipv4-top;
@@ -66,4 +95,76 @@
"oc-if:subinterface/oc-ip:ipv6/oc-ip:addresses/oc-ip:address" {
uses ip-vrrp-top;
}
+
+ augment "/oc-if:interfaces/oc-if:interface/oc-if:subinterfaces/" +
+ "oc-if:subinterface/oc-ip:ipv6/oc-ip:addresses/oc-ip:address/" +
+ "vrrp/vrrp-group/config" {
+ description
+ "Additional VRRP data for IPv6 interfaces";
+
+ uses ip-vrrp-ipv6-config;
+ }
+
+ augment "/oc-if:interfaces/oc-if:interface/oc-if:subinterfaces/" +
+ "oc-if:subinterface/oc-ip:ipv6/oc-ip:addresses/oc-ip:address/vrrp/" +
+ "vrrp-group/state" {
+ description
+ "Additional VRRP data for IPv6 interfaces";
+
+ uses ip-vrrp-ipv6-state;
+ }
+
+ augment "/oc-if:interfaces/oc-if:interface/oc-vlan:routed-vlan" {
+ description
+ "IPv4 addr family configuration for
+ interfaces";
+
+ uses ipv4-top;
+
+ }
+
+ augment "/oc-if:interfaces/oc-if:interface/oc-vlan:routed-vlan" {
+ description
+ "IPv6 addr family configuration for
+ interfaces";
+
+ uses ipv6-top;
+
+ }
+ augment "/oc-if:interfaces/oc-if:interface/oc-vlan:routed-vlan/" +
+ "oc-ip:ipv4/oc-ip:addresses/oc-ip:address" {
+ description
+ "Additional IP addr family configuration for
+ interfaces";
+
+ uses ip-vrrp-top;
+
+ }
+
+ augment "/oc-if:interfaces/oc-if:interface/oc-vlan:routed-vlan/" +
+ "oc-ip:ipv6/oc-ip:addresses/oc-ip:address" {
+ description
+ "Additional IP addr family configuration for
+ interfaces";
+
+ uses ip-vrrp-top;
+
+ }
+
+ augment "/oc-if:interfaces/oc-if:interface/oc-vlan:routed-vlan/" +
+ "oc-ip:ipv6/oc-ip:addresses/oc-ip:address/vrrp/vrrp-group/config" {
+ description
+ "Additional VRRP data for IPv6 interfaces";
+
+ uses ip-vrrp-ipv6-config;
+ }
+
+
+ augment "/oc-if:interfaces/oc-if:interface/oc-vlan:routed-vlan/" +
+ "oc-ip:ipv6/oc-ip:addresses/oc-ip:address/vrrp/vrrp-group/state" {
+ description
+ "Additional VRRP data for IPv6 interfaces";
+
+ uses ip-vrrp-ipv6-state;
+ }
}
diff --git a/compiler/plugin/maven/src/test/resources/augwithsamename/oc/openconfig-vlan.yang b/compiler/plugin/maven/src/test/resources/augwithsamename/oc/openconfig-vlan.yang
new file mode 100644
index 0000000..e3b3ec5
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/augwithsamename/oc/openconfig-vlan.yang
@@ -0,0 +1,46 @@
+module openconfig-vlan {
+
+ yang-version "1";
+
+ // namespace
+ namespace "http://openconfig.net/yang/vlan";
+
+ prefix "oc-vlan";
+
+ // import some basic types
+ import openconfig-interfaces { prefix oc-if; }
+
+ // meta
+ organization "OpenConfig working group";
+
+ contact
+ "OpenConfig working group
+ netopenconfig@googlegroups.com";
+
+ description
+ "This module defines configuration and state variables for VLANs,
+ in addition to VLAN parameters associated with interfaces";
+
+ //oc-ext:openconfig-version "1.0.2";
+
+ revision "2016-05-26" {
+ description
+ "OpenConfig public release";
+ reference "1.0.2";
+ }
+
+
+ grouping vlan-routed-top {
+ container routed-vlan {
+ }
+ }
+ augment "/oc-if:interfaces/oc-if:interface" {
+ uses vlan-routed-top;
+ }
+
+
+ // rpc statements
+
+ // notification statements
+
+}