diff options
42 files changed, 385 insertions, 62 deletions
diff --git a/checkstyle/pom.xml b/checkstyle/pom.xml index ef52947aba..4cf950efd9 100644 --- a/checkstyle/pom.xml +++ b/checkstyle/pom.xml @@ -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> diff --git a/cps-application/pom.xml b/cps-application/pom.xml index e8869707ce..0cf68ad87c 100755 --- a/cps-application/pom.xml +++ b/cps-application/pom.xml @@ -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> diff --git a/cps-application/src/main/resources/application.yml b/cps-application/src/main/resources/application.yml index 6aefda9c39..58748271cc 100644 --- a/cps-application/src/main/resources/application.yml +++ b/cps-application/src/main/resources/application.yml @@ -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: diff --git a/cps-bom/pom.xml b/cps-bom/pom.xml index f3c8f78515..0f5cb4b487 100644 --- a/cps-bom/pom.xml +++ b/cps-bom/pom.xml @@ -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> diff --git a/cps-dependencies/pom.xml b/cps-dependencies/pom.xml index 822d7cc82b..dac6e6603e 100755 --- a/cps-dependencies/pom.xml +++ b/cps-dependencies/pom.xml @@ -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> diff --git a/cps-events/pom.xml b/cps-events/pom.xml index b305a310bc..d776ccb094 100644 --- a/cps-events/pom.xml +++ b/cps-events/pom.xml @@ -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> diff --git a/cps-ncmp-events/pom.xml b/cps-ncmp-events/pom.xml index 47b10c959a..3e06028d59 100644 --- a/cps-ncmp-events/pom.xml +++ b/cps-ncmp-events/pom.xml @@ -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> diff --git a/cps-ncmp-rest-stub/cps-ncmp-rest-stub-app/pom.xml b/cps-ncmp-rest-stub/cps-ncmp-rest-stub-app/pom.xml index 6683a23537..275313c3b2 100644 --- a/cps-ncmp-rest-stub/cps-ncmp-rest-stub-app/pom.xml +++ b/cps-ncmp-rest-stub/cps-ncmp-rest-stub-app/pom.xml @@ -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> diff --git a/cps-ncmp-rest-stub/cps-ncmp-rest-stub-service/pom.xml b/cps-ncmp-rest-stub/cps-ncmp-rest-stub-service/pom.xml index d7a5da03f4..435cc70487 100644 --- a/cps-ncmp-rest-stub/cps-ncmp-rest-stub-service/pom.xml +++ b/cps-ncmp-rest-stub/cps-ncmp-rest-stub-service/pom.xml @@ -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> diff --git a/cps-ncmp-rest-stub/pom.xml b/cps-ncmp-rest-stub/pom.xml index 5e9d3de11c..4db8617b96 100644 --- a/cps-ncmp-rest-stub/pom.xml +++ b/cps-ncmp-rest-stub/pom.xml @@ -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> diff --git a/cps-ncmp-rest/docs/openapi/components.yaml b/cps-ncmp-rest/docs/openapi/components.yaml index 818b2daeed..243de62102 100644 --- a/cps-ncmp-rest/docs/openapi/components.yaml +++ b/cps-ncmp-rest/docs/openapi/components.yaml @@ -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: diff --git a/cps-ncmp-rest/pom.xml b/cps-ncmp-rest/pom.xml index 1ac1bd7e6e..2d6f687c29 100644 --- a/cps-ncmp-rest/pom.xml +++ b/cps-ncmp-rest/pom.xml @@ -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> diff --git a/cps-ncmp-service/pom.xml b/cps-ncmp-service/pom.xml index fa3a369ca6..527d70b552 100644 --- a/cps-ncmp-service/pom.xml +++ b/cps-ncmp-service/pom.xml @@ -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> diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/client/DmiRestClient.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/client/DmiRestClient.java index 28e09ac4bc..7066f80165 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/client/DmiRestClient.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/client/DmiRestClient.java @@ -21,10 +21,13 @@ 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()); diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/embeddedcache/TrustLevelCacheConfig.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/embeddedcache/TrustLevelCacheConfig.java index 66f61906da..ebe99057d7 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/embeddedcache/TrustLevelCacheConfig.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/embeddedcache/TrustLevelCacheConfig.java @@ -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 index 0000000000..dac32aa736 --- /dev/null +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/trustlevel/dmiavailability/DMiPluginWatchDog.java @@ -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 index 0000000000..352d36f942 --- /dev/null +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/trustlevel/dmiavailability/DmiPluginStatus.java @@ -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; +} diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/client/DmiRestClientSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/client/DmiRestClientSpec.groovy index 0d03fd9acf..80c0a27bf7 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/client/DmiRestClientSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/client/DmiRestClientSpec.groovy @@ -21,8 +21,13 @@ 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 index 0000000000..af546b7f5e --- /dev/null +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/trustlevel/dmiavailability/DMiPluginWatchDogSpec.groovy @@ -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 + } + +} diff --git a/cps-ncmp-service/src/test/resources/application.yml b/cps-ncmp-service/src/test/resources/application.yml index 6e7577b1a8..a4bb4e8124 100644 --- a/cps-ncmp-service/src/test/resources/application.yml +++ b/cps-ncmp-service/src/test/resources/application.yml @@ -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 index 0000000000..753222005e --- /dev/null +++ b/cps-ncmp-service/src/test/resources/dmiPluginHealthCheckResponse.json @@ -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 diff --git a/cps-parent/pom.xml b/cps-parent/pom.xml index a8de0ae0eb..42555fb0fd 100755 --- a/cps-parent/pom.xml +++ b/cps-parent/pom.xml @@ -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> diff --git a/cps-path-parser/pom.xml b/cps-path-parser/pom.xml index 325c303438..8ce3fa5b22 100644 --- a/cps-path-parser/pom.xml +++ b/cps-path-parser/pom.xml @@ -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> diff --git a/cps-rest/pom.xml b/cps-rest/pom.xml index 8d92d972c7..31375490e8 100755 --- a/cps-rest/pom.xml +++ b/cps-rest/pom.xml @@ -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> diff --git a/cps-ri/pom.xml b/cps-ri/pom.xml index 1a1c4a0489..e1598aba87 100644 --- a/cps-ri/pom.xml +++ b/cps-ri/pom.xml @@ -26,7 +26,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>
diff --git a/cps-service/pom.xml b/cps-service/pom.xml index d4fe2e31aa..59428cdfdf 100644 --- a/cps-service/pom.xml +++ b/cps-service/pom.xml @@ -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> diff --git a/cps-service/src/main/java/org/onap/cps/yang/YangTextSchemaSourceSetBuilder.java b/cps-service/src/main/java/org/onap/cps/yang/YangTextSchemaSourceSetBuilder.java index ca907148dd..0235b004f4 100644 --- a/cps-service/src/main/java/org/onap/cps/yang/YangTextSchemaSourceSetBuilder.java +++ b/cps-service/src/main/java/org/onap/cps/yang/YangTextSchemaSourceSetBuilder.java @@ -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); } } diff --git a/csit/tests/cps-data-operations/cps-data-operations.robot b/csit/tests/cps-data-operations/cps-data-operations.robot index b2912eed06..16eb5f239e 100644 --- a/csit/tests/cps-data-operations/cps-data-operations.robot +++ b/csit/tests/cps-data-operations/cps-data-operations.robot @@ -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} diff --git a/csit/tests/cps-subscriptions/cps-subscription-notification.robot b/csit/tests/cps-subscriptions/cps-subscription-notification.robot index b0e8665796..2d5152a290 100644 --- a/csit/tests/cps-subscriptions/cps-subscription-notification.robot +++ b/csit/tests/cps-subscriptions/cps-subscription-notification.robot @@ -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} diff --git a/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-app/pom.xml b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-app/pom.xml index 2d3a9be7e4..3663b822f1 100644 --- a/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-app/pom.xml +++ b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-app/pom.xml @@ -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> diff --git a/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/pom.xml b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/pom.xml index 53f1985a6f..8daddba3be 100644 --- a/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/pom.xml +++ b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/pom.xml @@ -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> diff --git a/dmi-plugin-demo-and-csit-stub/pom.xml b/dmi-plugin-demo-and-csit-stub/pom.xml index f9f4197d2e..430476985a 100644 --- a/dmi-plugin-demo-and-csit-stub/pom.xml +++ b/dmi-plugin-demo-and-csit-stub/pom.xml @@ -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> diff --git a/docs/api/swagger/ncmp/openapi-inventory.yaml b/docs/api/swagger/ncmp/openapi-inventory.yaml index 6203c857a5..af6b004b1b 100644 --- a/docs/api/swagger/ncmp/openapi-inventory.yaml +++ b/docs/api/swagger/ncmp/openapi-inventory.yaml @@ -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 diff --git a/docs/deployment.rst b/docs/deployment.rst index 3807d71d60..acc32e3640 100644 --- a/docs/deployment.rst +++ b/docs/deployment.rst @@ -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 diff --git a/docs/release-notes.rst b/docs/release-notes.rst index 013617a815..ee0ea9a448 100755 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -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 -------- diff --git a/integration-test/pom.xml b/integration-test/pom.xml index 9ae7d0cfc0..af67a5f693 100644 --- a/integration-test/pom.xml +++ b/integration-test/pom.xml @@ -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> diff --git a/jacoco-report/pom.xml b/jacoco-report/pom.xml index c8a3be8d3f..22e071fcb0 100644 --- a/jacoco-report/pom.xml +++ b/jacoco-report/pom.xml @@ -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> @@ -32,7 +32,7 @@ <groupId>org.onap.cps</groupId>
<artifactId>cps-aggregator</artifactId>
- <version>3.3.7-SNAPSHOT</version>
+ <version>3.3.8-SNAPSHOT</version>
<packaging>pom</packaging>
<name>cps</name>
diff --git a/releases/3.3.7-container.yaml b/releases/3.3.7-container.yaml new file mode 100644 index 0000000000..04b6fa5153 --- /dev/null +++ b/releases/3.3.7-container.yaml @@ -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 index 0000000000..b0a0563221 --- /dev/null +++ b/releases/3.3.7.yaml @@ -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 diff --git a/spotbugs/pom.xml b/spotbugs/pom.xml index daa47565f8..d511c0fb97 100644 --- a/spotbugs/pom.xml +++ b/spotbugs/pom.xml @@ -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> diff --git a/version.properties b/version.properties index b583c9ead7..4709bf127a 100755 --- a/version.properties +++ b/version.properties @@ -22,7 +22,7 @@ major=3 minor=3 -patch=7 +patch=8 base_version=${major}.${minor}.${patch} |