diff options
Diffstat (limited to 'sdnr/wt/data-provider/setup/src')
7 files changed, 99 insertions, 13 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 913313b86..8362b0030 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 @@ -35,6 +35,7 @@ import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.frankfurt.FrankfurtRel import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.frankfurt.FrankfurtReleaseInformationR2; 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; public abstract class ReleaseInformation { @@ -145,6 +146,8 @@ public abstract class ReleaseInformation { return new GuilinReleaseInformation(); case HONOLULU_R1: return new HonoluluReleaseInformation(); + case ISTANBUL_R1: + return new IstanbulReleaseInformation(); 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 c3974b98a..956f74b2d 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 @@ -25,10 +25,11 @@ public enum ComponentName { CONNECTIONLOG("connectionlog"), EVENTLOG("eventlog"), FAULTLOG("faultlog"), FAULTCURRENT( "faultcurrent"), HISTORICAL_PERFORMANCE_15M("historicalperformance15m"), HISTORICAL_PERFORMANCE_24H( - "historicalperformance24h"), INVENTORY( - "inventory"), INVENTORYTOPLEVEL("inventorytoplevel"), MAINTENANCE( - "maintenance"), MEDIATOR_SERVER("mediator-server"), REQUIRED_NETWORKELEMENT( - "required-networkelement"), GUICUTTHROUGH("guicutthrough"); + "historicalperformance24h"), INVENTORY("inventory"), INVENTORYTOPLEVEL( + "inventorytoplevel"), MAINTENANCE("maintenance"), MEDIATOR_SERVER( + "mediator-server"), REQUIRED_NETWORKELEMENT( + "required-networkelement"), GUICUTTHROUGH( + "guicutthrough"), USERDATA("userdata"); private final String value; 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 9b67bd46b..119479b97 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 @@ -30,9 +30,10 @@ public enum Release { FRANKFURT_R1("frankfurt-R1", "-v2", new EsVersion(6, 4, 3), new EsVersion(6, 8, 6)), FRANKFURT_R2("frankfurt-R2", "-v3", new EsVersion(7, 0, 1), new EsVersion(7, 6, 1)), GUILIN_R1("guilin-R1", "-v4", new EsVersion(7,1,1), new EsVersion(7,6,1)), - HONOLULU_R1("honolulu-R1", "-v5", new EsVersion(7,1,1), new EsVersion(8,0,0), false); + HONOLULU_R1("honolulu-R1", "-v5", new EsVersion(7,1,1), new EsVersion(8,0,0), false), + ISTANBUL_R1("istanbul-R1", "-v6", new EsVersion(7,1,1), new EsVersion(8,0,0), false); - public static final Release CURRENT_RELEASE = Release.HONOLULU_R1; + public static final Release CURRENT_RELEASE = Release.ISTANBUL_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 6d2da9035..664dce677 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 @@ -31,9 +31,10 @@ import org.onap.ccsdk.features.sdnr.wt.common.database.data.EsVersion; */ public enum ReleaseGroup { - EL_ALTO(Release.EL_ALTO), FRANKFURT(Release.FRANKFURT_R1, Release.FRANKFURT_R2), GUILIN(Release.GUILIN_R1), HONOLULU(Release.HONOLULU_R1); + EL_ALTO(Release.EL_ALTO), FRANKFURT(Release.FRANKFURT_R1, Release.FRANKFURT_R2), GUILIN( + Release.GUILIN_R1), HONOLULU(Release.HONOLULU_R1), ISTANBUL(Release.ISTANBUL_R1); - public static final ReleaseGroup CURRENT_RELEASE = HONOLULU; + public static final ReleaseGroup CURRENT_RELEASE = ISTANBUL; private final List<Release> releases; diff --git a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/honolulu/HonoluluReleaseInformation.java b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/honolulu/HonoluluReleaseInformation.java index 255a031e7..41f8175db 100644 --- a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/honolulu/HonoluluReleaseInformation.java +++ b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/honolulu/HonoluluReleaseInformation.java @@ -45,7 +45,7 @@ public class HonoluluReleaseInformation extends ReleaseInformation { } - private static Map<ComponentName, DatabaseInfo> createDBMap() { + public static Map<ComponentName, DatabaseInfo> createDBMap() { Map<ComponentName, DatabaseInfo> map= FrankfurtReleaseInformationR2.createDBMap(); map.put(ComponentName.GUICUTTHROUGH, new DatabaseInfo7("guicutthrough", "guicutthrough", "{\"name\": {\"type\": \"keyword\"},\"weburi\": {\"type\": \"keyword\"}}")); 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 new file mode 100644 index 000000000..67200bb2f --- /dev/null +++ b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/istanbul/IstanbulReleaseInformation.java @@ -0,0 +1,78 @@ +/* + * ============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.istanbul; + +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.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.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.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class IstanbulReleaseInformation extends ReleaseInformation { + + private final Logger LOG = LoggerFactory.getLogger(IstanbulReleaseInformation.class); + public IstanbulReleaseInformation() { + super(Release.ISTANBUL_R1,createDBMap()); + + } + + private static Map<ComponentName, DatabaseInfo> createDBMap() { + Map<ComponentName, DatabaseInfo> map= HonoluluReleaseInformation.createDBMap(); + map.put(ComponentName.USERDATA, new DatabaseInfo7("userdata", "userdata", "{}")); + return map; + } + + @Override + public SearchHitConverter getConverter(Release dst, ComponentName comp) { + if (dst == Release.ISTANBUL_R1) { + return new KeepDataSearchHitConverter(comp); + } + return null; + } + + @Override + protected 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 + protected boolean runPostInitCommands(HtDatabaseClient dbClient) { + return true; + } + +} diff --git a/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestMigrationProvider.java b/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestMigrationProvider.java index aaa33839f..311582a08 100644 --- a/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestMigrationProvider.java +++ b/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestMigrationProvider.java @@ -42,7 +42,7 @@ public class TestMigrationProvider { @Test public void testCreateImport() throws Exception { DataMigrationProviderImpl provider = new DataMigrationProviderImpl(hosts, null, null, true, 5000); - + DataMigrationReport report=null; try { @@ -51,11 +51,13 @@ public class TestMigrationProvider { fail("unable to init database"); } //import data into database - DataMigrationReport report = provider.importData(FRANKFURT_BACKUP_FILE, false, Release.FRANKFURT_R2); - assertTrue(report.completed()); - assertEquals(Release.CURRENT_RELEASE, provider.autoDetectRelease()); + report = provider.importData(FRANKFURT_BACKUP_FILE, false, Release.FRANKFURT_R2); } catch (Exception e) { + e.printStackTrace(); fail(e.getMessage()); } + assertTrue(report.completed()); + assertEquals(Release.CURRENT_RELEASE, provider.autoDetectRelease()); + } } |