Merge "Update Cps Events LCM RTD"
authorJoseph Keenan <joseph.keenan@est.tech>
Fri, 19 Aug 2022 10:28:32 +0000 (10:28 +0000)
committerGerrit Code Review <gerrit@onap.org>
Fri, 19 Aug 2022 10:28:32 +0000 (10:28 +0000)
INFO.yaml
cps-application/src/main/resources/application.yml
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/NcmpConfiguration.java
cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/sync/ModuleSyncWatchdogSpec.groovy
cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/sync/SyncUtilsSpec.groovy
csit/plans/cps/test.properties
docker-compose/docker-compose.yml

index 88e186e..a411e37 100755 (executable)
--- a/INFO.yaml
+++ b/INFO.yaml
@@ -62,6 +62,11 @@ committers:
       company: 'Ericsson Software Technology'
       id: 'JosephKeenan'
       timezone: 'Europe/Dublin'
+    - name: 'Sourabh Sharma'
+      email: 'sourabh.sourabh@est.tech'
+      company: 'Ericsson Software Technology'
+      id: 'sourabh_sourabh'
+      timezone: 'Europe/Dublin'
 repositories:
     - cps
 tsc:
index 6bbe80b..1755134 100644 (file)
@@ -46,6 +46,13 @@ spring:
         password: ${DB_PASSWORD}\r
         driverClassName: org.postgresql.Driver\r
         initialization-mode: always\r
+        hikari:\r
+            minimumIdle: 5\r
+            maximumPoolSize: 80\r
+            idleTimeout: 120000\r
+            connectionTimeout: 300000\r
+            leakDetectionThreshold: 300000\r
+            pool-name: CpsDatabasePool\r
 \r
     cache:\r
         type: caffeine\r
@@ -100,8 +107,8 @@ notification:
             enabled-dataspaces: ${NOTIFICATION_DATASPACE_FILTER_PATTERNS:""}\r
     async:\r
         executor:\r
-            core-pool-size: 10\r
-            max-pool-size: 100\r
+            core-pool-size: 2\r
+            max-pool-size: 10\r
             queue-capacity: 500\r
             wait-for-tasks-to-complete-on-shutdown: true\r
             thread-name-prefix: Async-\r
@@ -164,4 +171,4 @@ timers:
     locked-modules-sync:\r
         sleep-time-ms: 300000\r
     cm-handle-data-sync:\r
-        sleep-time-ms: 30000
\ No newline at end of file
+        sleep-time-ms: 30000\r
index a418155..f250ddb 100644 (file)
@@ -20,6 +20,7 @@
 
 package org.onap.cps.ncmp.api.impl.config;
 
+import java.time.Duration;
 import java.util.Arrays;
 import lombok.AccessLevel;
 import lombok.Getter;
@@ -39,6 +40,9 @@ import org.springframework.web.client.RestTemplate;
 @RequiredArgsConstructor(access = AccessLevel.PROTECTED)
 public class NcmpConfiguration {
 
+    private static final Duration CONNECTION_TIMEOUT_MILLISECONDS = Duration.ofMillis(180000);
+    private static final Duration READ_TIMEOUT_MILLISECONDS = Duration.ofMillis(180000);
+
     @Getter
     @Component
     public static class DmiProperties {
@@ -59,7 +63,8 @@ public class NcmpConfiguration {
     @Bean
     @Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
     public static RestTemplate restTemplate(final RestTemplateBuilder restTemplateBuilder) {
-        final RestTemplate restTemplate = restTemplateBuilder.build();
+        final RestTemplate restTemplate = restTemplateBuilder.setConnectTimeout(CONNECTION_TIMEOUT_MILLISECONDS)
+                .setReadTimeout(READ_TIMEOUT_MILLISECONDS).build();
         setRestTemplateMessageConverters(restTemplate);
         return restTemplate;
     }
index 863977a..81268cb 100644 (file)
 
 package org.onap.cps.ncmp.api.inventory.sync
 
-import org.mockito.Mock
+
 import org.onap.cps.ncmp.api.impl.event.lcm.LcmEventsCmHandleStateHandler
 import org.onap.cps.ncmp.api.impl.yangmodels.YangModelCmHandle
 import org.onap.cps.ncmp.api.inventory.CmHandleState
 import org.onap.cps.ncmp.api.inventory.CompositeState
-import org.onap.cps.ncmp.api.inventory.DataStoreSyncState
 import org.onap.cps.ncmp.api.inventory.InventoryPersistence
 import org.onap.cps.ncmp.api.inventory.LockReasonCategory
 import org.onap.cps.ncmp.api.inventory.CompositeStateBuilder
index 82e9d33..fb4ca39 100644 (file)
@@ -62,13 +62,25 @@ class SyncUtilsSpec extends Specification{
     @Shared
     def dataNode = new DataNode(leaves: ['id': 'cm-handle-123'])
 
+    @Shared
+    def dataNodeAdditionalProperties = new DataNode(leaves: ['name': 'dmiProp1', 'value': 'dmiValue1'])
+
+
     def 'Get an advised Cm-Handle where ADVISED cm handle #scenario'() {
         given: 'the inventory persistence service returns a collection of data nodes'
             mockCmHandleQueries.getCmHandlesByState(CmHandleState.ADVISED) >> dataNodeCollection
+        and: 'we have some additional (dmi, private) properties'
+            dataNodeAdditionalProperties.xpath = dataNode.xpath + '/additional-properties[@name="dmiProp1"]'
+            dataNode.childDataNodes = [dataNodeAdditionalProperties]
         when: 'get advised cm handles are fetched'
             def yangModelCmHandles = objectUnderTest.getAdvisedCmHandles()
         then: 'the returned data node collection is the correct size'
             yangModelCmHandles.size() == expectedDataNodeSize
+        and: 'if there is a data node the additional (dmi, private) properties are included'
+            if (expectedDataNodeSize > 0) {
+                assert yangModelCmHandles[0].dmiProperties[0].name == 'dmiProp1'
+                assert yangModelCmHandles[0].dmiProperties[0].value == 'dmiValue1'
+            }
         and: 'yang model collection contains the correct data'
             yangModelCmHandles.stream().map(yangModel -> yangModel.id).collect(Collectors.toSet()) ==
                 dataNodeCollection.stream().map(dataNode -> dataNode.leaves.get("id")).collect(Collectors.toSet())
index 47bb43b..449aa93 100644 (file)
@@ -23,4 +23,7 @@ DMI_SERVICE_URL=http://$LOCAL_IP:$DMI_PORT
 DOCKER_REPO=nexus3.onap.org:10003
 
 CPS_VERSION=latest
-DMI_VERSION=1.2.0-SNAPSHOT-latest
\ No newline at end of file
+DMI_VERSION=1.2.0-SNAPSHOT-latest
+
+ADVISED_MODULES_SYNC_SLEEP_TIME_MS=2000
+CMHANDLE_DATA_SYNC_SLEEP_TIME_MS=2000
\ No newline at end of file
index 8d3a0a3..ca7795f 100644 (file)
@@ -49,8 +49,8 @@ services:
       notification.enabled: 'true'
       notification.async.executor.time-out-value-in-ms: 2000
       NOTIFICATION_DATASPACE_FILTER_PATTERNS: '.*'
-      TIMERS_ADVISED-MODULES-SYNC_SLEEP-TIME-MS: 2000
-      TIMERS_CM-HANDLE-DATA-SYNC_SLEEP-TIME-MS: 2000
+      TIMERS_ADVISED-MODULES-SYNC_SLEEP-TIME-MS: ${ADVISED_MODULES_SYNC_SLEEP_TIME_MS:-30000}
+      TIMERS_CM-HANDLE-DATA-SYNC_SLEEP-TIME-MS: ${CMHANDLE_DATA_SYNC_SLEEP_TIME_MS:-30000}
     restart: unless-stopped
     depends_on:
       - dbpostgresql