Merge "Set lock state and reason upon request"
authorToine Siebelink <toine.siebelink@est.tech>
Thu, 21 Sep 2023 08:57:40 +0000 (08:57 +0000)
committerGerrit Code Review <gerrit@onap.org>
Thu, 21 Sep 2023 08:57:40 +0000 (08:57 +0000)
42 files changed:
checkstyle/pom.xml
cps-application/pom.xml
cps-application/src/main/resources/application.yml
cps-bom/pom.xml
cps-dependencies/pom.xml
cps-events/pom.xml
cps-ncmp-events/pom.xml
cps-ncmp-rest-stub/cps-ncmp-rest-stub-app/pom.xml
cps-ncmp-rest-stub/cps-ncmp-rest-stub-service/pom.xml
cps-ncmp-rest-stub/pom.xml
cps-ncmp-rest/docs/openapi/components.yaml
cps-ncmp-rest/pom.xml
cps-ncmp-service/pom.xml
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/client/DmiRestClient.java
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/embeddedcache/TrustLevelCacheConfig.java
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/trustlevel/dmiavailability/DMiPluginWatchDog.java [new file with mode: 0644]
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/trustlevel/dmiavailability/DmiPluginStatus.java [new file with mode: 0644]
cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/client/DmiRestClientSpec.groovy
cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/trustlevel/dmiavailability/DMiPluginWatchDogSpec.groovy [new file with mode: 0644]
cps-ncmp-service/src/test/resources/application.yml
cps-ncmp-service/src/test/resources/dmiPluginHealthCheckResponse.json [new file with mode: 0644]
cps-parent/pom.xml
cps-path-parser/pom.xml
cps-rest/pom.xml
cps-ri/pom.xml
cps-service/pom.xml
cps-service/src/main/java/org/onap/cps/yang/YangTextSchemaSourceSetBuilder.java
csit/tests/cps-data-operations/cps-data-operations.robot
csit/tests/cps-subscriptions/cps-subscription-notification.robot
dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-app/pom.xml
dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/pom.xml
dmi-plugin-demo-and-csit-stub/pom.xml
docs/api/swagger/ncmp/openapi-inventory.yaml
docs/deployment.rst
docs/release-notes.rst
integration-test/pom.xml
jacoco-report/pom.xml
pom.xml
releases/3.3.7-container.yaml [new file with mode: 0644]
releases/3.3.7.yaml [new file with mode: 0644]
spotbugs/pom.xml
version.properties

index ef52947..4cf950e 100644 (file)
@@ -26,7 +26,7 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.onap.cps</groupId>
     <artifactId>checkstyle</artifactId>
-    <version>3.3.7-SNAPSHOT</version>
+    <version>3.3.8-SNAPSHOT</version>
 
     <profiles>
         <profile>
index e886970..0cf68ad 100755 (executable)
@@ -28,7 +28,7 @@
     <parent>
         <groupId>org.onap.cps</groupId>
         <artifactId>cps-parent</artifactId>
-        <version>3.3.7-SNAPSHOT</version>
+        <version>3.3.8-SNAPSHOT</version>
         <relativePath>../cps-parent/pom.xml</relativePath>
     </parent>
 
index 6aefda9..5874827 100644 (file)
@@ -191,6 +191,8 @@ ncmp:
             dmi-response-timeout-ms: 30000
         model-loader:
             retry-time-ms: 1000
+        trust-level:
+            dmi-availability-watchdog-ms: 30000
 
     modules-sync-watchdog:
         async-executor:
index f3c8f78..0f5cb4b 100644 (file)
@@ -25,7 +25,7 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.onap.cps</groupId>
     <artifactId>cps-bom</artifactId>
-    <version>3.3.7-SNAPSHOT</version>
+    <version>3.3.8-SNAPSHOT</version>
     <packaging>pom</packaging>
 
     <description>This artifact contains dependencyManagement declarations of all published CPS components.</description>
index 822d7cc..dac6e66 100755 (executable)
@@ -27,7 +27,7 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.onap.cps</groupId>
     <artifactId>cps-dependencies</artifactId>
-    <version>3.3.7-SNAPSHOT</version>
+    <version>3.3.8-SNAPSHOT</version>
     <packaging>pom</packaging>
 
     <name>${project.groupId}:${project.artifactId}</name>
index b305a31..d776ccb 100644 (file)
@@ -24,7 +24,7 @@
     <parent>
         <groupId>org.onap.cps</groupId>
         <artifactId>cps-parent</artifactId>
-        <version>3.3.7-SNAPSHOT</version>
+        <version>3.3.8-SNAPSHOT</version>
         <relativePath>../cps-parent/pom.xml</relativePath>
     </parent>
 
index 47b10c9..3e06028 100644 (file)
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.onap.cps</groupId>
         <artifactId>cps-parent</artifactId>
-        <version>3.3.7-SNAPSHOT</version>
+        <version>3.3.8-SNAPSHOT</version>
         <relativePath>../cps-parent/pom.xml</relativePath>
     </parent>
 
index 6683a23..275313c 100644 (file)
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.onap.cps</groupId>
         <artifactId>cps-ncmp-rest-stub</artifactId>
-        <version>3.3.7-SNAPSHOT</version>
+        <version>3.3.8-SNAPSHOT</version>
     </parent>
 
     <artifactId>cps-ncmp-rest-stub-app</artifactId>
index d7a5da0..435cc70 100644 (file)
@@ -21,7 +21,7 @@
     <parent>
         <groupId>org.onap.cps</groupId>
         <artifactId>cps-ncmp-rest-stub</artifactId>
-        <version>3.3.7-SNAPSHOT</version>
+        <version>3.3.8-SNAPSHOT</version>
     </parent>
     <artifactId>cps-ncmp-rest-stub-service</artifactId>
 
index 5e9d3de..4db8617 100644 (file)
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.onap.cps</groupId>
         <artifactId>cps-parent</artifactId>
-        <version>3.3.7-SNAPSHOT</version>
+        <version>3.3.8-SNAPSHOT</version>
         <relativePath>../cps-parent/pom.xml</relativePath>
     </parent>
 
index 818b2da..243de62 100644 (file)
@@ -127,6 +127,9 @@ components:
           $ref: '#/components/schemas/RestCmHandleProperties'
         publicCmHandleProperties:
           $ref: '#/components/schemas/RestCmHandleProperties'
+        moduleSetTag:
+          type: string
+          example: "my-module-set-tag"
     RestCmHandleProperties:
       type: object
       additionalProperties:
index 1ac1bd7..2d6f687 100644 (file)
@@ -27,7 +27,7 @@
     <parent>
         <groupId>org.onap.cps</groupId>
         <artifactId>cps-parent</artifactId>
-        <version>3.3.7-SNAPSHOT</version>
+        <version>3.3.8-SNAPSHOT</version>
         <relativePath>../cps-parent/pom.xml</relativePath>
     </parent>
 
index fa3a369..527d70b 100644 (file)
@@ -27,7 +27,7 @@
     <parent>
         <groupId>org.onap.cps</groupId>
         <artifactId>cps-parent</artifactId>
-        <version>3.3.7-SNAPSHOT</version>
+        <version>3.3.8-SNAPSHOT</version>
         <relativePath>../cps-parent/pom.xml</relativePath>
     </parent>
 
index 28e09ac..7066f80 100644 (file)
 
 package org.onap.cps.ncmp.api.impl.client;
 
+import com.fasterxml.jackson.databind.JsonNode;
 import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
 import org.onap.cps.ncmp.api.impl.config.NcmpConfiguration.DmiProperties;
 import org.onap.cps.ncmp.api.impl.exception.HttpClientRequestException;
 import org.onap.cps.ncmp.api.impl.operations.OperationType;
+import org.onap.cps.ncmp.api.impl.trustlevel.dmiavailability.DmiPluginStatus;
 import org.springframework.http.HttpEntity;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.MediaType;
@@ -35,6 +38,7 @@ import org.springframework.web.client.RestTemplate;
 
 @Component
 @AllArgsConstructor
+@Slf4j
 public class DmiRestClient {
 
     private RestTemplate restTemplate;
@@ -60,6 +64,28 @@ public class DmiRestClient {
         }
     }
 
+    /**
+     * Sends GET operation to DMI plugin's health check URL.
+     *
+     * @param       dmiPluginBaseUrl the base URL of the dmi-plugin
+     * @return      DmiPluginStatus as UP or DOWN
+     */
+    public DmiPluginStatus getDmiPluginStatus(final String dmiPluginBaseUrl) {
+        try {
+            final HttpEntity<Object> httpHeaders = new HttpEntity<>(configureHttpHeaders(new HttpHeaders()));
+            final JsonNode dmiPluginHealthStatus = restTemplate.getForObject(dmiPluginBaseUrl + "/manage/health",
+                    JsonNode.class, httpHeaders);
+            if (dmiPluginHealthStatus != null) {
+                if (dmiPluginHealthStatus.get("status").asText().equals("UP")) {
+                    return DmiPluginStatus.UP;
+                }
+            }
+        } catch (final Exception exception) {
+            log.warn("Could not send request for health check since {}", exception.getMessage());
+        }
+        return DmiPluginStatus.DOWN;
+    }
+
     private HttpHeaders configureHttpHeaders(final HttpHeaders httpHeaders) {
         if (dmiProperties.isDmiBasicAuthEnabled()) {
             httpHeaders.setBasicAuth(dmiProperties.getAuthUsername(), dmiProperties.getAuthPassword());
index 66f6190..ebe9905 100644 (file)
@@ -32,24 +32,25 @@ import org.springframework.context.annotation.Configuration;
 @Configuration
 public class TrustLevelCacheConfig extends HazelcastCacheConfig {
 
-    private static final SetConfig untrustworthyCmHandlesSetConfig = createSetConfig("untrustworthyCmHandlesSetConfig");
+    private static final SetConfig untrustworthyCmHandlesSetConfig =
+            createSetConfig("untrustworthyCmHandlesSetConfig");
+
+    private static final MapConfig trustLevelPerDmiPluginCacheConfig =
+            createMapConfig("trustLevelPerDmiPluginCacheConfig");
 
     /**
-     * Untrustworthy cmhandle set instance.
+     * Distributed collection of untrustworthy cm handles.
      *
-     * @return instance of distributed set of untrustworthy cmhandles.
+     * @return instance of distributed set of untrustworthy cm handles.
      */
     @Bean
     public ISet<String> untrustworthyCmHandlesSet() {
-        return createHazelcastInstance("untrustworthyCmHandlesSet", untrustworthyCmHandlesSetConfig).getSet(
-                "untrustworthyCmHandlesSet");
+        return createHazelcastInstance("untrustworthyCmHandlesSet",
+                untrustworthyCmHandlesSetConfig).getSet("untrustworthyCmHandlesSet");
     }
 
-    private static final MapConfig trustLevelPerDmiPluginCacheConfig =
-            createMapConfig("trustLevelPerDmiPluginCacheConfig");
-
     /**
-     * Distributed instance of trust level cache that contains dmi-plugin name by trust level.
+     * Distributed instance of trust level cache containing the trust level per dmi plugin service(name).
      *
      * @return configured map of dmi-plugin name as keys to trust-level for values.
      */
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/trustlevel/dmiavailability/DMiPluginWatchDog.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/trustlevel/dmiavailability/DMiPluginWatchDog.java
new file mode 100644 (file)
index 0000000..dac32aa
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 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.
+ *  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+package org.onap.cps.ncmp.api.impl.trustlevel.dmiavailability;
+
+import com.hazelcast.map.IMap;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.onap.cps.ncmp.api.impl.client.DmiRestClient;
+import org.onap.cps.ncmp.api.impl.trustlevel.TrustLevel;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Service;
+
+@Slf4j
+@RequiredArgsConstructor
+@Service
+public class DMiPluginWatchDog {
+
+    private final IMap<String, TrustLevel> trustLevelPerDmiPlugin;
+
+    private final DmiRestClient dmiRestClient;
+
+    /**
+     * Monitors the aliveness of DMI plugins by this watchdog.
+     * This method periodically checks the health and status of each DMI plugin to ensure that
+     * they are functioning properly. If a plugin is found to be unresponsive or in an
+     * unhealthy state, the cache will be updated with the latest status.
+     * The @fixedDelayString is the time interval, in milliseconds, between consecutive aliveness checks.
+     */
+    @Scheduled(fixedDelayString = "${ncmp.timers.trust-evel.dmi-availability-watchdog-ms:30000}")
+    public void watchDmiPluginAliveness() {
+        trustLevelPerDmiPlugin.keySet().forEach((dmiPluginName) -> {
+            final DmiPluginStatus dmiPluginStatus = dmiRestClient.getDmiPluginStatus(dmiPluginName);
+            log.debug("Trust level for dmi-plugin: {} is {}", dmiPluginName, dmiPluginStatus.toString());
+            if (DmiPluginStatus.UP.equals(dmiPluginStatus)) {
+                trustLevelPerDmiPlugin.put(dmiPluginName, TrustLevel.COMPLETE);
+            } else {
+                trustLevelPerDmiPlugin.put(dmiPluginName, TrustLevel.NONE);
+            }
+        });
+    }
+
+}
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/trustlevel/dmiavailability/DmiPluginStatus.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/trustlevel/dmiavailability/DmiPluginStatus.java
new file mode 100644 (file)
index 0000000..352d36f
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 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.
+ *  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+package org.onap.cps.ncmp.api.impl.trustlevel.dmiavailability;
+
+public enum DmiPluginStatus {
+    UP, DOWN;
+}
index 0d03fd9..80c0a27 100644 (file)
 
 package org.onap.cps.ncmp.api.impl.client
 
+import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.ObjectMapper
+import com.fasterxml.jackson.databind.node.ObjectNode
 import org.onap.cps.ncmp.api.impl.config.NcmpConfiguration
 import org.onap.cps.ncmp.api.impl.exception.HttpClientRequestException
+import org.onap.cps.ncmp.api.impl.trustlevel.dmiavailability.DmiPluginStatus
+import org.onap.cps.ncmp.utils.TestUtils
 import org.spockframework.spring.SpringBean
 import org.springframework.beans.factory.annotation.Autowired
 import org.springframework.boot.test.context.SpringBootTest
@@ -40,7 +45,7 @@ import static org.onap.cps.ncmp.api.impl.operations.OperationType.PATCH
 import static org.onap.cps.ncmp.api.impl.operations.OperationType.CREATE
 
 @SpringBootTest
-@ContextConfiguration(classes = [NcmpConfiguration.DmiProperties, DmiRestClient])
+@ContextConfiguration(classes = [NcmpConfiguration.DmiProperties, DmiRestClient, ObjectMapper])
 class DmiRestClientSpec extends Specification {
 
     @SpringBean
@@ -48,8 +53,11 @@ class DmiRestClientSpec extends Specification {
 
     @Autowired
     DmiRestClient objectUnderTest
-    def resourceUrl = 'some url'
 
+    @Autowired
+    ObjectMapper objectMapper
+
+    def resourceUrl = 'some url'
     def mockResponseEntity = Mock(ResponseEntity)
     def dmiProperties = new NcmpConfiguration.DmiProperties()
 
@@ -85,6 +93,36 @@ class DmiRestClientSpec extends Specification {
             operation << [CREATE, READ, PATCH]
     }
 
+    def 'Get dmi plugin health status #scenario'() {
+        given: 'a health check response data as jsonNode'
+            def dmiPluginHealthCheckResponseJsonData = TestUtils.getResourceFileContent('dmiPluginHealthCheckResponse.json')
+            def jsonNode = objectMapper.readValue(dmiPluginHealthCheckResponseJsonData, JsonNode.class)
+            ((ObjectNode) jsonNode).put('status', dmiAliveness);
+        and: 'the rest template return a valid json node'
+            mockRestTemplate.getForObject(*_) >> {jsonNode}
+        when: 'get aliveness of the dmi plugin'
+            def result = objectUnderTest.getDmiPluginStatus(resourceUrl)
+        then: 'return value is equal to result of rest template call'
+            result == expectedResult
+        where: 'the following dmi aliveness are being used'
+            scenario             | dmiAliveness || expectedResult
+            'dmi plugin is UP'   | 'UP'         || DmiPluginStatus.UP
+            'dmi plugin is DOWN' | 'DOWN'       || DmiPluginStatus.DOWN
+    }
+
+    def 'Failing to get dmi plugin health status #scenario'() {
+        given: 'the rest template return null'
+            mockRestTemplate.getForObject(*_) >> {getResponse}
+        when: 'get aliveness of the dmi plugin'
+            def result = objectUnderTest.getDmiPluginStatus(resourceUrl)
+        then: 'return value is equal to result of rest template call'
+            result == expectedResult
+        where: 'the following dmi responses are being used'
+            scenario                        | getResponse                  || expectedResult
+            'get response is null'          | null                         || DmiPluginStatus.DOWN
+            'get response throws exception' | {throw new Exception()}      || DmiPluginStatus.DOWN
+    }
+
     def 'Basic auth header #scenario'() {
         when: 'Specific dmi properties are provided'
             dmiProperties.dmiBasicAuthEnabled = authEnabled
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/trustlevel/dmiavailability/DMiPluginWatchDogSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/trustlevel/dmiavailability/DMiPluginWatchDogSpec.groovy
new file mode 100644 (file)
index 0000000..af546b7
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 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.
+ *  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+package org.onap.cps.ncmp.api.impl.trustlevel.dmiavailability
+
+import com.hazelcast.map.IMap
+import org.onap.cps.ncmp.api.impl.client.DmiRestClient
+import org.onap.cps.ncmp.api.impl.trustlevel.TrustLevel
+import spock.lang.Specification
+
+class DMiPluginWatchDogSpec extends Specification {
+
+
+    def mockTrustLevelPerDmiPlugin = Mock(IMap<String, TrustLevel>)
+    def mockDmiRestClient = Mock(DmiRestClient)
+    def objectUnderTest = new DMiPluginWatchDog(mockTrustLevelPerDmiPlugin, mockDmiRestClient)
+
+
+    def 'watch dmi plugin aliveness'() {
+        given: 'the dmi client returns aliveness for #dmi1Status'
+            mockDmiRestClient.getDmiPluginStatus('dmi1') >> dmi1Status
+        and: 'trust level cache returns dmi1'
+            mockTrustLevelPerDmiPlugin.keySet() >> {['dmi1'] as Set}
+        when: 'watch dog started'
+            objectUnderTest.watchDmiPluginAliveness()
+        then: 'trust level cache has been populated with #dmi1TrustLevel for dmi1'
+            1 * mockTrustLevelPerDmiPlugin.put('dmi1', dmi1TrustLevel)
+        where: 'the following parameter are used'
+            scenario                  | dmi1Status              || dmi1TrustLevel
+            'dmi1 is UP'              | DmiPluginStatus.UP      || TrustLevel.COMPLETE
+            'dmi1 is DOWN'            | DmiPluginStatus.DOWN    || TrustLevel.NONE
+    }
+
+}
index 6e7577b..a4bb4e8 100644 (file)
@@ -42,6 +42,9 @@ ncmp:
             enabled: true
         api:
             base-path: dmi
+    timers:
+        trust-level:
+            dmi-availability-watchdog-ms: 30000
 
     modules-sync-watchdog:
         async-executor:
diff --git a/cps-ncmp-service/src/test/resources/dmiPluginHealthCheckResponse.json b/cps-ncmp-service/src/test/resources/dmiPluginHealthCheckResponse.json
new file mode 100644 (file)
index 0000000..7532220
--- /dev/null
@@ -0,0 +1,27 @@
+{
+  "status": "UP",
+  "components": {
+    "diskSpace": {
+      "status": "UP",
+      "details": {
+        "total": 269490393088,
+        "free": 228467286016,
+        "threshold": 10485760,
+        "exists": true
+      }
+    },
+    "livenessState": {
+      "status": "UP"
+    },
+    "ping": {
+      "status": "UP"
+    },
+    "readinessState": {
+      "status": "UP"
+    }
+  },
+  "groups": [
+    "liveness",
+    "readiness"
+  ]
+}
\ No newline at end of file
index a8de0ae..42555fb 100755 (executable)
@@ -32,7 +32,7 @@
 
     <groupId>org.onap.cps</groupId>
     <artifactId>cps-parent</artifactId>
-    <version>3.3.7-SNAPSHOT</version>
+    <version>3.3.8-SNAPSHOT</version>
     <packaging>pom</packaging>
 
     <properties>
index 325c303..8ce3fa5 100644 (file)
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.onap.cps</groupId>
         <artifactId>cps-parent</artifactId>
-        <version>3.3.7-SNAPSHOT</version>
+        <version>3.3.8-SNAPSHOT</version>
         <relativePath>../cps-parent/pom.xml</relativePath>
     </parent>
 
index 8d92d97..3137549 100755 (executable)
@@ -28,7 +28,7 @@
     <parent>
         <groupId>org.onap.cps</groupId>
         <artifactId>cps-parent</artifactId>
-        <version>3.3.7-SNAPSHOT</version>
+        <version>3.3.8-SNAPSHOT</version>
         <relativePath>../cps-parent/pom.xml</relativePath>
     </parent>
 
index 1a1c4a0..e1598ab 100644 (file)
@@ -26,7 +26,7 @@
     <parent>\r
         <groupId>org.onap.cps</groupId>\r
         <artifactId>cps-parent</artifactId>\r
-        <version>3.3.7-SNAPSHOT</version>\r
+        <version>3.3.8-SNAPSHOT</version>\r
         <relativePath>../cps-parent/pom.xml</relativePath>\r
     </parent>\r
 \r
index d4fe2e3..59428cd 100644 (file)
@@ -29,7 +29,7 @@
   <parent>
     <groupId>org.onap.cps</groupId>
     <artifactId>cps-parent</artifactId>
-    <version>3.3.7-SNAPSHOT</version>
+    <version>3.3.8-SNAPSHOT</version>
     <relativePath>../cps-parent/pom.xml</relativePath>
   </parent>
 
index ca90714..0235b00 100644 (file)
@@ -43,10 +43,11 @@ import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.repo.api.RevisionSourceIdentifier;
 import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
-import org.opendaylight.yangtools.yang.parser.rfc7950.reactor.RFC7950Reactors;
-import org.opendaylight.yangtools.yang.parser.rfc7950.repo.YangStatementStreamSource;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor;
+import org.opendaylight.yangtools.yang.parser.api.YangParser;
+import org.opendaylight.yangtools.yang.parser.api.YangParserException;
+import org.opendaylight.yangtools.yang.parser.api.YangParserFactory;
+import org.opendaylight.yangtools.yang.parser.impl.DefaultYangParserFactory;
+import org.opendaylight.yangtools.yang.xpath.impl.di.DefaultXPathParserFactory;
 
 @NoArgsConstructor
 public final class YangTextSchemaSourceSetBuilder {
@@ -56,6 +57,9 @@ public final class YangTextSchemaSourceSetBuilder {
 
     private final ImmutableMap.Builder<String, String> yangModelMap = new ImmutableMap.Builder<>();
 
+    private static final YangParserFactory YANG_PARSER_FACTORY =
+            new DefaultYangParserFactory(new DefaultXPathParserFactory());
+
     /**
      * Add Yang resource context.
      *
@@ -136,11 +140,11 @@ public final class YangTextSchemaSourceSetBuilder {
      * @return the schema context
      */
     private static SchemaContext generateSchemaContext(final Map<String, String> yangResourceNameToContent) {
-        final CrossSourceStatementReactor.BuildAction reactor = RFC7950Reactors.defaultReactor().newBuild();
+        final YangParser yangParser = YANG_PARSER_FACTORY.createParser();
         for (final YangTextSchemaSource yangTextSchemaSource : forResources(yangResourceNameToContent)) {
             final String resourceName = yangTextSchemaSource.getIdentifier().getName();
             try {
-                reactor.addSource(YangStatementStreamSource.create(yangTextSchemaSource));
+                yangParser.addSource(yangTextSchemaSource);
             } catch (final Exception exception) {
                 throw new ModelValidationException("Yang resource processing exception.",
                     String.format("Could not process resource %s:%n%s", resourceName, exception.getMessage()),
@@ -148,13 +152,13 @@ public final class YangTextSchemaSourceSetBuilder {
             }
         }
         try {
-            return reactor.buildEffective();
-        } catch (final ReactorException reactorException) {
+            return yangParser.buildEffectiveModel();
+        } catch (final YangParserException yangParserException) {
             final List<String> resourceNames = yangResourceNameToContent.keySet().stream().collect(Collectors.toList());
             Collections.sort(resourceNames);
             throw new ModelValidationException("Invalid schema set.",
                 String.format("Effective schema context build failed for resources %s.", resourceNames),
-                reactorException);
+                yangParserException);
         }
     }
 
index b2912ee..16eb5f2 100644 (file)
@@ -58,17 +58,20 @@ Consume cloud event from client topic
     ${messages}=         Poll                group_id=${group_id}     only_value=false
     ${event}                        Set Variable                      ${messages}[0]
     ${headers}                      Set Variable                      ${event.headers()}
-    ${specVersionHeaderValue}       Set Variable                      ${headers[1][1]}
-    ${sourceHeaderValue}            Set Variable                      ${headers[3][1]}
-    ${typeHeaderValue}              Set Variable                      ${headers[4][1]}
-    ${correlationIdHeaderValue}     Set Variable                      ${headers[8][1]}
-    Should Be Equal As Strings      ${specVersionHeaderValue}         1.0
-    Should Be Equal As Strings      ${sourceHeaderValue}              DMI
-    Should Be Equal As Strings      ${correlationIdHeaderValue}       ${expectedRequestId}
-    Should Be Equal As Strings      ${typeHeaderValue}                org.onap.cps.ncmp.events.async1_0_0.DataOperationEvent
+    FOR   ${header_key_value_pair}   IN  @{headers}
+        Compare Header Values       ${header_key_value_pair[0]}   ${header_key_value_pair[1]}      "ce_specversion"      "1.0"
+        Compare Header Values       ${header_key_value_pair[0]}   ${header_key_value_pair[1]}      "ce_source"           "DMI"
+        Compare Header Values       ${header_key_value_pair[0]}   ${header_key_value_pair[1]}      "ce_type"             "org.onap.cps.ncmp.events.async1_0_0.DataOperationEvent"
+        Compare Header Values       ${header_key_value_pair[0]}   ${header_key_value_pair[1]}      "ce_correlationid"    "${expectedRequestId}"
+    END
     [Teardown]                      Basic Teardown                    ${group_id}
 
 *** Keywords ***
+Compare Header Values
+    [Arguments]                    ${header_key}        ${header_value}     ${header_to_check}       ${expected_header_value}
+    IF   "${header_key}" == ${header_to_check}
+        Should Be Equal As Strings              "${header_value}"    ${expected_header_value}
+    END
 
 Basic Teardown
     [Arguments]     ${group_id}
index b0e8665..2d5152a 100644 (file)
@@ -69,16 +69,20 @@ All Messages Are Produced and Consumed
     ${result}=                      Poll                        group_id=${GROUP_ID}      only_value=False
     ${headers}                      Set Variable                      ${result[0].headers()}
     ${value}                        Set Variable                      ${result[0].value()}
-    ${valueAsDict}=                 Evaluate                          json.loads("""${value}""")                              json
-    ${specVersionHeaderValue}       Set Variable                      ${headers[1][1]}
-    ${sourceHeaderValue}            Set Variable                      ${headers[3][1]}
-    ${typeHeaderValue}              Set Variable                      ${headers[4][1]}
-    ${correlationIdHeaderValue}     Set Variable                      ${headers[6][1]}
+    ${valueAsDict}=                 Evaluate                          json.loads("""${value}""")                        json
+    FOR   ${header_key_value_pair}   IN  @{headers}
+        Compare Header Values       ${header_key_value_pair[0]}   ${header_key_value_pair[1]}     "ce_specversion"      "1.0"
+        Compare Header Values       ${header_key_value_pair[0]}   ${header_key_value_pair[1]}     "ce_source"           "NCMP"
+        Compare Header Values       ${header_key_value_pair[0]}   ${header_key_value_pair[1]}     "ce_type"             "subscriptionCreatedStatus"
+        Compare Header Values       ${header_key_value_pair[0]}   ${header_key_value_pair[1]}     "ce_correlationid"    "SCO-9989752cm-subscription-001"
+    END
     Dictionaries Should Be Equal    ${valueAsDict}                    ${ncmpOutEventJsonGlobal}
-    Should Be Equal As Strings      ${specVersionHeaderValue}         1.0
-    Should Be Equal As Strings      ${sourceHeaderValue}              NCMP
-    Should Be Equal As Strings      ${typeHeaderValue}                subscriptionCreatedStatus
-    Should Be Equal As Strings      ${correlationIdHeaderValue}       SCO-9989752cm-subscription-001
+
+Compare Header Values
+    [Arguments]                    ${header_key}        ${header_value}      ${header_to_check}       ${expected_header_value}
+    IF   "${header_key}" == ${header_to_check}
+        Should Be Equal As Strings              "${header_value}"    ${expected_header_value}
+    END
 
 Basic Teardown
     [Arguments]                     ${group_id}
index 2d3a9be..3663b82 100644 (file)
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.onap.cps</groupId>
         <artifactId>dmi-plugin-demo-and-csit-stub</artifactId>
-        <version>3.3.7-SNAPSHOT</version>
+        <version>3.3.8-SNAPSHOT</version>
     </parent>
 
     <artifactId>dmi-plugin-demo-and-csit-stub-app</artifactId>
index 53f1985..8daddba 100644 (file)
@@ -21,7 +21,7 @@
     <parent>
         <groupId>org.onap.cps</groupId>
         <artifactId>dmi-plugin-demo-and-csit-stub</artifactId>
-        <version>3.3.7-SNAPSHOT</version>
+        <version>3.3.8-SNAPSHOT</version>
     </parent>
     <artifactId>dmi-plugin-demo-and-csit-stub-service</artifactId>
 
index f9f4197..4304769 100644 (file)
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.onap.cps</groupId>
         <artifactId>cps-parent</artifactId>
-        <version>3.3.7-SNAPSHOT</version>
+        <version>3.3.8-SNAPSHOT</version>
         <relativePath>../cps-parent/pom.xml</relativePath>
     </parent>
 
index 6203c85..af6b004 100644 (file)
@@ -265,22 +265,26 @@ components:
             key: my-property
           cmHandleProperties:
             key: my-property
+          moduleSetTag: my-module-set-tag
         - cmHandle: my-cm-handle
           publicCmHandleProperties:
             key: my-property
           cmHandleProperties:
             key: my-property
+          moduleSetTag: my-module-set-tag
         createdCmHandles:
         - cmHandle: my-cm-handle
           publicCmHandleProperties:
             key: my-property
           cmHandleProperties:
             key: my-property
+          moduleSetTag: my-module-set-tag
         - cmHandle: my-cm-handle
           publicCmHandleProperties:
             key: my-property
           cmHandleProperties:
             key: my-property
+          moduleSetTag: my-module-set-tag
         dmiPlugin: my-dmi-plugin
         dmiModelPlugin: my-dmi-model-plugin
         dmiDataPlugin: my-dmi-data-plugin
@@ -325,6 +329,7 @@ components:
           key: my-property
         cmHandleProperties:
           key: my-property
+        moduleSetTag: my-module-set-tag
       properties:
         cmHandle:
           example: my-cm-handle
@@ -339,6 +344,9 @@ components:
             example: my-property
             type: string
           type: object
+        moduleSetTag:
+          example: my-module-set-tag
+          type: string
       required:
       - cmHandle
       type: object
index 3807d71..acc32e3 100644 (file)
@@ -310,3 +310,31 @@ CPS-Core Docker Installation
 
 CPS-Core can also be installed in a docker environment. Latest `docker-compose <https://github.com/onap/cps/blob/master/docker-compose/docker-compose.yml>`_ is included in the repo to start all the relevant services.
 The latest instructions are covered in the `README <https://github.com/onap/cps/blob/master/docker-compose/README.md>`_.
+
+CPS-Core and NCMP Distributed Datastructures
+============================================
+
+CPS-Core and NCMP both internally uses embedded distributed datastructure to replicate the state across various instances for low latency.
+These instances require some additional ports to be available. The default range starts from 5701 and based on the number of instances configured they are incremented sequentially.
+
+Below are the list of distributed datastructures that we have.
+
++--------------+---------------------------------+----------------------------------------------------------+
+| Component    | Datastructure name              |                 Use                                      |
++==============+=================================+==========================================================+
+| cps-core     | anchorDataCache                 | Used to resolve prefix for the container name.           |
++--------------+---------------------------------+----------------------------------------------------------+
+| cps-ncmp     | moduleSyncStartedOnCmHandles    | Watchdog process to register cmHandles.                  |
++--------------+---------------------------------+----------------------------------------------------------+
+| cps-ncmp     | dataSyncSemaphores              | Watchdog process to sync data from the nodes.            |
++--------------+---------------------------------+----------------------------------------------------------+
+| cps-ncmp     | moduleSyncWorkQueue             | Queue used internally for workers to pick the task.      |
++--------------+---------------------------------+----------------------------------------------------------+
+| cps-ncmp     | forwardedSubscriptionEventCache | Keeps track of the LCM Subscription Events.              |
++--------------+---------------------------------+----------------------------------------------------------+
+| cps-ncmp     | untrustworthyCmHandlesSet       | Stores untrustworthy cmHandles whose TrustLevel is NONE. |
++--------------+---------------------------------+----------------------------------------------------------+
+| cps-ncmp     | trustLevelPerDmiPlugin          | Stores the TrustLevel for the dmi-plugins.               |
++--------------+---------------------------------+----------------------------------------------------------+
+
+Total number of caches : 7
\ No newline at end of file
index 013617a..ee0ea9a 100755 (executable)
@@ -16,6 +16,33 @@ CPS Release Notes
 ..      * * *   MONTREAL   * * *
 ..      ========================
 
+Version: 3.3.8
+==============
+
+Release Data
+------------
+
++--------------------------------------+--------------------------------------------------------+
+| **CPS Project**                      |                                                        |
+|                                      |                                                        |
++--------------------------------------+--------------------------------------------------------+
+| **Docker images**                    | onap/cps-and-ncmp:3.3.8                                |
+|                                      |                                                        |
++--------------------------------------+--------------------------------------------------------+
+| **Release designation**              | 3.3.8 Montreal                                         |
+|                                      |                                                        |
++--------------------------------------+--------------------------------------------------------+
+| **Release date**                     | Not yet released                                       |
+|                                      |                                                        |
++--------------------------------------+--------------------------------------------------------+
+
+Bug Fixes
+---------
+3.3.8
+
+Features
+--------
+
 Version: 3.3.7
 ==============
 
@@ -32,13 +59,14 @@ Release Data
 | **Release designation**              | 3.3.7 Montreal                                         |
 |                                      |                                                        |
 +--------------------------------------+--------------------------------------------------------+
-| **Release date**                     | Not yet released                                       |
+| **Release date**                     | 2023 September 20                                      |
 |                                      |                                                        |
 +--------------------------------------+--------------------------------------------------------+
 
 Bug Fixes
 ---------
 3.3.7
+    - `CPS-1866 <https://jira.onap.org/browse/CPS-1866>`_ Fix ClassDefNotFoundError in opendaylight Yang parser
 
 Features
 --------
index 9ae7d0c..af67a5f 100644 (file)
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.onap.cps</groupId>
         <artifactId>cps-parent</artifactId>
-        <version>3.3.7-SNAPSHOT</version>
+        <version>3.3.8-SNAPSHOT</version>
         <relativePath>../cps-parent/pom.xml</relativePath>
     </parent>
 
index c8a3be8..22e071f 100644 (file)
@@ -5,7 +5,7 @@
     <parent>
         <groupId>org.onap.cps</groupId>
         <artifactId>cps-parent</artifactId>
-        <version>3.3.7-SNAPSHOT</version>
+        <version>3.3.8-SNAPSHOT</version>
         <relativePath>../cps-parent/pom.xml</relativePath>
     </parent>
     <modelVersion>4.0.0</modelVersion>
diff --git a/pom.xml b/pom.xml
index 0834767..71310fb 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -32,7 +32,7 @@
 \r
     <groupId>org.onap.cps</groupId>\r
     <artifactId>cps-aggregator</artifactId>\r
-    <version>3.3.7-SNAPSHOT</version>\r
+    <version>3.3.8-SNAPSHOT</version>\r
     <packaging>pom</packaging>\r
 \r
     <name>cps</name>\r
diff --git a/releases/3.3.7-container.yaml b/releases/3.3.7-container.yaml
new file mode 100644 (file)
index 0000000..04b6fa5
--- /dev/null
@@ -0,0 +1,8 @@
+distribution_type: container
+container_release_tag: 3.3.7
+project: cps
+log_dir: cps-maven-docker-stage-master/928/
+ref: c3e7b0e3ab0d3b3155d713f639080bdd036d7ba2
+containers:
+  - name: 'cps-and-ncmp'
+    version: '3.3.7-20230920T152321Z'
\ No newline at end of file
diff --git a/releases/3.3.7.yaml b/releases/3.3.7.yaml
new file mode 100644 (file)
index 0000000..b0a0563
--- /dev/null
@@ -0,0 +1,4 @@
+distribution_type: maven
+log_dir: cps-maven-stage-master/936/
+project: cps
+version: 3.3.7
\ No newline at end of file
index daa4756..d511c0f 100644 (file)
@@ -25,7 +25,7 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.onap.cps</groupId>
     <artifactId>spotbugs</artifactId>
-    <version>3.3.7-SNAPSHOT</version>
+    <version>3.3.8-SNAPSHOT</version>
 
     <properties>
         <nexusproxy>https://nexus.onap.org</nexusproxy>
index b583c9e..4709bf1 100755 (executable)
@@ -22,7 +22,7 @@
 
 major=3
 minor=3
-patch=7
+patch=8
 
 base_version=${major}.${minor}.${patch}