diff options
author | Michael Dürre <michael.duerre@highstreet-technologies.com> | 2022-07-20 09:32:50 +0200 |
---|---|---|
committer | Michael Dürre <michael.duerre@highstreet-technologies.com> | 2022-07-21 12:38:52 +0200 |
commit | 25423c50e504676f15c7a57c03aad40bfc35c7e6 (patch) | |
tree | 811649e2ec44e0332e601c6563e00e914d355b9a /sdnr/wt/data-provider/provider | |
parent | cea47224b7b6afdd7b3d3ead8d08baf46eadc575 (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/provider')
10 files changed, 168 insertions, 87 deletions
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()); |