X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=binding%2Fmdsal-binding-generator-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fmdsal%2Fbinding%2Fyang%2Ftypes%2FAbstractTypeProvider.java;h=2efc0f64c3fe6dc619dd89d1a4966b021fda9ba4;hb=5257d1f5ee59ade8f1b56078eda5e0b78e6d9183;hp=bbd45c7788b565c3458e59a78955f6411f8401da;hpb=1441f51fcc3bd6e9dc67ad6f5810754c43a073d4;p=mdsal.git diff --git a/binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/mdsal/binding/yang/types/AbstractTypeProvider.java b/binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/mdsal/binding/yang/types/AbstractTypeProvider.java index bbd45c7788..2efc0f64c3 100644 --- a/binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/mdsal/binding/yang/types/AbstractTypeProvider.java +++ b/binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/mdsal/binding/yang/types/AbstractTypeProvider.java @@ -9,8 +9,8 @@ package org.opendaylight.mdsal.binding.yang.types; import static java.util.Objects.requireNonNull; import static org.opendaylight.mdsal.binding.model.util.BindingTypes.TYPE_OBJECT; -import static org.opendaylight.yangtools.yang.model.util.SchemaContextUtil.findDataSchemaNode; import static org.opendaylight.yangtools.yang.model.util.SchemaContextUtil.findDataSchemaNodeForRelativeXPath; +import static org.opendaylight.yangtools.yang.model.util.SchemaContextUtil.findDataTreeSchemaNode; import static org.opendaylight.yangtools.yang.model.util.SchemaContextUtil.findParentModule; import com.google.common.annotations.Beta; @@ -266,16 +266,17 @@ public abstract class AbstractTypeProvider implements TypeProvider { // Then try to look up the expression. final PathExpression leafRefXPath = leafref.getPathStatement(); - final PathExpression leafRefStrippedXPath = new PathExpressionImpl( - GROUPS_PATTERN.matcher(leafRefXPath.getOriginalString()).replaceAll(""), leafRefXPath.isAbsolute()); final Module parentModule = getParentModule(parentNode); final SchemaNode leafRefValueNode; - if (!leafRefStrippedXPath.isAbsolute()) { - leafRefValueNode = SchemaContextUtil.findDataSchemaNodeForRelativeXPath(schemaContext, parentModule, - parentNode, leafRefStrippedXPath); + if (leafRefXPath.isAbsolute()) { + leafRefValueNode = SchemaContextUtil.findDataTreeSchemaNode(schemaContext, parentModule.getQNameModule(), + leafRefXPath); } else { - leafRefValueNode = SchemaContextUtil.findDataSchemaNode(schemaContext, parentModule, leafRefStrippedXPath); + leafRefValueNode = SchemaContextUtil.findDataSchemaNodeForRelativeXPath(schemaContext, parentModule, + parentNode, new PathExpressionImpl( + GROUPS_PATTERN.matcher(leafRefXPath.getOriginalString()).replaceAll(""), false)); } + return leafRefValueNode != null && leafRefValueNode.equals(parentNode); } @@ -510,7 +511,7 @@ public abstract class AbstractTypeProvider implements TypeProvider { final SchemaNode dataNode; if (xpath.isAbsolute()) { - dataNode = findDataSchemaNode(schemaContext, module, xpath); + dataNode = findDataTreeSchemaNode(schemaContext, module.getQNameModule(), xpath); } else { dataNode = findDataSchemaNodeForRelativeXPath(schemaContext, module, parentNode, xpath); if (dataNode == null && inGrouping) { @@ -1540,7 +1541,7 @@ public abstract class AbstractTypeProvider implements TypeProvider { if (module != null) { final SchemaNode dataNode; if (xpath.isAbsolute()) { - dataNode = findDataSchemaNode(schemaContext, module, xpath); + dataNode = findDataTreeSchemaNode(schemaContext, module.getQNameModule(), xpath); } else { dataNode = findDataSchemaNodeForRelativeXPath(schemaContext, module, parentNode, xpath); }