summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service
diff options
context:
space:
mode:
authorRuslan Kashapov <ruslan.kashapov@pantheon.tech>2021-05-07 10:46:27 +0300
committerRuslan Kashapov <ruslan.kashapov@pantheon.tech>2021-05-11 10:23:56 +0300
commit1baf48d05be1cd32e22c065ebfec218da100d1f2 (patch)
tree3609e4c341d204c36111de9894f73f68b1dd11cb /cps-ncmp-service
parent0905ac124ea1d8ab5067b4b00ece0469961cfa36 (diff)
Create list-node elements (part3): NCMP REST and service layers
Issue-ID: CPS-360 Change-Id: Id8be89f19750d72bae334491aea4a59f21c7ecd6 Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Diffstat (limited to 'cps-ncmp-service')
-rw-r--r--cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NetworkCmProxyDataService.java10
-rwxr-xr-xcps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java5
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/api/impl/NetworkCmProxyDataServiceImplSpec.groovy10
3 files changed, 25 insertions, 0 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NetworkCmProxyDataService.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NetworkCmProxyDataService.java
index 8176ea50fa..ccc4e44ccb 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NetworkCmProxyDataService.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NetworkCmProxyDataService.java
@@ -68,6 +68,16 @@ public interface NetworkCmProxyDataService {
void createDataNode(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
/**
+ * Creates one or more child node elements with descendants under existing node from list-node data fragment.
+ *
+ * @param cmHandle The identifier for a network function, network element, subnetwork or any other cm
+ * object managed by Network CM Proxy
+ * @param parentNodeXpath xpath to parent node
+ * @param jsonData data as JSON string
+ */
+ void addListNodeElements(@NonNull String cmHandle, @NonNull String parentNodeXpath, @NonNull String jsonData);
+
+ /**
* Updates data node for given cm handle using xpath to parent node.
*
* @param cmHandle The identifier for a network function, network element, subnetwork or any other cm object
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java
index 56f4cf8dce..bdb71bf625 100755
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java
@@ -68,6 +68,11 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService
}
@Override
+ public void addListNodeElements(final String cmHandle, final String parentNodeXpath, final String jsonData) {
+ cpsDataService.saveListNodeData(getDataspaceName(), cmHandle, parentNodeXpath, jsonData);
+ }
+
+ @Override
public void updateNodeLeaves(final String cmHandle, final String parentNodeXpath, final String jsonData) {
cpsDataService.updateNodeLeaves(getDataspaceName(), cmHandle, parentNodeXpath, jsonData);
}
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/api/impl/NetworkCmProxyDataServiceImplSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/api/impl/NetworkCmProxyDataServiceImplSpec.groovy
index 0a00e34f7b..e67d4ad85d 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/api/impl/NetworkCmProxyDataServiceImplSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/api/impl/NetworkCmProxyDataServiceImplSpec.groovy
@@ -73,6 +73,16 @@ class NetworkCmProxyDataServiceImplSpec extends Specification {
1 * mockcpsDataService.saveData(expectedDataspaceName, cmHandle, xpath, jsonData)
}
+ def 'Add list-node elements.'() {
+ given: 'a cm handle and parent node xpath'
+ def jsonData = 'some json'
+ def xpath = '/test-node'
+ when: 'addListNodeElements is invoked'
+ objectUnderTest.addListNodeElements(cmHandle, xpath, jsonData)
+ then: 'the CPS service method is invoked once with the expected parameters'
+ 1 * mockcpsDataService.saveListNodeData(expectedDataspaceName, cmHandle, xpath, jsonData)
+ }
+
def 'Update data node leaves.'() {
given: 'a cm Handle and a cps path'
def xpath = '/xpath'