summaryrefslogtreecommitdiffstats
path: root/cps-service/src/main
diff options
context:
space:
mode:
authorRuslan Kashapov <ruslan.kashapov@pantheon.tech>2021-04-02 12:41:14 +0300
committerRishi Chail <rishi.chail@est.tech>2021-04-07 09:17:23 +0000
commit26effb23f559df0256327b8d37c865e023a41292 (patch)
tree14f4a596e0e5d6602d183a741d9de5911b126bbe /cps-service/src/main
parentd138529fe66f39b17047091d7e54117845ba9b50 (diff)
Fix xpath building for data nodes addressing YANG augmentation
Issue-ID: CPS-316 Change-Id: I8aa0960c2a6af2b8fe5bc2fb90efe36baee7a881 Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Diffstat (limited to 'cps-service/src/main')
-rw-r--r--cps-service/src/main/java/org/onap/cps/spi/model/DataNodeBuilder.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/cps-service/src/main/java/org/onap/cps/spi/model/DataNodeBuilder.java b/cps-service/src/main/java/org/onap/cps/spi/model/DataNodeBuilder.java
index ea0626c2b2..cf79ad7e0b 100644
--- a/cps-service/src/main/java/org/onap/cps/spi/model/DataNodeBuilder.java
+++ b/cps-service/src/main/java/org/onap/cps/spi/model/DataNodeBuilder.java
@@ -30,6 +30,7 @@ import java.util.Set;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
import org.onap.cps.utils.YangUtils;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode;
import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode;
@@ -150,8 +151,10 @@ public class DataNodeBuilder {
}
private static void addYangContainer(final DataNode currentDataNode, final DataContainerNode<?> dataContainerNode) {
- final DataNode dataContainerDataNode = createAndAddChildDataNode(currentDataNode,
- YangUtils.buildXpath(dataContainerNode.getIdentifier()));
+ final DataNode dataContainerDataNode =
+ (dataContainerNode.getIdentifier() instanceof YangInstanceIdentifier.AugmentationIdentifier)
+ ? currentDataNode
+ : createAndAddChildDataNode(currentDataNode, YangUtils.buildXpath(dataContainerNode.getIdentifier()));
final Collection<DataContainerChild<?, ?>> normalizedChildNodes = dataContainerNode.getValue();
for (final NormalizedNode<?, ?> normalizedNode : normalizedChildNodes) {
addDataNodeFromNormalizedNode(dataContainerDataNode, normalizedNode);