summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cps-ncmp-rest-stub/cps-ncmp-rest-stub-service/src/test/groovy/org/onap/cps/ncmp/rest/stub/providers/ResourceProviderSpec.groovy3
-rw-r--r--cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/NcmpDatastoreRequestHandler.java6
-rw-r--r--cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NcmpEventResponseCode.java1
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/async/RecordFilterStrategiesSpec.groovy41
-rw-r--r--cps-service/src/main/java/org/onap/cps/utils/DataMapUtils.java9
-rw-r--r--cps-service/src/main/java/org/onap/cps/utils/PrefixResolver.java16
-rw-r--r--cps-service/src/test/groovy/org/onap/cps/utils/DataMapUtilsSpec.groovy8
-rw-r--r--cps-service/src/test/groovy/org/onap/cps/utils/PrefixResolverSpec.groovy5
-rw-r--r--csit/data/dataOperationRequest.json12
-rwxr-xr-xcsit/plans/cps/setup.sh2
-rw-r--r--csit/plans/cps/test.properties3
-rw-r--r--csit/plans/cps/testplan.txt3
-rwxr-xr-xcsit/prepare-csit.sh4
-rw-r--r--csit/tests/cps-data-operations/cps-data-operations.robot77
-rw-r--r--dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-app/pom.xml106
-rw-r--r--dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-app/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/DmiDemoApplication.java32
-rw-r--r--dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/pom.xml51
-rw-r--r--dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiRestStubController.java180
-rw-r--r--dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/model/data/operational/CmHandle.java33
-rw-r--r--dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/model/data/operational/DataOperationRequest.java37
-rw-r--r--dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/model/data/operational/ResourceDataOperationRequests.java27
-rw-r--r--dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/utils/ResourceFileReaderUtil.java51
-rw-r--r--dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/application.yml42
-rw-r--r--dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/data/operational/ietf-network-topology-sample-rfc8345.json76
-rw-r--r--dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/moduleResourcesResponse.json (renamed from dmi-plugin-stub/files/moduleResourcesResponse.json)0
-rw-r--r--dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/moduleResponse.json (renamed from dmi-plugin-stub/files/moduleResponse.json)0
-rw-r--r--dmi-plugin-demo-and-csit-stub/pom.xml42
-rw-r--r--dmi-plugin-stub/mappings/dataOperationRequest.json9
-rw-r--r--dmi-plugin-stub/mappings/module.json13
-rw-r--r--dmi-plugin-stub/mappings/moduleResources.json13
-rwxr-xr-xdmi-plugin-stub/start.sh2
-rw-r--r--docker-compose/docker-compose.yml16
-rw-r--r--pom.xml1
33 files changed, 851 insertions, 70 deletions
diff --git a/cps-ncmp-rest-stub/cps-ncmp-rest-stub-service/src/test/groovy/org/onap/cps/ncmp/rest/stub/providers/ResourceProviderSpec.groovy b/cps-ncmp-rest-stub/cps-ncmp-rest-stub-service/src/test/groovy/org/onap/cps/ncmp/rest/stub/providers/ResourceProviderSpec.groovy
index 7bfe5c322..948d8a149 100644
--- a/cps-ncmp-rest-stub/cps-ncmp-rest-stub-service/src/test/groovy/org/onap/cps/ncmp/rest/stub/providers/ResourceProviderSpec.groovy
+++ b/cps-ncmp-rest-stub/cps-ncmp-rest-stub-service/src/test/groovy/org/onap/cps/ncmp/rest/stub/providers/ResourceProviderSpec.groovy
@@ -21,7 +21,6 @@
package org.onap.cps.ncmp.rest.stub.providers
import java.nio.file.Files
-import java.nio.file.Path
import org.springframework.util.FileSystemUtils
import spock.lang.Shared
import spock.lang.Specification
@@ -46,7 +45,7 @@ class ResourceProviderSpec extends Specification {
def 'Resource Provider with existing file on #scenario'() {
- given: 'a resource provider with base stub folder defined on #scenario'
+ given: 'a resource provider with base stub folder defined on #scenario'
def resourceProvider = new ResourceProviderImpl(dir)
when: 'attempting to access that file #filename'
def optional= resourceProvider.getResourceInputStream(filename)
diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/NcmpDatastoreRequestHandler.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/NcmpDatastoreRequestHandler.java
index 101be45d3..d7aeab6b0 100644
--- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/NcmpDatastoreRequestHandler.java
+++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/NcmpDatastoreRequestHandler.java
@@ -167,12 +167,10 @@ public class NcmpDatastoreRequestHandler implements TaskManagementDefaultHandler
dataOperationRequest.getDataOperationDefinitions().forEach(dataOperationDetail -> {
if (OperationType.fromOperationName(dataOperationDetail.getOperation()) != READ) {
throw new OperationNotSupportedException(
- dataOperationDetail.getOperation() + " operation not yet supported for target ids :"
- + dataOperationDetail.getCmHandleIds());
+ dataOperationDetail.getOperation() + " operation not yet supported");
} else if (DatastoreType.fromDatastoreName(dataOperationDetail.getDatastore()) == OPERATIONAL) {
throw new InvalidDatastoreException(dataOperationDetail.getDatastore()
- + " datastore is not supported for target ids : "
- + dataOperationDetail.getCmHandleIds());
+ + " datastore is not supported");
}
});
}
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NcmpEventResponseCode.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NcmpEventResponseCode.java
index 42d813505..d250c36a8 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NcmpEventResponseCode.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NcmpEventResponseCode.java
@@ -25,6 +25,7 @@ import lombok.Getter;
@Getter
public enum NcmpEventResponseCode {
+ SUCCESS("0", "Successfully applied changes"),
CM_HANDLES_NOT_FOUND("100", "cm handle id(s) not found"),
CM_HANDLES_NOT_READY("101", "cm handle(s) not ready"),
DMI_SERVICE_NOT_RESPONDING("102", "dmi plugin service is not responding"),
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/async/RecordFilterStrategiesSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/async/RecordFilterStrategiesSpec.groovy
new file mode 100644
index 000000000..4189a8b38
--- /dev/null
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/async/RecordFilterStrategiesSpec.groovy
@@ -0,0 +1,41 @@
+package org.onap.cps.ncmp.api.impl.async
+
+import spock.lang.Specification
+import org.apache.kafka.common.header.Header
+import org.apache.kafka.common.header.Headers
+
+import java.nio.charset.Charset
+
+class RecordFilterStrategiesSpec extends Specification {
+
+ def objectUnderTest = new RecordFilterStrategies()
+
+ def headers = Mock(Headers)
+ def header = Mock(Header)
+
+ def 'Determining cloud event using ce_type header for a #scenario.'() {
+ given: 'headers contain a header for key: #key'
+ headers.lastHeader(key) >> header
+ expect: 'the check for cloud events returns #expectedResult'
+ assert objectUnderTest.isCloudEvent(headers) == expectedResult
+ where: 'the following headers (keys) are defined'
+ scenario | key || expectedResult
+ 'cloud event' | 'ce_type' || true
+ 'non-cloud event' | 'other' || false
+ }
+
+ def 'Excluding cloud event of given type only with #scenario.'() {
+ given: 'headers contain a header for key: #key and value: #value'
+ header.value() >> value.getBytes(Charset.defaultCharset())
+ headers.lastHeader(key) >> header
+ expect: 'the event would (not) be excluded: #expectedToBeExcluded'
+ assert objectUnderTest.isNotCloudEventOfType(headers,'requiredType') == expectedToBeExcluded
+ where: 'the following headers are defined'
+ scenario | key | value || expectedToBeExcluded
+ 'required type' | 'ce_type' | 'requiredType' || false
+ 'contains requiredType' | 'ce_type' | 'Contains requiredType and more' || false
+ 'other type' | 'ce_type' | 'other' || true
+ 'no ce_type header' | 'other' | 'irrelevant' || true
+ }
+
+}
diff --git a/cps-service/src/main/java/org/onap/cps/utils/DataMapUtils.java b/cps-service/src/main/java/org/onap/cps/utils/DataMapUtils.java
index b0e109baf..b4d5a0944 100644
--- a/cps-service/src/main/java/org/onap/cps/utils/DataMapUtils.java
+++ b/cps-service/src/main/java/org/onap/cps/utils/DataMapUtils.java
@@ -1,7 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Pantheon.tech
- * Modifications (C) 2021-2022 Nordix Foundation
+ * Modifications (C) 2021-2023 Nordix Foundation
* Modifications Copyright (C) 2022 Bell Canada
* Modifications Copyright (C) 2022-2023 TechMahindra Ltd.
* ================================================================================
@@ -33,6 +33,8 @@ import java.util.Collections;
import java.util.Map;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
+import org.onap.cps.cpspath.parser.CpsPathQuery;
+import org.onap.cps.cpspath.parser.CpsPathUtil;
import org.onap.cps.spi.model.DataNode;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
@@ -106,8 +108,9 @@ public class DataMapUtils {
}
private static String getNodeIdentifier(String xpath) {
- if (xpath.endsWith("]")) {
- xpath = xpath.substring(0, xpath.lastIndexOf('['));
+ final CpsPathQuery cpsPathQuery = CpsPathUtil.getCpsPathQuery(xpath);
+ if (cpsPathQuery.isPathToListElement()) {
+ xpath = cpsPathQuery.getXpathPrefix();
}
final int fromIndex = xpath.lastIndexOf('/') + 1;
return xpath.substring(fromIndex);
diff --git a/cps-service/src/main/java/org/onap/cps/utils/PrefixResolver.java b/cps-service/src/main/java/org/onap/cps/utils/PrefixResolver.java
index 58b239c34..d58ddf4fa 100644
--- a/cps-service/src/main/java/org/onap/cps/utils/PrefixResolver.java
+++ b/cps-service/src/main/java/org/onap/cps/utils/PrefixResolver.java
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation.
+ * Copyright (C) 2022-2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,12 +25,13 @@ import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import lombok.RequiredArgsConstructor;
import org.onap.cps.api.CpsAdminService;
import org.onap.cps.api.impl.YangTextSchemaSourceSetCache;
import org.onap.cps.cache.AnchorDataCacheEntry;
+import org.onap.cps.cpspath.parser.CpsPathPrefixType;
+import org.onap.cps.cpspath.parser.CpsPathQuery;
+import org.onap.cps.cpspath.parser.CpsPathUtil;
import org.onap.cps.spi.model.Anchor;
import org.onap.cps.yang.YangTextSchemaSourceSet;
import org.opendaylight.yangtools.yang.common.QNameModule;
@@ -53,9 +54,6 @@ public class PrefixResolver {
private final IMap<String, AnchorDataCacheEntry> anchorDataCache;
- private static final Pattern TOP_LEVEL_NODE_NAME_FINDER
- = Pattern.compile("\\/([\\w-]*)(\\[@(?!.*\\[).*?])?(\\/.*)?"); //NOSONAR
-
/**
* Get the module prefix for the given xpath for a dataspace and anchor name.
*
@@ -93,9 +91,9 @@ public class PrefixResolver {
private String getPrefixForTopContainer(final Map<String, String> prefixPerContainerName,
final String xpath) {
- final Matcher matcher = TOP_LEVEL_NODE_NAME_FINDER.matcher(xpath);
- if (matcher.matches()) {
- final String topLevelContainerName = matcher.group(1);
+ final CpsPathQuery cpsPathQuery = CpsPathUtil.getCpsPathQuery(xpath);
+ if (cpsPathQuery.getCpsPathPrefixType() == CpsPathPrefixType.ABSOLUTE) {
+ final String topLevelContainerName = cpsPathQuery.getContainerNames().get(0);
if (prefixPerContainerName.containsKey(topLevelContainerName)) {
return prefixPerContainerName.get(topLevelContainerName);
}
diff --git a/cps-service/src/test/groovy/org/onap/cps/utils/DataMapUtilsSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/utils/DataMapUtilsSpec.groovy
index c636f4b5f..29085a9c7 100644
--- a/cps-service/src/test/groovy/org/onap/cps/utils/DataMapUtilsSpec.groovy
+++ b/cps-service/src/test/groovy/org/onap/cps/utils/DataMapUtilsSpec.groovy
@@ -68,8 +68,8 @@ class DataMapUtilsSpec extends Specification {
scenario | xPath | expectedNodeIdentifier
'container xpath' | '/bookstore' | 'sampleModuleName:bookstore'
'xpath contains list attribute' | '/bookstore/categories[@code=1]' | 'sampleModuleName:categories'
- 'xpath contains list attributes with /' | '/bookstore/categories[@code=1/2]' | 'sampleModuleName:categories'
-
+ 'xpath contains list attributes with /' | '/bookstore/categories[@code="1/2"]' | 'sampleModuleName:categories'
+ 'xpath contains list attributes with [' | '/bookstore/categories[@code="[1]"]' | 'sampleModuleName:categories'
}
def 'Data node structure with anchor name conversion to map with root node identifier.'() {
@@ -98,7 +98,7 @@ class DataMapUtilsSpec extends Specification {
def dataNode = buildDataNode(
"/parent",[parentLeaf:'parentLeafValue', parentLeafList:['parentLeafListEntry1','parentLeafListEntry2']],[
- buildDataNode('/parent/child-list[@id=1/2]',[listElementLeaf:'listElement1leafValue'],noChildren),
+ buildDataNode('/parent/child-list[@id="1/2"]',[listElementLeaf:'listElement1leafValue'],noChildren),
buildDataNode('/parent/child-list[@id=2]',[listElementLeaf:'listElement2leafValue'],noChildren),
buildDataNode('/parent/child-object',[childLeaf:'childLeafValue'],
[buildDataNode('/parent/child-object/grand-child-object',[grandChildLeaf:'grandChildLeafValue'],noChildren)]
@@ -107,7 +107,7 @@ class DataMapUtilsSpec extends Specification {
def dataNodeWithAnchor = buildDataNodeWithAnchor(
"/parent", 'anchor01',[parentLeaf:'parentLeafValue', parentLeafList:['parentLeafListEntry1','parentLeafListEntry2']],[
- buildDataNode('/parent/child-list[@id=1/2]',[listElementLeaf:'listElement1leafValue'],noChildren),
+ buildDataNode('/parent/child-list[@id="1/2"]',[listElementLeaf:'listElement1leafValue'],noChildren),
buildDataNode('/parent/child-list[@id=2]',[listElementLeaf:'listElement2leafValue'],noChildren),
buildDataNode('/parent/child-object',[childLeaf:'childLeafValue'],
[buildDataNode('/parent/child-object/grand-child-object',[grandChildLeaf:'grandChildLeafValue'],noChildren)]
diff --git a/cps-service/src/test/groovy/org/onap/cps/utils/PrefixResolverSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/utils/PrefixResolverSpec.groovy
index 4c1b89116..ff6ab346f 100644
--- a/cps-service/src/test/groovy/org/onap/cps/utils/PrefixResolverSpec.groovy
+++ b/cps-service/src/test/groovy/org/onap/cps/utils/PrefixResolverSpec.groovy
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2022 Nordix Foundation
+ * Copyright (C) 2021-2023 Nordix Foundation
* Modifications Copyright (C) 2021 Pantheon.tech
* Modifications Copyright (C) 2021-2022 Bell Canada.
* ================================================================================
@@ -77,8 +77,9 @@ class PrefixResolverSpec extends Specification {
'/test-tree/with/descendants' || 'tree'
'/test-tree[@id=1]' || 'tree'
'/test-tree[@id=1]/child' || 'tree'
+ '/test-tree[@id="[1]"]/child' || 'tree'
+ '//test-tree' || ''
'/not-defined' || ''
- 'invalid-xpath' || ''
}
def 'get prefix with populated anchor data cache with #scenario cache entry'() {
diff --git a/csit/data/dataOperationRequest.json b/csit/data/dataOperationRequest.json
new file mode 100644
index 000000000..1b94a299d
--- /dev/null
+++ b/csit/data/dataOperationRequest.json
@@ -0,0 +1,12 @@
+{
+ "operations": [
+ {
+ "operation": "read",
+ "operationId": "operational-12",
+ "datastore": "ncmp-datastore:passthrough-operational",
+ "options": "(fields=schemas/schema)",
+ "resourceIdentifier": "parent/child",
+ "targetIds": ["850117873c9a4936856a5081be96e6a8"]
+ }
+ ]
+} \ No newline at end of file
diff --git a/csit/plans/cps/setup.sh b/csit/plans/cps/setup.sh
index e7ad67e2b..269d3cb29 100755
--- a/csit/plans/cps/setup.sh
+++ b/csit/plans/cps/setup.sh
@@ -129,4 +129,4 @@ check_health $DMI_HOST:$DMI_MANAGEMENT_PORT 'dmi-plugin'
###################### ROBOT Configurations ##########################
# Pass variables required for Robot test suites in ROBOT_VARIABLES
-ROBOT_VARIABLES="-v CPS_CORE_HOST:$CPS_CORE_HOST -v CPS_CORE_PORT:$CPS_CORE_PORT -v DMI_HOST:$LOCAL_IP -v DMI_PORT:$DMI_PORT -v CPS_CORE_MANAGEMENT_PORT:$CPS_CORE_MANAGEMENT_PORT -v DATADIR:$WORKSPACE/data --exitonfailure"
+ROBOT_VARIABLES="-v CPS_CORE_HOST:$CPS_CORE_HOST -v CPS_CORE_PORT:$CPS_CORE_PORT -v DMI_HOST:$LOCAL_IP -v DMI_PORT:$DMI_PORT -v DMI_CSIT_STUB_HOST:$LOCAL_IP -v DMI_CSIT_STUB_PORT:$DMI_DEMO_STUB_PORT -v CPS_CORE_MANAGEMENT_PORT:$CPS_CORE_MANAGEMENT_PORT -v DATADIR:$WORKSPACE/data --exitonfailure"
diff --git a/csit/plans/cps/test.properties b/csit/plans/cps/test.properties
index 14d6f77d1..474a71818 100644
--- a/csit/plans/cps/test.properties
+++ b/csit/plans/cps/test.properties
@@ -29,3 +29,6 @@ ADVISED_MODULES_SYNC_SLEEP_TIME_MS=2000
CMHANDLE_DATA_SYNC_SLEEP_TIME_MS=2000
CPS_HOME=$CPS_HOME
+
+DMI_DEMO_STUB_PORT=8784
+DMI_DEMO_STUB_VERSION=latest
diff --git a/csit/plans/cps/testplan.txt b/csit/plans/cps/testplan.txt
index c59712358..cca11fb93 100644
--- a/csit/plans/cps/testplan.txt
+++ b/csit/plans/cps/testplan.txt
@@ -22,4 +22,5 @@ cps-data
cps-model-sync
cps-data-sync
ncmp-passthrough
-cm-handle-query \ No newline at end of file
+cm-handle-query
+cps-data-operations \ No newline at end of file
diff --git a/csit/prepare-csit.sh b/csit/prepare-csit.sh
index 78f0fbde2..fbd5dc5f0 100755
--- a/csit/prepare-csit.sh
+++ b/csit/prepare-csit.sh
@@ -69,5 +69,9 @@ python3 -m pip install --upgrade --extra-index-url="https://nexus3.onap.org/repo
echo "Versioning information:"
python3 --version
+
+echo "Installing confluent kafka library for robot framework:"
+pip install robotframework-confluentkafkalibrary
+
pip freeze
python3 -m robot.run --version || : \ No newline at end of file
diff --git a/csit/tests/cps-data-operations/cps-data-operations.robot b/csit/tests/cps-data-operations/cps-data-operations.robot
new file mode 100644
index 000000000..451fb0a42
--- /dev/null
+++ b/csit/tests/cps-data-operations/cps-data-operations.robot
@@ -0,0 +1,77 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+*** Settings ***
+Documentation NCMP
+
+Library Collections
+Library OperatingSystem
+Library RequestsLibrary
+Library BuiltIn
+Library ConfluentKafkaLibrary
+
+Suite Setup Create Session CPS_URL http://${CPS_CORE_HOST}:${CPS_CORE_PORT}
+
+*** Variables ***
+
+${auth} Basic Y3BzdXNlcjpjcHNyMGNrcyE=
+${topic} data-operation-client-topic
+${ncmpBasePath} /ncmp
+${expectedRequestId} ${EMPTY}
+${dmipluginCsitStubUrl} http://${DMI_CSIT_STUB_HOST}:${DMI_CSIT_STUB_PORT}
+${newCmHandleRequestBody} {"dmiPlugin":"${dmipluginCsitStubUrl}","createdCmHandles":[{"cmHandle":"850117873c9a4936856a5081be96e6a8"}]}
+
+*** Test Cases ***
+
+NCMP Data Operation, forwarded to DMI, response on Client Topic
+ ${uri}= Set Variable ${ncmpBasePath}/v1/data
+ ${dataOperationReqBody}= Get Binary File ${DATADIR}${/}dataOperationRequest.json
+ ${params}= Create Dictionary topic=${topic}
+ ${headers}= Create Dictionary Content-Type=application/json Authorization=${auth}
+ POST On Session CPS_URL ncmpInventory/v1/ch headers=${headers} data=${newCmHandleRequestBody}
+ Sleep 5 wait some time to get updated the cm handle state to READY
+ ${response}= POST On Session CPS_URL ${uri} params=${params} headers=${headers} data=${dataOperationReqBody}
+ Set Global Variable ${expectedRequestId} ${response.json()}[requestId]
+ Should Be Equal As Strings ${response.status_code} 200
+ Sleep 5 wait some time to get published a message to the client topic
+
+Consume cloud event from client topic
+ ${group_id}= Create Consumer port=19092 auto_offset_reset=earliest
+ Subscribe Topic topics=${topic} group_id=${group_id}
+ ${messages}= Poll group_id=${group_id} only_value=false
+ ${event} Set Variable ${messages}[0]
+ ${headers} Set Variable ${event.headers()}
+ ${specVersionHeaderValue} Set Variable ${headers[1][1]}
+ ${sourceHeaderValue} Set Variable ${headers[3][1]}
+ ${typeHeaderValue} Set Variable ${headers[4][1]}
+ ${correlationIdHeaderValue} Set Variable ${headers[8][1]}
+ Should Be Equal As Strings ${specVersionHeaderValue} 1.0
+ Should Be Equal As Strings ${sourceHeaderValue} DMI
+ Should Be Equal As Strings ${correlationIdHeaderValue} ${expectedRequestId}
+ Should Be Equal As Strings ${typeHeaderValue} org.onap.cps.ncmp.events.async1_0_0.DataOperationEvent
+ [Teardown] Basic Teardown ${group_id}
+
+*** Keywords ***
+
+Basic Teardown
+ [Arguments] ${group_id}
+ Unsubscribe ${group_id}
+ Close Consumer ${group_id}
+
diff --git a/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-app/pom.xml b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-app/pom.xml
new file mode 100644
index 000000000..71dcec880
--- /dev/null
+++ b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-app/pom.xml
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ Copyright (C) 2023 Nordix Foundation
+ ================================================================================
+ 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.
+ SPDX-License-Identifier: Apache-2.0
+ ============LICENSE_END=========================================================
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.cps</groupId>
+ <artifactId>dmi-plugin-demo-and-csit-stub</artifactId>
+ <version>3.3.4-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>dmi-plugin-demo-and-csit-stub-app</artifactId>
+
+ <properties>
+ <app>org.onap.cps.ncmp.dmi.rest.stub.DmiDemoApplication</app>
+ <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
+ <base.image>${docker.pull.registry}/onap/integration-java11:8.0.0</base.image>
+ <image.tag>${project.version}-${maven.build.timestamp}</image.tag>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>com.google.cloud.tools</groupId>
+ <artifactId>jib-maven-plugin</artifactId>
+ <configuration>
+ <container>
+ <mainClass>${app}</mainClass>
+ <creationTime>USE_CURRENT_TIMESTAMP</creationTime>
+ </container>
+ <from>
+ <image>${base.image}</image>
+ </from>
+ <to>
+ <tags>
+ <tag>latest</tag>
+ </tags>
+ <image>${docker.push.registry}/onap/${image.name}:${image.tag}</image>
+ </to>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <id>build</id>
+ <goals>
+ <goal>dockerBuild</goal>
+ </goals>
+ </execution>
+ <execution>
+ <phase>deploy</phase>
+ <id>buildAndPush</id>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>docker</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <properties>
+ <image.name>dmi-plugin-demo-and-csit-stub</image.name>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.google.cloud.tools</groupId>
+ <artifactId>jib-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.cps</groupId>
+ <artifactId>dmi-plugin-demo-and-csit-stub-service</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+</project> \ No newline at end of file
diff --git a/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-app/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/DmiDemoApplication.java b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-app/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/DmiDemoApplication.java
new file mode 100644
index 000000000..2d4a2d8e8
--- /dev/null
+++ b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-app/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/DmiDemoApplication.java
@@ -0,0 +1,32 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.cps.ncmp.dmi.rest.stub;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class DmiDemoApplication {
+
+ public static void main(final String[] args) {
+ SpringApplication.run(DmiDemoApplication.class, args);
+ }
+}
diff --git a/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/pom.xml b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/pom.xml
new file mode 100644
index 000000000..a9e382768
--- /dev/null
+++ b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/pom.xml
@@ -0,0 +1,51 @@
+<!--
+ ============LICENSE_START=======================================================
+ Copyright (C) 2023 Nordix Foundation
+ ================================================================================
+ 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.
+ SPDX-License-Identifier: Apache-2.0
+ ============LICENSE_END=========================================================
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.cps</groupId>
+ <artifactId>dmi-plugin-demo-and-csit-stub</artifactId>
+ <version>3.3.4-SNAPSHOT</version>
+ </parent>
+ <artifactId>dmi-plugin-demo-and-csit-stub-service</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-tomcat</artifactId>
+ </exclusion>
+ </exclusions>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.googlecode.json-simple</groupId>
+ <artifactId>json-simple</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.onap.cps</groupId>
+ <artifactId>cps-ncmp-rest</artifactId>
+ </dependency>
+ </dependencies>
+</project> \ No newline at end of file
diff --git a/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiRestStubController.java b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiRestStubController.java
new file mode 100644
index 000000000..b7e67d755
--- /dev/null
+++ b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiRestStubController.java
@@ -0,0 +1,180 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.cps.ncmp.dmi.rest.stub.controller;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import io.cloudevents.CloudEvent;
+import io.cloudevents.core.builder.CloudEventBuilder;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+import java.util.stream.Collectors;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.json.simple.parser.JSONParser;
+import org.json.simple.parser.ParseException;
+import org.onap.cps.ncmp.api.NcmpEventResponseCode;
+import org.onap.cps.ncmp.api.impl.utils.EventDateTimeFormatter;
+import org.onap.cps.ncmp.dmi.rest.stub.model.data.operational.CmHandle;
+import org.onap.cps.ncmp.dmi.rest.stub.model.data.operational.DataOperationRequest;
+import org.onap.cps.ncmp.dmi.rest.stub.model.data.operational.ResourceDataOperationRequests;
+import org.onap.cps.ncmp.dmi.rest.stub.utils.ResourceFileReaderUtil;
+import org.onap.cps.ncmp.events.async1_0_0.Data;
+import org.onap.cps.ncmp.events.async1_0_0.DataOperationEvent;
+import org.onap.cps.ncmp.events.async1_0_0.Response;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.ApplicationContext;
+import org.springframework.core.io.ResourceLoader;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.kafka.core.KafkaTemplate;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("${rest.api.dmi-stub-base-path}")
+@RequiredArgsConstructor
+@Slf4j
+public class DmiRestStubController {
+
+ private final KafkaTemplate<String, CloudEvent> cloudEventKafkaTemplate;
+ private final ObjectMapper objectMapper;
+ private final ApplicationContext applicationContext;
+
+ @Value("${app.ncmp.async-m2m.topic}")
+ private String ncmpAsyncM2mTopic;
+
+ private String dataOperationEventType = "org.onap.cps.ncmp.events.async1_0_0.DataOperationEvent";
+
+ /**
+ * Get all modules for given cm handle.
+ *
+ * @param cmHandle The identifier for a network function, network element, subnetwork,
+ * or any other cm object by managed Network CM Proxy
+ * @param moduleReferencesRequest module references request body
+ * @return ResponseEntity response entity having module response as json string.
+ */
+ @PostMapping("/v1/ch/{cmHandle}/modules")
+ public ResponseEntity<String> getModuleReferences(@PathVariable final String cmHandle,
+ @RequestBody final Object moduleReferencesRequest) {
+ final String moduleResponseContent = ResourceFileReaderUtil
+ .getResourceFileContent(applicationContext.getResource(
+ ResourceLoader.CLASSPATH_URL_PREFIX + "module/moduleResponse.json"));
+ return ResponseEntity.ok(moduleResponseContent);
+ }
+
+ /**
+ * Get all module resources for given cm handle.
+ *
+ * @param cmHandle The identifier for a network function, network element, subnetwork,
+ * or any other cm object by managed Network CM Proxy
+ * @param moduleResourcesReadRequest module resources read request body
+ * @return ResponseEntity response entity having module resources response as json string.
+ */
+ @PostMapping("/v1/ch/{cmHandle}/moduleResources")
+ public ResponseEntity<String> retrieveModuleResources(
+ @PathVariable final String cmHandle,
+ @RequestBody final Object moduleResourcesReadRequest) {
+ final String moduleResourcesResponseContent = ResourceFileReaderUtil
+ .getResourceFileContent(applicationContext.getResource(
+ ResourceLoader.CLASSPATH_URL_PREFIX + "module/moduleResourcesResponse.json"));
+ return ResponseEntity.ok(moduleResourcesResponseContent);
+ }
+
+ /**
+ * This method is not implemented for ONAP DMI plugin.
+ *
+ * @param topic client given topic name
+ * @param requestId requestId generated by NCMP as an ack for client
+ * @param resourceDataOperationRequests list of operation details
+ * @return (@ code ResponseEntity) response entity
+ */
+ @PostMapping("/v1/data")
+ public ResponseEntity<Void> getResourceDataForCmHandleDataOperation(@RequestParam(value = "topic")
+ final String topic,
+ @RequestParam(value = "requestId")
+ final String requestId,
+ @RequestBody final ResourceDataOperationRequests
+ resourceDataOperationRequests) {
+ log.info("Request received from the NCMP to DMI Plugin");
+ resourceDataOperationRequests.forEach(resourceDataOperationRequest -> {
+ final DataOperationEvent dataOperationEvent = getDataOperationEvent(resourceDataOperationRequest);
+ resourceDataOperationRequest.getCmHandles().forEach(cmHandle -> {
+ dataOperationEvent.getData().getResponses().get(0).setIds(List.of(cmHandle.getId()));
+ final CloudEvent cloudEvent = buildAndGetCloudEvent(topic, requestId, dataOperationEvent);
+ cloudEventKafkaTemplate.send(ncmpAsyncM2mTopic, UUID.randomUUID().toString(), cloudEvent);
+ });
+ });
+ return new ResponseEntity<>(HttpStatus.ACCEPTED);
+ }
+
+ private CloudEvent buildAndGetCloudEvent(final String topic, final String requestId,
+ final DataOperationEvent dataOperationEvent) {
+ CloudEvent cloudEvent = null;
+ try {
+ cloudEvent = CloudEventBuilder.v1()
+ .withId(UUID.randomUUID().toString())
+ .withSource(URI.create("DMI"))
+ .withType(dataOperationEventType)
+ .withDataSchema(URI.create("urn:cps:" + dataOperationEventType + ":1.0.0"))
+ .withTime(EventDateTimeFormatter.toIsoOffsetDateTime(
+ EventDateTimeFormatter.getCurrentIsoFormattedDateTime()))
+ .withData(objectMapper.writeValueAsBytes(dataOperationEvent))
+ .withExtension("destination", topic)
+ .withExtension("correlationid", requestId)
+ .build();
+ } catch (final JsonProcessingException jsonProcessingException) {
+ log.error("Unable to parse event into bytes. cause : {}", jsonProcessingException.getMessage());
+ }
+ return cloudEvent;
+ }
+
+ private DataOperationEvent getDataOperationEvent(final DataOperationRequest dataOperationRequest) {
+ final Response response = new Response();
+ response.setOperationId(dataOperationRequest.getOperationId());
+ response.setStatusCode(NcmpEventResponseCode.SUCCESS.getStatusCode());
+ response.setStatusMessage(NcmpEventResponseCode.SUCCESS.getStatusMessage());
+ response.setIds(dataOperationRequest.getCmHandles().stream().map(CmHandle::getId).collect(Collectors.toList()));
+ final String ietfNetworkTopologySample = ResourceFileReaderUtil
+ .getResourceFileContent(applicationContext.getResource(
+ ResourceLoader.CLASSPATH_URL_PREFIX
+ + "data/operational/ietf-network-topology-sample-rfc8345.json"));
+ final JSONParser jsonParser = new JSONParser();
+ try {
+ response.setResult(jsonParser.parse(ietfNetworkTopologySample));
+ } catch (final ParseException parseException) {
+ log.error("Unable to parse event result as json object. cause : {}", parseException.getMessage());
+ }
+ final List<Response> responseList = new ArrayList<>();
+ responseList.add(response);
+ final Data data = new Data();
+ data.setResponses(responseList);
+ final DataOperationEvent dataOperationEvent = new DataOperationEvent();
+ dataOperationEvent.setData(data);
+ return dataOperationEvent;
+ }
+}
diff --git a/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/model/data/operational/CmHandle.java b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/model/data/operational/CmHandle.java
new file mode 100644
index 000000000..93a90c917
--- /dev/null
+++ b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/model/data/operational/CmHandle.java
@@ -0,0 +1,33 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.cps.ncmp.dmi.rest.stub.model.data.operational;
+
+import java.util.HashMap;
+import java.util.Map;
+import lombok.Getter;
+import lombok.Setter;
+
+@Setter
+@Getter
+public class CmHandle {
+ private String id;
+ private Map<String, String> cmHandleProperties = new HashMap<>();
+}
diff --git a/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/model/data/operational/DataOperationRequest.java b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/model/data/operational/DataOperationRequest.java
new file mode 100644
index 000000000..2c0cb919b
--- /dev/null
+++ b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/model/data/operational/DataOperationRequest.java
@@ -0,0 +1,37 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.cps.ncmp.dmi.rest.stub.model.data.operational;
+
+import java.util.ArrayList;
+import java.util.List;
+import lombok.Getter;
+import lombok.Setter;
+
+@Setter
+@Getter
+public class DataOperationRequest {
+ private String operation;
+ private String operationId;
+ private String datastore;
+ private String options;
+ private String resourceIdentifier;
+ private List<CmHandle> cmHandles = new ArrayList<>();
+}
diff --git a/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/model/data/operational/ResourceDataOperationRequests.java b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/model/data/operational/ResourceDataOperationRequests.java
new file mode 100644
index 000000000..68a222a30
--- /dev/null
+++ b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/model/data/operational/ResourceDataOperationRequests.java
@@ -0,0 +1,27 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.cps.ncmp.dmi.rest.stub.model.data.operational;
+
+import java.util.ArrayList;
+
+public class ResourceDataOperationRequests extends ArrayList<DataOperationRequest> {
+ private static final long serialVersionUID = 3553323170854399881L;
+}
diff --git a/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/utils/ResourceFileReaderUtil.java b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/utils/ResourceFileReaderUtil.java
new file mode 100644
index 000000000..0d2adee43
--- /dev/null
+++ b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/utils/ResourceFileReaderUtil.java
@@ -0,0 +1,51 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.cps.ncmp.dmi.rest.stub.utils;
+
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.core.io.Resource;
+import org.springframework.util.StreamUtils;
+
+/**
+ * Common convenience methods for reading resource file content.
+ */
+@Slf4j
+public class ResourceFileReaderUtil {
+
+ /**
+ * Converts a resource file content into string.
+ *
+ * @param fileClasspath to name of the file in test/resources
+ * @return the content of the file as a String
+ * @throws IOException when there is an IO issue
+ */
+ public static String getResourceFileContent(final Resource fileClasspath) {
+ String fileContent = null;
+ try {
+ fileContent = StreamUtils.copyToString(fileClasspath.getInputStream(), StandardCharsets.UTF_8);
+ } catch (final IOException ioException) {
+ log.debug("unable to read resource file content. cause : {}", ioException.getMessage());
+ }
+ return fileContent;
+ }
+}
diff --git a/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/application.yml b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/application.yml
new file mode 100644
index 000000000..8e39a4e71
--- /dev/null
+++ b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/application.yml
@@ -0,0 +1,42 @@
+# ============LICENSE_START=======================================================
+# Copyright (C) 2023 Nordix Foundation
+# ================================================================================
+# 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.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+server:
+ port: 8092
+
+rest:
+ api:
+ dmi-stub-base-path: /dmi
+
+spring:
+ main:
+ banner-mode: "off"
+ application:
+ name: "dmi-plugin-demo-and-csit-stub"
+
+ kafka:
+ bootstrap-servers: ${KAFKA_BOOTSTRAP_SERVER:localhost:19092}
+ security:
+ protocol: PLAINTEXT
+ producer:
+ value-serializer: io.cloudevents.kafka.CloudEventSerializer
+ client-id: cps-core
+
+app:
+ ncmp:
+ async-m2m:
+ topic: ${NCMP_ASYNC_M2M_TOPIC:ncmp-async-m2m}
diff --git a/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/data/operational/ietf-network-topology-sample-rfc8345.json b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/data/operational/ietf-network-topology-sample-rfc8345.json
new file mode 100644
index 000000000..8f9dbc225
--- /dev/null
+++ b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/data/operational/ietf-network-topology-sample-rfc8345.json
@@ -0,0 +1,76 @@
+{
+ "ietf-network:networks": {
+ "network": [
+ {
+ "network-types": {
+ },
+ "network-id": "otn-hc",
+ "node": [
+ {
+ "node-id": "D1",
+ "termination-point": [
+ {
+ "tp-id": "1-0-1"
+ },
+ {
+ "tp-id": "1-2-1"
+ },
+ {
+ "tp-id": "1-3-1"
+ }
+ ]
+ },
+ {
+ "node-id": "D2",
+ "termination-point": [
+ {
+ "tp-id": "2-0-1"
+ },
+ {
+ "tp-id": "2-1-1"
+ },
+ {
+ "tp-id": "2-3-1"
+ }
+ ]
+ },
+ {
+ "node-id": "D3",
+ "termination-point": [
+ {
+ "tp-id": "3-1-1"
+ },
+ {
+ "tp-id": "3-2-1"
+ }
+ ]
+ }
+ ],
+ "ietf-network-topology:link": [
+ {
+ "link-id": "D1,1-2-1,D2,2-1-1",
+ "source": {
+ "source-node": "D1",
+ "source-tp": "1-2-1"
+ },
+ "destination": {
+ "dest-node": "D2",
+ "dest-tp": "2-1-1"
+ }
+ },
+ {
+ "link-id": "D2,2-1-1,D1,1-2-1",
+ "source": {
+ "source-node": "D2",
+ "source-tp": "2-1-1"
+ },
+ "destination": {
+ "dest-node": "D1",
+ "dest-tp": "1-2-1"
+ }
+ }
+ ]
+ }
+ ]
+ }
+ }
diff --git a/dmi-plugin-stub/files/moduleResourcesResponse.json b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/moduleResourcesResponse.json
index 69eb9da92..69eb9da92 100644
--- a/dmi-plugin-stub/files/moduleResourcesResponse.json
+++ b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/moduleResourcesResponse.json
diff --git a/dmi-plugin-stub/files/moduleResponse.json b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/moduleResponse.json
index ef49eb488..ef49eb488 100644
--- a/dmi-plugin-stub/files/moduleResponse.json
+++ b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/moduleResponse.json
diff --git a/dmi-plugin-demo-and-csit-stub/pom.xml b/dmi-plugin-demo-and-csit-stub/pom.xml
new file mode 100644
index 000000000..e8dd4c021
--- /dev/null
+++ b/dmi-plugin-demo-and-csit-stub/pom.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ Copyright (C) 2023 Nordix Foundation
+ ================================================================================
+ 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.
+ SPDX-License-Identifier: Apache-2.0
+ ============LICENSE_END=========================================================
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.cps</groupId>
+ <artifactId>cps-parent</artifactId>
+ <version>3.3.4-SNAPSHOT</version>
+ <relativePath>../cps-parent/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>dmi-plugin-demo-and-csit-stub</artifactId>
+ <packaging>pom</packaging>
+
+ <properties>
+ <parent.directory>${project.parent.basedir}/..</parent.directory>
+ <sonar.skip>true</sonar.skip>
+ <jacoco.skip>true</jacoco.skip>
+ </properties>
+
+ <modules>
+ <module>dmi-plugin-demo-and-csit-stub-service</module>
+ <module>dmi-plugin-demo-and-csit-stub-app</module>
+ </modules>
+</project> \ No newline at end of file
diff --git a/dmi-plugin-stub/mappings/dataOperationRequest.json b/dmi-plugin-stub/mappings/dataOperationRequest.json
deleted file mode 100644
index 1df7363dd..000000000
--- a/dmi-plugin-stub/mappings/dataOperationRequest.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "request": {
- "method": "POST",
- "urlPattern": "/dmi/v1/data?.*"
- },
- "response": {
- "status": 501
- }
-}
diff --git a/dmi-plugin-stub/mappings/module.json b/dmi-plugin-stub/mappings/module.json
deleted file mode 100644
index a1b35ba13..000000000
--- a/dmi-plugin-stub/mappings/module.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "request": {
- "method": "POST",
- "urlPattern": "/dmi/v1/ch/.*/modules"
- },
- "response": {
- "status": 200,
- "bodyFileName": "moduleResponse.json",
- "headers": {
- "Content-Type": "application/json"
- }
- }
-}
diff --git a/dmi-plugin-stub/mappings/moduleResources.json b/dmi-plugin-stub/mappings/moduleResources.json
deleted file mode 100644
index 4efb9b088..000000000
--- a/dmi-plugin-stub/mappings/moduleResources.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "request": {
- "method": "POST",
- "urlPattern": "/dmi/v1/ch/.*/moduleResources"
- },
- "response": {
- "status": 200,
- "bodyFileName": "moduleResourcesResponse.json",
- "headers": {
- "Content-Type": "application/json"
- }
- }
-}
diff --git a/dmi-plugin-stub/start.sh b/dmi-plugin-stub/start.sh
deleted file mode 100755
index ffa8ce882..000000000
--- a/dmi-plugin-stub/start.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-docker run -it --rm -p 8783:8080 -v "$(pwd)"/mappings:/home/wiremock/mappings -v "$(pwd)"/files:/home/wiremock/__files --name wiremock wiremock/wiremock:2.33.2 --verbose
-
diff --git a/docker-compose/docker-compose.yml b/docker-compose/docker-compose.yml
index 3dc54bbfc..23f34b463 100644
--- a/docker-compose/docker-compose.yml
+++ b/docker-compose/docker-compose.yml
@@ -106,17 +106,19 @@ services:
profiles:
- dmi-service
- ncmp-dmi-plugin-stub:
- container_name: ncmp-dmi-plugin-stub
- image: wiremock/wiremock:2.33.2
+ ncmp-dmi-plugin-demo-and-csit-stub:
+ container_name: ncmp-dmi-plugin-demo-and-csit-stub
+ image: ${DOCKER_REPO:-nexus3.onap.org:10003}/onap/dmi-plugin-demo-and-csit-stub:${DMI_DEMO_STUB_VERSION:-latest}
ports:
- - ${DMI_PORT:-8783}:8080
- volumes:
- - ../dmi-plugin-stub/mappings:/home/wiremock/mappings
- - ../dmi-plugin-stub/files:/home/wiremock/__files
+ - ${DMI_DEMO_STUB_PORT:-8784}:8092
+ environment:
+ KAFKA_BOOTSTRAP_SERVER: kafka:9092
+ NCMP_CONSUMER_GROUP_ID: ncmp-group
+ NCMP_ASYNC_M2M_TOPIC: ncmp-async-m2m
restart: unless-stopped
profiles:
- dmi-stub
+ - dmi-service
prometheus:
container_name: prometheus-container
diff --git a/pom.xml b/pom.xml
index 7270bc46f..910afa2ac 100644
--- a/pom.xml
+++ b/pom.xml
@@ -61,6 +61,7 @@
<module>cps-ncmp-rest-stub</module>
<module>cps-path-parser</module>
<module>cps-ri</module>
+ <module>dmi-plugin-demo-and-csit-stub</module>
<module>integration-test</module>
<module>checkstyle</module>
<module>spotbugs</module>