summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xcps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java13
-rw-r--r--cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/DmiPluginRegistration.java4
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplRegistrationSpec.groovy14
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy5
4 files changed, 28 insertions, 8 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java
index ea2f72fef7..f8b4b3326c 100755
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java
@@ -46,6 +46,7 @@ import org.onap.cps.ncmp.api.NetworkCmProxyDataService;
import org.onap.cps.ncmp.api.impl.events.lcm.LcmEventsCmHandleStateHandler;
import org.onap.cps.ncmp.api.impl.operations.DmiDataOperations;
import org.onap.cps.ncmp.api.impl.operations.OperationType;
+import org.onap.cps.ncmp.api.impl.trustlevel.TrustLevel;
import org.onap.cps.ncmp.api.impl.utils.CmHandleQueryConditions;
import org.onap.cps.ncmp.api.impl.utils.InventoryQueryConditions;
import org.onap.cps.ncmp.api.impl.utils.YangDataConverter;
@@ -90,6 +91,7 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService
private final LcmEventsCmHandleStateHandler lcmEventsCmHandleStateHandler;
private final CpsDataService cpsDataService;
private final IMap<String, Object> moduleSyncStartedOnCmHandles;
+ private final IMap<String, TrustLevel> trustLevelPerDmiPlugin;
@Override
public DmiPluginRegistrationResponse updateDmiRegistrationAndSyncModule(
@@ -111,6 +113,9 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService
networkCmProxyDataServicePropertyHandler
.updateCmHandleProperties(dmiPluginRegistration.getUpdatedCmHandles()));
}
+
+ setTrustLevelPerDmiPlugin(dmiPluginRegistration);
+
return dmiPluginRegistrationResponse;
}
@@ -411,4 +416,12 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService
}
}
+ private void setTrustLevelPerDmiPlugin(final DmiPluginRegistration dmiPluginRegistration) {
+ if (DmiPluginRegistration.isNullEmptyOrBlank(dmiPluginRegistration.getDmiDataPlugin())) {
+ trustLevelPerDmiPlugin.put(dmiPluginRegistration.getDmiPlugin(), TrustLevel.COMPLETE);
+ } else {
+ trustLevelPerDmiPlugin.put(dmiPluginRegistration.getDmiDataPlugin(), TrustLevel.COMPLETE);
+ }
+ }
+
}
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/DmiPluginRegistration.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/DmiPluginRegistration.java
index d1360c3256..953b3c4e94 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/DmiPluginRegistration.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/DmiPluginRegistration.java
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2022 Nordix Foundation
+ * Copyright (C) 2021-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.
@@ -80,7 +80,7 @@ public class DmiPluginRegistration {
}
}
- private static boolean isNullEmptyOrBlank(final String serviceName) {
+ public static boolean isNullEmptyOrBlank(final String serviceName) {
return Strings.isNullOrEmpty(serviceName) || serviceName.isBlank();
}
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplRegistrationSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplRegistrationSpec.groovy
index 8942c42f13..654377c7c5 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplRegistrationSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplRegistrationSpec.groovy
@@ -29,6 +29,7 @@ import org.onap.cps.ncmp.api.NetworkCmProxyCmHandleQueryService
import org.onap.cps.ncmp.api.impl.events.lcm.LcmEventsCmHandleStateHandler
import org.onap.cps.ncmp.api.impl.exception.DmiRequestException
import org.onap.cps.ncmp.api.impl.operations.DmiDataOperations
+import org.onap.cps.ncmp.api.impl.trustlevel.TrustLevel
import org.onap.cps.ncmp.api.impl.yangmodels.YangModelCmHandle
import org.onap.cps.ncmp.api.inventory.CmHandleQueries
import org.onap.cps.ncmp.api.inventory.CmHandleState
@@ -65,6 +66,7 @@ class NetworkCmProxyDataServiceImplRegistrationSpec extends Specification {
def mockLcmEventsCmHandleStateHandler = Mock(LcmEventsCmHandleStateHandler)
def mockCpsDataService = Mock(CpsDataService)
def mockModuleSyncStartedOnCmHandles = Mock(IMap<String, Object>)
+ def mockTrustLevelPerDmiPlugin = Mock(IMap<String, TrustLevel>)
def objectUnderTest = getObjectUnderTest()
def 'DMI Registration: Create, Update & Delete operations are processed in the right order'() {
@@ -119,11 +121,13 @@ class NetworkCmProxyDataServiceImplRegistrationSpec extends Specification {
objectUnderTest.updateDmiRegistrationAndSyncModule(dmiPluginRegistration)
then: 'create cm handles registration and sync modules is called with the correct plugin information'
1 * objectUnderTest.parseAndCreateCmHandlesInDmiRegistrationAndSyncModules(dmiPluginRegistration)
+ and: 'dmi is added to the trustLevel map'
+ 1 * mockTrustLevelPerDmiPlugin.put(dmiPluginRegisteredName, TrustLevel.COMPLETE)
where:
- scenario | dmiPlugin | dmiModelPlugin | dmiDataPlugin
- 'combined DMI plugin' | 'service1' | '' | ''
- 'data & model DMI plugins' | '' | 'service1' | 'service2'
- 'data & model using same service' | '' | 'service1' | 'service1'
+ scenario | dmiPlugin | dmiModelPlugin | dmiDataPlugin | dmiPluginRegisteredName
+ 'combined DMI plugin' | 'service1' | '' | '' | 'service1'
+ 'data & model DMI plugins' | '' | 'service1' | 'service2' | 'service2'
+ 'data & model using same service' | '' | 'service1' | 'service1' | 'service1'
}
def 'Create CM-handle Validation: Invalid DMI plugin service name with #scenario'() {
@@ -376,7 +380,7 @@ class NetworkCmProxyDataServiceImplRegistrationSpec extends Specification {
return Spy(new NetworkCmProxyDataServiceImpl(spiedJsonObjectMapper, mockDmiDataOperations,
mockNetworkCmProxyDataServicePropertyHandler, mockInventoryPersistence, mockCmhandleQueries,
stubbedNetworkCmProxyCmHandlerQueryService, mockLcmEventsCmHandleStateHandler, mockCpsDataService,
- mockModuleSyncStartedOnCmHandles))
+ mockModuleSyncStartedOnCmHandles, mockTrustLevelPerDmiPlugin))
}
def addPersistedYangModelCmHandles(ids) {
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy
index cf5aae1817..50fc30f78a 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy
@@ -26,6 +26,7 @@ package org.onap.cps.ncmp.api.impl
import com.hazelcast.map.IMap
import org.onap.cps.ncmp.api.NetworkCmProxyCmHandleQueryService
import org.onap.cps.ncmp.api.impl.events.lcm.LcmEventsCmHandleStateHandler
+import org.onap.cps.ncmp.api.impl.trustlevel.TrustLevel
import org.onap.cps.ncmp.api.impl.yangmodels.YangModelCmHandle
import org.onap.cps.ncmp.api.inventory.CmHandleQueries
import org.onap.cps.ncmp.api.inventory.CmHandleState
@@ -72,6 +73,7 @@ class NetworkCmProxyDataServiceImplSpec extends Specification {
def mockCpsCmHandlerQueryService = Mock(NetworkCmProxyCmHandleQueryService)
def mockLcmEventsCmHandleStateHandler = Mock(LcmEventsCmHandleStateHandler)
def stubModuleSyncStartedOnCmHandles = Stub(IMap<String, Object>)
+ def stubTrustLevelPerDmiPlugin = Stub(IMap<String, TrustLevel>)
def NO_TOPIC = null
def NO_REQUEST_ID = null
@@ -89,7 +91,8 @@ class NetworkCmProxyDataServiceImplSpec extends Specification {
mockCpsCmHandlerQueryService,
mockLcmEventsCmHandleStateHandler,
mockCpsDataService,
- stubModuleSyncStartedOnCmHandles)
+ stubModuleSyncStartedOnCmHandles,
+ stubTrustLevelPerDmiPlugin)
def cmHandleXPath = "/dmi-registry/cm-handles[@id='testCmHandle']"