summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--INFO.yaml2
-rw-r--r--docs/api/swagger/openapi.yaml20
-rw-r--r--docs/release-notes.rst27
-rw-r--r--openapi/components.yml16
-rw-r--r--openapi/openapi.yml1
-rw-r--r--pom.xml2
-rw-r--r--releases/1.5.0-container.yaml9
-rw-r--r--releases/1.5.0.yaml4
-rw-r--r--src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java5
-rw-r--r--src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/DmiRestControllerSpec.groovy53
-rw-r--r--src/test/resources/moduleResources.json3
-rw-r--r--version.properties2
12 files changed, 137 insertions, 7 deletions
diff --git a/INFO.yaml b/INFO.yaml
index 63ebd6b3..c96b1580 100644
--- a/INFO.yaml
+++ b/INFO.yaml
@@ -19,7 +19,7 @@
---
project: 'ncmp-dmi-plugin'
project_creation_date: '2021-05-24'
-lifecycle_state: 'Incubation'
+lifecycle_state: 'Mature'
project_category: ''
project_lead: &onap_releng_ptl
name: 'Toine Siebelink'
diff --git a/docs/api/swagger/openapi.yaml b/docs/api/swagger/openapi.yaml
index 4e3ae897..5782a9c8 100644
--- a/docs/api/swagger/openapi.yaml
+++ b/docs/api/swagger/openapi.yaml
@@ -209,6 +209,15 @@ paths:
required: false
schema:
type: string
+ - name: moduleSetTag
+ description: Module set tag of the given cm handle.
+ in: query
+ examples:
+ sample1:
+ value: module-set-tag1
+ required: false
+ schema:
+ type: string
requestBody:
content:
application/json:
@@ -379,6 +388,16 @@ components:
required: false
schema:
type: string
+ moduleSetTagParamInQuery:
+ name: moduleSetTag
+ in: query
+ description: Module set tag of the given cm handle.
+ required: false
+ schema:
+ type: string
+ examples:
+ sample1:
+ value: module-set-tag1
requiredTopicParamInQuery:
allowReserved: true
description: mandatory topic name passed from client(NCMP).
@@ -493,6 +512,7 @@ components:
type: object
ModuleResourcesReadRequest:
example:
+ moduleSetTag: module-set-tag1
data:
modules:
- name: my-name
diff --git a/docs/release-notes.rst b/docs/release-notes.rst
index 209c9897..75ece03f 100644
--- a/docs/release-notes.rst
+++ b/docs/release-notes.rst
@@ -19,6 +19,29 @@ DMI-Plugin Release Notes
.. * * * NEW DELHI * * *
.. =========================
+Version: 1.5.1
+==============
+
+Release Data
+------------
+
++--------------------------------------+--------------------------------------------------------+
+| **CPS Project** | DMI-Plugin |
+| | |
++--------------------------------------+--------------------------------------------------------+
+| **Docker images** | onap/ncmp-dmi-plugin:1.5.1 |
+| | |
++--------------------------------------+--------------------------------------------------------+
+| **Release designation** | 1.5.1 New Delhi |
+| | |
++--------------------------------------+--------------------------------------------------------+
+| **Release date** | (not yet released) |
+| | |
++--------------------------------------+--------------------------------------------------------+
+
+Features
+--------
+
Version: 1.5.0
==============
@@ -32,10 +55,10 @@ Release Data
| **Docker images** | onap/ncmp-dmi-plugin:1.5.0 |
| | |
+--------------------------------------+--------------------------------------------------------+
-| **Release designation** | 1.5.0 Montreal |
+| **Release designation** | 1.5.0 New Delhi |
| | |
+--------------------------------------+--------------------------------------------------------+
-| **Release date** | 2024 April 3 |
+| **Release date** | 2024 May 14 |
| | |
+--------------------------------------+--------------------------------------------------------+
diff --git a/openapi/components.yml b/openapi/components.yml
index 00d71564..e011b16d 100644
--- a/openapi/components.yml
+++ b/openapi/components.yml
@@ -101,6 +101,11 @@ components:
ModuleResourcesReadRequest:
type: object
properties:
+ moduleSetTag:
+ type: string
+ description: Module set tag of the given cm handle
+ example: Module-set-tag-1
+ required: false
data:
type: object
properties:
@@ -292,6 +297,17 @@ components:
value:
topic: my-topic-name
+ moduleSetTagParamInQuery:
+ name: moduleSetTag
+ in: query
+ description: Module set tag of the given cm handle.
+ required: false
+ schema:
+ type: string
+ examples:
+ sample1:
+ value: tag1
+
requiredRequestIdParamInQuery:
name: requestId
in: query
diff --git a/openapi/openapi.yml b/openapi/openapi.yml
index 6dbc19f3..38f21c15 100644
--- a/openapi/openapi.yml
+++ b/openapi/openapi.yml
@@ -128,6 +128,7 @@ paths:
- $ref: 'components.yml#/components/parameters/resourceIdentifierInQuery'
- $ref: 'components.yml#/components/parameters/optionsParamInQuery'
- $ref: 'components.yml#/components/parameters/topicParamInQuery'
+ - $ref: 'components.yml#/components/parameters/moduleSetTagParamInQuery'
requestBody:
description: Contains collection of cm handles with it's private properties and requestId
content:
diff --git a/pom.xml b/pom.xml
index d8d171cb..df55eb18 100644
--- a/pom.xml
+++ b/pom.xml
@@ -34,7 +34,7 @@
</organization>
<groupId>org.onap.cps</groupId>
<artifactId>ncmp-dmi-plugin</artifactId>
- <version>1.5.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
<name>ncmp-dmi-plugin</name>
<description>DMI Plugin Service</description>
<properties>
diff --git a/releases/1.5.0-container.yaml b/releases/1.5.0-container.yaml
new file mode 100644
index 00000000..b6ab4784
--- /dev/null
+++ b/releases/1.5.0-container.yaml
@@ -0,0 +1,9 @@
+distribution_type: container
+container_release_tag: 1.5.0
+project: cps/ncmp-dmi-plugin
+log_dir: cps-ncmp-dmi-plugin-maven-docker-stage-master/699/
+ref: 1a83551a2f8b5082399934f9320e9491c372c37f
+tag_release: true
+containers:
+ - name: 'ncmp-dmi-plugin'
+ version: '1.5.0-20240514T113617Z'
diff --git a/releases/1.5.0.yaml b/releases/1.5.0.yaml
new file mode 100644
index 00000000..3d13559f
--- /dev/null
+++ b/releases/1.5.0.yaml
@@ -0,0 +1,4 @@
+distribution_type: maven
+log_dir: cps-ncmp-dmi-plugin-maven-stage-master/699/
+project: cps/ncmp-dmi-plugin
+version: 1.5.0 \ No newline at end of file
diff --git a/src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java b/src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java
index 2ed1ebd3..47b9fc3e 100644
--- a/src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java
+++ b/src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java
@@ -80,13 +80,13 @@ public class DmiRestController implements DmiPluginApi, DmiPluginInternalApi {
return ResponseEntity.ok(moduleSet);
}
-
@Override
public ResponseEntity<YangResources> retrieveModuleResources(
final String cmHandle,
final ModuleResourcesReadRequest moduleResourcesReadRequest) {
final List<ModuleReference> moduleReferences = convertRestObjectToJavaApiObject(moduleResourcesReadRequest);
final YangResources yangResources = dmiService.getModuleResources(cmHandle, moduleReferences);
+ log.info("Module set tag received: {}", moduleResourcesReadRequest.getModuleSetTag());
return new ResponseEntity<>(yangResources, HttpStatus.OK);
}
@@ -138,7 +138,10 @@ public class DmiRestController implements DmiPluginApi, DmiPluginInternalApi {
final String resourceIdentifier,
final String optionsParamInQuery,
final String topicParamInQuery,
+ final String moduleSetTagParamInQuery,
final DataAccessRequest dataAccessRequest) {
+
+ log.info("Module set tag received: {}", moduleSetTagParamInQuery);
if (DatastoreType.PASSTHROUGH_OPERATIONAL == DatastoreType.fromDatastoreName(datastoreName)) {
return dataAccessPassthroughOperational(resourceIdentifier, cmHandle, dataAccessRequest,
optionsParamInQuery, topicParamInQuery);
diff --git a/src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/DmiRestControllerSpec.groovy b/src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/DmiRestControllerSpec.groovy
index 7b2570b0..520e76af 100644
--- a/src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/DmiRestControllerSpec.groovy
+++ b/src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/DmiRestControllerSpec.groovy
@@ -21,6 +21,10 @@
package org.onap.cps.ncmp.dmi.rest.controller
+
+import ch.qos.logback.classic.Logger
+import ch.qos.logback.classic.spi.ILoggingEvent
+import ch.qos.logback.core.read.ListAppender
import org.onap.cps.ncmp.dmi.TestUtils
import org.onap.cps.ncmp.dmi.config.WebSecurityConfig
import org.onap.cps.ncmp.dmi.exception.DmiException
@@ -34,6 +38,7 @@ import org.onap.cps.ncmp.dmi.notifications.async.AsyncTaskExecutor
import org.onap.cps.ncmp.dmi.notifications.async.DmiAsyncRequestResponseEventProducer
import org.onap.cps.ncmp.dmi.service.DmiService
import org.onap.cps.ncmp.dmi.service.model.ModuleReference
+import org.slf4j.LoggerFactory
import org.spockframework.spring.SpringBean
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.beans.factory.annotation.Value
@@ -75,6 +80,17 @@ class DmiRestControllerSpec extends Specification {
@SpringBean
AsyncTaskExecutor asyncTaskExecutor = new AsyncTaskExecutor(cpsAsyncRequestResponseEventProducer)
+ def logger = Spy(ListAppender<ILoggingEvent>)
+
+ void setup() {
+ ((Logger) LoggerFactory.getLogger(DmiRestController.class)).addAppender(logger)
+ logger.start()
+ }
+
+ void cleanup() {
+ ((Logger) LoggerFactory.getLogger(DmiRestController.class)).detachAndStopAllAppenders()
+ }
+
@Value('${rest.api.dmi-base-path}/v1')
def basePathV1
@@ -189,6 +205,26 @@ class DmiRestControllerSpec extends Specification {
response.status == HttpStatus.NOT_FOUND.value()
}
+ def 'Retrieve module resources and ensure module set tag is logged.'() {
+ given: 'URL to get module resources'
+ def getModulesEndpoint = "$basePathV1/ch/some-cm-handle/moduleResources"
+ and: 'request data to get some modules'
+ String jsonData = TestUtils.getResourceFileContent('moduleResources.json')
+ and: 'the DMI service returns the yang resources'
+ def moduleReferences = []
+ def yangResources = new YangResources()
+ def yangResource = new YangResource()
+ yangResources.add(yangResource)
+ mockDmiService.getModuleResources('some-cm-handle', moduleReferences) >> yangResources
+ when: 'the request is posted'
+ mvc.perform(post(getModulesEndpoint)
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(jsonData))
+ then: 'the module set tag is logged'
+ def loggingMessage = getLoggingMessage(0)
+ assert loggingMessage.contains('module-set-tag1')
+ }
+
def 'Get resource data for pass-through operational.'() {
given: 'Get resource data url and some request data'
def getResourceDataForCmHandleUrl = "${basePathV1}/ch/some-cmHandle/data/ds/ncmp-datastore:passthrough-operational" +
@@ -302,6 +338,19 @@ class DmiRestControllerSpec extends Specification {
resourceIdentifier << ['passthrough-operational', 'passthrough-running']
}
+ def 'PassThrough logs module set tag'(){
+ given: 'Passthrough read URL and request data with a module set tag (parameter)'
+ def readPassThroughUrl ="${basePathV1}/ch/some-cmHandle/data/ds/ncmp-datastore:" +
+ 'passthrough-running?resourceIdentifier=some-resourceIdentifier&moduleSetTag=module-set-tag1'
+ def jsonData = TestUtils.getResourceFileContent('readData.json')
+ when: 'the request is posted'
+ mvc.perform(
+ post(readPassThroughUrl).contentType(MediaType.APPLICATION_JSON).content(jsonData))
+ then: 'response status is OK'
+ def loggingMessage = getLoggingMessage(0)
+ assert loggingMessage.contains('module-set-tag1')
+ }
+
def 'Get resource data for pass-through running with #scenario value in resource identifier param.'() {
given: 'Get resource data url'
def getResourceDataForCmHandleUrl = "${basePathV1}/ch/some-cmHandle/data/ds/ncmp-datastore:passthrough-running" +
@@ -343,4 +392,8 @@ class DmiRestControllerSpec extends Specification {
then: 'the resource data operation endpoint returns the not implemented response'
assert response.status == 501
}
+
+ def getLoggingMessage(int index) {
+ return logger.list[index].formattedMessage
+ }
} \ No newline at end of file
diff --git a/src/test/resources/moduleResources.json b/src/test/resources/moduleResources.json
index 57f5aefd..23adfcba 100644
--- a/src/test/resources/moduleResources.json
+++ b/src/test/resources/moduleResources.json
@@ -13,5 +13,6 @@
},
"cmHandleProperties": {
"subsystemId": "system-001"
- }
+ },
+ "moduleSetTag": "module-set-tag1"
}
diff --git a/version.properties b/version.properties
index c2dd6f95..1833e74b 100644
--- a/version.properties
+++ b/version.properties
@@ -21,7 +21,7 @@
# because they are used in Jenkins, whose plug-in doesn't support this
major=1
-minor=5
+minor=6
patch=0
base_version=${major}.${minor}.${patch}