diff options
Diffstat (limited to 'plugins/restconf-client/provider/src/main')
9 files changed, 33 insertions, 32 deletions
diff --git a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiCallNode.java b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiCallNode.java index b5a9df706..4a2e18198 100644 --- a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiCallNode.java +++ b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiCallNode.java @@ -84,6 +84,7 @@ import org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.Namespace; import org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.PropertiesNodeSerializer; import org.opendaylight.restconf.common.context.InstanceIdentifierContext; import org.opendaylight.restconf.nb.rfc8040.utils.parser.ParserIdentifier; +import org.opendaylight.yangtools.yang.common.XMLNamespace; import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext; import org.opendaylight.yangtools.yang.model.api.SchemaNode; import org.opendaylight.yangtools.yang.model.parser.api.YangParserException; @@ -479,7 +480,7 @@ public class RestconfApiCallNode implements SvcLogicJavaPlugin { * @throws SvcLogicException when XML parsing fails */ private String getXmlReqForPutOp(String req, String nodeName, - URI modNs) throws SvcLogicException { + XMLNamespace modNs) throws SvcLogicException { req = getUpdatedXmlReq(req, nodeName, modNs.toString()); Document oldDoc; try { diff --git a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DfSerializerUtil.java b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DfSerializerUtil.java index 0134a5a47..ab554dd45 100644 --- a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DfSerializerUtil.java +++ b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DfSerializerUtil.java @@ -45,6 +45,7 @@ import org.dom4j.Element; import org.onap.ccsdk.sli.core.sli.SvcLogicException; import org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.Namespace; import org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.PropertiesNode; +import org.opendaylight.yangtools.yang.common.XMLNamespace; import org.opendaylight.yangtools.yang.model.api.Module; import org.opendaylight.yangtools.yang.model.api.SchemaContext; import org.opendaylight.yangtools.yang.model.api.TypeDefinition; @@ -190,13 +191,8 @@ public final class DfSerializerUtil { if (mName != null) { it = ctx.findModules(mName).iterator(); } else { - URI modUri = null; - try { - modUri = new URI(mUri); - } catch (URISyntaxException e) { - throw new SvcLogicException(URI_ERR, e); - } - it = ctx.findModules(modUri).iterator(); + + it = ctx.findModules(XMLNamespace.of(mUri)).iterator(); } if (!it.hasNext()) { diff --git a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/MdsalSerializerHelper.java b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/MdsalSerializerHelper.java index 1fd0d2dee..08edacc8a 100644 --- a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/MdsalSerializerHelper.java +++ b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/MdsalSerializerHelper.java @@ -52,8 +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.onap.ccsdk.sli.core.sli.provider.YangUtils.findDataChildSchemaByQName; +import static org.onap.ccsdk.sli.core.sli.provider.YangUtils.findSchemaForChild; import static org.opendaylight.yangtools.yang.data.util.ParserStreamUtils.findSchemaNodeByNameAndNamespace; /** diff --git a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/PropertiesNodeXmlListener.java b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/PropertiesNodeXmlListener.java index f098195e4..09734b6b6 100644 --- a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/PropertiesNodeXmlListener.java +++ b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/PropertiesNodeXmlListener.java @@ -30,6 +30,7 @@ import org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.Namespace; import org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.PropertiesNode; import org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.PropertiesNodeListener; import org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.RootNode; +import org.opendaylight.yangtools.yang.common.XMLNamespace; import java.io.Writer; import java.net.URI; @@ -211,7 +212,7 @@ public class PropertiesNodeXmlListener implements PropertiesNodeListener { */ private void setValueWithNs(Element element, LeafNode node) { Namespace valNs = node.valueNs(); - URI modNs = (valNs == null) ? null : valNs.moduleNs(); + XMLNamespace modNs = (valNs == null) ? null : valNs.moduleNs(); String val = node.value(); if (modNs != null) { element.addNamespace(XML_PREFIX, modNs.toString()); diff --git a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/InnerNode.java b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/InnerNode.java index 1cf99b2d4..a7a2b3735 100644 --- a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/InnerNode.java +++ b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/InnerNode.java @@ -35,7 +35,7 @@ import static org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.MdsalPrope import static org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.MdsalPropertiesNodeUtils.resolveName; 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; -import static org.opendaylight.yangtools.yang.data.impl.schema.SchemaUtils.findCorrespondingAugment; +import static org.onap.ccsdk.sli.core.sli.provider.YangUtils.findCorrespondingAugment; /** * Abstraction of an entity that represents an inner node to properties data diff --git a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/MdsalPropertiesNodeSerializer.java b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/MdsalPropertiesNodeSerializer.java index 8fd7a12bc..063e030ac 100644 --- a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/MdsalPropertiesNodeSerializer.java +++ b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/MdsalPropertiesNodeSerializer.java @@ -40,7 +40,9 @@ import static org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.NodeType.S import java.util.HashMap; import java.util.Map; import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.provider.YangUtils; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; +import org.opendaylight.yangtools.yang.common.XMLNamespace; import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext; import org.opendaylight.yangtools.yang.model.api.Module; import org.opendaylight.yangtools.yang.model.api.SchemaNode; @@ -143,7 +145,7 @@ public class MdsalPropertiesNodeSerializer extends PropertiesNodeSerializer<Sche } private RootNode createRootNode(String lastNodeName, String rootUri) { - Module m = SchemaContextUtil.findParentModule(schemaCtx(), curSchema); + Module m = YangUtils.findParentModule(schemaCtx(), curSchema); Namespace ns = new Namespace(m.getName(), m.getNamespace(), getRevision(m.getRevision())); return new RootNode(lastNodeName, ns, schemaNode(), rootUri); diff --git a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/MdsalPropertiesNodeUtils.java b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/MdsalPropertiesNodeUtils.java index 331f01cb7..9b0a31d09 100644 --- a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/MdsalPropertiesNodeUtils.java +++ b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/MdsalPropertiesNodeUtils.java @@ -28,23 +28,20 @@ import java.util.Collection; import java.util.Deque; import java.util.Iterator; import java.util.Optional; + +import com.sun.xml.txw2.annotation.XmlNamespace; import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.provider.YangUtils; import org.opendaylight.restconf.common.context.InstanceIdentifierContext; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.Revision; -import org.opendaylight.yangtools.yang.data.impl.schema.SchemaUtils; +import org.opendaylight.yangtools.yang.common.XMLNamespace; import org.opendaylight.yangtools.yang.data.util.ParserStreamUtils; import org.opendaylight.yangtools.yang.data.util.codec.IdentityCodecUtil; -import org.opendaylight.yangtools.yang.model.api.AnyxmlSchemaNode; -import org.opendaylight.yangtools.yang.model.api.AugmentationSchemaNode; -import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode; -import org.opendaylight.yangtools.yang.model.api.DataSchemaNode; -import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext; -import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode; +import org.opendaylight.yangtools.yang.model.api.*; 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.util.SchemaInferenceStack; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -447,14 +444,15 @@ public final class MdsalPropertiesNodeUtils { return null; } - QName qname = QName.create(namespace.moduleNs(), + + QName qname = QName.create(XMLNamespace.of(namespace.moduleNs().toString()), Revision.of(namespace.revision()), name); // YANG RPC will not be instance of DataSchemaNode if (curSchema instanceof DataSchemaNode) { Deque<DataSchemaNode> schemaNodeDeque = ParserStreamUtils. findSchemaNodeByNameAndNamespace(((DataSchemaNode) - curSchema), name, namespace.moduleNs()); + curSchema), name, XMLNamespace.of(namespace.moduleNs().toString())); if (schemaNodeDeque.isEmpty()) { // could not find schema node return null; @@ -467,10 +465,12 @@ public final class MdsalPropertiesNodeUtils { } // node is child of Choice/case - return SchemaUtils.findSchemaForChild(((ChoiceSchemaNode) schemaNode), + + + return YangUtils.findSchemaForChild(((ChoiceSchemaNode) schemaNode), qname); } else { - return SchemaUtils.findDataChildSchemaByQName(curSchema, qname); + return YangUtils.findDataChildSchemaByQName(curSchema, qname); } } diff --git a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/Namespace.java b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/Namespace.java index 4f27ee1e7..9bb71b5ba 100644 --- a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/Namespace.java +++ b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/Namespace.java @@ -20,14 +20,15 @@ package org.onap.ccsdk.sli.plugins.yangserializers.pnserializer; -import java.net.URI; + +import org.opendaylight.yangtools.yang.common.XMLNamespace; /** * Representation of YANG namespace. */ public class Namespace { private String moduleName; - private URI moduleNs; + private XMLNamespace moduleNs; private String revision; /** @@ -38,7 +39,7 @@ public class Namespace { * @param moduleNs module namespace * @param revision revision */ - public Namespace(String modulename, URI moduleNs, String revision) { + public Namespace(String modulename, XMLNamespace moduleNs, String revision) { this.moduleName = modulename; this.moduleNs = moduleNs; this.revision = revision; @@ -67,7 +68,7 @@ public class Namespace { * * @return module namespace */ - public URI moduleNs() { + public XMLNamespace moduleNs() { return moduleNs; } @@ -76,7 +77,7 @@ public class Namespace { * * @param moduleNs module namespace */ - public void moduleNs(URI moduleNs) { + public void moduleNs(XMLNamespace moduleNs) { this.moduleNs = moduleNs; } diff --git a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/RootNode.java b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/RootNode.java index c7f7340fd..d7ca885da 100644 --- a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/RootNode.java +++ b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/RootNode.java @@ -35,7 +35,7 @@ import static org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.MdsalPrope import static org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.MdsalPropertiesNodeUtils.resolveName; 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; -import static org.opendaylight.yangtools.yang.data.impl.schema.SchemaUtils.findCorrespondingAugment; +import static org.onap.ccsdk.sli.core.sli.provider.YangUtils.findCorrespondingAugment; /** * Abstraction of node representing properties data tree. |