diff options
author | Ruslan Kashapov <ruslan.kashapov@pantheon.tech> | 2021-04-02 12:41:14 +0300 |
---|---|---|
committer | Rishi Chail <rishi.chail@est.tech> | 2021-04-07 09:17:23 +0000 |
commit | 26effb23f559df0256327b8d37c865e023a41292 (patch) | |
tree | 14f4a596e0e5d6602d183a741d9de5911b126bbe /cps-service/src/main/java/org | |
parent | d138529fe66f39b17047091d7e54117845ba9b50 (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/java/org')
-rw-r--r-- | cps-service/src/main/java/org/onap/cps/spi/model/DataNodeBuilder.java | 7 |
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); |