summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-rest
diff options
context:
space:
mode:
authorseanbeirne <sean.beirne@est.tech>2023-10-17 11:03:16 +0100
committerSeán Beirne <sean.beirne@est.tech>2023-11-02 13:07:16 +0000
commitf41dd3b24da2cc956c3d6e27fc14e409f11c65c0 (patch)
tree83d17101101a07061b6d2172e9895f05bfc51dc7 /cps-ncmp-rest
parente5c66c7fec638412e10d5abef14d2a7afc86cb23 (diff)
Initial Registration with trustLevel on NCMP
- Updated NcmpServiceCmHandle class to include registration trustLevel Issue-ID: CPS-1902 Signed-off-by: seanbeirne <sean.beirne@est.tech> Change-Id: I7c97928f5cdd82f3036a57ea5f0c149e2872f4f1
Diffstat (limited to 'cps-ncmp-rest')
-rw-r--r--cps-ncmp-rest/docs/openapi/components.yaml4
-rw-r--r--cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NcmpRestInputMapper.java1
-rw-r--r--cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NcmpRestInputMapperSpec.groovy18
3 files changed, 15 insertions, 8 deletions
diff --git a/cps-ncmp-rest/docs/openapi/components.yaml b/cps-ncmp-rest/docs/openapi/components.yaml
index 62c9eb0505..9b5a1fd0ba 100644
--- a/cps-ncmp-rest/docs/openapi/components.yaml
+++ b/cps-ncmp-rest/docs/openapi/components.yaml
@@ -136,6 +136,10 @@ components:
moduleSetTag:
type: string
example: "my-module-set-tag"
+ trustLevel:
+ type: string
+ enum: [COMPLETE, NONE]
+ example: "COMPLETE"
RestCmHandleProperties:
type: object
additionalProperties:
diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NcmpRestInputMapper.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NcmpRestInputMapper.java
index af785d5658..045b8a7414 100644
--- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NcmpRestInputMapper.java
+++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NcmpRestInputMapper.java
@@ -56,6 +56,7 @@ public interface NcmpRestInputMapper {
@Mapping(source = "cmHandle", target = "cmHandleId")
@Mapping(source = "cmHandleProperties", target = "dmiProperties")
@Mapping(source = "publicCmHandleProperties", target = "publicProperties")
+ @Mapping(source = "trustLevel", target = "registrationTrustLevel")
NcmpServiceCmHandle toNcmpServiceCmHandle(final RestInputCmHandle restInputCmHandle);
RestModuleReference toRestModuleReference(
diff --git a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NcmpRestInputMapperSpec.groovy b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NcmpRestInputMapperSpec.groovy
index dfe7bf3853..c4dd91e117 100644
--- a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NcmpRestInputMapperSpec.groovy
+++ b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NcmpRestInputMapperSpec.groovy
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation
+ * Copyright (C) 2022-2023 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@
package org.onap.cps.ncmp.rest.controller
import org.mapstruct.factory.Mappers
+import org.onap.cps.ncmp.api.impl.trustlevel.TrustLevel
import org.onap.cps.ncmp.api.models.NcmpServiceCmHandle
import org.onap.cps.ncmp.rest.model.CmHandleQueryParameters
import org.onap.cps.ncmp.rest.model.ConditionProperties
@@ -39,8 +40,8 @@ class NcmpRestInputMapperSpec extends Specification {
def 'Convert a created REST CM Handle Input to an NCMP Service CM Handle with #scenario'() {
given: 'a rest cm handle input'
- def inputRestCmHandle = new RestInputCmHandle(cmHandle : 'example-id', cmHandleProperties: dmiProperties,
- publicCmHandleProperties: publicProperties)
+ def inputRestCmHandle = new RestInputCmHandle(cmHandle : 'example-id', cmHandleProperties: registrationDmiProperties,
+ publicCmHandleProperties: registrationPublicProperties, trustLevel: registrationTrustLevel)
def restDmiPluginRegistration = new RestDmiPluginRegistration(
createdCmHandles: [inputRestCmHandle])
when: 'to plugin dmi registration is called'
@@ -50,12 +51,13 @@ class NcmpRestInputMapperSpec extends Specification {
and: 'the converted cm handle has the same id'
result.createdCmHandles[0].cmHandleId == 'example-id'
and: '(empty) properties are converted correctly'
- result.createdCmHandles[0].dmiProperties == expectedDmiProperties
- result.createdCmHandles[0].publicProperties == expectedPublicProperties
+ result.createdCmHandles[0].dmiProperties == mappedDmiProperties
+ result.createdCmHandles[0].publicProperties == mappedPublicProperties
+ result.createdCmHandles[0].registrationTrustLevel == mappedTrustLevel
where: 'the following parameters are used'
- scenario | dmiProperties | publicProperties || expectedDmiProperties | expectedPublicProperties
- 'dmi and public properties' | ['Property-Example': 'example property'] | ['Public-Property-Example': 'public example property'] || ['Property-Example': 'example property'] | ['Public-Property-Example': 'public example property']
- 'no properties' | null | null || [:] | [:]
+ scenario | registrationDmiProperties | registrationPublicProperties | registrationTrustLevel || mappedDmiProperties | mappedPublicProperties | mappedTrustLevel
+ 'dmi and public properties' | ['Property-Example': 'example property'] | ['Public-Property-Example': 'public example property'] | 'COMPLETE' || ['Property-Example': 'example property'] | ['Public-Property-Example': 'public example property'] | TrustLevel.COMPLETE
+ 'no properties' | null | null | null || [:] | [:] | null
}
def 'Handling empty dmi registration'() {