summaryrefslogtreecommitdiffstats
path: root/plugins/grToolkit/provider
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/grToolkit/provider')
-rwxr-xr-xplugins/grToolkit/provider/pom.xml33
-rwxr-xr-xplugins/grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProvider.java34
-rw-r--r--plugins/grToolkit/provider/src/main/resources/org/opendaylight/blueprint/GrToolkit.xml9
-rw-r--r--plugins/grToolkit/provider/src/test/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProviderTest.java68
4 files changed, 78 insertions, 66 deletions
diff --git a/plugins/grToolkit/provider/pom.xml b/plugins/grToolkit/provider/pom.xml
index 5c77331c0..3bdecd54f 100755
--- a/plugins/grToolkit/provider/pom.xml
+++ b/plugins/grToolkit/provider/pom.xml
@@ -23,8 +23,8 @@
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.opendaylight.mdsal</groupId>
- <artifactId>mdsal-binding-api</artifactId>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-api</artifactId>
</dependency>
<dependency>
<groupId>org.onap.ccsdk.sli.core</groupId>
@@ -49,22 +49,22 @@
<artifactId>annotations</artifactId>
</dependency>
<dependency>
- <groupId>org.opendaylight.mdsal</groupId>
- <artifactId>mdsal-binding-test-model</artifactId>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-test-model</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-broker-impl</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-broker-impl</artifactId>
+ <type>test-jar</type>
+ <classifier>tests</classifier>
<scope>test</scope>
</dependency>
-<!-- <dependency> -->
-<!-- <groupId>org.opendaylight.controller</groupId> -->
-<!-- <artifactId>sal-binding-broker-impl</artifactId> -->
-<!-- <scope>test</scope> -->
-<!-- </dependency> -->
-<!-- <dependency> -->
-<!-- <groupId>org.opendaylight.controller</groupId> -->
-<!-- <artifactId>sal-binding-broker-impl</artifactId> -->
-<!-- <type>test-jar</type> -->
-<!-- <classifier>tests</classifier> -->
-<!-- <scope>test</scope> -->
-<!-- </dependency> -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
@@ -100,7 +100,6 @@
<dependency>
<groupId>com.github.stefanbirkner</groupId>
<artifactId>system-rules</artifactId>
- <version>1.19.0</version>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/plugins/grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProvider.java b/plugins/grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProvider.java
index 5a8730bff..7a8b3deb0 100755
--- a/plugins/grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProvider.java
+++ b/plugins/grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProvider.java
@@ -21,8 +21,6 @@
package org.onap.ccsdk.sli.plugins.grtoolkit;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
@@ -35,15 +33,18 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import java.util.Properties;
+import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import javax.annotation.Nonnull;
+
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+
import org.apache.commons.lang.StringUtils;
-import org.json.JSONArray;
-import org.json.JSONObject;
+
import org.onap.ccsdk.sli.core.dblib.DbLibService;
import org.onap.ccsdk.sli.plugins.grtoolkit.connection.ConnectionManager;
import org.onap.ccsdk.sli.plugins.grtoolkit.connection.ConnectionResponse;
@@ -59,11 +60,16 @@ import org.onap.ccsdk.sli.plugins.grtoolkit.resolver.HealthResolver;
import org.onap.ccsdk.sli.plugins.grtoolkit.resolver.SingleNodeHealthResolver;
import org.onap.ccsdk.sli.plugins.grtoolkit.resolver.SixNodeHealthResolver;
import org.onap.ccsdk.sli.plugins.grtoolkit.resolver.ThreeNodeHealthResolver;
+
+import org.json.JSONArray;
+import org.json.JSONObject;
+
import org.opendaylight.controller.cluster.datastore.DistributedDataStoreInterface;
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.DataTreeChangeListener;
-import org.opendaylight.mdsal.binding.api.NotificationPublishService;
-import org.opendaylight.mdsal.binding.api.RpcProviderService;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener;
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.AdminHealthInput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.AdminHealthOutput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.AdminHealthOutputBuilder;
@@ -92,9 +98,9 @@ import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.SiteIdentifierOutput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.SiteIdentifierOutputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.site.health.output.SitesBuilder;
-import org.opendaylight.yangtools.concepts.ObjectRegistration;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -127,8 +133,8 @@ public class GrToolkitProvider implements AutoCloseable, GrToolkitService, DataT
private final ExecutorService executor;
protected DataBroker dataBroker;
protected NotificationPublishService notificationService;
- protected RpcProviderService rpcRegistry;
- protected ObjectRegistration<GrToolkitService> rpcRegistration;
+ protected RpcProviderRegistry rpcRegistry;
+ protected BindingAwareBroker.RpcRegistration<GrToolkitService> rpcRegistration;
protected DbLibService dbLib;
private String member;
private ClusterActor self;
@@ -149,7 +155,7 @@ public class GrToolkitProvider implements AutoCloseable, GrToolkitService, DataT
*/
public GrToolkitProvider(DataBroker dataBroker,
NotificationPublishService notificationProviderService,
- RpcProviderService rpcProviderRegistry,
+ RpcProviderRegistry rpcProviderRegistry,
DistributedDataStoreInterface configDatastore,
DbLibService dbLibService) {
log.info("Creating provider for {}", APP_NAME);
@@ -171,7 +177,7 @@ public class GrToolkitProvider implements AutoCloseable, GrToolkitService, DataT
createContainers();
setProperties();
defineMembers();
- rpcRegistration = rpcRegistry.registerRpcImplementation(GrToolkitService.class, this);
+ rpcRegistration = rpcRegistry.addRpcImplementation(GrToolkitService.class, this);
log.info("Initialization complete for {}", APP_NAME);
}
diff --git a/plugins/grToolkit/provider/src/main/resources/org/opendaylight/blueprint/GrToolkit.xml b/plugins/grToolkit/provider/src/main/resources/org/opendaylight/blueprint/GrToolkit.xml
index 300c1cc75..5a4492c56 100644
--- a/plugins/grToolkit/provider/src/main/resources/org/opendaylight/blueprint/GrToolkit.xml
+++ b/plugins/grToolkit/provider/src/main/resources/org/opendaylight/blueprint/GrToolkit.xml
@@ -4,13 +4,16 @@
odl:use-default-for-reference-types="true">
<reference id="dataBroker"
- interface="org.opendaylight.controller.md.sal.binding.api.DataBroker" />
+ interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
+ odl:type="default" />
<reference id="notificationService"
- interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService" />
+ interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService"
+ odl:type="default" />
<reference id="rpcRegistry"
- interface="org.opendaylight.mdsal.binding.api.RpcProviderService" />
+ interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry"
+ odl:type="default" />
<reference id="dbLib"
interface="org.onap.ccsdk.sli.core.dblib.DbLibService" />
diff --git a/plugins/grToolkit/provider/src/test/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProviderTest.java b/plugins/grToolkit/provider/src/test/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProviderTest.java
index 6495c89cf..edd6d1b8d 100644
--- a/plugins/grToolkit/provider/src/test/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProviderTest.java
+++ b/plugins/grToolkit/provider/src/test/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProviderTest.java
@@ -20,42 +20,25 @@
*/
package org.onap.ccsdk.sli.plugins.grtoolkit;
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
+
import com.google.common.util.concurrent.ListenableFuture;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Properties;
-import java.util.concurrent.ExecutionException;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.contrib.java.lang.system.EnvironmentVariables;
+
import org.onap.ccsdk.sli.core.dblib.DBLibConnection;
import org.onap.ccsdk.sli.core.dblib.DbLibService;
import org.onap.ccsdk.sli.plugins.grtoolkit.data.ClusterActor;
+
import org.opendaylight.controller.cluster.access.concepts.MemberName;
import org.opendaylight.controller.cluster.datastore.DistributedDataStoreInterface;
import org.opendaylight.controller.cluster.datastore.utils.ActorUtils;
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.NotificationPublishService;
-import org.opendaylight.mdsal.binding.api.RpcProviderService;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.AdminHealthOutput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.ClusterHealthOutput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.DatabaseHealthOutput;
@@ -66,15 +49,38 @@ import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.ResumeAkkaTrafficOutput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.SiteHealthOutput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.SiteIdentifierOutput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.resume.akka.traffic.input.NodeInfoBuilder;
import org.opendaylight.yangtools.yang.common.RpcResult;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Properties;
+import java.util.concurrent.ExecutionException;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
public class GrToolkitProviderTest {
GrToolkitProvider provider;
GrToolkitProvider providerSpy;
DataBroker dataBroker;
NotificationPublishService notificationProviderService;
- RpcProviderService rpcProviderRegistry;
+ RpcProviderRegistry rpcProviderRegistry;
DistributedDataStoreInterface configDatastore;
DbLibService dbLibService;
DBLibConnection connection;
@@ -90,7 +96,7 @@ public class GrToolkitProviderTest {
environmentVariables.set("SDNC_CONFIG_DIR","src/test/resources");
dataBroker = mock(DataBroker.class);
notificationProviderService = mock(NotificationPublishService.class);
- rpcProviderRegistry = mock(RpcProviderService.class);
+ rpcProviderRegistry = mock(RpcProviderRegistry.class);
configDatastore = mock(DistributedDataStoreInterface.class);
dbLibService = mock(DbLibService.class);
connection = mock(DBLibConnection.class);
@@ -260,13 +266,11 @@ public class GrToolkitProviderTest {
@Test
public void haltTrafficTest() {
HaltAkkaTrafficInputBuilder builder = new HaltAkkaTrafficInputBuilder();
- builder.setNodeInfo(Arrays.asList(
- new org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.halt.akka.traffic.
- input.NodeInfoBuilder().build()));
+ builder.setNodeInfo(new ArrayList<>());
ListenableFuture<RpcResult<HaltAkkaTrafficOutput>> result = provider.haltAkkaTraffic(builder.build());
try {
assertEquals("200", result.get().getResult().getStatus());
- } catch (InterruptedException | ExecutionException e) {
+ } catch(InterruptedException | ExecutionException e) {
fail();
}
}
@@ -274,7 +278,7 @@ public class GrToolkitProviderTest {
@Test
public void resumeTrafficTest() {
ResumeAkkaTrafficInputBuilder builder = new ResumeAkkaTrafficInputBuilder();
- builder.setNodeInfo(Arrays.asList(new NodeInfoBuilder().build()));
+ builder.setNodeInfo(new ArrayList<>());
ListenableFuture<RpcResult<ResumeAkkaTrafficOutput>> result = provider.resumeAkkaTraffic(builder.build());
try {
assertEquals("200", result.get().getResult().getStatus());