From ce4e5f9a00d2677495240ad367b9bfc4b74752d0 Mon Sep 17 00:00:00 2001 From: Michael DÜrre Date: Mon, 18 Jan 2021 05:41:16 +0100 Subject: migrate sli to alu-SR1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit migrate ODL interfaces and fix code for changes in alu-SR1 Issue-ID: CCSDK-3089 Signed-off-by: Michael DÜrre Change-Id: Iad824627c581c902b639a2f0246e3133d4e38c48 --- .../sli/northbound/asdcapi/AsdcApiProvider.java | 49 +++++++++++----------- .../OSGI-INF/blueprint/asdc-blueprint.xml | 32 -------------- .../org/opendaylight/blueprint/asdc-blueprint.xml | 9 ++-- 3 files changed, 27 insertions(+), 63 deletions(-) delete mode 100644 northbound/asdcApi/provider/src/main/resources/OSGI-INF/blueprint/asdc-blueprint.xml (limited to 'northbound/asdcApi/provider/src/main') diff --git a/northbound/asdcApi/provider/src/main/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiProvider.java b/northbound/asdcApi/provider/src/main/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiProvider.java index 1a79f8c41..d8cf963b5 100644 --- a/northbound/asdcApi/provider/src/main/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiProvider.java +++ b/northbound/asdcApi/provider/src/main/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiProvider.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,19 +21,22 @@ package org.onap.ccsdk.sli.northbound.asdcapi; +import com.google.common.base.Optional; +import com.google.common.util.concurrent.FluentFuture; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; import java.util.Properties; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; - -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.api.ReadOnlyTransaction; -import org.opendaylight.controller.md.sal.binding.api.WriteTransaction; -import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; -import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; -import org.opendaylight.controller.sal.binding.api.BindingAwareBroker; -import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.mdsal.binding.api.DataBroker; +import org.opendaylight.mdsal.binding.api.NotificationPublishService; +import org.opendaylight.mdsal.binding.api.ReadTransaction; +import org.opendaylight.mdsal.binding.api.RpcProviderService; +import org.opendaylight.mdsal.binding.api.WriteTransaction; +import org.opendaylight.mdsal.common.api.CommitInfo; +import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.yang.gen.v1.http.xmlns.onap.org.asdc.license.model._1._0.rev160427.vf.license.model.grouping.VfLicenseModel; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.ASDCAPIService; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.Artifacts; @@ -49,17 +52,13 @@ import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.artifacts.ArtifactB import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.artifacts.ArtifactKey; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.vf.license.model.versions.VfLicenseModelVersion; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.vf.license.model.versions.VfLicenseModelVersionBuilder; +import org.opendaylight.yangtools.concepts.ObjectRegistration; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; 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.base.Optional; -import com.google.common.util.concurrent.CheckedFuture; -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 the MD-SAL. Additionally the @@ -104,14 +103,14 @@ public class AsdcApiProvider implements AutoCloseable, ASDCAPIService { private final ExecutorService executor; protected DataBroker dataBroker; protected NotificationPublishService notificationService; - protected RpcProviderRegistry rpcRegistry; + protected RpcProviderService rpcRegistry; private final AsdcApiSliClient asdcApiSliClient; - protected BindingAwareBroker.RpcRegistration rpcRegistration; + protected ObjectRegistration rpcRegistration; public AsdcApiProvider(final DataBroker dataBroker, final NotificationPublishService notificationPublishService, - final RpcProviderRegistry rpcProviderRegistry, + final RpcProviderService rpcProviderRegistry, final AsdcApiSliClient asdcApiSliClient) { LOG.info("Creating provider for {}", APPLICATION_NAME); @@ -130,7 +129,7 @@ public class AsdcApiProvider implements AutoCloseable, ASDCAPIService { if (rpcRegistration == null) { if (rpcRegistry != null) { - rpcRegistration = rpcRegistry.addRpcImplementation( + rpcRegistration = rpcRegistry.registerRpcImplementation( ASDCAPIService.class, this); LOG.info("Initialization complete for {}", APPLICATION_NAME); } else { @@ -152,7 +151,7 @@ public class AsdcApiProvider implements AutoCloseable, ASDCAPIService { try { - CheckedFuture checkedFuture = t.submit(); + FluentFuture checkedFuture = t.commit(); checkedFuture.get(); LOG.info("Create Containers succeeded!: "); @@ -180,7 +179,7 @@ public class AsdcApiProvider implements AutoCloseable, ASDCAPIService { InstanceIdentifier.builder(Artifacts.class) .child(Artifact.class, new ArtifactKey(aName, aVersion)).build(); Optional data = null; - try(ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction()) { + try(ReadTransaction readTx = dataBroker.newReadOnlyTransaction()) { data = (Optional) readTx.read(LogicalDatastoreType.CONFIGURATION, artifactInstanceId).get(); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught Exception reading MD-SAL for ["+aName+","+ aVersion+"] " ,e); @@ -211,7 +210,7 @@ public class AsdcApiProvider implements AutoCloseable, ASDCAPIService { tx.merge(LogicalDatastoreType.CONFIGURATION, path, artifact); - tx.submit().checkedGet(); + tx.commit().get(); } catch (Exception e) { LOG.error("Caught exception trying to add artifact entry", e); } @@ -245,7 +244,7 @@ public class AsdcApiProvider implements AutoCloseable, ASDCAPIService { WriteTransaction tx = dataBroker.newWriteOnlyTransaction(); tx.merge(LogicalDatastoreType.CONFIGURATION, path, version); - tx.submit().checkedGet(); + tx.commit().get(); } catch (Exception e) { LOG.error( "Caught exception trying to save entry to MD-SAL", @@ -272,7 +271,7 @@ public class AsdcApiProvider implements AutoCloseable, ASDCAPIService { tx.merge(LogicalDatastoreType.CONFIGURATION, path, version); - tx.submit().checkedGet(); + tx.commit().get(); } catch (Exception e) { LOG.error( "Caught exception trying to save entry to MD-SAL", diff --git a/northbound/asdcApi/provider/src/main/resources/OSGI-INF/blueprint/asdc-blueprint.xml b/northbound/asdcApi/provider/src/main/resources/OSGI-INF/blueprint/asdc-blueprint.xml deleted file mode 100644 index 9ad08d3db..000000000 --- a/northbound/asdcApi/provider/src/main/resources/OSGI-INF/blueprint/asdc-blueprint.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/northbound/asdcApi/provider/src/main/resources/org/opendaylight/blueprint/asdc-blueprint.xml b/northbound/asdcApi/provider/src/main/resources/org/opendaylight/blueprint/asdc-blueprint.xml index 9ad08d3db..68925b115 100644 --- a/northbound/asdcApi/provider/src/main/resources/org/opendaylight/blueprint/asdc-blueprint.xml +++ b/northbound/asdcApi/provider/src/main/resources/org/opendaylight/blueprint/asdc-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" /> -- cgit 1.2.3-korg