summaryrefslogtreecommitdiffstats
path: root/plugins/restconf-client/provider
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2022-03-01 11:10:58 -0500
committerDan Timoney <dtimoney@att.com>2022-03-22 18:04:32 +0000
commit7c0ec3e4540c1a10a03efcfbae06c4a7915977a6 (patch)
treeca6c6fd9616f24efb786ee8620ad499cb258a4d9 /plugins/restconf-client/provider
parentb64e61b3631a022f6f166e6fc15026537ff46c63 (diff)
Migrate SLI to OpenDaylight Phosphorus
Updated ccsdk/sli to use Phosphorus SR1 version of parent poms and updated Java Reflection code to handle changes in Phosphorus: - use Uint8/Uint16/Uint32/Uint64 classes in place of char/Short/Long/BigInteger, respectively - add code for toMap method to handle change in representation of yang list from java List to java Map - Add new YangUtils class to replace removed ODL yangtools SchemaUtils class - Update restconf-client due to changes in yangtools Issue-ID: CCSDK-3567 Signed-off-by: Dan Timoney <dtimoney@att.com> Change-Id: Iea581c7f39b1038ce95cc0ca6728fe56dd023f3e
Diffstat (limited to 'plugins/restconf-client/provider')
-rwxr-xr-xplugins/restconf-client/provider/pom.xml8
-rw-r--r--plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiCallNode.java3
-rw-r--r--plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DfSerializerUtil.java10
-rw-r--r--plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/MdsalSerializerHelper.java4
-rw-r--r--plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/PropertiesNodeXmlListener.java3
-rw-r--r--plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/InnerNode.java2
-rw-r--r--plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/MdsalPropertiesNodeSerializer.java4
-rw-r--r--plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/MdsalPropertiesNodeUtils.java26
-rw-r--r--plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/Namespace.java11
-rw-r--r--plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/RootNode.java2
10 files changed, 40 insertions, 33 deletions
diff --git a/plugins/restconf-client/provider/pom.xml b/plugins/restconf-client/provider/pom.xml
index e82690afb..0e40a4958 100755
--- a/plugins/restconf-client/provider/pom.xml
+++ b/plugins/restconf-client/provider/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>binding-parent</artifactId>
- <version>2.3.2</version>
+ <version>2.3.3-SNAPSHOT</version>
</parent>
<groupId>org.onap.ccsdk.sli.plugins</groupId>
@@ -60,7 +60,13 @@
</dependency>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-common</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
<artifactId>yang-data-impl</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
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.