summaryrefslogtreecommitdiffstats
path: root/optical-service/provider
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2021-02-04 10:30:40 -0500
committerDan Timoney <dtimoney@att.com>2021-02-04 10:30:40 -0500
commit2e63f133b29f1bb7fccaf6e35d11488f042a5855 (patch)
tree8f95c37abe39ba61b21fb8b6bafe1cb4780580d0 /optical-service/provider
parent20ca6ead983ca534e1ce93abbeaa23a2e4aac0f1 (diff)
Upgrade to ODL Aluminum
Updated code to conform to OpenDaylight Aluminum release. Change-Id: I3ef7daebc689a5d2e344fc7b96ce885bda77a7f8 Issue-ID: SDNC-1474 Signed-off-by: Dan Timoney <dtimoney@att.com>
Diffstat (limited to 'optical-service/provider')
-rw-r--r--optical-service/provider/pom.xml58
-rw-r--r--optical-service/provider/src/main/java/org/onap/sdnc/northbound/OpticalServiceProvider.java30
-rw-r--r--optical-service/provider/src/main/resources/OSGI-INF/blueprint/optical-service-blueprint.xml32
-rw-r--r--optical-service/provider/src/main/resources/org/opendaylight/blueprint/optical-service-blueprint.xml9
-rw-r--r--optical-service/provider/src/test/java/org/onap/sdnc/northbound/TestOpticalServiceProvider.java25
5 files changed, 58 insertions, 96 deletions
diff --git a/optical-service/provider/pom.xml b/optical-service/provider/pom.xml
index 4f9a2b28..de480d91 100644
--- a/optical-service/provider/pom.xml
+++ b/optical-service/provider/pom.xml
@@ -5,8 +5,8 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>binding-parent</artifactId>
- <version>2.1.0</version>
- <relativePath/>
+ <version>2.1.1-SNAPSHOT</version>
+ <relativePath />
</parent>
<groupId>org.onap.sdnc.northbound</groupId>
@@ -21,15 +21,15 @@
</properties>
<dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.onap.ccsdk.sli.core</groupId>
- <artifactId>sli-core-artifacts</artifactId>
- <version>${ccsdk.sli.core.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>sli-core-artifacts</artifactId>
+ <version>${ccsdk.sli.core.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
</dependencyManagement>
<dependencies>
<dependency>
@@ -38,10 +38,6 @@
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-api</artifactId>
- </dependency>
- <dependency>
<groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>sli-common</artifactId>
</dependency>
@@ -50,10 +46,10 @@
<artifactId>sli-provider</artifactId>
</dependency>
<dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.service.component.annotations</artifactId>
- <version>1.4.0</version>
- <scope>provided</scope>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.service.component.annotations</artifactId>
+ <version>1.4.0</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
@@ -67,27 +63,29 @@
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
<version>2.0</version>
- </dependency>
+ </dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.9</version>
</dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-test-model</artifactId>
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>mdsal-binding-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>mdsal-binding-test-model</artifactId>
<scope>test</scope>
- </dependency>
+ </dependency>
<dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-broker-impl</artifactId>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>mdsal-binding-test-utils</artifactId>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-broker-impl</artifactId>
- <type>test-jar</type>
- <classifier>tests</classifier>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>mdsal-binding-dom-adapter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/optical-service/provider/src/main/java/org/onap/sdnc/northbound/OpticalServiceProvider.java b/optical-service/provider/src/main/java/org/onap/sdnc/northbound/OpticalServiceProvider.java
index 931b28ad..c8a80d5b 100644
--- a/optical-service/provider/src/main/java/org/onap/sdnc/northbound/OpticalServiceProvider.java
+++ b/optical-service/provider/src/main/java/org/onap/sdnc/northbound/OpticalServiceProvider.java
@@ -25,11 +25,13 @@ import java.util.Properties;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+
import org.onap.ccsdk.sli.core.sli.provider.MdsalHelper;
-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.BindingAwareBroker;
-import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.NotificationPublishService;
+import org.opendaylight.mdsal.binding.api.RpcProviderService;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.optical.service.rev191206.OpticalServiceCreateInput;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.optical.service.rev191206.OpticalServiceCreateInputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.optical.service.rev191206.OpticalServiceCreateOutput;
@@ -39,14 +41,11 @@ import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.optical.service.rev
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.optical.service.rev191206.OpticalServiceDeleteOutput;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.optical.service.rev191206.OpticalServiceDeleteOutputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.optical.service.rev191206.OpticalserviceService;
+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;
-
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-
/**
* Defines a base implementation for your provider. This class extends from a
* helper class which provides storage for the most commonly used components of
@@ -64,26 +63,31 @@ public class OpticalServiceProvider implements AutoCloseable, OpticalserviceServ
protected DataBroker dataBroker;
protected NotificationPublishService notificationService;
- protected RpcProviderRegistry rpcRegistry;
- protected BindingAwareBroker.RpcRegistration<OpticalserviceService> rpcRegistration;
+ protected RpcProviderService rpcProviderService;
+ protected ObjectRegistration<OpticalserviceService> rpcRegistration;
private final OpticalServiceClient opticalServiceClient;
public OpticalServiceProvider(final DataBroker dataBroker,
- final NotificationPublishService notificationPublishService, final RpcProviderRegistry rpcProviderRegistry,
+ final NotificationPublishService notificationPublishService, final RpcProviderService rpcProviderService,
final OpticalServiceClient opticalServiceClient) {
LOG.info("Creating provider for {}", APPLICATION_NAME);
executor = Executors.newFixedThreadPool(1);
this.dataBroker = dataBroker;
this.notificationService = notificationPublishService;
- this.rpcRegistry = rpcProviderRegistry;
+ this.rpcProviderService= rpcProviderService;
this.opticalServiceClient = opticalServiceClient;
initialize();
}
public void initialize() {
LOG.info("Initializing provider for {}", APPLICATION_NAME);
- rpcRegistration = rpcRegistry.addRpcImplementation(OpticalserviceService.class, this);
+
+ if (rpcRegistration == null) {
+ if (rpcProviderService != null) {
+ rpcRegistration = rpcProviderService.registerRpcImplementation(OpticalserviceService.class, this);
+ }
+ }
LOG.info("Initialization complete for {}", APPLICATION_NAME);
}
diff --git a/optical-service/provider/src/main/resources/OSGI-INF/blueprint/optical-service-blueprint.xml b/optical-service/provider/src/main/resources/OSGI-INF/blueprint/optical-service-blueprint.xml
deleted file mode 100644
index 871ab091..00000000
--- a/optical-service/provider/src/main/resources/OSGI-INF/blueprint/optical-service-blueprint.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
- odl:use-default-for-reference-types="true">
-
- <reference id="svcLogicService"
- interface="org.onap.ccsdk.sli.core.sli.provider.SvcLogicService" />
-
- <bean id="client" class="org.onap.sdnc.northbound.OpticalServiceClient">
- <argument ref="svcLogicService" />
- </bean>
-
- <reference id="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"
- odl:type="default" />
-
- <reference id="rpcRegistry"
- interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry"
- odl:type="default" />
-
- <bean id="provider" class="org.onap.sdnc.northbound.OpticalServiceProvider">
- <argument ref="dataBroker" />
- <argument ref="notificationService" />
- <argument ref="rpcRegistry" />
- <argument ref="client" />
- </bean>
-
-</blueprint>
diff --git a/optical-service/provider/src/main/resources/org/opendaylight/blueprint/optical-service-blueprint.xml b/optical-service/provider/src/main/resources/org/opendaylight/blueprint/optical-service-blueprint.xml
index 871ab091..b7338eb7 100644
--- a/optical-service/provider/src/main/resources/org/opendaylight/blueprint/optical-service-blueprint.xml
+++ b/optical-service/provider/src/main/resources/org/opendaylight/blueprint/optical-service-blueprint.xml
@@ -11,16 +11,13 @@
</bean>
<reference id="dataBroker"
- interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
- odl:type="default" />
+ interface="org.opendaylight.mdsal.binding.api.DataBroker" />
<reference id="notificationService"
- interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService"
- odl:type="default" />
+ interface="org.opendaylight.mdsal.binding.api.NotificationPublishService" />
<reference id="rpcRegistry"
- interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry"
- odl:type="default" />
+ interface="org.opendaylight.mdsal.binding.api.RpcProviderService" />
<bean id="provider" class="org.onap.sdnc.northbound.OpticalServiceProvider">
<argument ref="dataBroker" />
diff --git a/optical-service/provider/src/test/java/org/onap/sdnc/northbound/TestOpticalServiceProvider.java b/optical-service/provider/src/test/java/org/onap/sdnc/northbound/TestOpticalServiceProvider.java
index 5738aabb..3c3729f3 100644
--- a/optical-service/provider/src/test/java/org/onap/sdnc/northbound/TestOpticalServiceProvider.java
+++ b/optical-service/provider/src/test/java/org/onap/sdnc/northbound/TestOpticalServiceProvider.java
@@ -20,30 +20,25 @@
*/
package org.onap.sdnc.northbound;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
import org.junit.Before;
import org.junit.Test;
-import org.onap.sdnc.northbound.OpticalServiceProvider;
-import org.onap.sdnc.northbound.OpticalServiceClient;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
-import org.opendaylight.controller.md.sal.binding.test.AbstractConcurrentDataBrokerTest;
-import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.optical.service.rev191206.OpticalServiceCreateInput;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.NotificationPublishService;
+import org.opendaylight.mdsal.binding.api.RpcProviderService;
+import org.opendaylight.mdsal.binding.dom.adapter.test.AbstractConcurrentDataBrokerTest;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.optical.service.rev191206.OpticalServiceCreateInputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.optical.service.rev191206.OpticalServiceCreateOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.optical.service.rev191206.optical.service.create.request.PayloadBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.optical.service.rev191206.OpticalServiceDeleteInput;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.optical.service.rev191206.OpticalServiceDeleteInputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.optical.service.rev191206.OpticalServiceDeleteOutput;
-
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
public class TestOpticalServiceProvider extends AbstractConcurrentDataBrokerTest {
private OpticalServiceProvider opticalServiceProvider;
@@ -58,7 +53,7 @@ public class TestOpticalServiceProvider extends AbstractConcurrentDataBrokerTest
if (null == opticalServiceProvider) {
DataBroker dataBroker = getDataBroker();
NotificationPublishService mockNotification = mock(NotificationPublishService.class);
- RpcProviderRegistry mockRpcRegistry = mock(RpcProviderRegistry.class);
+ RpcProviderService mockRpcRegistry = mock(RpcProviderService.class);
OpticalServiceClient mockSliClient = mock(OpticalServiceClient.class);
when(mockSliClient.hasGraph(module, rpc, version, mode)).thenReturn(false);
opticalServiceProvider = new OpticalServiceProvider(dataBroker, mockNotification, mockRpcRegistry, mockSliClient);