diff options
Diffstat (limited to 'northbound')
23 files changed, 581 insertions, 387 deletions
diff --git a/northbound/asdcApi/provider/pom.xml b/northbound/asdcApi/provider/pom.xml index a7ced7ad2..19e5660f7 100755 --- a/northbound/asdcApi/provider/pom.xml +++ b/northbound/asdcApi/provider/pom.xml @@ -35,8 +35,8 @@ </dependency> <dependency> - <groupId>org.opendaylight.mdsal</groupId> - <artifactId>mdsal-binding-api</artifactId> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-binding-api</artifactId> </dependency> <dependency> @@ -54,18 +54,24 @@ </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.mdsal</groupId> - <artifactId>mdsal-binding-dom-adapter</artifactId> + <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> 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 d8cf963b5..1a79f8c41 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,22 +21,19 @@ 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.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.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.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; @@ -52,13 +49,17 @@ 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 @@ -103,14 +104,14 @@ public class AsdcApiProvider implements AutoCloseable, ASDCAPIService { private final ExecutorService executor; protected DataBroker dataBroker; protected NotificationPublishService notificationService; - protected RpcProviderService rpcRegistry; + protected RpcProviderRegistry rpcRegistry; private final AsdcApiSliClient asdcApiSliClient; - protected ObjectRegistration<ASDCAPIService> rpcRegistration; + protected BindingAwareBroker.RpcRegistration<ASDCAPIService> rpcRegistration; public AsdcApiProvider(final DataBroker dataBroker, final NotificationPublishService notificationPublishService, - final RpcProviderService rpcProviderRegistry, + final RpcProviderRegistry rpcProviderRegistry, final AsdcApiSliClient asdcApiSliClient) { LOG.info("Creating provider for {}", APPLICATION_NAME); @@ -129,7 +130,7 @@ public class AsdcApiProvider implements AutoCloseable, ASDCAPIService { if (rpcRegistration == null) { if (rpcRegistry != null) { - rpcRegistration = rpcRegistry.registerRpcImplementation( + rpcRegistration = rpcRegistry.addRpcImplementation( ASDCAPIService.class, this); LOG.info("Initialization complete for {}", APPLICATION_NAME); } else { @@ -151,7 +152,7 @@ public class AsdcApiProvider implements AutoCloseable, ASDCAPIService { try { - FluentFuture<? extends @NonNull CommitInfo> checkedFuture = t.commit(); + CheckedFuture<Void, TransactionCommitFailedException> checkedFuture = t.submit(); checkedFuture.get(); LOG.info("Create Containers succeeded!: "); @@ -179,7 +180,7 @@ public class AsdcApiProvider implements AutoCloseable, ASDCAPIService { InstanceIdentifier.<Artifacts>builder(Artifacts.class) .child(Artifact.class, new ArtifactKey(aName, aVersion)).build(); Optional<Artifact> data = null; - try(ReadTransaction readTx = dataBroker.newReadOnlyTransaction()) { + try(ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction()) { data = (Optional<Artifact>) readTx.read(LogicalDatastoreType.CONFIGURATION, artifactInstanceId).get(); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught Exception reading MD-SAL for ["+aName+","+ aVersion+"] " ,e); @@ -210,7 +211,7 @@ public class AsdcApiProvider implements AutoCloseable, ASDCAPIService { tx.merge(LogicalDatastoreType.CONFIGURATION, path, artifact); - tx.commit().get(); + tx.submit().checkedGet(); } catch (Exception e) { LOG.error("Caught exception trying to add artifact entry", e); } @@ -244,7 +245,7 @@ public class AsdcApiProvider implements AutoCloseable, ASDCAPIService { WriteTransaction tx = dataBroker.newWriteOnlyTransaction(); tx.merge(LogicalDatastoreType.CONFIGURATION, path, version); - tx.commit().get(); + tx.submit().checkedGet(); } catch (Exception e) { LOG.error( "Caught exception trying to save entry to MD-SAL", @@ -271,7 +272,7 @@ public class AsdcApiProvider implements AutoCloseable, ASDCAPIService { tx.merge(LogicalDatastoreType.CONFIGURATION, path, version); - tx.commit().get(); + tx.submit().checkedGet(); } 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 new file mode 100644 index 000000000..9ad08d3db --- /dev/null +++ b/northbound/asdcApi/provider/src/main/resources/OSGI-INF/blueprint/asdc-blueprint.xml @@ -0,0 +1,32 @@ +<?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.ccsdk.sli.northbound.asdcapi.AsdcApiSliClient"> + <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.ccsdk.sli.northbound.asdcapi.AsdcApiProvider"> + <argument ref="dataBroker" /> + <argument ref="notificationService" /> + <argument ref="rpcRegistry" /> + <argument ref="client" /> + </bean> + +</blueprint>
\ 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 68925b115..9ad08d3db 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,13 +11,16 @@ </bean> <reference id="dataBroker" - interface="org.opendaylight.mdsal.binding.api.DataBroker" /> + interface="org.opendaylight.controller.md.sal.binding.api.DataBroker" + odl:type="default" /> <reference id="notificationService" - interface="org.opendaylight.mdsal.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" /> <bean id="provider" class="org.onap.ccsdk.sli.northbound.asdcapi.AsdcApiProvider"> <argument ref="dataBroker" /> diff --git a/northbound/asdcApi/provider/src/test/java/org/onap/ccsdk/sli/northbound/asdcapi/TestAsdcApiApi.java b/northbound/asdcApi/provider/src/test/java/org/onap/ccsdk/sli/northbound/asdcapi/TestAsdcApiApi.java index 15ed92776..1f266365c 100644 --- a/northbound/asdcApi/provider/src/test/java/org/onap/ccsdk/sli/northbound/asdcapi/TestAsdcApiApi.java +++ b/northbound/asdcApi/provider/src/test/java/org/onap/ccsdk/sli/northbound/asdcapi/TestAsdcApiApi.java @@ -21,95 +21,116 @@ package org.onap.ccsdk.sli.northbound.asdcapi; -public class TestAsdcApiApi {//extends AbstractConcurrentDataBrokerTest { - -// private AsdcApiProvider asdcApiProvider; -// private static final Logger LOG = LoggerFactory.getLogger(AsdcApiProvider.class); -// -// @Before -// public void setUp() throws Exception { -// if (null == asdcApiProvider) { -// DataBroker dataBroker = getDataBroker(); -// NotificationPublishService mockNotification = mock(NotificationPublishService.class); -// RpcProviderService mockRpcRegistry = mock(RpcProviderService.class); -// AsdcApiSliClient mockSliClient = mock(AsdcApiSliClient.class); -// Properties respProps = new Properties(); -// respProps.setProperty("error-code", "200"); -// respProps.setProperty("error-message", "Success"); -// -// when(mockSliClient.hasGraph("ASDC-API", "vf-license-model-update" , null, "sync")).thenReturn(true); -// when(mockSliClient.execute("ASDC-API", "vf-license-model-update", null, "sync", respProps)).thenReturn(respProps); -// -// asdcApiProvider = new AsdcApiProvider(dataBroker, mockNotification, mockRpcRegistry, mockSliClient); -// } -// } -// -// //Testcase should return error 503 when No service logic active for ASDC-API. -// @Test -// public void testVfLicenseModelUpdate() { -// -// VfLicenseModelUpdateInputBuilder inputBuilder = new VfLicenseModelUpdateInputBuilder(); -// -// inputBuilder.setArtifactName("abc"); -// inputBuilder.setArtifactVersion("1"); -// -// // TODO: currently initialize SvcLogicServiceClient is failing, need to fix -// java.util.concurrent.Future<RpcResult<VfLicenseModelUpdateOutput>> future = asdcApiProvider -// .vfLicenseModelUpdate(inputBuilder.build()); -// RpcResult<VfLicenseModelUpdateOutput> rpcResult = null; -// try { -// rpcResult = future.get(); -// } catch (Exception e) { -// fail("Error : " + e); -// } -// LOG.info("result: {}", rpcResult); -// assertEquals("200", rpcResult.getResult().getAsdcApiResponseCode()); -// } -// -// //Input parameter validation -// @Test -// public void testVfLicenseModelUpdateInputValidation() { -// -// VfLicenseModelUpdateInputBuilder inputBuilder = new VfLicenseModelUpdateInputBuilder(); -// -// inputBuilder.setArtifactName("abc"); -// inputBuilder.setArtifactVersion("1"); -// -// java.util.concurrent.Future<RpcResult<VfLicenseModelUpdateOutput>> future = asdcApiProvider -// .vfLicenseModelUpdate(null); -// assertNull(future); -// } -// -// @Test -// public void testVfLicenseModelUpdateValidation1() { -// -// VfLicenseModelUpdateInputBuilder inputBuilder = new VfLicenseModelUpdateInputBuilder(); -// -// inputBuilder.setArtifactName("license1"); -// inputBuilder.setArtifactVersion("version1"); -// -// VfLicenseModelBuilder vfLicenseModelBuilder = new VfLicenseModelBuilder(); -// vfLicenseModelBuilder.setVfId("123"); -// vfLicenseModelBuilder.setVendorName("acme"); -// inputBuilder.setVfLicenseModel(vfLicenseModelBuilder.build()); -// -// -// java.util.concurrent.Future<RpcResult<VfLicenseModelUpdateOutput>> future = asdcApiProvider -// .vfLicenseModelUpdate(inputBuilder.build()); -// RpcResult<VfLicenseModelUpdateOutput> rpcResult = null; -// try { -// rpcResult = future.get(); -// } catch (Exception e) { -// fail("Error : " + e); -// } -// } -// -// -// -// -// @Test -// public void testAddArtifactVersion() { -// asdcApiProvider.addArtifactVersion("artifact1", -// "version1"); -// } +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +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.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.http.xmlns.onap.org.asdc.license.model._1._0.rev160427.vf.license.model.grouping.VfLicenseModelBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.VfLicenseModelUpdateInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.VfLicenseModelUpdateOutput; +import org.opendaylight.yangtools.yang.common.RpcResult; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Properties; + +public class TestAsdcApiApi extends AbstractConcurrentDataBrokerTest { + + private AsdcApiProvider asdcApiProvider; + private static final Logger LOG = LoggerFactory.getLogger(AsdcApiProvider.class); + + @Before + public void setUp() throws Exception { + if (null == asdcApiProvider) { + DataBroker dataBroker = getDataBroker(); + NotificationPublishService mockNotification = mock(NotificationPublishService.class); + RpcProviderRegistry mockRpcRegistry = mock(RpcProviderRegistry.class); + AsdcApiSliClient mockSliClient = mock(AsdcApiSliClient.class); + Properties respProps = new Properties(); + respProps.setProperty("error-code", "200"); + respProps.setProperty("error-message", "Success"); + + when(mockSliClient.hasGraph("ASDC-API", "vf-license-model-update" , null, "sync")).thenReturn(true); + when(mockSliClient.execute("ASDC-API", "vf-license-model-update", null, "sync", respProps)).thenReturn(respProps); + + asdcApiProvider = new AsdcApiProvider(dataBroker, mockNotification, mockRpcRegistry, mockSliClient); + } + } + + //Testcase should return error 503 when No service logic active for ASDC-API. + @Test + public void testVfLicenseModelUpdate() { + + VfLicenseModelUpdateInputBuilder inputBuilder = new VfLicenseModelUpdateInputBuilder(); + + inputBuilder.setArtifactName("abc"); + inputBuilder.setArtifactVersion("1"); + + // TODO: currently initialize SvcLogicServiceClient is failing, need to fix + java.util.concurrent.Future<RpcResult<VfLicenseModelUpdateOutput>> future = asdcApiProvider + .vfLicenseModelUpdate(inputBuilder.build()); + RpcResult<VfLicenseModelUpdateOutput> rpcResult = null; + try { + rpcResult = future.get(); + } catch (Exception e) { + fail("Error : " + e); + } + LOG.info("result: {}", rpcResult); + assertEquals("200", rpcResult.getResult().getAsdcApiResponseCode()); + } + + //Input parameter validation + @Test + public void testVfLicenseModelUpdateInputValidation() { + + VfLicenseModelUpdateInputBuilder inputBuilder = new VfLicenseModelUpdateInputBuilder(); + + inputBuilder.setArtifactName("abc"); + inputBuilder.setArtifactVersion("1"); + + java.util.concurrent.Future<RpcResult<VfLicenseModelUpdateOutput>> future = asdcApiProvider + .vfLicenseModelUpdate(null); + assertNull(future); + } + + @Test + public void testVfLicenseModelUpdateValidation1() { + + VfLicenseModelUpdateInputBuilder inputBuilder = new VfLicenseModelUpdateInputBuilder(); + + inputBuilder.setArtifactName("license1"); + inputBuilder.setArtifactVersion("version1"); + + VfLicenseModelBuilder vfLicenseModelBuilder = new VfLicenseModelBuilder(); + vfLicenseModelBuilder.setVfId("123"); + vfLicenseModelBuilder.setVendorName("acme"); + inputBuilder.setVfLicenseModel(vfLicenseModelBuilder.build()); + + + java.util.concurrent.Future<RpcResult<VfLicenseModelUpdateOutput>> future = asdcApiProvider + .vfLicenseModelUpdate(inputBuilder.build()); + RpcResult<VfLicenseModelUpdateOutput> rpcResult = null; + try { + rpcResult = future.get(); + } catch (Exception e) { + fail("Error : " + e); + } + } + + + + + @Test + public void testAddArtifactVersion() { + asdcApiProvider.addArtifactVersion("artifact1", + "version1"); + } } diff --git a/northbound/daexim-offsite-backup/provider/pom.xml b/northbound/daexim-offsite-backup/provider/pom.xml index 9db8934f6..c7b7d1c86 100755 --- a/northbound/daexim-offsite-backup/provider/pom.xml +++ b/northbound/daexim-offsite-backup/provider/pom.xml @@ -23,30 +23,30 @@ <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.opendaylight.controller</groupId> <artifactId>sal-common-util</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>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> diff --git a/northbound/daexim-offsite-backup/provider/src/main/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProvider.java b/northbound/daexim-offsite-backup/provider/src/main/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProvider.java index 7ee2a91d7..09c8f92f4 100755 --- a/northbound/daexim-offsite-backup/provider/src/main/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProvider.java +++ b/northbound/daexim-offsite-backup/provider/src/main/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProvider.java @@ -21,9 +21,6 @@ package org.onap.ccsdk.sli.northbound.daeximoffsitebackup; -import com.google.common.util.concurrent.FluentFuture; -import com.google.common.util.concurrent.Futures; -import com.google.common.util.concurrent.ListenableFuture; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -47,22 +44,27 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import java.util.zip.ZipOutputStream; import javax.annotation.Nonnull; -import org.eclipse.jdt.annotation.NonNull; -import org.opendaylight.mdsal.binding.api.DataBroker; -import org.opendaylight.mdsal.binding.api.DataTreeChangeListener; -import org.opendaylight.mdsal.binding.api.RpcProviderService; -import org.opendaylight.mdsal.binding.api.WriteTransaction; -import org.opendaylight.mdsal.common.api.CommitInfo; + +import com.google.common.util.concurrent.CheckedFuture; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; + +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.WriteTransaction; +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.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.BackupDataInput; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.BackupDataOutput; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.BackupDataOutputBuilder; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.DaeximOffsiteBackupService; -import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.RetrieveDataInput; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.RetrieveDataOutput; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.RetrieveDataOutputBuilder; -import org.opendaylight.yangtools.concepts.ObjectRegistration; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.RetrieveDataInput; import org.opendaylight.yangtools.yang.common.RpcResult; import org.opendaylight.yangtools.yang.common.RpcResultBuilder; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -84,11 +86,11 @@ public class DaeximOffsiteBackupProvider implements AutoCloseable, DaeximOffsite private final ExecutorService executor; private Properties properties; private DataBroker dataBroker; - private RpcProviderService rpcRegistry; - private ObjectRegistration<DaeximOffsiteBackupService> rpcRegistration; + private RpcProviderRegistry rpcRegistry; + private BindingAwareBroker.RpcRegistration<DaeximOffsiteBackupService> rpcRegistration; public DaeximOffsiteBackupProvider(DataBroker dataBroker, - RpcProviderService rpcProviderRegistry) { + RpcProviderRegistry rpcProviderRegistry) { LOG.info("Creating provider for " + appName); this.executor = Executors.newFixedThreadPool(1); this.dataBroker = dataBroker; @@ -105,7 +107,7 @@ public class DaeximOffsiteBackupProvider implements AutoCloseable, DaeximOffsite } catch (Exception e) { LOG.error("Caught Exception while trying to load properties file", e); } - rpcRegistration = rpcRegistry.registerRpcImplementation(DaeximOffsiteBackupService.class, this); + rpcRegistration = rpcRegistry.addRpcImplementation(DaeximOffsiteBackupService.class, this); LOG.info("Initialization complete for " + appName); } @@ -171,7 +173,7 @@ public class DaeximOffsiteBackupProvider implements AutoCloseable, DaeximOffsite private void createContainers() { final WriteTransaction t = dataBroker.newReadWriteTransaction(); try { - FluentFuture<? extends @NonNull CommitInfo> checkedFuture = t.commit(); + CheckedFuture<Void, TransactionCommitFailedException> checkedFuture = t.submit(); checkedFuture.get(); LOG.info("Create Containers succeeded!: "); } catch (InterruptedException | ExecutionException e) { diff --git a/northbound/daexim-offsite-backup/provider/src/main/resources/OSGI-INF/blueprint/DaeximOffsiteBackup.xml b/northbound/daexim-offsite-backup/provider/src/main/resources/OSGI-INF/blueprint/DaeximOffsiteBackup.xml new file mode 100755 index 000000000..8e2101ad3 --- /dev/null +++ b/northbound/daexim-offsite-backup/provider/src/main/resources/OSGI-INF/blueprint/DaeximOffsiteBackup.xml @@ -0,0 +1,20 @@ +<?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="dataBroker" + interface="org.opendaylight.controller.md.sal.binding.api.DataBroker" + odl:type="default" /> + + <reference id="rpcRegistry" + interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry" + odl:type="default" /> + + <bean id="provider" class="org.onap.ccsdk.sli.northbound.daeximoffsitebackup.DaeximOffsiteBackupProvider"> + <argument ref="dataBroker" /> + <argument ref="rpcRegistry" /> + </bean> + + <odl:rpc-implementation ref="provider"/> +</blueprint> diff --git a/northbound/daexim-offsite-backup/provider/src/main/resources/org/opendaylight/blueprint/DaeximOffsiteBackup.xml b/northbound/daexim-offsite-backup/provider/src/main/resources/org/opendaylight/blueprint/DaeximOffsiteBackup.xml index 6118f28c3..8e2101ad3 100755 --- a/northbound/daexim-offsite-backup/provider/src/main/resources/org/opendaylight/blueprint/DaeximOffsiteBackup.xml +++ b/northbound/daexim-offsite-backup/provider/src/main/resources/org/opendaylight/blueprint/DaeximOffsiteBackup.xml @@ -4,10 +4,12 @@ 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="rpcRegistry" - interface="org.opendaylight.mdsal.binding.api.RpcProviderService" /> + interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry" + odl:type="default" /> <bean id="provider" class="org.onap.ccsdk.sli.northbound.daeximoffsitebackup.DaeximOffsiteBackupProvider"> <argument ref="dataBroker" /> diff --git a/northbound/daexim-offsite-backup/provider/src/test/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProviderTest.java b/northbound/daexim-offsite-backup/provider/src/test/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProviderTest.java index 03fe37513..0f0cee288 100644 --- a/northbound/daexim-offsite-backup/provider/src/test/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProviderTest.java +++ b/northbound/daexim-offsite-backup/provider/src/test/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProviderTest.java @@ -26,7 +26,7 @@ import static org.junit.Assert.fail; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import com.google.common.util.concurrent.FluentFuture; +import com.google.common.util.concurrent.CheckedFuture; import java.io.File; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; @@ -38,9 +38,10 @@ import java.util.concurrent.ExecutionException; import org.eclipse.jdt.annotation.Nullable; import org.junit.Before; import org.junit.Test; -import org.opendaylight.mdsal.binding.api.DataBroker; -import org.opendaylight.mdsal.binding.api.ReadWriteTransaction; -import org.opendaylight.mdsal.binding.api.RpcProviderService; +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; +import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; +import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.DaeximOffsiteBackupService; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.RetrieveDataInput; import org.opendaylight.yangtools.yang.binding.Augmentation; @@ -48,8 +49,8 @@ import org.opendaylight.yangtools.yang.binding.Augmentation; public class DaeximOffsiteBackupProviderTest { public DataBroker dataBroker; public ReadWriteTransaction writeTransaction; - public FluentFuture checkedFuture; - public RpcProviderService rpcRegistry; + public CheckedFuture<Void, TransactionCommitFailedException> checkedFuture; + public RpcProviderRegistry rpcRegistry; public DaeximOffsiteBackupProvider provider; public Properties resProps; @@ -60,16 +61,16 @@ public class DaeximOffsiteBackupProviderTest { resProps.put("error-message", "Success"); dataBroker = mock(DataBroker.class); writeTransaction = mock(ReadWriteTransaction.class); - checkedFuture = mock(FluentFuture.class); - rpcRegistry = mock(RpcProviderService.class); - when(rpcRegistry.registerRpcImplementation(any(), any(DaeximOffsiteBackupService.class))).thenReturn(null); + checkedFuture = mock(CheckedFuture.class); + rpcRegistry = mock(RpcProviderRegistry.class); + when(rpcRegistry.addRoutedRpcImplementation(any(), any(DaeximOffsiteBackupService.class))).thenReturn(null); try { when(checkedFuture.get()).thenReturn(null); } catch(InterruptedException | ExecutionException e) { e.printStackTrace(); } - when(writeTransaction.commit()).thenReturn(checkedFuture); + when(writeTransaction.submit()).thenReturn(checkedFuture); when(dataBroker.newReadWriteTransaction()).thenReturn(writeTransaction); provider = new DaeximOffsiteBackupProvider(dataBroker, rpcRegistry); diff --git a/northbound/dataChange/provider/pom.xml b/northbound/dataChange/provider/pom.xml index 03f46e68b..10f6f001a 100755 --- a/northbound/dataChange/provider/pom.xml +++ b/northbound/dataChange/provider/pom.xml @@ -35,8 +35,8 @@ </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> @@ -48,28 +48,24 @@ </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.mdsal</groupId> - <artifactId>mdsal-dom-api</artifactId> + <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> diff --git a/northbound/dataChange/provider/src/main/java/org/onap/ccsdk/sli/northbound/DataChangeProvider.java b/northbound/dataChange/provider/src/main/java/org/onap/ccsdk/sli/northbound/DataChangeProvider.java index cf4b07a70..3301ca8e0 100644 --- a/northbound/dataChange/provider/src/main/java/org/onap/ccsdk/sli/northbound/DataChangeProvider.java +++ b/northbound/dataChange/provider/src/main/java/org/onap/ccsdk/sli/northbound/DataChangeProvider.java @@ -9,9 +9,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. @@ -22,26 +22,28 @@ package org.onap.ccsdk.sli.northbound; -import com.google.common.util.concurrent.Futures; -import com.google.common.util.concurrent.ListenableFuture; import java.util.Properties; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; + import org.onap.ccsdk.sli.core.sli.provider.MdsalHelper; -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.BindingAwareBroker; +import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationInput; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationInputBuilder; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationOutput; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationOutputBuilder; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeService; -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 the MD-SAL. Additionally the @@ -58,14 +60,14 @@ public class DataChangeProvider implements AutoCloseable, DataChangeService { protected DataBroker dataBroker; protected NotificationPublishService notificationService; - protected RpcProviderService rpcRegistry; - protected ObjectRegistration<DataChangeService> rpcRegistration; + protected RpcProviderRegistry rpcRegistry; + protected BindingAwareBroker.RpcRegistration<DataChangeService> rpcRegistration; private final DataChangeClient dataChangeClient; public DataChangeProvider(final DataBroker dataBroker, final NotificationPublishService notificationPublishService, - final RpcProviderService rpcProviderRegistry, + final RpcProviderRegistry rpcProviderRegistry, final DataChangeClient dataChangeClient) { this.LOG.info( "Creating provider for {}", APPLICATION_NAME); @@ -79,7 +81,7 @@ public class DataChangeProvider implements AutoCloseable, DataChangeService { public void initialize(){ LOG.info( "Initializing provider for {}", APPLICATION_NAME); - rpcRegistration = rpcRegistry.registerRpcImplementation(DataChangeService.class, this); + rpcRegistration = rpcRegistry.addRpcImplementation(DataChangeService.class, this); LOG.info( "Initialization complete for {}", APPLICATION_NAME); } diff --git a/northbound/dataChange/provider/src/main/resources/OSGI-INF/blueprint/datachange-blueprint.xml b/northbound/dataChange/provider/src/main/resources/OSGI-INF/blueprint/datachange-blueprint.xml new file mode 100644 index 000000000..5a38c81f1 --- /dev/null +++ b/northbound/dataChange/provider/src/main/resources/OSGI-INF/blueprint/datachange-blueprint.xml @@ -0,0 +1,32 @@ +<?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.ccsdk.sli.northbound.DataChangeClient"> + <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.ccsdk.sli.northbound.DataChangeProvider"> + <argument ref="dataBroker" /> + <argument ref="notificationService" /> + <argument ref="rpcRegistry" /> + <argument ref="client" /> + </bean> + +</blueprint>
\ No newline at end of file diff --git a/northbound/dataChange/provider/src/main/resources/org/opendaylight/blueprint/datachange-blueprint.xml b/northbound/dataChange/provider/src/main/resources/org/opendaylight/blueprint/datachange-blueprint.xml index 7bc0076dd..5a38c81f1 100644 --- a/northbound/dataChange/provider/src/main/resources/org/opendaylight/blueprint/datachange-blueprint.xml +++ b/northbound/dataChange/provider/src/main/resources/org/opendaylight/blueprint/datachange-blueprint.xml @@ -11,13 +11,16 @@ </bean> <reference id="dataBroker" - interface="org.opendaylight.mdsal.binding.api.DataBroker" /> + interface="org.opendaylight.controller.md.sal.binding.api.DataBroker" + odl:type="default" /> <reference id="notificationService" - interface="org.opendaylight.mdsal.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" /> <bean id="provider" class="org.onap.ccsdk.sli.northbound.DataChangeProvider"> <argument ref="dataBroker" /> diff --git a/northbound/dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/DataChangeClientTest.java b/northbound/dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/DataChangeClientTest.java index 88a7f5bf0..9ba6c8742 100644 --- a/northbound/dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/DataChangeClientTest.java +++ b/northbound/dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/DataChangeClientTest.java @@ -1,55 +1,56 @@ -package org.onap.sdnc.northbound.dataChange; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; -import java.util.Properties; -import org.junit.Before; -import org.junit.Test; -import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService; -import org.onap.ccsdk.sli.northbound.DataChangeClient; -import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationOutputBuilder; - -public class DataChangeClientTest { - - SvcLogicService mockSvcLogicService; - String module = "test-module"; - String rpc = "test-rpc"; - String version = "test-version"; - String mode = "test-mode"; - Properties localProp = new Properties(); - - @Before - public void setUp() throws Exception { - mockSvcLogicService = mock(SvcLogicService.class); - when(mockSvcLogicService.hasGraph(module, rpc, version, mode)).thenReturn(true); - } - - @Test - public void testDataChangeClientConstructor() { - DataChangeClient dataChangeClient = new DataChangeClient(mockSvcLogicService); - assertNotNull(dataChangeClient); - } - - @Test - public void testHasGraph() throws SvcLogicException { - DataChangeClient dataChangeClient = new DataChangeClient(mockSvcLogicService); - boolean result = dataChangeClient.hasGraph(module, rpc, version, mode); - assertTrue(result); - } - - @Test - public void testExecuteSvcLogicStatusFailure() throws SvcLogicException { - DataChangeNotificationOutputBuilder serviceData = mock(DataChangeNotificationOutputBuilder.class); - Properties parms = mock(Properties.class); - SvcLogicService svcLogicService = mock(SvcLogicService.class); - Properties properties = new Properties(); - properties.setProperty("SvcLogic.status", "failure"); - when(svcLogicService.execute(module, rpc, version, mode, properties)).thenReturn(properties); - DataChangeClient sliClient = new DataChangeClient(svcLogicService); - Properties prop = sliClient.execute(module, rpc, version, mode, serviceData, properties); - assertTrue(prop != null); - } +package org.onap.sdnc.northbound.dataChange; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.*; + +import java.util.Properties; + +import org.junit.Before; +import org.junit.Test; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.provider.MdsalHelper; +import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService; +import org.onap.ccsdk.sli.northbound.DataChangeClient; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationOutputBuilder; + +public class DataChangeClientTest { + + SvcLogicService mockSvcLogicService; + String module = "test-module"; + String rpc = "test-rpc"; + String version = "test-version"; + String mode = "test-mode"; + Properties localProp = new Properties(); + + @Before + public void setUp() throws Exception { + mockSvcLogicService = mock(SvcLogicService.class); + when(mockSvcLogicService.hasGraph(module, rpc, version, mode)).thenReturn(true); + } + + @Test + public void testDataChangeClientConstructor() { + DataChangeClient dataChangeClient = new DataChangeClient(mockSvcLogicService); + assertNotNull(dataChangeClient); + } + + @Test + public void testHasGraph() throws SvcLogicException { + DataChangeClient dataChangeClient = new DataChangeClient(mockSvcLogicService); + boolean result = dataChangeClient.hasGraph(module, rpc, version, mode); + assertTrue(result); + } + + @Test + public void testExecuteSvcLogicStatusFailure() throws SvcLogicException { + DataChangeNotificationOutputBuilder serviceData = mock(DataChangeNotificationOutputBuilder.class); + Properties parms = mock(Properties.class); + SvcLogicService svcLogicService = mock(SvcLogicService.class); + Properties properties = new Properties(); + properties.setProperty("SvcLogic.status", "failure"); + when(svcLogicService.execute(module, rpc, version, mode, properties)).thenReturn(properties); + DataChangeClient sliClient = new DataChangeClient(svcLogicService); + Properties prop = sliClient.execute(module, rpc, version, mode, serviceData, properties); + assertTrue(prop != null); + } }
\ No newline at end of file diff --git a/northbound/dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/TestDataChange.java b/northbound/dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/TestDataChange.java index ad2e85498..f9c39b703 100644 --- a/northbound/dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/TestDataChange.java +++ b/northbound/dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/TestDataChange.java @@ -21,57 +21,75 @@ package org.onap.sdnc.northbound.dataChange; -public class TestDataChange {//extends AbstractConcurrentDataBrokerTest { +import org.junit.Before; +import org.junit.Test; +import org.onap.ccsdk.sli.northbound.DataChangeProvider; +import org.onap.ccsdk.sli.northbound.DataChangeClient; +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.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationInput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationOutput; +import org.opendaylight.yangtools.yang.common.RpcResult; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; -// private DataChangeProvider dataChangeProvider; -// private static final Logger LOG = LoggerFactory.getLogger(DataChangeProvider.class); -// -// @Before -// public void setUp() throws Exception { -// if (null == dataChangeProvider) { -// DataBroker dataBroker = getDataBroker(); -// NotificationPublishService mockNotification = mock(NotificationPublishService.class); -// RpcProviderService mockRpcRegistry = mock(RpcProviderService.class); -// DataChangeClient mockSliClient = mock(DataChangeClient.class); -// dataChangeProvider = new DataChangeProvider(dataBroker, mockNotification, mockRpcRegistry, mockSliClient); -// } -// } -// -// //Testcase should return error 503 when No service logic active for dataChange. -// @Test -// public void testDataChangeNotification() { -// -// DataChangeNotificationInputBuilder inputBuilder = new DataChangeNotificationInputBuilder(); -// -// inputBuilder.setAaiEventId("1"); -// -// -// // TODO: currently initialize SvcLogicServiceClient is failing, need to fix -// java.util.concurrent.Future<RpcResult<DataChangeNotificationOutput>> future = dataChangeProvider -// .dataChangeNotification(inputBuilder.build()); -// RpcResult<DataChangeNotificationOutput> rpcResult = null; -// try { -// rpcResult = future.get(); -// } catch (Exception e) { -// fail("Error : " + e); -// } -// LOG.info("result: {}", rpcResult); -// assertEquals("503", rpcResult.getResult().getDataChangeResponseCode()); -// } -// -// //Input parameter validation -// @Test -// public void testDataChangeNotificationInputValidation() { -// -// java.util.concurrent.Future<RpcResult<DataChangeNotificationOutput>> future = dataChangeProvider -// .dataChangeNotification(null); -// RpcResult<DataChangeNotificationOutput> rpcResult = null; -// try { -// rpcResult = future.get(); -// } catch (Exception e) { -// fail("Error : " + e); -// } -// LOG.info("result: {}", rpcResult); -// assertEquals("403", rpcResult.getResult().getDataChangeResponseCode()); -// } +import static org.junit.Assert.*; +import static org.mockito.Mockito.mock; + +public class TestDataChange extends AbstractConcurrentDataBrokerTest { + + private DataChangeProvider dataChangeProvider; + private static final Logger LOG = LoggerFactory.getLogger(DataChangeProvider.class); + + @Before + public void setUp() throws Exception { + if (null == dataChangeProvider) { + DataBroker dataBroker = getDataBroker(); + NotificationPublishService mockNotification = mock(NotificationPublishService.class); + RpcProviderRegistry mockRpcRegistry = mock(RpcProviderRegistry.class); + DataChangeClient mockSliClient = mock(DataChangeClient.class); + dataChangeProvider = new DataChangeProvider(dataBroker, mockNotification, mockRpcRegistry, mockSliClient); + } + } + + //Testcase should return error 503 when No service logic active for dataChange. + @Test + public void testDataChangeNotification() { + + DataChangeNotificationInputBuilder inputBuilder = new DataChangeNotificationInputBuilder(); + + inputBuilder.setAaiEventId("1"); + + + // TODO: currently initialize SvcLogicServiceClient is failing, need to fix + java.util.concurrent.Future<RpcResult<DataChangeNotificationOutput>> future = dataChangeProvider + .dataChangeNotification(inputBuilder.build()); + RpcResult<DataChangeNotificationOutput> rpcResult = null; + try { + rpcResult = future.get(); + } catch (Exception e) { + fail("Error : " + e); + } + LOG.info("result: {}", rpcResult); + assertEquals("503", rpcResult.getResult().getDataChangeResponseCode()); + } + + //Input parameter validation + @Test + public void testDataChangeNotificationInputValidation() { + + java.util.concurrent.Future<RpcResult<DataChangeNotificationOutput>> future = dataChangeProvider + .dataChangeNotification(null); + RpcResult<DataChangeNotificationOutput> rpcResult = null; + try { + rpcResult = future.get(); + } catch (Exception e) { + fail("Error : " + e); + } + LOG.info("result: {}", rpcResult); + assertEquals("403", rpcResult.getResult().getDataChangeResponseCode()); + } } diff --git a/northbound/lcm/provider/pom.xml b/northbound/lcm/provider/pom.xml index bd6f762d0..5c32d4501 100755 --- a/northbound/lcm/provider/pom.xml +++ b/northbound/lcm/provider/pom.xml @@ -35,18 +35,18 @@ </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.opendaylight.controller</groupId> - <artifactId>sal-common-util</artifactId> - </dependency> + <artifactId>sal-binding-broker-impl</artifactId> + </dependency> <dependency> - <groupId>org.opendaylight.mdsal</groupId> - <artifactId>mdsal-dom-api</artifactId> - <scope>provided</scope> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-common-util</artifactId> </dependency> + <dependency> <groupId>org.onap.ccsdk.sli.core</groupId> <artifactId>sli-common</artifactId> @@ -58,6 +58,11 @@ <dependency> <groupId>org.onap.ccsdk.sli.core</groupId> <artifactId>sli-provider-base</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-core-api</artifactId> </dependency> <dependency> <groupId>org.opendaylight.yangtools</groupId> diff --git a/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmProvider.java b/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmProvider.java index 4dd46d597..100496e39 100644 --- a/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmProvider.java +++ b/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmProvider.java @@ -21,26 +21,32 @@ package org.onap.ccsdk.sli.northbound; * ============LICENSE_END========================================================= */ -import com.google.common.util.concurrent.Futures; -import com.google.common.util.concurrent.ListenableFuture; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Properties; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.concurrent.Future; import org.onap.ccsdk.sli.core.sli.provider.MdsalHelper; -import org.opendaylight.mdsal.binding.api.NotificationPublishService; -import org.opendaylight.mdsal.binding.api.RpcProviderService; -import org.opendaylight.mdsal.dom.api.DOMDataBroker; +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.impl.AbstractForwardedDataBroker; +import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker; +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.northbound.lcm.rev180329.*; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.common.header.CommonHeaderBuilder; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.status.StatusBuilder; -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; + +import org.onap.ccsdk.sli.northbound.LcmResponseCode.*; + /** * Defines a base implementation for your provider. This class extends from a * helper class which provides storage for the most commonly used components of @@ -87,19 +93,23 @@ public class LcmProvider implements AutoCloseable, LCMService { private static final String APPLICATION_NAME = "LCM"; private final ExecutorService executor; + protected DataBroker dataBroker; protected DOMDataBroker domDataBroker; protected NotificationPublishService notificationService; - protected RpcProviderService rpcRegistry; + protected RpcProviderRegistry rpcRegistry; private final LcmSliClient lcmSliClient; - protected ObjectRegistration<LCMService> rpcRegistration; + protected BindingAwareBroker.RpcRegistration<LCMService> rpcRegistration; - public LcmProvider(final DOMDataBroker dataBroker, final NotificationPublishService notificationPublishService, - final RpcProviderService rpcProviderRegistry, final LcmSliClient lcmSliClient) { + public LcmProvider(final DataBroker dataBroker, final NotificationPublishService notificationPublishService, + final RpcProviderRegistry rpcProviderRegistry, final LcmSliClient lcmSliClient) { LOG.info("Creating provider for {}", APPLICATION_NAME); executor = Executors.newFixedThreadPool(1); - domDataBroker = dataBroker; + this.dataBroker = dataBroker; + if (dataBroker instanceof AbstractForwardedDataBroker) { + domDataBroker = ((AbstractForwardedDataBroker) dataBroker).getDelegate(); + } notificationService = notificationPublishService; rpcRegistry = rpcProviderRegistry; this.lcmSliClient = lcmSliClient; @@ -111,7 +121,7 @@ public class LcmProvider implements AutoCloseable, LCMService { if (rpcRegistration == null) { if (rpcRegistry != null) { - rpcRegistration = rpcRegistry.registerRpcImplementation(LCMService.class, this); + rpcRegistration = rpcRegistry.addRpcImplementation(LCMService.class, this); LOG.info("Initialization complete for {}", APPLICATION_NAME); } else { LOG.warn("Error initializing {} : rpcRegistry unset", APPLICATION_NAME); diff --git a/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmSliClient.java b/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmSliClient.java index 05bb43f82..54e53c776 100644 --- a/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmSliClient.java +++ b/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmSliClient.java @@ -24,9 +24,10 @@ package org.onap.ccsdk.sli.northbound; import java.util.Properties; + import org.onap.ccsdk.sli.core.sli.SvcLogicException; import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService; -import org.opendaylight.mdsal.dom.api.DOMDataBroker; +import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/northbound/lcm/provider/src/main/resources/OSGI-INF/blueprint/lcm-blueprint.xml b/northbound/lcm/provider/src/main/resources/OSGI-INF/blueprint/lcm-blueprint.xml new file mode 100644 index 000000000..5597d0801 --- /dev/null +++ b/northbound/lcm/provider/src/main/resources/OSGI-INF/blueprint/lcm-blueprint.xml @@ -0,0 +1,34 @@ +<?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.ccsdk.sli.northbound.LcmSliClient"> + <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.ccsdk.sli.northbound.LcmProvider"> + <argument ref="dataBroker" /> + <argument ref="notificationService" /> + <argument ref="rpcRegistry" /> + <argument ref="client" /> + </bean> + + <odl:rpc-implementation ref="provider"/> + +</blueprint>
\ No newline at end of file diff --git a/northbound/lcm/provider/src/main/resources/org/opendaylight/blueprint/lcm-blueprint.xml b/northbound/lcm/provider/src/main/resources/org/opendaylight/blueprint/lcm-blueprint.xml index 7550c8b93..5597d0801 100644 --- a/northbound/lcm/provider/src/main/resources/org/opendaylight/blueprint/lcm-blueprint.xml +++ b/northbound/lcm/provider/src/main/resources/org/opendaylight/blueprint/lcm-blueprint.xml @@ -11,13 +11,16 @@ </bean> <reference id="dataBroker" - interface="org.opendaylight.mdsal.dom.api.DOMDataBroker" /> + interface="org.opendaylight.controller.md.sal.binding.api.DataBroker" + odl:type="default" /> <reference id="notificationService" - interface="org.opendaylight.mdsal.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" /> <bean id="provider" class="org.onap.ccsdk.sli.northbound.LcmProvider"> <argument ref="dataBroker" /> diff --git a/northbound/lcm/provider/src/test/java/org/onap/ccsdk/sli/northbound/TestLcmProvider.java b/northbound/lcm/provider/src/test/java/org/onap/ccsdk/sli/northbound/TestLcmProvider.java index 85325cb56..b73151e8d 100644 --- a/northbound/lcm/provider/src/test/java/org/onap/ccsdk/sli/northbound/TestLcmProvider.java +++ b/northbound/lcm/provider/src/test/java/org/onap/ccsdk/sli/northbound/TestLcmProvider.java @@ -2,9 +2,10 @@ package org.onap.ccsdk.sli.northbound; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; -import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; + import java.io.InputStream; import java.net.URL; import java.text.SimpleDateFormat; @@ -20,14 +21,13 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicStoreFactory; import org.onap.ccsdk.sli.core.sli.provider.SvcLogicClassResolver; import org.onap.ccsdk.sli.core.sli.provider.SvcLogicPropertiesProviderImpl; import org.onap.ccsdk.sli.core.sli.provider.SvcLogicServiceImpl; -import org.opendaylight.mdsal.binding.api.NotificationPublishService; -import org.opendaylight.mdsal.binding.api.RpcProviderService; -import org.opendaylight.mdsal.dom.api.DOMDataBroker; +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.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.Action; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ActionStatusInputBuilder; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ActionStatusOutput; -import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ActivateNESwInputBuilder; -import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ActivateNESwOutput; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.AttachVolumeInputBuilder; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.AttachVolumeOutput; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.AuditInputBuilder; @@ -52,8 +52,6 @@ import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329. import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.DetachVolumeOutput; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.DistributeTrafficInputBuilder; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.DistributeTrafficOutput; -import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.DownloadNESwInputBuilder; -import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.DownloadNESwOutput; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.EvacuateInputBuilder; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.EvacuateOutput; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.HealthCheckInputBuilder; @@ -108,10 +106,13 @@ import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329. import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.UpgradePreCheckOutput; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.UpgradeSoftwareInputBuilder; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.UpgradeSoftwareOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.DownloadNESwInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.DownloadNESwOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ActivateNESwInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ActivateNESwOutput; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ZULU; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.action.identifiers.ActionIdentifiersBuilder; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.common.header.CommonHeaderBuilder; -import org.opendaylight.yangtools.concepts.ObjectRegistration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -125,11 +126,11 @@ public class TestLcmProvider { */ @Before public void setUp() throws Exception { - DOMDataBroker dataBroker = mock(DOMDataBroker.class); + DataBroker dataBroker = mock(DataBroker.class); NotificationPublishService notifyService = mock(NotificationPublishService.class); - RpcProviderService rpcRegistry = mock(RpcProviderService.class); - ObjectRegistration<LCMService> rpcRegistration = mock(ObjectRegistration.class); - when(rpcRegistry.registerRpcImplementation(any(Class.class), any(LCMService.class))).thenReturn(rpcRegistration); + RpcProviderRegistry rpcRegistry = mock(RpcProviderRegistry.class); + BindingAwareBroker.RpcRegistration<LCMService> rpcRegistration = (BindingAwareBroker.RpcRegistration<LCMService>) mock(BindingAwareBroker.RpcRegistration.class); + when(rpcRegistry.addRpcImplementation(any(Class.class), any(LCMService.class))).thenReturn(rpcRegistration); // Load svclogic.properties and get a SvcLogicStore @@ -193,7 +194,7 @@ public class TestLcmProvider { try { CheckLockOutput results = provider.checkLock(builder.build()).get().getResult(); LOG.info("CheckLock returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("CheckLock threw exception"); @@ -228,7 +229,7 @@ public class TestLcmProvider { try { RebootOutput results = provider.reboot(builder.build()).get().getResult(); LOG.info("Reboot returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("Reboot threw exception"); @@ -263,7 +264,7 @@ public class TestLcmProvider { try { UpgradeBackupOutput results = provider.upgradeBackup(builder.build()).get().getResult(); LOG.info("UpgradeBackout returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("CheckLock threw exception"); @@ -297,7 +298,7 @@ public class TestLcmProvider { try { RollbackOutput results = provider.rollback(builder.build()).get().getResult(); LOG.info("Rollback returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("Rollback threw exception"); @@ -331,7 +332,7 @@ public class TestLcmProvider { try { SyncOutput results = provider.sync(builder.build()).get().getResult(); LOG.info("Sync returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("Sync threw exception"); @@ -364,7 +365,7 @@ public class TestLcmProvider { try { QueryOutput results = provider.query(builder.build()).get().getResult(); LOG.info("Query returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("Query threw exception"); @@ -398,7 +399,7 @@ public class TestLcmProvider { try { ConfigExportOutput results = provider.configExport(builder.build()).get().getResult(); LOG.info("ConfigExport returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("ConfigExport threw exception"); @@ -433,7 +434,7 @@ public class TestLcmProvider { try { StopApplicationOutput results = provider.stopApplication(builder.build()).get().getResult(); LOG.info("StopApplication returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("StopApplication threw exception"); @@ -467,7 +468,7 @@ public class TestLcmProvider { try { SoftwareUploadOutput results = provider.softwareUpload(builder.build()).get().getResult(); LOG.info("SoftwareUpload returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("SoftwareUpload threw exception"); @@ -501,7 +502,7 @@ public class TestLcmProvider { try { ResumeTrafficOutput results = provider.resumeTraffic(builder.build()).get().getResult(); LOG.info("ResumeTraffic returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("ResumeTraffic threw exception"); @@ -535,7 +536,7 @@ public class TestLcmProvider { try { DistributeTrafficOutput results = provider.distributeTraffic(builder.build()).get().getResult(); LOG.info("DistributeTraffic returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("DistributeTraffic threw exception"); @@ -569,7 +570,7 @@ public class TestLcmProvider { try { ConfigureOutput results = provider.configure(builder.build()).get().getResult(); LOG.info("Configure returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("Configure threw exception"); @@ -603,7 +604,7 @@ public class TestLcmProvider { try { ActionStatusOutput results = provider.actionStatus(builder.build()).get().getResult(); LOG.info("ActionStatus returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("ActionStatus threw exception"); @@ -637,7 +638,7 @@ public class TestLcmProvider { try { UpgradePreCheckOutput results = provider.upgradePreCheck(builder.build()).get().getResult(); LOG.info("UpgradePreCheck returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("UpgradePreCheck threw exception"); @@ -671,7 +672,7 @@ public class TestLcmProvider { try { LiveUpgradeOutput results = provider.liveUpgrade(builder.build()).get().getResult(); LOG.info("LiveUpgrade returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("LiveUpgrade threw exception"); @@ -705,7 +706,7 @@ public class TestLcmProvider { try { ConfigModifyOutput results = provider.configModify(builder.build()).get().getResult(); LOG.info("ConfigModify returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("ConfigModify threw exception"); @@ -739,7 +740,7 @@ public class TestLcmProvider { try { RestartOutput results = provider.restart(builder.build()).get().getResult(); LOG.info("Restart returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("Restart threw exception"); @@ -773,7 +774,7 @@ public class TestLcmProvider { try { HealthCheckOutput results = provider.healthCheck(builder.build()).get().getResult(); LOG.info("HealthCheck returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("HealthCheck threw exception"); @@ -807,7 +808,7 @@ public class TestLcmProvider { try { LockOutput results = provider.lock(builder.build()).get().getResult(); LOG.info("Lock returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("Lock threw exception"); @@ -841,7 +842,7 @@ public class TestLcmProvider { try { TerminateOutput results = provider.terminate(builder.build()).get().getResult(); LOG.info("Terminate returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("Terminate threw exception"); @@ -875,7 +876,7 @@ public class TestLcmProvider { try { AttachVolumeOutput results = provider.attachVolume(builder.build()).get().getResult(); LOG.info("AttachVolume returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("AttachVolume threw exception"); @@ -909,7 +910,7 @@ public class TestLcmProvider { try { MigrateOutput results = provider.migrate(builder.build()).get().getResult(); LOG.info("Migrate returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("Migrate threw exception"); @@ -943,7 +944,7 @@ public class TestLcmProvider { try { QuiesceTrafficOutput results = provider.quiesceTraffic(builder.build()).get().getResult(); LOG.info("QuiesceTraffic returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("QuiesceTraffic threw exception"); @@ -977,7 +978,7 @@ public class TestLcmProvider { try { ConfigRestoreOutput results = provider.configRestore(builder.build()).get().getResult(); LOG.info("ConfigRestore returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("ConfigRestore threw exception"); @@ -1011,7 +1012,7 @@ public class TestLcmProvider { try { UpgradeBackoutOutput results = provider.upgradeBackout(builder.build()).get().getResult(); LOG.info("UpgradeBackout returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("UpgradeBackout threw exception"); @@ -1045,7 +1046,7 @@ public class TestLcmProvider { try { EvacuateOutput results = provider.evacuate(builder.build()).get().getResult(); LOG.info("Evacuate returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("Evacuate threw exception"); @@ -1079,7 +1080,7 @@ public class TestLcmProvider { try { UnlockOutput results = provider.unlock(builder.build()).get().getResult(); LOG.info("Unlock returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("Unlock threw exception"); @@ -1112,7 +1113,7 @@ public class TestLcmProvider { try { ConfigBackupDeleteOutput results = provider.configBackupDelete(builder.build()).get().getResult(); LOG.info("ConfigBackupDelete returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("ConfigBackupDelete threw exception"); @@ -1146,7 +1147,7 @@ public class TestLcmProvider { try { UpgradeSoftwareOutput results = provider.upgradeSoftware(builder.build()).get().getResult(); LOG.info("UpgradeSoftware returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("UpgradeSoftware threw exception"); @@ -1181,7 +1182,7 @@ public class TestLcmProvider { try { DownloadNESwOutput results = provider.downloadNESw(builder.build()).get().getResult(); LOG.info("DownloadNESw returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("DownloadNESw threw exception"); @@ -1216,7 +1217,7 @@ public class TestLcmProvider { try { ActivateNESwOutput results = provider.activateNESw(builder.build()).get().getResult(); LOG.info("ActivateNESw returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("ActivateNESw threw exception"); @@ -1250,7 +1251,7 @@ public class TestLcmProvider { try { StopOutput results = provider.stop(builder.build()).get().getResult(); LOG.info("Stop returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("Stop threw exception"); @@ -1284,7 +1285,7 @@ public class TestLcmProvider { try { DetachVolumeOutput results = provider.detachVolume(builder.build()).get().getResult(); LOG.info("DetachVolume returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("DetachVolume threw exception"); @@ -1318,7 +1319,7 @@ public class TestLcmProvider { try { ConfigScaleOutOutput results = provider.configScaleOut(builder.build()).get().getResult(); LOG.info("ConfigScaleOut returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("ConfigScaleOut threw exception"); @@ -1352,7 +1353,7 @@ public class TestLcmProvider { try { UpgradePostCheckOutput results = provider.upgradePostCheck(builder.build()).get().getResult(); LOG.info("UpgradePostCheck returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("UpgradePostCheck threw exception"); @@ -1386,7 +1387,7 @@ public class TestLcmProvider { try { TestOutput results = provider.test(builder.build()).get().getResult(); LOG.info("Test returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("Test threw exception"); @@ -1420,7 +1421,7 @@ public class TestLcmProvider { try { StartApplicationOutput results = provider.startApplication(builder.build()).get().getResult(); LOG.info("StartApplication returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("StartApplication threw exception"); @@ -1454,7 +1455,7 @@ public class TestLcmProvider { try { ConfigBackupOutput results = provider.configBackup(builder.build()).get().getResult(); LOG.info("ConfigBackup returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("ConfigBackup threw exception"); @@ -1488,7 +1489,7 @@ public class TestLcmProvider { try { ConfigBackupOutput results = provider.configBackup(builder.build()).get().getResult(); LOG.info("ConfigBackup returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("ConfigBackup threw exception"); @@ -1522,7 +1523,7 @@ public class TestLcmProvider { try { AuditOutput results = provider.audit(builder.build()).get().getResult(); LOG.info("Audit returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("Audit threw exception"); @@ -1556,7 +1557,7 @@ public class TestLcmProvider { try { StartOutput results = provider.start(builder.build()).get().getResult(); LOG.info("Start returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("Start threw exception"); @@ -1590,7 +1591,7 @@ public class TestLcmProvider { try { SnapshotOutput results = provider.snapshot(builder.build()).get().getResult(); LOG.info("Snapshot returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); - assert(results.getStatus().getCode().intValue() == 400); + assert(results.getStatus().getCode() == 400); } catch (InterruptedException | ExecutionException e) { LOG.error("Caught exception", e); fail("Snapshot threw exception"); diff --git a/northbound/ueb-listener/src/test/resources/incoming/src_test_resources_csars_service-NfodService-csar.csar b/northbound/ueb-listener/src/test/resources/incoming/src_test_resources_csars_service-NfodService-csar.csar Binary files differnew file mode 100644 index 000000000..329076a15 --- /dev/null +++ b/northbound/ueb-listener/src/test/resources/incoming/src_test_resources_csars_service-NfodService-csar.csar |