summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service
diff options
context:
space:
mode:
authorDaniel Hanrahan <daniel.hanrahan@est.tech>2024-09-02 09:22:13 +0000
committerGerrit Code Review <gerrit@onap.org>2024-09-02 09:22:13 +0000
commit29aefda31575e17ef5d8584f7b3a92b882995a15 (patch)
tree27c3c4505298c47e0f1d6cfb48a2d5c1761b025e /cps-ncmp-service
parent5b2edb3e260d1daf69b36e42c5a5bc2e23d64615 (diff)
parent45308e0a3309c48511a9e2d44798fddabdb16096 (diff)
Merge "Support alternate id interface for CPS-E-05 - publicProperties"
Diffstat (limited to 'cps-ncmp-service')
-rw-r--r--cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/NetworkCmProxyInventoryFacade.java7
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/NetworkCmProxyInventoryFacadeSpec.groovy18
2 files changed, 17 insertions, 8 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/NetworkCmProxyInventoryFacade.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/NetworkCmProxyInventoryFacade.java
index e678159d9f..785eb8f022 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/NetworkCmProxyInventoryFacade.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/NetworkCmProxyInventoryFacade.java
@@ -191,12 +191,13 @@ public class NetworkCmProxyInventoryFacade {
}
/**
- * Get cm handle public properties for a given cm handle id.
+ * Get cm handle public properties for a given cm handle or alternate id.
*
- * @param cmHandleId cm handle identifier
+ * @param cmHandleReference cm handle or alternate identifier
* @return cm handle public properties
*/
- public Map<String, String> getCmHandlePublicProperties(final String cmHandleId) {
+ public Map<String, String> getCmHandlePublicProperties(final String cmHandleReference) {
+ final String cmHandleId = alternateIdMatcher.getCmHandleId(cmHandleReference);
final YangModelCmHandle yangModelCmHandle = inventoryPersistence.getYangModelCmHandle(cmHandleId);
return YangDataConverter.toPropertiesMap(yangModelCmHandle.getPublicProperties());
}
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/NetworkCmProxyInventoryFacadeSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/NetworkCmProxyInventoryFacadeSpec.groovy
index b243a74cd9..9d51fff05a 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/NetworkCmProxyInventoryFacadeSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/NetworkCmProxyInventoryFacadeSpec.groovy
@@ -134,17 +134,25 @@ class NetworkCmProxyInventoryFacadeSpec extends Specification {
assert result.currentTrustLevel == TrustLevel.COMPLETE
}
- def 'Get cm handle public properties'() {
+ def 'Get cm handle public properties using #scenario'() {
given: 'a yang modelled cm handle'
def dmiProperties = [new YangModelCmHandle.Property('prop', 'some DMI property')]
def publicProperties = [new YangModelCmHandle.Property('public prop', 'some public prop')]
- def yangModelCmHandle = new YangModelCmHandle(id:'some-cm-handle', dmiServiceName: 'some service name', dmiProperties: dmiProperties, publicProperties: publicProperties)
+ def cmHandleId = 'some-cm-handle'
+ def alternateId = 'some-alternate-id'
+ def yangModelCmHandle = new YangModelCmHandle(id:cmHandleId, alternateId: alternateId, dmiServiceName: 'some service name', dmiProperties: dmiProperties, publicProperties: publicProperties)
+ and: 'we have corresponding cm handle for the cm handle reference'
+ 1 * mockAlternateIdMatcher.getCmHandleId(cmHandleRef) >> cmHandleId
and: 'the system returns this yang modelled cm handle'
- 1 * mockInventoryPersistence.getYangModelCmHandle('some-cm-handle') >> yangModelCmHandle
- when: 'getting cm handle public properties for a given cm handle id from ncmp service'
- def result = objectUnderTest.getCmHandlePublicProperties('some-cm-handle')
+ 1 * mockInventoryPersistence.getYangModelCmHandle(cmHandleId) >> yangModelCmHandle
+ when: 'getting cm handle public properties for a given cm handle reference from ncmp service'
+ def result = objectUnderTest.getCmHandlePublicProperties(cmHandleRef)
then: 'the result returns the correct data'
assert result == [ 'public prop' : 'some public prop' ]
+ where: 'following cm handle reference is used'
+ scenario | cmHandleRef
+ 'Cm Handle Reference as cm handle-id' | 'some-cm-handle'
+ 'Cm Handle Reference as alternate-id' | 'some-alternate-id'
}
def 'Get cm handle composite state using #scenario'() {