<modelVersion>4.0.0</modelVersion>
<groupId>org.onap.cps</groupId>
<artifactId>checkstyle</artifactId>
- <version>3.4.6-SNAPSHOT</version>
+ <version>3.4.7-SNAPSHOT</version>
<profiles>
<profile>
<parent>
<groupId>org.onap.cps</groupId>
<artifactId>cps-parent</artifactId>
- <version>3.4.6-SNAPSHOT</version>
+ <version>3.4.7-SNAPSHOT</version>
<relativePath>../cps-parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.onap.cps</groupId>
<artifactId>cps-bom</artifactId>
- <version>3.4.6-SNAPSHOT</version>
+ <version>3.4.7-SNAPSHOT</version>
<packaging>pom</packaging>
<description>This artifact contains dependencyManagement declarations of all published CPS components.</description>
<modelVersion>4.0.0</modelVersion>
<groupId>org.onap.cps</groupId>
<artifactId>cps-dependencies</artifactId>
- <version>3.4.6-SNAPSHOT</version>
+ <version>3.4.7-SNAPSHOT</version>
<packaging>pom</packaging>
<name>${project.groupId}:${project.artifactId}</name>
<parent>
<groupId>org.onap.cps</groupId>
<artifactId>cps-parent</artifactId>
- <version>3.4.6-SNAPSHOT</version>
+ <version>3.4.7-SNAPSHOT</version>
<relativePath>../cps-parent/pom.xml</relativePath>
</parent>
<parent>
<groupId>org.onap.cps</groupId>
<artifactId>cps-parent</artifactId>
- <version>3.4.6-SNAPSHOT</version>
+ <version>3.4.7-SNAPSHOT</version>
<relativePath>../cps-parent/pom.xml</relativePath>
</parent>
<parent>
<groupId>org.onap.cps</groupId>
<artifactId>cps-ncmp-rest-stub</artifactId>
- <version>3.4.6-SNAPSHOT</version>
+ <version>3.4.7-SNAPSHOT</version>
</parent>
<artifactId>cps-ncmp-rest-stub-app</artifactId>
<parent>
<groupId>org.onap.cps</groupId>
<artifactId>cps-ncmp-rest-stub</artifactId>
- <version>3.4.6-SNAPSHOT</version>
+ <version>3.4.7-SNAPSHOT</version>
</parent>
<artifactId>cps-ncmp-rest-stub-service</artifactId>
<parent>
<groupId>org.onap.cps</groupId>
<artifactId>cps-parent</artifactId>
- <version>3.4.6-SNAPSHOT</version>
+ <version>3.4.7-SNAPSHOT</version>
<relativePath>../cps-parent/pom.xml</relativePath>
</parent>
<parent>
<groupId>org.onap.cps</groupId>
<artifactId>cps-parent</artifactId>
- <version>3.4.6-SNAPSHOT</version>
+ <version>3.4.7-SNAPSHOT</version>
<relativePath>../cps-parent/pom.xml</relativePath>
</parent>
final DataOperationRequest dataOperationRequest,
final String authorization) {
return ncmpPassthroughResourceRequestHandler.executeRequest(topicParamInQuery,
- dataOperationRequestMapper.toDataOperationRequest(dataOperationRequest));
+ dataOperationRequestMapper.toDataOperationRequest(dataOperationRequest), authorization);
}
/**
*
* @param topicParamInQuery the topic param in query
* @param dataOperationRequest data operation request details for resource data
+ * @param authorization contents of Authorization header, or null if not present
* @return the response entity
*/
public ResponseEntity<Object> executeRequest(final String topicParamInQuery,
- final DataOperationRequest
- dataOperationRequest) {
+ final DataOperationRequest dataOperationRequest,
+ final String authorization) {
validateDataOperationRequest(topicParamInQuery, dataOperationRequest);
if (!notificationFeatureEnabled) {
return ResponseEntity.ok(Map.of("status",
"Asynchronous request is unavailable as notification feature is currently disabled."));
}
- return getRequestIdAndSendDataOperationRequestToDmiService(topicParamInQuery, dataOperationRequest);
+ return getRequestIdAndSendDataOperationRequestToDmiService(topicParamInQuery, dataOperationRequest,
+ authorization);
}
@Override
authorization);
}
- private ResponseEntity<Object> getRequestIdAndSendDataOperationRequestToDmiService(final String topicParamInQuery,
- final DataOperationRequest
- dataOperationRequest) {
+ private ResponseEntity<Object> getRequestIdAndSendDataOperationRequestToDmiService(
+ final String topicParamInQuery,
+ final DataOperationRequest dataOperationRequest,
+ final String authorization) {
final String requestId = UUID.randomUUID().toString();
cpsNcmpTaskExecutor.executeTask(
- getTaskSupplierForDataOperationRequest(topicParamInQuery, dataOperationRequest, requestId),
+ getTaskSupplierForDataOperationRequest(topicParamInQuery, dataOperationRequest, requestId, authorization),
timeOutInMilliSeconds);
return ResponseEntity.ok(Map.of("requestId", requestId));
}
private Supplier<Object> getTaskSupplierForDataOperationRequest(final String topicParamInQuery,
final DataOperationRequest dataOperationRequest,
- final String requestId) {
+ final String requestId,
+ final String authorization) {
return () -> {
networkCmProxyDataService.executeDataOperationForCmHandles(topicParamInQuery,
dataOperationRequest,
- requestId);
+ requestId,
+ authorization);
return noReturn;
};
}
and: 'notification feature is turned on/off'
objectUnderTest.notificationFeatureEnabled = notificationFeatureEnabled
when: 'data operation request is executed'
- objectUnderTest.executeRequest('someTopic', new DataOperationRequest())
+ objectUnderTest.executeRequest('someTopic', new DataOperationRequest(), NO_AUTH_HEADER)
then: 'the task is executed in an async fashion or not'
expectedCalls * spiedCpsNcmpTaskExecutor.executeTask(*_)
where: 'the following parameters are used'
and: ' a flag to track the network service call'
def networkServiceMethodCalled = false
and: 'the (mocked) service will use the flag to indicate it is called'
- mockNetworkCmProxyDataService.executeDataOperationForCmHandles('myTopic', dataOperationRequest, _) >> {
+ mockNetworkCmProxyDataService.executeDataOperationForCmHandles('myTopic', dataOperationRequest, _, NO_AUTH_HEADER) >> {
networkServiceMethodCalled = true
}
when: 'data operation request is executed'
- objectUnderTest.executeRequest('myTopic', dataOperationRequest)
+ objectUnderTest.executeRequest('myTopic', dataOperationRequest, NO_AUTH_HEADER)
then: 'the task is executed in an async fashion'
1 * spiedCpsNcmpTaskExecutor.executeTask(*_)
and: 'the network service is invoked'
def dataOperationDefinition = new DataOperationDefinition(operation: 'read', datastore: datastore)
when: 'data operation request is executed'
def dataOperationRequest = new DataOperationRequest(dataOperationDefinitions: [dataOperationDefinition])
- objectUnderTest.executeRequest('myTopic', dataOperationRequest)
+ objectUnderTest.executeRequest('myTopic', dataOperationRequest, NO_AUTH_HEADER)
then: 'the correct error is thrown'
def thrown = thrown(InvalidDatastoreException)
assert thrown.message.contains(expectedErrorMessage)
and: 'a data operation definition with operation: #operation'
def dataOperationDefinition = new DataOperationDefinition(operation: operation, datastore: 'ncmp-datastore:passthrough-running')
when: 'bulk request is executed'
- objectUnderTest.executeRequest('someTopic', new DataOperationRequest(dataOperationDefinitions:[dataOperationDefinition]))
+ objectUnderTest.executeRequest('someTopic', new DataOperationRequest(dataOperationDefinitions:[dataOperationDefinition]), NO_AUTH_HEADER)
then: 'the expected type of exception is thrown'
thrown(expectedException)
where: 'the following operations are used'
<parent>
<groupId>org.onap.cps</groupId>
<artifactId>cps-parent</artifactId>
- <version>3.4.6-SNAPSHOT</version>
+ <version>3.4.7-SNAPSHOT</version>
<relativePath>../cps-parent/pom.xml</relativePath>
</parent>
*
* @param topicParamInQuery topic name for (triggering) async responses
* @param dataOperationRequest contains a list of operation definitions(multiple operations)
+ * @param requestId request ID
+ * @param authorization contents of Authorization header, or null if not present
*/
void executeDataOperationForCmHandles(String topicParamInQuery,
DataOperationRequest dataOperationRequest,
- String requestId);
+ String requestId,
+ String authorization);
/**
@Override
public void executeDataOperationForCmHandles(final String topicParamInQuery,
- final DataOperationRequest
- dataOperationRequest,
- final String requestId) {
- dmiDataOperations.requestResourceDataFromDmi(topicParamInQuery, dataOperationRequest, requestId);
+ final DataOperationRequest dataOperationRequest,
+ final String requestId,
+ final String authorization) {
+ dmiDataOperations.requestResourceDataFromDmi(topicParamInQuery, dataOperationRequest, requestId,
+ authorization);
}
@Override
* @param topicParamInQuery topic name for (triggering) async responses
* @param dataOperationRequest data operation request to execute operations
* @param requestId requestId for as a response
+ * @param authorization contents of Authorization header, or null if not present
*/
public void requestResourceDataFromDmi(final String topicParamInQuery,
final DataOperationRequest dataOperationRequest,
- final String requestId) {
+ final String requestId,
+ final String authorization) {
final Set<String> cmHandlesIds
= getDistinctCmHandleIdsFromDataOperationRequest(dataOperationRequest);
= ResourceDataOperationRequestUtils.processPerDefinitionInDataOperationsRequest(topicParamInQuery,
requestId, dataOperationRequest, yangModelCmHandles);
- buildDataOperationRequestUrlAndSendToDmiService(topicParamInQuery, requestId, operationsOutPerDmiServiceName);
+ buildDataOperationRequestUrlAndSendToDmiService(topicParamInQuery, requestId, operationsOutPerDmiServiceName,
+ authorization);
}
/**
private void buildDataOperationRequestUrlAndSendToDmiService(final String topicParamInQuery,
final String requestId,
final Map<String, List<DmiDataOperation>>
- groupsOutPerDmiServiceName) {
+ groupsOutPerDmiServiceName,
+ final String authorization) {
groupsOutPerDmiServiceName.forEach((dmiServiceName, dmiDataOperationRequestBodies) -> {
final String dmiDataOperationResourceUrl =
getDmiServiceDataOperationRequestUrl(dmiServiceName, topicParamInQuery, requestId);
- sendDataOperationRequestToDmiService(dmiDataOperationResourceUrl, dmiDataOperationRequestBodies);
+ sendDataOperationRequestToDmiService(dmiDataOperationResourceUrl, dmiDataOperationRequestBodies,
+ authorization);
});
}
private void sendDataOperationRequestToDmiService(final String dataOperationResourceUrl,
- final List<DmiDataOperation> dmiDataOperationRequestBodies) {
+ final List<DmiDataOperation> dmiDataOperationRequestBodies,
+ final String authorization) {
final DmiDataOperationRequest dmiDataOperationRequest = DmiDataOperationRequest.builder()
.operations(dmiDataOperationRequestBodies).build();
final String dmiDataOperationRequestAsJsonString =
jsonObjectMapper.asJsonString(dmiDataOperationRequest);
TaskExecutor.executeTask(() -> dmiRestClient.postOperationWithJsonData(dataOperationResourceUrl,
- dmiDataOperationRequestAsJsonString, READ, null),
+ dmiDataOperationRequestAsJsonString, READ, authorization),
DEFAULT_ASYNC_TASK_EXECUTOR_TIMEOUT_IN_MILLISECONDS)
.whenCompleteAsync((response, throwable) -> handleTaskCompletionException(throwable,
dataOperationResourceUrl, dmiDataOperationRequestBodies));
given: 'cpsDataService returns valid data node'
def dataOperationRequest = getDataOperationRequest(datastoreName)
when: 'request resource data for data operation is called'
- objectUnderTest.executeDataOperationForCmHandles('some topic', dataOperationRequest, 'requestId')
+ objectUnderTest.executeDataOperationForCmHandles('some topic', dataOperationRequest, 'requestId', NO_AUTH_HEADER)
then: 'request resource data for data operation returns expected response'
- 1 * mockDmiDataOperations.requestResourceDataFromDmi('some topic', dataOperationRequest, 'requestId')
+ 1 * mockDmiDataOperations.requestResourceDataFromDmi('some topic', dataOperationRequest, 'requestId', NO_AUTH_HEADER)
where: 'the following data stores are used'
datastoreName << [PASSTHROUGH_RUNNING.datastoreName, PASSTHROUGH_OPERATIONAL.datastoreName]
}
postOperationWithJsonDataMethodCalled = true
}
when: 'get resource data for group of cm handles are invoked'
- objectUnderTest.requestResourceDataFromDmi('my-topic-name', dataOperationRequest, 'requestId')
+ objectUnderTest.requestResourceDataFromDmi('my-topic-name', dataOperationRequest, 'requestId', NO_AUTH_HEADER)
then: 'validate the post operation was called and ncmp generated dmi request body json args'
new PollingConditions().within(1) {
assert postOperationWithJsonDataMethodCalled == true
<groupId>org.onap.cps</groupId>
<artifactId>cps-parent</artifactId>
- <version>3.4.6-SNAPSHOT</version>
+ <version>3.4.7-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<parent>
<groupId>org.onap.cps</groupId>
<artifactId>cps-parent</artifactId>
- <version>3.4.6-SNAPSHOT</version>
+ <version>3.4.7-SNAPSHOT</version>
<relativePath>../cps-parent/pom.xml</relativePath>
</parent>
<parent>
<groupId>org.onap.cps</groupId>
<artifactId>cps-parent</artifactId>
- <version>3.4.6-SNAPSHOT</version>
+ <version>3.4.7-SNAPSHOT</version>
<relativePath>../cps-parent/pom.xml</relativePath>
</parent>
<parent>\r
<groupId>org.onap.cps</groupId>\r
<artifactId>cps-parent</artifactId>\r
- <version>3.4.6-SNAPSHOT</version>\r
+ <version>3.4.7-SNAPSHOT</version>\r
<relativePath>../cps-parent/pom.xml</relativePath>\r
</parent>\r
\r
<parent>
<groupId>org.onap.cps</groupId>
<artifactId>cps-parent</artifactId>
- <version>3.4.6-SNAPSHOT</version>
+ <version>3.4.7-SNAPSHOT</version>
<relativePath>../cps-parent/pom.xml</relativePath>
</parent>
<parent>
<groupId>org.onap.cps</groupId>
<artifactId>dmi-plugin-demo-and-csit-stub</artifactId>
- <version>3.4.6-SNAPSHOT</version>
+ <version>3.4.7-SNAPSHOT</version>
</parent>
<artifactId>dmi-plugin-demo-and-csit-stub-app</artifactId>
<parent>
<groupId>org.onap.cps</groupId>
<artifactId>dmi-plugin-demo-and-csit-stub</artifactId>
- <version>3.4.6-SNAPSHOT</version>
+ <version>3.4.7-SNAPSHOT</version>
</parent>
<artifactId>dmi-plugin-demo-and-csit-stub-service</artifactId>
<parent>
<groupId>org.onap.cps</groupId>
<artifactId>cps-parent</artifactId>
- <version>3.4.6-SNAPSHOT</version>
+ <version>3.4.7-SNAPSHOT</version>
<relativePath>../cps-parent/pom.xml</relativePath>
</parent>
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized request
- details: This request is unauthorized
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized request
- details: This request is unauthorized
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized request
- details: This request is unauthorized
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized request
- details: This request is unauthorized
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized request
- details: This request is unauthorized
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized request
- details: This request is unauthorized
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized request
- details: This request is unauthorized
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized request
- details: This request is unauthorized
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized request
- details: This request is unauthorized
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized request
- details: This request is unauthorized
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized request
- details: This request is unauthorized
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized request
- details: This request is unauthorized
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized request
- details: This request is unauthorized
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized request
- details: This request is unauthorized
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized request
- details: This request is unauthorized
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized request
- details: This request is unauthorized
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized request
- details: This request is unauthorized
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized request
- details: This request is unauthorized
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized request
- details: This request is unauthorized
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized request
- details: This request is unauthorized
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized request
- details: This request is unauthorized
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized request
- details: This request is unauthorized
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized request
- details: This request is unauthorized
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized request
- details: This request is unauthorized
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized request
- details: This request is unauthorized
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized request
- details: This request is unauthorized
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized request
- details: This request is unauthorized
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized request
- details: This request is unauthorized
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- Unauthorized:
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized request
- details: This request is unauthorized
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
Forbidden:
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized error message
- details: Unauthorized error details
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
type: string
type: array
description: OK
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized error message
- details: Unauthorized error details
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
type: string
type: array
description: OK
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized error message
- details: Unauthorized error details
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- Unauthorized:
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized error message
- details: Unauthorized error details
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
Forbidden:
content:
application/json:
default: application/json
example: application/yang-data+json
type: string
+ - description: Authorization parameter for request.
+ in: header
+ name: Authorization
+ required: false
+ schema:
+ type: string
responses:
"204":
content: {}
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized error message
- details: Unauthorized error details
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
default: false
type: boolean
+ - description: Authorization parameter for request.
+ in: header
+ name: Authorization
+ required: false
+ schema:
+ type: string
responses:
"200":
content:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized error message
- details: Unauthorized error details
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
default: application/json
example: application/yang-data+json
type: string
+ - description: Authorization parameter for request.
+ in: header
+ name: Authorization
+ required: false
+ schema:
+ type: string
requestBody:
content:
'*/*':
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized error message
- details: Unauthorized error details
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
default: application/json
example: application/yang-data+json
type: string
+ - description: Authorization parameter for request.
+ in: header
+ name: Authorization
+ required: false
+ schema:
+ type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized error message
- details: Unauthorized error details
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
default: application/json
example: application/yang-data+json
type: string
+ - description: Authorization parameter for request.
+ in: header
+ name: Authorization
+ required: false
+ schema:
+ type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized error message
- details: Unauthorized error details
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
required: true
schema:
type: string
+ - description: Authorization parameter for request.
+ in: header
+ name: Authorization
+ required: false
+ schema:
+ type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized error message
- details: Unauthorized error details
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized error message
- details: Unauthorized error details
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized error message
- details: Unauthorized error details
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
$ref: '#/components/schemas/RestModuleDefinition'
type: array
description: OK
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized error message
- details: Unauthorized error details
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized error message
- details: Unauthorized error details
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized error message
- details: Unauthorized error details
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"404":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized error message
- details: Unauthorized error details
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"404":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized error message
- details: Unauthorized error details
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized error message
- details: Unauthorized error details
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"404":
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- "401":
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized error message
- details: Unauthorized error details
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
"403":
content:
application/json:
schema:
default: false
type: boolean
+ authorizationParamInHeader:
+ description: Authorization parameter for request.
+ in: header
+ name: Authorization
+ required: false
+ schema:
+ type: string
contentParamInHeader:
description: "Content parameter for request, if content parameter is null, default\
\ value is application/json."
schema:
$ref: '#/components/schemas/ErrorMessage'
description: Bad Request
- Unauthorized:
- content:
- application/json:
- example:
- status: 401
- message: Unauthorized error message
- details: Unauthorized error details
- schema:
- $ref: '#/components/schemas/ErrorMessage'
- description: Unauthorized
Forbidden:
content:
application/json:
.. * * * NEW DELHI * * *
.. =========================
+Version: 3.4.7
+==============
+
+Release Data
+------------
+
++--------------------------------------+--------------------------------------------------------+
+| **CPS Project** | |
+| | |
++--------------------------------------+--------------------------------------------------------+
+| **Docker images** | onap/cps-and-ncmp:3.4.7 |
+| | |
++--------------------------------------+--------------------------------------------------------+
+| **Release designation** | 3.4.7 New Delhi |
+| | |
++--------------------------------------+--------------------------------------------------------+
+| **Release date** | Not yet released |
+| | |
++--------------------------------------+--------------------------------------------------------+
+
+Bug Fixes
+---------
+3.4.7
+
+Features
+--------
+
Version: 3.4.6
==============
| **Release designation** | 3.4.6 New Delhi |
| | |
+--------------------------------------+--------------------------------------------------------+
-| **Release date** | Not yet released |
+| **Release date** | 2024 February 29 |
| | |
+--------------------------------------+--------------------------------------------------------+
Bug Fixes
---------
3.4.6
+ - `CPS-2126 <https://jira.onap.org/browse/CPS-2126>`_ Passing HTTP Authorization Bearer Token to DMI Plugins.
Features
--------
+ - `CPS-2133 <https://jira.onap.org/browse/CPS-2133>`_ Revert Uplift of Spring Boot version from 3.2.2 to 3.1.2
+
+Notes
+-----
+This release brings improvements to compatibility with Service Mesh and for that below measures are been taken.
+
+Basic authorization provided using Spring security is been removed from CPS-Core and NCMP and hence authorization is no longer enforced.(basic auth header will be ignored, but is still allowed).
+NCMP will propagate a bearer token to DMI conditionally.
+401 Unauthorized will not be returned. Best effort has been made to ensure backwards compatibility.
Version: 3.4.5
==============
<parent>
<groupId>org.onap.cps</groupId>
<artifactId>cps-parent</artifactId>
- <version>3.4.6-SNAPSHOT</version>
+ <version>3.4.7-SNAPSHOT</version>
<relativePath>../cps-parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
import org.springframework.boot.autoconfigure.domain.EntityScan
+import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.context.annotation.ComponentScan
import org.springframework.data.jpa.repository.config.EnableJpaRepositories
import org.springframework.http.HttpStatus
import org.springframework.http.MediaType
import org.springframework.test.web.client.MockRestServiceServer
+import org.springframework.test.web.servlet.MockMvc
import org.springframework.web.client.RestTemplate
import org.testcontainers.spock.Testcontainers
import spock.lang.Shared
import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo
import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus
-@SpringBootTest(classes = [CpsDataspaceService])
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.MOCK, classes = [CpsDataspaceService])
@Testcontainers
@EnableAutoConfiguration
+@AutoConfigureMockMvc
@EnableJpaRepositories(basePackageClasses = [DataspaceRepository])
@ComponentScan(basePackages = ['org.onap.cps'])
@EntityScan('org.onap.cps.spi.entities')
@Shared
DatabaseTestContainer databaseTestContainer = DatabaseTestContainer.getInstance()
+ @Autowired
+ MockMvc mvc;
+
@Autowired
CpsDataspaceService cpsDataspaceService
--- /dev/null
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2024 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.integration.functional
+
+import java.time.Duration
+import org.onap.cps.integration.base.CpsIntegrationSpecBase
+import org.springframework.http.HttpHeaders
+import org.springframework.http.HttpStatus
+import org.springframework.http.MediaType
+import org.springframework.test.web.client.match.MockRestRequestMatchers
+
+import static org.springframework.http.HttpMethod.GET
+import static org.springframework.http.HttpMethod.DELETE
+import static org.springframework.http.HttpMethod.PATCH
+import static org.springframework.http.HttpMethod.POST
+import static org.springframework.http.HttpMethod.PUT
+import static org.springframework.test.web.client.match.MockRestRequestMatchers.method
+import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo
+import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.request
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status
+
+class NcmpBearerTokenPassthroughSpec extends CpsIntegrationSpecBase {
+
+ static final NO_MODULE_SET_TAG = ''
+ static final MODULE_REFERENCES_RESPONSE = readResourceDataFile('mock-dmi-responses/bookStoreAWithModules_M1_M2_Response.json')
+ static final MODULE_RESOURCES_RESPONSE = readResourceDataFile('mock-dmi-responses/bookStoreAWithModules_M1_M2_ResourcesResponse.json')
+
+ def setup() {
+ registerCmHandle(DMI_URL, 'ch-1', NO_MODULE_SET_TAG, MODULE_REFERENCES_RESPONSE, MODULE_RESOURCES_RESPONSE)
+ }
+
+ def cleanup() {
+ deregisterCmHandle(DMI_URL, 'ch-1')
+ }
+
+ def 'Bearer token is passed from NCMP to DMI in pass-through data operations.'() {
+ given: 'DMI will expect to receive a request with a bearer token'
+ def targetDmiUrl = "$DMI_URL/dmi/v1/ch/ch-1/data/ds/ncmp-datastore:passthrough-running?resourceIdentifier=my-resource-id"
+ mockDmiServer.expect(requestTo(targetDmiUrl))
+ .andExpect(MockRestRequestMatchers.header(HttpHeaders.AUTHORIZATION, 'Bearer some-bearer-token'))
+ .andRespond(withStatus(HttpStatus.OK).contentType(MediaType.APPLICATION_JSON))
+
+ when: 'a pass-through data request is sent to NCMP with a bearer token'
+ mvc.perform(request(httpMethod, '/ncmp/v1/ch/ch-1/data/ds/ncmp-datastore:passthrough-running')
+ .queryParam('resourceIdentifier', 'my-resource-id')
+ .contentType(MediaType.APPLICATION_JSON)
+ .content('{ "some-json": "data" }')
+ .header(HttpHeaders.AUTHORIZATION, 'Bearer some-bearer-token'))
+ .andExpect(status().is2xxSuccessful())
+
+ then: 'DMI has received request with bearer token'
+ mockDmiServer.verify()
+
+ where: 'all HTTP operations are applied'
+ httpMethod << [GET, POST, PUT, PATCH, DELETE]
+ }
+
+ def 'Basic auth header is NOT passed from NCMP to DMI in pass-through data operations.'() {
+ given: 'DMI will expect to receive a request with no authorization header'
+ def targetDmiUrl = "$DMI_URL/dmi/v1/ch/ch-1/data/ds/ncmp-datastore:passthrough-running?resourceIdentifier=my-resource-id"
+ mockDmiServer.expect(requestTo(targetDmiUrl))
+ .andExpect(MockRestRequestMatchers.headerDoesNotExist(HttpHeaders.AUTHORIZATION))
+ .andRespond(withStatus(HttpStatus.OK).contentType(MediaType.APPLICATION_JSON))
+
+ when: 'a pass-through data request is sent to NCMP with basic authentication'
+ mvc.perform(request(httpMethod, '/ncmp/v1/ch/ch-1/data/ds/ncmp-datastore:passthrough-running')
+ .queryParam('resourceIdentifier', 'my-resource-id')
+ .contentType(MediaType.APPLICATION_JSON)
+ .content('{ "some-json": "data" }')
+ .header(HttpHeaders.AUTHORIZATION, 'Basic Y3BzdXNlcjpjcHNyMGNrcyE='))
+ .andExpect(status().is2xxSuccessful())
+
+ then: 'DMI has received request with no authorization header'
+ mockDmiServer.verify()
+
+ where: 'all HTTP operations are applied'
+ httpMethod << [GET, POST, PUT, PATCH, DELETE]
+ }
+
+ def 'Bearer token is passed from NCMP to DMI in async batch pass-through data operation.'() {
+ given: 'DMI will expect to receive a request with a bearer token'
+ mockDmiServer.expect(method(POST))
+ .andExpect(MockRestRequestMatchers.header(HttpHeaders.AUTHORIZATION, 'Bearer some-bearer-token'))
+ .andRespond(withStatus(HttpStatus.OK).contentType(MediaType.APPLICATION_JSON))
+
+ when: 'a pass-through async data request is sent to NCMP with a bearer token'
+ def requestBody = """{"operations": [{
+ "operation": "read",
+ "operationId": "operational-1",
+ "datastore": "ncmp-datastore:passthrough-running",
+ "resourceIdentifier": "my-resource-id",
+ "targetIds": ["ch-1"]
+ }]}"""
+ mvc.perform(request(POST, '/ncmp/v1/data')
+ .queryParam('topic', 'my-topic')
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(requestBody)
+ .header(HttpHeaders.AUTHORIZATION, 'Bearer some-bearer-token'))
+ .andExpect(status().is2xxSuccessful())
+
+ then: 'DMI will receive the async request with bearer token'
+ mockDmiServer.verify(Duration.ofSeconds(1))
+ }
+
+}
topic: ${DMI_DEVICE_HEARTBEAT_TOPIC:dmi-device-heartbeat}
notification:
- enabled: false
+ enabled: true
async:
executor:
core-pool-size: 2
<parent>
<groupId>org.onap.cps</groupId>
<artifactId>cps-parent</artifactId>
- <version>3.4.6-SNAPSHOT</version>
+ <version>3.4.7-SNAPSHOT</version>
<relativePath>../cps-parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
\r
<groupId>org.onap.cps</groupId>\r
<artifactId>cps-aggregator</artifactId>\r
- <version>3.4.6-SNAPSHOT</version>\r
+ <version>3.4.7-SNAPSHOT</version>\r
<packaging>pom</packaging>\r
\r
<name>cps</name>\r
--- /dev/null
+distribution_type: container
+container_release_tag: 3.4.6
+project: cps
+log_dir: cps-maven-docker-stage-master/938/
+ref: 4a978d3c66da16bc96b54cba807138fc9b0c79fa
+containers:
+ - name: 'cps-and-ncmp'
+ version: '3.4.6-20240229T165311Z'
--- /dev/null
+distribution_type: maven
+log_dir: cps-maven-stage-master/946/
+project: cps
+version: 3.4.6
\ No newline at end of file
<modelVersion>4.0.0</modelVersion>
<groupId>org.onap.cps</groupId>
<artifactId>spotbugs</artifactId>
- <version>3.4.6-SNAPSHOT</version>
+ <version>3.4.7-SNAPSHOT</version>
<properties>
<nexusproxy>https://nexus.onap.org</nexusproxy>
major=3
minor=4
-patch=6
+patch=7
base_version=${major}.${minor}.${patch}