From 2e63f133b29f1bb7fccaf6e35d11488f042a5855 Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Thu, 4 Feb 2021 10:30:40 -0500 Subject: Upgrade to ODL Aluminum Updated code to conform to OpenDaylight Aluminum release. Change-Id: I3ef7daebc689a5d2e344fc7b96ce885bda77a7f8 Issue-ID: SDNC-1474 Signed-off-by: Dan Timoney --- .../features/features-optical-service/pom.xml | 2 +- optical-service/features/pom.xml | 2 +- .../features/sdnc-optical-service/pom.xml | 2 +- optical-service/installer/pom.xml | 2 +- optical-service/model/pom.xml | 2 +- optical-service/pom.xml | 2 +- optical-service/provider/pom.xml | 58 +++++++++++----------- .../sdnc/northbound/OpticalServiceProvider.java | 30 ++++++----- .../blueprint/optical-service-blueprint.xml | 32 ------------ .../blueprint/optical-service-blueprint.xml | 9 ++-- .../northbound/TestOpticalServiceProvider.java | 25 ++++------ 11 files changed, 64 insertions(+), 102 deletions(-) delete mode 100644 optical-service/provider/src/main/resources/OSGI-INF/blueprint/optical-service-blueprint.xml (limited to 'optical-service') diff --git a/optical-service/features/features-optical-service/pom.xml b/optical-service/features/features-optical-service/pom.xml index e693910d..77380425 100644 --- a/optical-service/features/features-optical-service/pom.xml +++ b/optical-service/features/features-optical-service/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent feature-repo-parent - 2.1.0 + 2.1.1-SNAPSHOT diff --git a/optical-service/features/pom.xml b/optical-service/features/pom.xml index c67f97f7..da6744bd 100644 --- a/optical-service/features/pom.xml +++ b/optical-service/features/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 2.1.0 + 2.1.1-SNAPSHOT diff --git a/optical-service/features/sdnc-optical-service/pom.xml b/optical-service/features/sdnc-optical-service/pom.xml index ae00dfd0..93e968f1 100644 --- a/optical-service/features/sdnc-optical-service/pom.xml +++ b/optical-service/features/sdnc-optical-service/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent single-feature-parent - 2.1.0 + 2.1.1-SNAPSHOT diff --git a/optical-service/installer/pom.xml b/optical-service/installer/pom.xml index 757f6aaf..82cf0222 100644 --- a/optical-service/installer/pom.xml +++ b/optical-service/installer/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 2.1.0 + 2.1.1-SNAPSHOT diff --git a/optical-service/model/pom.xml b/optical-service/model/pom.xml index f4294ca1..a17a134a 100644 --- a/optical-service/model/pom.xml +++ b/optical-service/model/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent binding-parent - 2.1.0 + 2.1.1-SNAPSHOT diff --git a/optical-service/pom.xml b/optical-service/pom.xml index a0fe1116..2eb28882 100644 --- a/optical-service/pom.xml +++ b/optical-service/pom.xml @@ -5,7 +5,7 @@ org.onap.ccsdk.parent odlparent-lite - 2.1.0 + 2.1.1-SNAPSHOT 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 @@ org.onap.ccsdk.parent binding-parent - 2.1.0 - + 2.1.1-SNAPSHOT + org.onap.sdnc.northbound @@ -21,15 +21,15 @@ - - - org.onap.ccsdk.sli.core - sli-core-artifacts - ${ccsdk.sli.core.version} - pom - import - - + + + org.onap.ccsdk.sli.core + sli-core-artifacts + ${ccsdk.sli.core.version} + pom + import + + @@ -37,10 +37,6 @@ optical-service-model ${project.version} - - org.opendaylight.controller - sal-binding-api - org.onap.ccsdk.sli.core sli-common @@ -50,10 +46,10 @@ sli-provider - org.osgi - org.osgi.service.component.annotations - 1.4.0 - provided + org.osgi + org.osgi.service.component.annotations + 1.4.0 + provided javax.servlet @@ -67,27 +63,29 @@ org.apache.velocity velocity-engine-core 2.0 - + commons-codec commons-codec 1.9 - - org.opendaylight.controller - sal-test-model + + org.opendaylight.mdsal + mdsal-binding-api + + + org.opendaylight.mdsal + mdsal-binding-test-model test - + - org.opendaylight.controller - sal-binding-broker-impl + org.opendaylight.mdsal + mdsal-binding-test-utils test - org.opendaylight.controller - sal-binding-broker-impl - test-jar - tests + org.opendaylight.mdsal + mdsal-binding-dom-adapter test 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 rpcRegistration; + protected RpcProviderService rpcProviderService; + protected ObjectRegistration 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 @@ - - - - - - - - - - - - - - - - - - - - - - - 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 @@ + interface="org.opendaylight.mdsal.binding.api.DataBroker" /> + interface="org.opendaylight.mdsal.binding.api.NotificationPublishService" /> + interface="org.opendaylight.mdsal.binding.api.RpcProviderService" /> 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); -- cgit 1.2.3-korg