aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/data-provider/provider/src/main
diff options
context:
space:
mode:
authorMichael Dürre <michael.duerre@highstreet-technologies.com>2020-02-26 06:41:50 +0100
committerKAPIL SINGAL <ks220y@att.com>2020-02-27 14:52:20 +0000
commitee75b19ee79f49b28a3137b6dcfdf02d6120f3de (patch)
tree49a6a7b10578ee5f9780ea38f8a9408cf4cf14c7 /sdnr/wt/data-provider/provider/src/main
parent8f762f215f49fd4b1d498adc2cc4f98093f0ddf3 (diff)
add data migration tool
add tool for data migration and initialization Issue-ID: SDNC-1085 Signed-off-by: Michael Dürre <michael.duerre@highstreet-technologies.com> Change-Id: Ibd1ffeffa95d2897ae65f7d964e98941d810ffcb Signed-off-by: Michael Dürre <michael.duerre@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/data-provider/provider/src/main')
-rw-r--r--sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/HtDatabaseMaintenanceService.java8
-rw-r--r--sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/QueryByFilter.java6
-rw-r--r--sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/EsConfig.java11
-rwxr-xr-xsdnr/wt/data-provider/provider/src/main/resources/es-init.sh8
4 files changed, 22 insertions, 11 deletions
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/HtDatabaseMaintenanceService.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/HtDatabaseMaintenanceService.java
index 45d989d6a..5ff7a5dec 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/HtDatabaseMaintenanceService.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/HtDatabaseMaintenanceService.java
@@ -120,6 +120,7 @@ public class HtDatabaseMaintenanceService implements HtDatabaseMaintenance {
}
}
+
}
/**
@@ -153,6 +154,7 @@ public class HtDatabaseMaintenanceService implements HtDatabaseMaintenance {
* @param mountPointNodeName
* @return
*/
+ @SuppressWarnings("null")
private boolean isRequireNe(String mountPointNodeName) {
NetworkElementConnectionEntity ne = null;
if (requiredNeRW != null) {
@@ -161,7 +163,11 @@ public class HtDatabaseMaintenanceService implements HtDatabaseMaintenance {
} else {
LOG.warn("cannot read db. no db reader writer initialized");
}
- return ne != null;
+ if (ne != null && ne.isIsRequired() != null) {
+ return ne.isIsRequired();
+ } else {
+ return false;
+ }
}
}
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/QueryByFilter.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/QueryByFilter.java
index db527959c..6b3c89af9 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/QueryByFilter.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/QueryByFilter.java
@@ -17,6 +17,7 @@
******************************************************************************/
package org.onap.ccsdk.features.sdnr.wt.dataprovider.data;
+import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
@@ -40,6 +41,7 @@ import org.slf4j.LoggerFactory;
public class QueryByFilter {
private static final Logger LOG = LoggerFactory.getLogger(DataObjectAcessorPm.class);
+ private static final List<String> timestampValueNames = Arrays.asList("timestamp","start","end");
private QueryByFilter() {
//Hide
@@ -276,7 +278,7 @@ public class QueryByFilter {
// v=v.toLowerCase();
}
if (DbFilter.hasSearchParams(v)) {
- if(p!=null && "timestamp".equals(p.toLowerCase())) {
+ if(p!=null && timestampValueNames.contains(p.toLowerCase())) {
query = fromTimestampSearchFilter(p,v);
if(query!=null) {
return query;
@@ -311,7 +313,7 @@ public class QueryByFilter {
// v=v.toLowerCase();
}
if(DbFilter.hasSearchParams(v)) {
- if(p!=null && "timestamp".equals(p.toLowerCase())) {
+ if(p!=null && timestampValueNames.contains(p.toLowerCase())) {
tmpQuery=fromTimestampSearchFilter(p,v);
if(tmpQuery!=null) {
query.must(tmpQuery);
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/EsConfig.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/EsConfig.java
index a846cd8f3..ccfbe98fd 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/EsConfig.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/EsConfig.java
@@ -53,7 +53,10 @@ public class EsConfig implements Configuration, IEsConfig {
private static final String DEFAULT_ARCHIVE_INTERVAL_SEC = "0";
/** keep data for this time [in seconds] 30 days */
private static final String DEFAULT_ARCHIVE_LIMIT_SEC = String.valueOf(60L * 60L * 24L * 30L);
- private static final String DEFAULT_KEY_NODE = "elasticsearchnode";
+ //private static final String DEFAULT_KEY_NODE = "elasticsearchnode";
+ private static final String DEFAULT_VALUE_NODE = "elasticsearchnode";
+ private static final String DEFAULT_VALUE_DBUSERNAME = "${SDNRDBUSERNAME}";
+ private static final String DEFAULT_VALUE_DBPASSWORD = "${SDNRDBPASSWORD}";
private final ConfigurationFileRepresentation configuration;
@@ -138,9 +141,9 @@ public class EsConfig implements Configuration, IEsConfig {
configuration.setPropertyIfNotAvailable(SECTION_MARKER_ES, PROPERTY_KEY_CLUSTER, DEFAULT_VALUE_CLUSTER);
configuration.setPropertyIfNotAvailable(SECTION_MARKER_ES, PROPERTY_KEY_ARCHIVE_INTERVAL,
DEFAULT_ARCHIVE_INTERVAL_SEC);
- configuration.setPropertyIfNotAvailable(SECTION_MARKER_ES, PROPERTY_KEY_NODE, DEFAULT_KEY_NODE);
- configuration.setPropertyIfNotAvailable(SECTION_MARKER_ES, PROPERTY_KEY_AUTH_USERNAME, "");
- configuration.setPropertyIfNotAvailable(SECTION_MARKER_ES, PROPERTY_KEY_AUTH_PASSWORD, "");
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER_ES, PROPERTY_KEY_NODE, DEFAULT_VALUE_NODE);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER_ES, PROPERTY_KEY_AUTH_USERNAME, DEFAULT_VALUE_DBUSERNAME);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER_ES, PROPERTY_KEY_AUTH_PASSWORD, DEFAULT_VALUE_DBPASSWORD);
}
@Override
diff --git a/sdnr/wt/data-provider/provider/src/main/resources/es-init.sh b/sdnr/wt/data-provider/provider/src/main/resources/es-init.sh
index 8873b0b75..67d495aa0 100755
--- a/sdnr/wt/data-provider/provider/src/main/resources/es-init.sh
+++ b/sdnr/wt/data-provider/provider/src/main/resources/es-init.sh
@@ -36,10 +36,10 @@ INITFILENAME="Init.script"
set_definition() {
def "connectionlog" '{"node-id": {"type": "keyword"},"timestamp": {"type": "date"},"status": {"type": "keyword"}}'
- def "maintenancemode" '{"node-id": {"type": "keyword"},"active": {"type": "boolean"}},"date_detection":false}}'
- def "faultlog" '{"node-id": {"type": "keyword"},"severity": {"type": "keyword"},"timestamp": {"type": "date"},"problem": {"type": "keyword"},"counter": {"type": "keyword"},"object-id":{"type": "keyword"},"source-type":{"type": "keyword"}}'
- def "faultcurrent" '{"node-id": {"type": "keyword"},"severity": {"type": "keyword"},"timestamp": {"type": "date"},"problem": {"type": "keyword"},"counter": {"type": "keyword"},"object-id":{"type": "keyword"}}'
- def "eventlog" '{"node-id": {"type": "keyword"},"timestamp": {"type": "date"},"new-value": {"type": "keyword"},"attribute-name": {"type": "keyword"},"counter": {"type": "keyword"},"object-id": {"type": "keyword"}}'
+ def "maintenancemode" '{"node-id": {"type": "keyword"},"start": {"type": "date"},"end": {"type": "date"},"description": {"type": "keyword"},"active": {"type": "boolean"}},"date_detection":false}}'
+ def "faultlog" '{"node-id": {"type": "keyword"},"severity": {"type": "keyword"},"timestamp": {"type": "date"},"problem": {"type": "keyword"},"counter": {"type": "long"},"object-id":{"type": "keyword"},"source-type":{"type": "keyword"}}'
+ def "faultcurrent" '{"node-id": {"type": "keyword"},"severity": {"type": "keyword"},"timestamp": {"type": "date"},"problem": {"type": "keyword"},"counter": {"type": "long"},"object-id":{"type": "keyword"}}'
+ def "eventlog" '{"node-id": {"type": "keyword"},"source-type": {"type": "keyword"},"timestamp": {"type": "date"},"new-value": {"type": "keyword"},"attribute-name": {"type": "keyword"},"counter": {"type": "long"},"object-id": {"type": "keyword"}}'
def "inventoryequipment" '{"date": {"type": "keyword"},"model-identifier": {"type": "keyword"},"manufacturer-identifier": {"type": "keyword"},"type-name": {"type": "keyword"},"description": {"type": "keyword"},"uuid": {"type": "keyword"},"version": {"type": "keyword"},"parent-uuid": {"type": "keyword"},"contained-holder": {"type": "keyword"},"node-id": {"type": "keyword"},"tree-level": {"type": "long"},"part-type-id": {"type": "keyword"},"serial": {"type": "keyword"}}'
def "historicalperformance24h" '{"node-name":{"type": "keyword"},"timestamp":{"type": "date"},"suspect-interval-flag":{"type":"boolean"},"scanner-id":{"type": "keyword"},"uuid-interface":{"type": "keyword"},"layer-protocol-name":{"type": "keyword"},"granularity-period":{"type": "keyword"},"radio-signal-id":{"type": "keyword"}}'
def "historicalperformance15min" '{"node-name":{"type": "keyword"},"timestamp":{"type": "date"},"suspect-interval-flag":{"type":"boolean"},"scanner-id":{"type": "keyword"},"uuid-interface":{"type": "keyword"},"layer-protocol-name":{"type": "keyword"},"granularity-period":{"type": "keyword"},"radio-signal-id":{"type": "keyword"}}'