diff --git a/sdnr/wt/data-provider/installer/pom.xml b/sdnr/wt/data-provider/installer/pom.xml
index 5b3a5df..dcb6884 100755
--- a/sdnr/wt/data-provider/installer/pom.xml
+++ b/sdnr/wt/data-provider/installer/pom.xml
@@ -69,7 +69,7 @@
             <artifactId>${application.name}-setup</artifactId>
             <version>${project.version}</version>
         </dependency>
-
+        
     </dependencies>
 
     <build>
diff --git a/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/DataProvider.java b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/DataProvider.java
index a9e3346..f4578d5 100644
--- a/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/DataProvider.java
+++ b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/DataProvider.java
@@ -1,4 +1,4 @@
-/**
+/*
  * ============LICENSE_START========================================================================
  * ONAP : ccsdk feature sdnr wt
  * =================================================================================================
@@ -19,7 +19,6 @@
 
 import java.util.Date;
 import java.util.List;
-
 import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ConnectionlogEntity;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.EventlogEntity;
@@ -67,7 +66,7 @@
 
     /**
      * write internal equipment to database
-     * 
+     *
      * @param internalEquipment with mandatory fields.
      */
     void writeInventory(Inventory internalEquipment);
@@ -76,17 +75,19 @@
      *
      * @param networkElementConnectionEntitiy to wirte to DB
      * @param nodeId Id for this DB element
+     * @return if succeeded
      */
-    void updateNetworkConnectionDeviceType(NetworkElementConnectionEntity networkElementConnectionEntitiy,
+    boolean updateNetworkConnectionDeviceType(NetworkElementConnectionEntity networkElementConnectionEntitiy,
             String nodeId);
 
     /**
      * Update after new mountpoint registration
-     * 
+     *
      * @param networkElementConnectionEntitiy data
      * @param nodeId of device (mountpoint name)
+     * @return if succeeded
      */
-    void updateNetworkConnection22(NetworkElementConnectionEntity networkElementConnectionEntitiy, String nodeId);
+    boolean updateNetworkConnection22(NetworkElementConnectionEntity networkElementConnectionEntitiy, String nodeId);
 
     void removeNetworkConnection(String nodeId);
 
diff --git a/sdnr/wt/data-provider/model/src/main/yang/data-provider.yang b/sdnr/wt/data-provider/model/src/main/yang/data-provider@2019-08-01.yang
similarity index 98%
rename from sdnr/wt/data-provider/model/src/main/yang/data-provider.yang
rename to sdnr/wt/data-provider/model/src/main/yang/data-provider@2019-08-01.yang
index ef65104..46505cd 100644
--- a/sdnr/wt/data-provider/model/src/main/yang/data-provider.yang
+++ b/sdnr/wt/data-provider/model/src/main/yang/data-provider@2019-08-01.yang
@@ -1,5 +1,5 @@
 module data-provider {
-  
+
   yang-version 1.1;
   namespace "urn:opendaylight:params:xml:ns:yang:data-provider";
   prefix odluxprovider;
@@ -191,7 +191,7 @@
       }
       enum NtsManager {
         description
-          "Simulation of device";
+          "Manage adapter to simulate devices";
       }
       enum Nonsupported {
         description
@@ -201,6 +201,18 @@
         description
           "Device type at this point of time unknown";
       }
+      enum O-RAN-FH {
+        description
+          "implements RAN according to o-ran*.yang fro for fronthaule";
+      }
+      enum O-ROADM {
+          description
+            "implements Open ROADM";
+        }
+      enum O1-TR069 {
+          description
+            "implements O1 RAN interface according to TR069";
+      }
     }
     description
       "An enumeration as identification of the device.";
@@ -272,7 +284,7 @@
       }
     }
     description
-      "The enumeration with the options for granularity period of the 
+      "The enumeration with the options for granularity period of the
        performance data similar to g.874.1-model";
   }
 
@@ -466,7 +478,7 @@
       type string;
       mandatory true;
       description
-        "Key to get/set configuration entry in database. Normally Mountpoint 
+        "Key to get/set configuration entry in database. Normally Mountpoint
          name is used as key id of node.";
     }
     leaf node-id {
@@ -559,7 +571,7 @@
 
   grouping pmdata-microwave {
     description
-      "Consolidated performance information of all microwave model interface 
+      "Consolidated performance information of all microwave model interface
        PACs";
     leaf es {
       type int32;
@@ -855,7 +867,7 @@
       default "-99";
       config false;
       description
-        "Lowest temperature (in degree Celsius) of the radio module inside the 
+        "Lowest temperature (in degree Celsius) of the radio module inside the
          outdoor unit.";
     }
     leaf rf-temp-max {
@@ -864,7 +876,7 @@
       default "-99";
       config false;
       description
-        "Highest temperature (in degree Celsius) of the radio module inside the 
+        "Highest temperature (in degree Celsius) of the radio module inside the
          outdoor unit.";
     }
     leaf rf-temp-avg {
@@ -873,7 +885,7 @@
       default "-99";
       config false;
       description
-        "Averaged temperature (in degree Celsius) of the radio module inside 
+        "Averaged temperature (in degree Celsius) of the radio module inside
          the outdoor unit.";
     }
     leaf defect-blocks-sum {
@@ -882,7 +894,7 @@
       default "-1";
       config false;
       description
-        "Total number of blocks that were defect after receiving and could not 
+        "Total number of blocks that were defect after receiving and could not
          be corrected by the FEC.";
     }
     leaf time-period {
@@ -904,9 +916,9 @@
       default "-1";
       config false;
       description
-        "Counts the number of Bytes of Ethernet traffic (before header 
-         compression) transmitted within a second and keeps the highest value 
-         within the measurement period. Field to be left blank for all types of 
+        "Counts the number of Bytes of Ethernet traffic (before header
+         compression) transmitted within a second and keeps the highest value
+         within the measurement period. Field to be left blank for all types of
          TDM containers.";
     }
     leaf tx-ethernet-bytes-max-m {
@@ -915,9 +927,9 @@
       default "-1";
       config false;
       description
-        "Counts the number of Bytes of Ethernet traffic (before header 
-         compression) transmitted within a minute and keeps the highest value 
-         with in the measurement period. Field to be left blank for all types 
+        "Counts the number of Bytes of Ethernet traffic (before header
+         compression) transmitted within a minute and keeps the highest value
+         with in the measurement period. Field to be left blank for all types
          of TDM containers.";
     }
     leaf tx-ethernet-bytes-sum {
@@ -926,8 +938,8 @@
       default "-1";
       config false;
       description
-        "Total number of Bytes of Ethernet traffic (before header compression) 
-         transmitted (in direction out of the device) during the measurement 
+        "Total number of Bytes of Ethernet traffic (before header compression)
+         transmitted (in direction out of the device) during the measurement
         period. Field to be left blank for all types of TDM containers.";
     }
   }
@@ -970,7 +982,7 @@
 
   grouping inventory-entity {
     description
-      "One equipment entity in a list of a network element that could be rack, 
+      "One equipment entity in a list of a network element that could be rack,
        card, backplane, module";
     leaf id {
       type string;
@@ -996,7 +1008,7 @@
     leaf uuid {
       type string;
       description
-        "Unique inventory id of this node for this equipment, provided by 
+        "Unique inventory id of this node for this equipment, provided by
          network element";
     }
     leaf-list contained-holder {
@@ -1022,7 +1034,7 @@
     leaf date {
       type string;
       description
-        "manufactured-thing/equipment-instance/manufacture-date: Date 
+        "manufactured-thing/equipment-instance/manufacture-date: Date
          information provided by manufacturer. No specific format. ()";
     }
     leaf version {
diff --git a/sdnr/wt/data-provider/provider/pom.xml b/sdnr/wt/data-provider/provider/pom.xml
index 0d133f8..9e158ab 100644
--- a/sdnr/wt/data-provider/provider/pom.xml
+++ b/sdnr/wt/data-provider/provider/pom.xml
@@ -47,12 +47,11 @@
     </licenses>
 
     <properties>
-        <checkstyle.skip>true</checkstyle.skip> <!-- POM configuration -->
         <maven.javadoc.skip>true</maven.javadoc.skip>
         <maven.build.timestamp.format>yyyy-MM-dd HH:mm</maven.build.timestamp.format>
         <buildtime>${maven.build.timestamp}</buildtime>
         <databaseport>49402</databaseport>
-        <odlux.buildno>52.3b24c2d(20/04/08)</odlux.buildno>
+        <odlux.buildno>56.139cd6d(20/07/08)</odlux.buildno>
     </properties>
 
     <dependencies>
@@ -91,6 +90,11 @@
             <artifactId>org.apache.karaf.shell.core</artifactId>
             <scope>provided</scope>
         </dependency>
+<!--          <dependency> -->
+<!--             <groupId>org.apache.karaf.bundle</groupId> -->
+<!--             <artifactId>org.apache.karaf.bundle.core</artifactId> -->
+<!--             <scope>provided</scope> -->
+<!--         </dependency> -->
         <dependency>
             <groupId>org.opendaylight.netconf</groupId>
             <artifactId>sal-netconf-connector</artifactId>
@@ -146,9 +150,11 @@
                             <executable>java</executable>
                             <arguments>
                                 <argument>-jar</argument>
-                                <argument>${basedir}/../setup/target/sdnr-dmt.jar</argument>
+                                <argument>${basedir}/../../data-provider/setup/target/sdnr-dmt.jar</argument>
                                 <argument>-c</argument>
                                 <argument>pluginfile</argument>
+                                <argument>-v</argument>
+                                <argument>v3</argument>
                                 <argument>-of</argument>
                                 <argument>${project.build.directory}/EsInit.script</argument>
                             </arguments>
@@ -165,7 +171,7 @@
                     <clusterName>testCluster</clusterName>
                     <transportPort>9500</transportPort>
                     <httpPort>${databaseport}</httpPort>
-                    <version>6.5.0</version>
+                    <version>7.1.1</version>
                     <timeout>120</timeout>
                     <pathInitScript>${project.build.directory}/EsInit.script</pathInitScript>
                 </configuration>
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/DataObjectAcessor.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/DataObjectAcessor.java
index 3fe2a62..c3c63a9 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/DataObjectAcessor.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/DataObjectAcessor.java
@@ -24,38 +24,35 @@
 import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient;
 import org.onap.ccsdk.features.sdnr.wt.common.database.SearchResult;
 import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilder;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.EsDataObjectReaderWriter;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.EsDataObjectReaderWriter2;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.Entity;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.EntityInput;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class DataObjectAcessor<T extends DataObject> extends EsDataObjectReaderWriter<T> {
+public class DataObjectAcessor<T extends DataObject> extends EsDataObjectReaderWriter2<T> {
 
     private static final Logger LOG = LoggerFactory.getLogger(DataObjectAcessor.class);
 
-    public DataObjectAcessor(HtDatabaseClient dbClient, Entity entity, Class<T> clazz) throws ClassNotFoundException {
-        this(dbClient, entity, clazz, true);
+    DataObjectAcessor(HtDatabaseClient dbClient, Entity entity, Class<T> clazz) throws ClassNotFoundException {
+        super(dbClient, entity, clazz);
         LOG.info("Create {}", this.getClass().getName());
     }
 
-    public DataObjectAcessor(HtDatabaseClient dbClient, Entity entity, Class<T> clazz, boolean idSupported)
-            throws ClassNotFoundException {
-        super(dbClient, entity, clazz);
-        if (idSupported) {
-            setEsIdAttributeName("_id");
-        }
+    public QueryResult<T> getData(EntityInput input) {
+
+        QueryByFilter queryByFilter = new QueryByFilter(input);
+        QueryBuilder queryBuilder = queryByFilter.getQueryBuilderByFilter();
+        // Exception handling during user input for invalid filter input.
+        // This wrong filter by user is allowed an results into empty data.
+        boolean ignoreException = queryBuilder.contains("range");
+
+        LOG.info("Request: {} filter {} ignoreException{}:", this.getDataTypeName(), queryByFilter, ignoreException);
+
+        SearchResult<T> result = doReadAll(queryBuilder, ignoreException);
+        return new QueryResult<>(queryByFilter, result);
     }
 
-    QueryResult<T> getData(EntityInput input) {
-        long page = QueryByFilter.getPage(input);
-        long pageSize = QueryByFilter.getPageSize(input);
-        LOG.info("Request: {}", this.getDataTypeName());
-        QueryBuilder query = QueryByFilter.fromFilter(input.getFilter()).from((page - 1) * pageSize).size(pageSize);
-        QueryByFilter.setSortOrder(query, input.getSortorder());
-        SearchResult<T> result = doReadAll(query, query.contains("range"));
-        return new QueryResult<>(page, pageSize, result);
-    }
 
 }
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/DataObjectAcessorPm.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/DataObjectAcessorPm.java
index 8eb51b6..8301736 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/DataObjectAcessorPm.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/DataObjectAcessorPm.java
@@ -26,16 +26,11 @@
 import org.onap.ccsdk.features.sdnr.wt.common.database.ExtRestClient;
 import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient;
 import org.onap.ccsdk.features.sdnr.wt.common.database.SearchResult;
-import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilder;
-import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilders;
 import org.onap.ccsdk.features.sdnr.wt.common.database.requests.SearchRequest;
 import org.onap.ccsdk.features.sdnr.wt.common.database.responses.AggregationEntries;
 import org.onap.ccsdk.features.sdnr.wt.common.database.responses.SearchResponse;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.Entity;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.EntityInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SortOrder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.entity.input.Filter;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.entity.input.Sortorder;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -49,7 +44,7 @@
     private static final String KEY = "node-name";
 
 
-    enum Intervall {
+    public enum Intervall {
         PMDATA15M("historicalperformance15min", "historicalperformance15min"), PMDATA24H("historicalperformance24h",
                 "historicalperformance24h");
 
@@ -75,7 +70,8 @@
 
     public DataObjectAcessorPm(HtDatabaseClient dbClient, Intervall mode, Entity entity, Class<T> clazz)
             throws ClassNotFoundException {
-        super(dbClient, entity, clazz, false);
+        super(dbClient, entity, clazz);
+        LOG.info("DataObjectAcessorPm");
         this.dbClient = dbClient;
         this.mode = mode;
     }
@@ -87,47 +83,24 @@
      * @return
      * @throws IOException
      */
-    QueryResult<String> getDataLtpList(EntityInput input) throws IOException {
-        long page = QueryByFilter.getPage(input);
-        long pageSize = QueryByFilter.getPageSize(input);
-        Filter nodeFilter = QueryByFilter.getFilter(input.getFilter(), NODE_KEY);
-        if (nodeFilter != null) {
-            SearchRequest request = new SearchRequest(mode.getIndex(), mode.getType());
-            request.setQuery(
-                    QueryBuilders.matchQuery(NODE_KEY, nodeFilter.getFiltervalue()).aggregations(UUID_KEY).size(0));
-            try {
-                SearchResponse response = this.dbClient.search(request);
-                AggregationEntries aggs = response.getAggregations(UUID_KEY);
-                String[] uuids = aggs.getKeysAsPagedStringList(pageSize, pageSize * (page - 1));
-                long totalSize = aggs.size();
-                return new QueryResult<String>(page, pageSize, new SearchResult<String>(uuids, totalSize));
-            } catch (IOException e) {
-                throw new IOException("problem reading ltps for req=" + request, e);
-            }
-        } else {
-            String msg = "no nodename in filter found ";
-            LOG.debug(msg);
-            throw new IllegalArgumentException(msg);
+    public QueryResult<String> getDataLtpList(EntityInput input) throws IOException {
+
+        QueryByFilter queryByFilter = new QueryByFilter(input);
+        SearchRequest request =
+                queryByFilter.getSearchRequestByFilter(NODE_KEY, UUID_KEY, mode.getIndex(), mode.getType());
+        try {
+            SearchResponse response = this.dbClient.search(request);
+            AggregationEntries aggs = response.getAggregations(UUID_KEY);
+            String[] uuids =
+                    aggs.getKeysAsPagedStringList(queryByFilter.getPageSize(), queryByFilter.getPageStartIndex());
+            long totalSize = aggs.size();
+            return new QueryResult<String>(queryByFilter.getPage(), queryByFilter.getPageSize(),
+                    new SearchResult<String>(uuids, totalSize));
+        } catch (IOException e) {
+            throw new IOException("problem reading ltps for req=" + request, e);
         }
     }
 
-    //	QueryResult<String> getDataDeviceList(EntityInput input) throws IOException {
-    //
-    //		long page = QueryByFilter.getPage(input);
-    //		long pageSize = QueryByFilter.getPageSize(input);
-    //
-    //		SearchRequest request = new SearchRequest(mode.getIndex(), mode.getType());
-    //		request.setQuery(QueryBuilders.matchAllQuery().aggregations(KEY).size(0));
-    ////		try {
-    //			SearchResponse response = this.dbClient.search(request);
-    //			AggregationEntries aggs = response.getAggregations(KEY);
-    //			String[] uuids = aggs.getKeysAsPagedStringList(pageSize, pageSize * (page - 1));
-    //			long totalSize = aggs.size();
-    //			return new QueryResult<String>(page, pageSize, new SearchResult<String>(uuids, totalSize));
-    ////		} catch (IOException e) {
-    ////			throw new IOException("problem reading nodes for req="+request, e);
-    ////		}
-    //	}
     /**
      * get aggregated devices list
      * 
@@ -135,31 +108,19 @@
      * @return
      * @throws IOException
      */
-    QueryResult<String> getDataDeviceList(EntityInput input) throws IOException {
+    public QueryResult<String> getDataDeviceList(EntityInput input) throws IOException {
 
-        long page = QueryByFilter.getPage(input);
-        long pageSize = QueryByFilter.getPageSize(input);
-
-        Sortorder soNode = QueryByFilter.getSortOrder(input.getSortorder(), KEY);
-        SearchRequest request = new SearchRequest(mode.getIndex(), mode.getType());
-        QueryBuilder query = null;
-        if (soNode != null) {
-            query = QueryBuilders.matchAllQuery()
-                    .aggregations(KEY,
-                            soNode.getSortorder() == SortOrder.Ascending
-                                    ? org.onap.ccsdk.features.sdnr.wt.common.database.queries.SortOrder.ASCENDING
-                                    : org.onap.ccsdk.features.sdnr.wt.common.database.queries.SortOrder.DESCENDING)
-                    .size(0);
-        } else {
-            query = QueryBuilders.matchAllQuery().aggregations(KEY).size(0);
-        }
-        request.setQuery(query);
+        QueryByFilter queryByFilter = new QueryByFilter(input);
+        SearchRequest request =
+                queryByFilter.getSearchRequestBySortOrder(NODE_KEY, UUID_KEY, mode.getIndex(), mode.getType());
         try {
             SearchResponse response = this.dbClient.search(request);
             AggregationEntries aggs = response.getAggregations(KEY);
-            String[] uuids = aggs.getKeysAsPagedStringList(pageSize, pageSize * (page - 1));
+            String[] uuids =
+                    aggs.getKeysAsPagedStringList(queryByFilter.getPageSize(), queryByFilter.getPageStartIndex());
             long totalSize = aggs.size();
-            return new QueryResult<String>(page, pageSize, new SearchResult<String>(uuids, totalSize));
+            return new QueryResult<String>(queryByFilter.getPage(), queryByFilter.getPageSize(),
+                    new SearchResult<String>(uuids, totalSize));
         } catch (IOException e) {
             throw new IOException("problem reading nodes for req=" + request, e);
         }
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/DataObjectAcessorStatus.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/DataObjectAcessorStatus.java
index 4dd52f4..1fa6de3 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/DataObjectAcessorStatus.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/DataObjectAcessorStatus.java
@@ -43,12 +43,12 @@
     private final Entity entity;
 
     public DataObjectAcessorStatus(HtDatabaseClient dbClient, Entity entity) throws ClassNotFoundException {
-        super(dbClient, entity, Data.class, false);
+        super(dbClient, entity, Data.class);
         this.dbClient = dbClient;
         this.entity = entity;
     }
 
-    QueryResult<Data> getDataStatus() throws IOException {
+    public QueryResult<Data> getDataStatus() throws IOException {
         SearchRequest request = getNewInstanceOfSearchRequest(entity);
         request.setQuery(QueryBuilders.matchAllQuery().aggregations(ESDATATYPE_FAULTCURRENT_SEVERITY_KEY).size(0));
         SearchResponse response = this.dbClient.search(request);
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/DataObjectAcessorWithId.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/DataObjectAcessorWithId.java
new file mode 100644
index 0000000..10dd779
--- /dev/null
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/DataObjectAcessorWithId.java
@@ -0,0 +1,41 @@
+/*
+ * ============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.data;
+
+import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.Entity;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DataObjectAcessorWithId<T extends DataObject> extends DataObjectAcessor<T> {
+
+    private static final Logger LOG = LoggerFactory.getLogger(DataObjectAcessorWithId.class);
+
+    public DataObjectAcessorWithId(HtDatabaseClient dbClient, Entity entity, Class<T> clazz)
+            throws ClassNotFoundException {
+        super(dbClient, entity, clazz);
+        setEsIdAttributeName("_id");
+        LOG.info("Create {}", this.getClass().getName());
+    }
+
+}
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/DataTreeChildObject.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/DataTreeChildObject.java
deleted file mode 100644
index a92265a..0000000
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/DataTreeChildObject.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * ============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.data;
-
-import java.util.Map;
-
-/**
- * @author Michael Dürre
- *
- */
-public class DataTreeChildObject {
-
-    private final String label;
-    private final String ownSeverity;
-    private final String childrenSeveritySummary;
-    private final boolean isMatch;
-    private final Map<String, DataTreeChildObject> children;
-
-    public DataTreeChildObject(String label, boolean isMatch, Map<String, DataTreeChildObject> children,
-            String ownSeverity, String childrenSeveritySummary) {
-        this.label = label;
-        this.isMatch = isMatch;
-        this.children = children;
-        this.ownSeverity = ownSeverity;
-        this.childrenSeveritySummary = childrenSeveritySummary;
-    }
-}
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/ElasticSearchDataProvider.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/ElasticSearchDataProvider.java
index 76d47e3..30e617a 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/ElasticSearchDataProvider.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/ElasticSearchDataProvider.java
@@ -77,17 +77,15 @@
     private static final String EXCEPTION_UNABLE_TO_UPDATE_IN_DATABASE = "unable to update data in database";
     private static final String EXCEPTION_UNABLE_TO_REMOVE_FROM_DATABASE = "unable to remove data from database";
 
-    private static final boolean DEFAULT_TRUSTALLCERTS = false;
-
     private final HtDatabaseClient dbClient;
-    private final DataObjectAcessor<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.faultcurrent.list.output.Data> eventRWFaultCurrent;
-    private final DataObjectAcessor<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.faultlog.list.output.Data> eventRWFaultLog;
-    private final DataObjectAcessor<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.mediator.server.list.output.Data> mediatorserverRW;
-    private final DataObjectAcessor<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.maintenance.list.output.Data> maintenanceRW;
-    private final DataObjectAcessor<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.inventory.list.output.Data> equipmentRW;
-    private final DataObjectAcessor<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.connectionlog.list.output.Data> connnectionlogRW;
-    private final DataObjectAcessor<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.eventlog.list.output.Data> eventlogRW;
-    private final DataObjectAcessor<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.network.element.connection.list.output.Data> networkelementConnectionRW;
+    private final DataObjectAcessorWithId<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.faultcurrent.list.output.Data> eventRWFaultCurrent;
+    private final DataObjectAcessorWithId<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.faultlog.list.output.Data> eventRWFaultLog;
+    private final DataObjectAcessorWithId<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.mediator.server.list.output.Data> mediatorserverRW;
+    private final DataObjectAcessorWithId<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.maintenance.list.output.Data> maintenanceRW;
+    private final DataObjectAcessorWithId<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.inventory.list.output.Data> equipmentRW;
+    private final DataObjectAcessorWithId<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.connectionlog.list.output.Data> connnectionlogRW;
+    private final DataObjectAcessorWithId<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.eventlog.list.output.Data> eventlogRW;
+    private final DataObjectAcessorWithId<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.network.element.connection.list.output.Data> networkelementConnectionRW;
     private final DataObjectAcessorPm<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.pmdata._15m.list.output.Data> pm15mRW;
     private final DataObjectAcessorPm<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.pmdata._24h.list.output.Data> pm24hRW;
 
@@ -100,7 +98,7 @@
     }
 
     public ElasticSearchDataProvider(HostInfo[] hosts) throws Exception {
-        this(hosts, null, null, DEFAULT_TRUSTALLCERTS);
+        this(hosts, null, null, HtDatabaseClient.TRUSTALL_DEFAULT);
     }
 
     public ElasticSearchDataProvider(HostInfo[] hosts, String authUsername, String authPassword, boolean trustAllCerts)
@@ -108,31 +106,32 @@
         super();
         LOG.info("Start {}", this.getClass().getName());
 
+
         this.dbClient = HtDatabaseClient.getClient(hosts, authUsername, authPassword, trustAllCerts);
-        this.mediatorserverRW = new DataObjectAcessor<>(dbClient, Entity.MediatorServer,
+        this.mediatorserverRW = new DataObjectAcessorWithId<>(dbClient, Entity.MediatorServer,
                 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.mediator.server.list.output.Data.class);
         this.mediatorserverRW.setWriteInterface(MediatorServerEntity.class);
 
-        this.maintenanceRW = new DataObjectAcessor<>(dbClient, Entity.Maintenancemode,
+        this.maintenanceRW = new DataObjectAcessorWithId<>(dbClient, Entity.Maintenancemode,
                 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.maintenance.list.output.Data.class);
         this.maintenanceRW.setWriteInterface(MaintenanceEntity.class);
 
-        this.equipmentRW = new DataObjectAcessor<>(dbClient, Entity.Inventoryequipment,
+        this.equipmentRW = new DataObjectAcessorWithId<>(dbClient, Entity.Inventoryequipment,
                 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.inventory.list.output.Data.class);
 
-        this.eventRWFaultCurrent = new DataObjectAcessor<>(dbClient, Entity.Faultcurrent,
+        this.eventRWFaultCurrent = new DataObjectAcessorWithId<>(dbClient, Entity.Faultcurrent,
                 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.faultcurrent.list.output.Data.class);
 
-        this.eventRWFaultLog = new DataObjectAcessor<>(dbClient, Entity.Faultlog,
+        this.eventRWFaultLog = new DataObjectAcessorWithId<>(dbClient, Entity.Faultlog,
                 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.faultlog.list.output.Data.class);
 
-        this.connnectionlogRW = new DataObjectAcessor<>(dbClient, Entity.Connectionlog,
+        this.connnectionlogRW = new DataObjectAcessorWithId<>(dbClient, Entity.Connectionlog,
                 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.connectionlog.list.output.Data.class);
 
-        this.eventlogRW = new DataObjectAcessor<>(dbClient, Entity.Eventlog,
+        this.eventlogRW = new DataObjectAcessorWithId<>(dbClient, Entity.Eventlog,
                 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.eventlog.list.output.Data.class);
 
-        this.networkelementConnectionRW = new DataObjectAcessor<>(dbClient, Entity.NetworkelementConnection,
+        this.networkelementConnectionRW = new DataObjectAcessorWithId<>(dbClient, Entity.NetworkelementConnection,
                 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.network.element.connection.list.output.Data.class);
         this.networkelementConnectionRW.setWriteInterface(NetworkElementConnectionEntity.class);
 
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/HtDatabaseEventsService.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/HtDatabaseEventsService.java
index d255cad..4efbf6e 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/HtDatabaseEventsService.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/HtDatabaseEventsService.java
@@ -27,6 +27,7 @@
 import java.util.List;
 
 import javax.annotation.Nonnull;
+
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
 import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient;
@@ -113,7 +114,7 @@
                     ConnectionlogEntity.class, ConnectionlogBuilder.class);
 
             networkelementConnectionDB = new EsDataObjectReaderWriter2<>(client, Entity.NetworkelementConnection,
-                    NetworkElementConnectionEntity.class, NetworkElementConnectionBuilder.class)
+                    NetworkElementConnectionEntity.class, NetworkElementConnectionBuilder.class, true)
                             .setEsIdAttributeName("_id");
 
             pmData15mDB = new EsDataObjectReaderWriter2<>(client, Entity.Historicalperformance15min, PmdataEntity.class,
@@ -271,15 +272,64 @@
 
     // -- Networkelement
 
+
+    /**
+     * join base with parameters of toJoin (only non null values)
+     * 
+     * @param base base object
+     * @param toJoin object with new property values
+     * @return new joined object
+     */
+    @SuppressWarnings("unused")
+    private NetworkElementConnectionEntity joinNe(NetworkElementConnectionEntity base,
+            NetworkElementConnectionEntity toJoin) {
+        if (base == null) {
+            return toJoin;
+        }
+        NetworkElementConnectionBuilder builder = new NetworkElementConnectionBuilder(base);
+        if (toJoin != null) {
+            if (toJoin.isIsRequired() != null) {
+                builder.setIsRequired(toJoin.isIsRequired());
+            }
+            if (toJoin.getCoreModelCapability() != null) {
+                builder.setCoreModelCapability(toJoin.getCoreModelCapability());
+            }
+            if (toJoin.getDeviceType() != null) {
+                builder.setDeviceType(toJoin.getDeviceType());
+            }
+            if (toJoin.getHost() != null) {
+                builder.setHost(toJoin.getHost());
+            }
+            if (toJoin.getNodeDetails() != null) {
+                builder.setNodeDetails(toJoin.getNodeDetails());
+            }
+            if (toJoin.getPassword() != null) {
+                builder.setPassword(toJoin.getPassword());
+            }
+            if (toJoin.getPort() != null) {
+                builder.setPort(toJoin.getPort());
+            }
+            if (toJoin.getStatus() != null) {
+                builder.setStatus(toJoin.getStatus());
+            }
+            if (toJoin.getUsername() != null) {
+                builder.setUsername(toJoin.getUsername());
+            }
+        }
+        return builder.build();
+    }
+
     /**
      *
      * @param networkElementConnectionEntitiy to wirte to DB
      * @param nodeId Id for this DB element
      */
     @Override
-    public void updateNetworkConnectionDeviceType(NetworkElementConnectionEntity networkElementConnectionEntitiy,
+    public boolean updateNetworkConnectionDeviceType(NetworkElementConnectionEntity networkElementConnectionEntitiy,
             String nodeId) {
-        this.networkelementConnectionDB.update(networkElementConnectionEntitiy, nodeId);
+        return this.networkelementConnectionDB.update(networkElementConnectionEntitiy, nodeId) != null;
+        //		NetworkElementConnectionEntity e = this.networkelementConnectionDB.read(nodeId);
+        //		this.networkelementConnectionDB.write(this.joinNe(e, networkElementConnectionEntitiy), nodeId);
     }
 
     /**
@@ -289,10 +339,14 @@
      * @param nodeId of device (mountpoint name)
      */
     @Override
-    public void updateNetworkConnection22(NetworkElementConnectionEntity networkElementConnectionEntitiy,
+    public boolean updateNetworkConnection22(NetworkElementConnectionEntity networkElementConnectionEntitiy,
             String nodeId) {
-        this.networkelementConnectionDB.updateOrCreate(networkElementConnectionEntitiy, nodeId,
-                Arrays.asList("is-required", "username", "password"));
+        LOG.info("update networkelement-connection for {} with data {}", nodeId, networkElementConnectionEntitiy);
+        return this.networkelementConnectionDB.updateOrCreate(networkElementConnectionEntitiy, nodeId,
+                Arrays.asList("is-required", "username", "password")) != null;
+        //		NetworkElementConnectionEntity e = this.networkelementConnectionDB.read(nodeId);
+        //		this.networkelementConnectionDB.write(this.joinNe(e, networkElementConnectionEntitiy), nodeId);
+
     }
 
     /* please do not remove */
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 a675f68..3e9a939 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
@@ -46,15 +46,15 @@
     private final EsDataObjectReaderWriter2<MaintenanceEntity> maintenanceRW;
     private final EsDataObjectReaderWriter2<NetworkElementConnectionEntity> requiredNeRW;
 
-    HtDatabaseMaintenanceService(@NonNull HtDatabaseClient client) throws ClassNotFoundException {
+    public HtDatabaseMaintenanceService(@NonNull HtDatabaseClient client) throws ClassNotFoundException {
         HtAssert.nonnull(client);
 
         // Create control structure
         maintenanceRW = new EsDataObjectReaderWriter2<>(client, Entity.Maintenancemode, MaintenanceEntity.class,
-                MaintenanceBuilder.class).setEsIdAttributeName("_id");
+                MaintenanceBuilder.class, true).setEsIdAttributeName("_id");
 
         requiredNeRW = new EsDataObjectReaderWriter2<>(client, Entity.NetworkelementConnection,
-                NetworkElementConnectionEntity.class, NetworkElementConnectionBuilder.class)
+                NetworkElementConnectionEntity.class, NetworkElementConnectionBuilder.class, true)
                         .setEsIdAttributeName("_id");
 
     }
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/MediatorServerDataProvider.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/MediatorServerDataProvider.java
index 258104d..c229006 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/MediatorServerDataProvider.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/MediatorServerDataProvider.java
@@ -40,7 +40,7 @@
     private static final Logger LOG = LoggerFactory.getLogger(MediatorServerDataProvider.class);
 
     private final HtDatabaseClient dbClient;
-    private final DataObjectAcessor<Data> mediatorserverRW;
+    private final DataObjectAcessorWithId<Data> mediatorserverRW;
     private final int REFRESH_INTERVAL = 60;
     private final Map<String, Data> entries;
     private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
@@ -55,7 +55,7 @@
         LOG.info("Start {}", this.getClass().getName());
         this.entries = new HashMap<>();
         this.dbClient = HtDatabaseClient.getClient(hosts, authUsername, authPassword);
-        this.mediatorserverRW = new DataObjectAcessor<>(dbClient, Entity.MediatorServer, Data.class);
+        this.mediatorserverRW = new DataObjectAcessorWithId<>(dbClient, Entity.MediatorServer, Data.class);
         this.scheduler.scheduleAtFixedRate(onTick, this.REFRESH_INTERVAL, this.REFRESH_INTERVAL, TimeUnit.SECONDS);
     }
 
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 b6a5020..4e7bee9 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
@@ -21,6 +21,8 @@
  */
 package org.onap.ccsdk.features.sdnr.wt.dataprovider.data;
 
+import java.math.BigInteger;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Calendar;
 import java.util.Date;
@@ -33,11 +35,13 @@
 import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilder;
 import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilders;
 import org.onap.ccsdk.features.sdnr.wt.common.database.queries.RangeQueryBuilder;
+import org.onap.ccsdk.features.sdnr.wt.common.database.requests.SearchRequest;
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.NetconfTimeStamp;
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.NetconfTimeStampImpl;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.EntityInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SortOrder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.entity.input.Filter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.entity.input.Pagination;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.entity.input.Sortorder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -47,48 +51,130 @@
     private static final Logger LOG = LoggerFactory.getLogger(DataObjectAcessorPm.class);
     private static final List<String> timestampValueNames = Arrays.asList("timestamp", "start", "end");
 
-    private QueryByFilter() {
-        //Hide
+    private static List<Sortorder> emptySortOrderList = new ArrayList<>();
+    private static List<Filter> emptyFilterList = new ArrayList<>();
+
+    // Derived from input
+    private long page;
+    private long pageSize;
+    private long fromPage;
+    private List<Filter> filterList;
+    private List<Sortorder> sortOrder;
+
+    /**
+     * Process input from RPC into Queries to database
+     * 
+     * @param input Input from RPC, for test it could be null
+     */
+    public QueryByFilter(EntityInput input) {
+        page = -1;
+        pageSize = -1;
+        if (input != null) {
+            @Nullable
+            Pagination pagination = input.getPagination();
+            if (pagination != null) {
+                BigInteger pageOrNull = pagination.getPage();
+                if (pageOrNull != null) {
+                    page = pageOrNull.longValue();
+                }
+                Long pageSizeOrNull = pagination.getSize();
+                if (pageSizeOrNull != null) {
+                    pageSize = pageSizeOrNull;
+                }
+            }
+        }
+        if (page < 0)
+            page = 1;
+        if (pageSize < 0)
+            pageSize = 1;
+
+        fromPage = (page - 1) * pageSize;
+        if (fromPage < 0 || pageSize > 10000)
+            throw new IllegalArgumentException("mismatching input parameters. From:" + fromPage + " size:" + pageSize);
+
+        filterList = input.getFilter();
+        if (filterList == null)
+            filterList = emptyFilterList;
+        sortOrder = input.getSortorder();
+        if (sortOrder == null)
+            sortOrder = emptySortOrderList;
+
     }
 
-    static long getPage(EntityInput input) {
-        return getPage(input, 1);
+    public QueryBuilder getQueryBuilderByFilter() {
+        return getQueryBuilderByFilter("");
     }
 
-    @SuppressWarnings("null")
-    private static long getPage(EntityInput input, long defaultValue) {
-        return input.getPagination() != null ? input.getPagination().getPage().longValue() : defaultValue;
+    public QueryBuilder getQueryBuilderByFilter(String prefix) {
+        QueryBuilder queryBuilder = fromFilter(filterList, prefix).from(fromPage).size(pageSize);
+        setSortOrder(queryBuilder, sortOrder, prefix);
+        return queryBuilder;
     }
 
-    static long getPageSize(EntityInput input) {
-        return getPageSize(input, 1);
+    public SearchRequest getSearchRequestByFilter(String nodeKey, String uuidKey, String index, String dataType) {
+        Filter nodeFilter = getFilter(filterList, nodeKey);
+        if (nodeFilter != null) {
+            SearchRequest request = new SearchRequest(index, dataType);
+            request.setQuery(
+                    QueryBuilders.matchQuery(nodeKey, nodeFilter.getFiltervalue()).aggregations(uuidKey).size(0));
+            return request;
+        } else {
+            String msg = "no nodename in filter found ";
+            LOG.debug(msg);
+            throw new IllegalArgumentException(msg);
+        }
     }
 
-    @SuppressWarnings("null")
-    private static long getPageSize(EntityInput input, long defaultValue) {
-        return input.getPagination() != null ? input.getPagination().getSize().longValue() : defaultValue;
+    public SearchRequest getSearchRequestBySortOrder(String nodeKey, String uuidKey, String index, String dataType) {
+        Sortorder soNode = getSortOrder(sortOrder, nodeKey);
+        SearchRequest request = new SearchRequest(index, dataType);
+        QueryBuilder query = null;
+        if (soNode != null) {
+            query = QueryBuilders.matchAllQuery().aggregations(nodeKey, convert(soNode.getSortorder())).size(0);
+        } else {
+            query = QueryBuilders.matchAllQuery().aggregations(nodeKey).size(0);
+        }
+        request.setQuery(query);
+        return request;
     }
 
-
-    public static QueryBuilder setSortOrder(QueryBuilder query, @Nullable List<Sortorder> sortorder) {
-        return setSortOrder(query, sortorder, "");
+    public long getPage() {
+        return page;
     }
 
+    public long getPageSize() {
+        return pageSize;
+    }
+
+    public long getPageStartIndex() {
+        return fromPage;
+    }
+
+    @Override
+    public String toString() {
+        return "QueryByFilter [page=" + page + ", pageSize=" + pageSize + ", fromPage=" + fromPage + ", filterList="
+                + filterList + ", sortOrder=" + sortOrder + "]";
+    }
+
+    /*
+     * Private and static implementations
+     */
     private static QueryBuilder setSortOrder(QueryBuilder query, @Nullable List<Sortorder> sortorder, String prefix) {
         if (sortorder != null && sortorder.size() > 0) {
             for (Sortorder so : sortorder) {
-                query.sort((prefix != null ? prefix : "") + so.getProperty(),
-                        so.getSortorder() == SortOrder.Ascending
-                                ? org.onap.ccsdk.features.sdnr.wt.common.database.queries.SortOrder.ASCENDING
-                                : org.onap.ccsdk.features.sdnr.wt.common.database.queries.SortOrder.DESCENDING);
+                query.sort(handlePrefix(prefix, so.getProperty()), convert(so.getSortorder()));
             }
         }
         return query;
-
     }
 
+    private static org.onap.ccsdk.features.sdnr.wt.common.database.queries.SortOrder convert(SortOrder sortOrder) {
+        return sortOrder == SortOrder.Ascending
+                ? org.onap.ccsdk.features.sdnr.wt.common.database.queries.SortOrder.ASCENDING
+                : org.onap.ccsdk.features.sdnr.wt.common.database.queries.SortOrder.DESCENDING;
+    };
 
-    public static Sortorder getSortOrder(@Nullable List<Sortorder> list, String prop) {
+    private static Sortorder getSortOrder(@Nullable List<Sortorder> list, String prop) {
         if (list == null) {
             return null;
         }
@@ -100,7 +186,7 @@
         return null;
     }
 
-    public static Filter getFilter(@Nullable List<Filter> list, String prop) {
+    private static Filter getFilter(@Nullable List<Filter> list, String prop) {
         if (list == null) {
             return null;
         }
@@ -112,10 +198,6 @@
         return null;
     }
 
-    public static QueryBuilder fromFilter(@Nullable List<Filter> filters) {
-        return fromFilter(filters, "");
-    }
-
     private static String fillTimeStamp(String value) {
         int idx = value.lastIndexOf("*");
         final String REPLACE = "0000-00-00T00:00:00.0Z";
@@ -176,7 +258,7 @@
                 c.set(Calendar.YEAR, c.get(Calendar.YEAR) + 1);
                 upperEnd = converter.getTimeStampAsNetconfString(c.getTime());
                 break;
-            case 6: //switch 10 months (2000-0* or 2000-1*)
+            case 6: // switch 10 months (2000-0* or 2000-1*)
                 tmpvalue = c.get(Calendar.MONTH);
                 if (tmpvalue < 9) {
                     c.set(Calendar.MONTH, 9);
@@ -187,7 +269,7 @@
                 upperEnd = converter.getTimeStampAsNetconfString(c.getTime());
 
                 break;
-            case 7: //switch one month (2018-01* or 2018-01-*)
+            case 7: // switch one month (2018-01* or 2018-01-*)
             case 8:
                 c.add(Calendar.MONTH, 1);
                 upperEnd = converter.getTimeStampAsNetconfString(c.getTime());
@@ -287,14 +369,14 @@
 
 
             } else if (DbFilter.isComparisonValid(v)) {
-                RangeQueryBuilder q = DbFilter.getRangeQuery((prefix != null ? prefix : "") + p, v);
+                RangeQueryBuilder q = DbFilter.getRangeQuery(handlePrefix(prefix, p), v);
                 if (q != null) {
                     return q;
                 } else {
-                    return QueryBuilders.matchQuery((prefix != null ? prefix : "") + p, v);
+                    return QueryBuilders.matchQuery(handlePrefix(prefix, p), v);
                 }
             } else {
-                return QueryBuilders.matchQuery((prefix != null ? prefix : "") + p, v);
+                return QueryBuilders.matchQuery(handlePrefix(prefix, p), v);
             }
         } else {
             BoolQueryBuilder query = new BoolQueryBuilder();
@@ -313,22 +395,20 @@
                         if (tmpQuery != null) {
                             query.must(tmpQuery);
                         } else {
-                            query.must(QueryBuilders.regex((prefix != null ? prefix : "") + p,
-                                    DbFilter.createDatabaseRegex(v)));
+                            query.must(QueryBuilders.regex(handlePrefix(prefix, p), DbFilter.createDatabaseRegex(v)));
                         }
                     } else {
-                        query.must(QueryBuilders.regex((prefix != null ? prefix : "") + p,
-                                DbFilter.createDatabaseRegex(v)));
+                        query.must(QueryBuilders.regex(handlePrefix(prefix, p), DbFilter.createDatabaseRegex(v)));
                     }
                 } else if (DbFilter.isComparisonValid(v)) {
-                    RangeQueryBuilder q = DbFilter.getRangeQuery((prefix != null ? prefix : "") + p, v);
+                    RangeQueryBuilder q = DbFilter.getRangeQuery(handlePrefix(prefix, p), v);
                     if (q != null) {
                         query.must(q);
                     } else {
-                        query.must(QueryBuilders.matchQuery((prefix != null ? prefix : "") + p, v));
+                        query.must(QueryBuilders.matchQuery(handlePrefix(prefix, p), v));
                     }
                 } else {
-                    query.must(QueryBuilders.matchQuery((prefix != null ? prefix : "") + p, v));
+                    query.must(QueryBuilders.matchQuery(handlePrefix(prefix, p), v));
                 }
             }
             LOG.trace("Query result. {}", query.toJSON());
@@ -336,4 +416,8 @@
         }
     }
 
+    private static String handlePrefix(String prefix, String p) {
+        return (prefix != null ? prefix : "") + p;
+    }
+
 }
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/QueryByFilterStatic.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/QueryByFilterStatic.java
new file mode 100644
index 0000000..4abe658
--- /dev/null
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/QueryByFilterStatic.java
@@ -0,0 +1,336 @@
+/*
+ * ============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.data;
+
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.TimeZone;
+import org.eclipse.jdt.annotation.Nullable;
+import org.onap.ccsdk.features.sdnr.wt.common.database.data.DbFilter;
+import org.onap.ccsdk.features.sdnr.wt.common.database.queries.BoolQueryBuilder;
+import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilder;
+import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilders;
+import org.onap.ccsdk.features.sdnr.wt.common.database.queries.RangeQueryBuilder;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.NetconfTimeStamp;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.NetconfTimeStampImpl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.EntityInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SortOrder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.entity.input.Filter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.entity.input.Sortorder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+class QueryByFilterStatic {
+
+    private static final Logger LOG = LoggerFactory.getLogger(DataObjectAcessorPm.class);
+    private static final List<String> timestampValueNames = Arrays.asList("timestamp", "start", "end");
+
+    private QueryByFilterStatic() {
+        //Hide
+    }
+
+    static long getPage(EntityInput input) {
+        return getPage(input, 1);
+    }
+
+    private static long getPage(EntityInput input, long defaultValue) {
+        return input.getPagination() != null ? input.getPagination().getPage().longValue() : defaultValue;
+    }
+
+    static long getPageSize(EntityInput input) {
+        return getPageSize(input, 1);
+    }
+
+    private static long getPageSize(EntityInput input, long defaultValue) {
+        return input.getPagination() != null ? input.getPagination().getSize().longValue() : defaultValue;
+    }
+
+
+    public static QueryBuilder setSortOrder(QueryBuilder query, @Nullable List<Sortorder> sortorder) {
+        return setSortOrder(query, sortorder, "");
+    }
+
+    private static QueryBuilder setSortOrder(QueryBuilder query, @Nullable List<Sortorder> sortorder, String prefix) {
+        if (sortorder != null && sortorder.size() > 0) {
+            for (Sortorder so : sortorder) {
+                query.sort((prefix != null ? prefix : "") + so.getProperty(),
+                        so.getSortorder() == SortOrder.Ascending
+                                ? org.onap.ccsdk.features.sdnr.wt.common.database.queries.SortOrder.ASCENDING
+                                : org.onap.ccsdk.features.sdnr.wt.common.database.queries.SortOrder.DESCENDING);
+            }
+        }
+        return query;
+
+    }
+
+
+    public static Sortorder getSortOrder(@Nullable List<Sortorder> list, String prop) {
+        if (list == null) {
+            return null;
+        }
+        for (Sortorder o : list) {
+            if (prop.equals(o.getProperty())) {
+                return o;
+            }
+        }
+        return null;
+    }
+
+    public static Filter getFilter(@Nullable List<Filter> list, String prop) {
+        if (list == null) {
+            return null;
+        }
+        for (Filter f : list) {
+            if (prop.equals(f.getProperty())) {
+                return f;
+            }
+        }
+        return null;
+    }
+
+    public static QueryBuilder fromFilter(@Nullable List<Filter> filters) {
+        return fromFilter(filters, "");
+    }
+
+    private static String fillTimeStamp(String value) {
+        int idx = value.lastIndexOf("*");
+        final String REPLACE = "0000-00-00T00:00:00.0Z";
+        String s = value.substring(0, idx) + REPLACE.substring(idx);
+        if (Integer.parseInt(s.substring(5, 7)) == 0) {
+            s = s.substring(0, 5) + "01-" + s.substring(8);
+        }
+        if (Integer.parseInt(s.substring(8, 10)) == 0) {
+            s = s.substring(0, 8) + "01" + s.substring(10);
+        }
+
+        return s;
+    }
+
+    /**
+     * convert timestamp with ending placeholder in filter to elasticsearch filter e.g. 2017* => gte:
+     * 2017-01-01T00:00:00Z, lt:2018-01-01T00:00:00Z
+     *
+     * 201* => 2010-01... 2020 .. 2018-* => 2018-01... <=> 2019-01
+     *
+     */
+    private static @Nullable QueryBuilder fromTimestampSearchFilter(String property, String value) {
+        if (!value.endsWith("*")) {
+            return null;
+        }
+        int idx = value.lastIndexOf("*");
+        String lowerEnd = fillTimeStamp(value);
+        String upperEnd = null;
+        NetconfTimeStamp converter = NetconfTimeStampImpl.getConverter();
+        Date dt = null;
+        try {
+            dt = converter.getDateFromNetconf(lowerEnd);
+        } catch (Exception e) {
+
+        }
+        if (dt == null) {
+            return null;
+        }
+        //        property.substring(0,idx)+REPLACE.substring(idx+1);
+        Calendar c = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
+        c.setTime(dt);
+        int tmpvalue;
+        switch (idx) {
+            case 1: // (2*)
+                c.set(Calendar.YEAR, c.get(Calendar.YEAR) + 1000);
+                upperEnd = converter.getTimeStampAsNetconfString(c.getTime());
+                break;
+            case 2: // (20*)
+                c.set(Calendar.YEAR, c.get(Calendar.YEAR) + 100);
+                upperEnd = converter.getTimeStampAsNetconfString(c.getTime());
+                break;
+            case 3: // (200*)
+                c.set(Calendar.YEAR, c.get(Calendar.YEAR) + 10);
+                upperEnd = converter.getTimeStampAsNetconfString(c.getTime());
+                break;
+            case 4: // (2000*)
+            case 5: // (2000-*)
+                c.set(Calendar.YEAR, c.get(Calendar.YEAR) + 1);
+                upperEnd = converter.getTimeStampAsNetconfString(c.getTime());
+                break;
+            case 6: //switch 10 months (2000-0* or 2000-1*)
+                tmpvalue = c.get(Calendar.MONTH);
+                if (tmpvalue < 9) {
+                    c.set(Calendar.MONTH, 9);
+                } else {
+                    c.set(Calendar.YEAR, c.get(Calendar.YEAR) + 1);
+                    c.set(Calendar.MONTH, 0);
+                }
+                upperEnd = converter.getTimeStampAsNetconfString(c.getTime());
+
+                break;
+            case 7: //switch one month (2018-01* or 2018-01-*)
+            case 8:
+                c.add(Calendar.MONTH, 1);
+                upperEnd = converter.getTimeStampAsNetconfString(c.getTime());
+                break;
+            case 9: // (2018-01-0*)
+                tmpvalue = c.get(Calendar.DAY_OF_MONTH);
+                if (tmpvalue == 1) {
+                    c.set(Calendar.DAY_OF_MONTH, 10);
+                } else if (tmpvalue == 10) {
+                    c.set(Calendar.DAY_OF_MONTH, 20);
+                } else if (tmpvalue == 20) {
+                    if (c.getActualMaximum(Calendar.DAY_OF_MONTH) < 30) {
+                        c.set(Calendar.DAY_OF_MONTH, 1);
+                        c.add(Calendar.MONTH, 1);
+                    } else {
+                        c.set(Calendar.DAY_OF_MONTH, 30);
+                    }
+                } else if (tmpvalue == 30) {
+                    c.set(Calendar.DAY_OF_MONTH, 1);
+                    c.add(Calendar.MONTH, 1);
+                } else {
+                    break;
+                }
+                upperEnd = converter.getTimeStampAsNetconfString(c.getTime());
+                break;
+            case 10: // (2018-01-01*)
+            case 11: // (2018-01-01T*)
+                c.add(Calendar.DAY_OF_MONTH, 1);
+                upperEnd = converter.getTimeStampAsNetconfString(c.getTime());
+                break;
+            case 12: // (2018-01-01T1*)
+                tmpvalue = c.get(Calendar.HOUR_OF_DAY);
+                if (tmpvalue == 20) {
+                    c.set(Calendar.HOUR_OF_DAY, 0);
+                    c.add(Calendar.DAY_OF_MONTH, 1);
+                } else {
+                    c.add(Calendar.HOUR_OF_DAY, 10);
+                }
+                upperEnd = converter.getTimeStampAsNetconfString(c.getTime());
+                break;
+            case 13: // (2018-01-01T11*)
+            case 14: // (2018-01-01T11-*)
+                c.add(Calendar.HOUR_OF_DAY, 1);
+                upperEnd = converter.getTimeStampAsNetconfString(c.getTime());
+                break;
+            case 15: // (2018-01-01T11-3*)
+                c.add(Calendar.MINUTE, 10);
+                upperEnd = converter.getTimeStampAsNetconfString(c.getTime());
+                break;
+            case 16: // (2018-01-01T11-32*)
+            case 17: // (2018-01-01T11-32-*)
+                c.add(Calendar.MINUTE, 1);
+                upperEnd = converter.getTimeStampAsNetconfString(c.getTime());
+                break;
+            case 18: // (2018-01-01T11-32-1*)
+                c.add(Calendar.SECOND, 10);
+                upperEnd = converter.getTimeStampAsNetconfString(c.getTime());
+                break;
+            case 19: // (2018-01-01T11-32-11*)
+            case 20: // (2018-01-01T11-32-11.*)
+                c.add(Calendar.SECOND, 1);
+                upperEnd = converter.getTimeStampAsNetconfString(c.getTime());
+                break;
+
+            default:
+                break;
+        }
+
+        if (upperEnd == null) {
+            return null;
+        }
+        return QueryBuilders.rangeQuery(property).gte(lowerEnd).lt(upperEnd);
+
+    }
+
+    private static QueryBuilder fromFilter(@Nullable List<Filter> filters, String prefix) {
+        if (filters == null || filters.size() == 0) {
+            return QueryBuilders.matchAllQuery();
+
+        } else if (filters.size() == 1) {
+            QueryBuilder query;
+            String p = filters.get(0).getProperty();
+            String v = filters.get(0).getFiltervalue();
+            if ("id".equals(p)) {
+                p = "_id";
+            } else {
+                //    v=v.toLowerCase();
+            }
+            if (DbFilter.hasSearchParams(v)) {
+                if (p != null && timestampValueNames.contains(p.toLowerCase())) {
+                    query = fromTimestampSearchFilter(p, v);
+                    if (query != null) {
+                        return query;
+                    }
+                }
+                return QueryBuilders.regex(p, DbFilter.createDatabaseRegex(v));
+
+
+            } else if (DbFilter.isComparisonValid(v)) {
+                RangeQueryBuilder q = DbFilter.getRangeQuery((prefix != null ? prefix : "") + p, v);
+                if (q != null) {
+                    return q;
+                } else {
+                    return QueryBuilders.matchQuery((prefix != null ? prefix : "") + p, v);
+                }
+            } else {
+                return QueryBuilders.matchQuery((prefix != null ? prefix : "") + p, v);
+            }
+        } else {
+            BoolQueryBuilder query = new BoolQueryBuilder();
+            QueryBuilder tmpQuery;
+            for (Filter fi : filters) {
+                String p = fi.getProperty();
+                String v = fi.getFiltervalue();
+                if ("id".equals(p)) {
+                    p = "_id";
+                } else {
+                    //    v=v.toLowerCase();
+                }
+                if (DbFilter.hasSearchParams(v)) {
+                    if (p != null && timestampValueNames.contains(p.toLowerCase())) {
+                        tmpQuery = fromTimestampSearchFilter(p, v);
+                        if (tmpQuery != null) {
+                            query.must(tmpQuery);
+                        } else {
+                            query.must(QueryBuilders.regex((prefix != null ? prefix : "") + p,
+                                    DbFilter.createDatabaseRegex(v)));
+                        }
+                    } else {
+                        query.must(QueryBuilders.regex((prefix != null ? prefix : "") + p,
+                                DbFilter.createDatabaseRegex(v)));
+                    }
+                } else if (DbFilter.isComparisonValid(v)) {
+                    RangeQueryBuilder q = DbFilter.getRangeQuery((prefix != null ? prefix : "") + p, v);
+                    if (q != null) {
+                        query.must(q);
+                    } else {
+                        query.must(QueryBuilders.matchQuery((prefix != null ? prefix : "") + p, v));
+                    }
+                } else {
+                    query.must(QueryBuilders.matchQuery((prefix != null ? prefix : "") + p, v));
+                }
+            }
+            LOG.trace("Query result. {}", query.toJSON());
+            return query;
+        }
+    }
+
+}
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/QueryResult.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/QueryResult.java
index 61e5241..7570523 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/QueryResult.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/QueryResult.java
@@ -42,11 +42,22 @@
         pagination = x.build();
     }
 
+    public QueryResult(QueryByFilter queryByFilter, SearchResult<T> result) {
+        this.result = result;
+
+        PaginationBuilder x = new PaginationBuilder();
+        x.setPage(BigInteger.valueOf(queryByFilter.getPage()));
+        x.setSize(queryByFilter.getPageSize());
+        x.setTotal(BigInteger.valueOf(result.getTotal()));
+        pagination = x.build();
+    }
+
+
     public SearchResult<T> getResult() {
         return result;
     }
 
-    PaginationOutputG getPagination() {
+    public PaginationOutputG getPagination() {
         return pagination;
     }
 
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/EsDataObjectReaderWriter.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/EsDataObjectReaderWriter.java
deleted file mode 100644
index c0518c6..0000000
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/EsDataObjectReaderWriter.java
+++ /dev/null
@@ -1,357 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP : ccsdk features
- * ================================================================================
- * Copyright (C) 2019 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.database;
-
-import java.io.IOException;
-import java.lang.reflect.Field;
-import java.util.List;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import org.onap.ccsdk.features.sdnr.wt.common.database.DatabaseClient;
-import org.onap.ccsdk.features.sdnr.wt.common.database.SearchHit;
-import org.onap.ccsdk.features.sdnr.wt.common.database.SearchResult;
-import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilder;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.yangtools.YangToolsMapper;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.Entity;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-
-/**
- * Class to rw yang-tool generated objects into elasticsearch database. For "ES _id" exchange the esIdAddAtributteName
- * is used. This attribute mast be of type String and contains for read and write operations the object id. The function
- * can be used without id handling. If id handling is required the parameter needs to be specified by class definition
- * in yang and setting the name by using setAttributeName()
- *
- * @param <T> Yang tools generated class object.
- */
-public class EsDataObjectReaderWriter<T extends DataObject> {
-
-    private final Logger LOG = LoggerFactory.getLogger(EsDataObjectReaderWriter.class);
-
-    /** Typename for elastic search data schema **/
-    private String dataTypeName;
-
-    /** Elasticsearch Database client to be used **/
-    private DatabaseClient db;
-
-    /** Mapper with configuration to use opendaylight yang-tools builder pattern for object creation **/
-    private YangToolsMapper yangtoolsMapper;
-
-    /** Class of T as attribute to allow JSON to Class object mapping **/
-    private Class<T> clazz;
-
-    /** Field is used to write id. If null no id handling **/
-    private @Nullable Field field;
-
-    /** Attribute that is used as id field for the database object **/
-    private @Nullable String esIdAddAtributteName;
-
-    /** Interface to be used for write operations. Rule for write: T extends S and **/
-    private Class<? extends DataObject> writeInterfaceClazz; // == "S"
-
-    /**
-     * Elasticsearch database read and write for specific class, defined by opendaylight yang-tools.
-     *
-     * @param db Database access client
-     * @param dataTypeName typename in database schema
-     * @param clazz class of type to be handled
-     * @throws ClassNotFoundException
-     */
-    public EsDataObjectReaderWriter(DatabaseClient db, Entity dataTypeName, Class<T> clazz)
-            throws ClassNotFoundException {
-        this(db, dataTypeName.getName(), clazz);
-    }
-
-    public EsDataObjectReaderWriter(DatabaseClient db, String dataTypeName, Class<T> clazz)
-            throws ClassNotFoundException {
-        LOG.info("Create {} for datatype {} class {}", this.getClass().getName(), dataTypeName, clazz.getName());
-
-        this.esIdAddAtributteName = null;
-        this.field = null;
-        this.writeInterfaceClazz = clazz;
-        this.db = db;
-        this.dataTypeName = dataTypeName;
-        this.yangtoolsMapper = new YangToolsMapper();
-        //this.yangtoolsMapper.assertBuilderClass(clazz);
-        this.clazz = clazz;
-        //
-        //		if (! db.isExistsIndex(dataTypeName)) {
-        //			throw new IllegalArgumentException("Index "+dataTypeName+" not existing.");
-        //		}
-    }
-
-    public String getDataTypeName() {
-        return dataTypeName;
-    }
-
-    public Class<T> getClazz() {
-        return clazz;
-    }
-
-    /**
-     * Simlar to {@link #setEsIdAttributeName()}, but adapts the parameter to yangtools attribute naming schema
-     * 
-     * @param esIdAttributeName is converted to UnderscoreCamelCase
-     * @return this for further operations.
-     */
-    public EsDataObjectReaderWriter<T> setEsIdAttributeNameCamelized(String esIdAttributeName) {
-        return setEsIdAttributeName(YangToolsMapper.toCamelCaseAttributeName(esIdAttributeName));
-    }
-
-    /**
-     * Attribute name of class that is containing the object id
-     * 
-     * @param esIdAttributeName of the implementation class for the yangtools interface. Expected attribute name format
-     *        is CamelCase with leading underline. @
-     * @return this for further operations.
-     * @throws SecurityException if no access or IllegalArgumentException if wrong type or no attribute with this name.
-     */
-    public EsDataObjectReaderWriter<T> setEsIdAttributeName(String esIdAttributeName) {
-        LOG.debug("Set attribute '{}'", esIdAttributeName);
-        this.esIdAddAtributteName = null; // Reset status
-        this.field = null;
-
-        Field attributeField;
-        try {
-            Builder<T> builder = yangtoolsMapper.getBuilder(clazz);
-            T object = builder.build();
-            attributeField = object.getClass().getDeclaredField(esIdAttributeName);
-            if (attributeField.getType().equals(String.class)) {
-                attributeField.setAccessible(true);
-                this.esIdAddAtributteName = esIdAttributeName; //Set new status if everything OK
-                this.field = attributeField;
-            } else {
-                String msg = "Wrong field type " + attributeField.getType().getName() + " of " + esIdAttributeName;
-                LOG.debug(msg);
-                throw new IllegalArgumentException(msg);
-            }
-        } catch (NoSuchFieldException e) {
-            // Convert to run-time exception
-            String msg = "NoSuchFieldException for '" + esIdAttributeName + "' in class " + clazz.getName();
-            LOG.debug(msg);
-            throw new IllegalArgumentException(msg);
-        } catch (SecurityException e) {
-            LOG.debug("Access problem " + esIdAttributeName, e);
-            throw e;
-        }
-        return this;
-    }
-
-    /**
-     * Specify subclass of T for write operations.
-     * 
-     * @param writeInterfaceClazz
-     */
-    public EsDataObjectReaderWriter<T> setWriteInterface(@Nonnull Class<? extends DataObject> writeInterfaceClazz) {
-        LOG.debug("Set write interface to {}", writeInterfaceClazz);
-        if (writeInterfaceClazz == null)
-            throw new IllegalArgumentException("Null not allowed here.");
-
-        this.writeInterfaceClazz = writeInterfaceClazz;
-        return this;
-    }
-
-    /**
-     * Write child object to database with specific id
-     * 
-     * @param object
-     * @param @Nullable esId use the id or if null generate unique id
-     * @return String with id or null
-     */
-    public @Nullable <S extends DataObject> String write(S object, @Nullable String esId) {
-        if (writeInterfaceClazz.isInstance(object)) {
-            try {
-                String json = yangtoolsMapper.writeValueAsString(object);
-                return db.doWriteRaw(dataTypeName, esId, json);
-            } catch (JsonProcessingException e) {
-                LOG.error("Write problem: ", e);
-            }
-        } else {
-            LOG.error("Type {} does not provide interface {}", object != null ? object.getClass().getName() : "null",
-                    writeInterfaceClazz.getName());
-        }
-        return null;
-    }
-
-    /**
-     * Update partial child object to database with match/term query
-     * 
-     * @param object
-     * @param esId
-     * @return String with esId or null
-     */
-    public @Nullable <S extends DataObject> boolean update(S object, QueryBuilder query) {
-        if (writeInterfaceClazz.isInstance(object)) {
-            try {
-                String json = yangtoolsMapper.writeValueAsString(object);
-                return db.doUpdate(this.dataTypeName, json, query);
-            } catch (JsonProcessingException e) {
-                LOG.error("Update problem: ", e);
-            }
-        } else {
-            LOG.error("Type {} does not provide interface {}", object != null ? object.getClass().getName() : "null",
-                    writeInterfaceClazz.getName());
-        }
-        return false;
-    }
-
-    /**
-     * Write/ update partial child object to database with specific id Write if not exists, else update
-     * 
-     * @param object
-     * @param esId
-     * @return String with esId or null
-     */
-    public @Nullable <S extends DataObject> String update(S object, String esId) {
-        return this.update(object, esId, null);
-    }
-
-    public @Nullable <S extends DataObject> String update(S object, String esId, List<String> onylForInsert) {
-        if (writeInterfaceClazz.isInstance(object)) {
-            try {
-                String json = yangtoolsMapper.writeValueAsString(object);
-                return db.doUpdateOrCreate(dataTypeName, esId, json, onylForInsert);
-            } catch (JsonProcessingException e) {
-                LOG.error("Update problem: ", e);
-            }
-        } else {
-            LOG.error("Type {} does not provide interface {}", object != null ? object.getClass().getName() : "null",
-                    writeInterfaceClazz.getName());
-        }
-        return null;
-    }
-
-    /**
-     * Read object from database, by using the id field
-     * 
-     * @param object
-     * @return
-     */
-    public @Nullable T read(String esId) {
-        @Nullable
-        T res = (T) null;
-        if (esId != null) {
-            String json = db.doReadJsonData(dataTypeName, esId);
-            try {
-                res = yangtoolsMapper.readValue(json.getBytes(), clazz);
-            } catch (IOException e) {
-                LOG.error("Problem: ", e);
-            }
-        }
-        return res;
-    }
-
-    /**
-     * Remove object
-     * 
-     * @param esId to identify the object.
-     * @return success
-     */
-    public boolean remove(String esId) {
-        return db.doRemove(this.dataTypeName, esId);
-    }
-
-    public int remove(QueryBuilder query) {
-        return this.db.doRemove(this.dataTypeName, query);
-    }
-
-    /**
-     * Get all elements of related type
-     * 
-     * @return all Elements
-     */
-    public SearchResult<T> doReadAll() {
-        return doReadAll(null);
-    }
-
-    public SearchResult<T> doReadAll(QueryBuilder query) {
-        return this.doReadAll(query, false);
-    }
-
-    /**
-     * Read all existing objects of a type
-     * 
-     * @param query for the elements
-     * @return the list of all objects
-     */
-
-    public SearchResult<T> doReadAll(QueryBuilder query, boolean ignoreException) {
-
-        SearchResult<T> res = new SearchResult<T>();
-        SearchResult<SearchHit> result;
-        List<SearchHit> hits;
-        if (query != null) {
-            LOG.debug("read data in {} with query {}", dataTypeName, query.toJSON());
-            result = db.doReadByQueryJsonData(dataTypeName, query, ignoreException);
-        } else {
-            result = db.doReadAllJsonData(dataTypeName, ignoreException);
-        }
-        hits = result.getHits();
-        LOG.debug("Read: {} elements: {}  Failures: {}", dataTypeName, hits.size(),
-                yangtoolsMapper.getMappingFailures());
-
-        T object;
-        for (SearchHit hit : hits) {
-            object = getT(hit.getSourceAsString());
-            LOG.debug("Mapp Object: {}\nSource: '{}'\nResult: '{}'\n Failures: {}", hit.getId(),
-                    hit.getSourceAsString(), object, yangtoolsMapper.getMappingFailures());
-            if (object != null) {
-                setEsId(object, hit.getId());
-                res.add(object);
-            } else {
-                LOG.warn("Mapp result null Object: {}\n Source: '{}'\n : '", hit.getId(), hit.getSourceAsString());
-            }
-        }
-        res.setTotal(result.getTotal());
-        return res;
-    }
-
-    /* ---------------------------------------------
-     * Private functions
-     */
-
-    private void setEsId(T object, String esId) {
-        if (field != null) {
-            try {
-                field.set(object, esId);
-            } catch (IllegalArgumentException | IllegalAccessException e) {
-                LOG.debug("Field set problem.", e);
-            }
-        }
-    }
-
-    private @Nullable T getT(String jsonString) {
-        try {
-            return yangtoolsMapper.readValue(jsonString, clazz);
-        } catch (IOException e) {
-            LOG.info("Mapping problem", e);
-            return (T) null;
-        }
-    }
-
-}
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/EsDataObjectReaderWriter2.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/EsDataObjectReaderWriter2.java
index e0f6e4a..6588269 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/EsDataObjectReaderWriter2.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/EsDataObjectReaderWriter2.java
@@ -21,13 +21,12 @@
  */
 package org.onap.ccsdk.features.sdnr.wt.dataprovider.database;
 
+import com.fasterxml.jackson.core.JsonProcessingException;
 import java.io.IOException;
 import java.lang.reflect.Field;
 import java.util.List;
-
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
-
 import org.eclipse.jdt.annotation.NonNull;
 import org.onap.ccsdk.features.sdnr.wt.common.database.DatabaseClient;
 import org.onap.ccsdk.features.sdnr.wt.common.database.SearchHit;
@@ -41,8 +40,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.fasterxml.jackson.core.JsonProcessingException;
-
 /**
  * Class to rw yang-tool generated objects into elasticsearch database. For "ES _id" exchange the esIdAddAtributteName
  * is used. This attribute mast be of type String and contains for read and write operations the object id. The function
@@ -78,28 +75,23 @@
 
     /** Interface to be used for write operations. Rule for write: T extends S and **/
     private Class<? extends DataObject> writeInterfaceClazz; // == "S"
+    /** Flag true to sync this attribute during write always, what is slow and false do not sync */
+    private final boolean syncAfterWrite;
 
     /**
      * Elasticsearch database read and write for specific class, defined by opendaylight yang-tools.
      *
+     * @param <X>
+     * @param <B>
      * @param db Database access client
      * @param dataTypeName typename in database schema
      * @param clazz class of type to be handled
+     * @param builderClazz class to build related object if builder pattern should be used.
+     * @param syncAfterWrite
      * @throws ClassNotFoundException
      */
     public <X extends T, @NonNull B extends Builder<X>> EsDataObjectReaderWriter2(DatabaseClient db,
-            Entity dataTypeName, @Nonnull Class<T> clazz, @Nullable Class<B> builderClazz)
-            throws ClassNotFoundException {
-        this(db, dataTypeName.getName(), clazz, builderClazz);
-    }
-
-    public <X extends T, @NonNull B extends Builder<X>> EsDataObjectReaderWriter2(DatabaseClient db,
-            Entity dataTypeName, @Nonnull Class<T> clazz) throws ClassNotFoundException {
-        this(db, dataTypeName.getName(), clazz, null);
-    }
-
-    public <X extends T, @NonNull B extends Builder<X>> EsDataObjectReaderWriter2(DatabaseClient db,
-            String dataTypeName, @Nonnull Class<T> clazz, @Nullable Class<B> builderClazz)
+            String dataTypeName, @Nonnull Class<T> clazz, @Nullable Class<B> builderClazz, boolean syncAfterWrite)
             throws ClassNotFoundException {
         LOG.info("Create {} for datatype {} class {}", this.getClass().getName(), dataTypeName, clazz.getName());
 
@@ -110,11 +102,43 @@
         this.dataTypeName = dataTypeName;
         this.yangtoolsMapper = new YangToolsMapper2<>(clazz, builderClazz);
         this.clazz = clazz;
+        this.syncAfterWrite = syncAfterWrite;
+    }
+
+    public <X extends T, @NonNull B extends Builder<X>> EsDataObjectReaderWriter2(DatabaseClient db,
+            Entity dataTypeName, @Nonnull Class<T> clazz, @Nullable Class<B> builderClazz)
+            throws ClassNotFoundException {
+        this(db, dataTypeName.getName(), clazz, builderClazz, false);
+    }
+
+    public <X extends T, @NonNull B extends Builder<X>> EsDataObjectReaderWriter2(DatabaseClient db,
+            Entity dataTypeName, @Nonnull Class<T> clazz, @Nullable Class<B> builderClazz, boolean syncAfterWrite)
+            throws ClassNotFoundException {
+        this(db, dataTypeName.getName(), clazz, builderClazz, syncAfterWrite);
+    }
+
+    public EsDataObjectReaderWriter2(DatabaseClient db, Entity dataTypeName, @Nonnull Class<T> clazz,
+            boolean syncAfterWrite) throws ClassNotFoundException {
+        this(db, dataTypeName.getName(), clazz, null, syncAfterWrite);
+    }
+
+    public EsDataObjectReaderWriter2(DatabaseClient db, Entity dataTypeName, Class<T> clazz)
+            throws ClassNotFoundException {
+        this(db, dataTypeName.getName(), clazz, null, false);
+    }
+
+    /**
+     * Get Datatype name
+     *
+     * @return string with dataTypeName
+     */
+    public String getDataTypeName() {
+        return dataTypeName;
     }
 
     /**
      * Simlar to {@link #setEsIdAttributeName()}, but adapts the parameter to yangtools attribute naming schema
-     * 
+     *
      * @param esIdAttributeName is converted to UnderscoreCamelCase
      * @return this for further operations.
      */
@@ -124,7 +148,7 @@
 
     /**
      * Attribute name of class that is containing the object id
-     * 
+     *
      * @param esIdAttributeName of the implementation class for the yangtools interface. Expected attribute name format
      *        is CamelCase with leading underline. @
      * @return this for further operations.
@@ -137,7 +161,7 @@
 
         Field attributeField;
         try {
-            Builder<T> builder = yangtoolsMapper.getBuilder(clazz);
+            Builder<? extends T> builder = yangtoolsMapper.getBuilder(clazz);
             if (builder == null) {
                 String msg = "No builder for " + clazz;
                 LOG.debug(msg);
@@ -169,7 +193,7 @@
 
     /**
      * Specify subclass of T for write operations.
-     * 
+     *
      * @param writeInterfaceClazz
      */
     public EsDataObjectReaderWriter2<T> setWriteInterface(@Nonnull Class<? extends DataObject> writeInterfaceClazz) {
@@ -194,7 +218,7 @@
 
     /**
      * Write child object to database with specific id
-     * 
+     *
      * @param object to be written
      * @param esId use the id or if null generate unique id
      * @return String with id or null
@@ -203,7 +227,7 @@
         if (object != null && writeInterfaceClazz.isInstance(object)) {
             try {
                 String json = yangtoolsMapper.writeValueAsString(object);
-                return db.doWriteRaw(dataTypeName, esId, json);
+                return db.doWriteRaw(dataTypeName, esId, json, this.syncAfterWrite);
             } catch (JsonProcessingException e) {
                 LOG.error("Write problem: ", e);
             }
@@ -216,7 +240,7 @@
 
     /**
      * Update partial child object to database with match/term query
-     * 
+     *
      * @param <S> of object
      * @param object to write
      * @param query for write of specific attributes
@@ -239,7 +263,7 @@
 
     /**
      * Write/ update partial child object to database with specific id Write if not exists, else update
-     * 
+     *
      * @param object
      * @param esId
      * @return String with esId or null
@@ -268,7 +292,7 @@
 
     /**
      * Read object from database, by using the id field
-     * 
+     *
      * @param object
      * @return
      */
@@ -292,7 +316,7 @@
 
     /**
      * Remove object
-     * 
+     *
      * @param esId to identify the object.
      * @return success
      */
@@ -306,7 +330,7 @@
 
     /**
      * Get all elements of related type
-     * 
+     *
      * @return all Elements
      */
     public SearchResult<T> doReadAll() {
@@ -319,46 +343,39 @@
 
     /**
      * Read all existing objects of a type
-     * 
+     *
      * @param query for the elements
      * @return the list of all objects
      */
 
     public SearchResult<T> doReadAll(QueryBuilder query, boolean ignoreException) {
 
-        SearchResult<T> res = new SearchResult<>();
-        int idx = 0; //Idx for getAll
-        int iterateLength = 100; //Step width for iterate
+        SearchResult<T> res = new SearchResult<T>();
 
         SearchResult<SearchHit> result;
         List<SearchHit> hits;
-        do {
-            if (query != null) {
-                LOG.debug("read data in {} with query {}", dataTypeName, query.toJSON());
-                result = db.doReadByQueryJsonData(dataTypeName, query, ignoreException);
+        if (query != null) {
+            LOG.debug("read data in {} with query {}", dataTypeName, query.toJSON());
+            result = db.doReadByQueryJsonData(dataTypeName, query, ignoreException);
+        } else {
+            result = db.doReadAllJsonData(dataTypeName, ignoreException);
+        }
+        hits = result.getHits();
+        LOG.debug("Read: {} elements: {}  Failures: {}", dataTypeName, hits.size(),
+                yangtoolsMapper.getMappingFailures());
+
+        T object;
+        for (SearchHit hit : hits) {
+            object = getT(hit.getSourceAsString());
+            LOG.debug("Mapp Object: {}\nSource: '{}'\nResult: '{}'\n Failures: {}", hit.getId(),
+                    hit.getSourceAsString(), object, yangtoolsMapper.getMappingFailures());
+            if (object != null) {
+                setEsId(object, hit.getId());
+                res.add(object);
             } else {
-                result = db.doReadAllJsonData(dataTypeName, ignoreException);
+                LOG.warn("Mapp result null Object: {}\n Source: '{}'\n : '", hit.getId(), hit.getSourceAsString());
             }
-            hits = result.getHits();
-            LOG.debug("Read: {} elements: {}  Failures: {}", dataTypeName, hits.size(),
-                    yangtoolsMapper.getMappingFailures());
-
-            T object;
-            idx += result.getHits().size();
-            for (SearchHit hit : hits) {
-                object = getT(hit.getSourceAsString());
-                LOG.debug("Mapp Object: {}\nSource: '{}'\nResult: '{}'\n Failures: {}", hit.getId(),
-                        hit.getSourceAsString(), object, yangtoolsMapper.getMappingFailures());
-                if (object != null) {
-                    setEsId(object, hit.getId());
-                    res.add(object);
-                } else {
-                    LOG.warn("Mapp result null Object: {}\n Source: '{}'\n : '", hit.getId(), hit.getSourceAsString());
-                }
-            }
-
-        } while (hits.size() == iterateLength); // Do it until end indicated, because less hits than iterateLength
-                                                // allows.
+        }
         res.setTotal(result.getTotal());
         return res;
     }
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/AboutHttpServlet.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/AboutHttpServlet.java
index 1206842..fdac1c1 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/AboutHttpServlet.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/AboutHttpServlet.java
@@ -23,7 +23,9 @@
 
 import java.io.IOException;
 import java.net.URL;
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.jar.Attributes;
@@ -35,11 +37,14 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+//import org.apache.karaf.bundle.core.BundleInfo;
+//import org.apache.karaf.bundle.core.BundleService;
 import org.onap.ccsdk.features.sdnr.wt.common.Resources;
 import org.onap.ccsdk.features.sdnr.wt.common.file.PomFile;
 import org.onap.ccsdk.features.sdnr.wt.common.file.PomPropertiesFile;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.data.ODLVersionLUT;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.data.SystemInfo;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -69,6 +74,7 @@
     private static final String PLACEHOLDER_MDSAL_VERSION = "{mdsal-version}";
     private static final String PLACEHOLDER_YANGTOOLS_VERSION = "{yangtools-version}";
     private static final String PLACEHOLDER_KARAF_INFO = "{karaf-info}";
+    private static final String PLACEHOLDER_DEVICEMANAGER_TABLE = "{devicemanagers}";
     private static final String README_FILE = "README.md";
 
     private final String groupId = "org.onap.ccsdk.features.sdnr.wt";
@@ -76,14 +82,22 @@
 
     private final Map<String, String> data;
     private final String readmeContent;
+    //	private BundleService bundleService;
+
 
     public AboutHttpServlet() {
 
         this.data = new HashMap<>();
         this.collectStaticData();
         this.readmeContent = this.render(this.getResourceFileContent(README_FILE));
+        //BundleContext  context = FrameworkUtil.getBundle(this.getClass()).getBundleContext();
+
     }
 
+    //	public void setBundleService(BundleService bundleService) {
+    //		this.bundleService = bundleService;
+    //	}
+
     /**
      * collect static versioning data
      */
@@ -96,7 +110,7 @@
         this.data.put(PLACEHOLDER_ODLUX_REVISION, this.getPomProperty("odlux.buildno"));
         this.data.put(PLACEHOLDER_PACAKGE_VERSION, this.getManifestValue("Bundle-Version"));
         this.data.put(PLACEHOLDER_CCSDK_VERSION, ccsdkVersion);
-        this.data.put(PLACEHOLDER_ONAP_RELEASEVERSION, "1.8.1-SNAPSHOT");
+        this.data.put(PLACEHOLDER_ONAP_RELEASEVERSION, "2.0.0-SNAPSHOT");
         this.data.put(PLACEHOLDER_MDSAL_VERSION, SystemInfo.getMdSalVersion(UNKNOWN));
         this.data.put(PLACEHOLDER_YANGTOOLS_VERSION, SystemInfo.getYangToolsVersion(UNKNOWN));
         this.data.put(PLACEHOLDER_PACKAGE_GITHASH, this.getGitHash(UNKNOWN));
@@ -170,6 +184,7 @@
         LOG.info("collecting dynamic data");
         try {
             this.data.put(PLACEHOLDER_KARAF_INFO, SystemInfo.get());
+            this.data.put(PLACEHOLDER_DEVICEMANAGER_TABLE, this.getDevicemanagerBundles());
         } catch (Exception e) {
             LOG.warn("problem collecting system data: {}", e);
         }
@@ -264,6 +279,28 @@
         return null;
     }
 
+    private String getDevicemanagerBundles() {
+        //		if(this.bundleService==null) {
+        //			LOG.debug("no bundle service available");
+        //			return "";
+        //		}
+        //		
+        //		List<String> ids = new ArrayList<String>();
+        //		List<Bundle> bundles = bundleService.selectBundles("0", ids , true);
+        //		if(bundles==null || bundles.size()<=0) {
+        //			LOG.debug("no bundles found");
+        //			return "";
+        //		}
+        //		LOG.debug("found {} bundles",bundles.size());
+        //		MarkdownTable table = new MarkdownTable();
+        //		for(Bundle bundle:bundles) {
+        //			BundleInfo info = this.bundleService.getInfo(bundle);
+        //			table.addRow(new String[] {String.valueOf(info.getBundleId()),info.getVersion(),info.getName(),info.getState().toString()});
+        //		}
+        //		return table.toMarkDown();
+        return "";
+    }
+
     /**
      * get file by uri from resources and write out to response stream
      * 
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/DataTreeChildObject.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/DataTreeChildObject.java
new file mode 100644
index 0000000..e34988b
--- /dev/null
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/DataTreeChildObject.java
@@ -0,0 +1,192 @@
+/*
+ * ============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.http;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.json.JSONObject;
+
+public class DataTreeChildObject {
+
+    private final String label;
+    private final String ownSeverity;
+    private final String childrenSeveritySummary;
+    private final boolean isMatch;
+    private final Map<String, DataTreeChildObject> children;
+    private final Map<String, Object> properties;
+
+    public boolean isMatch() {
+        return this.isMatch;
+    }
+
+    public DataTreeChildObject(String label, boolean isMatch, Map<String, DataTreeChildObject> children,
+            String ownSeverity, String childrenSeveritySummary) {
+        this.label = label;
+        this.isMatch = isMatch;
+        this.children = children;
+        this.ownSeverity = ownSeverity;
+        this.childrenSeveritySummary = childrenSeveritySummary;
+        this.properties = new HashMap<>();
+    }
+
+    public DataTreeChildObject setProperty(String key, Object value) {
+        this.properties.put(key, value);
+        return this;
+    }
+
+    public Object getProperty(String key, Object defaultValue) {
+        return this.properties.getOrDefault(key, defaultValue);
+    }
+
+    /**
+     * @param string
+     * @param b
+     */
+    public DataTreeChildObject(String label, boolean isMatch) {
+        this(label, isMatch, new HashMap<>(), null, null);
+    }
+
+    /**
+     * @param treeLevel
+     * @param id
+     * @param data
+     * @param childKey
+     * @param parentKey
+     * @return
+     */
+    public boolean putChild(long treeLevel, String id, DataTreeChildObject data, String parentKey, String childKey) {
+        Object itemValue;
+        Object itemValueToMatch = data.getProperty(parentKey, null);
+        if (itemValueToMatch == null) {
+            return false;
+        }
+        if (treeLevel > 0) {
+            if (this.children != null) {
+                for (DataTreeChildObject child : this.children.values()) {
+                    if (child.putChild(treeLevel - 1, id, data, parentKey, childKey)) {
+                        return true;
+                    }
+                }
+            }
+        } else {
+            //			if(this.children!=null) {
+            //				for(DataTreeChildObject child:this.children.values()) {
+            //					itemValue=(String) child.getProperty(childKey, null);
+            //					if(itemValue!=null && itemValue.equals(itemValueToMatch)) {
+            //						child.children.put(id, data);
+            //						return true;
+            //					}
+            //				}
+            //			}
+            itemValue = this.getProperty(childKey, null);
+            if (itemValue != null && itemValue.equals(itemValueToMatch)) {
+                this.children.put(id, data);
+            }
+        }
+        return false;
+    }
+
+    /**
+     * @param treeLevel
+     * @param id
+     * @param data
+     * @param parentKey
+     * @param childKey
+     * @return
+     */
+    public boolean putChildIfNotExists(long treeLevel, String id, DataTreeChildObject data, String parentKey,
+            String childKey) {
+        Object itemValue;
+        Object itemValueToMatch = data.getProperty(parentKey, null);
+        if (itemValueToMatch == null) {
+            return false;
+        }
+        if (treeLevel > 0) {
+            if (this.children != null) {
+                for (DataTreeChildObject child : this.children.values()) {
+                    if (child.putChildIfNotExists(treeLevel - 1, id, data, parentKey, childKey)) {
+                        return true;
+                    }
+                }
+            }
+        } else {
+            itemValue = this.getProperty(childKey, null);
+            if (itemValue != null && itemValue.equals(itemValueToMatch)) {
+                if (!this.children.containsKey(id)) {
+                    this.children.put(id, data);
+                }
+            }
+        }
+        return false;
+    }
+
+    /**
+     * @return
+     */
+    public JSONObject toJSONObject() {
+        JSONObject o = new JSONObject();
+        o.put("label", this.label);
+        o.put("isMatch", this.isMatch);
+        JSONObject c = new JSONObject();
+        if (this.children != null) {
+            for (Entry<String, DataTreeChildObject> entry : this.children.entrySet()) {
+                c.put(entry.getKey(), entry.getValue().toJSONObject());
+            }
+        }
+        o.put("children", c);
+        //		o.put("ownSeverity", null);
+        //		o.put("childrenSeveritySummary", null);
+        return o;
+    }
+
+    public boolean hasChildMatching() {
+        boolean match = false;
+        for (DataTreeChildObject child : this.children.values()) {
+            match = match || child.hasChildMatching() || this.isMatch;
+            if (match) {
+                break;
+            }
+        }
+        return match;
+    }
+
+    /**
+     *
+     */
+    public void removeUnmatchedPaths() {
+        List<String> toRemove = new ArrayList<>();
+        for (Entry<String, DataTreeChildObject> entry : this.children.entrySet()) {
+            if (!(entry.getValue().hasChildMatching() || entry.getValue().isMatch)) {
+                toRemove.add(entry.getKey());
+            } else {
+                entry.getValue().removeUnmatchedPaths();
+            }
+        }
+        for (String key : toRemove) {
+            this.children.remove(key);
+        }
+    }
+}
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/DataTreeHttpServlet.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/DataTreeHttpServlet.java
index 490f3ca..245ac1c 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/DataTreeHttpServlet.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/DataTreeHttpServlet.java
@@ -21,14 +21,29 @@
  */
 package org.onap.ccsdk.features.sdnr.wt.dataprovider.http;
 
+import java.io.BufferedReader;
 import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.json.JSONObject;
 import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.impl.DataTreeProviderImpl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.Entity;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * @author Michael Dürre
@@ -36,24 +51,190 @@
  */
 public class DataTreeHttpServlet extends HttpServlet {
 
+    public enum FilterMode {
+        Strict, //show only filtered items and their parents
+        Lazy //show root items (and all their children) which have matches inside
+    }
+
     /**
-     * @param rawClient
+     * 
      */
-    public void setDatabaseClient(HtDatabaseClient rawClient) {
+    private static final long serialVersionUID = 1L;
+    private final DataTreeProviderImpl dataTreeProvider;
+    private static final Logger LOG = LoggerFactory.getLogger(DataTreeHttpServlet.class);
 
+    public DataTreeHttpServlet() {
+        super();
+        this.dataTreeProvider = new DataTreeProviderImpl();
+    }
 
+    /**
+     * @param client
+     */
+    public void setDatabaseClient(HtDatabaseClient client) {
+        this.dataTreeProvider.setDatabaseClient(client);
+
+    }
+
+    public static String readPayload(HttpServletRequest request) throws IOException {
+
+        String body = null;
+        StringBuilder stringBuilder = new StringBuilder();
+        BufferedReader bufferedReader = null;
+
+        try {
+            InputStream inputStream = request.getInputStream();
+            if (inputStream != null) {
+                bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
+                char[] charBuffer = new char[128];
+                int bytesRead = -1;
+                while ((bytesRead = bufferedReader.read(charBuffer)) > 0) {
+                    stringBuilder.append(charBuffer, 0, bytesRead);
+                }
+            } else {
+                stringBuilder.append("");
+            }
+        } catch (IOException ex) {
+            throw ex;
+        } finally {
+            if (bufferedReader != null) {
+                try {
+                    bufferedReader.close();
+                } catch (IOException ex) {
+                    throw ex;
+                }
+            }
+        }
+
+        body = stringBuilder.toString();
+        return body;
     }
 
     @Override
     protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
         final String uri = req.getRequestURI();
+        LOG.debug("GET request for {}", uri);
+        final EntityWithTree e = getEntity(uri);
+        if (e != null) {
+            LOG.info("GET request for {} to e={} with tree={}", uri, e.entity, e.tree);
+            switch (e.entity) {
+                case Inventoryequipment:
+                    DataTreeObject o = this.dataTreeProvider.readInventoryTree(e.tree, null, FilterMode.Lazy);
+                    this.doJsonResponse(resp, o);
+                    break;
+                default:
+                    this.notAvailble(resp);
+                    break;
+            }
+        } else {
+            LOG.debug("unable to find entity for uri {}", uri);
+        }
     }
 
-    private void readInventoryTree(String filter) {
+    @Override
+    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+        final String uri = req.getRequestURI();
+        String filter = null;
+        FilterMode mode = FilterMode.Lazy;
+        try {
+            final String body = readPayload(req);
+            JSONObject data = new JSONObject(body);
+            if (data.has("query")) {
+                filter = data.getString("query");
+            }
+            if (data.has("mode")) {
+                mode = data.getString("mode").equals("lazy") ? FilterMode.Lazy : FilterMode.Strict;
+            }
+
+
+        } catch (Exception e) {
+            LOG.warn("problem reading payload: {}", e);
+        }
+        LOG.debug("POST request for {}", uri);
+        final EntityWithTree e = getEntity(uri);
+        if (e != null) {
+            switch (e.entity) {
+                case Inventoryequipment:
+                    DataTreeObject o = this.dataTreeProvider.readInventoryTree(e.tree, filter, mode);
+                    this.doJsonResponse(resp, o);
+                    break;
+                default:
+                    this.notAvailble(resp);
+                    break;
+            }
+        }
+    }
+
+    /**
+     * @param resp
+     */
+    private void notAvailble(HttpServletResponse resp) {
+        try {
+            resp.sendError(HttpServletResponse.SC_NOT_FOUND);
+        } catch (IOException e) {
+
+        }
+    }
+
+    public static EntityWithTree getEntity(String uri) {
+        final String regex = "^\\/tree\\/read-(.*)-tree\\/?(.*)$";
+        final Pattern pattern = Pattern.compile(regex);
+        final Matcher matcher = pattern.matcher(uri);
+        Entity e = null;
+        if (matcher.find() && matcher.groupCount() > 0) {
+            try {
+                e = Entity.forName(matcher.group(1)).get();
+                return new EntityWithTree(e, matcher.groupCount() > 1 ? matcher.group(2) : null);
+            } catch (Exception e2) {
+                LOG.warn("unable to parse {} into entity: {}", matcher.group(2), e2);
+            }
+        }
+        return null;
 
     }
 
-    private void doJsonResponse(HttpServletResponse resp, Object data) {
+    private void doJsonResponse(HttpServletResponse resp, DataTreeObject data) {
+        resp.setHeader("Content-Type", "application/json");
+        try {
+            resp.getWriter().write(data.toJSON());
+        } catch (IOException e) {
+            LOG.warn("problem sending response: {}", e);
+        }
+    }
 
+    public static class EntityWithTree {
+        public final Entity entity;
+        public final List<String> tree;
+
+        @Override
+        public String toString() {
+            return "EntityWithTree [entity=" + entity + ", tree=" + tree + "]";
+        }
+
+        public EntityWithTree(Entity e, String tree) {
+            this.entity = e;
+            if (tree != null) {
+                if (tree.startsWith("/")) {
+                    tree = tree.substring(1);
+                }
+                if (tree.endsWith("/")) {
+                    tree = tree.substring(0, tree.length() - 1);
+                }
+                String[] tmp = tree.split("\\/");
+                this.tree = new ArrayList<>();
+                for (int i = 0; i < tmp.length; i++) {
+                    try {
+                        String s = URLDecoder.decode(tmp[i], "utf-8");
+                        if (s != null && s.length() > 0) {
+                            this.tree.add(s);
+                        }
+                    } catch (UnsupportedEncodingException e1) {
+                        LOG.warn("problem urldecode {}: {}", tmp[i], e);
+                    }
+                }
+            } else {
+                this.tree = null;
+            }
+        }
     }
 }
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/DataTreeObject.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/DataTreeObject.java
new file mode 100644
index 0000000..d6c8bd7
--- /dev/null
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/DataTreeObject.java
@@ -0,0 +1,140 @@
+/*
+ * ============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.http;
+
+import java.util.HashMap;
+
+import org.json.JSONObject;
+
+public class DataTreeObject extends HashMap<String, DataTreeChildObject> {
+
+    private static final long serialVersionUID = 1L;
+    private final String parentKey;
+    private final String childKey;
+
+    public DataTreeObject createTreeByPath(String[] pathFilter) {
+
+        if (pathFilter != null && pathFilter.length > 0) {
+            for (String key : this.keySet()) {
+                if (key.equals(pathFilter[0])) {
+                    DataTreeChildObject o = this.getChildElemByPath(this.get(key), slice(pathFilter, 1));
+                    DataTreeObject r = new DataTreeObject(this.parentKey, this.childKey);
+                    r.put(key, o);
+                    return r;
+                }
+            }
+        }
+
+        return null;
+
+    }
+
+    private DataTreeChildObject getChildElemByPath(DataTreeChildObject source, String[] pathFilter) {
+
+        if (pathFilter != null && pathFilter.length > 0) {
+            //			for(String key:source..keySet()) {
+            //				if(key.equals(pathFilter[0])){
+            //					DataTreeChildObject o= this.getChildElemByPath(this.get(key),slice(pathFilter,1));
+            //				}
+            //			}
+        }
+
+        return null;
+    }
+
+    public DataTreeObject(String parentKey, String childKey) {
+        this.parentKey = parentKey;
+        this.childKey = childKey;
+    }
+
+    /**
+     * @param treeLevel
+     * @param id
+     * @param data
+     */
+    public void put(long treeLevel, String id, DataTreeChildObject data) {
+        for (DataTreeChildObject entry : this.values()) {
+            if (entry.putChild(treeLevel, id, data, this.parentKey, this.childKey)) {
+                break;
+            }
+        }
+
+    }
+
+    /**
+     *
+     */
+    public String toJSON() {
+        JSONObject o = new JSONObject();
+        for (Entry<String, DataTreeChildObject> entry : this.entrySet()) {
+            o.put(entry.getKey(), entry.getValue().toJSONObject());
+        }
+        return o.toString();
+    }
+
+    /**
+     *
+     */
+    public void removeUnmatchedPaths() {
+        for (DataTreeChildObject entry : this.values()) {
+            entry.removeUnmatchedPaths();
+        }
+
+    }
+
+    /**
+     * @param treeLevel
+     * @param id
+     * @param setProperty
+     */
+    public void putIfNotExists(long treeLevel, String id, DataTreeChildObject data) {
+        for (DataTreeChildObject entry : this.values()) {
+            if (entry.putChildIfNotExists(treeLevel, id, data, this.parentKey, this.childKey)) {
+                break;
+            }
+        }
+    }
+
+    /**
+     * @param id
+     * @param data
+     */
+    public void putIfNotExists(String id, DataTreeChildObject data) {
+        if (!this.containsKey(id)) {
+            this.put(id, data);
+        }
+    }
+
+    /**
+     * @param source
+     * @param i
+     * @return
+     */
+    public static String[] slice(String[] source, int start) {
+        String[] r = new String[source.length - start];
+        for (int i = 0; i < r.length; i++) {
+            r[i] = source[i + start];
+        }
+        return r;
+
+    }
+}
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/MarkdownTable.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/MarkdownTable.java
new file mode 100644
index 0000000..52eda0c
--- /dev/null
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/MarkdownTable.java
@@ -0,0 +1,75 @@
+/*
+ * ============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.http;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Michael Dürre
+ *
+ */
+public class MarkdownTable {
+
+    private String[] columns;
+    private final List<String[]> rows;
+
+    public MarkdownTable() {
+        this.rows = new ArrayList<>();
+    }
+
+    public void setHeader(String[] cols) {
+        this.columns = cols;
+    }
+
+    public void addRow(String[] values) {
+        this.rows.add(values);
+    }
+
+    public String toMarkDown() {
+        StringBuilder sb = new StringBuilder();
+        final int cols =
+                this.columns != null ? this.columns.length : this.rows.size() > 0 ? this.rows.get(0).length : 0;
+        if (cols > 0) {
+            sb.append("|");
+            for (int i = 0; i < cols; i++) {
+                sb.append(String.format(" %s |", this.columns != null ? this.columns[i] : ""));
+            }
+            sb.append("\n");
+            sb.append("|");
+            for (int i = 0; i < cols; i++) {
+                sb.append(" --- |");
+            }
+            sb.append("\n");
+            sb.append("|");
+            for (String[] row : this.rows) {
+                for (int i = 0; i < cols; i++) {
+                    sb.append(String.format(" %s |", row[i]));
+                }
+                sb.append("\n");
+            }
+
+
+        }
+        return sb.toString();
+    }
+}
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/ODLVersionLUT.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/ODLVersionLUT.java
similarity index 82%
rename from sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/ODLVersionLUT.java
rename to sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/ODLVersionLUT.java
index 8027fb2..3ea3e3d 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/ODLVersionLUT.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/ODLVersionLUT.java
@@ -19,7 +19,7 @@
  * ============LICENSE_END=========================================================
  *
  */
-package org.onap.ccsdk.features.sdnr.wt.dataprovider.data;
+package org.onap.ccsdk.features.sdnr.wt.dataprovider.http;
 
 public class ODLVersionLUT {
 
@@ -27,8 +27,8 @@
         if (onapCCSDKVersion == null) {
             return def;
         }
-        if (onapCCSDKVersion.startsWith("1.6.")) {
-            return "ONAP Guillin";
+        if (onapCCSDKVersion.startsWith("2.0.")) {
+            return "ONAP Guilin";
         }
         if (onapCCSDKVersion.startsWith("1.5.")) {
             return "ONAP Frankfurt";
@@ -39,6 +39,9 @@
         if (onapCCSDKVersion.startsWith("1.3.")) {
             return "ONAP El Alto";
         }
+        if (onapCCSDKVersion.startsWith("1.2.")) {
+            return "ONAP Guilin";
+        }
         return def;
     }
 
@@ -47,8 +50,8 @@
         if (onapCCSDKVersion == null) {
             return def;
         }
-        if (onapCCSDKVersion.startsWith("1.6.")) {
-            return "sodium-SRX (0.11.X)";
+        if (onapCCSDKVersion.startsWith("2.")) {
+            return "sodium-SR3 (0.11.3)";
         }
         if (onapCCSDKVersion.startsWith("1.5.")) {
             return "neon-SR1 (0.10.1)";
@@ -59,6 +62,9 @@
         if (onapCCSDKVersion.startsWith("1.3.")) {
             return "fluorine-SR2 (0.9.2)";
         }
+        if (onapCCSDKVersion.startsWith("1.2.")) {
+            return "sodium-SR3 (0.11.3)";
+        }
         return def;
     }
 }
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/SystemInfo.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/SystemInfo.java
similarity index 99%
rename from sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/SystemInfo.java
rename to sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/SystemInfo.java
index 9b8806a..12b03ff 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/SystemInfo.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/SystemInfo.java
@@ -19,7 +19,7 @@
  * ============LICENSE_END=========================================================
  *
  */
-package org.onap.ccsdk.features.sdnr.wt.dataprovider.data;
+package org.onap.ccsdk.features.sdnr.wt.dataprovider.http;
 
 import java.io.File;
 import java.io.IOException;
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/YangSchemaHttpServlet.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/YangSchemaHttpServlet.java
index 075f4f7..48862a6 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/YangSchemaHttpServlet.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/YangSchemaHttpServlet.java
@@ -28,7 +28,6 @@
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.data.YangFileProvider;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/DataProviderImpl.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/DataProviderImpl.java
index 286af7a..f9e0fcb 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/DataProviderImpl.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/DataProviderImpl.java
@@ -46,6 +46,7 @@
     private MsServlet mediatorServerServlet;
     private DataProviderServiceImpl rpcApiService;
     private AboutHttpServlet aboutServlet;
+    private DataTreeHttpServlet treeServlet;
     private HtDatabaseClient dbClient;
 
     // Blueprint 1
@@ -66,12 +67,17 @@
         this.aboutServlet = aboutServlet;
     }
 
+    public void setTreeServlet(DataTreeHttpServlet treeServlet) {
+        this.treeServlet = treeServlet;
+    }
+
     public void init() throws Exception {
 
         LOG.info("Session Initiated start {}", APPLICATION_NAME);
 
         // Start RPC Service
         this.rpcApiService = new DataProviderServiceImpl(rpcProviderService, this.mediatorServerServlet);
+        this.treeServlet.setDatabaseClient(this.rpcApiService.getRawClient());
         LOG.info("Session Initiated end. Initialization done");
     }
 
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/DataTreeProviderImpl.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/DataTreeProviderImpl.java
new file mode 100644
index 0000000..2af354b
--- /dev/null
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/DataTreeProviderImpl.java
@@ -0,0 +1,321 @@
+/*
+ * ============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.impl;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import org.json.JSONObject;
+import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient;
+import org.onap.ccsdk.features.sdnr.wt.common.database.SearchHit;
+import org.onap.ccsdk.features.sdnr.wt.common.database.queries.BoolQueryBuilder;
+import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilder;
+import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilders;
+import org.onap.ccsdk.features.sdnr.wt.common.database.queries.SortOrder;
+import org.onap.ccsdk.features.sdnr.wt.common.database.requests.Search7Request;
+import org.onap.ccsdk.features.sdnr.wt.common.database.requests.SearchRequest;
+import org.onap.ccsdk.features.sdnr.wt.common.database.responses.AggregationEntries;
+import org.onap.ccsdk.features.sdnr.wt.common.database.responses.SearchResponse;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.http.DataTreeChildObject;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.http.DataTreeHttpServlet.FilterMode;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.http.DataTreeObject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.Entity;
+
+/**
+ * @author Michael Dürre
+ *
+ */
+public class DataTreeProviderImpl {
+
+    private static final long MAXSIZE_PERSEARCH = 10;
+    private HtDatabaseClient dbClient;
+    final String INVENTORY_PROPERTY_TREELEVEL = "tree-level";
+    final String INVENTORY_PROPERTY_NODEID = "node-id";
+    final String INVENTORY_PROPERTY_UUID = "uuid";
+    final String INVENTORY_PROPERTY_PARENTUUID = "parent-uuid";
+    final String INVENTORY_PROPERTY_FOR_LABEL_CHILD = "uuid";
+    final String INVENTORY_PROPERTY_FOR_LABEL = "uuid";
+
+    private List<SearchHit> search(Entity e, String filter, String propTreeLevel) throws IOException {
+        return this.search(e, filter, null, null, null, null, null, null, propTreeLevel);
+    }
+
+    private List<SearchHit> search(Entity e, String filter, String nodeKey, String nodeId, String parentKey,
+            String parentValue, String childKey, String childValue, String propTreeLevel) throws IOException {
+        QueryBuilder query =
+                filter == null ? QueryBuilders.matchAllQuery() : QueryBuilders.searchAllFieldsQuery(filter);
+        if ((nodeId != null && nodeKey != null) || (parentKey != null && parentValue != null)) {
+            BoolQueryBuilder bquery = new BoolQueryBuilder();
+            if (filter != null) {
+                bquery.must(query);
+            }
+            if (nodeId != null) {
+                bquery.must(QueryBuilders.matchQuery(nodeKey, nodeId));
+            }
+            //			if (parentKey != null && parentValue != null) {
+            //				bquery.must(QueryBuilders.matchQuery(parentKey, parentValue));
+            //			}
+            //			if (childKey != null && childValue != null) {
+            //				bquery.must(QueryBuilders.matchQuery(childKey, childValue));
+            //			}
+            query = bquery;
+
+        }
+        return this.search(e, query, propTreeLevel);
+    }
+
+    private List<SearchHit> search(Entity e, QueryBuilder query, String propTreeLevel) throws IOException {
+        List<SearchHit> list = new ArrayList<SearchHit>();
+        query.sort(propTreeLevel, SortOrder.ASCENDING);
+        SearchRequest request = new Search7Request(Entity.Inventoryequipment.getName());
+        query.size(MAXSIZE_PERSEARCH);
+        request.setQuery(query);
+        SearchResponse response = this.dbClient.search(request);
+        SearchHit[] matches = response.getHits();
+        for (SearchHit hit : matches) {
+            list.add(hit);
+        }
+        if (response.getTotal() > MAXSIZE_PERSEARCH) {
+            long todo = response.getTotal();
+            long from = MAXSIZE_PERSEARCH;
+            while (todo > from) {
+                request.setQuery(query.from(from));
+                from += MAXSIZE_PERSEARCH;
+                //merge into list
+                response = this.dbClient.search(request);
+                matches = response.getHits();
+                for (SearchHit hit : matches) {
+                    list.add(hit);
+                }
+            }
+        }
+        return list;
+    }
+
+    /**
+     * @param iNVENTORY_PROPERTY_NODEID2
+     * @return
+     * @throws IOException
+     */
+    private AggregationEntries searchAggregated(Entity e, String key) throws IOException {
+        QueryBuilder query = QueryBuilders.matchAllQuery().aggregations(key).size(MAXSIZE_PERSEARCH);
+        SearchRequest request = new Search7Request(e.getName());
+        request.setQuery(query);
+        SearchResponse response = this.dbClient.search(request);
+        return response.getAggregations(key);
+    }
+
+    /**
+     *
+     * @param tree
+     * @param filter
+     * @param
+     * @return
+     * @throws IOException
+     */
+    public DataTreeObject readInventoryTree(List<String> tree, String filter, FilterMode mode) throws IOException {
+
+        //root nodes will be node-information -> below inventory
+        if (tree == null || tree.size() <= 0) {
+            return this.readInventoryTreeWithNode(filter, mode);
+        }
+        //root node will be inventory on tree-level if sliced treePath
+        else {
+            return this.readInventoryTreeForNode(tree.get(0), tree.subList(0, tree.size() - 1), filter, mode);
+        }
+
+    }
+
+    /**
+     * @param string
+     * @param slice
+     * @param filter
+     * @param mode
+     * @return
+     */
+    private DataTreeObject readInventoryTreeForNode(String nodeId, List<String> list, String filter, FilterMode mode)
+            throws IOException {
+        DataTreeObject tree = new DataTreeObject(INVENTORY_PROPERTY_PARENTUUID, INVENTORY_PROPERTY_UUID);
+        final String parentUuid = list.size() > 1 ? list.get(list.size() - 2) : null;
+        final String uuid = list.size() > 0 ? list.get(list.size() - 1) : null;
+        List<SearchHit> matches = this.search(Entity.Inventoryequipment, filter, INVENTORY_PROPERTY_NODEID, nodeId,
+                INVENTORY_PROPERTY_PARENTUUID, parentUuid, INVENTORY_PROPERTY_UUID, uuid, INVENTORY_PROPERTY_TREELEVEL);
+
+        //tree.a(subtreePath);
+        List<SearchHit> others = this.search(Entity.Inventoryequipment, (String) null, INVENTORY_PROPERTY_TREELEVEL);
+        if (matches.size() > 0) {
+            int treeLevelToStart = (list == null || list.size() <= 0) ? 0 : list.size() - 1;
+            //build tree
+            JSONObject hitData;
+            //fill root elems
+            for (SearchHit hit : matches) {
+                hitData = hit.getSource();
+                if (hitData.getLong("tree-level") == treeLevelToStart) {
+                    tree.put(hit.getId(),
+                            new DataTreeChildObject(hitData.getString(INVENTORY_PROPERTY_FOR_LABEL), true)
+                                    .setProperty(INVENTORY_PROPERTY_UUID, hitData.getString(INVENTORY_PROPERTY_UUID))
+                                    .setProperty(INVENTORY_PROPERTY_PARENTUUID,
+                                            hitData.getString(INVENTORY_PROPERTY_PARENTUUID)));
+                }
+            }
+            for (SearchHit hit : others) {
+                hitData = hit.getSource();
+                if (hitData.getLong("tree-level") == treeLevelToStart) {
+                    tree.putIfNotExists(hit.getId(),
+                            new DataTreeChildObject(hitData.getString(INVENTORY_PROPERTY_FOR_LABEL), false)
+                                    .setProperty(INVENTORY_PROPERTY_UUID, hitData.getString(INVENTORY_PROPERTY_UUID))
+                                    .setProperty(INVENTORY_PROPERTY_PARENTUUID,
+                                            hitData.getString(INVENTORY_PROPERTY_PARENTUUID)));
+                }
+            }
+            //fill child elems
+            for (SearchHit hit : matches) {
+                hitData = hit.getSource();
+                if (hitData.getLong("tree-level") > treeLevelToStart) {
+                    tree.put(hitData.getLong("tree-level") - treeLevelToStart - 1, hit.getId(),
+                            new DataTreeChildObject(hitData.getString(INVENTORY_PROPERTY_FOR_LABEL), true)
+                                    .setProperty(INVENTORY_PROPERTY_UUID, hitData.getString(INVENTORY_PROPERTY_UUID))
+                                    .setProperty(INVENTORY_PROPERTY_PARENTUUID,
+                                            hitData.getString(INVENTORY_PROPERTY_PARENTUUID)));
+                }
+            }
+            for (SearchHit hit : others) {
+                hitData = hit.getSource();
+                if (hitData.getLong("tree-level") > treeLevelToStart) {
+                    tree.putIfNotExists(hitData.getLong("tree-level") - treeLevelToStart - 1, hit.getId(),
+                            new DataTreeChildObject(hitData.getString(INVENTORY_PROPERTY_FOR_LABEL), false)
+                                    .setProperty(INVENTORY_PROPERTY_UUID, hitData.getString(INVENTORY_PROPERTY_UUID))
+                                    .setProperty(INVENTORY_PROPERTY_PARENTUUID,
+                                            hitData.getString(INVENTORY_PROPERTY_PARENTUUID)));
+                }
+            }
+        }
+        return tree;
+    }
+
+    /**
+     * node will be root elements inventory information below from level-1
+     *
+     * @param filter
+     * @param mode
+     * @return
+     * @throws IOException
+     */
+    private DataTreeObject readInventoryTreeWithNode(String filter, FilterMode mode) throws IOException {
+        DataTreeObject tree = new DataTreeObject(INVENTORY_PROPERTY_PARENTUUID, INVENTORY_PROPERTY_UUID);
+
+        List<SearchHit> matches = this.search(Entity.Inventoryequipment, filter, INVENTORY_PROPERTY_TREELEVEL);
+        List<SearchHit> others = null;
+        if (matches.size() > 0) {
+            if (filter != null) {
+                //find all parents up to tree-level 0
+                String nodeId = "";
+                List<String> alreadyInList = new ArrayList<>();
+                BoolQueryBuilder query2 = QueryBuilders.boolQuery();
+                for (SearchHit hit : matches) {
+                    nodeId = hit.getSource().getString(INVENTORY_PROPERTY_NODEID);
+                    if (alreadyInList.contains(nodeId)) {
+                        continue;
+                    }
+                    query2.should(QueryBuilders.matchQuery(INVENTORY_PROPERTY_NODEID, nodeId));
+                    alreadyInList.add(nodeId);
+                    tree.put(nodeId,
+                            new DataTreeChildObject(nodeId, false).setProperty(INVENTORY_PROPERTY_UUID, nodeId));
+
+                }
+                others = this.search(Entity.Inventoryequipment, query2, INVENTORY_PROPERTY_TREELEVEL);
+            } else {
+                AggregationEntries nodes = this.searchAggregated(Entity.Inventoryequipment, INVENTORY_PROPERTY_NODEID);
+                for (String node : nodes.keySet()) {
+                    tree.put(node, new DataTreeChildObject(node, false).setProperty(INVENTORY_PROPERTY_UUID, node));
+                }
+            }
+
+            //build tree
+            JSONObject hitData;
+            //fill root elems
+            for (SearchHit hit : matches) {
+                hitData = hit.getSource();
+                if (hitData.getLong("tree-level") == 0) {
+                    tree.put(0, hit.getId(),
+                            new DataTreeChildObject(hitData.getString(INVENTORY_PROPERTY_FOR_LABEL), true)
+                                    .setProperty(INVENTORY_PROPERTY_UUID, hitData.getString(INVENTORY_PROPERTY_UUID))
+                                    .setProperty(INVENTORY_PROPERTY_PARENTUUID,
+                                            hitData.getString(INVENTORY_PROPERTY_NODEID)));
+                }
+            }
+            if (others != null) {
+                for (SearchHit hit : others) {
+                    hitData = hit.getSource();
+                    if (hitData.getLong("tree-level") == 0) {
+                        tree.putIfNotExists(0, hit.getId(),
+                                new DataTreeChildObject(hitData.getString(INVENTORY_PROPERTY_FOR_LABEL), false)
+                                        .setProperty(INVENTORY_PROPERTY_UUID,
+                                                hitData.getString(INVENTORY_PROPERTY_UUID))
+                                        .setProperty(INVENTORY_PROPERTY_PARENTUUID,
+                                                hitData.getString(INVENTORY_PROPERTY_NODEID)));
+                    }
+                }
+            }
+            //fill child elements
+            for (SearchHit hit : matches) {
+                hitData = hit.getSource();
+                long treeLevel = hitData.getLong("tree-level");
+                if (treeLevel > 0) {
+                    tree.put(treeLevel, hit.getId(),
+                            new DataTreeChildObject(hitData.getString(INVENTORY_PROPERTY_FOR_LABEL_CHILD), true)
+                                    .setProperty(INVENTORY_PROPERTY_UUID, hitData.getString(INVENTORY_PROPERTY_UUID))
+                                    .setProperty(INVENTORY_PROPERTY_PARENTUUID,
+                                            hitData.getString(INVENTORY_PROPERTY_PARENTUUID)));
+                }
+            }
+            if (others != null) {
+                for (SearchHit hit : others) {
+                    hitData = hit.getSource();
+                    long treeLevel = hitData.getLong("tree-level");
+                    if (hitData.getLong("tree-level") > 0) {
+                        tree.putIfNotExists(treeLevel, hit.getId(),
+                                new DataTreeChildObject(hitData.getString(INVENTORY_PROPERTY_FOR_LABEL_CHILD), false)
+                                        .setProperty(INVENTORY_PROPERTY_UUID,
+                                                hitData.getString(INVENTORY_PROPERTY_UUID))
+                                        .setProperty(INVENTORY_PROPERTY_PARENTUUID,
+                                                hitData.getString(INVENTORY_PROPERTY_PARENTUUID)));
+                    }
+                }
+            }
+            if (mode == FilterMode.Strict) {
+                tree.removeUnmatchedPaths();
+            }
+        }
+        return tree;
+    }
+
+
+
+    /**
+     * @param client
+     */
+    public void setDatabaseClient(HtDatabaseClient client) {
+        this.dbClient = client;
+
+    }
+}
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 0014377..44751ff 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
@@ -26,7 +26,6 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
-
 import org.onap.ccsdk.features.sdnr.wt.common.configuration.Configuration;
 import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
 import org.onap.ccsdk.features.sdnr.wt.common.configuration.filechange.IConfigChangedListener;
@@ -52,13 +51,12 @@
     private static final String PROPERTY_KEY_AUTH_PASSWORD = "esAuthPassword";
 
 
-    private static String defaultHostinfo = "${SDNRDBURL}";//printHosts(new HostInfo[] { new HostInfo("sdnrdb", 9200, Protocol.HTTP) });
+    private static String defaultHostinfo = "${SDNRDBURL}";
     private static final String DEFAULT_VALUE_CLUSTER = "";
     /** check db data in this interval [in seconds] 0 deactivated */
     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_VALUE_NODE = "elasticsearchnode";
     private static final String DEFAULT_VALUE_DBUSERNAME = "${SDNRDBUSERNAME}";
     private static final String DEFAULT_VALUE_DBPASSWORD = "${SDNRDBPASSWORD}";
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/yangtools/YangToolsMapper2.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/yangtools/YangToolsMapper2.java
index ce67c39..814bfd7 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/yangtools/YangToolsMapper2.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/yangtools/YangToolsMapper2.java
@@ -59,16 +59,25 @@
 
     private final Logger LOG = LoggerFactory.getLogger(YangToolsMapper2.class);
     private static final long serialVersionUID = 1L;
-    private static String ENTITY = "Entity";
     private static String BUILDER = "Builder";
 
-    private @Nullable Class<T> clazz;
-    private @Nullable Class<? extends Builder<? extends T>> builderClazz;
+    private @Nullable final Class<T> clazz;
+    private @Nullable final Class<? extends Builder<? extends T>> builderClazz;
 
     private BundleContext context;
 
-    public <X extends T, B extends Builder<X>> YangToolsMapper2(Class<T> clazz, Class<B> builderClazz)
-            throws ClassNotFoundException {
+    /**
+     * Generic Object creation of yangtools java class builder pattern.
+     * 
+     * @param <X> Class of DataObject
+     * @param <B> Builder for the class.
+     * @param clazz specifies class to be mapped
+     * @param builderClazz is the builder for class with name pattern "clazzBuilder".<br>
+     *        If null the clazz is expected to support normal jackson build pattern.
+     * @throws ClassNotFoundException if builderClazz not available in bundle
+     */
+    public <X extends T, B extends Builder<X>> YangToolsMapper2(@NonNull Class<T> clazz,
+            @Nullable Class<B> builderClazz) throws ClassNotFoundException {
         super();
         configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
         setPropertyNamingStrategy(PropertyNamingStrategy.KEBAB_CASE);
@@ -84,11 +93,6 @@
         context = bundle != null ? bundle.getBundleContext() : null;
     }
 
-    public YangToolsMapper2() throws ClassNotFoundException {
-        this(null, null);
-    }
-
-
     @Override
     public String writeValueAsString(Object value) throws JsonProcessingException {
         return super.writeValueAsString(value);
@@ -101,11 +105,12 @@
      * @param clazz class with interface.
      * @return builder for interface or null if not existing
      */
-    @SuppressWarnings("unchecked")
-    public @Nullable <T extends DataObject> Builder<T> getBuilder(Class<T> clazz) {
+    public @Nullable Builder<? extends T> getBuilder(Class<T> clazz) {
         try {
-            //Class<?> clazzBuilder = getBuilderClass(getBuilderClassName(clazz));
-            return (Builder<T>) builderClazz.newInstance();
+            if (builderClazz != null)
+                return (Builder<? extends T>) builderClazz.newInstance();
+            else
+                return null;
         } catch (InstantiationException | IllegalAccessException e) {
             LOG.debug("Problem ", e);
             return null;
@@ -169,12 +174,6 @@
      */
     private static String getBuilderClassName(Class<?> clazz) {
         return clazz.getName() + BUILDER;
-        //		String clazzName = clazz.getName();
-        //		if (clazzName.endsWith(ENTITY)) {
-        //			return clazzName.replace(ENTITY, BUILDER);
-        //		} else {
-        //			return clazzName + BUILDER;
-        //		}
     }
 
     /**
diff --git a/sdnr/wt/data-provider/provider/src/main/resources/about/README.md b/sdnr/wt/data-provider/provider/src/main/resources/about/README.md
index 81c8c6c..58091d5 100644
--- a/sdnr/wt/data-provider/provider/src/main/resources/about/README.md
+++ b/sdnr/wt/data-provider/provider/src/main/resources/about/README.md
@@ -1,4 +1,4 @@
-
+## Version Info
 |  |  |
 | --- | ----- |
 | ONAP release | {release-name} |
@@ -12,6 +12,11 @@
 | ODLUX version | {odlux-revision} |
 | Cluster size | {cluster-size} |
 
+## Device manager
+
+{devicemanagers}
+
+## System Info
 ```
 {karaf-info}
 ```
\ No newline at end of file
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
deleted file mode 100755
index 67d495a..0000000
--- a/sdnr/wt/data-provider/provider/src/main/resources/es-init.sh
+++ /dev/null
@@ -1,446 +0,0 @@
-#!/bin/bash
-# ============LICENSE_START========================================================================
-# ONAP : ccsdk feature sdnr wt
-# =================================================================================================
-# Copyright (C) 2019 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==========================================================================
-#
-# Version 2
-# Usage .. see help below
-
-SDNRNAME=sdnrdb
-REPLICAS=1
-SHARDS=5
-PREFIX=""
-VERSION="-v1"
-VERBOSE=0
-INITFILENAME="Init.script"
-
-#declare -a ALIAS
-#declare -a MAPPING
-
-# ------------------------------------------------------------
-# Function with definition of mappings
-# $1: alias name for index
-# $2: mapping properties and additonal parameter for this section
-
-set_definition() {
-  def "connectionlog" '{"node-id": {"type": "keyword"},"timestamp": {"type": "date"},"status": {"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"}}'
-  def "mediator-server" '{"url":{"type": "keyword"},"name":{"type": "keyword"}}'
-  def "networkelement-connection" '{"node-id": {"type": "keyword"},"host": {"type": "keyword"},"port": {"type": "long"},"username": {"type": "keyword"},"password": {"type": "keyword"},"core-model-capability": {"type": "keyword"},"device-type": {"type": "keyword"},"is-required": {"type": "boolean"},"status": {"type": "keyword"}},"date_detection":false'
-}
-
-# ------------------------------------------------------------
-# Functions
-
-# Get ip of container with database
-getsdnrurl() {
-  if [ ! -z "$DBURL" ]; then
-    return
-  fi
-  cmd=$(which docker)
-  if [ ! -z "$cmd" ]; then
-    SDNRIP=$($cmd inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "$SDNRNAME")
-    if [ "$?" = "1" ] ; then
-      echo "WARN: Container $SDNRNAME not running. Start the sdnrdb container or enter a database url."
-      echo "continuing with localhost"
-      SDNRIP="localhost"
-    fi
-  else
-    # if no docker and no db url given
-    if [ -z "$DBURL" ]; then
-      echo "WARN: Please enter a database url."
-      echo "continuing with localhost"
-      SDNRIP="localhost"
-    fi
-  fi
-  DBURL="http://$SDNRIP:9200"
-}
-
-# Add elements to the array ALIAS and MAPPING
-# $1 alias
-# $2 mapping properties
-def() {
-   ALIAS=("${ALIAS[@]}" "$1")
-   MAPPING=("${MAPPING[@]}" "$2")
-}
-
-# $1 Response
-print_response() {
-    response="$1"
-    body=$(echo $response | sed -E 's/HTTPSTATUS\:[0-9]{3}$//')
-    code=$(echo $response | tr -d '\n' | sed -E 's/.*HTTPSTATUS:([0-9]{3})$/\1/')
-    if [ "$VERBOSE" = "0" -a "$code" -ne "200" ] ; then
-        echo "Error response $code $body"
-    fi
-    if [ "$VERBOSE" -ge 1 ] ; then
-        echo "response $code"
-    fi
-    if [ "$VERBOSE" -ge 2 ] ; then
-       echo "content: $body"
-    fi
-}
-
-#Write ini file for elasticsearch
-# $1 index
-# $1 data
-file_append() {
-    echo "PUT:"$1"/:"$2 >> $INITFILENAME
-}
-
-# Send get request to database
-# USes DBURL
-# $1 url path
-# $2 data
-http_get_request() {
-    url="$DBURL/$1"
-    if [ "$VERBOSE" -ge 2 ] ; then
-       echo "PUT to $url data $data"
-    fi
-    response=$(curl --silent --write-out "HTTPSTATUS:%{http_code}" -X GET -H "Content-Type: application/json" "$url")
-    print_response "$response"
-}
-
-# Send put request to database
-# USes DBURL
-# $1 url path
-# $2 data
-http_put_request() {
-    url="$DBURL/$1"
-    if [ "$VERBOSE" -ge 2 ] ; then
-       echo "PUT to $url data $data"
-    fi
-    response=$(curl --silent --write-out "HTTPSTATUS:%{http_code}" -X PUT -H "Content-Type: application/json" -d "$2" "$url")
-    print_response "$response"
-}
-
-# Send delete request to database
-# $1 url
-http_delete_request() {
-    url="$DBURL/$1"
-    if [ "$VERBOSE" -ge 2 ] ; then
-       echo "DELETE to $url"
-    fi
-    echo "DELETE to $url"
-    response=$(curl --silent --write-out "HTTPSTATUS:%{http_code}" -X DELETE -H "Content-Type: application/json" $url)
-    print_response "$response"
-}
-
-# Delete index and alias
-# $1 alias
-delete_index_alias() {
-
-    echo "deleting alias $alias"
-     # Delete alias
-    alias="$PREFIX$1"
-    index="$PREFIX$1$VERSION"
-
-    url="$index/_alias/$alias"
-    http_delete_request "$url"
-
-     # Delete index
-    echo "deleting index $index"
-    url="$index"
-    http_delete_request "$url"
-
-     # Delete alias that was falsely autocreated as index
-    echo "deleting index $index"
-    url="$alias"
-    http_delete_request "$url"
-}
-
-# Write mappings
-# Uses version, SHARDS and REPLICAS parameters
-# $1 alias and datatype "mydatatype"
-# $2 mapping properties
-# $3 filename or empty for WEB
-create_index_alias() {
-   # Create index
-    alias="$PREFIX$1"
-    index="$PREFIX$1$VERSION"
-    mappings='"mappings":{"'$1'":{"properties":'$2'}}'
-    settings='"settings":{"index":{"number_of_shards":'$SHARDS',"number_of_replicas":'$REPLICAS'},"analysis":{"analyzer":{"content":{"type":"custom","tokenizer":"whitespace"}}}}'
-
-    if [ -z "$mappings" ]; then
-        data="{$settings}"
-    else
-        data="{$settings,$mappings}"
-    fi
-
-    url=$index
-    echo "creating index $index"
-    if [ -z "$3" ] ; then
-        http_put_request "$url" "$data"
-    else
-        file_append "$url" "$data"
-    fi
-
-    #Create alias
-    url="$index/_alias/$alias"
-    echo "creating alias $alias for $index"
-    if [ -z "$3" ] ; then
-        http_put_request "$url"
-    else
-        file_append "$url" "{}"
-    fi
-}
-
-# Wait for status
-# $1 time to wait
-es_wait_yellow() {
-  ESSTATUS="yellow"
-  attempt_counter=0
-  max_attempts=5
-  echo "Wait up to $max_attempts attempts for $DBURL availability"
-  until $(curl --output /dev/null --silent --head --fail $DBURL); do
-    if [ ${attempt_counter} -eq ${max_attempts} ];then
-      echo "Error: Max attempts reached."
-      exit 3
-    fi
-    attempt_counter=$(($attempt_counter+1))
-    printf '.'
-    sleep 5
-  done
-  sleep 2
-  echo "Wait up to $1 for status $ESSTATUS"
-  RES=$(curl GET "$DBURL/_cluster/health?wait_for_status=$ESSTATUS&timeout=$1&pretty" 2>/dev/null)
-  if [ "$?" = "0" ] ; then
-    if [[ "$RES" =~ .*status.*:.*yellow.* || "$RES" =~ .*status.*:.*green.* ]] ; then
-      echo "Status $ESSTATUS reached: $RES"
-    else
-      echo "Error: DB Reachable, but status $ESSTATUS not reached"
-      exit 2
-    fi
-  else
-    echo "Error: $DBURL not reachable"
-    exit 2
-  fi
-}
-
-# Commands
-
-cmd_create() {
-    if [ -n "$WAITYELLOW" ] ; then
-        es_wait_yellow "$WAITYELLOW"
-    fi
-    for i in "${!ALIAS[@]}"; do
-          create_index_alias "${ALIAS[$i]}" "${MAPPING[$i]}"
-    done
-}
-
-cmd_delete() {
-    if [ -n "$WAITYELLOW" ] ; then
-        es_wait_yellow "$WAITYELLOW"
-    fi
-    for i in "${!ALIAS[@]}"; do
-          delete_index_alias "${ALIAS[$i]}"
-    done
-    for i in "${!ALIAS[@]}"; do
-        delete_index_alias "${ALIAS[$i]}"
-    done
-}
-cmd_purge() {
-#    http_get_request '_cat/aliases'
-#    body=$(echo $response | sed -E 's/HTTPSTATUS\:[0-9]{3}$//')
-#    echo "$response" | awk '/^([^ ]*)[ ]*([^ ]*).*$/{ print $2"/_alias/"$1 }'
-#    http_get_request '_cat/indices'
-#    echo "indices"
-#    echo "$response"
-#    echo "$response" | awk '/^[^ ]*[ ]*[^ ]*[ ]*([^ ]*).*$/{ print $3 }'
-    echo "not yet implemented"
-}
-cmd_initfile() {
-    echo "Create script initfile: $INITFILENAME"
-    if [ -f "$INITFILENAME" ] ; then
-       rm $INITFILENAME
-    else
-       mkdir -p $(dirname $INITFILENAME )
-    fi
-    for i in "${!ALIAS[@]}"; do
-          create_index_alias "${ALIAS[$i]}" "${MAPPING[$i]}" file
-    done
-}
-
-# Prepare database startup
-cmd_startup() {
-   ESWAIT=30s
-   echo "Startup ElasticSearch DBURL=$DBURL CMD=$STARTUP_CMD CLUSTER=$CLUSTER_ENABLED INDEX=$NODE_INDEX"
-   if $CLUSTER_ENABLED ; then
-     if [ "$NODE_INDEX" = "0" ] ; then
-       echo "Cluster node 0 detected .. create"
-       es_wait_yellow $ESWAIT
-       cmd_create
-     else
-       echo "Cluster node > 0 detected .. do nothing"
-     fi
-   else
-     echo "No cluster"
-     es_wait_yellow $ESWAIT
-     cmd_create
-   fi
-}
-
-# Parse arguments
-parse_args() {
-    while [[ $# -gt 0 ]]
-    do
-      par=($(echo $1 | tr '=' '\n'))
-      echo ""
-      if [ ${#par[@]} == "2" ] ; then
-        # Equal sign found
-        key=${par[0]}
-        value=${par[1]}
-      else
-        # No equal sign
-        key="$1"
-        value="$2"
-      fi
-      shift
-      #Further shift if parameter is used
-      case $key in
-        -db|--dburl|--database)
-          DBURL="$value"
-          shift
-          ;;
-        -r|--replicas)
-          REPLICAS="$value"
-          shift
-          ;;
-        -s|--shards)
-          SHARDS="$value"
-          shift
-          ;;
-        -p|--prefix)
-          PREFIX="$value"
-          shift
-          ;;
-        -f|--file)
-          INITFILENAME="$value"
-          shift
-          ;;
-        -x|--verbose)
-          VERBOSE="${value:-0}"
-          shift
-          ;;
-        -v|--version)
-          VERSION="${value:--v1}"
-          shift
-          ;;
-        -vx|--versionx)
-          VERSION=""
-          ;;
-        -w|--wait)
-          WAITYELLOW="${value:-30s}"
-          shift
-          ;;
-        --cmd)
-          STARTUP_CMD="$value"
-          shift
-          ;;
-        --odlcluster)
-          CLUSTER_ENABLED="$value"
-          shift
-          ;;
-         --index)
-           NODE_INDEX="$value"
-           shift
-           ;;
-        *)
-          ;;
-      esac;
-    done
-}
-
-# -----------------------------------------
-# Main starts here
-
-TASK=$1
-shift
-parse_args "$@"
-
-set_definition
-
-
-echo "------------------------------"
-echo "Elasticsearch for SDN-R helper"
-echo "------------------------------"
-echo "Uses database container $SDNRNAME"
-echo "Database url $DBURL"
-echo "  shards=$SHARDS replicas=$REPLICAS prefix=$PREFIX verbose=$VERBOSE version='$VERSION'"
-
-
-case "$TASK" in
-    "create")
-        getsdnrurl
-        if [ -z "$DBURL" ] ; then
-          echo "Error: unable to detect database url."
-          exit 1
-        fi
-        cmd_create
-        ;;
-    "delete")
-        getsdnrurl
-        if [ -z "$DBURL" ] ; then
-          echo "Error: unable to detect database url."
-          exit 1
-        fi
-        cmd_delete
-        ;;
-    "purge")
-        getsdnrurl
-        if [ -z "$DBURL" ] ; then
-          echo "Error: unable to detect database url."
-          exit 1
-        fi
-        cmd_purge
-        ;;
-    "initfile")
-        cmd_initfile
-        ;;
-    "startup")
-        cmd_startup
-        ;;
-     *)
-        echo "usage:"
-        echo "  es-init.sh COMMAND [OPTIONS]"
-        echo "    Commands:"
-        echo "       create           create SDN-R used indices and aliases"
-        echo "       delete           delete SDN-R used indices and aliases"
-        echo "       initfile         Create initfile for java unit tests"
-        echo "       purge            Clear complete database (indices and aliases)"
-        echo "       startup          Initial database write if node number 01"
-        echo "    Options:"
-        echo -e "      -db\--database   DATABASEURL"
-        echo -e "      -r\--replicas    REPLICAS"
-        echo -e "      -s\--shards      SHARDS"
-        echo -e "      -p\--prefix      DATABASE-PREFIX"
-        echo -e "      -f\--file        init filename"
-        echo -e "      -x\--verbose     Verbose level less 0 .. 2 full"
-        echo -e "      -v\--version     Version prefix"
-        echo -e "      -vx\--versionx   Version prefix empty"
-        echo -e "      -i\--ignore      Ignore error responses"
-        echo -e "      --odlcluster     true/false if odl configured as cluster"
-        echo -e "      --index          Cluster node 0.."
-        echo -e "      --cmd            startup sub command"
-        echo " examples:"
-        echo "   single node db:"
-        echo "      es-init.sh create -db http://sdnrdb:9200 -r 0"
-       ;;
-esac
diff --git a/sdnr/wt/data-provider/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/sdnr/wt/data-provider/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
index fcd62ff..ad9661f 100644
--- a/sdnr/wt/data-provider/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
+++ b/sdnr/wt/data-provider/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
@@ -30,6 +30,8 @@
                interface="org.opendaylight.mdsal.binding.api.RpcProviderService"
                odl:type="default"/>
 
+<!--     <reference id="bundleService" interface="org.apache.karaf.bundle.core.BundleService" odl:type="default"/> -->
+
     <bean id="readyServlet"
           class="org.onap.ccsdk.features.sdnr.wt.dataprovider.http.ReadyHttpServlet">
     </bean>
@@ -41,7 +43,8 @@
     </service>
 
     <bean id="aboutServlet"
-          class="org.onap.ccsdk.features.sdnr.wt.dataprovider.http.AboutHttpServlet">
+          class="org.onap.ccsdk.features.sdnr.wt.dataprovider.http.about.AboutHttpServlet">
+<!--           <property name="bundleService" ref="bundleService"/> -->
     </bean>
     <service interface="javax.servlet.http.HttpServlet"
              ref="aboutServlet">
@@ -58,17 +61,26 @@
             <entry key="alias" value="/ms"/>
         </service-properties>
     </service>
+    <bean id="treeServlet"
+          class="org.onap.ccsdk.features.sdnr.wt.dataprovider.http.DataTreeHttpServlet">
+    </bean>
+    <service interface="javax.servlet.http.HttpServlet" ref="treeServlet">
+        <service-properties>
+            <entry key="alias" value="/tree"/>
+        </service-properties>
+    </service>
 
     <bean id="provider"
           class="org.onap.ccsdk.features.sdnr.wt.dataprovider.impl.DataProviderImpl"
           init-method="init" destroy-method="close">
         <property name="rpcProviderService" ref="rpcProviderService"/>
         <property name="aboutServlet" ref="aboutServlet"/>
+        <property name="treeServlet" ref="treeServlet"/>
         <property name="mediatorServerServlet" ref="msServlet"/>
     </bean>
 
     <bean id="yangServlet"
-          class="org.onap.ccsdk.features.sdnr.wt.dataprovider.http.YangSchemaHttpServlet">
+          class="org.onap.ccsdk.features.sdnr.wt.dataprovider.http.yangschema.YangSchemaHttpServlet">
     </bean>
     <service interface="javax.servlet.http.HttpServlet"
              ref="yangServlet">
diff --git a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestAbout.java b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestAbout.java
index f147e87..5d9011a 100644
--- a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestAbout.java
+++ b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestAbout.java
@@ -25,7 +25,6 @@
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.http.AboutHttpServlet;
-
 import static org.junit.Assert.assertTrue;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
diff --git a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestCRUDforDatabase.java b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestCRUDforDatabase.java
index 5cf2f06..a22f303 100644
--- a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestCRUDforDatabase.java
+++ b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestCRUDforDatabase.java
@@ -41,6 +41,7 @@
 import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilders;
 import org.onap.ccsdk.features.sdnr.wt.common.database.requests.BaseRequest;
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.data.ElasticSearchDataProvider;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.test.util.HostInfoForTest;
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.yangtools.YangToolsMapper;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.CreateMaintenanceInput;
@@ -123,12 +124,11 @@
 
     private static ElasticSearchDataProvider dbProvider;
     private static HtDatabaseClient dbRawProvider;
-    public static HostInfo[] hosts = new HostInfo[] {new HostInfo("localhost", Integer
-            .valueOf(System.getProperty("databaseport") != null ? System.getProperty("databaseport") : "49200"))};
 
     @BeforeClass
     public static void init() throws Exception {
 
+        HostInfo[] hosts = HostInfoForTest.get();
         dbProvider = new ElasticSearchDataProvider(hosts);
         dbProvider.waitForYellowDatabaseStatus(30, TimeUnit.SECONDS);
         dbRawProvider = HtDatabaseClient.getClient(hosts);
@@ -337,7 +337,6 @@
 
         // ==UPDATE============================
         System.out.println("Trying to update...");
-        final String name2 = "sim88";
         final String url2 = "10.5.10.2";
         final long port2 = 5960;
 
diff --git a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestConfig.java b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestConfig.java
index 1275b03..9a96986 100644
--- a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestConfig.java
+++ b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestConfig.java
@@ -22,13 +22,15 @@
 package org.onap.ccsdk.features.sdnr.wt.dataprovider.test;
 
 import static org.junit.Assert.assertEquals;
+
 import java.io.File;
-import java.lang.reflect.Field;
-import java.util.Map;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation;
+import org.onap.ccsdk.features.sdnr.wt.common.configuration.subtypes.Section;
+import org.onap.ccsdk.features.sdnr.wt.common.configuration.subtypes.Section.EnvGetter;
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.impl.EsConfig;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -38,7 +40,8 @@
     private static final Logger LOG = LoggerFactory.getLogger(TestConfig.class);
 
     private static final String TESTFILENAME = "testconfig.properties";
-    private static final String HOSTNAME = "localhost";
+    private static String ENVSDNRDBURL = "SDNRDBURL";
+    private static String SDNRDBURL = "http://sdnrdb:9200";
 
     @After
     @Before
@@ -52,35 +55,16 @@
 
     @Test
     public void test() {
-        int databasePort = setSDNRDBURLEnv();
-
+        EnvGetter env = Section.getEnvGetter();
+        Section.setEnvGetter((envname) -> {
+            return envname.equals(ENVSDNRDBURL) ? SDNRDBURL : env.getenv(envname);
+        });
         ConfigurationFileRepresentation configuration = new ConfigurationFileRepresentation(TESTFILENAME);
         EsConfig esConfig = new EsConfig(configuration);
         LOG.info("Defaultconfiguration: {}", esConfig.toString());
         assertEquals("http", esConfig.getHosts()[0].protocol.getValue());
-        assertEquals(databasePort, esConfig.getHosts()[0].port);
-        assertEquals(HOSTNAME, esConfig.getHosts()[0].hostname);
+        assertEquals(9200, esConfig.getHosts()[0].port);
+        assertEquals("sdnrdb", esConfig.getHosts()[0].hostname);
 
     }
-
-    public static int setSDNRDBURLEnv() {
-        int databasePort = Integer
-                .valueOf(System.getProperty("databaseport") != null ? System.getProperty("databaseport") : "49200");
-        System.out.println("DB Port: " + databasePort);
-        setEnv("SDNRDBURL", "http://"+HOSTNAME+":"+databasePort);
-        return databasePort;
-    }
-
-    public static void setEnv(String key, String value) {
-        try {
-            Map<String, String> env = System.getenv();
-            Class<?> cl = env.getClass();
-            Field field = cl.getDeclaredField("m");
-            field.setAccessible(true);
-            Map<String, String> writableEnv = (Map<String, String>) field.get(env);
-            writableEnv.put(key, value);
-        } catch (Exception e) {
-            throw new IllegalStateException("Failed to set environment variable", e);
-        }
-    }
 }
diff --git a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestDataTreeSerialization.java b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestDataTreeSerialization.java
deleted file mode 100644
index 60a2c50..0000000
--- a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestDataTreeSerialization.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * ============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.test;
-
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.yangtools.YangToolsMapper;
-
-/**
- * @author Michael Dürre
- *
- */
-public class TestDataTreeSerialization {
-
-    //YangToolsMapper
-}
diff --git a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestEventService.java b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestEventService.java
index 6d54016..9c95a7d 100644
--- a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestEventService.java
+++ b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestEventService.java
@@ -34,11 +34,13 @@
 import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient;
 import org.onap.ccsdk.features.sdnr.wt.common.database.SearchHit;
 import org.onap.ccsdk.features.sdnr.wt.common.database.SearchResult;
+import org.onap.ccsdk.features.sdnr.wt.common.database.config.HostInfo;
 import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilders;
 import org.onap.ccsdk.features.sdnr.wt.common.database.requests.DeleteByQueryRequest;
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.data.ElasticSearchDataProvider;
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.data.HtDatabaseEventsService;
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.NetconfTimeStampImpl;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.test.util.HostInfoForTest;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ConnectionLogStatus;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.ConnectionlogBuilder;
@@ -78,9 +80,10 @@
     @BeforeClass
     public static void init() throws Exception {
 
-        dbProvider = new ElasticSearchDataProvider(TestCRUDforDatabase.hosts);
+        HostInfo[] hosts = HostInfoForTest.get();
+        dbProvider = new ElasticSearchDataProvider(hosts);
         dbProvider.waitForYellowDatabaseStatus(30, TimeUnit.SECONDS);
-        dbRawProvider = HtDatabaseClient.getClient(TestCRUDforDatabase.hosts);
+        dbRawProvider = HtDatabaseClient.getClient(hosts);
 
         try {
             service = new HtDatabaseEventsService(dbRawProvider, dbProvider);
diff --git a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestFilterConversion.java b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestFilterConversion.java
index 52ca299..5c2a66e 100644
--- a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestFilterConversion.java
+++ b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestFilterConversion.java
@@ -24,54 +24,89 @@
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import java.util.Arrays;
 import java.util.List;
 
 import org.junit.Test;
+import org.mockito.Mockito;
+import org.mockito.stubbing.Answer;
 import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilder;
+import org.onap.ccsdk.features.sdnr.wt.common.database.requests.SearchRequest;
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.data.QueryByFilter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.EntityInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SortOrder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.entity.input.Filter;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.entity.input.FilterBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.entity.input.Sortorder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.entity.input.SortorderBuilder;
 
-public class TestFilterConversion {
+public class TestFilterConversion extends Mockito {
 
     private static final String PROPERTY = "node-id";
     private static final String PROPERTY2 = "_id";
     private static final String PROPERTY3 = "timestamp";
 
     @Test
-    public void testQuestionMark() {
+    public void testQuestionMark1() {
+        EntityInput input = mock(EntityInput.class);
         List<Filter> filters = Arrays.asList(new FilterBuilder().setProperty(PROPERTY).setFiltervalue("si?ba").build());
-        QueryBuilder query = QueryByFilter.fromFilter(filters);
+        when(input.getFilter()).thenReturn(filters);
+
+        QueryBuilder query = new QueryByFilter(input).getQueryBuilderByFilter();
         System.out.println(query.toJSON());
+
         assertTrue(query.toJSON().contains("{1,1}"));
-        assertNotNull(QueryByFilter.getFilter(filters, PROPERTY));
-        assertNull(QueryByFilter.getFilter(filters, PROPERTY2));
-        filters = Arrays.asList(new FilterBuilder().setProperty(PROPERTY).setFiltervalue("si?ba").build(),
+        assertNotNull(new QueryByFilter(input).getQueryBuilderByFilter(PROPERTY));
+
+    }
+
+    @Test
+    public void testQuestionMarkExcpetion() {
+        EntityInput input = mock(EntityInput.class);
+        List<Filter> filters = Arrays.asList(new FilterBuilder().setProperty(PROPERTY).setFiltervalue("si?ba").build());
+        when(input.getFilter()).thenReturn(filters);
+        try {
+            new QueryByFilter(input).getSearchRequestByFilter("test1", "test2", "test3", "test4");
+            fail();
+        } catch (IllegalArgumentException e) { // fails if type not correct
+
+        }
+
+    }
+
+    @Test
+    public void testQuestionMark2() {
+        EntityInput input = mock(EntityInput.class);
+        List<Filter> filters = Arrays.asList(new FilterBuilder().setProperty(PROPERTY).setFiltervalue("si?ba").build(),
                 new FilterBuilder().setProperty(PROPERTY2).setFiltervalue("abc").build());
-        query = QueryByFilter.fromFilter(filters);
+        when(input.getFilter()).thenReturn(filters);
+        QueryBuilder query = new QueryByFilter(input).getQueryBuilderByFilter();
         System.out.println(query.toJSON());
-        assertNotNull(QueryByFilter.getFilter(filters, PROPERTY2));
-        filters = Arrays.asList(new FilterBuilder().setProperty(PROPERTY).setFiltervalue("si?ba").build(),
+        assertNotNull(new QueryByFilter(input).getQueryBuilderByFilter(PROPERTY2));
+    }
+
+    @Test
+    public void testQuestionMark3() {
+        EntityInput input = mock(EntityInput.class);
+        List<Filter> filters = Arrays.asList(new FilterBuilder().setProperty(PROPERTY).setFiltervalue("si?ba").build(),
                 new FilterBuilder().setProperty(PROPERTY3).setFiltervalue("<2019-06-13T15:00:12.0Z").build());
-        query = QueryByFilter.fromFilter(filters);
         List<Sortorder> sortorder =
                 Arrays.asList(new SortorderBuilder().setProperty(PROPERTY).setSortorder(SortOrder.Ascending).build());
-        QueryByFilter.setSortOrder(query, sortorder);
-        assertNotNull(QueryByFilter.getSortOrder(sortorder, PROPERTY));
+        when(input.getFilter()).thenReturn(filters);
+        when(input.getSortorder()).thenReturn(sortorder);
+
+        assertNotNull(new QueryByFilter(input).getQueryBuilderByFilter(PROPERTY));
     }
 
     @Test
     public void testSortorder() {
-        String f =
-                "{\"input\":{\"filter\":[],\"sortorder\":[{\"property\":\"source-type\",\"sortorder\":\"ascending\"}],\"pagination\":{\"size\":10,\"page\":1}}}";
-
-        QueryBuilder query = QueryByFilter.setSortOrder(QueryByFilter.fromFilter(null), Arrays
-                .asList(new SortorderBuilder().setProperty("source-type").setSortorder(SortOrder.Ascending).build()));
+        EntityInput input = mock(EntityInput.class);
+        List<Sortorder> sortorder = Arrays
+                .asList(new SortorderBuilder().setProperty("source-type").setSortorder(SortOrder.Ascending).build());
+        when(input.getSortorder()).thenReturn(sortorder);
+        QueryBuilder query = new QueryByFilter(input).getQueryBuilderByFilter();
         System.out.println(query.toJSON());
     }
 }
diff --git a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestImplementation.java b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestImplementation.java
index cc880d1..2aedabe 100644
--- a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestImplementation.java
+++ b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestImplementation.java
@@ -26,46 +26,53 @@
 import java.util.Set;
 
 import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.common.configuration.subtypes.Section;
+import org.onap.ccsdk.features.sdnr.wt.common.configuration.subtypes.Section.EnvGetter;
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.http.AboutHttpServlet;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.http.DataTreeHttpServlet;
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.http.MsServlet;
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.impl.DataProviderImpl;
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.StatusChangedHandler.StatusKey;
 import org.opendaylight.mdsal.binding.api.RpcProviderService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.DataProviderService;
 import org.opendaylight.yangtools.concepts.ObjectRegistration;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.RpcService;
 
-import net.bytebuddy.implementation.bytecode.StackSize;
-
 /**
  * @author Michael Dürre
  *
  */
 public class TestImplementation {
 
+    static String XY = "http://localhost:"
+            + (System.getProperty("databaseport") != null ? System.getProperty("databaseport") : "49200");
+
     @Test
     public void test() {
-        TestConfig.setSDNRDBURLEnv();
+        //TestConfig.setSDNRDBURLEnv("http://localhost:"+(System.getProperty("databaseport") != null ? System.getProperty("databaseport") : "49200"));
+        EnvGetter env = Section.getEnvGetter();
+        Section.setEnvGetter((xy) -> {
+            System.out.println("Search " + xy);
+            return xy.equals("SDNRDBURL") ? XY : env.getenv(xy);
+        });
         DataProviderImpl impl = new DataProviderImpl();
         impl.setRpcProviderService(new RpcProviderService() {
 
             @Override
             public <S extends RpcService, T extends S> ObjectRegistration<T> registerRpcImplementation(Class<S> type,
                     T implementation, Set<InstanceIdentifier<?>> paths) {
-                // TODO Auto-generated method stub
                 return null;
             }
 
             @Override
             public <S extends RpcService, T extends S> ObjectRegistration<T> registerRpcImplementation(Class<S> type,
                     T implementation) {
-                // TODO Auto-generated method stub
                 return null;
             }
         });
         impl.setMediatorServerServlet(new MsServlet());
         impl.setAboutServlet(new AboutHttpServlet());
+        impl.setTreeServlet(new DataTreeHttpServlet());
         try {
             impl.init();
         } catch (Exception e) {
diff --git a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestMaintenanceServiceData.java b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestMaintenanceServiceData.java
index 5839738..897fcc8 100644
--- a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestMaintenanceServiceData.java
+++ b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestMaintenanceServiceData.java
@@ -30,10 +30,12 @@
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient;
+import org.onap.ccsdk.features.sdnr.wt.common.database.config.HostInfo;
 import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilders;
 import org.onap.ccsdk.features.sdnr.wt.common.database.requests.DeleteByQueryRequest;
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.data.ElasticSearchDataProvider;
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.HtDatabaseMaintenance;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.test.util.HostInfoForTest;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.Entity;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.MaintenanceBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.MaintenanceEntity;
@@ -53,9 +55,10 @@
     @BeforeClass
     public static void init() throws Exception {
 
-        dbProvider = new ElasticSearchDataProvider(TestCRUDforDatabase.hosts);
+        HostInfo[] hosts = HostInfoForTest.get();
+        dbProvider = new ElasticSearchDataProvider(hosts);
         dbProvider.waitForYellowDatabaseStatus(30, TimeUnit.SECONDS);
-        dbRawProvider = HtDatabaseClient.getClient(TestCRUDforDatabase.hosts);
+        dbRawProvider = HtDatabaseClient.getClient(hosts);
         service = dbProvider.getHtDatabaseMaintenance();
     }
 
diff --git a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestMediatorServerService.java b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestMediatorServerService.java
index 83f8de8..7afc521 100644
--- a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestMediatorServerService.java
+++ b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestMediatorServerService.java
@@ -29,20 +29,20 @@
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient;
+import org.onap.ccsdk.features.sdnr.wt.common.database.config.HostInfo;
 import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilders;
 import org.onap.ccsdk.features.sdnr.wt.common.database.requests.DeleteByQueryRequest;
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.data.ElasticSearchDataProvider;
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.data.MediatorServerDataProvider;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.test.util.HostInfoForTest;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.CreateMediatorServerInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.CreateMediatorServerOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.Entity;
 
 /**
  * @author Michael Dürre
- *
  */
 public class TestMediatorServerService {
-    private static final String SERVERID = null;
     private static ElasticSearchDataProvider dbProvider;
     private static HtDatabaseClient dbRawProvider;
     private static MediatorServerDataProvider service = null;
@@ -50,13 +50,11 @@
 
     @BeforeClass
     public static void init() throws Exception {
-
-        dbProvider = new ElasticSearchDataProvider(TestCRUDforDatabase.hosts);
+        HostInfo[] hosts = HostInfoForTest.get();
+        dbProvider = new ElasticSearchDataProvider(hosts);
         dbProvider.waitForYellowDatabaseStatus(30, TimeUnit.SECONDS);
-        dbRawProvider = HtDatabaseClient.getClient(TestCRUDforDatabase.hosts);
-        service = new MediatorServerDataProvider(TestCRUDforDatabase.hosts);
-
-
+        dbRawProvider = HtDatabaseClient.getClient(hosts);
+        service = new MediatorServerDataProvider(hosts);
     }
 
     @Test
diff --git a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestNuMappings.java b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestNuMappings.java
index f9c8812..bcd2ea7 100644
--- a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestNuMappings.java
+++ b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestNuMappings.java
@@ -21,9 +21,7 @@
  */
 package org.onap.ccsdk.features.sdnr.wt.dataprovider.test;
 
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonMappingException;
+import static org.junit.Assert.assertTrue;
 import java.io.IOException;
 import org.junit.Test;
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.yangtools.YangToolsMapper;
@@ -34,28 +32,20 @@
 public class TestNuMappings {
 
     @Test
-    public void test33() {
-        Faultcurrent c = new FaultcurrentBuilder().setSeverity(SeverityType.Critical).build();
+    public void testMapObjectToJson() throws IOException {
         YangToolsMapper mapper = new YangToolsMapper();
-        try {
-            System.out.println(mapper.writeValueAsString(c) + "<=>" + SeverityType.Critical.getName());
-        } catch (JsonProcessingException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-        try {
-            Faultcurrent f = mapper.readValue("{\"severity\":\"Critical\"}", Faultcurrent.class);
-            System.out.println(f);
-            System.out.println(mapper.writeValueAsString(f));
-        } catch (JsonParseException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        } catch (JsonMappingException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        } catch (IOException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
+
+        Faultcurrent c = new FaultcurrentBuilder().setSeverity(SeverityType.Critical).build();
+        String json = mapper.writeValueAsString(c);
+        assertTrue("Critical expected", json.contains(SeverityType.Critical.getName()));
     }
+
+    @Test
+    public void testMapJsonToObject() throws IOException {
+        YangToolsMapper mapper = new YangToolsMapper();
+
+        Faultcurrent f = mapper.readValue("{\"severity\":\"Critical\"}", Faultcurrent.class);
+        assertTrue("Critical expected", f.getSeverity().equals(SeverityType.Critical));
+    }
+
 }
diff --git a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestTimestampFilter.java b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestTimestampFilter.java
index 39377d7..e757e24 100644
--- a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestTimestampFilter.java
+++ b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestTimestampFilter.java
@@ -30,134 +30,165 @@
 
 import org.json.JSONObject;
 import org.junit.Test;
+import org.mockito.Mockito;
 import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilder;
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.data.QueryByFilter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.EntityInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.entity.input.Filter;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.entity.input.FilterBuilder;
 
-public class TestTimestampFilter {
+public class TestTimestampFilter extends Mockito {
 
     @Test
     public void testTimestampRange() {
         final String PROPERTY_TIMESTAMP = "timestamp";
         List<Filter> filters =
                 Arrays.asList(new FilterBuilder().setProperty(PROPERTY_TIMESTAMP).setFiltervalue("2017*").build());
-        QueryBuilder query = QueryByFilter.fromFilter(filters);
+        EntityInput input = mock(EntityInput.class);
+        when(input.getFilter()).thenReturn(filters);
+        QueryBuilder query = new QueryByFilter(input).getQueryBuilderByFilter();
         assertRange(query.getInner(), PROPERTY_TIMESTAMP, "2017-01-01T00:00:00.0Z", "2018-01-01T00:00:00.0Z");
 
         filters = Arrays.asList(new FilterBuilder().setProperty(PROPERTY_TIMESTAMP).setFiltervalue("2*").build());
-        query = QueryByFilter.fromFilter(filters);
+        when(input.getFilter()).thenReturn(filters);
+        query = new QueryByFilter(input).getQueryBuilderByFilter();
         assertRange(query.getInner(), PROPERTY_TIMESTAMP, "2000-01-01T00:00:00.0Z", "3000-01-01T00:00:00.0Z");
 
         filters = Arrays.asList(new FilterBuilder().setProperty(PROPERTY_TIMESTAMP).setFiltervalue("20*").build());
-        query = QueryByFilter.fromFilter(filters);
+        when(input.getFilter()).thenReturn(filters);
+        query = new QueryByFilter(input).getQueryBuilderByFilter();
         assertRange(query.getInner(), PROPERTY_TIMESTAMP, "2000-01-01T00:00:00.0Z", "2100-01-01T00:00:00.0Z");
 
         filters = Arrays.asList(new FilterBuilder().setProperty(PROPERTY_TIMESTAMP).setFiltervalue("205*").build());
-        query = QueryByFilter.fromFilter(filters);
+        when(input.getFilter()).thenReturn(filters);
+        query = new QueryByFilter(input).getQueryBuilderByFilter();
         assertRange(query.getInner(), PROPERTY_TIMESTAMP, "2050-01-01T00:00:00.0Z", "2060-01-01T00:00:00.0Z");
 
         filters = Arrays.asList(new FilterBuilder().setProperty(PROPERTY_TIMESTAMP).setFiltervalue("2050*").build());
-        query = QueryByFilter.fromFilter(filters);
+        when(input.getFilter()).thenReturn(filters);
+        query = new QueryByFilter(input).getQueryBuilderByFilter();
         assertRange(query.getInner(), PROPERTY_TIMESTAMP, "2050-01-01T00:00:00.0Z", "2051-01-01T00:00:00.0Z");
 
         filters = Arrays.asList(new FilterBuilder().setProperty(PROPERTY_TIMESTAMP).setFiltervalue("2050-*").build());
-        query = QueryByFilter.fromFilter(filters);
+        when(input.getFilter()).thenReturn(filters);
+        query = new QueryByFilter(input).getQueryBuilderByFilter();
         assertRange(query.getInner(), PROPERTY_TIMESTAMP, "2050-01-01T00:00:00.0Z", "2051-01-01T00:00:00.0Z");
 
         filters = Arrays.asList(new FilterBuilder().setProperty(PROPERTY_TIMESTAMP).setFiltervalue("2050-1*").build());
-        query = QueryByFilter.fromFilter(filters);
+        when(input.getFilter()).thenReturn(filters);
+        query = new QueryByFilter(input).getQueryBuilderByFilter();
         assertRange(query.getInner(), PROPERTY_TIMESTAMP, "2050-10-01T00:00:00.0Z", "2051-01-01T00:00:00.0Z");
 
         filters = Arrays.asList(new FilterBuilder().setProperty(PROPERTY_TIMESTAMP).setFiltervalue("2050-10*").build());
-        query = QueryByFilter.fromFilter(filters);
+        when(input.getFilter()).thenReturn(filters);
+        query = new QueryByFilter(input).getQueryBuilderByFilter();
         assertRange(query.getInner(), PROPERTY_TIMESTAMP, "2050-10-01T00:00:00.0Z", "2050-11-01T00:00:00.0Z");
 
         filters =
                 Arrays.asList(new FilterBuilder().setProperty(PROPERTY_TIMESTAMP).setFiltervalue("2050-10-*").build());
-        query = QueryByFilter.fromFilter(filters);
+        when(input.getFilter()).thenReturn(filters);
+        query = new QueryByFilter(input).getQueryBuilderByFilter();
         assertRange(query.getInner(), PROPERTY_TIMESTAMP, "2050-10-01T00:00:00.0Z", "2050-11-01T00:00:00.0Z");
 
         filters =
                 Arrays.asList(new FilterBuilder().setProperty(PROPERTY_TIMESTAMP).setFiltervalue("2050-10-0*").build());
-        query = QueryByFilter.fromFilter(filters);
+        when(input.getFilter()).thenReturn(filters);
+        query = new QueryByFilter(input).getQueryBuilderByFilter();
         assertRange(query.getInner(), PROPERTY_TIMESTAMP, "2050-10-01T00:00:00.0Z", "2050-10-10T00:00:00.0Z");
 
         filters = Arrays
                 .asList(new FilterBuilder().setProperty(PROPERTY_TIMESTAMP).setFiltervalue("2050-10-02*").build());
-        query = QueryByFilter.fromFilter(filters);
+        when(input.getFilter()).thenReturn(filters);
+        query = new QueryByFilter(input).getQueryBuilderByFilter();
         assertRange(query.getInner(), PROPERTY_TIMESTAMP, "2050-10-02T00:00:00.0Z", "2050-10-03T00:00:00.0Z");
 
         filters = Arrays
                 .asList(new FilterBuilder().setProperty(PROPERTY_TIMESTAMP).setFiltervalue("2050-10-14*").build());
-        query = QueryByFilter.fromFilter(filters);
+        when(input.getFilter()).thenReturn(filters);
+        query = new QueryByFilter(input).getQueryBuilderByFilter();
         assertRange(query.getInner(), PROPERTY_TIMESTAMP, "2050-10-14T00:00:00.0Z", "2050-10-15T00:00:00.0Z");
 
         filters = Arrays
                 .asList(new FilterBuilder().setProperty(PROPERTY_TIMESTAMP).setFiltervalue("2050-10-14T*").build());
-        query = QueryByFilter.fromFilter(filters);
+        when(input.getFilter()).thenReturn(filters);
+        query = new QueryByFilter(input).getQueryBuilderByFilter();
         assertRange(query.getInner(), PROPERTY_TIMESTAMP, "2050-10-14T00:00:00.0Z", "2050-10-15T00:00:00.0Z");
 
         filters = Arrays
                 .asList(new FilterBuilder().setProperty(PROPERTY_TIMESTAMP).setFiltervalue("2050-10-14T1*").build());
-        query = QueryByFilter.fromFilter(filters);
+        when(input.getFilter()).thenReturn(filters);
+        query = new QueryByFilter(input).getQueryBuilderByFilter();
         assertRange(query.getInner(), PROPERTY_TIMESTAMP, "2050-10-14T10:00:00.0Z", "2050-10-14T20:00:00.0Z");
 
         filters = Arrays
                 .asList(new FilterBuilder().setProperty(PROPERTY_TIMESTAMP).setFiltervalue("2050-10-14T12*").build());
-        query = QueryByFilter.fromFilter(filters);
+        when(input.getFilter()).thenReturn(filters);
+        query = new QueryByFilter(input).getQueryBuilderByFilter();
         assertRange(query.getInner(), PROPERTY_TIMESTAMP, "2050-10-14T12:00:00.0Z", "2050-10-14T13:00:00.0Z");
 
         filters = Arrays
                 .asList(new FilterBuilder().setProperty(PROPERTY_TIMESTAMP).setFiltervalue("2050-10-14T12:*").build());
-        query = QueryByFilter.fromFilter(filters);
+        when(input.getFilter()).thenReturn(filters);
+        query = new QueryByFilter(input).getQueryBuilderByFilter();
         assertRange(query.getInner(), PROPERTY_TIMESTAMP, "2050-10-14T12:00:00.0Z", "2050-10-14T13:00:00.0Z");
 
         filters = Arrays
                 .asList(new FilterBuilder().setProperty(PROPERTY_TIMESTAMP).setFiltervalue("2050-10-14T12:4*").build());
-        query = QueryByFilter.fromFilter(filters);
+        when(input.getFilter()).thenReturn(filters);
+        query = new QueryByFilter(input).getQueryBuilderByFilter();
         assertRange(query.getInner(), PROPERTY_TIMESTAMP, "2050-10-14T12:40:00.0Z", "2050-10-14T12:50:00.0Z");
 
         filters = Arrays.asList(
                 new FilterBuilder().setProperty(PROPERTY_TIMESTAMP).setFiltervalue("2050-10-14T12:42*").build());
-        query = QueryByFilter.fromFilter(filters);
+        when(input.getFilter()).thenReturn(filters);
+        query = new QueryByFilter(input).getQueryBuilderByFilter();
         assertRange(query.getInner(), PROPERTY_TIMESTAMP, "2050-10-14T12:42:00.0Z", "2050-10-14T12:43:00.0Z");
 
         filters = Arrays.asList(
                 new FilterBuilder().setProperty(PROPERTY_TIMESTAMP).setFiltervalue("2050-10-14T12:42:*").build());
-        query = QueryByFilter.fromFilter(filters);
+        when(input.getFilter()).thenReturn(filters);
+        query = new QueryByFilter(input).getQueryBuilderByFilter();
         assertRange(query.getInner(), PROPERTY_TIMESTAMP, "2050-10-14T12:42:00.0Z", "2050-10-14T12:43:00.0Z");
 
         filters = Arrays.asList(
                 new FilterBuilder().setProperty(PROPERTY_TIMESTAMP).setFiltervalue("2050-10-14T12:42:5*").build());
-        query = QueryByFilter.fromFilter(filters);
+        when(input.getFilter()).thenReturn(filters);
+        query = new QueryByFilter(input).getQueryBuilderByFilter();
         assertRange(query.getInner(), PROPERTY_TIMESTAMP, "2050-10-14T12:42:50.0Z", "2050-10-14T12:43:00.0Z");
 
         filters = Arrays.asList(
                 new FilterBuilder().setProperty(PROPERTY_TIMESTAMP).setFiltervalue("2050-10-14T12:42:56*").build());
-        query = QueryByFilter.fromFilter(filters);
+        when(input.getFilter()).thenReturn(filters);
+        query = new QueryByFilter(input).getQueryBuilderByFilter();
         assertRange(query.getInner(), PROPERTY_TIMESTAMP, "2050-10-14T12:42:56.0Z", "2050-10-14T12:42:57.0Z");
     }
 
     @Test
     public void testExtra() {
         final String PROPERTY_TIMESTAMP = "end";
-        List<Filter> filters = null;
-        QueryBuilder query = null;
+        EntityInput input = mock(EntityInput.class);
+        List<Filter> filters;
+
         filters = Arrays
                 .asList(new FilterBuilder().setProperty(PROPERTY_TIMESTAMP).setFiltervalue("2020-02-19T*").build());
-        query = QueryByFilter.fromFilter(filters);
+        when(input.getFilter()).thenReturn(filters);
+        QueryBuilder query = new QueryByFilter(input).getQueryBuilderByFilter();
         assertRange(query.getInner(), PROPERTY_TIMESTAMP, "2020-02-19T00:00:00.0Z", "2020-02-20T00:00:00.0Z");
+
         filters = Arrays
                 .asList(new FilterBuilder().setProperty(PROPERTY_TIMESTAMP).setFiltervalue("2020-02-19*").build());
-        query = QueryByFilter.fromFilter(filters);
+        when(input.getFilter()).thenReturn(filters);
+        query = new QueryByFilter(input).getQueryBuilderByFilter();
         assertRange(query.getInner(), PROPERTY_TIMESTAMP, "2020-02-19T00:00:00.0Z", "2020-02-20T00:00:00.0Z");
+
         filters = Arrays.asList(new FilterBuilder().setProperty(PROPERTY_TIMESTAMP).setFiltervalue("2020*").build());
-        query = QueryByFilter.fromFilter(filters);
+        when(input.getFilter()).thenReturn(filters);
+        query = new QueryByFilter(input).getQueryBuilderByFilter();
         assertRange(query.getInner(), PROPERTY_TIMESTAMP, "2020-01-01T00:00:00.0Z", "2021-01-01T00:00:00.0Z");
 
     }
 
+
     private void assertRange(JSONObject rangeQuery, String property, String lower, String upper) {
         System.out.println("==test for " + rangeQuery.toString());
         assertTrue(rangeQuery.has("range"));
diff --git a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestTree.java b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestTree.java
new file mode 100644
index 0000000..f2a7ff9
--- /dev/null
+++ b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestTree.java
@@ -0,0 +1,81 @@
+/*
+ * ============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.test;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.concurrent.TimeUnit;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient;
+import org.onap.ccsdk.features.sdnr.wt.common.database.config.HostInfo;
+import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilders;
+import org.onap.ccsdk.features.sdnr.wt.common.database.requests.DeleteByQueryRequest;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.data.ElasticSearchDataProvider;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.http.DataTreeHttpServlet;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.http.DataTreeHttpServlet.EntityWithTree;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.http.DataTreeHttpServlet.FilterMode;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.http.DataTreeObject;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.impl.DataTreeProviderImpl;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.test.util.HostInfoForTest;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.Entity;
+
+/**
+ * @author Michael Dürre
+ *
+ */
+public class TestTree {
+
+    private static ElasticSearchDataProvider dbProvider;
+    private static HtDatabaseClient dbRawProvider;
+
+    @BeforeClass
+    public static void init() throws Exception {
+        HostInfo[] hosts = HostInfoForTest.get();
+        dbProvider = new ElasticSearchDataProvider(hosts);
+        dbProvider.waitForYellowDatabaseStatus(30, TimeUnit.SECONDS);
+        dbRawProvider = HtDatabaseClient.getClient(hosts);
+    }
+
+    @Test
+    public void testInventoryTree() throws IOException {
+        DataTreeProviderImpl provider = new DataTreeProviderImpl();
+        provider.setDatabaseClient(dbRawProvider);
+        DeleteByQueryRequest query = new DeleteByQueryRequest(Entity.Inventoryequipment.getName(), true);
+        query.setQuery(QueryBuilders.matchAllQuery().toJSON());
+        dbRawProvider.deleteByQuery(query);
+
+        DataTreeObject tree = provider.readInventoryTree(null, null, FilterMode.Lazy);
+
+        tree = provider.readInventoryTree(Arrays.asList("sim1"), "CARD", FilterMode.Lazy);
+        System.out.println(tree.toJSON());
+
+    }
+
+    @Test
+    public void testUriConversion() {
+        EntityWithTree e = DataTreeHttpServlet.getEntity("/tree/read-inventoryequipment-tree/sim1/sim1%2FODU");
+        System.out.println(e);
+        e = DataTreeHttpServlet.getEntity("/tree/read-inventoryequipment-tree/");
+        System.out.println(e);
+    }
+}
diff --git a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestYangGenSalMapping.java b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestYangGenSalMapping.java
index 585f7de..4221891 100644
--- a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestYangGenSalMapping.java
+++ b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestYangGenSalMapping.java
@@ -25,19 +25,19 @@
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.List;
-import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
 import org.json.JSONObject;
 import org.junit.Test;
-import org.onap.ccsdk.features.sdnr.wt.common.database.DatabaseClient;
 import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient;
 import org.onap.ccsdk.features.sdnr.wt.common.database.SearchResult;
 import org.onap.ccsdk.features.sdnr.wt.common.database.config.HostInfo;
-import org.onap.ccsdk.features.sdnr.wt.common.database.config.HostInfo.Protocol;
 import org.onap.ccsdk.features.sdnr.wt.common.database.queries.BoolQueryBuilder;
 import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilder;
 import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilders;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.EsDataObjectReaderWriter;
+import org.onap.ccsdk.features.sdnr.wt.common.database.requests.CreateIndexRequest;
+import org.onap.ccsdk.features.sdnr.wt.common.database.requests.DeleteIndexRequest;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.EsDataObjectReaderWriter2;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.test.util.HostInfoForTest;
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.yangtools.YangToolsMapper;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
@@ -58,22 +58,12 @@
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.pmdata15m.entity.PerformanceDataBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.pmdata._15m.list.output.Data;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.pmdata._15m.list.output.DataBuilder;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataContainer;
-import org.opendaylight.yangtools.yang.binding.DataObject;
 
 public class TestYangGenSalMapping {
 
     // Create mapper for serialization and deserialization
     YangToolsMapper mapper = new YangToolsMapper();
 
-    private static HostInfo[] getHostinfo() {
-        int databasePort = Integer
-                .valueOf(System.getProperty("databaseport") != null ? System.getProperty("databaseport") : "49200");
-        System.out.println("DB Port: " + databasePort);
-        return new HostInfo[] {new HostInfo("localhost", databasePort, Protocol.HTTP)};
-    }
-
     @Test
     public void test1() throws IOException {
 
@@ -86,9 +76,10 @@
         loginPasswordBuilder.setPassword("myTestPassword");
         netconfNodeBuilder.setCredentials(loginPasswordBuilder.build());
 
-        OdlHelloMessageCapabilitiesBuilder odlHelloMessageCapabilitiesBuilder = new OdlHelloMessageCapabilitiesBuilder();
+        OdlHelloMessageCapabilitiesBuilder odlHelloMessageCapabilitiesBuilder =
+                new OdlHelloMessageCapabilitiesBuilder();
         List<Uri> uriList = new ArrayList<>();
-        uriList.add( new Uri("test.uri") );
+        uriList.add(new Uri("test.uri"));
         odlHelloMessageCapabilitiesBuilder.setCapability(uriList);
         netconfNodeBuilder.setOdlHelloMessageCapabilities(odlHelloMessageCapabilitiesBuilder.build());
 
@@ -104,50 +95,39 @@
         NetconfNode generatedNode = mapper.readValue(res.getBytes(), NetconfNode.class);
         out(generatedNode.toString()); // Print it with specified indentation
         // Compare result
-        out("Equal?  "+netconfNode.equals(generatedNode));
-    }
-
-    static class TestDataObjectBuilder implements Builder<TestDataObject> {
-        @Override
-        public @NonNull TestDataObject build() throws IllegalArgumentException {
-            return new TestDataObject();
-        }
-    }
-
-    static class TestDataObject implements DataObject {
-        String test;
-
-        @Override
-        public Class<? extends DataContainer> getImplementedInterface() {
-            return null;
-        }
+        //TODO - Guilin
+        //out("Equal?  "+netconfNode.equals(generatedNode));
     }
 
     @Test
-    public void test2() throws Exception    {
+    public void test2() throws Exception {
 
-        int databasePort = Integer.valueOf(System.getProperty("databaseport")!=null?System.getProperty("databaseport"):"49200");
-        System.out.println("DB Port: "+databasePort);
+        final String idx = "inventorytest";
+        HostInfo[] hostInfo = HostInfoForTest.get();
+        HtDatabaseClient db = HtDatabaseClient.getClient(hostInfo);
 
-        HostInfo[] HOSTINFOS = new HostInfo[] { new HostInfo("localhost", databasePort ,Protocol.HTTP)};
-        DatabaseClient db = HtDatabaseClient.getClient(HOSTINFOS);
-
-        EsDataObjectReaderWriter<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.inventory.list.output.Data> dataRW =
-            new EsDataObjectReaderWriter<>(db, "inventorytest", org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.inventory.list.output.Data.class);
-
+        EsDataObjectReaderWriter2<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.inventory.list.output.Data> dataRW =
+                new EsDataObjectReaderWriter2<>(db, Entity.Inventoryequipment,
+                        org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.inventory.list.output.Data.class);
+        if (!db.isExistsIndex(idx)) {
+            db.createIndex(new CreateIndexRequest(idx));
+        }
         org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.inventory.list.output.Data d1;
         d1 = getInventoryDataBuilder("MyDescription", 23L).build();
-        String id = dataRW.write(d1,null);
+        String id = dataRW.write(d1, null);
 
         org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.inventory.list.output.Data d2;
         d2 = dataRW.read(id);
 
         out(d2.toString());
+        if (db.isExistsIndex(idx)) {
+            db.deleteIndex(new DeleteIndexRequest(idx));
+        }
 
     }
 
     @Test
-    public void test3() throws IOException    {
+    public void test3() throws IOException {
 
         PerformanceDataBuilder performanceBuilder = new PerformanceDataBuilder();
         performanceBuilder.setEs(99);
@@ -168,88 +148,125 @@
 
     @Test
     public void test4() throws IOException {
-
-        String jsonString = "{\n" + "\"node-name\": \"Sim2230\",\n" + "\"uuid-interface\": \"LP-MWPS-TTP-RADIO\",\n"
-                + "\"layer-protocol-name\": \"MWPS\",\n" + "\"radio-signal-id\": \"Test8\",\n"
-                + "\"time-stamp\": \"2017-03-01T09:15:00.0Z\",\n" + "\"granularity-period\": \"Period15Min\",\n"
-                + "\"scanner-id\": \"PM_RADIO_15M_4\",\n" + "\"performance-data\": {\n" + "\"unavailability\": 0,\n"
-                + "\"tx-level-max\": 3,\n" + "\"tx-level-avg\": 3,\n" + "\"rx-level-min\": -44,\n"
-                + "\"rx-level-max\": -45,\n" + "\"rx-level-avg\": -44,\n" + "\"time2-states\": 0,\n"
-                + "\"time4-states-s\": 0,\n" + "\"time4-states\": 0,\n" + "\"time8-states\": -1,\n"
-                + "\"time16-states-s\": -1,\n" + "\"time16-states\": 0,\n" + "\"time32-states\": -1,\n"
-                + "\"time64-states\": 900,\n" + "\"time128-states\": -1,\n" + "\"time256-states\": -1,\n"
-                + "\"time512-states\": -1,\n" + "\"time512-states-l\": -1,\n" + "\"time1024-states\": -1,\n"
-                + "\"time1024-states-l\": -1,\n" + "\"time8192-states-l\": -1,\n" + "\"time8192-states\": -1,\n"
-                + "\"time2048-states\": -1,\n" + "\"snir-min\": -99,\n" + "\"snir-max\": -99,\n"
-                + "\"snir-avg\": -99,\n" + "\"xpd-min\": -99,\n" + "\"xpd-max\": -99,\n" + "\"xpd-avg\": -99,\n"
-                + "\"rf-temp-min\": -99,\n" + "\"rf-temp-max\": -99,\n" + "\"rf-temp-avg\": -99,\n"
-                + "\"defect-blocks-sum\": -1,\n" + "\"time-period\": 900,\n" + "\"cses\": 0,\n"
-                + "\"time4096-states-l\": -1,\n" + "\"tx-level-min\": 3,\n" + "\"es\": 0,\n"
-                + "\"time2048-states-l\": -1,\n" + "\"time4096-states\": -1,\n" + "\"ses\": 0\n" + "},\n"
-                + "\"suspect-interval-flag\": false\n" + "}\n" + "}";
+     // @formatter:off
+     String jsonString = "{\n"
+                + "\"node-name\": \"Sim2230\",\n"
+                + "\"uuid-interface\": \"LP-MWPS-TTP-RADIO\",\n"
+                + "\"layer-protocol-name\": \"MWPS\",\n"
+                + "\"radio-signal-id\": \"Test8\",\n"
+                + "\"time-stamp\": \"2017-03-01T09:15:00.0Z\",\n"
+                + "\"granularity-period\": \"Period15Min\",\n"
+                + "\"scanner-id\": \"PM_RADIO_15M_4\",\n"
+                + "\"performance-data\": {\n"
+                +     "\"unavailability\": 0,\n"
+                +     "\"tx-level-max\": 3,\n"
+                +     "\"tx-level-avg\": 3,\n"
+                +     "\"rx-level-min\": -44,\n"
+                +     "\"rx-level-max\": -45,\n"
+                +     "\"rx-level-avg\": -44,\n"
+                +     "\"time2-states\": 0,\n"
+                +     "\"time4-states-s\": 0,\n"
+                +     "\"time4-states\": 0,\n"
+                +     "\"time8-states\": -1,\n"
+                +     "\"time16-states-s\": -1,\n"
+                +     "\"time16-states\": 0,\n"
+                +     "\"time32-states\": -1,\n"
+                +     "\"time64-states\": 900,\n"
+                +     "\"time128-states\": -1,\n"
+                +     "\"time256-states\": -1,\n"
+                +     "\"time512-states\": -1,\n"
+                +     "\"time512-states-l\": -1,\n"
+                +     "\"time1024-states\": -1,\n"
+                +     "\"time1024-states-l\": -1,\n"
+                +     "\"time8192-states-l\": -1,\n"
+                +     "\"time8192-states\": -1,\n"
+                +     "\"time2048-states\": -1,\n"
+                +     "\"snir-min\": -99,\n"
+                +     "\"snir-max\": -99,\n"
+                +     "\"snir-avg\": -99,\n"
+                +     "\"xpd-min\": -99,\n"
+                +     "\"xpd-max\": -99,\n"
+                +     "\"xpd-avg\": -99,\n"
+                +     "\"rf-temp-min\": -99,\n"
+                +     "\"rf-temp-max\": -99,\n"
+                +     "\"rf-temp-avg\": -99,\n"
+                +     "\"defect-blocks-sum\": -1,\n"
+                +     "\"time-period\": 900,\n"
+                +     "\"cses\": 0,\n"
+                +     "\"time4096-states-l\": -1,\n"
+                +     "\"tx-level-min\": 3,\n"
+                +     "\"es\": 0,\n"
+                +     "\"time2048-states-l\": -1,\n"
+                +     "\"time4096-states\": -1,\n"
+                +     "\"ses\": 0\n"
+                + "},\n"
+                + "\"suspect-interval-flag\": false\n"
+                + "}\n"
+                + "}";
+        // @formatter:on
         // Map to JSON String to Object
         Data generatedNode = mapper.readValue(jsonString.getBytes(), Data.class);
         out(generatedNode.toString()); // Print it with specified indentation
-
     }
 
 
     @Test
     public void test5() throws IOException {
-        String jsonString = "{\n" +
-                "    \"time-stamp\": \"2017-03-01T06:45:00.0Z\",\n" +
-                "    \"node-name\": \"Sim2230\",\n" +
-                "    \"uuid-interface\": \"LP-MWPS-TTP-RADIO\",\n" +
-                "    \"scanner-id\": \"PM_RADIO_15M_14\",\n" +
-                "    \"layer-protocol-name\": \"MWPS\",\n" +
-                "    \"granularity-period\": \"Period15Min\",\n" +
-                "    \"radio-signal-id\": \"Test8\",\n" +
-                "    \"suspect-interval-flag\": false,\n" +
-                "    \"performance-data\": {\n" +
-                "        \"time4096-states-l\": -1,\n" +
-                "        \"time16-states-s\": -1,\n" +
-                "        \"tx-level-max\": 3,\n" +
-                "        \"snir-max\": -99,\n" +
-                "        \"time16-states\": 0,\n" +
-                "        \"time64-states\": 900,\n" +
-                "        \"unavailability\": 0,\n" +
-                "        \"time8192-states-l\": -1,\n" +
-                "        \"time512-states\": -1,\n" +
-                "        \"xpd-min\": -99,\n" +
-                "        \"xpd-avg\": -99,\n" +
-                "        \"tx-level-avg\": 3,\n" +
-                "        \"tx-level-min\": 3,\n" +
-                "        \"rf-temp-min\": -99,\n" +
-                "        \"rf-temp-avg\": -99,\n" +
-                "        \"snir-avg\": -99,\n" +
-                "        \"snir-min\": -99,\n" +
-                "        \"time-period\": 900,\n" +
-                "        \"time2-states\": 0,\n" +
-                "        \"time4-states\": 0,\n" +
-                "        \"time8-states\": -1,\n" +
-                "        \"ses\": 0,\n" +
-                "        \"time2048-states-l\": -1,\n" +
-                "        \"time2048-states\": -1,\n" +
-                "        \"xpd-max\": -99,\n" +
-                "        \"rf-temp-max\": -99,\n" +
-                "        \"time8192-states\": -1,\n" +
-                "        \"time128-states\": -1,\n" +
-                "        \"time256-states\": -1,\n" +
-                "        \"rx-level-min\": -44,\n" +
-                "        \"rx-level-avg\": -44,\n" +
-                "        \"time1024-states-l\": -1,\n" +
-                "        \"es\": 0,\n" +
-                "        \"cses\": 0,\n" +
-                "        \"time4-states-s\": 0,\n" +
-                "        \"time1024-states\": -1,\n" +
-                "        \"time512-states-l\": -1,\n" +
-                "        \"time4096-states\": -1,\n" +
-                "        \"rx-level-max\": -45,\n" +
-                "        \"defect-blocks-sum\": -1,\n" +
-                "        \"time32-states\": -1\n" +
-                "    }\n" +
-                "}";
-
+        // @formatter:off
+        String jsonString = "{\n"
+                + "    \"time-stamp\": \"2017-03-01T06:45:00.0Z\",\n"
+                + "    \"node-name\": \"Sim2230\",\n"
+                + "    \"uuid-interface\": \"LP-MWPS-TTP-RADIO\",\n"
+                + "    \"scanner-id\": \"PM_RADIO_15M_14\",\n"
+                + "    \"layer-protocol-name\": \"MWPS\",\n"
+                + "    \"granularity-period\": \"Period15Min\",\n"
+                + "    \"radio-signal-id\": \"Test8\",\n"
+                + "    \"suspect-interval-flag\": false,\n"
+                + "    \"performance-data\": {\n"
+                + "        \"time4096-states-l\": -1,\n"
+                + "        \"time16-states-s\": -1,\n"
+                + "        \"tx-level-max\": 3,\n"
+                + "        \"snir-max\": -99,\n"
+                + "        \"time16-states\": 0,\n"
+                + "        \"time64-states\": 900,\n"
+                + "        \"unavailability\": 0,\n"
+                + "        \"time8192-states-l\": -1,\n"
+                + "        \"time512-states\": -1,\n"
+                + "        \"xpd-min\": -99,\n"
+                + "        \"xpd-avg\": -99,\n"
+                + "        \"tx-level-avg\": 3,\n"
+                + "        \"tx-level-min\": 3,\n"
+                + "        \"rf-temp-min\": -99,\n"
+                + "        \"rf-temp-avg\": -99,\n"
+                + "        \"snir-avg\": -99,\n"
+                + "        \"snir-min\": -99,\n"
+                + "        \"time-period\": 900,\n"
+                + "        \"time2-states\": 0,\n"
+                + "        \"time4-states\": 0,\n"
+                + "        \"time8-states\": -1,\n"
+                + "        \"ses\": 0,\n"
+                + "        \"time2048-states-l\": -1,\n"
+                + "        \"time2048-states\": -1,\n"
+                + "        \"xpd-max\": -99,\n"
+                + "        \"rf-temp-max\": -99,\n"
+                + "        \"time8192-states\": -1,\n"
+                + "        \"time128-states\": -1,\n"
+                + "        \"time256-states\": -1,\n"
+                + "        \"rx-level-min\": -44,\n"
+                + "        \"rx-level-avg\": -44,\n"
+                + "        \"time1024-states-l\": -1,\n"
+                + "        \"es\": 0,\n"
+                + "        \"cses\": 0,\n"
+                + "        \"time4-states-s\": 0,\n"
+                + "        \"time1024-states\": -1,\n"
+                + "        \"time512-states-l\": -1,\n"
+                + "        \"time4096-states\": -1,\n"
+                + "        \"rx-level-max\": -45,\n"
+                + "        \"defect-blocks-sum\": -1,\n"
+                + "        \"time32-states\": -1\n"
+                + "    }\n"
+                + "}";
+        // @formatter:on
         // Map to JSON String to Object
         Data generatedNode = mapper.readValue(jsonString.getBytes(), Data.class);
         out(generatedNode.toString()); // Print it with specified indentation
@@ -260,11 +277,12 @@
     @Test
     public void test6() throws Exception {
         out(method());
-        HtDatabaseClient dbClient = HtDatabaseClient.getClient(getHostinfo());
-        String PMDATA15M_TYPE = "historicalperformance15min";
+        HostInfo[] hostInfo = HostInfoForTest.get();
+        HtDatabaseClient dbClient = HtDatabaseClient.getClient(hostInfo);
 
-        EsDataObjectReaderWriter<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.pmdata._15m.list.output.Data> pm15mRW =
-                new EsDataObjectReaderWriter<>(dbClient, PMDATA15M_TYPE, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.pmdata._15m.list.output.Data.class);
+        EsDataObjectReaderWriter2<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.pmdata._15m.list.output.Data> pm15mRW =
+                new EsDataObjectReaderWriter2<>(dbClient, Entity.Historicalperformance15min,
+                        org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.pmdata._15m.list.output.Data.class);
         pm15mRW.setEsIdAttributeName("_nodeName");
 
         ReadPmdata15mListInputBuilder inputBuilder = new ReadPmdata15mListInputBuilder();
@@ -283,12 +301,13 @@
         QueryBuilder query = fromFilter(input.getFilter()).from((page - 1) * pageSize).size(pageSize);
         setSortOrder(query, input.getSortorder());
 
-        SearchResult<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.pmdata._15m.list.output.Data> result=pm15mRW.doReadAll(query);
+        SearchResult<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.pmdata._15m.list.output.Data> result =
+                pm15mRW.doReadAll(query);
 
-        out("Found: "+result.getHits().size());
-        int t=0;
+        out("Found: " + result.getHits().size());
+        int t = 0;
         for (Data hit : result.getHits()) {
-            out("Hit "+t+++":"+hit);
+            out("Hit " + t++ + ":" + hit);
         }
         setPagination(outputBuilder, page, pageSize, result.getTotal());
         outputBuilder.setData(result.getHits());
@@ -297,20 +316,21 @@
     @Test
     public void test7() throws Exception {
         out(method());
-        String ESDATATYPE_MEDIATORSERVER = Entity.MediatorServer.getName();
-        HtDatabaseClient dbClient = HtDatabaseClient.getClient(getHostinfo());
-        EsDataObjectReaderWriter<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.mediator.server.list.output.Data> mediatorserverRW;
+        HostInfo[] hostInfo = HostInfoForTest.get();
+        HtDatabaseClient dbClient = HtDatabaseClient.getClient(hostInfo);
 
-        mediatorserverRW = new EsDataObjectReaderWriter<>(dbClient, ESDATATYPE_MEDIATORSERVER,
+        EsDataObjectReaderWriter2<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.mediator.server.list.output.Data> mediatorserverRW;
+        mediatorserverRW = new EsDataObjectReaderWriter2<>(dbClient, Entity.MediatorServer,
                 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.mediator.server.list.output.Data.class)
-                .setWriteInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.MediatorServerEntity.class)
-                .setEsIdAttributeName("_id");
+                        .setWriteInterface(
+                                org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.MediatorServerEntity.class)
+                        .setEsIdAttributeName("_id");
 
         CreateMediatorServerInputBuilder inputBuilder = new CreateMediatorServerInputBuilder();
         inputBuilder.setName("Hans");
         inputBuilder.setUrl("MyGreatUrl");
 
-        String id = mediatorserverRW.write(inputBuilder.build(),"testid");
+        String id = mediatorserverRW.write(inputBuilder.build(), "testid");
         System.out.println(id);
 
     }
@@ -320,15 +340,15 @@
         out(method());
         String input;
         input = "id-dd-dd";
-        System.out.println("Map " + input + " to "+YangToolsMapper.toCamelCaseAttributeName(input));
+        System.out.println("Map " + input + " to " + YangToolsMapper.toCamelCaseAttributeName(input));
         input = "idDdGg";
-        System.out.println("Map " + input + " to "+YangToolsMapper.toCamelCaseAttributeName(input));
+        System.out.println("Map " + input + " to " + YangToolsMapper.toCamelCaseAttributeName(input));
         input = "_idDdGg";
-        System.out.println("Map " + input + " to "+YangToolsMapper.toCamelCaseAttributeName(input));
+        System.out.println("Map " + input + " to " + YangToolsMapper.toCamelCaseAttributeName(input));
         input = "--ff--gfg";
-        System.out.println("Map " + input + " to "+YangToolsMapper.toCamelCaseAttributeName(input));
+        System.out.println("Map " + input + " to " + YangToolsMapper.toCamelCaseAttributeName(input));
         input = "";
-        System.out.println("Map " + input + " to "+YangToolsMapper.toCamelCaseAttributeName(input));
+        System.out.println("Map " + input + " to " + YangToolsMapper.toCamelCaseAttributeName(input));
     }
 
     /* ---------------------------------
@@ -339,7 +359,8 @@
         return nameofCurrMethod;
     }
 
-    private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.inventory.list.output.DataBuilder getInventoryDataBuilder(String description, long treeLevel) {
+    private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.inventory.list.output.DataBuilder getInventoryDataBuilder(
+            String description, long treeLevel) {
         org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.inventory.list.output.DataBuilder dataBuilder =
                 new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.inventory.list.output.DataBuilder();
         dataBuilder.setDescription(description);
@@ -377,10 +398,9 @@
         if (filters == null || filters.size() == 0) {
             return QueryBuilders.matchAllQuery();
 
-        } else if(filters.size()==1){
+        } else if (filters.size() == 1) {
             return QueryBuilders.matchQuery(filters.get(0).getProperty(), filters.get(0).getFiltervalue());
-        }
-        else {
+        } else {
             BoolQueryBuilder query = new BoolQueryBuilder();
             for (Filter fi : filters) {
                 query.must(QueryBuilders.matchQuery((prefix != null ? prefix : "") + fi.getProperty(),
@@ -390,6 +410,7 @@
         }
 
     }
+
     private static QueryBuilder setSortOrder(QueryBuilder query, @Nullable List<Sortorder> sortorder) {
         return setSortOrder(query, sortorder, "");
     }
@@ -407,9 +428,12 @@
 
     }
 
-    private static void setPagination(ReadPmdata15mListOutputBuilder outputBuilder, long page, long pageSize, long totalSize) {
-        org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.pmdata._15m.list.output.Pagination value = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.pmdata._15m.list.output.PaginationBuilder()
-                .setPage(BigInteger.valueOf(page)).setSize(pageSize).setTotal(BigInteger.valueOf(totalSize)).build();
+    private static void setPagination(ReadPmdata15mListOutputBuilder outputBuilder, long page, long pageSize,
+            long totalSize) {
+        org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.pmdata._15m.list.output.Pagination value =
+                new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.read.pmdata._15m.list.output.PaginationBuilder()
+                        .setPage(BigInteger.valueOf(page)).setSize(pageSize).setTotal(BigInteger.valueOf(totalSize))
+                        .build();
         outputBuilder.setPagination(value);
     }
 
diff --git a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestYangProvider.java b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestYangProvider.java
index 19bd76c..244d6b0 100644
--- a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestYangProvider.java
+++ b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestYangProvider.java
@@ -48,7 +48,6 @@
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.data.YangFileProvider;
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.data.YangFilename;
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.http.YangSchemaHttpServlet;
-
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
diff --git a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/util/HostInfoForTest.java b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/util/HostInfoForTest.java
new file mode 100644
index 0000000..8ea4b13
--- /dev/null
+++ b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/util/HostInfoForTest.java
@@ -0,0 +1,53 @@
+/*
+ * ============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.test.util;
+
+import org.onap.ccsdk.features.sdnr.wt.common.database.config.HostInfo;
+import org.onap.ccsdk.features.sdnr.wt.common.database.config.HostInfo.Protocol;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Using pom.xml property to setup URL to database in JUnit tests. Setup impom.xml: <br>
+ * <properties><databaseport>49402</databaseport> </properties> in cooperation with plugin
+ * <groupId>com.github.alexcojocaru</groupId> <artifactId>elasticsearch-maven-plugin</artifactId>
+ * In local development test environment port 49200 is used.
+ */
+public class HostInfoForTest {
+
+    private static final Logger LOG = LoggerFactory.getLogger(HostInfoForTest.class);
+
+    // static methods
+    public static HostInfo[] get() {
+        int port;
+
+        String portAsString = System.getProperty("databaseport");
+        if (portAsString == null | portAsString.isEmpty())
+            port = 49200;
+        else
+            port = Integer.valueOf(portAsString);
+        HostInfo testHost = new HostInfo("localhost", port, Protocol.HTTP);
+        LOG.info("Testhost {}",testHost);
+        return new HostInfo[] {testHost};
+    }
+    // end of static methods
+}
diff --git a/sdnr/wt/data-provider/provider/src/test/resources/simplelogger.properties b/sdnr/wt/data-provider/provider/src/test/resources/simplelogger.properties
index 9943c2f..056e91e 100644
--- a/sdnr/wt/data-provider/provider/src/test/resources/simplelogger.properties
+++ b/sdnr/wt/data-provider/provider/src/test/resources/simplelogger.properties
@@ -19,10 +19,12 @@
 #
 #
 
-org.slf4j.simpleLogger.defaultLogLevel=INFO
+org.slf4j.simpleLogger.defaultLogLevel=DEBUG
 org.slf4j.simpleLogger.showDateTime=true
 #org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS Z
 #org.slf4j.simpleLogger.showThreadName=true
 org.slf4j.simpleLogger.showLogName=true
 org.slf4j.simpleLogger.showShortLogName=false
 org.slf4j.simpleLogger.org.onap.ccsdk.features.sdnr.wt.dataprovider=DEBUG
+org.slf4j.simpleLogger.org.onap.ccsdk.features.sdnr.wt.common=DEBUG
+
diff --git a/sdnr/wt/data-provider/setup/pom.xml b/sdnr/wt/data-provider/setup/pom.xml
index a43ec0c..cf79294 100644
--- a/sdnr/wt/data-provider/setup/pom.xml
+++ b/sdnr/wt/data-provider/setup/pom.xml
@@ -60,12 +60,11 @@
         <dependency>
             <groupId>commons-cli</groupId>
             <artifactId>commons-cli</artifactId>
-            <version>1.4</version>
         </dependency>
         <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-log4j12</artifactId>
-        </dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+       </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>sdnr-wt-common</artifactId>
@@ -77,7 +76,6 @@
             <version>${project.version}</version>
         </dependency>
     </dependencies>
-
     <build>
         <plugins>
             <plugin>
@@ -89,7 +87,7 @@
                     <clusterName>testCluster</clusterName>
                     <transportPort>49504</transportPort>
                     <httpPort>${databaseport}</httpPort>
-                    <version>6.5.0</version>
+                    <version>7.1.1</version>
                 </configuration>
                 <executions>
                     <execution>
@@ -133,7 +131,7 @@
                 </executions>
                 <configuration>
                     <finalName>sdnr-dmt</finalName>
-                    <appendAssemblyId>false</appendAssemblyId>
+                  <appendAssemblyId>false</appendAssemblyId>
                     <archive>
                         <manifest>
                             <mainClass>org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.Program</mainClass>
diff --git a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/DataMigrationProviderImpl.java b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/DataMigrationProviderImpl.java
index dabe004..100f523 100644
--- a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/DataMigrationProviderImpl.java
+++ b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/DataMigrationProviderImpl.java
@@ -33,7 +33,6 @@
 import java.util.Set;
 import org.json.JSONObject;
 import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient;
-import org.onap.ccsdk.features.sdnr.wt.common.database.Portstatus;
 import org.onap.ccsdk.features.sdnr.wt.common.database.SearchHit;
 import org.onap.ccsdk.features.sdnr.wt.common.database.SearchResult;
 import org.onap.ccsdk.features.sdnr.wt.common.database.config.HostInfo;
@@ -55,6 +54,7 @@
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.DataContainer;
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.DataMigrationReport;
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.Release;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.ReleaseGroup;
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.SearchHitConverter;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -63,19 +63,13 @@
 
 
     private static final Logger LOG = LoggerFactory.getLogger(DataMigrationProviderImpl.class);
+
     private final HtDatabaseClient dbClient;
 
     public DataMigrationProviderImpl(HostInfo[] hosts, String username, String password, boolean trustAll,
-            long timeoutms) {
+            long timeoutms) throws Exception {
 
-        if (timeoutms > 0) {
-            Portstatus.waitSecondsTillAvailable(timeoutms / 1000, hosts);
-        }
-        try {
-            this.dbClient = HtDatabaseClient.getClient(hosts, username, password, trustAll);
-        } catch (Exception e) {
-            throw new IllegalArgumentException("Can not reach database with parameters.",e);
-        }
+        dbClient = HtDatabaseClient.getClient(hosts, username, password, trustAll, timeoutms);
     }
 
     @Override
@@ -125,7 +119,7 @@
                 for (SearchHit item : data) {
                     if (!dryrun) {
                         String id = this.dbClient.doWriteRaw(indexName, dataTypeName, item.getId(),
-                                item.getSourceAsString());
+                                item.getSourceAsString(), true);
                         if (!item.getId().equals(id)) {
                             LOG.warn("entry for {} with original id {} was written with another id {}",
                                     component.getValue(), item.getId(), id);
@@ -268,6 +262,7 @@
         return entries;
     }
 
+
     @Override
     public boolean initDatabase(Release release, int numShards, int numReplicas, String dbPrefix, boolean forceRecreate,
             long timeoutms) {
@@ -278,6 +273,16 @@
         if (dbVersion == null) {
             return false;
         }
+        LOG.info("detected database version {}", dbVersion);
+        if (release == null) {
+            release = ReleaseGroup.CURRENT_RELEASE.getLatestCompatibleRelease(dbVersion);
+            if (release == null) {
+                LOG.warn("unable to autodetect release for this database version for release {}",
+                        ReleaseGroup.CURRENT_RELEASE.name());
+                return false;
+            }
+            LOG.info("autodetect release {}", release);
+        }
         if (!release.isDbInRange(dbVersion)) {
             LOG.warn("db version {} maybe not compatible with release {}", dbVersion, release);
             return false;
@@ -342,6 +347,20 @@
         if (entries == null) {
             return false;
         }
+        if (release == null) {
+            EsVersion dbVersion = this.readActualVersion();
+            if (dbVersion == null) {
+                return false;
+            }
+            LOG.info("detected database version {}", dbVersion);
+            release = ReleaseGroup.CURRENT_RELEASE.getLatestCompatibleRelease(dbVersion);
+            if (release == null) {
+                LOG.warn("unable to autodetect release for this database version for release {}",
+                        ReleaseGroup.CURRENT_RELEASE.name());
+                return false;
+            }
+            LOG.info("autodetect release {}", release);
+        }
         ReleaseInformation ri = ReleaseInformation.getInstance(release);
         AcknowledgedResponse response;
         if (entries.size() <= 0) {
diff --git a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/Program.java b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/Program.java
index c7775a9..4b201bc 100644
--- a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/Program.java
+++ b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/Program.java
@@ -53,7 +53,9 @@
     private static final String CMD_LIST_VERSION = "list";
 
     private static final String CMD_INITDB_DESCRIPTION = "initialize databse indices and aliases";
-    private static final String CMD_CLEAR_DB_DESCRIPTION = "clear database indices and aliases";
+    private static final String CMD_CLEAR_DB_DESCRIPTION = "delete database indices and aliases for current release";
+    private static final String CMD_CLEAR_DB_COMPLETE_DESCRIPTION = "delete all database indices and aliases";
+
     private static final String CMD_CREATE_PLUGIN_INIT_FILE_DESCRIPTION = "create maven plugin file";
     private static final String CMD_IMPORT_DESCRIPTION = "import data into database";
     private static final String CMD_EXPORT_DESCRIPTION = "export data from database";
@@ -61,31 +63,51 @@
 
     private static final List<String[]> commands = Arrays.asList(new String[] {CMD_INITDB, CMD_INITDB_DESCRIPTION},
             new String[] {CMD_CLEAR_DB, CMD_CLEAR_DB_DESCRIPTION},
+            new String[] {CMD_CLEAR_DB_COMPLETE, CMD_CLEAR_DB_COMPLETE_DESCRIPTION},
             new String[] {CMD_CREATE_PLUGIN_INIT_FILE, CMD_CREATE_PLUGIN_INIT_FILE_DESCRIPTION},
             new String[] {CMD_IMPORT, CMD_IMPORT_DESCRIPTION}, new String[] {CMD_EXPORT, CMD_EXPORT_DESCRIPTION},
             new String[] {CMD_LIST_VERSION, CMD_LIST_VERSION_DESCRIPTION});
     private static final String APPLICATION_NAME = "SDNR DataMigrationTool";
+
     private static final int DEFAULT_SHARDS = 5;
     private static final int DEFAULT_REPLICAS = 1;
+    private static final int DEFAULT_DATABASEWAIT_SECONDS = 30;
     private static final String DEFAULT_DBURL = "http://sdnrdb:9200";
     private static final String DEFAULT_DBPREFIX = "";
+    private static final boolean DEFAULT_TRUSTINSECURESSL = false;
+
     private static final String OPTION_FORCE_RECREATE_SHORT = "f";
+    private static final String OPTION_FORCE_RECREATE_LONG = "force-recreate";
     private static final String OPTION_SILENT_SHORT = "n";
     private static final String OPTION_SILENT = "silent";
     private static final String OPTION_VERSION_SHORT = "v";
+    private static final String OPTION_VERSION_LONG = "version";
     private static final String OPTION_SHARDS_SHORT = "s";
+    private static final String OPTION_SHARDS_LONG = "shards";
     private static final String OPTION_REPLICAS_SHORT = "r";
+    private static final String OPTION_REPLICAS_LONG = "replicas";
     private static final String OPTION_OUTPUTFILE_SHORT = "of";
+    private static final String OPTION_OUTPUTFILE_LONG = "output-file";
     private static final String OPTION_INPUTFILE_SHORT = "if";
+    private static final String OPTION_INPUTFILE_LONG = "input-file";
     private static final String OPTION_DEBUG_SHORT = "x";
+    private static final String OPTION_DEBUG_LONG = "verbose";
     private static final String OPTION_TRUSTINSECURESSL_SHORT = "k";
+    private static final String OPTION_TRUSTINSECURESSL_LONG = "trust-insecure";
     private static final String OPTION_DATABASE_SHORT = "db";
+    private static final String OPTION_DATABASE_LONG = "dburl";
     private static final String OPTION_COMMAND_SHORT = "c";
+    private static final String OPTION_COMMAND_LONG = "cmd";
     private static final String OPTION_DATABASEUSER_SHORT = "dbu";
+    private static final String OPTION_DATABASEUSER_LONG = "db-username";
     private static final String OPTION_DATABASEPASSWORD_SHORT = "dbp";
+    private static final String OPTION_DATABASEPASSWORD_LONG = "db-password";
     private static final String OPTION_DATABASEPREFIX_SHORT = "p";
+    private static final String OPTION_DATABASEPREFIX_LONG = "prefix";
     private static final String OPTION_DATABASEWAIT_SHORT = "w";
+    private static final String OPTION_DATABASEWAIT_LONG = "wait";
     private static final String OPTION_HELP_SHORT = "h";
+    private static final String OPTION_HELP_LONG = "help";
     // end of constants
 
     // variables
@@ -111,6 +133,9 @@
         if (def instanceof Long) {
             return cmd.hasOption(option) ? (T) Long.valueOf(cmd.getOptionValue(option)) : def;
         }
+        if (def instanceof Release) {
+            return cmd.hasOption(option) ? (T) Release.getValueBySuffix(cmd.getOptionValue(option)) : def;
+        }
         if (cmd.hasOption(option) && cmd.getOptionValue(option) != null) {
             if (option.equals(OPTION_VERSION_SHORT)) {
                 String v = cmd.getOptionValue(option);
@@ -215,7 +240,8 @@
                     if (of == null) {
                         throw new Exception("please add the parameter output-file");
                     }
-                    MavenDatabasePluginInitFile.create(Release.CURRENT_RELEASE, of);
+                    MavenDatabasePluginInitFile
+                            .create(getOptionOrDefault(cmd, OPTION_VERSION_SHORT, Release.CURRENT_RELEASE), of);
                 } catch (Exception e) {
                     return exit(e);
                 }
@@ -271,11 +297,11 @@
         String username = getOptionOrDefault(cmd, OPTION_DATABASEUSER_SHORT, null);
         String password = getOptionOrDefault(cmd, OPTION_DATABASEPASSWORD_SHORT, null);
         String filename = getOptionOrDefault(cmd, OPTION_OUTPUTFILE_SHORT, null);
-        boolean trustAll = getOptionOrDefault(cmd, OPTION_TRUSTINSECURESSL_SHORT, false);
+        boolean trustAll = getOptionOrDefault(cmd, OPTION_TRUSTINSECURESSL_SHORT, DEFAULT_TRUSTINSECURESSL);
         if (filename == null) {
             throw new Exception("please add output file parameter");
         }
-        long timeoutms = getOptionOrDefault(cmd, OPTION_DATABASEWAIT_SHORT, 30) * 1000;
+        long timeoutms = getTimeoutOptionMillis(cmd);
         DataMigrationProviderImpl service = new DataMigrationProviderImpl(new HostInfo[] {HostInfo.parse(dbUrl)},
                 username, password, trustAll, timeoutms);
         DataMigrationReport report = service.importData(filename, false);
@@ -283,6 +309,7 @@
         if (!report.completed()) {
             throw new Exception("db import seems to be not executed completed");
         }
+        LOG.info("database import completed successfully");
     }
 
     private static void cmd_dbexport(CommandLine cmd) throws Exception {
@@ -290,11 +317,11 @@
         String username = getOptionOrDefault(cmd, OPTION_DATABASEUSER_SHORT, null);
         String password = getOptionOrDefault(cmd, OPTION_DATABASEPASSWORD_SHORT, null);
         String filename = getOptionOrDefault(cmd, OPTION_OUTPUTFILE_SHORT, null);
-        boolean trustAll = getOptionOrDefault(cmd, OPTION_TRUSTINSECURESSL_SHORT, false);
+        boolean trustAll = getOptionOrDefault(cmd, OPTION_TRUSTINSECURESSL_SHORT, DEFAULT_TRUSTINSECURESSL);
         if (filename == null) {
             throw new Exception("please add output file parameter");
         }
-        long timeoutms = getOptionOrDefault(cmd, OPTION_DATABASEWAIT_SHORT, 30) * 1000;
+        long timeoutms = getTimeoutOptionMillis(cmd);
         DataMigrationProviderImpl service = new DataMigrationProviderImpl(new HostInfo[] {HostInfo.parse(dbUrl)},
                 username, password, trustAll, timeoutms);
         DataMigrationReport report = service.exportData(filename);
@@ -302,7 +329,7 @@
         if (!report.completed()) {
             throw new Exception("db export seems to be not executed completed");
         }
-
+        LOG.info("database export completed successfully");
     }
 
     private static int exit(Exception e) {
@@ -315,85 +342,96 @@
     }
 
     private static void cmd_clear_db(CommandLine cmd) throws Exception {
-        Release r = getOptionOrDefault(cmd, OPTION_VERSION_SHORT, Release.CURRENT_RELEASE);
+        Release r = getOptionOrDefault(cmd, OPTION_VERSION_SHORT, (Release) null);
         String dbUrl = getOptionOrDefault(cmd, OPTION_DATABASE_SHORT, DEFAULT_DBURL);
         String dbPrefix = getOptionOrDefault(cmd, OPTION_DATABASEPREFIX_SHORT, DEFAULT_DBPREFIX);
         String username = getOptionOrDefault(cmd, OPTION_DATABASEUSER_SHORT, null);
         String password = getOptionOrDefault(cmd, OPTION_DATABASEPASSWORD_SHORT, null);
-        boolean trustAll = getOptionOrDefault(cmd, OPTION_TRUSTINSECURESSL_SHORT, false);
-        long timeoutms = getOptionOrDefault(cmd, OPTION_DATABASEWAIT_SHORT, 30) * 1000;
+        boolean trustAll = getOptionOrDefault(cmd, OPTION_TRUSTINSECURESSL_SHORT, DEFAULT_TRUSTINSECURESSL);
+        long timeoutms = getTimeoutOptionMillis(cmd);
         DataMigrationProviderImpl service = new DataMigrationProviderImpl(new HostInfo[] {HostInfo.parse(dbUrl)},
                 username, password, trustAll, timeoutms);
         if (!service.clearDatabase(r, dbPrefix, timeoutms)) {
             throw new Exception("failed to init database");
         }
+        LOG.info("database clear completed successfully");
     }
 
     private static void cmd_clear_db_complete(CommandLine cmd) throws Exception {
         String dbUrl = getOptionOrDefault(cmd, OPTION_DATABASE_SHORT, DEFAULT_DBURL);
         String username = getOptionOrDefault(cmd, OPTION_DATABASEUSER_SHORT, null);
         String password = getOptionOrDefault(cmd, OPTION_DATABASEPASSWORD_SHORT, null);
-        boolean trustAll = getOptionOrDefault(cmd, OPTION_TRUSTINSECURESSL_SHORT, false);
-        long timeoutms = getOptionOrDefault(cmd, OPTION_DATABASEWAIT_SHORT, 30) * 1000;
+        boolean trustAll = getOptionOrDefault(cmd, OPTION_TRUSTINSECURESSL_SHORT, DEFAULT_TRUSTINSECURESSL);
+        long timeoutms = getTimeoutOptionMillis(cmd);
         DataMigrationProviderImpl service = new DataMigrationProviderImpl(new HostInfo[] {HostInfo.parse(dbUrl)},
                 username, password, trustAll, timeoutms);
         if (!service.clearCompleteDatabase(timeoutms)) {
             throw new Exception("failed to init database");
         }
+        LOG.info("database complete clear completed successfully");
     }
 
     private static void cmd_init_db(CommandLine cmd) throws Exception {
-        Release r = getOptionOrDefault(cmd, OPTION_VERSION_SHORT, Release.CURRENT_RELEASE);
+        Release r = getOptionOrDefault(cmd, OPTION_VERSION_SHORT, (Release) null);
         int numShards = getOptionOrDefault(cmd, OPTION_SHARDS_SHORT, DEFAULT_SHARDS);
         int numReplicas = getOptionOrDefault(cmd, OPTION_REPLICAS_SHORT, DEFAULT_REPLICAS);
         String dbUrl = getOptionOrDefault(cmd, OPTION_DATABASE_SHORT, DEFAULT_DBURL);
         String dbPrefix = getOptionOrDefault(cmd, OPTION_DATABASEPREFIX_SHORT, DEFAULT_DBPREFIX);
         String username = getOptionOrDefault(cmd, OPTION_DATABASEUSER_SHORT, null);
         String password = getOptionOrDefault(cmd, OPTION_DATABASEPASSWORD_SHORT, null);
-        boolean trustAll = getOptionOrDefault(cmd, OPTION_TRUSTINSECURESSL_SHORT, false);
-        long timeoutms = getOptionOrDefault(cmd, OPTION_DATABASEWAIT_SHORT, 30) * 1000;
+        boolean trustAll = getOptionOrDefault(cmd, OPTION_TRUSTINSECURESSL_SHORT, DEFAULT_TRUSTINSECURESSL);
+        long timeoutms = getTimeoutOptionMillis(cmd);
         DataMigrationProviderImpl service = new DataMigrationProviderImpl(new HostInfo[] {HostInfo.parse(dbUrl)},
                 username, password, trustAll, timeoutms);
         boolean forceRecreate = cmd.hasOption(OPTION_FORCE_RECREATE_SHORT);
         if (!service.initDatabase(r, numShards, numReplicas, dbPrefix, forceRecreate, timeoutms)) {
             throw new Exception("failed to init database");
         }
+        LOG.info("database init completed successfully");
 
     }
 
     private static Options init() {
         Options result = new Options();
-        result.addOption(createOption(OPTION_COMMAND_SHORT, "cmd", true, "command to execute", false));
-        result.addOption(createOption(OPTION_DATABASE_SHORT, "dburl", true, "database url", false));
-        result.addOption(
-                createOption(OPTION_DATABASEUSER_SHORT, "db-username", true, "database basic auth username", false));
-        result.addOption(createOption(OPTION_DATABASEPASSWORD_SHORT, "db-password", true,
+        result.addOption(createOption(OPTION_COMMAND_SHORT, OPTION_COMMAND_LONG, true, "command to execute", false));
+        result.addOption(createOption(OPTION_DATABASE_SHORT, OPTION_DATABASE_LONG, true, "database url", false));
+        result.addOption(createOption(OPTION_DATABASEUSER_SHORT, OPTION_DATABASEUSER_LONG, true,
+                "database basic auth username", false));
+        result.addOption(createOption(OPTION_DATABASEPASSWORD_SHORT, OPTION_DATABASEPASSWORD_LONG, true,
                 "database basic auth password", false));
-        result.addOption(createOption(OPTION_REPLICAS_SHORT, "replicas", true, "amount of replicas", false));
-        result.addOption(createOption(OPTION_SHARDS_SHORT, "shards", true, "amount of shards", false));
-        result.addOption(createOption(OPTION_DATABASEPREFIX_SHORT, "prefix", true, "prefix for db indices", false));
-        result.addOption(createOption(OPTION_VERSION_SHORT, "version", true, "version", false));
-        result.addOption(createOption(OPTION_DEBUG_SHORT, "verbose", false, "verbose mode", false));
-        result.addOption(createOption(OPTION_TRUSTINSECURESSL_SHORT, "trust-insecure", false,
+        result.addOption(createOption(OPTION_REPLICAS_SHORT, OPTION_REPLICAS_LONG, true, "amount of replicas", false));
+        result.addOption(createOption(OPTION_SHARDS_SHORT, OPTION_SHARDS_LONG, true, "amount of shards", false));
+        result.addOption(createOption(OPTION_DATABASEPREFIX_SHORT, OPTION_DATABASEPREFIX_LONG, true,
+                "prefix for db indices", false));
+        result.addOption(createOption(OPTION_VERSION_SHORT, OPTION_VERSION_LONG, true, "version", false));
+        result.addOption(createOption(OPTION_DEBUG_SHORT, OPTION_DEBUG_LONG, false, "verbose mode", false));
+        result.addOption(createOption(OPTION_TRUSTINSECURESSL_SHORT, OPTION_TRUSTINSECURESSL_LONG, false,
                 "trust insecure ssl certs", false));
-        result.addOption(createOption(OPTION_DATABASEWAIT_SHORT, "wait", true,
+        result.addOption(createOption(OPTION_DATABASEWAIT_SHORT, OPTION_DATABASEWAIT_LONG, true,
                 "wait for yellow status with timeout in seconds", false));
-        result.addOption(
-                createOption(OPTION_FORCE_RECREATE_SHORT, "force-recreate", false, "delete if sth exists", false));
+        result.addOption(createOption(OPTION_FORCE_RECREATE_SHORT, OPTION_FORCE_RECREATE_LONG, false,
+                "delete if sth exists", false));
         result.addOption(createOption(OPTION_SILENT_SHORT, OPTION_SILENT, false, "prevent console output", false));
-        result.addOption(createOption(OPTION_OUTPUTFILE_SHORT, "output-file", true, "file to write into", false));
-        result.addOption(createOption(OPTION_INPUTFILE_SHORT, "input-file", true, "file to read from", false));
-        result.addOption(createOption(OPTION_HELP_SHORT, "help", false, "show help", false));
+        result.addOption(
+                createOption(OPTION_OUTPUTFILE_SHORT, OPTION_OUTPUTFILE_LONG, true, "file to write into", false));
+        result.addOption(createOption(OPTION_INPUTFILE_SHORT, OPTION_INPUTFILE_LONG, true, "file to read from", false));
+        result.addOption(createOption(OPTION_HELP_SHORT, OPTION_HELP_LONG, false, "show help", false));
         return result;
     }
 
+    private static long getTimeoutOptionMillis(CommandLine cmd) throws ParseException {
+        return getOptionOrDefault(cmd, OPTION_DATABASEWAIT_SHORT, DEFAULT_DATABASEWAIT_SECONDS) * 1000;
+    }
+
     /**
-     * @param opt
-     * @param longOpt
-     * @param hasArg
-     * @param description
-     * @param required
-     * @return
+     * create option for argparse lib
+     * 
+     * @param opt short option string
+     * @param longOpt long option string
+     * @param hasArg flag if has a parameter after option tag
+     * @param description description for help output
+     * @param required flag if is required for program
+     * @return option object for argparse lib
      */
     private static Option createOption(String opt, String longOpt, boolean hasArg, String description,
             boolean required) {
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 cb20025..d772dc2 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
@@ -33,7 +33,9 @@
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.SearchHitConverter;
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.elalto.ElAltoReleaseInformation;
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.frankfurt.FrankfurtReleaseInformation;
+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.guilin.GuilinReleaseInformationR2;
 
 public abstract class ReleaseInformation {
 
@@ -138,8 +140,12 @@
                 return new ElAltoReleaseInformation();
             case FRANKFURT_R1:
                 return new FrankfurtReleaseInformation();
-            case GUILIN:
+            case FRANKFURT_R2:
+                return new FrankfurtReleaseInformationR2();
+            case GUILIN_R1:
                 return new GuilinReleaseInformation();
+            case GUILIN_R2:
+                return new GuilinReleaseInformationR2();
             default:
                 return null;
         }
diff --git a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/DatabaseInfo.java b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/DatabaseInfo.java
index 4c38b50..51acd07 100644
--- a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/DatabaseInfo.java
+++ b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/DatabaseInfo.java
@@ -28,7 +28,7 @@
 public class DatabaseInfo {
     public final String doctype;
     public final String alias;
-    private final String mapping;
+    protected final String mapping;
     private final String settingsFormat;
     private final String index;
 
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/DataTreeObject.java b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/DatabaseInfo7.java
similarity index 60%
rename from sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/DataTreeObject.java
rename to sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/DatabaseInfo7.java
index 4333dcc..58b98c2 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/data/DataTreeObject.java
+++ b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/DatabaseInfo7.java
@@ -19,14 +19,26 @@
  * ============LICENSE_END=========================================================
  *
  */
-package org.onap.ccsdk.features.sdnr.wt.dataprovider.data;
-
-import java.util.HashMap;
+package org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data;
 
 /**
  * @author Michael Dürre
  *
  */
-public class DataTreeObject extends HashMap<String, DataTreeChildObject> {
+public class DatabaseInfo7 extends DatabaseInfo {
 
+    public DatabaseInfo7(String alias, String doctype, String mapping) {
+        super(alias, alias, doctype, mapping);
+    }
+
+    public DatabaseInfo7(String index, String alias, String doctype, String mapping, String settingsformat) {
+        super(index, alias, doctype, mapping, settingsformat);
+    }
+
+    @Override
+    public String getMapping(boolean useStrict) {
+        return this.mapping == null ? null
+                : String.format("{%s\"properties\":%s}", useStrict ? "\"dynamic\": false," : "\"dynamic\": true,",
+                        this.mapping);
+    }
 }
diff --git a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/MavenDatabasePluginInitFile.java b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/MavenDatabasePluginInitFile.java
index 66a5e16..3f6334a 100644
--- a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/MavenDatabasePluginInitFile.java
+++ b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/MavenDatabasePluginInitFile.java
@@ -50,6 +50,7 @@
         ReleaseInformation ri = ReleaseInformation.getInstance(release);
         Set<ComponentName> comps = ri.getComponents();
         List<String> lines = new ArrayList<>();
+        lines.add("PUT:_cluster/settings/:{\"persistent\":{\"action.auto_create_index\":\"true\"}}");
         for (ComponentName c : comps) {
             lines.add(String.format("PUT:%s/:{" + settings + "," + mappings + "}", ri.getIndex(c), shards, replicas,
                     ri.getDatabaseMapping(c)));
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 13c6047..b2442df 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
@@ -27,11 +27,12 @@
 public enum Release {
 
     EL_ALTO("el alto", "_v1", new EsVersion(2, 2, 0), new EsVersion(2, 2, 0)), FRANKFURT_R1("frankfurt-R1", "-v2",
-            new EsVersion(6, 4, 3), new EsVersion(6, 8, 6)), FRANKFURT_R2("frankfurt-R2", "", new EsVersion(6, 4, 3),
-                    new EsVersion(6, 8, 6)), FRANKFURT_R3("frankfurt-R3", "", new EsVersion(6, 4, 3),
-                            new EsVersion(6, 8, 6)),
+            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)),
+    //FRANKFURT_R3("frankfurt-R3","",new EsVersion(6,4,3),new EsVersion(6,8,6)),
 
-    GUILIN("guilin", "", new EsVersion(6, 4, 3), new EsVersion(6, 8, 6));
+    GUILIN_R1("guilin-R1", "-v4", new EsVersion(6, 4, 3), new EsVersion(6, 8, 6)), GUILIN_R2("guilin-R2", "-v5",
+            new EsVersion(7, 0, 1), new EsVersion(7, 6, 1));
 
     public static final Release CURRENT_RELEASE = Release.FRANKFURT_R1;
 
@@ -67,6 +68,9 @@
     }
 
     public static Release getValueBySuffix(String suffix) {
+        if (!suffix.startsWith("-")) {
+            suffix = "-" + suffix;
+        }
         for (Release r : Release.values()) {
             if (r.dbSuffix.equals(suffix))
                 return r;
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
new file mode 100644
index 0000000..c7d26db
--- /dev/null
+++ b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/ReleaseGroup.java
@@ -0,0 +1,66 @@
+/*
+ * ============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.data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.onap.ccsdk.features.sdnr.wt.common.database.data.EsVersion;
+
+/**
+ * @author Michael Dürre
+ *
+ */
+public enum ReleaseGroup {
+
+    EL_ALTO(Release.EL_ALTO), FRANKFURT(Release.FRANKFURT_R1, Release.FRANKFURT_R2), GUILIN(Release.GUILIN_R1,
+            Release.GUILIN_R2);
+
+    public static final ReleaseGroup CURRENT_RELEASE = FRANKFURT;
+
+    private final List<Release> releases;
+
+    ReleaseGroup(Release... values) {
+        this.releases = new ArrayList<Release>();
+        if (values != null) {
+            for (Release r : values) {
+                this.releases.add(r);
+            }
+        }
+    }
+
+    /**
+     * @param dbVersion
+     * @return
+     */
+    public Release getLatestCompatibleRelease(EsVersion dbVersion) {
+        Release match = null;
+        for (Release r : this.releases) {
+            if (r.isDbInRange(dbVersion)) {
+                match = r;
+            }
+        }
+        return match;
+    }
+
+
+}
diff --git a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/SearchHitConverter.java b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/SearchHitConverter.java
index a95a405..87c4d64 100644
--- a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/SearchHitConverter.java
+++ b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/data/SearchHitConverter.java
@@ -22,9 +22,7 @@
 package org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data;
 
 import org.onap.ccsdk.features.sdnr.wt.common.database.SearchHit;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.elalto.ElAltoReleaseInformation;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.frankfurt.FrankfurtReleaseInformation;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.guilin.GuilinReleaseInformation;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.ReleaseInformation;
 
 public interface SearchHitConverter {
 
@@ -46,17 +44,8 @@
 
     public static class Factory {
         public static SearchHitConverter getInstance(Release src, Release dst, ComponentName component) {
-            switch (src) {
-                case EL_ALTO:
-                    return new ElAltoReleaseInformation().getConverter(dst, component);
-                case FRANKFURT_R1:
-                    return new FrankfurtReleaseInformation().getConverter(dst, component);
-                case GUILIN:
-                    return new GuilinReleaseInformation().getConverter(dst, component);
-                default:
-                    return null;
-
-            }
+            ReleaseInformation ri = ReleaseInformation.getInstance(src);
+            return ri != null ? ri.getConverter(dst, component) : null;
         }
     }
 
diff --git a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/frankfurt/FrankfurtReleaseInformation.java b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/frankfurt/FrankfurtReleaseInformation.java
index ad0abee..7b8c40b 100644
--- a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/frankfurt/FrankfurtReleaseInformation.java
+++ b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/frankfurt/FrankfurtReleaseInformation.java
@@ -86,7 +86,7 @@
 
         ClusterSettingsResponse response = null;
         try {
-            response = dbClient.setupClusterSettings(new ClusterSettingsRequest(false));
+            response = dbClient.setupClusterSettings(new ClusterSettingsRequest(false).maxCompilationsPerMinute(400));
         } catch (IOException e) {
             LOG.warn("problem setting up cluster: {}", e);
         }
diff --git a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/frankfurt/FrankfurtReleaseInformationR2.java b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/frankfurt/FrankfurtReleaseInformationR2.java
new file mode 100644
index 0000000..e842b5c
--- /dev/null
+++ b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/frankfurt/FrankfurtReleaseInformationR2.java
@@ -0,0 +1,102 @@
+/*
+ * ============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.frankfurt;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+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.Release;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.SearchHitConverter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+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;
+
+public class FrankfurtReleaseInformationR2 extends ReleaseInformation {
+
+    private final Logger LOG = LoggerFactory.getLogger(FrankfurtReleaseInformationR2.class);
+    private final Map<Release, Map<ComponentName, SearchHitConverter>> converters = new HashMap<>();
+
+    public FrankfurtReleaseInformationR2() {
+        super(Release.FRANKFURT_R2, createDBMap());
+    }
+
+    private static Map<ComponentName, DatabaseInfo> createDBMap() {
+        Map<ComponentName, DatabaseInfo> map = new HashMap<>();
+        map.put(ComponentName.CONNECTIONLOG, new DatabaseInfo7("connectionlog", "connectionlog",
+                "{\"node-id\": {\"type\": \"keyword\"},\"timestamp\": {\"type\": \"date\"},\"status\": {\"type\": \"keyword\"}}"));
+        map.put(ComponentName.EVENTLOG, new DatabaseInfo7("eventlog", "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\"}}"));
+        map.put(ComponentName.FAULTCURRENT, new DatabaseInfo7("faultcurrent", "faultcurrent",
+                "{\"node-id\": {\"type\": \"keyword\"},\"severity\": {\"type\": \"keyword\"},\"timestamp\": {\"type\": \"date\"},\"problem\": {\"type\": \"keyword\"},\"counter\": {\"type\": \"long\"},\"object-id\":{\"type\": \"keyword\"}}"));
+        map.put(ComponentName.FAULTLOG, new DatabaseInfo7("faultlog", "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\"}}"));
+        map.put(ComponentName.INVENTORY, new DatabaseInfo7("inventoryequipment", "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\"}}"));
+        map.put(ComponentName.HISTORICAL_PERFORMANCE_15M, new DatabaseInfo7("historicalperformance15min",
+                "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\"}}"));
+        map.put(ComponentName.HISTORICAL_PERFORMANCE_24H, new DatabaseInfo7("historicalperformance24h",
+                "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\"}}"));
+        map.put(ComponentName.REQUIRED_NETWORKELEMENT, new DatabaseInfo7("networkelement-connection",
+                "networkelement-connection",
+                "{\"node-id\": {\"type\": \"keyword\"},\"host\": {\"type\": \"keyword\"},\"port\": {\"type\": \"long\"},\"username\": {\"type\": \"keyword\"},\"password\": {\"type\": \"keyword\"},\"core-model-capability\": {\"type\": \"keyword\"},\"device-type\": {\"type\": \"keyword\"},\"is-required\": {\"type\": \"boolean\"},\"status\": {\"type\": \"keyword\"}}"));
+        map.put(ComponentName.MEDIATOR_SERVER, new DatabaseInfo7("mediator-server", "mediator-server",
+                "{\"url\":{\"type\": \"keyword\"},\"name\":{\"type\": \"keyword\"}}"));
+        map.put(ComponentName.MAINTENANCE, new DatabaseInfo7("maintenancemode", "maintenancemode",
+                "{\"node-id\": {\"type\": \"keyword\"},\"start\": {\"type\": \"date\"},\"end\": {\"type\": \"date\"},\"description\": {\"type\": \"keyword\"},\"active\": {\"type\": \"boolean\"}},\"date_detection\":false}}"));
+        return map;
+    }
+
+    @Override
+    public SearchHitConverter getConverter(Release dst, ComponentName comp) {
+        SearchHitConverter c = this.converters.containsKey(dst) ? this.converters.get(dst).get(comp) : null;
+        if (c == null) {
+            c = super.getConverter(dst, comp);
+        }
+        return c;
+    }
+
+    @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/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/guilin/GuilinReleaseInformation.java b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/guilin/GuilinReleaseInformation.java
index a81a6f0..2c2ac25 100644
--- a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/guilin/GuilinReleaseInformation.java
+++ b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/guilin/GuilinReleaseInformation.java
@@ -22,16 +22,15 @@
 package org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.guilin;
 
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
+import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient;
+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.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.common.database.HtDatabaseClient;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.ReleaseInformation;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.DatabaseInfo;
 
 public class GuilinReleaseInformation extends ReleaseInformation {
 
@@ -40,7 +39,7 @@
      * @param dbMap
      */
     public GuilinReleaseInformation() {
-        super(Release.GUILIN, createDBMap());
+        super(Release.GUILIN_R1, createDBMap());
 
     }
 
@@ -63,7 +62,7 @@
 
     @Override
     public SearchHitConverter getConverter(Release dst, ComponentName comp) {
-        if (dst == Release.GUILIN) {
+        if (dst == Release.GUILIN_R1) {
             return new KeepDataSearchHitConverter(comp);
         }
         return null;
diff --git a/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/guilin/GuilinReleaseInformationR2.java b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/guilin/GuilinReleaseInformationR2.java
new file mode 100644
index 0000000..29c79f3
--- /dev/null
+++ b/sdnr/wt/data-provider/setup/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/guilin/GuilinReleaseInformationR2.java
@@ -0,0 +1,81 @@
+/*
+ * ============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.guilin;
+
+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.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.KeepDataSearchHitConverter;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.Release;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.SearchHitConverter;
+
+public class GuilinReleaseInformationR2 extends ReleaseInformation {
+
+    /**
+     * @param r
+     * @param dbMap
+     */
+    public GuilinReleaseInformationR2() {
+        super(Release.GUILIN_R2, createDBMap());
+
+    }
+
+    private static Map<ComponentName, DatabaseInfo> createDBMap() {
+        Map<ComponentName, DatabaseInfo> map = new HashMap<>();
+        map.put(ComponentName.EVENTLOG, new DatabaseInfo("eventlog", "eventlog", ""));
+        map.put(ComponentName.FAULTCURRENT, new DatabaseInfo("faultcurrent", "faultcurrent", ""));
+        map.put(ComponentName.FAULTLOG, new DatabaseInfo("faultlog", "faultlog", ""));
+        map.put(ComponentName.INVENTORY, new DatabaseInfo("inventoryequipment", "inventoryequipment", ""));
+        map.put(ComponentName.HISTORICAL_PERFORMANCE_15M,
+                new DatabaseInfo("historicalperformance15min", "historicalperformance15min", ""));
+        map.put(ComponentName.HISTORICAL_PERFORMANCE_24H,
+                new DatabaseInfo("historicalperformance24h", "historicalperformance24h", ""));
+        map.put(ComponentName.REQUIRED_NETWORKELEMENT,
+                new DatabaseInfo("networkelement-connection", "networkelement-connection", ""));
+        map.put(ComponentName.MEDIATOR_SERVER, new DatabaseInfo("mediator-server", "mediator-server", ""));
+        map.put(ComponentName.MAINTENANCE, new DatabaseInfo("maintenancemode", "maintenancemode", ""));
+        return map;
+    }
+
+    @Override
+    public SearchHitConverter getConverter(Release dst, ComponentName comp) {
+        if (dst == Release.GUILIN_R2) {
+            return new KeepDataSearchHitConverter(comp);
+        }
+        return null;
+    }
+
+    @Override
+    protected boolean runPreInitCommands(HtDatabaseClient dbClient) {
+        return true;
+    }
+
+    @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/TestData.java b/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestData.java
index c786456..ab0510c 100644
--- a/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestData.java
+++ b/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestData.java
@@ -48,32 +48,79 @@
  *
  */
 public class TestData {
-    private static final JSONObject EVENTLOG_SEARCHHIT = new JSONObject("{\n" + "\"_index\": \"sdnevents_v1\",\n"
-            + "\"_type\": \"eventlog\",\n" + "\"_id\": \"AXB7cJHlZ_FApnwi29xq\",\n" + "\"_version\": 1,\n"
-            + "\"_score\": 1,\n" + "\"_source\": {\n" + "\"event\": {\n"
-            + "\"nodeName\": \"SDN-Controller-465e2ae306ca\",\n" + "\"counter\": \"1\",\n"
-            + "\"timeStamp\": \"2020-02-25T08:22:19.8Z\",\n" + "\"objectId\": \"sim2230\",\n"
-            + "\"attributeName\": \"ConnectionStatus\",\n" + "\"newValue\": \"connecting\",\n"
-            + "\"type\": \"AttributeValueChangedNotificationXml\"\n" + "}\n" + "}\n" + "}");
-    private static final JSONObject EVENTLOG_SEARCHHIT2 = new JSONObject("{\n" + "\"_index\": \"sdnevents_v1\",\n"
-            + "\"_type\": \"eventlog\",\n" + "\"_id\": \"AXB7cJHlZ_FApnwi29xq\",\n" + "\"_version\": 1,\n"
-            + "\"_score\": 1,\n" + "\"_source\": {\n" + "\"event\": {\n"
-            + "\"nodeName\": \"SDN-Controller-465e2ae306ca\",\n" + "\"counter\": \"3\",\n"
-            + "\"timeStamp\": \"2020-02-22T08:22:19.8Z\",\n" + "\"objectId\": \"sim2230\",\n"
-            + "\"attributeName\": \"ConnectionStatus\",\n" + "\"newValue\": \"connected\",\n"
-            + "\"type\": \"AttributeValueChangedNotificationXml\"\n" + "}\n" + "}\n" + "}");
-    private static final String CONFIG_CONTENT = "[dcae]\n" + "dcaeUserCredentials=admin:admin\n" + "dcaeUrl=off\n"
-            + "dcaeHeartbeatPeriodSeconds=120\n" + "dcaeTestCollector=no\n" + "\n" + "[es]\n"
-            + "esCluster=sendateodl5\n" + "#time limit to keep increasing data in database [in seconds]\n"
-            + "#60*60*24*30 (30days)\n" + "esArchiveLimit=2592000\n" + "#folder where removed data will be stored\n"
-            + "esArchiveFolder=./backup\n" + "#interval to archive database [in seconds]\n" + "#60*60*24 (1day)\n"
-            + "esArchiveInterval=86400\n" + "\n" + "[aai]\n" + "#keep comment\n"
-            + "aaiHeaders=[\"X-TransactionId: 9999\"]\n" + "aaiUrl=http://localhost:81\n"
-            + "aaiUserCredentials=AAI:AAI\n" + "aaiDeleteOnMountpointRemove=false\n" + "aaiTrustAllCerts=false\n"
-            + "aaiApiVersion=aai/v13\n" + "aaiPropertiesFile=aaiclient.properties\n" + "aaiApplicationId=SDNR\n"
+    // @formatter:off 
+    private static final JSONObject EVENTLOG_SEARCHHIT = new JSONObject("{\n"
+            + "\"_index\": \"sdnevents_v1\",\n"
+            + "\"_type\": \"eventlog\",\n"
+            + "\"_id\": \"AXB7cJHlZ_FApnwi29xq\",\n"
+            + "\"_version\": 1,\n"
+            + "\"_score\": 1,\n"
+            + "\"_source\": {\n"
+            + "\"event\": {\n"
+            + "\"nodeName\": \"SDN-Controller-465e2ae306ca\",\n"
+            + "\"counter\": \"1\",\n"
+            + "\"timeStamp\": \"2020-02-25T08:22:19.8Z\",\n"
+            + "\"objectId\": \"sim2230\",\n"
+            + "\"attributeName\": \"ConnectionStatus\",\n"
+            + "\"newValue\": \"connecting\",\n"
+            + "\"type\": \"AttributeValueChangedNotificationXml\"\n"
+            + "}\n"
+            + "}\n"
+            + "}");
+    private static final JSONObject EVENTLOG_SEARCHHIT2 = new JSONObject("{\n"
+            + "\"_index\": \"sdnevents_v1\",\n"
+            + "\"_type\": \"eventlog\",\n"
+            + "\"_id\": \"AXB7cJHlZ_FApnwi29xq\",\n"
+            + "\"_version\": 1,\n"
+            + "\"_score\": 1,\n"
+            + "\"_source\": {\n"
+            + "\"event\": {\n"
+            + "\"nodeName\": \"SDN-Controller-465e2ae306ca\",\n"
+            + "\"counter\": \"3\",\n"
+            + "\"timeStamp\": \"2020-02-22T08:22:19.8Z\",\n"
+            + "\"objectId\": \"sim2230\",\n"
+            + "\"attributeName\": \"ConnectionStatus\",\n"
+            + "\"newValue\": \"connected\",\n"
+            + "\"type\": \"AttributeValueChangedNotificationXml\"\n"
+            + "}\n"
+            + "}\n"
+            + "}");
+    private static final String CONFIG_CONTENT = "[dcae]\n"
+            + "dcaeUserCredentials=admin:admin\n"
+            + "dcaeUrl=off\n"
+            + "dcaeHeartbeatPeriodSeconds=120\n"
+            + "dcaeTestCollector=no\n"
+            + "\n"
+            + "[es]\n"
+            + "esCluster=sendateodl5\n"
+            + "#time limit to keep increasing data in database [in seconds]\n"
+            + "#60*60*24*30 (30days)\n"
+            + "esArchiveLimit=2592000\n"
+            + "#folder where removed data will be stored\n"
+            + "esArchiveFolder=./backup\n"
+            + "#interval to archive database [in seconds]\n"
+            + "#60*60*24 (1day)\n"
+            + "esArchiveInterval=86400\n"
+            + "\n"
+            + "[aai]\n"
+            + "#keep comment\n"
+            + "aaiHeaders=[\"X-TransactionId: 9999\"]\n"
+            + "aaiUrl=http://localhost:81\n"
+            + "aaiUserCredentials=AAI:AAI\n"
+            + "aaiDeleteOnMountpointRemove=false\n"
+            + "aaiTrustAllCerts=false\n"
+            + "aaiApiVersion=aai/v13\n"
+            + "aaiPropertiesFile=aaiclient.properties\n"
+            + "aaiApplicationId=SDNR\n"
             + "aaiPcks12ClientCertFile=/opt/logs/externals/data/stores/keystore.client.p12\n"
-            + "aaiPcks12ClientCertPassphrase=adminadmin\n" + "aaiClientConnectionTimeout=30000\n" + "\n" + "[pm]\n"
-            + "pmCluster=sendateodl5\n" + "pmEnabled=true\n" + "";
+            + "aaiPcks12ClientCertPassphrase=adminadmin\n"
+            + "aaiClientConnectionTimeout=30000\n"
+            + "\n"
+            + "[pm]\n"
+            + "pmCluster=sendateodl5\n"
+            + "pmEnabled=true\n"
+            + "";
+    // @formatter:on 
 
     @Test
     public void testComponentData() {
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 02877f0..3243841 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
@@ -27,7 +27,6 @@
 
 import org.junit.Test;
 import org.onap.ccsdk.features.sdnr.wt.common.database.config.HostInfo;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.DataMigrationProviderImpl;
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.DataMigrationReport;
 import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.Release;
 
@@ -42,16 +41,20 @@
             .valueOf(System.getProperty("databaseport") != null ? System.getProperty("databaseport") : "49200"))};
 
     @Test
-    public void testCreateImport() {
+    public void testCreateImport() throws Exception {
         DataMigrationProviderImpl provider = new DataMigrationProviderImpl(hosts, null, null, true, 5000);
 
         try {
+
+
             //create el alto db infrastructure
-            provider.initDatabase(Release.FRANKFURT_R1, 5, 1, "", true, 10000);
+            if (!provider.initDatabase(null, 5, 1, "", true, 10000)) {
+                fail("unable to init database");
+            }
             //import data into database
-            DataMigrationReport report = provider.importData(FRANKFURT_BACKUP_FILE, false, Release.FRANKFURT_R1);
+            DataMigrationReport report = provider.importData(FRANKFURT_BACKUP_FILE, false, Release.FRANKFURT_R2);
             assertTrue(report.completed());
-            assertEquals(Release.FRANKFURT_R1, provider.autoDetectRelease());
+            assertEquals(Release.FRANKFURT_R2, provider.autoDetectRelease());
         } catch (Exception e) {
             fail(e.getMessage());
         }
diff --git a/sdnr/wt/data-provider/setup/tmp.log b/sdnr/wt/data-provider/setup/tmp.log
deleted file mode 100644
index d2c5a87..0000000
--- a/sdnr/wt/data-provider/setup/tmp.log
+++ /dev/null
@@ -1 +0,0 @@
-{"configs":{},"components":{},"release":"frankfurt-R1","created":"2020-02-25T05:29:35.3Z"}
