aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/data-provider
diff options
context:
space:
mode:
authorMichael Dürre <michael.duerre@highstreet-technologies.com>2022-07-20 09:32:50 +0200
committerMichael Dürre <michael.duerre@highstreet-technologies.com>2022-07-21 12:38:52 +0200
commit25423c50e504676f15c7a57c03aad40bfc35c7e6 (patch)
tree811649e2ec44e0332e601c6563e00e914d355b9a /sdnr/wt/data-provider
parentcea47224b7b6afdd7b3d3ead8d08baf46eadc575 (diff)
migrate sdnr features to sulfur
fix sdnr code for sulfur Issue-ID: CCSDK-3692 Signed-off-by: Michael Dürre <michael.duerre@highstreet-technologies.com> Change-Id: I0a62ade424bb978222e7ce6450215fb327f957b7 Signed-off-by: Michael Dürre <michael.duerre@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/data-provider')
-rw-r--r--sdnr/wt/data-provider/dblib/pom.xml3
-rw-r--r--sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/DatabaseDataProvider.java3
-rw-r--r--sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/SqlDBDataProvider.java14
-rw-r--r--sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/rpctypehelper/QueryResult.java8
-rw-r--r--sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/database/SqlDBMapper.java23
-rw-r--r--sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/database/SqlDBStatusReader.java16
-rw-r--r--sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/SelectQuery.java5
-rw-r--r--sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/SqlQuery.java31
-rw-r--r--sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/filters/RegexSqlDBFilter.java9
-rw-r--r--sdnr/wt/data-provider/dblib/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/dblib/test/TestMariaDataProvider.java6
-rw-r--r--sdnr/wt/data-provider/dblib/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/dblib/test/TestQuerySyntax.java27
-rw-r--r--sdnr/wt/data-provider/feature/pom.xml3
-rwxr-xr-xsdnr/wt/data-provider/installer/pom.xml3
-rw-r--r--sdnr/wt/data-provider/model/pom.xml5
-rw-r--r--sdnr/wt/data-provider/model/src/main/yang/data-provider@2020-11-10.yang3
-rwxr-xr-xsdnr/wt/data-provider/pom.xml3
-rw-r--r--sdnr/wt/data-provider/provider/pom.xml7
-rw-r--r--sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/EsDataObjectReaderWriter2.java27
-rw-r--r--sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/acessor/DataObjectAcessorStatus.java11
-rw-r--r--sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/impl/ElasticSearchDataProvider.java13
-rw-r--r--sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/impl/HtUserdataManagerImpl.java5
-rw-r--r--sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/nodb/NoDbDatabaseDataProvider.java4
-rw-r--r--sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/ODLVersionLUT.java5
-rw-r--r--sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/DataProviderServiceImpl.java32
-rw-r--r--sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestCRUDforDatabase.java146
-rw-r--r--sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestYangGenSalMapping.java5
-rw-r--r--sdnr/wt/data-provider/setup/pom.xml7
-rw-r--r--sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/MariaDBTestBase.java3
-rw-r--r--sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestMariaDBMapper.java8
29 files changed, 295 insertions, 140 deletions
diff --git a/sdnr/wt/data-provider/dblib/pom.xml b/sdnr/wt/data-provider/dblib/pom.xml
index 3e7329056..073d95ac8 100644
--- a/sdnr/wt/data-provider/dblib/pom.xml
+++ b/sdnr/wt/data-provider/dblib/pom.xml
@@ -22,13 +22,14 @@
~ ============LICENSE_END=======================================================
~
-->
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>binding-parent</artifactId>
- <version>2.4.0</version>
+ <version>2.4.1-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/DatabaseDataProvider.java b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/DatabaseDataProvider.java
index 20b86e661..fbd105aa1 100644
--- a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/DatabaseDataProvider.java
+++ b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/DatabaseDataProvider.java
@@ -48,6 +48,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.pro
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadEventlogListOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadFaultcurrentListOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadFaultlogListOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadGuiCutThroughEntryOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadGuiCutThroughEntryOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadInventoryListOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadMaintenanceListOutputBuilder;
@@ -102,7 +103,7 @@ public interface DatabaseDataProvider {
ReadPmdata24hDeviceListOutputBuilder readPmdata24hDeviceList(EntityInput input) throws IOException;
- ReadStatusOutputBuilder readStatus() throws IOException;
+ ReadStatusOutputBuilder readStatus(EntityInput input) throws IOException;
boolean waitForYellowDatabaseStatus(long timeout, TimeUnit unit);
diff --git a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/SqlDBDataProvider.java b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/SqlDBDataProvider.java
index 1bb30dc69..cabe6bed0 100644
--- a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/SqlDBDataProvider.java
+++ b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/SqlDBDataProvider.java
@@ -297,7 +297,7 @@ public class SqlDBDataProvider extends HtDatabaseEventsService implements Databa
outputBuilder.setPagination(
new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.pmdata._15m.ltp.list.output.PaginationBuilder(
result.getPagination()).build());
- outputBuilder.setData(result.getResult());
+ outputBuilder.setData(result.getResultSet());
return outputBuilder;
}
@@ -308,7 +308,7 @@ public class SqlDBDataProvider extends HtDatabaseEventsService implements Databa
outputBuilder.setPagination(
new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.pmdata._15m.device.list.output.PaginationBuilder(
result.getPagination()).build());
- outputBuilder.setData(result.getResult());
+ outputBuilder.setData(result.getResultSet());
return outputBuilder;
}
@@ -322,7 +322,7 @@ public class SqlDBDataProvider extends HtDatabaseEventsService implements Databa
outputBuilder.setPagination(
new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.pmdata._24h.ltp.list.output.PaginationBuilder(
result.getPagination()).build());
- outputBuilder.setData(result.getResult());
+ outputBuilder.setData(result.getResultSet());
return outputBuilder;
}
@@ -335,14 +335,14 @@ public class SqlDBDataProvider extends HtDatabaseEventsService implements Databa
outputBuilder.setPagination(
new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.pmdata._24h.device.list.output.PaginationBuilder(
result.getPagination()).build());
- outputBuilder.setData(result.getResult());
+ outputBuilder.setData(result.getResultSet());
return outputBuilder;
}
@Override
- public ReadStatusOutputBuilder readStatus() throws IOException {
+ public ReadStatusOutputBuilder readStatus(EntityInput input) throws IOException {
QueryResult<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.status.output.Data> result =
- readStatus.getDataStatus();
+ readStatus.getDataStatus(input);
ReadStatusOutputBuilder outputBuilder = new ReadStatusOutputBuilder();
outputBuilder.setData(result.getResult());
@@ -352,7 +352,7 @@ public class SqlDBDataProvider extends HtDatabaseEventsService implements Databa
@Override
public CreateNetworkElementConnectionOutputBuilder createNetworkElementConnection(
NetworkElementConnectionEntity input) throws IOException {
- String id = this.networkelementConnectionRW.write(input, input.getNodeId());
+ String id = this.networkelementConnectionRW.updateOrInsert(input, input.getNodeId());
if (id == null) {
throw new IOException(EXCEPTION_UNABLE_TO_WRITE_IN_DATABASE);
}
diff --git a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/rpctypehelper/QueryResult.java b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/rpctypehelper/QueryResult.java
index c81725073..db4e980af 100644
--- a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/rpctypehelper/QueryResult.java
+++ b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/rpctypehelper/QueryResult.java
@@ -22,7 +22,10 @@
package org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.data.rpctypehelper;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
+
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.PaginationOutputG;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.connectionlog.list.output.PaginationBuilder;
import org.opendaylight.yangtools.yang.common.Uint32;
@@ -43,8 +46,11 @@ public class QueryResult<T> {
pagination = x.build();
}
+ public Set<T> getResultSet() {
+ return new HashSet<>(this.result);
+ }
public List<T> getResult() {
- return result;
+ return this.result;
}
public PaginationOutputG getPagination() {
diff --git a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/database/SqlDBMapper.java b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/database/SqlDBMapper.java
index 19323b9f7..1c24636db 100644
--- a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/database/SqlDBMapper.java
+++ b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/database/SqlDBMapper.java
@@ -33,6 +33,8 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
+
import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.query.filters.DBKeyValuePair;
import org.onap.ccsdk.features.sdnr.wt.yang.mapper.YangToolsMapper;
import org.onap.ccsdk.features.sdnr.wt.yang.mapper.YangToolsMapperHelper;
@@ -40,7 +42,6 @@ import org.onap.ccsdk.features.sdnr.wt.yang.mapper.mapperextensions.YangToolsBui
import org.onap.ccsdk.features.sdnr.wt.yang.mapper.mapperextensions.YangToolsDeserializerModifier;
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.rev201110.Entity;
-import org.opendaylight.yangtools.concepts.Builder;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.Enumeration;
import org.opendaylight.yangtools.yang.common.Uint16;
@@ -223,7 +224,7 @@ public class SqlDBMapper {
String type = mariaDBTypeMap.getOrDefault(valueType, null);
if (type == null) {
if (implementsInterface(valueType, DataObject.class) || implementsInterface(valueType, List.class)
- || implementsInterface(valueType, Map.class)) {
+ || implementsInterface(valueType, Map.class) || implementsInterface(valueType, Set.class)) {
return "JSON";
}
if (implementsInterface(valueType, Enumeration.class)) {
@@ -352,13 +353,13 @@ public class SqlDBMapper {
}
@SuppressWarnings("unchecked")
- public static <T> List<T> read(ResultSet data, Class<T> clazz, String column)
+ public static <S,T> List<T> read(ResultSet data, Class<T> clazz, String column)
throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, SQLException,
InstantiationException, SecurityException, NoSuchMethodException, JsonProcessingException {
if(data==null) {
return Arrays.asList();
}
- Builder<T> builder = findPOJOBuilder(clazz);
+ S builder = findPOJOBuilder(clazz);
if(builder==null && column==null) {
throw new InstantiationException("unable to find builder for class "+clazz.getName());
}
@@ -374,7 +375,7 @@ public class SqlDBMapper {
m.setAccessible(true);
m.invoke(builder, getValueOrDefault(data, col, argType, null));
}
- list.add(builder.build());
+ list.add(callBuild(builder));
} else {
Object value = getValueOrDefault(data, column, clazz, null);
if (value != null) {
@@ -386,7 +387,13 @@ public class SqlDBMapper {
}
@SuppressWarnings("unchecked")
- private static <T> Builder<T> findPOJOBuilder(Class<T> ac) throws InstantiationException, IllegalAccessException,
+ private static <S,T> T callBuild(S builder) throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ Method method = builder.getClass().getMethod("build");
+ return (T) method.invoke(builder);
+ }
+
+ @SuppressWarnings("unchecked")
+ private static <S,T> S findPOJOBuilder(Class<T> ac) throws InstantiationException, IllegalAccessException,
IllegalArgumentException, InvocationTargetException, SecurityException, NoSuchMethodException {
try {
String builder = null;
@@ -400,8 +407,8 @@ public class SqlDBMapper {
}
if (builder != null) {
Class<?> innerBuilder = YangToolsMapperHelper.findClass(builder);
- Class<Builder<T>> builderClass = (Class<Builder<T>>) innerBuilder;
- return builderClass.getDeclaredConstructor().newInstance();
+ //Class<Builder<T>> builderClass = (Class<Builder<T>>) innerBuilder;
+ return (S) innerBuilder.getDeclaredConstructor().newInstance();
}
} catch (ClassNotFoundException e) {
diff --git a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/database/SqlDBStatusReader.java b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/database/SqlDBStatusReader.java
index b0b169d18..75d8c9ad2 100644
--- a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/database/SqlDBStatusReader.java
+++ b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/database/SqlDBStatusReader.java
@@ -24,11 +24,16 @@ package org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.database;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Arrays;
+import java.util.Map;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.SqlDBClient;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.data.rpctypehelper.QueryResult;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.query.SqlQuery;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ConnectionLogStatus;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Entity;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EntityInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.entity.input.Filter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.entity.input.FilterKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.status.output.Data;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.status.output.DataBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.status.entity.FaultsBuilder;
@@ -49,8 +54,8 @@ public class SqlDBStatusReader {
this.controllerId = controllerId;
}
- public QueryResult<Data> getDataStatus() {
- String selectQuery = createCountQuery("severity", Entity.Faultcurrent, this.controllerId);
+ public QueryResult<Data> getDataStatus(EntityInput input) {
+ String selectQuery = createCountQuery("severity", Entity.Faultcurrent, this.controllerId, input);
long criticalCount = 0;
long majorCount = 0;
long minorCount = 0;
@@ -81,7 +86,7 @@ public class SqlDBStatusReader {
DataBuilder builder = new DataBuilder().setFaults(
new FaultsBuilder().setCriticals(Uint32.valueOf(criticalCount)).setMajors(Uint32.valueOf(majorCount))
.setMinors(Uint32.valueOf(minorCount)).setWarnings(Uint32.valueOf(warningCount)).build());
- selectQuery = createCountQuery("status", Entity.NetworkelementConnection, this.controllerId);
+ selectQuery = createCountQuery("status", Entity.NetworkelementConnection, this.controllerId, input);
NetworkElementConnectionsBuilder neBuilder = new NetworkElementConnectionsBuilder();
String state;
long connectedCount = 0, connectingCount = 0, disconnectedCount = 0, mountedCount = 0, unableToConnectCount = 0,
@@ -123,10 +128,11 @@ public class SqlDBStatusReader {
return new QueryResult<Data>(Arrays.asList(builder.build()), 1, 1, 1);
}
- private static String createCountQuery(String key, Entity e, String controllerId) {
+ private static String createCountQuery(String key, Entity e, String controllerId, EntityInput input) {
+ Map<FilterKey, Filter> filter = input != null ? input.getFilter() : null;
return String.format("SELECT `%s`, COUNT(`%s`) " + "FROM `%s` " + "%s " + "GROUP BY `%s`;", key, key,
e.getName(),
- controllerId != null ? String.format("WHERE `%s`='%s'", SqlDBMapper.ODLID_DBCOL, controllerId) : "",
+ SqlQuery.getWhereExpression(filter!=null?filter.values():null, controllerId),
key);
}
diff --git a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/SelectQuery.java b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/SelectQuery.java
index 6403a5c1d..a4df26bae 100644
--- a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/SelectQuery.java
+++ b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/SelectQuery.java
@@ -25,6 +25,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.stream.Collectors;
import org.eclipse.jdt.annotation.Nullable;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.database.SqlDBMapper;
@@ -114,7 +115,7 @@ public class SelectQuery implements SqlQuery {
private static Filter cleanFilter(Filter filter) {
final String sFilter = filter.getFiltervalue();
- final List<String> sFilters = filter.getFiltervalues();
+ final Set<String> sFilters = filter.getFiltervalues();
//if only single filter value is set
if (sFilter != null && (sFilters == null || sFilter.isEmpty())) {
return "*".equals(filter.getFiltervalue()) ? null : filter;
@@ -128,7 +129,7 @@ public class SelectQuery implements SqlQuery {
} ;
return new FilterBuilder().setProperty(filter.getProperty()).setFiltervalue(filter.getFiltervalue())
.setFiltervalues(
- filter.getFiltervalues().stream().filter(e -> !"*".equals(e)).collect(Collectors.toList()))
+ filter.getFiltervalues().stream().filter(e -> !"*".equals(e)).collect(Collectors.toSet()))
.build();
}
}
diff --git a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/SqlQuery.java b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/SqlQuery.java
index 3e26d0935..c954faadb 100644
--- a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/SqlQuery.java
+++ b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/SqlQuery.java
@@ -24,18 +24,22 @@ package org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.query;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
+import java.util.Collection;
import java.util.Date;
import java.util.List;
+import java.util.Set;
import java.util.TimeZone;
import java.util.stream.Collectors;
import org.eclipse.jdt.annotation.Nullable;
import org.onap.ccsdk.features.sdnr.wt.common.database.data.DbFilter;
+import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.database.SqlDBMapper;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.query.filters.DBFilterKeyValuePair;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.query.filters.RangeSqlDBFilter;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.query.filters.RegexSqlDBFilter;
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.rev201110.entity.input.Filter;
+import io.netty.util.internal.StringUtil;
public interface SqlQuery {
@@ -50,18 +54,25 @@ public interface SqlQuery {
static final boolean DEFAULT_IGNORE_CONTROLLERID = false;
static final boolean DEFAULT_IGNORE_ID_FIELD = false;
- public static String getWhereExpression(List<Filter> filters) {
- if (filters == null) {
+ public static String getWhereExpression(Collection<Filter> filters) {
+ return getWhereExpression(filters, null);
+ }
+ public static String getWhereExpression(Collection<Filter> filters, String controllerId) {
+ if (filters == null && controllerId == null) {
return "";
}
StringBuilder sb = new StringBuilder();
- filters = filters.stream().filter(e -> !"*".equals(e.getFiltervalue())).collect(Collectors.toList());
- if (!filters.isEmpty()) {
-
- sb.append(" WHERE (" + getFilterExpression(filters.get(0)) + ")");
- for (int i = 1; i < filters.size(); i++) {
- sb.append(" AND (" + getFilterExpression(filters.get(i)) + ")");
- }
+ List<String> filters2 =
+ filters != null
+ ? filters.stream().filter(e -> !"*".equals(e.getFiltervalue())).map(e -> getFilterExpression(e))
+ .collect(Collectors.toList())
+ : new ArrayList<>();
+ if(controllerId!=null) {
+ filters2.add(getFilterExpression(SqlDBMapper.ODLID_DBCOL, controllerId));
+ }
+ if (!filters2.isEmpty() ) {
+ sb.append(" WHERE ");
+ sb.append(StringUtil.join(" AND ", filters2));
}
return sb.toString();
}
@@ -107,7 +118,7 @@ public interface SqlQuery {
return new DBFilterKeyValuePair(property, value).getFilterExpression();
}
- static List<String> collectValues(String filtervalue, List<String> filtervalues) {
+ static List<String> collectValues(String filtervalue, Set<String> filtervalues) {
if (filtervalues == null) {
return Arrays.asList(filtervalue);
}
diff --git a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/filters/RegexSqlDBFilter.java b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/filters/RegexSqlDBFilter.java
index 4ef1b9a55..65e0c54e4 100644
--- a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/filters/RegexSqlDBFilter.java
+++ b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/filters/RegexSqlDBFilter.java
@@ -21,7 +21,7 @@
*/
package org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.query.filters;
-public class RegexSqlDBFilter extends DBKeyValuePair<String> implements SqlDBFilter{
+public class RegexSqlDBFilter extends DBKeyValuePair<String> implements SqlDBFilter {
public RegexSqlDBFilter(String key, String value) {
@@ -32,4 +32,11 @@ public class RegexSqlDBFilter extends DBKeyValuePair<String> implements SqlDBFil
public String getFilterExpression() {
return String.format("`%s` RLIKE '%s'", this.getKey(), this.getValue());
}
+
+ @Override
+ public String getValue() {
+ String value = super.getValue();
+ return value != null ? value.replace("*", ".*") : null;
+ }
}
+
diff --git a/sdnr/wt/data-provider/dblib/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/dblib/test/TestMariaDataProvider.java b/sdnr/wt/data-provider/dblib/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/dblib/test/TestMariaDataProvider.java
index c9cf27c68..34c4d6fe8 100644
--- a/sdnr/wt/data-provider/dblib/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/dblib/test/TestMariaDataProvider.java
+++ b/sdnr/wt/data-provider/dblib/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/dblib/test/TestMariaDataProvider.java
@@ -183,7 +183,8 @@ public class TestMariaDataProvider {
assertEquals(2, faultCurrents.getData().size());
ReadStatusOutputBuilder status = null;
try {
- status = dbProvider.readStatus();
+ EntityInput input=null;
+ status = dbProvider.readStatus(input);
} catch (IOException e) {
e.printStackTrace();
fail("failed to read status");
@@ -567,7 +568,8 @@ public class TestMariaDataProvider {
ReadStatusOutputBuilder status = null;
try {
- status = dbProvider.readStatus();
+ EntityInput input=null;
+ status = dbProvider.readStatus(input);
} catch (IOException e) {
e.printStackTrace();
fail("failed to read status");
diff --git a/sdnr/wt/data-provider/dblib/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/dblib/test/TestQuerySyntax.java b/sdnr/wt/data-provider/dblib/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/dblib/test/TestQuerySyntax.java
index 576a3825c..7dd2464f9 100644
--- a/sdnr/wt/data-provider/dblib/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/dblib/test/TestQuerySyntax.java
+++ b/sdnr/wt/data-provider/dblib/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/dblib/test/TestQuerySyntax.java
@@ -1,5 +1,4 @@
-/*
- * ============LICENSE_START=======================================================
+/* ============LICENSE_START=======================================================
* ONAP : ccsdk features
* ================================================================================
* Copyright (C) 2020 highstreet technologies GmbH Intellectual Property.
@@ -27,6 +26,8 @@ import static org.junit.Assert.assertTrue;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
+import java.util.Set;
+
import org.junit.Test;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.query.CountQuery;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.query.SelectQuery;
@@ -169,7 +170,7 @@ public class TestQuerySyntax {
public void testSelectForFilterValues() {
EntityInput input = new ReadGuiCutThroughEntryInputBuilder()
.setFilter(YangToolsMapperHelper.toMap(Arrays.asList(
- new FilterBuilder().setProperty("id").setFiltervalues(Arrays.asList("das", "das2")).build())))
+ new FilterBuilder().setProperty("id").setFiltervalues(Set.of("das", "das2")).build())))
.setPagination(new PaginationBuilder().setSize(Uint32.valueOf(20)).setPage(Uint64.valueOf(1)).build())
.build();
SelectQuery query = new SelectQuery(TABLENAME1, input, CONTROLLERID);
@@ -190,7 +191,7 @@ public class TestQuerySyntax {
public void testSelectForFilterValues3() {
EntityInput input = new ReadGuiCutThroughEntryInputBuilder()
.setFilter(YangToolsMapperHelper.toMap(Arrays.asList(
- new FilterBuilder().setProperty("id").setFiltervalues(Arrays.asList("*","abc")).build())))
+ new FilterBuilder().setProperty("id").setFiltervalues(Set.of("*","abc")).build())))
.setPagination(new PaginationBuilder().setSize(Uint32.valueOf(20)).setPage(Uint64.valueOf(1)).build())
.build();
SelectQuery query = new SelectQuery(TABLENAME1, input, CONTROLLERID);
@@ -201,8 +202,8 @@ public class TestQuerySyntax {
public void testSelectForFilterValues4() {
EntityInput input = new ReadGuiCutThroughEntryInputBuilder()
.setFilter(YangToolsMapperHelper.toMap(Arrays.asList(
- new FilterBuilder().setProperty("id").setFiltervalues(Arrays.asList("abc")).build(),
- new FilterBuilder().setProperty("node-id").setFiltervalues(Arrays.asList("*")).build())))
+ new FilterBuilder().setProperty("id").setFiltervalues(Set.of("abc")).build(),
+ new FilterBuilder().setProperty("node-id").setFiltervalues(Set.of("*")).build())))
.setPagination(new PaginationBuilder().setSize(Uint32.valueOf(20)).setPage(Uint64.valueOf(1)).build())
.build();
SelectQuery query = new SelectQuery(TABLENAME1, input, CONTROLLERID);
@@ -210,6 +211,20 @@ public class TestQuerySyntax {
assertFalse(query.toSql().contains("RLIKE"));
}
@Test
+ public void testSelectForFilterValues5() {
+ EntityInput input = new ReadGuiCutThroughEntryInputBuilder()
+ .setFilter(YangToolsMapperHelper.toMap(Arrays.asList(
+ new FilterBuilder().setProperty("id").setFiltervalues(Set.of("abc")).build(),
+ new FilterBuilder().setProperty("node-id").setFiltervalues(Set.of("*ran*")).build())))
+ .setPagination(new PaginationBuilder().setSize(Uint32.valueOf(20)).setPage(Uint64.valueOf(1)).build())
+ .build();
+ SelectQuery query = new SelectQuery(TABLENAME1, input, CONTROLLERID);
+ System.out.println(query.toSql());
+ assertTrue(query.toSql().contains("RLIKE"));
+ assertTrue(query.toSql().contains(".*"));
+
+ }
+ @Test
public void testCount() {
CountQuery query = new CountQuery(Entity.Eventlog, TestMariaDataProvider.createInput(1, 20));
String sQuery = query.toSql();
diff --git a/sdnr/wt/data-provider/feature/pom.xml b/sdnr/wt/data-provider/feature/pom.xml
index 1a8d0fda1..d6a0c4d2c 100644
--- a/sdnr/wt/data-provider/feature/pom.xml
+++ b/sdnr/wt/data-provider/feature/pom.xml
@@ -22,13 +22,14 @@
~ ============LICENSE_END=======================================================
~
-->
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>2.4.0</version>
+ <version>2.4.1-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/sdnr/wt/data-provider/installer/pom.xml b/sdnr/wt/data-provider/installer/pom.xml
index fd50c9020..6160686a4 100755
--- a/sdnr/wt/data-provider/installer/pom.xml
+++ b/sdnr/wt/data-provider/installer/pom.xml
@@ -22,13 +22,14 @@
~ ============LICENSE_END=======================================================
~
-->
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>2.4.0</version>
+ <version>2.4.1-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/sdnr/wt/data-provider/model/pom.xml b/sdnr/wt/data-provider/model/pom.xml
index d5a6fc7f7..a673741fb 100644
--- a/sdnr/wt/data-provider/model/pom.xml
+++ b/sdnr/wt/data-provider/model/pom.xml
@@ -22,13 +22,14 @@
~ ============LICENSE_END=======================================================
~
-->
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>binding-parent</artifactId>
- <version>2.4.0</version>
+ <version>2.4.1-SNAPSHOT</version>
<relativePath/>
</parent>
@@ -59,6 +60,7 @@
<groupId>${project.groupId}</groupId>
<artifactId>sdnr-wt-common</artifactId>
<version>${project.version}</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.opendaylight.netconf</groupId>
@@ -68,6 +70,7 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
+ <scope>provided</scope>
</dependency>
</dependencies>
diff --git a/sdnr/wt/data-provider/model/src/main/yang/data-provider@2020-11-10.yang b/sdnr/wt/data-provider/model/src/main/yang/data-provider@2020-11-10.yang
index 8b905f49e..72ac45a56 100644
--- a/sdnr/wt/data-provider/model/src/main/yang/data-provider@2020-11-10.yang
+++ b/sdnr/wt/data-provider/model/src/main/yang/data-provider@2020-11-10.yang
@@ -2018,6 +2018,9 @@ module data-provider {
rpc read-status {
description
"Read status information of controller";
+ input {
+ uses entity-input;
+ }
output {
list data {
uses status-entity;
diff --git a/sdnr/wt/data-provider/pom.xml b/sdnr/wt/data-provider/pom.xml
index 9530b1094..fb3a00037 100755
--- a/sdnr/wt/data-provider/pom.xml
+++ b/sdnr/wt/data-provider/pom.xml
@@ -22,13 +22,14 @@
~ ============LICENSE_END=======================================================
~
-->
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>2.4.0</version>
+ <version>2.4.1-SNAPSHOT</version>
<relativePath/>
</parent>
diff --git a/sdnr/wt/data-provider/provider/pom.xml b/sdnr/wt/data-provider/provider/pom.xml
index 21206419d..cc4313374 100644
--- a/sdnr/wt/data-provider/provider/pom.xml
+++ b/sdnr/wt/data-provider/provider/pom.xml
@@ -22,13 +22,14 @@
~ ============LICENSE_END=======================================================
~
-->
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>binding-parent</artifactId>
- <version>2.4.0</version>
+ <version>2.4.1-SNAPSHOT</version>
<relativePath/>
</parent>
@@ -60,6 +61,7 @@
<dependency>
<groupId>org.apache.karaf.bundle</groupId>
<artifactId>org.apache.karaf.bundle.core</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
@@ -90,6 +92,7 @@
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
@@ -99,10 +102,12 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.karaf.shell</groupId>
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/EsDataObjectReaderWriter2.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/EsDataObjectReaderWriter2.java
index cb0f22da1..a10864c96 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/EsDataObjectReaderWriter2.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/EsDataObjectReaderWriter2.java
@@ -24,6 +24,7 @@ package org.onap.ccsdk.features.sdnr.wt.dataprovider.database.elasticsearch;
import com.fasterxml.jackson.core.JsonProcessingException;
import java.io.IOException;
import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -92,7 +93,7 @@ public class EsDataObjectReaderWriter2<T extends DataObject> {
* @param syncAfterWrite
* @throws ClassNotFoundException
*/
- public <X extends T, @NonNull B extends Builder<X>> EsDataObjectReaderWriter2(DatabaseClient db,
+ public <X extends T, B> EsDataObjectReaderWriter2(DatabaseClient db,
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());
@@ -111,13 +112,13 @@ public class EsDataObjectReaderWriter2<T extends DataObject> {
public void setFullsizeRequest(boolean fullsizeRequest) {
this.doFullsizeRequest = fullsizeRequest;
}
- public <X extends T, @NonNull B extends Builder<X>> EsDataObjectReaderWriter2(DatabaseClient db,
+ public <X extends T, B> 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,
+ public <X extends T, B> EsDataObjectReaderWriter2(DatabaseClient db,
Entity dataTypeName, @Nonnull Class<T> clazz, @Nullable Class<B> builderClazz, boolean syncAfterWrite)
throws ClassNotFoundException {
this(db, dataTypeName.getName(), clazz, builderClazz, syncAfterWrite);
@@ -160,20 +161,20 @@ public class EsDataObjectReaderWriter2<T extends DataObject> {
* @return this for further operations.
* @throws SecurityException if no access or IllegalArgumentException if wrong type or no attribute with this name.
*/
- public EsDataObjectReaderWriter2<T> setEsIdAttributeName(String esIdAttributeName) {
+ public <B> EsDataObjectReaderWriter2<T> setEsIdAttributeName(String esIdAttributeName) {
LOG.debug("Set attribute '{}'", esIdAttributeName);
this.esIdAddAtributteName = null; // Reset status
this.field = null;
Field attributeField;
try {
- Builder<? extends T> builder = yangtoolsMapper.getBuilder(clazz);
+ B builder = yangtoolsMapper.getBuilder(clazz);
if (builder == null) {
String msg = "No builder for " + clazz;
LOG.debug(msg);
throw new IllegalArgumentException(msg);
} else {
- T object = builder.build();
+ T object = YangToolsMapperHelper.callBuild(builder);
attributeField = object.getClass().getDeclaredField(esIdAttributeName);
if (attributeField.getType().equals(String.class)) {
attributeField.setAccessible(true);
@@ -193,7 +194,19 @@ public class EsDataObjectReaderWriter2<T extends DataObject> {
} catch (SecurityException e) {
LOG.debug("Access problem " + esIdAttributeName, e);
throw e;
- }
+ } catch (NoSuchMethodException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IllegalArgumentException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (InvocationTargetException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
return this;
}
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/acessor/DataObjectAcessorStatus.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/acessor/DataObjectAcessorStatus.java
index 5811550e6..9a4033b99 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/acessor/DataObjectAcessorStatus.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/acessor/DataObjectAcessorStatus.java
@@ -26,14 +26,15 @@ 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.onap.ccsdk.features.sdnr.wt.dataprovider.database.elasticsearch.data.rpctypehelper.QueryByFilter;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.elasticsearch.data.rpctypehelper.QueryResult;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.YangHelper2;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ConnectionLogStatus;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Entity;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EntityInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.status.output.Data;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.status.output.DataBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.status.entity.FaultsBuilder;
@@ -54,9 +55,11 @@ public class DataObjectAcessorStatus extends DataObjectAcessor<Data> {
}
- public QueryResult<Data> getDataStatus() throws IOException {
+ public QueryResult<Data> getDataStatus(EntityInput input) throws IOException {
SearchRequest request = getNewInstanceOfSearchRequest(Entity.Faultcurrent);
- QueryBuilder query = QueryBuilders.matchAllQuery().aggregations(ESDATATYPE_FAULTCURRENT_SEVERITY_KEY).size(0);
+ QueryByFilter queryByFilter = new QueryByFilter(input);
+ QueryBuilder query = queryByFilter.getQueryBuilderByFilter();
+ query.aggregations(ESDATATYPE_FAULTCURRENT_SEVERITY_KEY).size(0);
if(this.doFullsizeRequest) {
query.doFullsizeRequest();
}
@@ -71,7 +74,7 @@ public class DataObjectAcessorStatus extends DataObjectAcessor<Data> {
.setWarnings(YangHelper2.getLongOrUint32(aggs.getOrDefault("Warning", 0L))).build());
request = getNewInstanceOfSearchRequest(Entity.NetworkelementConnection);
- query = QueryBuilders.matchAllQuery().aggregations(ESDATATYPE_NECON_CONNECTIONSTATE_KEY).size(0);
+ query.aggregations(ESDATATYPE_NECON_CONNECTIONSTATE_KEY).size(0);
if(this.doFullsizeRequest) {
query.doFullsizeRequest();
}
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/impl/ElasticSearchDataProvider.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/impl/ElasticSearchDataProvider.java
index 38ea8044e..753930cdd 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/impl/ElasticSearchDataProvider.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/impl/ElasticSearchDataProvider.java
@@ -352,7 +352,7 @@ public class ElasticSearchDataProvider implements DatabaseDataProvider {
outputBuilder.setPagination(
new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.pmdata._15m.ltp.list.output.PaginationBuilder(
result.getPagination()).build());
- outputBuilder.setData(result.getResult().getHits());
+ outputBuilder.setData(result.getResult().getHitSets());
return outputBuilder;
}
@@ -363,7 +363,7 @@ public class ElasticSearchDataProvider implements DatabaseDataProvider {
outputBuilder.setPagination(
new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.pmdata._15m.device.list.output.PaginationBuilder(
result.getPagination()).build());
- outputBuilder.setData(result.getResult().getHits());
+ outputBuilder.setData(result.getResult().getHitSets());
return outputBuilder;
}
@@ -377,7 +377,7 @@ public class ElasticSearchDataProvider implements DatabaseDataProvider {
outputBuilder.setPagination(
new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.pmdata._24h.ltp.list.output.PaginationBuilder(
result.getPagination()).build());
- outputBuilder.setData(result.getResult().getHits());
+ outputBuilder.setData(result.getResult().getHitSets());
return outputBuilder;
}
@@ -390,14 +390,15 @@ public class ElasticSearchDataProvider implements DatabaseDataProvider {
outputBuilder.setPagination(
new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.pmdata._24h.device.list.output.PaginationBuilder(
result.getPagination()).build());
- outputBuilder.setData(result.getResult().getHits());
+ outputBuilder.setData(result.getResult().getHitSets());
return outputBuilder;
}
+
@Override
- public ReadStatusOutputBuilder readStatus() throws IOException {
+ public ReadStatusOutputBuilder readStatus(EntityInput input) throws IOException {
QueryResult<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.status.output.Data> result =
- readStatus.getDataStatus();
+ readStatus.getDataStatus(input);
ReadStatusOutputBuilder outputBuilder = new ReadStatusOutputBuilder();
outputBuilder.setData(result.getResult().getHits());
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/impl/HtUserdataManagerImpl.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/impl/HtUserdataManagerImpl.java
index 7b7dccc96..21e2694a9 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/impl/HtUserdataManagerImpl.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/impl/HtUserdataManagerImpl.java
@@ -21,7 +21,6 @@
*/
package org.onap.ccsdk.features.sdnr.wt.dataprovider.database.elasticsearch.impl;
-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.SearchResult;
@@ -47,9 +46,7 @@ public class HtUserdataManagerImpl extends HtUserdataManagerBase {
@Override
public boolean setUserdata(String username, String data) {
- JSONObject o = new JSONObject(this.getUserdata(username));
- JSONObject merge = mergeData(new JSONObject(data), o);
- return this.dbClient.doWriteRaw(Entity.Userdata.getName(), username, merge.toString()) != null;
+ return this.dbClient.doWriteRaw(Entity.Userdata.getName(), username, data) != null;
}
@Override
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/nodb/NoDbDatabaseDataProvider.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/nodb/NoDbDatabaseDataProvider.java
index e2ba9567e..54cf32ce0 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/nodb/NoDbDatabaseDataProvider.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/nodb/NoDbDatabaseDataProvider.java
@@ -72,7 +72,7 @@ public class NoDbDatabaseDataProvider implements DatabaseDataProvider {
private final HtDatabaseMediatorserver mediatorserver;
private final HtDatabaseMaintenance maintenance;
private final DataProvider dataprovider;
-
+
public NoDbDatabaseDataProvider() {
this.usermanger = new NoDbHtUserdataManager();
this.mediatorserver = new NoDbHtDatabaseMediatorserver();
@@ -160,7 +160,7 @@ public class NoDbDatabaseDataProvider implements DatabaseDataProvider {
}
@Override
- public ReadStatusOutputBuilder readStatus() throws IOException {
+ public ReadStatusOutputBuilder readStatus(EntityInput input) throws IOException {
return new ReadStatusOutputBuilder();
}
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/ODLVersionLUT.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/ODLVersionLUT.java
index 29d9ee9db..6ddc092d5 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/ODLVersionLUT.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/ODLVersionLUT.java
@@ -32,6 +32,9 @@ public class ODLVersionLUT {
if (onapCCSDKVersion == null) {
return def;
}
+ if (onapCCSDKVersion.startsWith("2.4.")) {
+ return "ONAP Kohn";
+ }
if (onapCCSDKVersion.startsWith("2.3.")) {
return "ONAP Jakarta";
}
@@ -66,6 +69,8 @@ public class ODLVersionLUT {
}
if(odlMdsalVersionLUT==null) {
odlMdsalVersionLUT = new HashMap<>();
+ odlMdsalVersionLUT.put("9.0.2","sulfur-SR0 (0.16.0)");
+ odlMdsalVersionLUT.put("8.0.11","phosphorus-SR2 (0.15.2)");
odlMdsalVersionLUT.put("8.0.7","phosphorus-SR1 (0.15.1)");
odlMdsalVersionLUT.put("8.0.5","phosphorus-SR0 (0.15.0)");
odlMdsalVersionLUT.put("7.0.9","silicon-SR2 (0.14.2)");
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/DataProviderServiceImpl.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/DataProviderServiceImpl.java
index 41fee76ad..b75108ab2 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/DataProviderServiceImpl.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/DataProviderServiceImpl.java
@@ -27,9 +27,12 @@ import com.google.common.util.concurrent.ListenableFuture;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Map;
import java.util.Optional;
+import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@@ -38,7 +41,6 @@ import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRep
import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.DatabaseDataProvider;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.elasticsearch.impl.ElasticSearchDataProvider;
-import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.elasticsearch.impl.HtUserdataManagerImpl;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.nodb.NoDbDatabaseDataProvider;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.data.SqlDBDataProvider;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.http.MsServlet;
@@ -47,6 +49,7 @@ import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.HtDatabaseMaintenance;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.HtUserdataManager;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.IEsConfig;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.SdnrDbType;
+import org.onap.ccsdk.features.sdnr.wt.yang.mapper.YangToolsMapperHelper;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.ReadTransaction;
import org.opendaylight.mdsal.binding.api.RpcProviderService;
@@ -112,11 +115,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.pro
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.UpdateNetworkElementConnectionOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.tls.key.entry.output.Pagination;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.tls.key.entry.output.PaginationBuilder;
-import org.opendaylight.yangtools.concepts.Builder;
import org.opendaylight.yangtools.concepts.ObjectRegistration;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.common.Uint32;
@@ -165,7 +167,7 @@ public class DataProviderServiceImpl implements DataProviderService, AutoCloseab
// Register ourselves as the REST API RPC implementation
LOG.info("Register RPC Service {}", DataProviderServiceImpl.class.getSimpleName());
this.rpcReg = rpcProviderService.registerRpcImplementation(DataProviderService.class, this);
-
+
}
private void sendResyncCallbackToApiGateway() {
@@ -279,7 +281,8 @@ public class DataProviderServiceImpl implements DataProviderService, AutoCloseab
@Override
public ListenableFuture<RpcResult<ReadStatusOutput>> readStatus(ReadStatusInput input) {
LOG.debug("RPC Request: readStatusEntityList with input {}", input);
- RpcResultBuilder<ReadStatusOutput> result = read(() -> DataProviderServiceImpl.this.dataProvider.readStatus());
+ RpcResultBuilder<ReadStatusOutput> result =
+ read(() -> DataProviderServiceImpl.this.dataProvider.readStatus(input));
return result.buildFuture();
}
@@ -460,11 +463,11 @@ public class DataProviderServiceImpl implements DataProviderService, AutoCloseab
}
ReadTlsKeyEntryOutputBuilder output = new ReadTlsKeyEntryOutputBuilder();
if (result.isEmpty()) {
- return output.setData(Arrays.asList()).setPagination(EMPTY_PAGINATION);
+ return output.setData(Set.of()).setPagination(EMPTY_PAGINATION);
}
Map<KeyCredentialKey, KeyCredential> keyCredential = result.get().getKeyCredential();
if (keyCredential == null) {
- return output.setData(Arrays.asList()).setPagination(EMPTY_PAGINATION);
+ return output.setData(Set.of()).setPagination(EMPTY_PAGINATION);
}
org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.entity.input.Pagination pagination =
input.getPagination();
@@ -474,7 +477,7 @@ public class DataProviderServiceImpl implements DataProviderService, AutoCloseab
: pagination.getSize() == null ? DEFAULT_PAGESIZE : pagination.getSize().longValue();
long from = pageNum > 0 ? (pageNum - 1) * size : 0;
output.setData(keyCredential.keySet().stream().skip(from).limit(size).map(e -> e.getKeyId())
- .collect(Collectors.toList()));
+ .collect(Collectors.toSet()));
output.setPagination(new PaginationBuilder().setPage(Uint64.valueOf(pageNum))
.setSize(Uint32.valueOf(output.getData().size())).setTotal(Uint64.valueOf(keyCredential.size()))
.build());
@@ -492,16 +495,16 @@ public class DataProviderServiceImpl implements DataProviderService, AutoCloseab
return buf.toString();
}
- private interface GetEntityInput<O extends DataObject> {
- Builder<O> get() throws IOException;
+ private interface GetEntityInput<O extends DataObject,B> {
+ B get() throws IOException;
}
- private static <O extends DataObject, I extends DataObject> RpcResultBuilder<O> read(
- GetEntityInput<O> inputgetter) {
+ private static <O extends DataObject, B> RpcResultBuilder<O> read(
+ GetEntityInput<O,B> inputgetter) {
RpcResultBuilder<O> result;
try {
- Builder<O> outputBuilder = inputgetter.get();
- result = RpcResultBuilder.success(outputBuilder);
+ B outputBuilder = inputgetter.get();
+ result = RpcResultBuilder.success(YangToolsMapperHelper.callBuild(outputBuilder));
} catch (Exception e) {
LOG.info("Exception", e);
result = RpcResultBuilder.failed();
@@ -510,6 +513,7 @@ public class DataProviderServiceImpl implements DataProviderService, AutoCloseab
return result;
}
+
public HtUserdataManager getHtDatabaseUserManager() {
return this.dbUserManager;
}
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 00e8075f9..08b1d00aa 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
@@ -31,8 +31,13 @@ import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.IOException;
import java.math.BigInteger;
+import java.util.Arrays;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
import java.util.concurrent.TimeUnit;
+
+import org.eclipse.jdt.annotation.Nullable;
import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient;
@@ -48,10 +53,12 @@ import org.onap.ccsdk.features.sdnr.wt.dataprovider.http.UserdataHttpServlet;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.YangHelper2;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.test.util.HostInfoForTest;
import org.onap.ccsdk.features.sdnr.wt.dataprovider.yangtools.DataProviderYangToolsMapper;
+import org.onap.ccsdk.features.sdnr.wt.yang.mapper.YangToolsMapperHelper;
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.rev201110.CmNotificationType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.CmOperation;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.CmSourceIndicator;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ConnectionLogStatus;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.CreateMaintenanceInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.CreateMaintenanceInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.CreateMaintenanceOutputBuilder;
@@ -68,9 +75,11 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.pro
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.DeleteNetworkElementConnectionInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.DeleteNetworkElementConnectionInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Entity;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EntityInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Faultlog;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.GranularityPeriodType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.NetworkElementConnectionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadCmlogListInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadCmlogListInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadCmlogListOutputBuilder;
@@ -116,6 +125,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.pro
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadPmdata24hLtpListInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadPmdata24hLtpListInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadPmdata24hLtpListOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadStatusInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.UpdateMaintenanceInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.UpdateMaintenanceInputBuilder;
@@ -126,11 +136,13 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.pro
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.UpdateNetworkElementConnectionInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.UpdateNetworkElementConnectionInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.UpdateNetworkElementConnectionOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.entity.input.Filter;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.entity.input.FilterBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.entity.input.FilterKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.entity.input.Pagination;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.entity.input.PaginationBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.mediator.server.list.output.Data;
+import org.opendaylight.yangtools.yang.common.Uint32;
public class TestCRUDforDatabase {
@@ -164,27 +176,49 @@ public class TestCRUDforDatabase {
//== CLEAR AND CREATE ================================
clearAndCreatefaultEntity("1", Entity.Faultcurrent.getName(),
"org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.CreateFaultcurrentInput",
- SeverityType.Critical);
+ SeverityType.Critical, "nodeA");
createFaultEntity("Lorem Ipsum", Entity.Faultcurrent.getName(),
"org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.CreateFaultcurrentInput",
- SeverityType.Major);
+ SeverityType.Major, "nodeB");
createFaultEntity("3", Entity.Faultcurrent.getName(),
"org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.CreateFaultcurrentInput",
- SeverityType.Minor);
+ SeverityType.Minor, "nodeC");
createFaultEntity("4", Entity.Faultcurrent.getName(),
"org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.CreateFaultcurrentInput",
- SeverityType.Warning);
-
+ SeverityType.Warning, "nodeA");
+
+ createNeConnection("nodeA","10.20.30.40",30000, ConnectionLogStatus.Connected);
+ createNeConnection("nodeB","10.20.30.40",31000, ConnectionLogStatus.Connected);
+ createNeConnection("nodeC","10.20.30.40",32000, ConnectionLogStatus.Connected);
+ createNeConnection("nodeAD","10.20.30.40",33000, ConnectionLogStatus.Connected);
+ createNeConnection("nodeE","10.20.30.40",34000, ConnectionLogStatus.Connected);
+ createNeConnection("nodeF","10.20.30.40",35000, ConnectionLogStatus.Connected);
//== READ ================================
List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.status.output.Data> readOutput =
- dbProvider.readStatus().getData();
+ dbProvider.readStatus(null).getData();
System.out.println(readOutput);
+
+
assertEquals(1, readOutput.get(0).getFaults().getMajors().intValue());
assertEquals(1, readOutput.get(0).getFaults().getMinors().intValue());
assertEquals(1, readOutput.get(0).getFaults().getWarnings().intValue());
assertEquals(1, readOutput.get(0).getFaults().getCriticals().intValue());
+ Map<FilterKey, Filter> filter = YangToolsMapperHelper
+ .toMap(Arrays.asList(new FilterBuilder().setProperty("node-id").setFiltervalue("nodeA").build()));
+ EntityInput input = new ReadStatusInputBuilder().setFilter(filter).build();
+ readOutput = dbProvider.readStatus(input).getData();
+ System.out.println(readOutput);
+ assertEquals(1, readOutput.get(0).getNetworkElementConnections().getConnected().intValue());
+ assertEquals(0, readOutput.get(0).getNetworkElementConnections().getConnecting().intValue());
+ assertEquals(0, readOutput.get(0).getNetworkElementConnections().getDisconnected().intValue());
+ assertEquals(0, readOutput.get(0).getNetworkElementConnections().getMounted().intValue());
+ assertEquals(0, readOutput.get(0).getFaults().getMajors().intValue());
+ assertEquals(0, readOutput.get(0).getFaults().getMinors().intValue());
+ assertEquals(1, readOutput.get(0).getFaults().getWarnings().intValue());
+ assertEquals(1, readOutput.get(0).getFaults().getCriticals().intValue());
+
//== DELETE ================================
@@ -197,13 +231,15 @@ public class TestCRUDforDatabase {
//== VERIFY DELETE ===========================
System.out.println("verify entries were deleted");
- readOutput = dbProvider.readStatus().getData();
+ readOutput = dbProvider.readStatus(null).getData();
assertEquals(0, readOutput.get(0).getFaults().getMajors().intValue());
assertEquals(0, readOutput.get(0).getFaults().getMinors().intValue());
assertEquals(0, readOutput.get(0).getFaults().getWarnings().intValue());
assertEquals(0, readOutput.get(0).getFaults().getCriticals().intValue());
}
+
+
@Test
public void testMediatorServer() {
final String NAME = "ms1";
@@ -599,14 +635,14 @@ public class TestCRUDforDatabase {
public void testCMLog() {
System.out.println("Starting CM log test...");
String dbId = clearAndCreateCMEntity("1", Entity.Cmlog.getName(),
- "org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.CreateCmlogInput");
+ "org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.CreateCmlogInput");
// ==READ===========================
System.out.println("try to read entry");
ReadCmlogListInput readinput = new ReadCmlogListInputBuilder()
- .setFilter(YangHelper2.getListOrMap(FilterKey.class,
- new FilterBuilder().setProperty("id").setFiltervalue(dbId).build()))
- .setPagination(getPagination(20, 1)).build();
+ .setFilter(YangHelper2.getListOrMap(FilterKey.class,
+ new FilterBuilder().setProperty("id").setFiltervalue(dbId).build()))
+ .setPagination(getPagination(20, 1)).build();
ReadCmlogListOutputBuilder readResult = null;
try {
@@ -616,8 +652,8 @@ public class TestCRUDforDatabase {
fail("CM log not read: " + e.getMessage());
}
- List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.cmlog.list.output.Data>
- data = readResult.getData();
+ List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.cmlog.list.output.Data> data =
+ readResult.getData();
assertNotNull(data);
assertEquals("1", dbId);
@@ -634,13 +670,13 @@ public class TestCRUDforDatabase {
System.out.println("try to update entry");
dbRawProvider.doUpdateOrCreate(Entity.Cmlog.getName(), "1",
- "{'node-id': 'test4657-78','operation': 'CREATE', 'notification-id': '1'}");
+ "{'node-id': 'test4657-78','operation': 'CREATE', 'notification-id': '1'}");
System.out.println("try to search entry 1");
readinput = new ReadCmlogListInputBuilder()
- .setFilter(YangHelper2.getListOrMap(FilterKey.class,
- new FilterBuilder().setProperty("node-id").setFiltervalue("test").build()))
- .setPagination(getPagination(20, 1)).build();
+ .setFilter(YangHelper2.getListOrMap(FilterKey.class,
+ new FilterBuilder().setProperty("node-id").setFiltervalue("test").build()))
+ .setPagination(getPagination(20, 1)).build();
//== VERIFY UPDATE ================================
readResult = dbProvider.readCMLogList(readinput);
@@ -652,9 +688,9 @@ public class TestCRUDforDatabase {
System.out.println("try to search entry 2");
readinput = new ReadCmlogListInputBuilder()
- .setFilter(YangHelper2.getListOrMap(FilterKey.class,
- new FilterBuilder().setProperty("node-id").setFiltervalue("test*").build()))
- .setPagination(getPagination(20, 1)).build();
+ .setFilter(YangHelper2.getListOrMap(FilterKey.class,
+ new FilterBuilder().setProperty("node-id").setFiltervalue("test*").build()))
+ .setPagination(getPagination(20, 1)).build();
readResult = dbProvider.readCMLogList(readinput);
data = readResult.getData();
@@ -676,7 +712,7 @@ public class TestCRUDforDatabase {
//== VERIFY DELETE ===========================
System.out.println("verify entries deleted");
readResult = dbProvider
- .readCMLogList(new ReadFaultlogListInputBuilder().setPagination(getPagination(20, 1)).build());
+ .readCMLogList(new ReadFaultlogListInputBuilder().setPagination(getPagination(20, 1)).build());
data = readResult.getData();
assertEquals(0, data.size());
}
@@ -1012,10 +1048,11 @@ public class TestCRUDforDatabase {
assertEquals("2008-11-21T00:00:00.0Z", data.get(0).getDate());
assertEquals("sd-dsa-eww", data.get(0).getSerial());
assertEquals(holderArray.length, data.get(0).getContainedHolder().size());
- assertEquals(holderArray[0], data.get(0).getContainedHolder().get(0));
- assertEquals(holderArray[1], data.get(0).getContainedHolder().get(1));
- assertEquals(holderArray[2], data.get(0).getContainedHolder().get(2));
-
+ Set<String> holder = data.get(0).getContainedHolder();
+ assertTrue(holder.contains(holderArray[0]));
+ assertTrue(holder.contains(holderArray[1]));
+ assertTrue(holder.contains(holderArray[2]));
+
// ==DELETE============================
System.out.println("delete after test");
@@ -1159,7 +1196,7 @@ public class TestCRUDforDatabase {
fail("Problem reading 15m ltp data");
}
- List<String> dataLtp = readltpResult.getData();
+ Set<String> dataLtp = readltpResult.getData();
assertNotNull(dataLtp);
assertEquals(2, dataLtp.size());
@@ -1179,7 +1216,7 @@ public class TestCRUDforDatabase {
fail("Problem reading 15m device data");
}
- List<String> dataDevice = readDeviceResult.getData();
+ Set<String> dataDevice = readDeviceResult.getData();
assertNotNull(dataDevice);
assertEquals(2, dataDevice.size());
@@ -1278,7 +1315,7 @@ public class TestCRUDforDatabase {
fail("Problem reading 24h ltp data");
}
- List<String> dataLtp = readltpResult.getData();
+ Set<String> dataLtp = readltpResult.getData();
assertNotNull(dataLtp);
assertEquals(3, dataLtp.size());
@@ -1300,7 +1337,7 @@ public class TestCRUDforDatabase {
fail("Problem reading 24h device data");
}
- List<String> dataDevice = readDeviceResult.getData();
+ Set<String> dataDevice = readDeviceResult.getData();
assertNotNull(dataDevice);
assertEquals(2, dataDevice.size());
@@ -1505,8 +1542,8 @@ public class TestCRUDforDatabase {
assertEquals("admin", UserdataHttpServlet.decodeJWTPayloadUsername(String.format("Bearer %s",
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbkBzZG4iLCJyb2xlcyI6WyJ1c2VyIiwiYWRtaW4iXSwiaXN"
- + "zIjoiT3BlbmRheWxpZ2h0IiwibmFtZSI6ImFkbWluQHNkbiIsImV4cCI6MTYxNTc5NTg1NywiZmFtaWx5X25hbWUiOiIifQ.wB"
- + "PdB45_bryU6_kSCu3be3dq3yth24niSXi6b2_1ufc"),
+ + "zIjoiT3BlbmRheWxpZ2h0IiwibmFtZSI6ImFkbWluQHNkbiIsImV4cCI6MTYxNTc5NTg1NywiZmFtaWx5X25hbWUiOiIifQ.wB"
+ + "PdB45_bryU6_kSCu3be3dq3yth24niSXi6b2_1ufc"),
"sub"));
}
@@ -1515,9 +1552,13 @@ public class TestCRUDforDatabase {
.setSize(YangHelper2.getLongOrUint32(pageSize)).build();
}
-
private String clearAndCreatefaultEntity(String initialDbId, String entityType, String implementedInterface,
SeverityType severity) {
+ return clearAndCreatefaultEntity(initialDbId, entityType, implementedInterface, severity, "s1");
+ }
+
+ private String clearAndCreatefaultEntity(String initialDbId, String entityType, String implementedInterface,
+ SeverityType severity, String nodeId) {
// ==CLEAR BEFORE TEST============================
System.out.println("try to clear entry");
try {
@@ -1527,11 +1568,24 @@ public class TestCRUDforDatabase {
}
- return createFaultEntity(initialDbId, entityType, implementedInterface, severity);
+ return createFaultEntity(initialDbId, entityType, implementedInterface, severity, nodeId);
}
+ private void createNeConnection(String nodeId, String host, int port, ConnectionLogStatus connectionStatus) {
+ try {
+ dbProvider.createNetworkElementConnection(new NetworkElementConnectionBuilder().setId(nodeId)
+ .setNodeId(nodeId).setStatus(connectionStatus).setHost(host).setPort(Uint32.valueOf(port)).build());
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
private String createFaultEntity(String initialDbId, String entityType, String implementedInterface,
SeverityType severity) {
+ return createFaultEntity(initialDbId, entityType, implementedInterface, severity, "s1");
+ }
+ private String createFaultEntity(String initialDbId, String entityType, String implementedInterface,
+ SeverityType severity, String nodeId) {
// ==CREATE============================
System.out.println("try to create entry");
String dbId = null;
@@ -1540,7 +1594,7 @@ public class TestCRUDforDatabase {
dbId = dbRawProvider.doUpdateOrCreate(entityType, initialDbId,
"{\n" + "\"timestamp\": \"2019-10-28T11:55:58.3Z\",\n" + "\"object-id\": \"LP-MWPS-RADIO\",\n"
- + "\"severity\": \"" + severity.toString() + "\",\n" + "\"node-id\": \"s1\",\n"
+ + "\"severity\": \"" + severity.toString() + "\",\n" + "\"node-id\": \""+nodeId+"\",\n"
+ "\"implemented-interface\": \"" + implementedInterface + "\",\n" + "\"counter\": 4340,\n"
+ "\"problem\": \"signalIsLost\",\n" + "\"type\": \"ProblemNotificationXml\"\n" + "}");
@@ -1566,23 +1620,19 @@ public class TestCRUDforDatabase {
private String createCMEntity(String initialDbId, String entityType, String implementedInterface) {
// ==CREATE============================
- System.out.println("try to create entry");
- String dbId = null;
+ System.out.println("try to create entry");
+ String dbId = null;
try {
dbId = dbRawProvider.doUpdateOrCreate(entityType, initialDbId,
- "{\n" + "\"timestamp\": \"2019-10-28T11:55:58.3Z\",\n"
- + "\" object-id\": \"LP-MWPS-RADIO\",\n"
- + "\"node-id\": \"node-1\",\n"
- + "\"counter\": 1,\n"
- + "\"notification-type\": \"" + CmNotificationType.NotifyMOIChanges.toString() + "\",\n"
- + "\"notification-id\": 123,\n"
- + "\"source-indicator\": \"" + CmSourceIndicator.MANAGEMENTOPERATION.toString() + "\",\n"
- + "\" path\": \"https://samsung.com/3GPP/simulation/network-function/ves=1\",\n"
- + "\"operation\": \"" + CmOperation.REPLACE.toString() + "\",\n"
- + "\"value\": \"pnf-registration:true\",\n"
- + "\"implemented-interface\": \"" + implementedInterface + "\"\n"
- + "}");
+ "{\n" + "\"timestamp\": \"2019-10-28T11:55:58.3Z\",\n" + "\" object-id\": \"LP-MWPS-RADIO\",\n"
+ + "\"node-id\": \"node-1\",\n" + "\"counter\": 1,\n" + "\"notification-type\": \""
+ + CmNotificationType.NotifyMOIChanges.toString() + "\",\n" + "\"notification-id\": 123,\n"
+ + "\"source-indicator\": \"" + CmSourceIndicator.MANAGEMENTOPERATION.toString() + "\",\n"
+ + "\" path\": \"https://samsung.com/3GPP/simulation/network-function/ves=1\",\n"
+ + "\"operation\": \"" + CmOperation.REPLACE.toString() + "\",\n"
+ + "\"value\": \"pnf-registration:true\",\n" + "\"implemented-interface\": \""
+ + implementedInterface + "\"\n" + "}");
} catch (Exception e) {
fail("Problem creating CM log entry" + e.getMessage());
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 611533ba1..910f63daf 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
@@ -24,7 +24,10 @@ package org.onap.ccsdk.features.sdnr.wt.dataprovider.test;
import java.io.IOException;
import java.math.BigInteger;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
+
import org.eclipse.jdt.annotation.Nullable;
import org.json.JSONObject;
import org.junit.Test;
@@ -81,7 +84,7 @@ public class TestYangGenSalMapping {
OdlHelloMessageCapabilitiesBuilder odlHelloMessageCapabilitiesBuilder =
new OdlHelloMessageCapabilitiesBuilder();
- List<Uri> uriList = new ArrayList<>();
+ Set<Uri> uriList = new HashSet<>();
uriList.add(new Uri("test.uri"));
odlHelloMessageCapabilitiesBuilder.setCapability(uriList);
netconfNodeBuilder.setOdlHelloMessageCapabilities(odlHelloMessageCapabilitiesBuilder.build());
diff --git a/sdnr/wt/data-provider/setup/pom.xml b/sdnr/wt/data-provider/setup/pom.xml
index ec5f36539..f36d5ae94 100644
--- a/sdnr/wt/data-provider/setup/pom.xml
+++ b/sdnr/wt/data-provider/setup/pom.xml
@@ -22,13 +22,14 @@
~ ============LICENSE_END=======================================================
~
-->
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>binding-parent</artifactId>
- <version>2.4.0</version>
+ <version>2.4.1-SNAPSHOT</version>
<relativePath/>
</parent>
@@ -97,6 +98,10 @@
<groupId>org.opendaylight.mdsal.binding.model.ietf</groupId>
<artifactId>rfc6991-ietf-yang-types</artifactId>
</dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ </dependency>
</dependencies>
<build>
<plugins>
diff --git a/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/MariaDBTestBase.java b/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/MariaDBTestBase.java
index a2a1fcdec..2845613cb 100644
--- a/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/MariaDBTestBase.java
+++ b/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/MariaDBTestBase.java
@@ -61,6 +61,7 @@ public class MariaDBTestBase {
private static final Map<String, String> envDefaultValues = initEnvDefaultValues();
private static final String SDNRDBDATABASETEST="test";
private static final String TESTPROPFILE = "test.properties";
+ private static final String SUFFIX = "";
public MariaDBTestBase() throws ManagedProcessException {
this(new Random().nextInt(1000) + 50000);
@@ -169,7 +170,7 @@ public class MariaDBTestBase {
boolean withControllerId) {
String createStatement = null;
try {
- createStatement = SqlDBMapper.createTable(cls, entity, "", autoIndex,withControllerId);
+ createStatement = SqlDBMapper.createTable(cls, entity, SUFFIX, autoIndex,withControllerId);
} catch (UnableToMapClassException e) {
fail(e.getMessage());
}
diff --git a/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestMariaDBMapper.java b/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestMariaDBMapper.java
index ef8998875..ceec97e36 100644
--- a/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestMariaDBMapper.java
+++ b/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestMariaDBMapper.java
@@ -27,6 +27,7 @@ import java.lang.reflect.InvocationTargetException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Arrays;
+import java.util.HashSet;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.junit.AfterClass;
@@ -72,6 +73,7 @@ public class TestMariaDBMapper {
// private static DbLibService dbService;
+ private static final String SUFFIX = "";
private static MariaDBTestBase testBase;
private static SqlDBDataProvider dbProvider;
@@ -123,10 +125,10 @@ public class TestMariaDBMapper {
builder.setDeviceType(NetworkElementDeviceType.OROADM);
builder.setHost("10.20.30.40");
builder.setIsRequired(true);
- NodeDetails nodeDetails = new NodeDetailsBuilder().setAvailableCapabilities(Arrays.asList(
+ NodeDetails nodeDetails = new NodeDetailsBuilder().setAvailableCapabilities(new HashSet<>(Arrays.asList(
"urn:ietf:params:netconf:capability:with-defaults:1.0?basic-mode=explicit&also-supported=report-all,"
+ "report-all-tagged,trim,explicit",
- "urn:ietf:params:netconf:capability:validate:1.1", "urn:ietf:params:netconf:capability:url:1.0"))
+ "urn:ietf:params:netconf:capability:validate:1.1", "urn:ietf:params:netconf:capability:url:1.0")))
.build();
builder.setNodeDetails(nodeDetails);
builder.setPassword("password");
@@ -202,7 +204,7 @@ public class TestMariaDBMapper {
boolean withControllerId) {
String createStatement = null;
try {
- createStatement = SqlDBMapper.createTable(cls, entity, "", autoIndex,withControllerId);
+ createStatement = SqlDBMapper.createTable(cls, entity, SUFFIX, autoIndex,withControllerId);
} catch (UnableToMapClassException e) {
fail(e.getMessage());
}