aboutsummaryrefslogtreecommitdiffstats
path: root/cps-ncmp-rest
diff options
context:
space:
mode:
Diffstat (limited to 'cps-ncmp-rest')
-rw-r--r--cps-ncmp-rest/docs/openapi/components.yaml26
-rwxr-xr-xcps-ncmp-rest/docs/openapi/ncmp.yml8
-rwxr-xr-xcps-ncmp-rest/docs/openapi/openapi-inventory.yml4
-rwxr-xr-xcps-ncmp-rest/docs/openapi/openapi.yml4
-rw-r--r--cps-ncmp-rest/pom.xml33
-rwxr-xr-xcps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java32
-rw-r--r--cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/NcmpDatastoreRequestHandler.java42
-rw-r--r--cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/NcmpPassthroughResourceRequestHandler.java12
-rw-r--r--cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/TaskManagementDefaultHandler.java10
-rwxr-xr-xcps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandler.java6
-rw-r--r--cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/mapper/DataOperationRequestMapper.java (renamed from cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/mapper/ResourceDataBatchRequestMapper.java)16
-rw-r--r--cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy75
-rw-r--r--cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandlerSpec.groovy6
13 files changed, 146 insertions, 128 deletions
diff --git a/cps-ncmp-rest/docs/openapi/components.yaml b/cps-ncmp-rest/docs/openapi/components.yaml
index 2781f572f2..818b2daeed 100644
--- a/cps-ncmp-rest/docs/openapi/components.yaml
+++ b/cps-ncmp-rest/docs/openapi/components.yaml
@@ -38,7 +38,7 @@ components:
properties:
message:
type: string
- example: "Bad Gateway Error Message NCMP"
+ example: 'Bad Gateway Error Message NCMP'
dmi-response:
type: object
properties:
@@ -160,11 +160,11 @@ components:
example: |
module stores {
yang-version 1.1;
- namespace "org:onap:ccsdk:sample";
+ namespace 'org:onap:ccsdk:sample';
prefix book-store;
- revision "2020-09-15" {
+ revision '2020-09-15' {
description
- "Sample Model";
+ 'Sample Model';
}
}
@@ -175,13 +175,11 @@ components:
cmHandleQueryParameters:
type: array
items:
- type: object
$ref: '#/components/schemas/ConditionProperties'
conditions:
deprecated: true
type: array
items:
- type: object
$ref: '#/components/schemas/OldConditionProperties'
description: not necessary, it is just for backward compatibility
@@ -203,7 +201,6 @@ components:
conditionParameters:
type: array
items:
- type: object
$ref: '#/components/schemas/ModuleNameAsJsonObject'
ModuleNameAsJsonObject:
properties:
@@ -285,18 +282,17 @@ components:
properties:
state:
$ref: '#/components/schemas/CmHandleCompositeState'
- # Batch Request Schemas
- ResourceDataBatchRequest:
+ # Data Operation Request Schemas
+ DataOperationRequest:
type: object
- title: get resource data for given array of operations
+ title: execute data operation for given array of operations
properties:
operations:
type: array
items:
- type: object
- $ref: '#/components/schemas/BatchOperationDefinition'
- description: contains batch request details
- BatchOperationDefinition:
+ $ref: '#/components/schemas/DataOperationDefinition'
+ description: contains group of data operation requests
+ DataOperationDefinition:
required:
- operation
- datastore
@@ -321,7 +317,7 @@ components:
type: array
items:
type: string
- example: [ "da310eecdb8d44c2acc0ddaae01174b1","c748c58f8e0b438f9fd1f28370b17d47" ]
+ example: [ "da310eecdb8d44c2acc0ddaae01174b1","c748c58f8e0b438f9fd1f28370b17d47" ]
examples:
dataSampleRequest:
diff --git a/cps-ncmp-rest/docs/openapi/ncmp.yml b/cps-ncmp-rest/docs/openapi/ncmp.yml
index 957a3b8735..95ca6ccdc7 100755
--- a/cps-ncmp-rest/docs/openapi/ncmp.yml
+++ b/cps-ncmp-rest/docs/openapi/ncmp.yml
@@ -194,13 +194,13 @@ resourceDataForCmHandle:
502:
$ref: 'components.yaml#/components/responses/BadGateway'
-getResourceDataForCmHandleBatch:
+dataOperationForCmHandle:
post:
tags:
- network-cm-proxy
- summary: Get resource data for batch of cm handle ids
+ summary: Execute a data operation for group of cm handle ids
description: This request will be handled asynchronously using messaging to the supplied topic. The rest response will be an acknowledge with a requestId to identify the relevant messages.
- operationId: getResourceDataForCmHandleBatch
+ operationId: executeDataOperationForCmHandles
parameters:
- $ref: 'components.yaml#/components/parameters/requiredTopicParamInQuery'
requestBody:
@@ -208,7 +208,7 @@ getResourceDataForCmHandleBatch:
content:
application/json:
schema:
- $ref: 'components.yaml#/components/schemas/ResourceDataBatchRequest'
+ $ref: 'components.yaml#/components/schemas/DataOperationRequest'
responses:
200:
description: OK
diff --git a/cps-ncmp-rest/docs/openapi/openapi-inventory.yml b/cps-ncmp-rest/docs/openapi/openapi-inventory.yml
index bd83dbf256..b794082875 100755
--- a/cps-ncmp-rest/docs/openapi/openapi-inventory.yml
+++ b/cps-ncmp-rest/docs/openapi/openapi-inventory.yml
@@ -1,6 +1,6 @@
# ============LICENSE_START=======================================================
# Copyright (C) 2021 Bell Canada
-# Modifications Copyright (C) 2022 Nordix Foundation
+# Modifications 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.
@@ -17,7 +17,7 @@
# SPDX-License-Identifier: Apache-2.0
# ============LICENSE_END=========================================================
-openapi: 3.0.1
+openapi: 3.0.3
info:
title: NCMP Inventory API
description: NCMP Inventory API
diff --git a/cps-ncmp-rest/docs/openapi/openapi.yml b/cps-ncmp-rest/docs/openapi/openapi.yml
index b63b568234..7ceb4fe70a 100755
--- a/cps-ncmp-rest/docs/openapi/openapi.yml
+++ b/cps-ncmp-rest/docs/openapi/openapi.yml
@@ -18,7 +18,7 @@
# SPDX-License-Identifier: Apache-2.0
# ============LICENSE_END=========================================================
-openapi: 3.0.1
+openapi: 3.0.3
info:
title: NCMP to CPS Proxy API
description: NCMP to CPS Proxy API
@@ -35,7 +35,7 @@ paths:
$ref: 'ncmp.yml#/resourceDataForCmHandle'
/v1/data:
- $ref: 'ncmp.yml#/getResourceDataForCmHandleBatch'
+ $ref: 'ncmp.yml#/dataOperationForCmHandle'
/v1/ch/{cm-handle}/data/ds/{datastore-name}/query:
$ref: 'ncmp.yml#/queryResourceDataForCmHandle'
diff --git a/cps-ncmp-rest/pom.xml b/cps-ncmp-rest/pom.xml
index 8c84546b23..8db3628a94 100644
--- a/cps-ncmp-rest/pom.xml
+++ b/cps-ncmp-rest/pom.xml
@@ -116,8 +116,9 @@
<plugins>
<!-- Swagger code generation. -->
<plugin>
- <groupId>io.swagger.codegen.v3</groupId>
- <artifactId>swagger-codegen-maven-plugin</artifactId>
+ <groupId>org.openapitools</groupId>
+ <artifactId>openapi-generator-maven-plugin</artifactId>
+ <version>6.6.0</version>
<executions>
<execution>
<id>ncmp-code-gen</id>
@@ -129,13 +130,16 @@
<invokerPackage>org.onap.cps.ncmp.rest.controller</invokerPackage>
<modelPackage>org.onap.cps.ncmp.rest.model</modelPackage>
<apiPackage>org.onap.cps.ncmp.rest.api</apiPackage>
- <language>spring</language>
+ <generatorName>spring</generatorName>
<generateSupportingFiles>false</generateSupportingFiles>
+ <generateAliasAsModel>true</generateAliasAsModel>
<configOptions>
<sourceFolder>src/gen/java</sourceFolder>
<dateLibrary>java11</dateLibrary>
<interfaceOnly>true</interfaceOnly>
<useTags>true</useTags>
+ <openApiNullable>false</openApiNullable>
+ <skipDefaultInterface>true</skipDefaultInterface>
</configOptions>
</configuration>
</execution>
@@ -149,13 +153,15 @@
<invokerPackage>org.onap.cps.ncmp.rest.controller</invokerPackage>
<modelPackage>org.onap.cps.ncmp.rest.model</modelPackage>
<apiPackage>org.onap.cps.ncmp.rest.api</apiPackage>
- <language>spring</language>
+ <generatorName>spring</generatorName>
<generateSupportingFiles>false</generateSupportingFiles>
<configOptions>
<sourceFolder>src/gen/java</sourceFolder>
<dateLibrary>java11</dateLibrary>
<interfaceOnly>true</interfaceOnly>
<useTags>true</useTags>
+ <openApiNullable>false</openApiNullable>
+ <skipDefaultInterface>true</skipDefaultInterface>
</configOptions>
</configuration>
</execution>
@@ -167,15 +173,30 @@
<phase>compile</phase>
<configuration>
<inputSpec>${project.basedir}/docs/openapi/openapi-inventory.yml</inputSpec>
- <language>openapi-yaml</language>
+ <generatorName>openapi-yaml</generatorName>
<configOptions>
<outputFile>openapi-inventory.yaml</outputFile>
</configOptions>
</configuration>
</execution>
+ <execution>
+ <id>ncmp-openapi-yaml-gen</id>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ <phase>compile</phase>
+ <configuration>
+ <inputSpec>${project.basedir}/docs/openapi/openapi.yml</inputSpec>
+ <generatorName>openapi-yaml</generatorName>
+ <configOptions>
+ <outputFile>openapi.yaml</outputFile>
+ </configOptions>
+ </configuration>
+ </execution>
</executions>
</plugin>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
@@ -189,7 +210,7 @@
</outputDirectory>
<resources>
<resource>
- <directory>${project.basedir}/target/generated-sources/swagger/</directory>
+ <directory>${project.basedir}/target/generated-sources/openapi/</directory>
<includes>
<include>openapi*.yaml</include>
</includes>
diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java
index 1b78fa0343..b81378dd20 100755
--- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java
+++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java
@@ -46,10 +46,10 @@ import org.onap.cps.ncmp.rest.controller.handlers.NcmpCachedResourceRequestHandl
import org.onap.cps.ncmp.rest.controller.handlers.NcmpDatastoreRequestHandler;
import org.onap.cps.ncmp.rest.controller.handlers.NcmpPassthroughResourceRequestHandler;
import org.onap.cps.ncmp.rest.mapper.CmHandleStateMapper;
-import org.onap.cps.ncmp.rest.mapper.ResourceDataBatchRequestMapper;
+import org.onap.cps.ncmp.rest.mapper.DataOperationRequestMapper;
import org.onap.cps.ncmp.rest.model.CmHandlePublicProperties;
import org.onap.cps.ncmp.rest.model.CmHandleQueryParameters;
-import org.onap.cps.ncmp.rest.model.ResourceDataBatchRequest;
+import org.onap.cps.ncmp.rest.model.DataOperationRequest;
import org.onap.cps.ncmp.rest.model.RestModuleDefinition;
import org.onap.cps.ncmp.rest.model.RestModuleReference;
import org.onap.cps.ncmp.rest.model.RestOutputCmHandle;
@@ -76,7 +76,7 @@ public class NetworkCmProxyController implements NetworkCmProxyApi {
private final CmHandleStateMapper cmHandleStateMapper;
private final NcmpCachedResourceRequestHandler ncmpCachedResourceRequestHandler;
private final NcmpPassthroughResourceRequestHandler ncmpPassthroughResourceRequestHandler;
- private final ResourceDataBatchRequestMapper resourceDataBatchRequestMapper;
+ private final DataOperationRequestMapper dataOperationRequestMapper;
/**
* Get resource data from datastore.
@@ -105,11 +105,11 @@ public class NetworkCmProxyController implements NetworkCmProxyApi {
}
@Override
- public ResponseEntity<Object> getResourceDataForCmHandleBatch(final String topicParamInQuery,
- final ResourceDataBatchRequest
- resourceDataBatchRequest) {
+ public ResponseEntity<Object> executeDataOperationForCmHandles(final String topicParamInQuery,
+ final DataOperationRequest
+ dataOperationRequest) {
return ncmpPassthroughResourceRequestHandler.executeRequest(topicParamInQuery,
- resourceDataBatchRequestMapper.toResourceDataBatchRequest(resourceDataBatchRequest));
+ dataOperationRequestMapper.toDataOperationRequest(dataOperationRequest));
}
/**
@@ -138,18 +138,18 @@ public class NetworkCmProxyController implements NetworkCmProxyApi {
/**
* Patch resource data from passthrough-running.
*
- * @param resourceIdentifier resource identifier
* @param datastoreName name of the datastore
* @param cmHandle cm handle identifier
+ * @param resourceIdentifier resource identifier
* @param requestBody the request body
* @param contentType content type of body
* @return {@code ResponseEntity} response from dmi plugin
*/
@Override
- public ResponseEntity<Object> patchResourceDataRunningForCmHandle(final String resourceIdentifier,
- final String datastoreName,
+ public ResponseEntity<Object> patchResourceDataRunningForCmHandle(final String datastoreName,
final String cmHandle,
+ final String resourceIdentifier,
final Object requestBody,
final String contentType) {
@@ -165,17 +165,17 @@ public class NetworkCmProxyController implements NetworkCmProxyApi {
/**
* Create resource data in datastore pass-through running for given cm-handle.
*
- * @param resourceIdentifier resource identifier
* @param datastoreName name of the datastore
* @param cmHandle cm handle identifier
+ * @param resourceIdentifier resource identifier
* @param requestBody the request body
* @param contentType content type of body
* @return {@code ResponseEntity} response from dmi plugin
*/
@Override
- public ResponseEntity<Void> createResourceDataRunningForCmHandle(final String resourceIdentifier,
- final String datastoreName,
+ public ResponseEntity<Void> createResourceDataRunningForCmHandle(final String datastoreName,
final String cmHandle,
+ final String resourceIdentifier,
final Object requestBody,
final String contentType) {
@@ -189,18 +189,18 @@ public class NetworkCmProxyController implements NetworkCmProxyApi {
/**
* Update resource data in datastore pass-through running for given cm-handle.
*
- * @param resourceIdentifier resource identifier
* @param datastoreName name of the datastore
* @param cmHandle cm handle identifier
+ * @param resourceIdentifier resource identifier
* @param requestBody the request body
* @param contentType content type of the body
* @return response entity
*/
@Override
- public ResponseEntity<Object> updateResourceDataRunningForCmHandle(final String resourceIdentifier,
- final String datastoreName,
+ public ResponseEntity<Object> updateResourceDataRunningForCmHandle(final String datastoreName,
final String cmHandle,
+ final String resourceIdentifier,
final Object requestBody,
final String contentType) {
validateDataStore(PASSTHROUGH_RUNNING, datastoreName);
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 a8ca13a752..101be45d37 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
@@ -31,7 +31,7 @@ import lombok.extern.slf4j.Slf4j;
import org.onap.cps.ncmp.api.impl.exception.InvalidDatastoreException;
import org.onap.cps.ncmp.api.impl.operations.DatastoreType;
import org.onap.cps.ncmp.api.impl.operations.OperationType;
-import org.onap.cps.ncmp.api.models.ResourceDataBatchRequest;
+import org.onap.cps.ncmp.api.models.DataOperationRequest;
import org.onap.cps.ncmp.rest.exceptions.OperationNotSupportedException;
import org.onap.cps.ncmp.rest.executor.CpsNcmpTaskExecutor;
import org.onap.cps.ncmp.rest.util.TopicValidator;
@@ -105,21 +105,21 @@ public class NcmpDatastoreRequestHandler implements TaskManagementDefaultHandler
}
/**
- * Executes asynchronous request for batch of cm handles to resource data.
+ * Executes asynchronous request for group of cm handles to resource data.
*
* @param topicParamInQuery the topic param in query
- * @param resourceDataBatchRequest batch request details for resource data
+ * @param dataOperationRequest data operation request details for resource data
* @return the response entity
*/
public ResponseEntity<Object> executeRequest(final String topicParamInQuery,
- final ResourceDataBatchRequest
- resourceDataBatchRequest) {
- validateBatchRequest(topicParamInQuery, resourceDataBatchRequest);
+ final DataOperationRequest
+ dataOperationRequest) {
+ validateDataOperationRequest(topicParamInQuery, dataOperationRequest);
if (!notificationFeatureEnabled) {
return ResponseEntity.ok(Map.of("status",
"Asynchronous request is unavailable as notification feature is currently disabled."));
}
- return getRequestIdAndSendBatchRequestToDmiService(topicParamInQuery, resourceDataBatchRequest);
+ return getRequestIdAndSendDataOperationRequestToDmiService(topicParamInQuery, dataOperationRequest);
}
protected ResponseEntity<Object> executeTaskAsync(final String topicParamInQuery,
@@ -152,27 +152,27 @@ public class NcmpDatastoreRequestHandler implements TaskManagementDefaultHandler
return executeTaskAsync(topicParamInQuery, requestId, taskSupplier);
}
- private ResponseEntity<Object> getRequestIdAndSendBatchRequestToDmiService(final String topicParamInQuery,
- final ResourceDataBatchRequest
- resourceDataBatchRequest) {
+ private ResponseEntity<Object> getRequestIdAndSendDataOperationRequestToDmiService(final String topicParamInQuery,
+ final DataOperationRequest
+ dataOperationRequest) {
final String requestId = UUID.randomUUID().toString();
- sendResourceDataBatchRequestAsynchronously(topicParamInQuery, resourceDataBatchRequest, requestId);
+ sendDataOperationRequestAsynchronously(topicParamInQuery, dataOperationRequest, requestId);
return ResponseEntity.ok(Map.of("requestId", requestId));
}
- private void validateBatchRequest(final String topicParamInQuery,
- final ResourceDataBatchRequest
- resourceDataBatchRequest) {
+ private void validateDataOperationRequest(final String topicParamInQuery,
+ final DataOperationRequest
+ dataOperationRequest) {
TopicValidator.validateTopicName(topicParamInQuery);
- resourceDataBatchRequest.getBatchOperationDefinitions().forEach(batchOperationDetail -> {
- if (OperationType.fromOperationName(batchOperationDetail.getOperation()) != READ) {
+ dataOperationRequest.getDataOperationDefinitions().forEach(dataOperationDetail -> {
+ if (OperationType.fromOperationName(dataOperationDetail.getOperation()) != READ) {
throw new OperationNotSupportedException(
- batchOperationDetail.getOperation() + " operation not yet supported for target ids :"
- + batchOperationDetail.getCmHandleIds());
- } else if (DatastoreType.fromDatastoreName(batchOperationDetail.getDatastore()) == OPERATIONAL) {
- throw new InvalidDatastoreException(batchOperationDetail.getDatastore()
+ dataOperationDetail.getOperation() + " operation not yet supported for target ids :"
+ + dataOperationDetail.getCmHandleIds());
+ } else if (DatastoreType.fromDatastoreName(dataOperationDetail.getDatastore()) == OPERATIONAL) {
+ throw new InvalidDatastoreException(dataOperationDetail.getDatastore()
+ " datastore is not supported for target ids : "
- + batchOperationDetail.getCmHandleIds());
+ + dataOperationDetail.getCmHandleIds());
}
});
}
diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/NcmpPassthroughResourceRequestHandler.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/NcmpPassthroughResourceRequestHandler.java
index 5c35818a3a..0e49c6df13 100644
--- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/NcmpPassthroughResourceRequestHandler.java
+++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/NcmpPassthroughResourceRequestHandler.java
@@ -22,7 +22,7 @@ package org.onap.cps.ncmp.rest.controller.handlers;
import java.util.function.Supplier;
import org.onap.cps.ncmp.api.NetworkCmProxyDataService;
-import org.onap.cps.ncmp.api.models.ResourceDataBatchRequest;
+import org.onap.cps.ncmp.api.models.DataOperationRequest;
import org.onap.cps.ncmp.rest.executor.CpsNcmpTaskExecutor;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
@@ -59,11 +59,11 @@ public class NcmpPassthroughResourceRequestHandler extends NcmpDatastoreRequestH
@Async
@Override
- public void sendResourceDataBatchRequestAsynchronously(final String topicParamInQuery,
- final ResourceDataBatchRequest
- resourceDataBatchRequest,
- final String requestId) {
- networkCmProxyDataService.requestResourceDataForCmHandleBatch(topicParamInQuery, resourceDataBatchRequest,
+ public void sendDataOperationRequestAsynchronously(final String topicParamInQuery,
+ final DataOperationRequest
+ dataOperationRequest,
+ final String requestId) {
+ networkCmProxyDataService.executeDataOperationForCmHandles(topicParamInQuery, dataOperationRequest,
requestId);
}
diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/TaskManagementDefaultHandler.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/TaskManagementDefaultHandler.java
index 937935bec4..b2520b1609 100644
--- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/TaskManagementDefaultHandler.java
+++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/TaskManagementDefaultHandler.java
@@ -21,7 +21,7 @@
package org.onap.cps.ncmp.rest.controller.handlers;
import java.util.function.Supplier;
-import org.onap.cps.ncmp.api.models.ResourceDataBatchRequest;
+import org.onap.cps.ncmp.api.models.DataOperationRequest;
import org.onap.cps.spi.FetchDescendantsOption;
public interface TaskManagementDefaultHandler {
@@ -46,10 +46,10 @@ public interface TaskManagementDefaultHandler {
return NO_OBJECT_SUPPLIER;
}
- default void sendResourceDataBatchRequestAsynchronously(final String topicParamInQuery,
- final ResourceDataBatchRequest
- resourceDataBatchRequest,
- final String requestId) {
+ default void sendDataOperationRequestAsynchronously(final String topicParamInQuery,
+ final DataOperationRequest
+ dataOperationRequest,
+ final String requestId) {
}
static FetchDescendantsOption getFetchDescendantsOption(final boolean includeDescendants) {
diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandler.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandler.java
index f459acec25..fac9489127 100755
--- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandler.java
+++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandler.java
@@ -1,7 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Pantheon.tech
- * Modifications Copyright (C) 2021-2022 Nordix Foundation
+ * Modifications Copyright (C) 2021-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.
@@ -31,7 +31,7 @@ import org.onap.cps.ncmp.api.impl.exception.ServerNcmpException;
import org.onap.cps.ncmp.rest.controller.NetworkCmProxyController;
import org.onap.cps.ncmp.rest.controller.NetworkCmProxyInventoryController;
import org.onap.cps.ncmp.rest.model.DmiErrorMessage;
-import org.onap.cps.ncmp.rest.model.DmiErrorMessageDmiresponse;
+import org.onap.cps.ncmp.rest.model.DmiErrorMessageDmiResponse;
import org.onap.cps.ncmp.rest.model.ErrorMessage;
import org.onap.cps.spi.exceptions.AlreadyDefinedException;
import org.onap.cps.spi.exceptions.AlreadyDefinedExceptionBatch;
@@ -116,7 +116,7 @@ public class NetworkCmProxyRestExceptionHandler {
final HttpStatus httpStatus,
final HttpClientRequestException httpClientRequestException) {
final var dmiErrorMessage = new DmiErrorMessage();
- final var dmiErrorResponse = new DmiErrorMessageDmiresponse();
+ final var dmiErrorResponse = new DmiErrorMessageDmiResponse();
dmiErrorResponse.setHttpCode(httpClientRequestException.getHttpStatus());
dmiErrorResponse.setBody(httpClientRequestException.getDetails());
dmiErrorMessage.setMessage(httpClientRequestException.getMessage());
diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/mapper/ResourceDataBatchRequestMapper.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/mapper/DataOperationRequestMapper.java
index d045e31610..51ee8ca174 100644
--- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/mapper/ResourceDataBatchRequestMapper.java
+++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/mapper/DataOperationRequestMapper.java
@@ -24,18 +24,18 @@ import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.NullValueCheckStrategy;
import org.mapstruct.NullValuePropertyMappingStrategy;
-import org.onap.cps.ncmp.api.models.BatchOperationDefinition;
-import org.onap.cps.ncmp.api.models.ResourceDataBatchRequest;
+import org.onap.cps.ncmp.api.models.DataOperationDefinition;
+import org.onap.cps.ncmp.api.models.DataOperationRequest;
@Mapper(componentModel = "spring", nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS,
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.SET_TO_DEFAULT)
-public interface ResourceDataBatchRequestMapper {
+public interface DataOperationRequestMapper {
- @Mapping(source = "operations", target = "batchOperationDefinitions")
- ResourceDataBatchRequest toResourceDataBatchRequest(
- org.onap.cps.ncmp.rest.model.ResourceDataBatchRequest resourceDataBatchRequest);
+ @Mapping(source = "operations", target = "dataOperationDefinitions")
+ DataOperationRequest toDataOperationRequest(
+ org.onap.cps.ncmp.rest.model.DataOperationRequest dataOperationRequest);
@Mapping(source = "targetIds", target = "cmHandleIds")
- BatchOperationDefinition toBatchOperationDefinition(
- org.onap.cps.ncmp.rest.model.BatchOperationDefinition batchOperationDefinition);
+ DataOperationDefinition toDataOperationDefinition(
+ org.onap.cps.ncmp.rest.model.DataOperationDefinition dataOperationDefinition);
}
diff --git a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy
index 31e83aa7a1..4ee31e1ec5 100644
--- a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy
+++ b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy
@@ -32,14 +32,14 @@ import org.onap.cps.ncmp.api.inventory.CmHandleState
import org.onap.cps.ncmp.api.inventory.CompositeState
import org.onap.cps.ncmp.api.inventory.DataStoreSyncState
import org.onap.cps.ncmp.api.inventory.LockReasonCategory
-import org.onap.cps.ncmp.rest.model.BatchOperationDefinition
+import org.onap.cps.ncmp.rest.model.DataOperationRequest
+import org.onap.cps.ncmp.rest.model.DataOperationDefinition
import org.onap.cps.ncmp.api.models.NcmpServiceCmHandle
import org.onap.cps.ncmp.rest.controller.handlers.NcmpCachedResourceRequestHandler
import org.onap.cps.ncmp.rest.controller.handlers.NcmpPassthroughResourceRequestHandler
import org.onap.cps.ncmp.rest.executor.CpsNcmpTaskExecutor
import org.onap.cps.ncmp.rest.mapper.CmHandleStateMapper
-import org.onap.cps.ncmp.rest.mapper.ResourceDataBatchRequestMapper
-import org.onap.cps.ncmp.rest.model.ResourceDataBatchRequest
+import org.onap.cps.ncmp.rest.mapper.DataOperationRequestMapper
import org.onap.cps.ncmp.rest.util.DeprecationHelper
import org.onap.cps.spi.FetchDescendantsOption
import org.onap.cps.spi.model.ModuleDefinition
@@ -101,7 +101,7 @@ class NetworkCmProxyControllerSpec extends Specification {
CmHandleStateMapper cmHandleStateMapper = Mappers.getMapper(CmHandleStateMapper)
@SpringBean
- ResourceDataBatchRequestMapper resourceDataBatchRequestMapper = Mappers.getMapper(ResourceDataBatchRequestMapper)
+ DataOperationRequestMapper dataOperationRequestMapper = Mappers.getMapper(DataOperationRequestMapper)
@SpringBean
CpsNcmpTaskExecutor spiedCpsTaskExecutor = Spy()
@@ -205,18 +205,18 @@ class NetworkCmProxyControllerSpec extends Specification {
'invalid non-empty topic value in url' | 'passthrough-operational' | '&topic=1_5_*_#'
}
- def 'Get (async) batch resource data from dmi service.'() {
- given: 'batch resource data url'
+ def 'Execute (async) data operation to read data from dmi service.'() {
+ given: 'data operation url'
def getUrl = "$ncmpBasePathV1/data?topic=my-topic-name"
- def resourceDataBatchRequestJsonData = jsonObjectMapper.asJsonString(
- getResourceDataBatchRequest("read", datastore.datastoreName))
- def expectedDmiResourceDataBatchRequest
- = jsonObjectMapper.convertJsonString(resourceDataBatchRequestJsonData, org.onap.cps.ncmp.api.models.ResourceDataBatchRequest.class)
- when: 'post data resource request is performed'
+ def dataOperationRequestJsonData = jsonObjectMapper.asJsonString(
+ getDataOperationRequest("read", datastore.datastoreName))
+ def expectedDmiDataOperationRequest
+ = jsonObjectMapper.convertJsonString(dataOperationRequestJsonData, org.onap.cps.ncmp.api.models.DataOperationRequest.class)
+ when: 'post data operation request is performed'
def response = mvc.perform(
post(getUrl)
.contentType(MediaType.APPLICATION_JSON)
- .content(resourceDataBatchRequestJsonData)
+ .content(dataOperationRequestJsonData)
).andReturn().response
then: 'response status is Ok'
response.status == HttpStatus.OK.value()
@@ -225,21 +225,21 @@ class NetworkCmProxyControllerSpec extends Specification {
then: 'wait a little to allow execution of service method by task executor (on separate thread)'
Thread.sleep(100)
then: 'the service has been invoked with the correct parameters '
- 1 * mockNetworkCmProxyDataService.requestResourceDataForCmHandleBatch('my-topic-name', expectedDmiResourceDataBatchRequest, _)
+ 1 * mockNetworkCmProxyDataService.executeDataOperationForCmHandles('my-topic-name', expectedDmiDataOperationRequest, _)
where: 'the following data stores are used'
datastore << [PASSTHROUGH_RUNNING, PASSTHROUGH_OPERATIONAL]
}
- def 'Get batch resource data for #scenario from dmi service.'() {
- given: 'batch resource data url'
+ def 'Execute (async) data operation for #scenario from dmi service.'() {
+ given: 'data operation url'
def getUrl = "$ncmpBasePathV1/data?topic=my-topic-name"
- def resourceDataBatchRequestJsonData = jsonObjectMapper.asJsonString(
- getResourceDataBatchRequest(operation, datastore))
+ def dataOperationRequestJsonData = jsonObjectMapper.asJsonString(
+ getDataOperationRequest(operation, datastore))
when: 'post data resource request is performed'
def response = mvc.perform(
post(getUrl)
.contentType(MediaType.APPLICATION_JSON)
- .content(resourceDataBatchRequestJsonData)
+ .content(dataOperationRequestJsonData)
).andReturn().response
then: 'response status is BAD_REQUEST'
response.status == HttpStatus.BAD_REQUEST.value()
@@ -250,17 +250,17 @@ class NetworkCmProxyControllerSpec extends Specification {
'non-supported operation (passthrough-operational)' | PASSTHROUGH_OPERATIONAL.datastoreName | 'create'
}
- def 'Get batch resource data when notification feature is disabled for datastore: #datastore.'() {
- given: 'batch resource data url'
+ def 'Get data operation resource data when notification feature is disabled for datastore: #datastore.'() {
+ given: 'data operation url'
def getUrl = "$ncmpBasePathV1/data?topic=my-topic-name"
- def resourceDataBatchRequestJsonData = jsonObjectMapper.asJsonString(
- getResourceDataBatchRequest("read", datastore.datastoreName))
+ def dataOperationRequestJsonData = jsonObjectMapper.asJsonString(
+ getDataOperationRequest("read", datastore.datastoreName))
ncmpPassthroughResourceRequestHandler.notificationFeatureEnabled = false
when: 'post data resource request is performed'
def response = mvc.perform(
post(getUrl)
.contentType(MediaType.APPLICATION_JSON)
- .content(resourceDataBatchRequestJsonData)
+ .content(dataOperationRequestJsonData)
).andReturn().response
then: 'response status is Ok'
response.status == HttpStatus.OK.value()
@@ -686,22 +686,23 @@ class NetworkCmProxyControllerSpec extends Specification {
return assertContainsAll(response, expectedContent)
}
- def getResourceDataBatchRequest(operation, datastore) {
- def resourceDataBatchRequest = new ResourceDataBatchRequest()
- def batchOperationDefinitions = new ArrayList()
- batchOperationDefinitions.add(getBatchOperationDefinition(operation, datastore))
- resourceDataBatchRequest.addOperationsItem(batchOperationDefinitions)
+ def getDataOperationRequest(operation, datastore) {
+ def dataOperationRequest = new DataOperationRequest()
+ def dataOperationDefinitions = new ArrayList()
+ dataOperationDefinitions.add(getDataOperationDefinition(operation, datastore))
+ dataOperationRequest.addOperationsItem(dataOperationDefinitions)
+ return dataOperationRequest
}
- def getBatchOperationDefinition(operation, datastore) {
- def batchOperationDefinition = new BatchOperationDefinition()
- batchOperationDefinition.setOperation(operation)
- batchOperationDefinition.setOperationId("operational-12")
- batchOperationDefinition.setDatastore(datastore)
- batchOperationDefinition.setOptions("some option")
- batchOperationDefinition.setResourceIdentifier("some resource identifier")
- batchOperationDefinition.addTargetIdsItem("some-cm-handle")
- return batchOperationDefinition
+ def getDataOperationDefinition(operation, datastore) {
+ def dataOperationDefinition = new DataOperationDefinition()
+ dataOperationDefinition.setOperation(operation)
+ dataOperationDefinition.setOperationId("operational-12")
+ dataOperationDefinition.setDatastore(datastore)
+ dataOperationDefinition.setOptions("some option")
+ dataOperationDefinition.setResourceIdentifier("some resource identifier")
+ dataOperationDefinition.addTargetIdsItem("some-cm-handle")
+ return dataOperationDefinition
}
}
diff --git a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandlerSpec.groovy b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandlerSpec.groovy
index a3afc5546f..6dc537c8d2 100644
--- a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandlerSpec.groovy
+++ b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandlerSpec.groovy
@@ -1,7 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2021 highstreet technologies GmbH
- * Modifications Copyright (C) 2021-2022 Nordix Foundation
+ * Modifications Copyright (C) 2021-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.
@@ -33,7 +33,7 @@ import org.onap.cps.ncmp.rest.controller.handlers.NcmpCachedResourceRequestHandl
import org.onap.cps.ncmp.rest.controller.handlers.NcmpPassthroughResourceRequestHandler
import org.onap.cps.ncmp.rest.executor.CpsNcmpTaskExecutor
import org.onap.cps.ncmp.rest.mapper.CmHandleStateMapper
-import org.onap.cps.ncmp.rest.mapper.ResourceDataBatchRequestMapper
+import org.onap.cps.ncmp.rest.mapper.DataOperationRequestMapper
import org.onap.cps.ncmp.rest.util.DeprecationHelper
import org.onap.cps.spi.exceptions.AlreadyDefinedException
import org.onap.cps.spi.exceptions.AlreadyDefinedExceptionBatch
@@ -76,7 +76,7 @@ class NetworkCmProxyRestExceptionHandlerSpec extends Specification {
CmHandleStateMapper cmHandleStateMapper = Mappers.getMapper(CmHandleStateMapper)
@SpringBean
- ResourceDataBatchRequestMapper resourceDataBatchRequestMapper = Mappers.getMapper(ResourceDataBatchRequestMapper)
+ DataOperationRequestMapper dataOperationRequestMapper = Mappers.getMapper(DataOperationRequestMapper)
@SpringBean
CpsNcmpTaskExecutor stubbedCpsTaskExecutor = Stub()