diff options
author | janani b <janani.b@huawei.com> | 2018-09-12 18:30:28 +0530 |
---|---|---|
committer | janani b <janani.b@huawei.com> | 2018-09-12 18:30:28 +0530 |
commit | 259eece936114ccacf9acc8f412eeed033fd10c4 (patch) | |
tree | a3cd3e726b234c546e5433a9006ac71896c0760d /restconf-client/provider/src/main/java/org/onap | |
parent | f7086e83c97a72be14ef6813b3c1f8bd0546452e (diff) |
UT and defect fixes for DF serializer
UT and defect fixes
Issue-ID: CCSDK-376
Change-Id: Ia5f04a0d7e07caad0e3b380fdfa6cc109ec43b4e
Signed-off-by: janani b <janani.b@huawei.com>
Diffstat (limited to 'restconf-client/provider/src/main/java/org/onap')
9 files changed, 202 insertions, 63 deletions
diff --git a/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiCallNode.java b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiCallNode.java index 42caf368..f9a1ecbf 100644 --- a/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiCallNode.java +++ b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiCallNode.java @@ -36,8 +36,8 @@ import org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.SerializerHelper; import org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.YangParameters; import org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.MdsalPropertiesNodeSerializer; import org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.PropertiesNodeSerializer; -import org.opendaylight.netconf.sal.restconf.impl.ControllerContext; import org.opendaylight.restconf.common.context.InstanceIdentifierContext; +import org.opendaylight.restconf.nb.rfc8040.utils.parser.ParserIdentifier; import org.opendaylight.yangtools.yang.model.api.SchemaContext; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; @@ -90,6 +90,27 @@ public class RestconfApiCallNode implements SvcLogicJavaPlugin { private static final Logger log = LoggerFactory.getLogger( RestconfApiCallNode.class); + /** + * Rest api call node service instance + */ + private RestapiCallNode restapiCallNode; + + /** + * Creates an instance of restconf api call node with restapi call node. + * + * @param r restapi call node + */ + public RestconfApiCallNode(RestapiCallNode r) { + this.restapiCallNode = r; + } + + /** + * Returns the restapi call node instance. + * @return + */ + public RestapiCallNode getRestapiCallNode() { + return restapiCallNode; + } /** * Sends the restconf request using the parameters map and the memory @@ -116,7 +137,7 @@ public class RestconfApiCallNode implements SvcLogicJavaPlugin { */ public void sendRequest(Map<String, String> paramMap, SvcLogicContext ctx, Integer retryCount) throws SvcLogicException { - RestapiCallNode rest = new RestapiCallNode(); + RestapiCallNode rest = getRestapiCallNode(); RetryPolicy retryPolicy = null; HttpResponse r = new HttpResponse(); try { @@ -203,7 +224,7 @@ public class RestconfApiCallNode implements SvcLogicJavaPlugin { * @return JSON or XML message to be sent * @throws SvcLogicException when serializing the request fails */ - protected String serializeRequest(Map<String, String> properties, + public String serializeRequest(Map<String, String> properties, YangParameters params, String uri, InstanceIdentifierContext insIdCtx) throws SvcLogicException { @@ -227,9 +248,9 @@ public class RestconfApiCallNode implements SvcLogicJavaPlugin { * @return response message as properties * @throws SvcLogicException when serializing the response fails */ - protected Map<String, String> serializeResponse(YangParameters params, - String uri, String response, - InstanceIdentifierContext insIdCtx) + public Map<String, String> serializeResponse(YangParameters params, + String uri, String response, + InstanceIdentifierContext insIdCtx) throws SvcLogicException { PropertiesNodeSerializer propSer = new MdsalPropertiesNodeSerializer( insIdCtx.getSchemaNode(), insIdCtx.getSchemaContext(), uri); @@ -255,9 +276,7 @@ public class RestconfApiCallNode implements SvcLogicJavaPlugin { String uri) throws SvcLogicException { SchemaContext context = getSchemaContext(params); - ControllerContext contCtx = ControllerContext.getInstance(); - contCtx.onGlobalContextUpdated(context); - return contCtx.toInstanceIdentifier(uri); + return ParserIdentifier.toInstanceIdentifier(uri, context, null); } /** @@ -294,7 +313,7 @@ public class RestconfApiCallNode implements SvcLogicJavaPlugin { * @param res http response * @return response message body */ - private String getResponse(SvcLogicContext ctx, YangParameters params, + public String getResponse(SvcLogicContext ctx, YangParameters params, String pre, HttpResponse res) { ctx.setAttribute(pre + RES_CODE, String.valueOf(res.code)); ctx.setAttribute(pre + RES_MSG, res.message); diff --git a/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DefaultJsonListener.java b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DefaultJsonListener.java index 107585a7..45317522 100644 --- a/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DefaultJsonListener.java +++ b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DefaultJsonListener.java @@ -53,6 +53,16 @@ public class DefaultJsonListener implements JsonListener { private String modName; /** + * Value of the current JSON node. + */ + private String value; + + /** + * Value namespace of the current JSON node. + */ + private String valueNs; + + /** * Creates an instance of default json listener with its serializer helper. * * @param serializerHelper serializer helper @@ -64,16 +74,18 @@ public class DefaultJsonListener implements JsonListener { @Override public void enterJsonNode(String nodeName, JsonNode node, NodeType nodeType) throws SvcLogicException { - getNodeName(nodeName); + getNodeName(nodeName, false); switch (nodeType) { case SINGLE_INSTANCE_LEAF_NODE: - serializerHelper.addNode(name, modName, node.asText(), null, + getNodeName(node.asText(), true); + serializerHelper.addNode(name, modName, value, valueNs, SINGLE_INSTANCE_LEAF_NODE); break; case MULTI_INSTANCE_LEAF_NODE: - serializerHelper.addNode(name, modName, node.asText(), null, + getNodeName(node.asText(), true); + serializerHelper.addNode(name, modName, value, valueNs, MULTI_INSTANCE_LEAF_NODE); break; @@ -105,18 +117,29 @@ public class DefaultJsonListener implements JsonListener { /** * Parses the abstract JSON name and fills the node name and node - * namespace of the current JSON node. + * namespace or value and value namespace of the current JSON node . * - * @param abstractName abstract JSON name + * @param abstractName full name value + * @param isVal if it is for value parsing */ - private void getNodeName(String abstractName) { + private void getNodeName(String abstractName, boolean isVal) { String[] val = abstractName.split(":"); if (val.length == 2) { - modName = val[0]; - name = val[1]; + if (isVal) { + valueNs = val[0]; + value = val[1]; + } else { + modName = val[0]; + name = val[1]; + } } else { - name = val[0]; + if (isVal) { + value = val[0]; + valueNs = null; + } else { + name = val[0]; + modName = null; + } } } - } diff --git a/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DefaultXmlListener.java b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DefaultXmlListener.java index 57969146..03abf44f 100644 --- a/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DefaultXmlListener.java +++ b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DefaultXmlListener.java @@ -21,8 +21,11 @@ package org.onap.ccsdk.sli.plugins.yangserializers.dfserializer; import org.dom4j.Element; +import org.dom4j.Namespace; import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import java.util.List; + import static java.lang.String.format; import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DfSerializerUtil.NODE_TYPE_ERR; @@ -56,6 +59,11 @@ public class DefaultXmlListener implements XmlListener { break; case OBJECT_NODE: + List cont = element.content(); + if (cont != null && cont.size() == 2 && + isValueNsForLeaf(cont, element)) { + return; + } serializerHelper.addNode(element.getName(), element.getNamespace().getURI(), null, null, null); @@ -67,6 +75,39 @@ public class DefaultXmlListener implements XmlListener { } } + /** + * Returns true if element has value namespace and adds the node to + * property tree; false otherwise. + * + * @param cont content of the element + * @param element element + * @return true if element has value namespace; false otherwise + * @throws SvcLogicException + */ + private boolean isValueNsForLeaf(List cont, Element element) + throws SvcLogicException { + for (Object c : cont) { + if (c instanceof Namespace) { + String value = element.getText(); + if (value != null) { + String[] val = value.split(":"); + String valPrefix = val[0]; + String actVal = val[1]; + if (valPrefix != null && actVal != null && + valPrefix.equals(((Namespace) c).getPrefix())) { + serializerHelper.addNode( + element.getName(), + element.getNamespace().getURI(), + actVal, + ((Namespace) c).getURI(), null); + return true; + } + } + } + } + return false; + } + @Override public void exitXmlElement(Element element) throws SvcLogicException { serializerHelper.exitNode(); diff --git a/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DfSerializerUtil.java b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DfSerializerUtil.java index 6acb04a8..598b08c1 100644 --- a/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DfSerializerUtil.java +++ b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DfSerializerUtil.java @@ -26,7 +26,6 @@ import org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.Namespace; import org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.PropertiesNode; import org.opendaylight.yangtools.yang.model.api.Module; import org.opendaylight.yangtools.yang.model.api.SchemaContext; -import org.opendaylight.yangtools.yang.model.api.SchemaNode; import org.opendaylight.yangtools.yang.model.api.TypeDefinition; import org.w3c.dom.Document; import org.xml.sax.InputSource; @@ -46,6 +45,7 @@ import java.io.StringWriter; import java.io.Writer; import java.net.URI; import java.net.URISyntaxException; +import java.util.Iterator; import static javax.xml.transform.OutputKeys.INDENT; import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.XmlNodeType.OBJECT_NODE; @@ -150,40 +150,44 @@ public final class DfSerializerUtil { * Returns the resolved namespace object from the input received from the * abstract data format. * - * @param mName module name - * @param curSchema current schema - * @param ctx schema context - * @param mUri module URI - * @param pNode properties node + * @param mName module name + * @param mUri module URI + * @param ctx schema context + * @param parent parent properties node * @return namespace * @throws SvcLogicException when resolving namespace fails */ - static Namespace getResolvedNamespace(String mName, SchemaNode curSchema, - SchemaContext ctx, String mUri, - PropertiesNode pNode) + static Namespace getResolvedNamespace(String mName, String mUri, + SchemaContext ctx, + PropertiesNode parent) throws SvcLogicException { - Module m = null; - URI namespace = curSchema.getQName().getNamespace(); + if (mName == null && mUri == null) { + Namespace parentNs = parent.namespace(); + return new Namespace(parentNs.moduleName(), parentNs.moduleNs(), + parentNs.revision()); + } + Iterator<Module> it; + Module mod; if (mName != null) { - m = ctx.findModule(mName).get(); - namespace = m == null ? null : m.getNamespace(); - } - if (mUri != null) { + it = ctx.findModules(mName).iterator(); + } else { + URI modUri = null; try { - m = ctx.findModule(new URI(mUri)).get(); + modUri = new URI(mUri); } catch (URISyntaxException e) { throw new SvcLogicException(URI_ERR, e); } - namespace = m == null ? null : m.getNamespace(); - mName = m.getName(); + it = ctx.findModules(modUri).iterator(); } - if (mName == null && mUri == null) { - return pNode.namespace(); + if (!it.hasNext()) { + return null; } + mod = it.next(); - return new Namespace(mName, namespace, getRevision(m.getRevision())); + return new Namespace(mod.getName(), mod.getQNameModule().getNamespace(), + getRevision(mod.getRevision())); } /** diff --git a/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/MdsalSerializerHelper.java b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/MdsalSerializerHelper.java index 5a898dfc..6f9f9070 100644 --- a/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/MdsalSerializerHelper.java +++ b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/MdsalSerializerHelper.java @@ -25,6 +25,9 @@ import org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.Namespace; import org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.NodeType; import org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.PropertiesNode; import org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.RootNode; +import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Revision; +import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode; import org.opendaylight.yangtools.yang.model.api.DataSchemaNode; import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode; import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode; @@ -49,6 +52,8 @@ import static org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.NodeType.M import static org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.NodeType.MULTI_INSTANCE_NODE; import static org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.NodeType.SINGLE_INSTANCE_LEAF_NODE; import static org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.NodeType.SINGLE_INSTANCE_NODE; +import static org.opendaylight.yangtools.yang.data.impl.schema.SchemaUtils.findDataChildSchemaByQName; +import static org.opendaylight.yangtools.yang.data.impl.schema.SchemaUtils.findSchemaForChild; import static org.opendaylight.yangtools.yang.data.util.ParserStreamUtils.findSchemaNodeByNameAndNamespace; /** @@ -108,14 +113,17 @@ public class MdsalSerializerHelper extends SerializerHelper<SchemaNode, SchemaCo throws SvcLogicException { Namespace ns; if (type == null) { - ns = getResolvedNamespace(null, curSchemaNode, getSchemaCtx(), - nameSpace, propNode); + ns = getResolvedNamespace(null, nameSpace, + getSchemaCtx(), propNode); } else { - ns = getResolvedNamespace(nameSpace, curSchemaNode, getSchemaCtx(), - nameSpace, propNode); + ns = getResolvedNamespace(nameSpace, null, + getSchemaCtx(), propNode); } if (isChildPresent(name, ns)) { addNodeToProperty(name, ns, value, valNameSpace, type); + } else { + throw new SvcLogicException(format( + "Unable to add the node %s", name)); } } @@ -192,15 +200,20 @@ public class MdsalSerializerHelper extends SerializerHelper<SchemaNode, SchemaCo NodeType nodeType) throws SvcLogicException { Namespace ns = null; if (valNs != null) { - TypeDefinition type = ((LeafSchemaNode) schemaNode).getType(); + TypeDefinition type; + if (schemaNode instanceof LeafSchemaNode) { + type = ((LeafSchemaNode) schemaNode).getType(); + } else { + type = ((LeafListSchemaNode) schemaNode).getType(); + } TypeDefinition<?> baseType = resolveBaseTypeFrom(type); if (baseType instanceof IdentityrefTypeDefinition) { if (nodeType == null) { - ns = getResolvedNamespace(null,schemaNode, getSchemaCtx(), - valNs, propNode); + ns = getResolvedNamespace(null, valNs, getSchemaCtx(), + propNode); } else { - ns = getResolvedNamespace(valNs, schemaNode, getSchemaCtx(), - null, propNode); + ns = getResolvedNamespace(valNs, null, getSchemaCtx(), + propNode); } } } @@ -255,14 +268,28 @@ public class MdsalSerializerHelper extends SerializerHelper<SchemaNode, SchemaCo * @return returns true if the child schema is available; false otherwise */ private boolean isChildPresent(String name, Namespace namespace) { - Deque<DataSchemaNode> dataSchema = findSchemaNodeByNameAndNamespace( - (DataSchemaNode) curSchemaNode, name, namespace.moduleNs()); - if (dataSchema != null) { - DataSchemaNode node = dataSchema.pop(); - if (node != null) { - curSchemaNode = node; - return true; + QName qname = QName.create(namespace.moduleNs(), + Revision.of(namespace.revision()), name); + SchemaNode childNode = null; + if (curSchemaNode instanceof DataSchemaNode) { + Deque<DataSchemaNode> dataSchema = findSchemaNodeByNameAndNamespace( + (DataSchemaNode) curSchemaNode, name, namespace.moduleNs()); + if (dataSchema != null && !dataSchema.isEmpty()) { + childNode = dataSchema.pop(); + } + + if (!dataSchema.isEmpty()) { + childNode = findSchemaForChild(((ChoiceSchemaNode) childNode), + qname); } + + } else { + childNode = findDataChildSchemaByQName(curSchemaNode, qname); + } + + if (childNode != null) { + curSchemaNode = childNode; + return true; } return false; } diff --git a/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/PropertiesNodeXmlListener.java b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/PropertiesNodeXmlListener.java index cf59b779..39a08e38 100644 --- a/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/PropertiesNodeXmlListener.java +++ b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/PropertiesNodeXmlListener.java @@ -42,6 +42,8 @@ import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DfSerializ import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DfSerializerUtil.UTF_HEADER; import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DfSerializerUtil.XML_PREFIX; import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DfSerializerUtil.getXmlWriter; +import static org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.NodeType.MULTI_INSTANCE_HOLDER_NODE; +import static org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.NodeType.MULTI_INSTANCE_LEAF_HOLDER_NODE; /** * Representation of XML implementation of properties node listener. @@ -193,7 +195,11 @@ public class PropertiesNodeXmlListener implements PropertiesNodeListener { */ private String getNodeNamespace(PropertiesNode node) { PropertiesNode parent = node.parent(); - if (parent instanceof RootNode || !parent.namespace().moduleName() + if (parent.nodeType() == MULTI_INSTANCE_HOLDER_NODE || + parent.nodeType() == MULTI_INSTANCE_LEAF_HOLDER_NODE) { + parent = parent.parent(); + } + if (parent instanceof RootNode || ! parent.namespace().moduleName() .equals(node.namespace().moduleName())) { return node.namespace().moduleNs().toString(); } diff --git a/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/DefaultPropertiesNodeListener.java b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/DefaultPropertiesNodeListener.java index d9120912..491dcb09 100644 --- a/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/DefaultPropertiesNodeListener.java +++ b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/DefaultPropertiesNodeListener.java @@ -54,7 +54,11 @@ public class DefaultPropertiesNodeListener implements PropertiesNodeListener { */ if (node.nodeType() == SINGLE_INSTANCE_LEAF_NODE || node.nodeType() == MULTI_INSTANCE_LEAF_NODE) { - params.put(node.uri(), ((LeafNode) node).value()); + String val = ((LeafNode) node).value(); + if (((LeafNode) node).valueNs() != null) { + val = ((LeafNode) node).valueNs().moduleName() + ":" + val; + } + params.put(node.uri(), val); } } diff --git a/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/MdsalPropertiesNodeSerializer.java b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/MdsalPropertiesNodeSerializer.java index c2414626..13a5c5a0 100644 --- a/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/MdsalPropertiesNodeSerializer.java +++ b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/MdsalPropertiesNodeSerializer.java @@ -33,6 +33,7 @@ import static org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.MdsalPrope import static org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.MdsalPropertiesNodeUtils.getListName; import static org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.MdsalPropertiesNodeUtils.getNamespace; import static org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.MdsalPropertiesNodeUtils.getNodeType; +import static org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.MdsalPropertiesNodeUtils.getParsedValue; import static org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.MdsalPropertiesNodeUtils.getRevision; import static org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.MdsalPropertiesNodeUtils.getValueNamespace; import static org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.MdsalPropertiesNodeUtils.resolveName; @@ -116,26 +117,32 @@ public class MdsalPropertiesNodeSerializer extends PropertiesNodeSerializer<Sche SINGLE_INSTANCE_NODE, schema); curSchema = schema; break; + case MULTI_INSTANCE_NODE: node = node.addChild(getIndex(name), localName, ns, MULTI_INSTANCE_NODE, schema); curSchema = schema; break; + case SINGLE_INSTANCE_LEAF_NODE: + Namespace valNs = getValueNamespace(value, schemaCtx()); + value = getParsedValue(valNs, value); node = node.addChild(localName, ns, SINGLE_INSTANCE_LEAF_NODE, - value, getValueNamespace(value, schemaCtx()), - schema); + value, valNs, schema); node = node.endNode(); curSchema = ((SchemaNode) node.appInfo()); break; + case MULTI_INSTANCE_LEAF_NODE: + valNs = getValueNamespace(value, schemaCtx()); + value = getParsedValue(valNs, value); node = node.addChild(getIndex(name), localName, ns, MULTI_INSTANCE_LEAF_NODE, value, - getValueNamespace(value, schemaCtx()), - schema); + valNs, schema); node = node.endNode(); curSchema = ((SchemaNode) node.appInfo()); break; + default: throw new SvcLogicException("Invalid node type"); } diff --git a/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/MdsalPropertiesNodeUtils.java b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/MdsalPropertiesNodeUtils.java index 5b4755e8..d7b4818b 100644 --- a/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/MdsalPropertiesNodeUtils.java +++ b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/MdsalPropertiesNodeUtils.java @@ -350,4 +350,12 @@ public final class MdsalPropertiesNodeUtils { return new Namespace(m.getName(), m.getQNameModule().getNamespace(), getRevision(m.getRevision())); } + + static String getParsedValue(Namespace valNs, String value) { + if (valNs != null && value.contains(":")) { + String[] valArr = value.split(":"); + return valArr[1]; + } + return value; + } } |