From: Fiete Ostkamp Date: Tue, 3 Mar 2026 12:12:27 +0000 (+0100) Subject: Reenable restconf-client X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F33%2F143433%2F1;p=ccsdk%2Fsli.git Reenable restconf-client Issue-ID: CCSDK-4115 Change-Id: I051eb281a73dc4b35ed3c00d9eae2be1b0d5014e Signed-off-by: Fiete Ostkamp --- diff --git a/plugins/features/ccsdk-restconf-client/pom.xml b/plugins/features/ccsdk-restconf-client/pom.xml index 9029d7b40..1bdabed3b 100644 --- a/plugins/features/ccsdk-restconf-client/pom.xml +++ b/plugins/features/ccsdk-restconf-client/pom.xml @@ -11,7 +11,7 @@ org.onap.ccsdk.sli.plugins ccsdk-restconf-client - 2.2.0-SNAPSHOT + 2.3.0-SNAPSHOT feature ccsdk-sli-plugins :: features :: ${project.artifactId} diff --git a/plugins/features/ccsdk-sli-plugins-all/pom.xml b/plugins/features/ccsdk-sli-plugins-all/pom.xml index 0b98ce9d0..c36ac3bdd 100644 --- a/plugins/features/ccsdk-sli-plugins-all/pom.xml +++ b/plugins/features/ccsdk-sli-plugins-all/pom.xml @@ -31,8 +31,6 @@ xml features - - ${project.groupId} ccsdk-sshapi-call-node diff --git a/plugins/features/installer/pom.xml b/plugins/features/installer/pom.xml index 92df2bdd8..bea6a2c3f 100755 --- a/plugins/features/installer/pom.xml +++ b/plugins/features/installer/pom.xml @@ -63,7 +63,6 @@ - org.onap.ccsdk.sli.plugins ccsdk-sshapi-call-node diff --git a/plugins/features/pom.xml b/plugins/features/pom.xml index 9bcb903df..0d04c72f5 100755 --- a/plugins/features/pom.xml +++ b/plugins/features/pom.xml @@ -20,7 +20,7 @@ ccsdk-gr-toolkit ccsdk-properties-node ccsdk-restapi-call-node - + ccsdk-restconf-client ccsdk-sshapi-call-node ccsdk-template-node ccsdk-sli-plugins-all diff --git a/plugins/pom.xml b/plugins/pom.xml index cf7d41221..09ecab08d 100755 --- a/plugins/pom.xml +++ b/plugins/pom.xml @@ -24,9 +24,7 @@ properties-node restapi-call-node sshapi-call-node - template-node grToolkit features diff --git a/plugins/restconf-client/installer/pom.xml b/plugins/restconf-client/installer/pom.xml index 00c1a965d..bb5587546 100755 --- a/plugins/restconf-client/installer/pom.xml +++ b/plugins/restconf-client/installer/pom.xml @@ -10,7 +10,7 @@ org.onap.ccsdk.sli.plugins restconf-client-installer - 2.2.0-SNAPSHOT + 2.3.0-SNAPSHOT pom ccsdk-sli-plugins :: ${project.artifactId} diff --git a/plugins/restconf-client/pom.xml b/plugins/restconf-client/pom.xml index bbf19257b..f31d400bc 100755 --- a/plugins/restconf-client/pom.xml +++ b/plugins/restconf-client/pom.xml @@ -10,7 +10,7 @@ org.onap.ccsdk.sli.plugins restconf-client - 2.2.0-SNAPSHOT + 2.3.0-SNAPSHOT pom ccsdk-sli-plugins :: ${project.artifactId} diff --git a/plugins/restconf-client/provider/pom.xml b/plugins/restconf-client/provider/pom.xml index 2d2f7c892..56a1c93f8 100755 --- a/plugins/restconf-client/provider/pom.xml +++ b/plugins/restconf-client/provider/pom.xml @@ -10,7 +10,7 @@ org.onap.ccsdk.sli.plugins restconf-client-provider - 2.2.0-SNAPSHOT + 2.3.0-SNAPSHOT bundle ccsdk-sli-plugins :: ${project.artifactId} @@ -93,15 +93,14 @@ ${project.version} - org.opendaylight.netconf - restconf-nb - 6.0.6 - - - javax.xml - jsr173 - - + org.opendaylight.yangtools + yang-model-spi + provided + + + org.opendaylight.yangtools + yang-data-util + provided org.opendaylight.yangtools @@ -121,6 +120,12 @@ + + javax.annotation + javax.annotation-api + 1.3.2 + test + junit junit @@ -172,4 +177,18 @@ httpclient + + + + org.apache.maven.plugins + maven-surefire-plugin + + + --add-opens java.base/java.lang=ALL-UNNAMED + ${surefireArgLine} + + + + + 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 index 000000000..ec868ffe9 --- /dev/null +++ b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/InstanceIdentifierContext.java @@ -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; + } +} 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 2e4a6c34c..aff5f136d 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 @@ -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); } /** diff --git a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiUtils.java b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiUtils.java index ee5dacdce..dea904470 100644 --- a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiUtils.java +++ b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiUtils.java @@ -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 + ""; 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. + * + *

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 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; + } } 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 ab554dd45..2577ec352 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 @@ -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())); } 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 063e030ac..ba1b217a7 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 @@ -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 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())); } diff --git a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/SchemaPathHolder.java b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/SchemaPathHolder.java index 4ef1bc664..c8712ccca 100644 --- a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/SchemaPathHolder.java +++ b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/SchemaPathHolder.java @@ -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. diff --git a/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DataFormatSerializerTest.java b/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DataFormatSerializerTest.java index 731b30429..10cc297e5 100644 --- a/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DataFormatSerializerTest.java +++ b/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DataFormatSerializerTest.java @@ -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."; diff --git a/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/IdentifierValidationTest.java b/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/IdentifierValidationTest.java index ca148033b..89d0e906a 100644 --- a/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/IdentifierValidationTest.java +++ b/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/IdentifierValidationTest.java @@ -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; diff --git a/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/PropertiesSerializerTest.java b/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/PropertiesSerializerTest.java index ff5871519..c4ae1fd58 100644 --- a/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/PropertiesSerializerTest.java +++ b/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/PropertiesSerializerTest.java @@ -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 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 +}