summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/data-provider/setup/src
diff options
context:
space:
mode:
authorJakub Dominik <j.dominik@samsung.com>2021-10-14 15:12:55 +0200
committerDan Timoney <dtimoney@att.com>2021-11-18 13:19:44 +0000
commit98aeaac496ac868a97ce9096c1c51ce9a133992a (patch)
treee3e4a52f786f4dbe271485366f0a0c8d74edc85f /sdnr/wt/data-provider/setup/src
parent5d3bfaac4bc7a8b7b030757e1f35795667915a2b (diff)
Extend SDNC persistent service to store CM
Extend SDNC persistent service to store received CM events into Elasticsearch and MariaDB Issue-ID: CCSDK-3497 Signed-off-by: Jakub Dominik <j.dominik@samsung.com> Change-Id: I39983e59ef6512ad6c3864d47aebe1d615897146 Signed-off-by: Michael DÜrre <michael.duerre@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/data-provider/setup/src')
-rw-r--r--sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/ReleaseInformation.java3
-rw-r--r--sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/ComponentName.java4
-rw-r--r--sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/DatabaseInfo7.java4
-rw-r--r--sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/Release.java7
-rw-r--r--sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/ReleaseGroup.java5
-rw-r--r--sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/database/MariaDbDataMigrationProvider.java5
-rw-r--r--sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/istanbul/IstanbulReleaseInformation.java34
-rw-r--r--sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/jakarta/JakartaReleaseInformation.java123
-rw-r--r--sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/MariaDBTestBase.java4
-rw-r--r--sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestBaseReleaseInformation.java34
-rw-r--r--sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestHonoluluReleaseInformation.java34
-rw-r--r--sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestJakartaReleaseInformation.java46
-rw-r--r--sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestMariaDBJakarta.java (renamed from sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestMariaDBIstanbul.java)4
13 files changed, 288 insertions, 19 deletions
diff --git a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/ReleaseInformation.java b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/ReleaseInformation.java
index 6e5bdc522..5e6520c08 100644
--- a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/ReleaseInformation.java
+++ b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/ReleaseInformation.java
@@ -40,6 +40,7 @@ import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.frankfurt.FrankfurtRel
import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.guilin.GuilinReleaseInformation;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.honolulu.HonoluluReleaseInformation;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.istanbul.IstanbulReleaseInformation;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.jakarta.JakartaReleaseInformation;
public abstract class ReleaseInformation {
@@ -175,6 +176,8 @@ public abstract class ReleaseInformation {
return new HonoluluReleaseInformation();
case ISTANBUL_R1:
return new IstanbulReleaseInformation();
+ case JAKARTA_R1:
+ return new JakartaReleaseInformation();
default:
return null;
}
diff --git a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/ComponentName.java b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/ComponentName.java
index 956f74b2d..c01e37abd 100644
--- a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/ComponentName.java
+++ b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/ComponentName.java
@@ -5,6 +5,8 @@
* Copyright (C) 2020 highstreet technologies GmbH Intellectual Property.
* All rights reserved.
* ================================================================================
+ * Update Copyright (C) 2021 Samsung Electronics Intellectual Property. All rights reserved.
+ * =================================================================================================
* 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
@@ -29,7 +31,7 @@ public enum ComponentName {
"inventorytoplevel"), MAINTENANCE("maintenance"), MEDIATOR_SERVER(
"mediator-server"), REQUIRED_NETWORKELEMENT(
"required-networkelement"), GUICUTTHROUGH(
- "guicutthrough"), USERDATA("userdata");
+ "guicutthrough"), USERDATA("userdata"),CMLOG("cmlog");
private final String value;
diff --git a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/DatabaseInfo7.java b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/DatabaseInfo7.java
index 58b98c2aa..87fc07ef9 100644
--- a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/DatabaseInfo7.java
+++ b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/DatabaseInfo7.java
@@ -30,7 +30,9 @@ public class DatabaseInfo7 extends DatabaseInfo {
public DatabaseInfo7(String alias, String doctype, String mapping) {
super(alias, alias, doctype, mapping);
}
-
+ public DatabaseInfo7(String alias, String doctype, String mapping, String settingsformat) {
+ super(alias, alias, doctype, mapping, settingsformat);
+ }
public DatabaseInfo7(String index, String alias, String doctype, String mapping, String settingsformat) {
super(index, alias, doctype, mapping, settingsformat);
}
diff --git a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/Release.java b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/Release.java
index 22338e89a..12cbe4f1f 100644
--- a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/Release.java
+++ b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/Release.java
@@ -34,9 +34,12 @@ public enum Release {
GUILIN_R1("guilin-R1", "-v4", new DatabaseVersion(7,1,1), new DatabaseVersion(7,6,1)),
HONOLULU_R1("honolulu-R1", "-v5", new DatabaseVersion(7,1,1), new DatabaseVersion(8,0,0), false),
ISTANBUL_R1("istanbul-R1", "-v6", new DatabaseVersion(7,1,1), new DatabaseVersion(8,0,0), false,
- new DatabaseVersion(10,2,7), new DatabaseVersion(10,6,0), false);
+ new DatabaseVersion(10,2,7), new DatabaseVersion(10,6,0), false),
+ JAKARTA_R1("jakarta-R1", "-v7", new DatabaseVersion(7,1,1), new DatabaseVersion(8,0,0), false,
+ new DatabaseVersion(10,2,7), new DatabaseVersion(10,6,0), false);
- public static final Release CURRENT_RELEASE = Release.ISTANBUL_R1;
+
+ public static final Release CURRENT_RELEASE = Release.JAKARTA_R1;
private final String value;
private final String dbSuffix;
diff --git a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/ReleaseGroup.java b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/ReleaseGroup.java
index 58e8d2055..91ad437f9 100644
--- a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/ReleaseGroup.java
+++ b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/ReleaseGroup.java
@@ -34,9 +34,10 @@ import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.SdnrDbType;
public enum ReleaseGroup {
EL_ALTO(Release.EL_ALTO), FRANKFURT(Release.FRANKFURT_R1, Release.FRANKFURT_R2), GUILIN(
- Release.GUILIN_R1), HONOLULU(Release.HONOLULU_R1), ISTANBUL(Release.ISTANBUL_R1);
+ Release.GUILIN_R1), HONOLULU(Release.HONOLULU_R1), ISTANBUL(Release.ISTANBUL_R1),
+ JAKARTA(Release.JAKARTA_R1);
- public static final ReleaseGroup CURRENT_RELEASE = ISTANBUL;
+ public static final ReleaseGroup CURRENT_RELEASE = JAKARTA;
private final List<Release> releases;
diff --git a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/database/MariaDbDataMigrationProvider.java b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/database/MariaDbDataMigrationProvider.java
index 55ba66ba6..ff93079a4 100644
--- a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/database/MariaDbDataMigrationProvider.java
+++ b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/database/MariaDbDataMigrationProvider.java
@@ -161,8 +161,9 @@ public class MariaDbDataMigrationProvider implements DataMigrationProviderServic
boolean componentsSucceeded = true;
for (ComponentName c : ri.getComponents()) {
ComponentData data = new ComponentData(c);
- SearchResult<SearchHit> result = null;//this.dbClient.doReadAllJsonData(ri.getAlias(c), ri.getDataType(c), false);
- data.addAll(result.getHits());
+ // TODO : check why doReadAllJsonData are comment
+ //SearchResult<SearchHit> result = null;//this.dbClient.doReadAllJsonData(ri.getAlias(c), ri.getDataType(c), false);
+ //data.addAll(result.getHits());
container.addComponent(c, data);
}
try {
diff --git a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/istanbul/IstanbulReleaseInformation.java b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/istanbul/IstanbulReleaseInformation.java
index 0dcd3ae3c..8a0aeb05e 100644
--- a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/istanbul/IstanbulReleaseInformation.java
+++ b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/istanbul/IstanbulReleaseInformation.java
@@ -21,9 +21,12 @@
*/
package org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.istanbul;
+import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient;
+import org.onap.ccsdk.features.sdnr.wt.common.database.requests.ClusterSettingsRequest;
+import org.onap.ccsdk.features.sdnr.wt.common.database.responses.ClusterSettingsResponse;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.SqlDBClient;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.ReleaseInformation;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.ComponentName;
@@ -35,13 +38,17 @@ import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.Release;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.SearchHitConverter;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.honolulu.HonoluluReleaseInformation;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Entity;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class IstanbulReleaseInformation extends ReleaseInformation {
- private static final String TIMEZONE_TYPE_FORMAT =
+ private final Logger LOG = LoggerFactory.getLogger(IstanbulReleaseInformation.class);
+
+ public static final String TIMEZONE_TYPE_FORMAT =
"CHAR(6) DEFAULT NULL CHECK (`%s` regexp '^[+-]\\\\d\\\\d:\\\\d\\\\d$')";
- private static final String TABLENAME_CONTROLLER_FORMAT = "controller%s";
- private static final String TABLEMAPPING_CONTROLLER =
+ public static final String TABLENAME_CONTROLLER_FORMAT = "controller%s";
+ public static final String TABLEMAPPING_CONTROLLER =
"`id` VARCHAR(40) CHARACTER SET utf8 NOT NULL,`desc` VARCHAR(255) CHARACTER SET utf8 ,primary key(id)";
private static final String TABLEMAPPING_CONNECTIONLOG_FORMAT = "`id` int(11) NOT NULL AUTO_INCREMENT,\n"
+ "`controller-id` VARCHAR(40) CHARACTER SET utf8 NOT NULL,\n" + "`timestamp` DATETIME(3) ,\n"
@@ -93,7 +100,7 @@ public class IstanbulReleaseInformation extends ReleaseInformation {
private static final String TABLEMAPPING_INVENTORY_FORMAT = "`id` VARCHAR(255) CHARACTER SET utf8 NOT NULL,\n"
+ "`controller-id` VARCHAR(40) CHARACTER SET utf8 NOT NULL,\n"
+ "`version` VARCHAR(255) CHARACTER SET utf8 ,\n" + "`type-name` VARCHAR(255) CHARACTER SET utf8 ,\n"
- + "`date` VARCHAR(255) CHARACTER SET utf8 ,\n" + "`description` VARCHAR(255) CHARACTER SET utf8 ,\n"
+ + "`date` VARCHAR(255) CHARACTER SET utf8 ,\n" + "`description` VARCHAR(1024) CHARACTER SET utf8 ,\n"
+ "`node-id` VARCHAR(255) CHARACTER SET utf8 ,\n" + "`uuid` VARCHAR(255) CHARACTER SET utf8 ,\n"
+ "`part-type-id` VARCHAR(255) CHARACTER SET utf8 ,\n"
+ "`model-identifier` VARCHAR(255) CHARACTER SET utf8 ,\n"
@@ -103,7 +110,7 @@ public class IstanbulReleaseInformation extends ReleaseInformation {
+ "primary key(id),foreign key(`controller-id`) references `controller%s`(id)";
private static final String TABLEMAPPING_MAINTENANCE_FORMAT = "`id` VARCHAR(255) CHARACTER SET utf8 NOT NULL,\n"
+ "`controller-id` VARCHAR(40) CHARACTER SET utf8 NOT NULL,\n" + "`active` BOOLEAN ,\n"
- + "`node-id` VARCHAR(255) CHARACTER SET utf8 ,\n" + "`description` VARCHAR(255) CHARACTER SET utf8 ,\n"
+ + "`node-id` VARCHAR(255) CHARACTER SET utf8 ,\n" + "`description` VARCHAR(1024) CHARACTER SET utf8 ,\n"
+ "`problem` VARCHAR(255) CHARACTER SET utf8 ,\n" + "`start` DATETIME(3) ,\n" + "`start-tz` "
+ String.format(TIMEZONE_TYPE_FORMAT, "start-tz") + " ,\n" + "`end` DATETIME(3) ,\n" + "`end-tz` "
+ String.format(TIMEZONE_TYPE_FORMAT, "end-tz") + " ,\n"
@@ -132,7 +139,7 @@ public class IstanbulReleaseInformation extends ReleaseInformation {
super(Release.ISTANBUL_R1, createDBMap(), createMariaDBMap(Release.ISTANBUL_R1.getDBSuffix()));
}
- private static Map<ComponentName, MariaDBTableInfo> createMariaDBMap(String suffix) {
+ public static Map<ComponentName, MariaDBTableInfo> createMariaDBMap(String suffix) {
Map<ComponentName, MariaDBTableInfo> map = new HashMap<>();
map.put(ComponentName.CONNECTIONLOG,
new MariaDBTableInfo(Entity.Connectionlog.getName(), TABLEMAPPING_CONNECTIONLOG_FORMAT));
@@ -158,7 +165,7 @@ public class IstanbulReleaseInformation extends ReleaseInformation {
return map;
}
- private static Map<ComponentName, DatabaseInfo> createDBMap() {
+ public static Map<ComponentName, DatabaseInfo> createDBMap() {
Map<ComponentName, DatabaseInfo> map = HonoluluReleaseInformation.createDBMap();
map.put(ComponentName.USERDATA, new DatabaseInfo7("userdata", "userdata", "{}"));
map.put(ComponentName.REQUIRED_NETWORKELEMENT, new DatabaseInfo7("networkelement-connection",
@@ -168,7 +175,10 @@ public class IstanbulReleaseInformation extends ReleaseInformation {
+ "\"core-model-capability\": {\"type\": \"keyword\"},\"device-type\": {\"type\": \"keyword\"},"
+ "\"device-function\": {\"type\": \"keyword\"},\"is-required\": {\"type\": \"boolean\"},"
+ "\"status\": {\"type\": \"keyword\"},\"tls-key\": {\"type\": \"keyword\"},"
- + "\"mount-method\": {\"type\":\"keyword\"}}"));
+ + "\"mount-method\": {\"type\":\"keyword\"}}",
+ "{\"index\":{\"max_result_window\": 20000,\"number_of_shards\":%d,\"number_of_replicas\":%d},"
+ +"\"analysis\":{\"analyzer\":{\"content\":{\"type\":\"custom\",\"tokenizer\":\"whitespace\"}}}}"
+ ));
return map;
}
@@ -182,7 +192,13 @@ public class IstanbulReleaseInformation extends ReleaseInformation {
@Override
public boolean runPreInitCommands(HtDatabaseClient dbClient) {
- return true;
+ ClusterSettingsResponse response = null;
+ try {
+ response = dbClient.setupClusterSettings(new ClusterSettingsRequest(false).maxCompilationsPerMinute(400));
+ } catch (IOException e) {
+ LOG.warn("problem setting up cluster: {}", e);
+ }
+ return response == null ? false : response.isAcknowledged();
}
@Override
diff --git a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/jakarta/JakartaReleaseInformation.java b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/jakarta/JakartaReleaseInformation.java
new file mode 100644
index 000000000..03033edad
--- /dev/null
+++ b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/jakarta/JakartaReleaseInformation.java
@@ -0,0 +1,123 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP : ccsdk features
+ * ================================================================================
+ * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property.
+ * All rights reserved.
+ * ================================================================================
+ * Update Copyright (C) 2021 Samsung Electronics Intellectual Property. All rights reserved.
+ * =================================================================================================
+c * 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.
+ * ============LICENSE_END=========================================================
+ *
+ */
+package org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.jakarta;
+
+import java.io.IOException;
+import java.util.Map;
+import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient;
+import org.onap.ccsdk.features.sdnr.wt.common.database.requests.ClusterSettingsRequest;
+import org.onap.ccsdk.features.sdnr.wt.common.database.responses.ClusterSettingsResponse;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.SqlDBClient;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.ReleaseInformation;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.ComponentName;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.DatabaseInfo;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.DatabaseInfo7;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.KeepDataSearchHitConverter;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.MariaDBTableInfo;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.Release;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.SearchHitConverter;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.istanbul.IstanbulReleaseInformation;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Entity;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class JakartaReleaseInformation extends ReleaseInformation {
+
+ private static final String TABLENAME_CONTROLLER_FORMAT = IstanbulReleaseInformation.TABLENAME_CONTROLLER_FORMAT;
+ private static final String TABLEMAPPING_CONTROLLER = IstanbulReleaseInformation.TABLEMAPPING_CONTROLLER;
+ private static final String TIMEZONE_TYPE_FORMAT = IstanbulReleaseInformation.TIMEZONE_TYPE_FORMAT;
+ private final Logger LOG = LoggerFactory.getLogger(JakartaReleaseInformation.class);
+
+ private static final String TABLEMAPPING_CMLOG_FORMAT =
+ "`id` int(11) NOT NULL AUTO_INCREMENT,\n" + "`controller-id` VARCHAR(40) CHARACTER SET utf8 NOT NULL,\n"
+ + "`source-type` VARCHAR(100) CHARACTER SET utf8 ,\n"
+ + "`object-id` VARCHAR(255) CHARACTER SET utf8 ,\n" + "`timestamp` DATETIME(3) ,\n"
+ + "`timestamp-tz` " + String.format(TIMEZONE_TYPE_FORMAT, "timestamp-tz")
+ + " ,\n" + "`node-id` VARCHAR(255) CHARACTER SET utf8 ,\n" + "`counter` INTEGER ,\n"
+ + "`notification-type` VARCHAR(100) CHARACTER SET utf8 ,\n"
+ + "`notification-id` VARCHAR(40) CHARACTER SET utf8 ,\n"
+ + "`source-indicator` VARCHAR(100) CHARACTER SET utf8 ,\n"
+ + "`path` VARCHAR(255) CHARACTER SET utf8 ,\n" + "`operation` VARCHAR(100) CHARACTER SET utf8 ,\n"
+ + "`value` VARCHAR(255) CHARACTER SET utf8 ,\n" + "primary key(id)";
+
+ public JakartaReleaseInformation() {
+ super(Release.JAKARTA_R1, createDBMap(), createMariaDBMap());
+ }
+
+ private static Map<ComponentName, DatabaseInfo> createDBMap() {
+ Map<ComponentName, DatabaseInfo> map = IstanbulReleaseInformation.createDBMap();
+ map.put(ComponentName.CMLOG, new DatabaseInfo7("cmlog", "cmlog",
+ "{\"node-id\": {\"type\": \"keyword\"},\"counter\": {\"type\": \"long\"},"
+ + "\"notification-id\": {\"type\": \"date\"},\"notification-type\": {\"type\": \"keyword\"},"
+ + "\"object-id\": {\"type\": \"long\"},\"operation\":{\"type\": \"keyword\"},"
+ + "\"path\": {\"type\": \"long\"},\"source-indicator\":{\"type\": \"keyword\"},"
+ + "\"source-type\": {\"type\": \"long\"},\"timestamp\":{\"type\": \"keyword\"},"
+ + "\"value\":{\"type\": \"keyword\"}}"));
+ return map;
+ }
+
+ private static Map<ComponentName, MariaDBTableInfo> createMariaDBMap() {
+ Map<ComponentName, MariaDBTableInfo> map =
+ IstanbulReleaseInformation.createMariaDBMap(Release.JAKARTA_R1.getDBSuffix());
+ map.put(ComponentName.CMLOG, new MariaDBTableInfo(Entity.Cmlog.getName(), TABLEMAPPING_CMLOG_FORMAT));
+ return map;
+ }
+
+ @Override
+ public SearchHitConverter getConverter(Release dst, ComponentName comp) {
+ if (dst == Release.JAKARTA_R1) {
+ return new KeepDataSearchHitConverter(comp);
+ }
+ return null;
+ }
+
+ @Override
+ public boolean runPreInitCommands(HtDatabaseClient dbClient) {
+ ClusterSettingsResponse response = null;
+ try {
+ response = dbClient.setupClusterSettings(new ClusterSettingsRequest(false).maxCompilationsPerMinute(400));
+ } catch (IOException e) {
+ LOG.warn("problem setting up cluster: {}", e);
+ }
+ return response == null ? false : response.isAcknowledged();
+ }
+
+ @Override
+ public boolean runPostInitCommands(HtDatabaseClient dbClient) {
+ return true;
+ }
+
+ @Override
+ public boolean runPreInitCommands(SqlDBClient dbClient) {
+ boolean success = dbClient.createTable(
+ String.format(TABLENAME_CONTROLLER_FORMAT, this.getReleas().getDBSuffix()), TABLEMAPPING_CONTROLLER);
+ return success;
+ }
+
+ @Override
+ public boolean runPostInitCommands(SqlDBClient dbClient) {
+ return true;
+ }
+
+}
diff --git a/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/MariaDBTestBase.java b/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/MariaDBTestBase.java
index 264f1203c..6fd4a40a4 100644
--- a/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/MariaDBTestBase.java
+++ b/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/MariaDBTestBase.java
@@ -5,6 +5,8 @@
* Copyright (C) 2021 highstreet technologies GmbH Intellectual Property.
* All rights reserved.
* ================================================================================
+ * Update Copyright (C) 2021 Samsung Electronics Intellectual Property. All rights reserved.
+ * ================================================================================================
* 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
@@ -35,6 +37,7 @@ import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.SqlDBConfig;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.data.SqlDBDataProvider;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.database.SqlDBMapper;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.database.SqlDBMapper.UnableToMapClassException;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.CmlogEntity;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ConnectionlogEntity;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Entity;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogEntity;
@@ -136,6 +139,7 @@ public class MariaDBTestBase {
createTable(dbService, EventlogEntity.class, Entity.Eventlog, true);
createTable(dbService, FaultcurrentEntity.class, Entity.Faultcurrent, false);
createTable(dbService, FaultlogEntity.class, Entity.Faultlog, true);
+ createTable(dbService, CmlogEntity.class, Entity.Cmlog, true);
createTable(dbService, GuicutthroughEntity.class, Entity.Guicutthrough, true);
createTable(dbService, Pmdata15mEntity.class, Entity.Historicalperformance15min, false);
createTable(dbService, Pmdata24hEntity.class, Entity.Historicalperformance24h, false);
diff --git a/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestBaseReleaseInformation.java b/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestBaseReleaseInformation.java
new file mode 100644
index 000000000..143611f36
--- /dev/null
+++ b/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestBaseReleaseInformation.java
@@ -0,0 +1,34 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP : ccsdk features
+ * ================================================================================
+ * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property.
+ * All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ *
+ */
+package org.onap.ccsdk.features.sdnr.wt.dataprovider.setup;
+
+import static org.junit.Assert.assertNotNull;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.ComponentName;
+
+public class TestBaseReleaseInformation {
+
+ protected void assertValidComponents(ReleaseInformation ri) {
+
+ assertNotNull(ri.getComponents());
+ assertNotNull(ri.getConverter(ri.getReleas(),ComponentName.FAULTCURRENT));
+ }
+}
diff --git a/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestHonoluluReleaseInformation.java b/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestHonoluluReleaseInformation.java
new file mode 100644
index 000000000..727d116fd
--- /dev/null
+++ b/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestHonoluluReleaseInformation.java
@@ -0,0 +1,34 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP : ccsdk features
+ * ================================================================================
+ * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property.
+ * All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ *
+ */
+package org.onap.ccsdk.features.sdnr.wt.dataprovider.setup;
+
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.honolulu.HonoluluReleaseInformation;
+
+public class TestHonoluluReleaseInformation extends TestBaseReleaseInformation{
+
+ @Test
+ public void test() {
+ this.assertValidComponents(new HonoluluReleaseInformation());
+ }
+
+}
diff --git a/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestJakartaReleaseInformation.java b/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestJakartaReleaseInformation.java
new file mode 100644
index 000000000..6258e31c2
--- /dev/null
+++ b/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestJakartaReleaseInformation.java
@@ -0,0 +1,46 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP : ccsdk features
+ * ================================================================================
+ * Copyright (C) 2021 Samsung Electronics Intellectual Property. All rights reserved.
+ * =================================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ *
+ */
+
+package org.onap.ccsdk.features.sdnr.wt.dataprovider.setup;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import java.util.Set;
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.ComponentName;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.jakarta.JakartaReleaseInformation;
+
+public class TestJakartaReleaseInformation {
+
+ @Test
+ public void testReleaseInformation() {
+ JakartaReleaseInformation ri = new JakartaReleaseInformation();
+ Set<ComponentName> components = ri.getComponents();
+ assertTrue(components.contains(ComponentName.USERDATA));
+ assertTrue(components.contains(ComponentName.REQUIRED_NETWORKELEMENT));
+ assertTrue(components.contains(ComponentName.CMLOG));
+ assertEquals("userdata", ri.getAlias(ComponentName.USERDATA));
+ assertEquals("networkelement-connection", ri.getAlias(ComponentName.REQUIRED_NETWORKELEMENT));
+ assertEquals("cmlog", ri.getAlias(ComponentName.CMLOG));
+ assertEquals("cmlog-v7", ri.getIndex(ComponentName.CMLOG));
+ }
+
+}
diff --git a/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestMariaDBIstanbul.java b/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestMariaDBJakarta.java
index 072ce2f6b..d657704fb 100644
--- a/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestMariaDBIstanbul.java
+++ b/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestMariaDBJakarta.java
@@ -34,7 +34,7 @@ import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.SdnrDbType;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.Release;
import ch.vorburger.exec.ManagedProcessException;
-public class TestMariaDBIstanbul {
+public class TestMariaDBJakarta {
private static final String MARIADB_USERNAME = "sdnrdb";
private static final String MARIADB_PASSWORD = "sdnrdb";
@@ -78,7 +78,7 @@ public class TestMariaDBIstanbul {
e.printStackTrace();
fail(e.getMessage());
}
- boolean success = provider.initDatabase(Release.ISTANBUL_R1, 1, 1, "", false, 1000);
+ boolean success = provider.initDatabase(Release.JAKARTA_R1, 1, 1, "", false, 1000);
assertTrue("init database failed",success);
try {
dbProvider.setControllerId();