summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--INFO.yaml2
-rw-r--r--docs/_static/cps-r9-ncmp-dmi-plugin-interface-diagram.pngbin24561 -> 90987 bytes
-rw-r--r--docs/api/swagger/openapi-datajob.yaml167
-rw-r--r--docs/api/swagger/openapi.yaml306
-rw-r--r--docs/architecture.rst11
-rw-r--r--docs/design.rst4
-rw-r--r--docs/index.rst5
-rw-r--r--openapi/components.yml33
-rw-r--r--openapi/openapi-datajob.yml240
-rw-r--r--openapi/openapi.yml1
-rw-r--r--pom.xml2
-rw-r--r--src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java16
-rw-r--r--src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/DmiRestControllerSpec.groovy62
-rw-r--r--src/test/resources/moduleResources.json3
-rw-r--r--version.properties4
15 files changed, 535 insertions, 321 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/_static/cps-r9-ncmp-dmi-plugin-interface-diagram.png b/docs/_static/cps-r9-ncmp-dmi-plugin-interface-diagram.png
index 6c5903d2..5a06fbf7 100644
--- a/docs/_static/cps-r9-ncmp-dmi-plugin-interface-diagram.png
+++ b/docs/_static/cps-r9-ncmp-dmi-plugin-interface-diagram.png
Binary files differ
diff --git a/docs/api/swagger/openapi-datajob.yaml b/docs/api/swagger/openapi-datajob.yaml
index 04a5bf1d..b3baa168 100644
--- a/docs/api/swagger/openapi-datajob.yaml
+++ b/docs/api/swagger/openapi-datajob.yaml
@@ -5,40 +5,69 @@ info:
title: NCMP Data Subjob API
version: 1.0.0
servers:
- - url: /dmi
+- url: /dmi
tags:
- - description: DMI plugin rest apis
- name: dmi-datajob
+- description: DMI plugin rest apis
+ name: dmi-datajob
paths:
- /v1/dataJob/{requestId}:
+ /dmi/v1/readJob/{requestId}:
post:
description: Create a read request
- operationId: createReadRequest
+ operationId: readDataJob
parameters:
- - description: Identifier for the overall Datajob
- explode: false
- in: path
- name: requestId
- required: true
- schema:
- example: some-identifier
- type: string
- style: simple
+ - description: Identifier for the overall Datajob
+ explode: false
+ in: path
+ name: requestId
+ required: true
+ schema:
+ example: some-identifier
+ type: string
+ style: simple
requestBody:
content:
application/3gpp-json-patch+json:
schema:
- $ref: '#/components/schemas/SubjobRequest'
+ $ref: '#/components/schemas/SubjobReadRequest'
description: Operation body
responses:
"200":
content:
application/json:
schema:
- $ref: '#/components/schemas/createReadRequest_200_response'
+ $ref: '#/components/schemas/readDataJob_200_response'
description: Response for subjob
tags:
- - dmi-datajob
+ - dmi-datajob
+ /dmi/v1/writeJob/{requestId}:
+ post:
+ description: Create a write request
+ operationId: writeDataJob
+ parameters:
+ - description: Identifier for the overall Datajob
+ explode: false
+ in: path
+ name: requestId
+ required: true
+ schema:
+ example: some-identifier
+ type: string
+ style: simple
+ requestBody:
+ content:
+ application/3gpp-json-patch+json:
+ schema:
+ $ref: '#/components/schemas/SubjobWriteRequest'
+ description: Operation body
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/readDataJob_200_response'
+ description: Response for subjob
+ tags:
+ - dmi-datajob
components:
parameters:
requestIdInPath:
@@ -52,7 +81,7 @@ components:
type: string
style: simple
schemas:
- SubjobRequest:
+ SubjobReadRequest:
properties:
dataAcceptType:
description: Defines the data response accept type
@@ -68,33 +97,50 @@ components:
example: my-data-producer-identifier
type: string
data:
- $ref: '#/components/schemas/SubjobRequest_data'
+ example:
+ op: read
+ operationId: 1
+ path: SubNetwork=Europe/SubNetwork=Ireland/MeContext=NR03gNodeBRadio00003/ManagedElement=NR03gNodeBRadio00003/GNBCUCPFunction=2
+ attributes: userLabel
+ scope:
+ scopeTyp: BASE_ONLY
+ items:
+ $ref: '#/components/schemas/SubjobReadRequest_data_inner'
+ type: array
required:
- - data
- - dataProducerId
+ - data
+ - dataProducerId
+ type: object
+ SubjobWriteRequest:
+ properties:
+ dataAcceptType:
+ description: Defines the data response accept type
+ example: application/vnd.3gpp.object-tree-hierarchical+json
+ type: string
+ dataContentType:
+ description: Defines the data request content type
+ example: application/3gpp-json-patch+json
+ type: string
+ dataProducerId:
+ description: ID of the producer registered by DMI for the paths in the operations
+ in this request
+ example: my-data-producer-identifier
+ type: string
+ data:
+ example:
+ op: add
+ path: SubNetwork=Europe/SubNetwork=Ireland/MeContext=NR03gNodeBRadio00003/ManagedElement=NR03gNodeBRadio00003/GNBCUCPFunction=1/EUtraNetwork=1/EUtranFrequency=12
+ value:
+ id: 12
+ attributes:
+ userLabel: label12
+ items:
+ $ref: '#/components/schemas/SubjobWriteRequest_data_inner'
+ type: array
+ required:
+ - data
+ - dataProducerId
type: object
- ReadOperation:
- example:
- op: read
- operationId: 1
- path: SubNetwork=Europe/SubNetwork=Ireland/MeContext=NR03gNodeBRadio00003/ManagedElement=NR03gNodeBRadio00003/GNBCUCPFunction=2
- attributes: userLabel
- scope:
- scopeTyp: BASE_ONLY
- items:
- $ref: '#/components/schemas/ReadOperation_inner'
- type: array
- WriteOperation:
- example:
- op: add
- path: SubNetwork=Europe/SubNetwork=Ireland/MeContext=NR03gNodeBRadio00003/ManagedElement=NR03gNodeBRadio00003/GNBCUCPFunction=1/EUtraNetwork=1/EUtranFrequency=12
- value:
- id: 12
- attributes:
- userLabel: label12
- items:
- $ref: '#/components/schemas/WriteOperation_inner'
- type: array
CmHandleProperties:
description: Private properties of the cm handle for the given path
type: object
@@ -119,7 +165,7 @@ components:
type: object
Object:
type: object
- createReadRequest_200_response:
+ readDataJob_200_response:
example:
dataProducerJobId: dataProducerJobId
properties:
@@ -127,11 +173,7 @@ components:
description: The data job ID.
type: string
type: object
- SubjobRequest_data:
- oneOf:
- - $ref: '#/components/schemas/ReadOperation'
- - $ref: '#/components/schemas/WriteOperation'
- ReadOperation_inner:
+ SubjobReadRequest_data_inner:
properties:
path:
description: Defines the resource on which operation is executed
@@ -181,18 +223,18 @@ components:
description: Private properties of the cm handle for the given path
type: object
required:
- - op
- - path
+ - op
+ - path
type: object
- WriteOperation_inner_value:
+ SubjobWriteRequest_data_inner_value:
description: Value dependent on the op specified. Resource for an add. Object
for a replace. ActionParameters for an action.
oneOf:
- - $ref: '#/components/schemas/Resource'
- - $ref: '#/components/schemas/ActionParameters'
- - $ref: '#/components/schemas/Object'
+ - $ref: '#/components/schemas/Resource'
+ - $ref: '#/components/schemas/ActionParameters'
+ - $ref: '#/components/schemas/Object'
type: object
- WriteOperation_inner:
+ SubjobWriteRequest_data_inner:
properties:
path:
description: Defines the resource on which operation is executed
@@ -206,9 +248,16 @@ components:
description: Unique identifier for the operation within the request
example: "1"
type: string
+ moduleSetTag:
+ description: Module set identifier
+ example: my-module-set-tag
+ type: string
+ cmHandleProperties:
+ description: Private properties of the cm handle for the given path
+ type: object
value:
- $ref: '#/components/schemas/WriteOperation_inner_value'
+ $ref: '#/components/schemas/SubjobWriteRequest_data_inner_value'
required:
- - op
- - path
+ - op
+ - path
type: object
diff --git a/docs/api/swagger/openapi.yaml b/docs/api/swagger/openapi.yaml
index 4e3ae897..ceb61913 100644
--- a/docs/api/swagger/openapi.yaml
+++ b/docs/api/swagger/openapi.yaml
@@ -4,26 +4,26 @@ info:
title: NCMP DMI Plugin
version: 1.0.0
servers:
- - url: /dmi
+- url: /dmi
tags:
- - description: DMI plugin internal rest apis
- name: dmi-plugin-internal
- - description: DMI plugin rest apis
- name: dmi-plugin
+- description: DMI plugin internal rest apis
+ name: dmi-plugin-internal
+- description: DMI plugin rest apis
+ name: dmi-plugin
paths:
/v1/ch/{cmHandle}/modules:
post:
description: Get all modules for given cm handle
operationId: getModuleReferences
parameters:
- - description: "The identifier for a network function, network element, subnetwork,\
+ - description: "The identifier for a network function, network element, subnetwork,\
\ or any other cm object by managed Network CM Proxy"
- in: path
- name: cmHandle
- required: true
- schema:
- example: my-cm-handle
- type: string
+ in: path
+ name: cmHandle
+ required: true
+ schema:
+ example: my-cm-handle
+ type: string
requestBody:
content:
application/json:
@@ -59,20 +59,20 @@ paths:
description: Internal Server Error
summary: Get all modules for cm handle
tags:
- - dmi-plugin
+ - dmi-plugin
/v1/ch/{cmHandle}/moduleResources:
post:
description: Retrieve module resources for one or more modules
operationId: retrieveModuleResources
parameters:
- - description: "The identifier for a network function, network element, subnetwork,\
+ - description: "The identifier for a network function, network element, subnetwork,\
\ or any other cm object by managed Network CM Proxy"
- in: path
- name: cmHandle
- required: true
- schema:
- example: my-cm-handle
- type: string
+ in: path
+ name: cmHandle
+ required: true
+ schema:
+ example: my-cm-handle
+ type: string
requestBody:
content:
application/json:
@@ -108,7 +108,7 @@ paths:
description: Internal Server Error
summary: Retrieve module resources
tags:
- - dmi-plugin
+ - dmi-plugin
/v1/inventory/cmHandles:
post:
description: register given list of cm handles (internal use only)
@@ -150,7 +150,7 @@ paths:
description: Internal Server Error
summary: register given list of cm handles (internal use only)
tags:
- - dmi-plugin-internal
+ - dmi-plugin-internal
x-api-audience: component-internal
/v1/ch/{cmHandle}/data/ds/{datastore-name}:
post:
@@ -158,57 +158,63 @@ paths:
cm handle
operationId: dataAccessPassthrough
parameters:
- - description: The type of the requested data
- in: path
- name: datastore-name
- required: true
- schema:
- example: ncmp-datastore:passthrough-operational or ncmp-datastore:passthrough-running
- type: string
- - description: "The identifier for a network function, network element, subnetwork,\
+ - description: The type of the requested data
+ in: path
+ name: datastore-name
+ required: true
+ schema:
+ example: ncmp-datastore:passthrough-operational or ncmp-datastore:passthrough-running
+ type: string
+ - description: "The identifier for a network function, network element, subnetwork,\
\ or any other cm object by managed Network CM Proxy"
- in: path
- name: cmHandle
- required: true
- schema:
- example: my-cm-handle
- type: string
- - allowReserved: true
- description: Resource identifier to get/set the resource data
- in: query
- name: resourceIdentifier
- required: true
- schema:
- example: my-schema:my-node
- type: string
- - allowReserved: true
- description: "options parameter in query, it is mandatory to wrap key(s)=value(s)\
+ in: path
+ name: cmHandle
+ required: true
+ schema:
+ example: my-cm-handle
+ type: string
+ - description: Resource identifier to get/set the resource data
+ in: query
+ name: resourceIdentifier
+ required: true
+ schema:
+ example: my-schema:my-node
+ type: string
+ - description: "options parameter in query, it is mandatory to wrap key(s)=value(s)\
\ in parenthesis'()'."
- examples:
- sample1:
- value:
- options: "(key1=value1,key2=value2)"
- sample2:
- value:
- options: "(key1=value1,key2=value1/value2)"
- sample3:
- value:
- options: "(key1=10,key2=value2,key3=val31,val32)"
- in: query
- name: options
- required: false
- schema:
- type: string
- - allowReserved: true
- description: topic name passed from client(NCMP).
- examples:
- sample1:
- value: my-topic-name
- in: query
- name: topic
- required: false
- schema:
- type: string
+ examples:
+ sample1:
+ value:
+ options: "(key1=value1,key2=value2)"
+ sample2:
+ value:
+ options: "(key1=value1,key2=value1/value2)"
+ sample3:
+ value:
+ options: "(key1=10,key2=value2,key3=val31,val32)"
+ in: query
+ name: options
+ required: false
+ schema:
+ type: string
+ - description: topic name passed from client(NCMP).
+ examples:
+ sample1:
+ value: my-topic-name
+ in: query
+ name: topic
+ required: false
+ schema:
+ type: string
+ - description: Module set tag of the given cm handle.
+ examples:
+ sample1:
+ value: tag1
+ in: query
+ name: moduleSetTag
+ required: false
+ schema:
+ type: string
requestBody:
content:
application/json:
@@ -222,9 +228,9 @@ paths:
application/json:
schema:
example:
- - yangSource: my-yang-source
- moduleName: my-module-name
- revision: my-revision
+ - yangSource: my-yang-source
+ moduleName: my-module-name
+ revision: my-revision
type: object
description: OK
"400":
@@ -250,35 +256,33 @@ paths:
summary: Get resource data from passthrough operational or running for a cm
handle
tags:
- - dmi-plugin
+ - dmi-plugin
/v1/data:
post:
description: Execute a data operation for group of cm handle ids by supplied
operation details
operationId: getResourceDataForCmHandleDataOperation
parameters:
- - allowReserved: true
- description: mandatory topic name passed from client(NCMP).
- examples:
- sample1:
- value:
- topic: my-topic-name
- in: query
- name: topic
- required: true
- schema:
- type: string
- - allowReserved: true
- description: request Id generated by NCMP and sent as an acknowledgement for
- the client request the same including here.
- examples:
- sample1:
- value: 4753fc1f-7de2-449a-b306-a6204b5370b3
- in: query
- name: requestId
- required: true
- schema:
- type: string
+ - description: mandatory topic name passed from client(NCMP).
+ examples:
+ sample1:
+ value:
+ topic: my-topic-name
+ in: query
+ name: topic
+ required: true
+ schema:
+ type: string
+ - description: request Id generated by NCMP and sent as an acknowledgement for
+ the client request the same including here.
+ examples:
+ sample1:
+ value: 4753fc1f-7de2-449a-b306-a6204b5370b3
+ in: query
+ name: requestId
+ required: true
+ schema:
+ type: string
requestBody:
content:
application/json:
@@ -320,7 +324,7 @@ paths:
description: Not Implemented
summary: Execute a data operation for group of cm handle ids.
tags:
- - dmi-plugin
+ - dmi-plugin
components:
parameters:
cmHandleInPath:
@@ -341,7 +345,6 @@ components:
example: ncmp-datastore:passthrough-operational or ncmp-datastore:passthrough-running
type: string
resourceIdentifierInQuery:
- allowReserved: true
description: Resource identifier to get/set the resource data
in: query
name: resourceIdentifier
@@ -350,7 +353,6 @@ components:
example: my-schema:my-node
type: string
optionsParamInQuery:
- allowReserved: true
description: "options parameter in query, it is mandatory to wrap key(s)=value(s)\
\ in parenthesis'()'."
examples:
@@ -369,7 +371,6 @@ components:
schema:
type: string
topicParamInQuery:
- allowReserved: true
description: topic name passed from client(NCMP).
examples:
sample1:
@@ -379,8 +380,17 @@ components:
required: false
schema:
type: string
+ moduleSetTagParamInQuery:
+ description: Module set tag of the given cm handle.
+ examples:
+ sample1:
+ value: tag1
+ in: query
+ name: moduleSetTag
+ required: false
+ schema:
+ type: string
requiredTopicParamInQuery:
- allowReserved: true
description: mandatory topic name passed from client(NCMP).
examples:
sample1:
@@ -392,7 +402,6 @@ components:
schema:
type: string
requiredRequestIdParamInQuery:
- allowReserved: true
description: request Id generated by NCMP and sent as an acknowledgement for
the client request the same including here.
examples:
@@ -469,12 +478,12 @@ components:
ModuleSet:
example:
schemas:
- - moduleName: my-module-name
- namespace: my-namespace
- revision: my-revision
- - moduleName: my-module-name
- namespace: my-namespace
- revision: my-revision
+ - moduleName: my-module-name
+ namespace: my-namespace
+ revision: my-revision
+ - moduleName: my-module-name
+ namespace: my-namespace
+ revision: my-revision
properties:
schemas:
items:
@@ -495,13 +504,18 @@ components:
example:
data:
modules:
- - name: my-name
- revision: my-revision
- - name: my-name
- revision: my-revision
+ - name: my-name
+ revision: my-revision
+ - name: my-name
+ revision: my-revision
+ moduleSetTag: Module-set-tag-1
cmHandleProperties:
key: "{\"prop1\":\"value1\",\"prop2\":\"value2\"}"
properties:
+ moduleSetTag:
+ description: Module set tag of the given cm handle
+ example: Module-set-tag-1
+ type: string
data:
$ref: '#/components/schemas/ModuleResourcesReadRequest_data'
cmHandleProperties:
@@ -533,15 +547,15 @@ components:
CmHandles:
example:
cmHandles:
- - cmHandleId1
- - cmHandleId2
- - cmHandleId3
+ - cmHandleId1
+ - cmHandleId2
+ - cmHandleId3
properties:
cmHandles:
example:
- - cmHandleId1
- - cmHandleId2
- - cmHandleId3
+ - cmHandleId1
+ - cmHandleId2
+ - cmHandleId3
items:
type: string
type: array
@@ -557,11 +571,11 @@ components:
properties:
operation:
enum:
- - read
- - create
- - update
- - patch
- - delete
+ - read
+ - create
+ - update
+ - patch
+ - delete
example: read
type: string
dataType:
@@ -584,12 +598,13 @@ components:
items:
$ref: '#/components/schemas/DataOperationRequest'
type: array
- cmHandle:
+ dmiOperationCmHandle:
example:
id: cmHandle123
cmHandleProperties:
myProp: some value
otherProp: other value
+ moduleSetTag: module-set-tag1
properties:
id:
type: string
@@ -597,7 +612,10 @@ components:
additionalProperties:
type: string
type: object
- title: cmHandle
+ moduleSetTag:
+ example: module-set-tag1
+ type: string
+ title: CmHandle with properties for DMI
type: object
ModuleSet_schemas_inner:
example:
@@ -630,10 +648,10 @@ components:
ModuleResourcesReadRequest_data:
example:
modules:
- - name: my-name
- revision: my-revision
- - name: my-name
- revision: my-revision
+ - name: my-name
+ revision: my-revision
+ - name: my-name
+ revision: my-revision
properties:
modules:
items:
@@ -647,14 +665,16 @@ components:
options: some option
operationId: "12"
cmHandles:
- - id: cmHandle123
- cmHandleProperties:
- myProp: some value
- otherProp: other value
- - id: cmHandle123
- cmHandleProperties:
- myProp: some value
- otherProp: other value
+ - id: cmHandle123
+ cmHandleProperties:
+ myProp: some value
+ otherProp: other value
+ moduleSetTag: module-set-tag1
+ - id: cmHandle123
+ cmHandleProperties:
+ myProp: some value
+ otherProp: other value
+ moduleSetTag: module-set-tag1
operation: read
properties:
operation:
@@ -676,12 +696,12 @@ components:
type: string
cmHandles:
items:
- $ref: '#/components/schemas/cmHandle'
+ $ref: '#/components/schemas/dmiOperationCmHandle'
type: array
required:
- - cmHandles
- - datastore
- - operation
- - operationId
+ - cmHandles
+ - datastore
+ - operation
+ - operationId
title: DataOperationRequest
type: object
diff --git a/docs/architecture.rst b/docs/architecture.rst
index 622b9c86..f0b87455 100644
--- a/docs/architecture.rst
+++ b/docs/architecture.rst
@@ -1,6 +1,6 @@
.. This work is licensed under a Creative Commons Attribution 4.0 International License.
.. http://creativecommons.org/licenses/by/4.0
-.. Copyright (C) 2021-2023 Nordix Foundation
+.. Copyright (C) 2021-2024 Nordix Foundation
.. _architecture:
DMI-Plugin Architecture
@@ -52,5 +52,14 @@ The DMI-Plugin provides following interfaces.
- Query data
- Query module references
- REST
+ * - DMI-I-02
+ - Provides support for Async Data Subjobs enabling CRUDAQ requests for the paths in the request using the ID of the producer registered by DMI. This enables subnetwork-wide requests
+ - - Create data based on dataProducerId
+ - Read data based on dataProducerId
+ - Update data based on dataProducerId
+ - Delete data based on dataProducerId
+ - Perform action on data based on dataProducerId
+ - Query data based on dataProducerId
+ - REST
More details on the CPS interface CPS-E-05 which is responsible for the DMI-Plugin can be found on the :ref:`CPS Architecture page<onap-cps:architecture>`
diff --git a/docs/design.rst b/docs/design.rst
index 2efcc585..dd1472c9 100644
--- a/docs/design.rst
+++ b/docs/design.rst
@@ -1,6 +1,6 @@
.. This work is licensed under a Creative Commons Attribution 4.0 International License.
.. http://creativecommons.org/licenses/by/4.0
-.. Copyright (C) 2021-2023 Nordix Foundation
+.. Copyright (C) 2021-2024 Nordix Foundation
.. DO NOT CHANGE THIS LABEL FOR RELEASE NOTES - EVEN THOUGH IT GIVES A WARNING
.. _design:
@@ -19,6 +19,8 @@ The DMI-Plugin supports the public APIs listed in the link below:
:download:`DMI Rest OpenApi Specification <api/swagger/openapi.yaml>`
+:download:`DMI Datajob OpenApi Specification <api/swagger/openapi-datajob.yaml>`
+
View Offered APIs
-----------------
diff --git a/docs/index.rst b/docs/index.rst
index 236b1c8e..ade75612 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -1,6 +1,6 @@
.. This work is licensed under a Creative Commons Attribution 4.0 International License.
.. http://creativecommons.org/licenses/by/4.0
-.. Copyright (C) 2021 Nordix Foundation
+.. Copyright (C) 2021-2024 Nordix Foundation
.. DO NOT CHANGE THIS LABEL FOR RELEASE NOTES - EVEN THOUGH IT GIVES A WARNING
.. _master_index:
@@ -28,7 +28,4 @@ CPS-NCMP Documentation
* :ref:`CPS-NCMP<onap-cps:master_index>`
-CPS-Temporal Documentation
---------------------------
-* :ref:`CPS-Temporal<onap-cps-cps-temporal:master_index>`
diff --git a/openapi/components.yml b/openapi/components.yml
index 00d71564..3142654d 100644
--- a/openapi/components.yml
+++ b/openapi/components.yml
@@ -76,31 +76,40 @@ components:
cmHandles:
type: array
items:
- $ref: '#/components/schemas/cmHandle'
+ $ref: '#/components/schemas/dmiOperationCmHandle'
required:
- operation
- operationId
- datastore
- cmHandles
- cmHandle:
+ dmiOperationCmHandle:
type: object
- title: 'cmHandle'
+ title: 'CmHandle with properties for DMI'
properties:
id:
type: string
cmHandleProperties:
additionalProperties:
type: string
+ moduleSetTag:
+ type: string
+ example: module-set-tag1
example:
id: cmHandle123
cmHandleProperties:
myProp: some value
otherProp: other value
+ moduleSetTag: module-set-tag1
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:
@@ -243,7 +252,6 @@ components:
in: query
description: Resource identifier to get/set the resource data
required: true
- allowReserved: true
schema:
type: string
example: my-schema:my-node
@@ -255,7 +263,6 @@ components:
required: false
schema:
type: string
- allowReserved: true
examples:
sample1:
value:
@@ -274,7 +281,6 @@ components:
required: false
schema:
type: string
- allowReserved: true
examples:
sample1:
value: my-topic-name
@@ -286,12 +292,22 @@ components:
required: true
schema:
type: string
- allowReserved: true
examples:
sample1:
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
@@ -299,7 +315,6 @@ components:
required: true
schema:
type: string
- allowReserved: true
examples:
sample1:
value: 4753fc1f-7de2-449a-b306-a6204b5370b3
@@ -314,4 +329,4 @@ components:
example: ncmp-datastore:passthrough-operational or ncmp-datastore:passthrough-running
security:
- - basicAuth: [] \ No newline at end of file
+ - basicAuth: []
diff --git a/openapi/openapi-datajob.yml b/openapi/openapi-datajob.yml
index b572ff3e..8a0f315b 100644
--- a/openapi/openapi-datajob.yml
+++ b/openapi/openapi-datajob.yml
@@ -27,10 +27,10 @@ tags:
- description: DMI plugin rest apis
name: dmi-datajob
paths:
- /v1/dataJob/{requestId}:
+ /dmi/v1/readJob/{requestId}:
post:
description: Create a read request
- operationId: createReadRequest
+ operationId: readDataJob
parameters:
- $ref: '#/components/parameters/requestIdInPath'
requestBody:
@@ -38,7 +38,32 @@ paths:
content:
application/3gpp-json-patch+json:
schema:
- $ref: '#/components/schemas/SubjobRequest'
+ $ref: '#/components/schemas/SubjobReadRequest'
+ tags:
+ - dmi-datajob
+ responses:
+ "200":
+ description: Response for subjob
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ dataProducerJobId:
+ type: string
+ description: The data job ID.
+ /dmi/v1/writeJob/{requestId}:
+ post:
+ description: Create a write request
+ operationId: writeDataJob
+ parameters:
+ - $ref: '#/components/parameters/requestIdInPath'
+ requestBody:
+ description: Operation body
+ content:
+ application/3gpp-json-patch+json:
+ schema:
+ $ref: '#/components/schemas/SubjobWriteRequest'
tags:
- dmi-datajob
responses:
@@ -63,7 +88,7 @@ components:
example: some-identifier
type: string
schemas:
- SubjobRequest:
+ SubjobReadRequest:
type: object
required:
- dataProducerId
@@ -82,100 +107,121 @@ components:
example: my-data-producer-identifier
type: string
data:
- oneOf:
- - $ref: '#/components/schemas/ReadOperation'
- - $ref: '#/components/schemas/WriteOperation'
- ReadOperation:
- example:
- op: read
- operationId: 1
- path: SubNetwork=Europe/SubNetwork=Ireland/MeContext=NR03gNodeBRadio00003/ManagedElement=NR03gNodeBRadio00003/GNBCUCPFunction=2
- attributes: userLabel
- scope:
- scopeTyp: BASE_ONLY
- type: array
- items:
- type: object
- required:
- - path
- - op
- properties:
- path:
- description: Defines the resource on which operation is executed
- example: SubNetwork=Europe/SubNetwork=Ireland/MeContext=NR03gNodeBRadio00003/ManagedElement=NR03gNodeBRadio00003
- type: string
- op:
- description: Describes the operation to execute
- example: read
- type: string
- operationId:
- description: Unique identifier for the operation within the request
- example: 1
- type: string
- attributes:
- description: This parameter specifies the attributes of the scoped resources that are returned
- type: array
- items:
- example: cellId
- type: string
- fields:
- description: This parameter specifies the attribute fields of the scoped resources that are returned
- type: array
- items:
- type: string
- filter:
- description: This parameter is used to filter the scoped Managed Objects. Only Managed Objects passing the filter criteria will be fetched
- example: NRCellDU/attributes/administrativeState==LOCKED
- type: string
- scopeType:
- description: ScopeType selects MOs depending on relationships with Base Managed Object
- example: BASE_ONLY
- type: string
- scopeLevel:
- description: Only used when the scope type is BASE_NTH_LEVEL to specify amount of levels to search
- example: 0
- type: integer
- moduleSetTag:
- description: Module set identifier
- example: my-module-set-tag
- type: string
- cmHandleProperties:
- description: Private properties of the cm handle for the given path
- $ref: '#/components/schemas/CmHandleProperties'
- WriteOperation:
- example:
- op: add
- path: SubNetwork=Europe/SubNetwork=Ireland/MeContext=NR03gNodeBRadio00003/ManagedElement=NR03gNodeBRadio00003/GNBCUCPFunction=1/EUtraNetwork=1/EUtranFrequency=12
- value:
- id: 12
- attributes:
- userLabel: label12
- type: array
- items:
- type: object
- required:
- - path
- - op
- properties:
- path:
- description: Defines the resource on which operation is executed
- example: SubNetwork=Europe/SubNetwork=Ireland/MeContext=NR03gNodeBRadio00003/ManagedElement=NR03gNodeBRadio00003
- type: string
- op:
- description: Describes the operation to execute
- example: add
- type: string
- operationId:
- description: Unique identifier for the operation within the request
- example: 1
- type: string
- value:
- description: Value dependent on the op specified. Resource for an add. Object for a replace. ActionParameters for an action.
+ example:
+ op: read
+ operationId: 1
+ path: SubNetwork=Europe/SubNetwork=Ireland/MeContext=NR03gNodeBRadio00003/ManagedElement=NR03gNodeBRadio00003/GNBCUCPFunction=2
+ attributes: userLabel
+ scope:
+ scopeTyp: BASE_ONLY
+ type: array
+ items:
type: object
- oneOf:
- - $ref: '#/components/schemas/Resource'
- - $ref: '#/components/schemas/ActionParameters'
- - $ref: '#/components/schemas/Object'
+ required:
+ - path
+ - op
+ properties:
+ path:
+ description: Defines the resource on which operation is executed
+ example: SubNetwork=Europe/SubNetwork=Ireland/MeContext=NR03gNodeBRadio00003/ManagedElement=NR03gNodeBRadio00003
+ type: string
+ op:
+ description: Describes the operation to execute
+ example: read
+ type: string
+ operationId:
+ description: Unique identifier for the operation within the request
+ example: 1
+ type: string
+ attributes:
+ description: This parameter specifies the attributes of the scoped resources that are returned
+ type: array
+ items:
+ example: cellId
+ type: string
+ fields:
+ description: This parameter specifies the attribute fields of the scoped resources that are returned
+ type: array
+ items:
+ type: string
+ filter:
+ description: This parameter is used to filter the scoped Managed Objects. Only Managed Objects passing the filter criteria will be fetched
+ example: NRCellDU/attributes/administrativeState==LOCKED
+ type: string
+ scopeType:
+ description: ScopeType selects MOs depending on relationships with Base Managed Object
+ example: BASE_ONLY
+ type: string
+ scopeLevel:
+ description: Only used when the scope type is BASE_NTH_LEVEL to specify amount of levels to search
+ example: 0
+ type: integer
+ moduleSetTag:
+ description: Module set identifier
+ example: my-module-set-tag
+ type: string
+ cmHandleProperties:
+ description: Private properties of the cm handle for the given path
+ $ref: '#/components/schemas/CmHandleProperties'
+ SubjobWriteRequest:
+ type: object
+ required:
+ - dataProducerId
+ - data
+ properties:
+ dataAcceptType:
+ description: Defines the data response accept type
+ example: application/vnd.3gpp.object-tree-hierarchical+json
+ type: string
+ dataContentType:
+ description: Defines the data request content type
+ example: application/3gpp-json-patch+json
+ type: string
+ dataProducerId:
+ description: ID of the producer registered by DMI for the paths in the operations in this request
+ example: my-data-producer-identifier
+ type: string
+ data:
+ example:
+ op: add
+ path: SubNetwork=Europe/SubNetwork=Ireland/MeContext=NR03gNodeBRadio00003/ManagedElement=NR03gNodeBRadio00003/GNBCUCPFunction=1/EUtraNetwork=1/EUtranFrequency=12
+ value:
+ id: 12
+ attributes:
+ userLabel: label12
+ type: array
+ items:
+ type: object
+ required:
+ - path
+ - op
+ properties:
+ path:
+ description: Defines the resource on which operation is executed
+ example: SubNetwork=Europe/SubNetwork=Ireland/MeContext=NR03gNodeBRadio00003/ManagedElement=NR03gNodeBRadio00003
+ type: string
+ op:
+ description: Describes the operation to execute
+ example: add
+ type: string
+ operationId:
+ description: Unique identifier for the operation within the request
+ example: 1
+ type: string
+ moduleSetTag:
+ description: Module set identifier
+ example: my-module-set-tag
+ type: string
+ cmHandleProperties:
+ description: Private properties of the cm handle for the given path
+ $ref: '#/components/schemas/CmHandleProperties'
+ value:
+ description: Value dependent on the op specified. Resource for an add. Object for a replace. ActionParameters for an action.
+ type: object
+ oneOf:
+ - $ref: '#/components/schemas/Resource'
+ - $ref: '#/components/schemas/ActionParameters'
+ - $ref: '#/components/schemas/Object'
CmHandleProperties:
description: Private properties of the cm handle for the given path
type: object
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 cebd4a89..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.1-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
<name>ncmp-dmi-plugin</name>
<description>DMI Plugin Service</description>
<properties>
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..ec56884c 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);
}
@@ -116,6 +116,17 @@ public class DmiRestController implements DmiPluginApi, DmiPluginInternalApi {
@Override
public ResponseEntity<Void> getResourceDataForCmHandleDataOperation(final String topic, final String requestId,
final ResourceDataOperationRequests resourceDataOperationRequests) {
+ log.info("Request Details (for testing purposes)");
+ log.info("Request Id: {}", requestId);
+ log.info("Topic: {}", topic);
+
+ log.info("Details of the first Operation");
+ log.info("Resource Identifier: {}", resourceDataOperationRequests.get(0).getResourceIdentifier());
+ log.info("Module Set Tag: {}", resourceDataOperationRequests.get(0).getCmHandles().get(0).getModuleSetTag());
+ log.info("Operation Id: {}", resourceDataOperationRequests.get(0).getOperationId());
+ log.info("Cm Handles: {}", resourceDataOperationRequests.get(0).getCmHandles());
+ log.info("Options: {}", resourceDataOperationRequests.get(0).getOptions());
+
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
@@ -138,7 +149,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..23b039bd 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" +
@@ -335,12 +384,23 @@ class DmiRestControllerSpec extends Specification {
def resourceDataUrl = "$basePathV1/data?topic=client-topic-name&requestId=some-requestId"
and: 'list of operation details are received into request body'
def dataOperationRequestBody = '[{"operation": "read", "operationId": "14", "datastore": "ncmp-datastore:passthrough-operational", "options": "some options", "resourceIdentifier": "some resourceIdentifier",' +
- ' "cmhandles": [ {"id": "cmHanlde123", "cmHandleProperties": { "myProp`": "some value", "otherProp": "other value"}}]}]'
+ '"cmHandles": [ {"id": "cmHandle123", "moduleSetTag": "module-set-tag1", "cmHandleProperties": { "myProp`": "some value", "otherProp": "other value"}}]}]'
when: 'the dmi resource data for dataOperation api is called.'
def response = mvc.perform(
post(resourceDataUrl).contentType(MediaType.APPLICATION_JSON).content(dataOperationRequestBody)
).andReturn().response
then: 'the resource data operation endpoint returns the not implemented response'
assert response.status == 501
+ and: 'the job details are correctly received (logged)'
+ assert getLoggingMessage(1).contains('some-requestId')
+ assert getLoggingMessage(2).contains('client-topic-name')
+ assert getLoggingMessage(4).contains('some resourceIdentifier')
+ assert getLoggingMessage(5).contains('module-set-tag1')
+ and: 'the operation Id is correctly received (logged)'
+ assert getLoggingMessage(6).contains('14')
+ }
+
+ 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 dd03141f..1833e74b 100644
--- a/version.properties
+++ b/version.properties
@@ -21,8 +21,8 @@
# because they are used in Jenkins, whose plug-in doesn't support this
major=1
-minor=5
-patch=1
+minor=6
+patch=0
base_version=${major}.${minor}.${patch}