Reenable restconf-client 33/143433/1
authorFiete Ostkamp <fiete.ostkamp@telekom.de>
Tue, 3 Mar 2026 12:12:27 +0000 (13:12 +0100)
committerFiete Ostkamp <fiete.ostkamp@telekom.de>
Tue, 3 Mar 2026 12:12:27 +0000 (13:12 +0100)
Issue-ID: CCSDK-4115
Change-Id: I051eb281a73dc4b35ed3c00d9eae2be1b0d5014e
Signed-off-by: Fiete Ostkamp <fiete.ostkamp@telekom.de>
18 files changed:
plugins/features/ccsdk-restconf-client/pom.xml
plugins/features/ccsdk-sli-plugins-all/pom.xml
plugins/features/installer/pom.xml
plugins/features/pom.xml
plugins/pom.xml
plugins/restconf-client/installer/pom.xml
plugins/restconf-client/pom.xml
plugins/restconf-client/provider/pom.xml
plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/InstanceIdentifierContext.java [new file with mode: 0644]
plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiCallNode.java
plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiUtils.java
plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DfSerializerUtil.java
plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/MdsalPropertiesNodeSerializer.java
plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/MdsalPropertiesNodeUtils.java
plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/SchemaPathHolder.java
plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DataFormatSerializerTest.java
plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/IdentifierValidationTest.java
plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/PropertiesSerializerTest.java

index 9029d7b..1bdabed 100644 (file)
@@ -11,7 +11,7 @@
 
     <groupId>org.onap.ccsdk.sli.plugins</groupId>
     <artifactId>ccsdk-restconf-client</artifactId>
-    <version>2.2.0-SNAPSHOT</version>
+    <version>2.3.0-SNAPSHOT</version>
     <packaging>feature</packaging>
 
     <name>ccsdk-sli-plugins :: features :: ${project.artifactId}</name>
index 0b98ce9..c36ac3b 100644 (file)
@@ -31,8 +31,6 @@
             <type>xml</type>
             <classifier>features</classifier>
         </dependency>
-        <!-- Commented out for now pending Scandium fix-->
-        <!--
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>ccsdk-restconf-client</artifactId>
@@ -40,7 +38,6 @@
             <type>xml</type>
             <classifier>features</classifier>
         </dependency>
-        -->
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>ccsdk-sshapi-call-node</artifactId>
index 92df2bd..bea6a2c 100755 (executable)
@@ -63,7 +63,6 @@
                 </exclusion>
             </exclusions>
         </dependency>
-        <!--
         <dependency>
             <groupId>org.onap.ccsdk.sli.plugins</groupId>
             <artifactId>ccsdk-restconf-client</artifactId>
@@ -77,7 +76,6 @@
                 </exclusion>
             </exclusions>
         </dependency>
-        -->
         <dependency>
             <groupId>org.onap.ccsdk.sli.plugins</groupId>
             <artifactId>ccsdk-sshapi-call-node</artifactId>
index 9bcb903..0d04c72 100755 (executable)
@@ -20,7 +20,7 @@
         <module>ccsdk-gr-toolkit</module>
         <module>ccsdk-properties-node</module>
         <module>ccsdk-restapi-call-node</module>
-       <!-- <module>ccsdk-restconf-client</module> -->
+        <module>ccsdk-restconf-client</module>
         <module>ccsdk-sshapi-call-node</module>
         <module>ccsdk-template-node</module>
         <module>ccsdk-sli-plugins-all</module>
index cf7d412..09ecab0 100755 (executable)
@@ -24,9 +24,7 @@
         <module>properties-node</module>
         <module>restapi-call-node</module>
         <module>sshapi-call-node</module>
-        <!--
         <module>restconf-client</module>
-        -->
         <module>template-node</module>
         <module>grToolkit</module>
         <module>features</module>
index 00c1a96..bb55875 100755 (executable)
@@ -10,7 +10,7 @@
 
     <groupId>org.onap.ccsdk.sli.plugins</groupId>
     <artifactId>restconf-client-installer</artifactId>
-    <version>2.2.0-SNAPSHOT</version>
+    <version>2.3.0-SNAPSHOT</version>
     <packaging>pom</packaging>
 
     <name>ccsdk-sli-plugins :: ${project.artifactId}</name>
index bbf1925..f31d400 100755 (executable)
@@ -10,7 +10,7 @@
 
     <groupId>org.onap.ccsdk.sli.plugins</groupId>
     <artifactId>restconf-client</artifactId>
-    <version>2.2.0-SNAPSHOT</version>
+    <version>2.3.0-SNAPSHOT</version>
     <packaging>pom</packaging>
 
     <name>ccsdk-sli-plugins :: ${project.artifactId}</name>
index 2d2f7c8..56a1c93 100755 (executable)
@@ -10,7 +10,7 @@
 
     <groupId>org.onap.ccsdk.sli.plugins</groupId>
     <artifactId>restconf-client-provider</artifactId>
-    <version>2.2.0-SNAPSHOT</version>
+    <version>2.3.0-SNAPSHOT</version>
     <packaging>bundle</packaging>
 
     <name>ccsdk-sli-plugins :: ${project.artifactId}</name>
             <version>${project.version}</version>
         </dependency>
         <dependency>
-            <groupId>org.opendaylight.netconf</groupId>
-            <artifactId>restconf-nb</artifactId>
-            <version>6.0.6</version>
-            <exclusions>
-                <exclusion>
-                    <groupId>javax.xml</groupId>
-                    <artifactId>jsr173</artifactId>
-                </exclusion>
-            </exclusions>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>yang-model-spi</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>yang-data-util</artifactId>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.opendaylight.yangtools</groupId>
 
 
         <!-- For test -->
+        <dependency>
+            <groupId>javax.annotation</groupId>
+            <artifactId>javax.annotation-api</artifactId>
+            <version>1.3.2</version>
+            <scope>test</scope>
+        </dependency>
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <artifactId>httpclient</artifactId>
         </dependency>
     </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <argLine>
+                        --add-opens java.base/java.lang=ALL-UNNAMED
+                        ${surefireArgLine}
+                    </argLine>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 </project>
diff --git a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/InstanceIdentifierContext.java b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/InstanceIdentifierContext.java
new file mode 100644 (file)
index 0000000..ec868ff
--- /dev/null
@@ -0,0 +1,65 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - CCSDK
+ * ================================================================================
+ * Copyright (C) 2025 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.ccsdk.sli.plugins.restconfapicall;
+
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
+import org.opendaylight.yangtools.yang.model.api.SchemaNode;
+
+/**
+ * Local replacement for ODL's InstanceIdentifierContext which was removed
+ * in OpenDaylight Scandium. Holds the schema node and schema context
+ * resolved from a RESTCONF URI.
+ */
+public class InstanceIdentifierContext {
+
+    private final SchemaNode schemaNode;
+    private final EffectiveModelContext schemaContext;
+
+    /**
+     * Creates an instance identifier context.
+     *
+     * @param schemaNode    the resolved schema node
+     * @param schemaContext the schema context
+     */
+    public InstanceIdentifierContext(SchemaNode schemaNode,
+                                    EffectiveModelContext schemaContext) {
+        this.schemaNode = schemaNode;
+        this.schemaContext = schemaContext;
+    }
+
+    /**
+     * Returns the schema node resolved from the URI.
+     *
+     * @return schema node
+     */
+    public SchemaNode getSchemaNode() {
+        return schemaNode;
+    }
+
+    /**
+     * Returns the schema context.
+     *
+     * @return schema context (EffectiveModelContext)
+     */
+    public EffectiveModelContext getSchemaContext() {
+        return schemaContext;
+    }
+}
index 2e4a6c3..aff5f13 100644 (file)
@@ -43,6 +43,7 @@ import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.getSch
 import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.getUpdatedXmlReq;
 import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.getYangParameters;
 import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.parseUrl;
+import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.toInstanceIdentifier;
 import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DfListenerFactory.instance;
 import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DfSerializerUtil.FORMAT_ERR;
 import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DfSerializerUtil.UTF_HEADER;
@@ -82,8 +83,6 @@ 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.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;
@@ -316,7 +315,7 @@ public class RestconfApiCallNode implements SvcLogicJavaPlugin {
                                                      String uri)
             throws SvcLogicException {
         EffectiveModelContext context = getSchemaContext(params);
-        return ParserIdentifier.toInstanceIdentifier(uri, context, null);
+        return toInstanceIdentifier(uri, context, null);
     }
 
     /**
index ee5dacd..dea9044 100644 (file)
@@ -31,14 +31,25 @@ import java.net.URI;
 import java.net.URISyntaxException;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
 import org.onap.ccsdk.sli.plugins.restapicall.HttpMethod;
 import org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.YangParameters;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.CaseSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
-import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.OperationDefinition;
+import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.SchemaNode;
+import org.opendaylight.yangtools.yang.model.spi.source.FileYangTextSource;
 import org.opendaylight.yangtools.yang.parser.api.YangParser;
 import org.opendaylight.yangtools.yang.parser.api.YangParserException;
 import org.opendaylight.yangtools.yang.parser.api.YangParserFactory;
@@ -193,7 +204,7 @@ public final class RestconfApiUtils {
         YangParser parser = parserFactory.createParser();
         for (File file : yangFiles) {
             try {
-                parser.addSource(YangTextSchemaSource.forPath(file.toPath()));
+                parser.addSource(new FileYangTextSource(file.toPath()));
             } catch (IOException | YangSyntaxErrorException e) {
                 throw new SvcLogicException(YANG_FILE_ERR + e.getMessage(), e);
             }
@@ -253,4 +264,160 @@ public final class RestconfApiUtils {
         req = req + "</" + nodeName + ">";
         return req.replaceAll(">\\s+<", "><");
     }
+
+    /**
+     * Resolves a RESTCONF URI path against the given schema context and
+     * returns an InstanceIdentifierContext wrapping the resolved SchemaNode
+     * and schema context.
+     *
+     * <p>This is a local replacement for the ODL ParserIdentifier.toInstanceIdentifier()
+     * which was removed in OpenDaylight Scandium.
+     *
+     * @param uri     RESTCONF-style URI path (e.g., "module:container/child=key")
+     * @param context the effective model context
+     * @param unused  unused parameter (kept for API compatibility)
+     * @return instance identifier context
+     * @throws IllegalArgumentException if the URI cannot be resolved
+     */
+    public static InstanceIdentifierContext toInstanceIdentifier(
+            String uri, EffectiveModelContext context, Object unused) {
+        if (uri == null || uri.isEmpty()) {
+            return new InstanceIdentifierContext(context, context);
+        }
+
+        String path = uri;
+        if (path.startsWith(SLASH)) {
+            path = path.substring(1);
+        }
+        // Remove trailing slash
+        if (path.endsWith(SLASH)) {
+            path = path.substring(0, path.length() - 1);
+        }
+
+        String[] segments = path.split(SLASH);
+        SchemaNode currentNode = context;
+
+        for (String segment : segments) {
+            // Remove list keys (everything after =)
+            String nodeName = segment;
+            if (nodeName.contains("=")) {
+                nodeName = nodeName.substring(0, nodeName.indexOf("="));
+            }
+
+            String moduleName = null;
+            String localName = nodeName;
+
+            // Split module:name
+            if (nodeName.contains(COLON)) {
+                String[] parts = nodeName.split(COLON, 2);
+                moduleName = parts[0];
+                localName = parts[1];
+            }
+
+            SchemaNode childNode = null;
+
+            if (moduleName != null) {
+                Iterator<? extends Module> modules = context.findModules(moduleName).iterator();
+                if (modules.hasNext()) {
+                    Module module = modules.next();
+                    QName qname = QName.create(module.getQNameModule(), localName);
+                    childNode = findDataChild(currentNode, qname);
+                }
+            } else {
+                // Use the namespace of the current node
+                if (currentNode != null && currentNode.getQName() != null) {
+                    QName qname = QName.create(currentNode.getQName().getModule(), localName);
+                    childNode = findDataChild(currentNode, qname);
+                }
+            }
+
+            if (childNode == null) {
+                throw new IllegalArgumentException(
+                        "Could not find schema node for: " + segment + " in URI: " + uri);
+            }
+
+            currentNode = childNode;
+        }
+
+        return new InstanceIdentifierContext(currentNode, context);
+    }
+
+    /**
+     * Finds a data child schema node by QName, traversing into choice/case
+     * nodes transparently (as RESTCONF URIs don't include choice/case names).
+     *
+     * @param parent parent schema node
+     * @param qname  QName of the target data node
+     * @return the found schema node, or null if not found
+     */
+    private static SchemaNode findDataChild(SchemaNode parent, QName qname) {
+        if (parent instanceof DataNodeContainer) {
+            DataNodeContainer container = (DataNodeContainer) parent;
+            // Try direct lookup first
+            DataSchemaNode child = container.dataChildByName(qname);
+            if (child != null) {
+                return child;
+            }
+            // Search inside choice/case nodes (transparent in data tree)
+            SchemaNode found = findInChoices(container, qname);
+            if (found != null) {
+                return found;
+            }
+        }
+        // Search RPCs/operations (for RESTCONF operations URIs)
+        if (parent instanceof SchemaContext) {
+            for (RpcDefinition rpc : ((SchemaContext) parent).getOperations()) {
+                if (qname.equals(rpc.getQName())) {
+                    return rpc;
+                }
+            }
+        }
+        if (parent instanceof OperationDefinition) {
+            switch (qname.getLocalName()) {
+                case "input":
+                    return ((OperationDefinition) parent).getInput();
+                case "output":
+                    return ((OperationDefinition) parent).getOutput();
+                default:
+                    break;
+            }
+        }
+        if (parent instanceof ChoiceSchemaNode) {
+            return findInChoice((ChoiceSchemaNode) parent, qname);
+        }
+        return null;
+    }
+
+    /**
+     * Searches for a data node inside choice/case nodes of a container.
+     */
+    private static SchemaNode findInChoices(DataNodeContainer container, QName qname) {
+        for (DataSchemaNode child : container.getChildNodes()) {
+            if (child instanceof ChoiceSchemaNode) {
+                SchemaNode found = findInChoice((ChoiceSchemaNode) child, qname);
+                if (found != null) {
+                    return found;
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Searches for a data node inside a choice's cases.
+     */
+    private static SchemaNode findInChoice(ChoiceSchemaNode choice, QName qname) {
+        for (CaseSchemaNode caze : choice.getCases()) {
+            DataSchemaNode found = caze.dataChildByName(qname);
+            if (found != null) {
+                return found;
+            }
+            // Recursively check nested choices within this case
+            SchemaNode nested = findInChoices(caze, qname);
+            if (nested != null) {
+                return nested;
+            }
+        }
+        return null;
+    }
 }
index ab554dd..2577ec3 100644 (file)
@@ -200,7 +200,7 @@ public final class DfSerializerUtil {
         }
         mod = it.next();
 
-        return new Namespace(mod.getName(), mod.getQNameModule().getNamespace(),
+        return new Namespace(mod.getName(), mod.getQNameModule().namespace(),
                              getRevision(mod.getRevision()));
     }
 
index 063e030..ba1b217 100644 (file)
@@ -41,12 +41,10 @@ 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;
-import org.opendaylight.yangtools.yang.model.util.SchemaContextUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -125,7 +123,7 @@ public class MdsalPropertiesNodeSerializer extends PropertiesNodeSerializer<Sche
                 String fixedUri = fixedUrl.getUri().replaceAll(
                         SLASH, DOT_REGEX);
                 fixedParams.put(fixedUri, entry.getValue());
-            } catch (IllegalArgumentException | RestconfDocumentedException
+            } catch (IllegalArgumentException
                     | NullPointerException e) {
                 log.info("Exception while processing properties by replacing " +
                     "underscore with colon. Process the properties as it is." + e);
index efbbc04..916ea57 100644 (file)
@@ -23,17 +23,15 @@ package org.onap.ccsdk.sli.plugins.yangserializers.pnserializer;
 import static com.google.common.base.Preconditions.checkArgument;
 import static java.lang.String.format;
 import static java.util.regex.Pattern.quote;
-import static org.opendaylight.restconf.nb.rfc8040.utils.parser.ParserIdentifier.toInstanceIdentifier;
+import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.toInstanceIdentifier;
 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.onap.ccsdk.sli.plugins.restconfapicall.InstanceIdentifierContext;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.Revision;
 import org.opendaylight.yangtools.yang.common.XMLNamespace;
@@ -41,7 +39,6 @@ import org.opendaylight.yangtools.yang.data.util.ParserStreamUtils;
 import org.opendaylight.yangtools.yang.data.util.codec.IdentityCodecUtil;
 import org.opendaylight.yangtools.yang.model.api.*;
 import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.util.SchemaInferenceStack;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -265,7 +262,7 @@ public final class MdsalPropertiesNodeUtils {
             InstanceIdentifierContext id = toInstanceIdentifier(
                     uri1, context, Optional.ofNullable(null));
             return new SchemaPathHolder(id, uri1);
-        } catch (IllegalArgumentException | RestconfDocumentedException
+        } catch (IllegalArgumentException
                 | NullPointerException e) {
             log.info("Exception while converting uri to instance identifier" +
                 " context. Process each node in uri to get instance identifier" +
@@ -342,7 +339,7 @@ public final class MdsalPropertiesNodeUtils {
             try {
                 id = toInstanceIdentifier(prefix + val, context, null);
                 return new SchemaPathHolder(id, val);
-            } catch (IllegalArgumentException | RestconfDocumentedException |
+            } catch (IllegalArgumentException |
                     NullPointerException e) {
                 log.info(format(INFO_MSG, val, e));
             }
@@ -354,7 +351,7 @@ public final class MdsalPropertiesNodeUtils {
         try {
             id = toInstanceIdentifier(prefix + val, context, null);
             return new SchemaPathHolder(id, val);
-        } catch (IllegalArgumentException | RestconfDocumentedException |
+        } catch (IllegalArgumentException |
                 NullPointerException e1) {
             throw new IllegalArgumentException(EXC_MSG, e1);
         }
@@ -423,7 +420,7 @@ public final class MdsalPropertiesNodeUtils {
         Iterator<? extends Module> it = ctx.findModules(modName).iterator();
         if (it.hasNext()) {
             Module m = it.next();
-            return new Namespace(modName, m.getQNameModule().getNamespace(),
+            return new Namespace(modName, m.getQNameModule().namespace(),
                                  getRevision(m.getRevision()));
         }
         return null;
@@ -559,7 +556,7 @@ public final class MdsalPropertiesNodeUtils {
             throw new SvcLogicException("Could not find module node");
         }
         Module m = module.get();
-        return new Namespace(m.getName(), m.getQNameModule().getNamespace(),
+        return new Namespace(m.getName(), m.getQNameModule().namespace(),
                              getRevision(m.getRevision()));
     }
 
index 4ef1bc6..c8712cc 100644 (file)
@@ -20,7 +20,7 @@
 
 package org.onap.ccsdk.sli.plugins.yangserializers.pnserializer;
 
-import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
+import org.onap.ccsdk.sli.plugins.restconfapicall.InstanceIdentifierContext;
 
 /**
  * Representation of a holder for a proper path and its corresponding schema.
index 731b304..10cc297 100644 (file)
@@ -32,7 +32,7 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicException;
 import org.onap.ccsdk.sli.plugins.restapicall.HttpResponse;
 import org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode;
 import org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiCallNode;
-import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
+import org.onap.ccsdk.sli.plugins.restconfapicall.InstanceIdentifierContext;
 import org.opendaylight.yangtools.yang.parser.api.YangParserFactory;
 import org.opendaylight.yangtools.yang.parser.impl.DefaultYangParserFactory;
 
@@ -161,8 +161,8 @@ public class DataFormatSerializerTest {
      *
      * @throws SvcLogicException when test case fails
      */
-    /* 
-     * Fails for potassium - commenting out for now 
+    /*
+     * Fails for potassium - commenting out for now
     @Test
     public void encodeForAnyXml() throws SvcLogicException {
         String pre = "execution-service_process.";
index ca14803..89d0e90 100644 (file)
@@ -32,7 +32,7 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicException;
 import org.onap.ccsdk.sli.plugins.restapicall.HttpResponse;
 import org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode;
 import org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiCallNode;
-import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
+import org.onap.ccsdk.sli.plugins.restconfapicall.InstanceIdentifierContext;
 import org.opendaylight.yangtools.yang.parser.api.YangParserFactory;
 import org.opendaylight.yangtools.yang.parser.impl.DefaultYangParserFactory;
 
index ff58715..c4ae1fd 100644 (file)
@@ -33,9 +33,10 @@ import java.util.Map;
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
-import org.opendaylight.restconf.nb.rfc8040.utils.parser.ParserIdentifier;
+import org.onap.ccsdk.sli.plugins.restconfapicall.InstanceIdentifierContext;
 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
+
+import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.toInstanceIdentifier;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 
 public final class PropertiesSerializerTest {
@@ -83,8 +84,7 @@ public final class PropertiesSerializerTest {
         params.put("test-yang_cont1.cont2.ll3[1]", "abc");
         params.put("test-yang_cont1.cont2.ll4[0]", "abc");
         params.put("test-yang_cont1.cont2.ll4[1]", "abc");
-        InstanceIdentifierContext iCtx = ParserIdentifier
-                .toInstanceIdentifier(uri, context, null);
+        InstanceIdentifierContext iCtx = toInstanceIdentifier(uri, context, null);
 
         PropertiesNodeSerializer ser = new MdsalPropertiesNodeSerializer(
                 iCtx.getSchemaNode(), context, uri);
@@ -293,8 +293,7 @@ public final class PropertiesSerializerTest {
         params.put("test-yang_cont1.cont2.ll5[0]", "abc");
         params.put("test-yang_cont1.cont2.ll5[1]", "abc");
 
-        InstanceIdentifierContext iCtx = ParserIdentifier
-                .toInstanceIdentifier(uri, context, null);
+        InstanceIdentifierContext iCtx = toInstanceIdentifier(uri, context, null);
         PropertiesNodeSerializer ser = new MdsalPropertiesNodeSerializer(
                 iCtx.getSchemaNode(), context, uri);
         PropertiesNode node = ser.encode(params);
@@ -401,8 +400,7 @@ public final class PropertiesSerializerTest {
         params.put("test-yang_cont8.ll7[0]", "abc");
         params.put("test-yang_cont8.ll7[1]", "abc");
 
-        InstanceIdentifierContext iCtx = ParserIdentifier
-                .toInstanceIdentifier(uri, context, null);
+        InstanceIdentifierContext iCtx = toInstanceIdentifier(uri, context, null);
         PropertiesNodeSerializer ser = new MdsalPropertiesNodeSerializer(
                 iCtx.getSchemaNode(), context, uri);
         PropertiesNode node = ser.encode(params);
@@ -460,8 +458,7 @@ public final class PropertiesSerializerTest {
         params.put("test-yang_cont9.ll8[0]", "abc");
         params.put("test-yang_cont9.cont11.leaf25", "abc");
 
-        InstanceIdentifierContext iCtx = ParserIdentifier
-                .toInstanceIdentifier(uri, context, null);
+        InstanceIdentifierContext iCtx = toInstanceIdentifier(uri, context, null);
         PropertiesNodeSerializer ser = new MdsalPropertiesNodeSerializer(
                 iCtx.getSchemaNode(), context, uri);
         PropertiesNode node = ser.encode(params);
@@ -498,8 +495,7 @@ public final class PropertiesSerializerTest {
         Map<String, String> params = new HashMap<>();
         params.put("test-yang_cont8.cont6.test-augment_leaf21", "abc");
 
-        InstanceIdentifierContext iCtx = ParserIdentifier
-                .toInstanceIdentifier(uri, context, null);
+        InstanceIdentifierContext iCtx = toInstanceIdentifier(uri, context, null);
         PropertiesNodeSerializer ser = new MdsalPropertiesNodeSerializer(
                 iCtx.getSchemaNode(), context, uri);
         PropertiesNode node = ser.encode(params);
@@ -540,8 +536,7 @@ public final class PropertiesSerializerTest {
         params.put("test-yang_cont13.leaf28", "abc");
         params.put("test-yang_cont13.ll9[0]", "abc");
 
-        InstanceIdentifierContext iCtx = ParserIdentifier
-                .toInstanceIdentifier(uri, context, null);
+        InstanceIdentifierContext iCtx = toInstanceIdentifier(uri, context, null);
         PropertiesNodeSerializer ser = new MdsalPropertiesNodeSerializer(
                 iCtx.getSchemaNode(), context, uri);
         PropertiesNode node = ser.encode(params);
@@ -589,8 +584,7 @@ public final class PropertiesSerializerTest {
         params.put("test-yang_cont9.cont11.cont13.list9[0].leaf27", "abc");
         params.put("test-yang_cont9.cont11.cont13.leaf28", "abc");
         params.put("test-yang_cont9.cont11.cont13.ll9[0]", "abc");
-        InstanceIdentifierContext iCtx = ParserIdentifier
-                .toInstanceIdentifier(uri, context, null);
+        InstanceIdentifierContext iCtx = toInstanceIdentifier(uri, context, null);
         PropertiesNodeSerializer ser = new MdsalPropertiesNodeSerializer(
                 iCtx.getSchemaNode(), context, uri);
         PropertiesNode node = ser.encode(params);
@@ -643,8 +637,7 @@ public final class PropertiesSerializerTest {
         params.put("test-augment_cont13.list9[0].leaf27", "abc");
         params.put("test-augment_cont13.leaf28", "abc");
         params.put("test-augment_cont13.ll9[0]", "abc");
-        InstanceIdentifierContext iCtx = ParserIdentifier
-                .toInstanceIdentifier(uri, context, null);
+        InstanceIdentifierContext iCtx = toInstanceIdentifier(uri, context, null);
         PropertiesNodeSerializer ser = new MdsalPropertiesNodeSerializer(
                 iCtx.getSchemaNode(), context, uri);
         PropertiesNode node = ser.encode(params);
@@ -695,8 +688,7 @@ public final class PropertiesSerializerTest {
         params.put("test-yang_cont1.cont2.cont4.test-augment_cont13.leaf28", "abc");
         params.put("test-yang_cont1.cont2.cont4.test-augment_cont13.ll9[0]", "abc");
 
-        InstanceIdentifierContext iCtx = ParserIdentifier
-                .toInstanceIdentifier(uri, context, null);
+        InstanceIdentifierContext iCtx = toInstanceIdentifier(uri, context, null);
         PropertiesNodeSerializer ser = new MdsalPropertiesNodeSerializer(
                 iCtx.getSchemaNode(), context, uri);
         PropertiesNode node = ser.encode(params);
@@ -763,8 +755,7 @@ public final class PropertiesSerializerTest {
         params.put("test-yang_create-sfc.input.cont13.ll9[0]", "abc");
         params.put("test-yang_create-sfc.input.test-augment_leaf36", "abc");
 
-        InstanceIdentifierContext iCtx = ParserIdentifier
-                .toInstanceIdentifier(uri, context, null);
+        InstanceIdentifierContext iCtx = toInstanceIdentifier(uri, context, null);
         PropertiesNodeSerializer ser = new MdsalPropertiesNodeSerializer(
                 iCtx.getSchemaNode(), context, uri);
         PropertiesNode node = ser.encode(params);
@@ -877,8 +868,7 @@ public final class PropertiesSerializerTest {
         params.put("test-yang_create-sfc.output.cont13.ll9[0]", "abc");
         params.put("test-yang_create-sfc.output.test-augment_leaf37", "abc");
 
-        InstanceIdentifierContext iCtx = ParserIdentifier
-                .toInstanceIdentifier(uri, context, null);
+        InstanceIdentifierContext iCtx = toInstanceIdentifier(uri, context, null);
         PropertiesNodeSerializer ser = new MdsalPropertiesNodeSerializer(
                 iCtx.getSchemaNode(), context, uri);
         PropertiesNode node = ser.encode(params);
@@ -985,8 +975,7 @@ public final class PropertiesSerializerTest {
         params.put("test-yang_cont18.cont18.list12[1].list12[0].leaf36", "xyz");
         params.put("test-yang_cont18.cont18.list12[1].list12[1].leaf36", "hey!");
 
-        InstanceIdentifierContext iCtx = ParserIdentifier
-                .toInstanceIdentifier(uri, context, null);
+        InstanceIdentifierContext iCtx = toInstanceIdentifier(uri, context, null);
         PropertiesNodeSerializer ser = new MdsalPropertiesNodeSerializer(
                 iCtx.getSchemaNode(), context, uri);
         PropertiesNode node = ser.encode(params);
@@ -1056,8 +1045,7 @@ public final class PropertiesSerializerTest {
         params.put("leaf41", "hi");
         params.put("test-yang_cont18.leaf41", "abc");
 
-        InstanceIdentifierContext iCtx = ParserIdentifier
-                .toInstanceIdentifier(uri, context, null);
+        InstanceIdentifierContext iCtx = toInstanceIdentifier(uri, context, null);
         PropertiesNodeSerializer ser = new MdsalPropertiesNodeSerializer(
                 iCtx.getSchemaNode(), context, uri);
         PropertiesNode node = ser.encode(params);
@@ -1078,8 +1066,7 @@ public final class PropertiesSerializerTest {
         params.put("identity-test_test.con1.interfaces.int-list[0].available.ll[0]", "identity-types:Loopback");
         params.put("identity-test_test.con1.interfaces.int-list[0].available.leaf1", "identity-types-second:Ethernet");
         params.put("identity-test_test.con1.interfaces.int-list[0].available.leaf2", "identity-types-second:iden2");
-        InstanceIdentifierContext iCtx = ParserIdentifier
-                .toInstanceIdentifier(uri, context, null);
+        InstanceIdentifierContext iCtx = toInstanceIdentifier(uri, context, null);
 
         PropertiesNodeSerializer ser = new MdsalPropertiesNodeSerializer(
                 iCtx.getSchemaNode(), context, uri);
@@ -1139,4 +1126,4 @@ public final class PropertiesSerializerTest {
         }
         return YangParserTestUtils.parseYangFiles(yangFiles);
     }
-}
\ No newline at end of file
+}