diff options
11 files changed, 281 insertions, 28 deletions
diff --git a/cps-application/src/main/resources/application.yml b/cps-application/src/main/resources/application.yml index 263ae6b3dd..00424a587e 100644 --- a/cps-application/src/main/resources/application.yml +++ b/cps-application/src/main/resources/application.yml @@ -130,10 +130,13 @@ logging: springframework: INFO
onap:
cps: INFO
-
-dmi:
- auth:
- username: ${DMI_USERNAME}
- password: ${DMI_PASSWORD}
- api:
- base-path: dmi
+ncmp:
+ dmi:
+ auth:
+ username: ${DMI_USERNAME}
+ password: ${DMI_PASSWORD}
+ api:
+ base-path: dmi
+ timers:
+ advised-modules-sync:
+ sleep-time-ms: 30000
\ No newline at end of file diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/NcmpConfiguration.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/NcmpConfiguration.java index b04619e336..a981022256 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/NcmpConfiguration.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/NcmpConfiguration.java @@ -39,11 +39,11 @@ public class NcmpConfiguration { @Getter @Component public static class DmiProperties { - @Value("${dmi.auth.username}") + @Value("${ncmp.dmi.auth.username}") private String authUsername; - @Value("${dmi.auth.password}") + @Value("${ncmp.dmi.auth.password}") private String authPassword; - @Value("${dmi.api.base-path}") + @Value("${ncmp.dmi.api.base-path}") private String dmiBasePath; } diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/sync/ModuleSyncWatchdog.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/sync/ModuleSyncWatchdog.java index 69413171d6..0d8f852193 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/sync/ModuleSyncWatchdog.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/sync/ModuleSyncWatchdog.java @@ -38,7 +38,7 @@ public class ModuleSyncWatchdog { /** * Execute Cm Handle poll which changes the cm handle state from 'ADVISED' to 'READY'. */ - @Scheduled(fixedDelay = 30000) + @Scheduled(fixedDelayString = "${ncmp.timers.advised-modules-sync.sleep-time-ms}") public void executeAdvisedCmHandlePoll() { YangModelCmHandle newAdvisedCmHandle = syncUtils.getAnAdvisedCmHandle(); while (newAdvisedCmHandle != null) { diff --git a/cps-ncmp-service/src/test/resources/application.yml b/cps-ncmp-service/src/test/resources/application.yml index c23926e4eb..c259bf0057 100644 --- a/cps-ncmp-service/src/test/resources/application.yml +++ b/cps-ncmp-service/src/test/resources/application.yml @@ -16,10 +16,11 @@ # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= -dmi: - auth: - username: some-user - password: some-password - api: - base-path: dmi +ncmp: + dmi: + auth: + username: some-user + password: some-password + api: + base-path: dmi diff --git a/cps-parent/pom.xml b/cps-parent/pom.xml index b76c63c6f7..1d6f58f84c 100755 --- a/cps-parent/pom.xml +++ b/cps-parent/pom.xml @@ -422,6 +422,7 @@ <argument>yangResourceCsvGenerator.py</argument> <argument>dmi-registry@2021-12-13</argument> <argument>dmi-registry@2022-02-10</argument> + <argument>dmi-registry@2022-05-10</argument> </arguments> </configuration> </plugin> diff --git a/cps-ri/src/main/resources/changelog/changelog-master.yaml b/cps-ri/src/main/resources/changelog/changelog-master.yaml index 251cec64b3..aa1b49d8b8 100644 --- a/cps-ri/src/main/resources/changelog/changelog-master.yaml +++ b/cps-ri/src/main/resources/changelog/changelog-master.yaml @@ -42,3 +42,5 @@ databaseChangeLog: file: changelog/db/changes/12-delete-all-previous-dmi-registry-schema-set.yaml - include: file: changelog/db/changes/13-insert-dmi-registry-2022-02-10-schema-set.yaml + - include: + file: changelog/db/changes/14-loadData-dmi-registry-2022-05-10-schema-set.yaml diff --git a/cps-ri/src/main/resources/changelog/db/changes/14-loadData-dmi-registry-2022-05-10-schema-set.yaml b/cps-ri/src/main/resources/changelog/db/changes/14-loadData-dmi-registry-2022-05-10-schema-set.yaml new file mode 100644 index 0000000000..da39d221c0 --- /dev/null +++ b/cps-ri/src/main/resources/changelog/db/changes/14-loadData-dmi-registry-2022-05-10-schema-set.yaml @@ -0,0 +1,113 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 2022 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========================================================= + +databaseChangeLog: + - changeSet: + author: cps + label: dmi-registry-schema-delete + id: 14 + sql: DELETE FROM schema_set_yang_resources + where schema_set_id = (select id from schema_set where name = 'ncmp-dmi-registry-model') + and yang_resource_id = (select id from yang_resource where name = 'dmi-registry@2022-02-10.yang') + rollback: + sql: INSERT INTO schema_set_yang_resources (schema_set_id, yang_resource_id) + VALUES ((select id from schema_set where name = 'ncmp-dmi-registry-model'), (select id from yang_resource where name = 'dmi-registry@2022-02-10.yang')); + + - changeSet: + author: cps + label: dmi-registry-schema-delete + id: 14.1 + sql: DELETE FROM yang_resource where name = 'dmi-registry@2022-02-10.yang' + rollback: + loadUpdateData: + encoding: UTF-8 + file: 'changelog/db/changes/data/dmi//generated-csv/generated_yang_resource_dmi-registry@2022-02-10.csv' + onlyUpdate: 'false' + primaryKey: 'id' + quotchar: '"' + separator: '|' + tableName: 'yang_resource' + columns: + - column: + header: name + name: name + type: STRING + - column: + header: content + name: content + type: STRING + - column: + header: checksum + name: checksum + type: STRING + - column: + header: module_name + name: module_name + type: STRING + - column: + header: revision + name: revision + type: STRING + + - changeSet: + author: cps + label: dmi-registry-schema-load-revision-2022-05-10 + id: 14.2 + loadUpdateData: + encoding: UTF-8 + file: 'changelog/db/changes/data/dmi/generated-csv/generated_yang_resource_dmi-registry@2022-05-10.csv' + onlyUpdate: 'false' + primaryKey: 'id' + quotchar: '"' + separator: '|' + tableName: 'yang_resource' + columns: + - column: + header: name + name: name + type: STRING + - column: + header: content + name: content + type: STRING + - column: + header: checksum + name: checksum + type: STRING + - column: + header: module_name + name: module_name + type: STRING + - column: + header: revision + name: revision + type: STRING + rollback: + - sql: + sql: DELETE FROM yang_resource where name = 'dmi-registry@2022-05-10.yang' + + - changeSet: + author: cps + label: dmi-registry-schema-load-revision-2022-05-10 + id: 14.3 + sql: INSERT INTO schema_set_yang_resources (schema_set_id, yang_resource_id) + VALUES ((select id from schema_set where name = 'ncmp-dmi-registry-model'), (select id from yang_resource where name = 'dmi-registry@2022-05-10.yang')); + rollback: + sql: DELETE FROM schema_set_yang_resources + where schema_set_id = (select id from schema_set where name = 'ncmp-dmi-registry-model') + and yang_resource_id = (select id from yang_resource where name = 'dmi-registry@2022-05-10.yang')
\ No newline at end of file diff --git a/cps-ri/src/main/resources/changelog/db/changes/data/yang-models/dmi-registry@2022-05-10.yang b/cps-ri/src/main/resources/changelog/db/changes/data/yang-models/dmi-registry@2022-05-10.yang new file mode 100644 index 0000000000..77517968c6 --- /dev/null +++ b/cps-ri/src/main/resources/changelog/db/changes/data/yang-models/dmi-registry@2022-05-10.yang @@ -0,0 +1,123 @@ +module dmi-registry { + + yang-version 1.1; + + namespace "org:onap:cps:ncmp"; + + prefix dmi-reg; + + contact "toine.siebelink@est.tech"; + + revision "2022-05-10" { + description + "Added DataSyncEnabled, SyncState with State, LastSyncTime, DataStoreSyncState with Operational and Running syncstate"; + } + + revision "2022-02-10" { + description + "Added State, LockReason, LockReasonDetails to aid with cmHandle sync and timestamp to aid with retry/timeout scenarios"; + } + + revision "2021-12-13" { + description + "Added new list of public additional properties for a Cm-Handle which are exposed to clients of the NCMP interface"; + } + + revision "2021-10-20" { + description + "Added dmi-data-service-name & dmi-model-service-name to allow separate DMI instances for each responsibility"; + } + + revision "2021-05-20" { + description + "Initial Version"; + } + + grouping LockReason { + leaf reason { + type string; + } + leaf details { + type string; + } + } + + grouping SyncState { + leaf sync-state { + type string; + } + leaf last-sync-time { + type string; + } + } + + grouping Datastores { + container operational { + uses SyncState; + } + container running { + uses SyncState; + } + } + + container dmi-registry { + list cm-handles { + key "id"; + leaf id { + type string; + } + leaf dmi-service-name { + type string; + } + leaf dmi-data-service-name { + type string; + } + leaf dmi-model-service-name { + type string; + } + + list additional-properties { + key "name"; + leaf name { + type string; + } + leaf value { + type string; + } + } + + list public-properties { + key "name"; + leaf name { + type string; + } + leaf value { + type string; + } + } + + container state { + leaf cm-handle-state { + type string; + } + + container lock-reason { + uses LockReason; + } + + leaf last-update-time { + type string; + } + + leaf data-sync-enabled { + type boolean; + default "false"; + } + + container datastores { + uses Datastores; + } + } + } + } +}
\ No newline at end of file diff --git a/cps-service/src/main/resources/logback-spring.xml b/cps-service/src/main/resources/logback-spring.xml index ce1af13143..03076023b3 100644 --- a/cps-service/src/main/resources/logback-spring.xml +++ b/cps-service/src/main/resources/logback-spring.xml @@ -58,7 +58,7 @@ </appender> <appender name="asyncConsole" class="ch.qos.logback.classic.AsyncAppender"> - <if condition='property("loggingFormat").equals("json")'> + <if condition='property("loggingFormat").equalsIgnoreCase("json")'> <then> <appender-ref ref="jsonConsole"/> </then> diff --git a/csit/plans/cps/setup.sh b/csit/plans/cps/setup.sh index 6ef4c9a1fe..d633b1ee26 100755 --- a/csit/plans/cps/setup.sh +++ b/csit/plans/cps/setup.sh @@ -50,7 +50,7 @@ check_health() ###################### setup env ############################ # Set env variables for docker compose -export LOCAL_IP=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+') +export LOCAL_IP=$((ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+') || hostname -I | awk '{print $1}') source $WORKSPACE/plans/cps/test.properties export $(cut -d= -f1 $WORKSPACE/plans/cps/test.properties) diff --git a/docs/deployment.rst b/docs/deployment.rst index 06e1ddcc08..7dd4494f27 100644 --- a/docs/deployment.rst +++ b/docs/deployment.rst @@ -157,8 +157,10 @@ To get a listing of the cps-core Pods, run the following command: dev-cps-core-postgres-primary-f7766d46c-s9d5b 1/1 Running 0 24h dev-cps-core-postgres-replica-84659d68f9-6qnt4 1/1 Running 0 24h +.. note:: + The CPS Service will have to be restarted each time a change is made to a configurable property. -Additional Cps-Core Customizations +Additional CPS-Core Customizations ================================== The following table lists some properties that can be specified as Helm chart @@ -181,14 +183,6 @@ Any spring supported property can be configured by providing in ``config.additio | | | | | | See also :ref:`cps_common_credentials_retrieval`. | | +---------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+ -| config.dmiPluginUserName | User name used by cps-core to authenticate themselves for using ncmp-dmi-plugin service. | ``dmiuser`` | -+---------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+ -| config.dmiPluginUserPassword | Internal password used by cps-core to connect to ncmp-dmi-plugin service. | Not defined | -| | | | -| | If not defined, the password is generated when deploying the application. | | -| | | | -| | See also :ref:`cps_common_credentials_retrieval`. | | -+---------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+ | postgres.config.pgUserName | Internal user name used by cps-core to connect to its own database. | ``cps`` | +---------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+ | postgres.config.pgUserPassword | Internal password used by cps-core to connect to its own database. | Not defined | @@ -287,6 +281,22 @@ Any spring supported property can be configured by providing in ``config.additio | maximumPoolSize | including both idle and in-use connections. | | +---------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+ +Additional CPS-NCMP Customizations +================================== ++---------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+ +| config.dmiPluginUserName | User name used by cps-core to authenticate themselves for using ncmp-dmi-plugin service. | ``dmiuser`` | ++---------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+ +| config.dmiPluginUserPassword | Internal password used by cps-core to connect to ncmp-dmi-plugin service. | Not defined | +| | | | +| | If not defined, the password is generated when deploying the application. | | +| | | | +| | See also :ref:`cps_common_credentials_retrieval`. | | ++---------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+ +| config.timers.advised-modules-sync | Specifies the delay in milliseconds in which the module sync watch dog will wake again after finishing. | ``30000`` | +| .sleep-time-ms | | | +| | | | ++---------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------+ + CPS-Core Docker Installation ============================ |