diff options
author | Toine Siebelink <toine.siebelink@est.tech> | 2022-12-12 16:09:21 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2022-12-12 16:09:21 +0000 |
commit | 55469288c62a762b16b53e665d1fd496d6126dec (patch) | |
tree | 1a4d96cdf0a35ec84d0158c3c5b4295fc1728f52 /cps-service/src/main/java | |
parent | c88883a6fcd629669efe490dc43cf5764d5ab00c (diff) | |
parent | e7f24d3f2f239e6bdc14a78eb01d07525650a960 (diff) |
Merge "Fix DataNodeBuilder for ChoiceNodes"
Diffstat (limited to 'cps-service/src/main/java')
-rw-r--r-- | cps-service/src/main/java/org/onap/cps/spi/model/DataNodeBuilder.java | 14 |
1 files changed, 13 insertions, 1 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 eaa2d77f47..af820def0c 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 @@ -33,6 +33,7 @@ import lombok.extern.slf4j.Slf4j; import org.onap.cps.spi.exceptions.DataValidationException; import org.onap.cps.utils.YangUtils; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode; 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; @@ -173,7 +174,9 @@ public class DataNodeBuilder { private static void addDataNodeFromNormalizedNode(final DataNode currentDataNode, final NormalizedNode normalizedNode) { - if (normalizedNode instanceof DataContainerNode) { + if (normalizedNode instanceof ChoiceNode) { + addChoiceNode(currentDataNode, (ChoiceNode) normalizedNode); + } else if (normalizedNode instanceof DataContainerNode) { addYangContainer(currentDataNode, (DataContainerNode) normalizedNode); } else if (normalizedNode instanceof MapNode) { addDataNodeForEachListElement(currentDataNode, (MapNode) normalizedNode); @@ -236,4 +239,13 @@ public class DataNodeBuilder { return newChildDataNode; } + private static void addChoiceNode(final DataNode currentDataNode, final ChoiceNode choiceNode) { + + final Collection<DataContainerChild> normalizedChildNodes = choiceNode.body(); + for (final NormalizedNode normalizedNode : normalizedChildNodes) { + addDataNodeFromNormalizedNode(currentDataNode, normalizedNode); + } + } + + } |