From ff3eecb980bfdc8d43d2ed3a4c786d634fa6f4e2 Mon Sep 17 00:00:00 2001 From: Jessica Wagantall Date: Tue, 1 Dec 2020 11:52:01 -0800 Subject: Migrate sli-northbound repo Migrate sli-northbound repo files into new directory "northbound". Signed-off-by: Jessica Wagantall --- northbound/lcm/provider/pom.xml | 101 ++ .../org/onap/ccsdk/sli/northbound/LcmProvider.java | 1126 ++++++++++++++ .../onap/ccsdk/sli/northbound/LcmResponseCode.java | 51 + .../sli/northbound/LcmRpcInvocationException.java | 25 + .../onap/ccsdk/sli/northbound/LcmSliClient.java | 99 ++ .../resources/OSGI-INF/blueprint/lcm-blueprint.xml | 34 + .../org/opendaylight/blueprint/lcm-blueprint.xml | 34 + .../onap/ccsdk/sli/northbound/TestLcmProvider.java | 1601 ++++++++++++++++++++ .../northbound/TestLcmRpcInvocationException.java | 20 + .../src/test/resources/graphs/lcm/LCM_Audit.xml | 30 + .../test/resources/graphs/lcm/LCM_Configure.xml | 30 + .../src/test/resources/graphs/lcm/LCM_Evacuate.xml | 30 + .../src/test/resources/graphs/lcm/LCM_Lock.xml | 30 + .../src/test/resources/graphs/lcm/LCM_Migrate.xml | 30 + .../src/test/resources/graphs/lcm/LCM_Query.xml | 30 + .../src/test/resources/graphs/lcm/LCM_Reboot.xml | 30 + .../src/test/resources/graphs/lcm/LCM_Rebuild.xml | 30 + .../src/test/resources/graphs/lcm/LCM_Restart.xml | 30 + .../src/test/resources/graphs/lcm/LCM_Rollback.xml | 30 + .../src/test/resources/graphs/lcm/LCM_Snapshot.xml | 30 + .../src/test/resources/graphs/lcm/LCM_Start.xml | 30 + .../src/test/resources/graphs/lcm/LCM_Stop.xml | 30 + .../src/test/resources/graphs/lcm/LCM_Sync.xml | 30 + .../test/resources/graphs/lcm/LCM_Terminate.xml | 30 + .../src/test/resources/graphs/lcm/LCM_Test.xml | 30 + .../src/test/resources/graphs/lcm/LCM_Unlock.xml | 30 + .../resources/graphs/lcm/LCM_action-status.xml | 30 + .../resources/graphs/lcm/LCM_activate-n-e-sw.xml | 30 + .../resources/graphs/lcm/LCM_attach-volume.xml | 30 + .../test/resources/graphs/lcm/LCM_check-lock.xml | 30 + .../graphs/lcm/LCM_config-backup-delete.xml | 30 + .../resources/graphs/lcm/LCM_config-backup.xml | 30 + .../resources/graphs/lcm/LCM_config-export.xml | 30 + .../resources/graphs/lcm/LCM_config-modify.xml | 30 + .../resources/graphs/lcm/LCM_config-restore.xml | 30 + .../resources/graphs/lcm/LCM_config-scale-out.xml | 30 + .../resources/graphs/lcm/LCM_detach-volume.xml | 30 + .../graphs/lcm/LCM_distribute-traffic.xml | 30 + .../resources/graphs/lcm/LCM_download-n-e-sw.xml | 30 + .../test/resources/graphs/lcm/LCM_health-check.xml | 30 + .../test/resources/graphs/lcm/LCM_live-upgrade.xml | 30 + .../resources/graphs/lcm/LCM_quiesce-traffic.xml | 30 + .../resources/graphs/lcm/LCM_resume-traffic.xml | 30 + .../resources/graphs/lcm/LCM_software-upload.xml | 30 + .../resources/graphs/lcm/LCM_start-application.xml | 30 + .../resources/graphs/lcm/LCM_stop-application.xml | 30 + .../resources/graphs/lcm/LCM_update-software.xml | 30 + .../resources/graphs/lcm/LCM_upgrade-backout.xml | 30 + .../resources/graphs/lcm/LCM_upgrade-backup.xml | 30 + .../graphs/lcm/LCM_upgrade-post-check.xml | 30 + .../resources/graphs/lcm/LCM_upgrade-pre-check.xml | 30 + .../src/test/resources/graphs/lcm/graph.versions | 42 + .../src/test/resources/simplelogger.properties | 22 + .../src/test/resources/svclogic.properties | 27 + 54 files changed, 4442 insertions(+) create mode 100755 northbound/lcm/provider/pom.xml create mode 100644 northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmProvider.java create mode 100644 northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmResponseCode.java create mode 100644 northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmRpcInvocationException.java create mode 100644 northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmSliClient.java create mode 100644 northbound/lcm/provider/src/main/resources/OSGI-INF/blueprint/lcm-blueprint.xml create mode 100644 northbound/lcm/provider/src/main/resources/org/opendaylight/blueprint/lcm-blueprint.xml create mode 100644 northbound/lcm/provider/src/test/java/org/onap/ccsdk/sli/northbound/TestLcmProvider.java create mode 100644 northbound/lcm/provider/src/test/java/org/onap/ccsdk/sli/northbound/TestLcmRpcInvocationException.java create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Audit.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Configure.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Evacuate.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Lock.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Migrate.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Query.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Reboot.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Rebuild.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Restart.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Rollback.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Snapshot.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Start.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Stop.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Sync.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Terminate.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Test.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Unlock.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_action-status.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_activate-n-e-sw.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_attach-volume.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_check-lock.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-backup-delete.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-backup.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-export.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-modify.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-restore.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-scale-out.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_detach-volume.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_distribute-traffic.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_download-n-e-sw.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_health-check.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_live-upgrade.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_quiesce-traffic.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_resume-traffic.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_software-upload.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_start-application.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_stop-application.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_update-software.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_upgrade-backout.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_upgrade-backup.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_upgrade-post-check.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_upgrade-pre-check.xml create mode 100644 northbound/lcm/provider/src/test/resources/graphs/lcm/graph.versions create mode 100644 northbound/lcm/provider/src/test/resources/simplelogger.properties create mode 100644 northbound/lcm/provider/src/test/resources/svclogic.properties (limited to 'northbound/lcm/provider') diff --git a/northbound/lcm/provider/pom.xml b/northbound/lcm/provider/pom.xml new file mode 100755 index 000000000..03f34e6ba --- /dev/null +++ b/northbound/lcm/provider/pom.xml @@ -0,0 +1,101 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + binding-parent + 2.1.0 + + + + org.onap.ccsdk.sli.northbound + lcm-provider + 1.1.1-SNAPSHOT + bundle + + ccsdk-sli-northbound :: lcm :: ${project.artifactId} + + + ${project.version} + + + + + + org.onap.ccsdk.sli.core + sli-core-artifacts + ${ccsdk.sli.core.version} + pom + import + + + + + + org.onap.ccsdk.sli.northbound + lcm-model + ${project.version} + + + + org.opendaylight.controller + sal-binding-api + + + org.opendaylight.controller + sal-binding-broker-impl + + + org.opendaylight.controller + sal-common-util + + + + org.onap.ccsdk.sli.core + sli-common + + + org.onap.ccsdk.sli.core + sli-provider + + + org.onap.ccsdk.sli.core + sli-provider-base + ${ccsdk.sli.core.version} + + + org.opendaylight.controller + sal-core-api + + + org.opendaylight.yangtools + yang-data-impl + + + junit + junit + test + + + org.testng + testng + test + + + org.mockito + mockito-core + test + + + org.apache.derby + derby + test + + + org.osgi + org.osgi.core + test + + + 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 new file mode 100644 index 000000000..100496e39 --- /dev/null +++ b/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmProvider.java @@ -0,0 +1,1126 @@ +package org.onap.ccsdk.sli.northbound; +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * Modifications Copyright © 2018 IBM. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +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.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.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 + * the MD-SAL. Additionally the base class provides some basic logging and + * initialization / clean up methods. + * + */ +public class LcmProvider implements AutoCloseable, LCMService { + + private class CommonLcmFields { + private StatusBuilder statusBuilder; + private CommonHeaderBuilder commonHeaderBuilder; + private Payload payload; + + public CommonLcmFields(StatusBuilder statusBuilder, CommonHeaderBuilder commonHeaderBuilder) { + this.statusBuilder = statusBuilder; + this.commonHeaderBuilder = commonHeaderBuilder; + this.payload = null; + } + + public CommonLcmFields(StatusBuilder statusBuilder, CommonHeaderBuilder commonHeaderBuilder, Payload payload) { + this.statusBuilder = statusBuilder; + this.commonHeaderBuilder = commonHeaderBuilder; + this.payload = payload; + } + + public StatusBuilder getStatusBuilder() { + return statusBuilder; + } + + public CommonHeaderBuilder getCommonHeaderBuilder() { + return commonHeaderBuilder; + } + + public Payload getPayload() { + return payload; + } + } + + private static final Logger LOG = LoggerFactory.getLogger(LcmProvider.class); + + private static final String exceptionMessage = "Caught exception"; + + private static final String APPLICATION_NAME = "LCM"; + + private final ExecutorService executor; + protected DataBroker dataBroker; + protected DOMDataBroker domDataBroker; + protected NotificationPublishService notificationService; + protected RpcProviderRegistry rpcRegistry; + private final LcmSliClient lcmSliClient; + + protected BindingAwareBroker.RpcRegistration rpcRegistration; + + 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); + this.dataBroker = dataBroker; + if (dataBroker instanceof AbstractForwardedDataBroker) { + domDataBroker = ((AbstractForwardedDataBroker) dataBroker).getDelegate(); + } + notificationService = notificationPublishService; + rpcRegistry = rpcProviderRegistry; + this.lcmSliClient = lcmSliClient; + initialize(); + } + + public void initialize() { + LOG.info("Initializing {} for {}", this.getClass().getName(), APPLICATION_NAME); + + if (rpcRegistration == null) { + if (rpcRegistry != null) { + rpcRegistration = rpcRegistry.addRpcImplementation(LCMService.class, this); + LOG.info("Initialization complete for {}", APPLICATION_NAME); + } else { + LOG.warn("Error initializing {} : rpcRegistry unset", APPLICATION_NAME); + } + } + } + + protected void initializeChild() { + // Override if you have custom initialization intelligence + } + + @Override + public void close() throws Exception { + LOG.info("Closing provider for " + APPLICATION_NAME); + executor.shutdown(); + rpcRegistration.close(); + LOG.info("Successfully closed provider for " + APPLICATION_NAME); + } + + + + @Override + public ListenableFuture> checkLock(CheckLockInput input) { + CheckLockInputBuilder iBuilder = new CheckLockInputBuilder(input); + CheckLockOutputBuilder oBuilder = new CheckLockOutputBuilder(); + + try { + CommonLcmFields retval = callDG("check-lock", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + + } + + @Override + public ListenableFuture> reboot(RebootInput input) { + RebootInputBuilder iBuilder = new RebootInputBuilder(input); + RebootOutputBuilder oBuilder = new RebootOutputBuilder(); + + try { + CommonLcmFields retval = callDG("reboot", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> upgradeBackup(UpgradeBackupInput input) { + UpgradeBackupInputBuilder iBuilder = new UpgradeBackupInputBuilder(input); + UpgradeBackupOutputBuilder oBuilder = new UpgradeBackupOutputBuilder(); + + try { + CommonLcmFields retval = callDG("upgrade-backup", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> rollback(RollbackInput input) { + RollbackInputBuilder iBuilder = new RollbackInputBuilder(input); + RollbackOutputBuilder oBuilder = new RollbackOutputBuilder(); + + try { + CommonLcmFields retval = callDG("rollback", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + if (retval.getPayload() != null) { + oBuilder.setPayload(retval.getPayload()); + } + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> sync(SyncInput input) { + SyncInputBuilder iBuilder = new SyncInputBuilder(input); + SyncOutputBuilder oBuilder = new SyncOutputBuilder(); + + try { + CommonLcmFields retval = callDG("sync", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> query(QueryInput input) { + QueryInputBuilder iBuilder = new QueryInputBuilder(input); + QueryOutputBuilder oBuilder = new QueryOutputBuilder(); + + try { + CommonLcmFields retval = callDG("query", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> configExport(ConfigExportInput input) { + ConfigExportInputBuilder iBuilder = new ConfigExportInputBuilder(input); + ConfigExportOutputBuilder oBuilder = new ConfigExportOutputBuilder(); + + try { + CommonLcmFields retval = callDG("config-export", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> stopApplication(StopApplicationInput input) { + StopApplicationInputBuilder iBuilder = new StopApplicationInputBuilder(input); + StopApplicationOutputBuilder oBuilder = new StopApplicationOutputBuilder(); + + try { + CommonLcmFields retval = callDG("stop-application", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> softwareUpload(SoftwareUploadInput input) { + SoftwareUploadInputBuilder iBuilder = new SoftwareUploadInputBuilder(input); + SoftwareUploadOutputBuilder oBuilder = new SoftwareUploadOutputBuilder(); + + try { + CommonLcmFields retval = callDG("software-upload", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> resumeTraffic(ResumeTrafficInput input) { + ResumeTrafficInputBuilder iBuilder = new ResumeTrafficInputBuilder(input); + ResumeTrafficOutputBuilder oBuilder = new ResumeTrafficOutputBuilder(); + + try { + CommonLcmFields retval = callDG("resume-traffic", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> distributeTraffic(DistributeTrafficInput input) { + DistributeTrafficInputBuilder iBuilder = new DistributeTrafficInputBuilder(input); + DistributeTrafficOutputBuilder oBuilder = new DistributeTrafficOutputBuilder(); + + try { + CommonLcmFields retval = callDG("distribute-traffic", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> configure(ConfigureInput input) { + ConfigureInputBuilder iBuilder = new ConfigureInputBuilder(input); + ConfigureOutputBuilder oBuilder = new ConfigureOutputBuilder(); + + try { + CommonLcmFields retval = callDG("configure", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> actionStatus(ActionStatusInput input) { + ActionStatusInputBuilder iBuilder = new ActionStatusInputBuilder(input); + ActionStatusOutputBuilder oBuilder = new ActionStatusOutputBuilder(); + + try { + CommonLcmFields retval = callDG("action-status", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> upgradePreCheck(UpgradePreCheckInput input) { + UpgradePreCheckInputBuilder iBuilder = new UpgradePreCheckInputBuilder(input); + UpgradePreCheckOutputBuilder oBuilder = new UpgradePreCheckOutputBuilder(); + + try { + CommonLcmFields retval = callDG("upgrade-pre-check", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + if (retval.getPayload() != null) { + oBuilder.setPayload(retval.getPayload()); + } + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> liveUpgrade(LiveUpgradeInput input) { + LiveUpgradeInputBuilder iBuilder = new LiveUpgradeInputBuilder(input); + LiveUpgradeOutputBuilder oBuilder = new LiveUpgradeOutputBuilder(); + + try { + CommonLcmFields retval = callDG("live-upgrade", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> configModify(ConfigModifyInput input) { + ConfigModifyInputBuilder iBuilder = new ConfigModifyInputBuilder(input); + ConfigModifyOutputBuilder oBuilder = new ConfigModifyOutputBuilder(); + + try { + CommonLcmFields retval = callDG("config-modify", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> restart(RestartInput input) { + RestartInputBuilder iBuilder = new RestartInputBuilder(input); + RestartOutputBuilder oBuilder = new RestartOutputBuilder(); + + try { + CommonLcmFields retval = callDG("restart", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> healthCheck(HealthCheckInput input) { + HealthCheckInputBuilder iBuilder = new HealthCheckInputBuilder(input); + HealthCheckOutputBuilder oBuilder = new HealthCheckOutputBuilder(); + + try { + CommonLcmFields retval = callDG("health-check", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> lock(LockInput input) { + LockInputBuilder iBuilder = new LockInputBuilder(input); + LockOutputBuilder oBuilder = new LockOutputBuilder(); + + try { + CommonLcmFields retval = callDG("lock", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> terminate(TerminateInput input) { + TerminateInputBuilder iBuilder = new TerminateInputBuilder(input); + TerminateOutputBuilder oBuilder = new TerminateOutputBuilder(); + + try { + CommonLcmFields retval = callDG("terminate", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> attachVolume(AttachVolumeInput input) { + AttachVolumeInputBuilder iBuilder = new AttachVolumeInputBuilder(input); + AttachVolumeOutputBuilder oBuilder = new AttachVolumeOutputBuilder(); + + try { + CommonLcmFields retval = callDG("attach-volume", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> migrate(MigrateInput input) { + MigrateInputBuilder iBuilder = new MigrateInputBuilder(input); + MigrateOutputBuilder oBuilder = new MigrateOutputBuilder(); + + try { + CommonLcmFields retval = callDG("migrate", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> quiesceTraffic(QuiesceTrafficInput input) { + QuiesceTrafficInputBuilder iBuilder = new QuiesceTrafficInputBuilder(input); + QuiesceTrafficOutputBuilder oBuilder = new QuiesceTrafficOutputBuilder(); + + try { + CommonLcmFields retval = callDG("quiesce-traffic", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> configRestore(ConfigRestoreInput input) { + ConfigRestoreInputBuilder iBuilder = new ConfigRestoreInputBuilder(input); + ConfigRestoreOutputBuilder oBuilder = new ConfigRestoreOutputBuilder(); + + try { + CommonLcmFields retval = callDG("config-restore", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> upgradeBackout(UpgradeBackoutInput input) { + UpgradeBackoutInputBuilder iBuilder = new UpgradeBackoutInputBuilder(input); + UpgradeBackoutOutputBuilder oBuilder = new UpgradeBackoutOutputBuilder(); + + try { + CommonLcmFields retval = callDG("upgrade-backout", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> evacuate(EvacuateInput input) { + EvacuateInputBuilder iBuilder = new EvacuateInputBuilder(input); + EvacuateOutputBuilder oBuilder = new EvacuateOutputBuilder(); + + try { + CommonLcmFields retval = callDG("evacuate", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> unlock(UnlockInput input) { + UnlockInputBuilder iBuilder = new UnlockInputBuilder(input); + UnlockOutputBuilder oBuilder = new UnlockOutputBuilder(); + + try { + CommonLcmFields retval = callDG("unlock", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> configBackupDelete(ConfigBackupDeleteInput input) { + ConfigBackupDeleteInputBuilder iBuilder = new ConfigBackupDeleteInputBuilder(input); + ConfigBackupDeleteOutputBuilder oBuilder = new ConfigBackupDeleteOutputBuilder(); + + try { + CommonLcmFields retval = callDG("config-backup-delete", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> upgradeSoftware(UpgradeSoftwareInput input) { + UpgradeSoftwareInputBuilder iBuilder = new UpgradeSoftwareInputBuilder(input); + UpgradeSoftwareOutputBuilder oBuilder = new UpgradeSoftwareOutputBuilder(); + + try { + CommonLcmFields retval = callDG("upgrade-software", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> downloadNESw(DownloadNESwInput input) { + DownloadNESwInputBuilder iBuilder = new DownloadNESwInputBuilder(input); + DownloadNESwOutputBuilder oBuilder = new DownloadNESwOutputBuilder(); + + try { + CommonLcmFields retval = callDG("download-n-e-sw", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + if (retval.getPayload() != null) { + oBuilder.setPayload(retval.getPayload()); + } + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> activateNESw(ActivateNESwInput input) { + ActivateNESwInputBuilder iBuilder = new ActivateNESwInputBuilder(input); + ActivateNESwOutputBuilder oBuilder = new ActivateNESwOutputBuilder(); + + try { + CommonLcmFields retval = callDG("activate-n-e-sw", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + if (retval.getPayload() != null) { + oBuilder.setPayload(retval.getPayload()); + } + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> stop(StopInput input) { + StopInputBuilder iBuilder = new StopInputBuilder(input); + StopOutputBuilder oBuilder = new StopOutputBuilder(); + + try { + CommonLcmFields retval = callDG("stop", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> detachVolume(DetachVolumeInput input) { + DetachVolumeInputBuilder iBuilder = new DetachVolumeInputBuilder(input); + DetachVolumeOutputBuilder oBuilder = new DetachVolumeOutputBuilder(); + + try { + CommonLcmFields retval = callDG("detach-volume", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> configScaleOut(ConfigScaleOutInput input) { + ConfigScaleOutInputBuilder iBuilder = new ConfigScaleOutInputBuilder(input); + ConfigScaleOutOutputBuilder oBuilder = new ConfigScaleOutOutputBuilder(); + + try { + CommonLcmFields retval = callDG("config-scale-out", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> upgradePostCheck(UpgradePostCheckInput input) { + UpgradePostCheckInputBuilder iBuilder = new UpgradePostCheckInputBuilder(input); + UpgradePostCheckOutputBuilder oBuilder = new UpgradePostCheckOutputBuilder(); + + try { + CommonLcmFields retval = callDG("upgrade-post-check", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + if (retval.getPayload() != null) { + oBuilder.setPayload(retval.getPayload()); + } + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> test(TestInput input) { + TestInputBuilder iBuilder = new TestInputBuilder(input); + TestOutputBuilder oBuilder = new TestOutputBuilder(); + + try { + CommonLcmFields retval = callDG("test", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> startApplication(StartApplicationInput input) { + StartApplicationInputBuilder iBuilder = new StartApplicationInputBuilder(input); + StartApplicationOutputBuilder oBuilder = new StartApplicationOutputBuilder(); + + try { + CommonLcmFields retval = callDG("start-application", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> configBackup(ConfigBackupInput input) { + ConfigBackupInputBuilder iBuilder = new ConfigBackupInputBuilder(input); + ConfigBackupOutputBuilder oBuilder = new ConfigBackupOutputBuilder(); + + try { + CommonLcmFields retval = callDG("config-backup", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> rebuild(RebuildInput input) { + RebuildInputBuilder iBuilder = new RebuildInputBuilder(input); + RebuildOutputBuilder oBuilder = new RebuildOutputBuilder(); + + try { + CommonLcmFields retval = callDG("rebuild", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> audit(AuditInput input) { + AuditInputBuilder iBuilder = new AuditInputBuilder(input); + AuditOutputBuilder oBuilder = new AuditOutputBuilder(); + + try { + CommonLcmFields retval = callDG("audit", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> start(StartInput input) { + StartInputBuilder iBuilder = new StartInputBuilder(input); + StartOutputBuilder oBuilder = new StartOutputBuilder(); + + try { + CommonLcmFields retval = callDG("start", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture> snapshot(SnapshotInput input) { + SnapshotInputBuilder iBuilder = new SnapshotInputBuilder(input); + SnapshotOutputBuilder oBuilder = new SnapshotOutputBuilder(); + + try { + CommonLcmFields retval = callDG("snapshot", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult rpcResult = + RpcResultBuilder. status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + private CommonLcmFields callDG(String rpcName, Object input) throws LcmRpcInvocationException { + + StatusBuilder statusBuilder = new StatusBuilder(); + + if (input == null) { + LOG.debug("Rejecting " +rpcName+ " because of invalid input"); + statusBuilder.setCode(LcmResponseCode.REJECT_INVALID_INPUT.getValue()); + statusBuilder.setMessage("REJECT - INVALID INPUT. Missing input"); + CommonHeaderBuilder hBuilder = new CommonHeaderBuilder(); + hBuilder.setApiVer("1"); + hBuilder.setOriginatorId("unknown"); + hBuilder.setRequestId("unset"); + hBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + throw new LcmRpcInvocationException(statusBuilder.build(), hBuilder.build()); + } + + CommonHeaderBuilder hBuilder = new CommonHeaderBuilder(((CommonHeader)input).getCommonHeader()); + + // add input to parms + LOG.info("Adding INPUT data for "+ rpcName +" input: " + input.toString()); + Properties inputProps = new Properties(); + MdsalHelper.toProperties(inputProps, input); + + Properties respProps = new Properties(); + + // Call SLI sync method + try + { + if (lcmSliClient.hasGraph("LCM", rpcName , null, "sync")) + { + try + { + respProps = lcmSliClient.execute("LCM", rpcName, null, "sync", inputProps, domDataBroker); + } + catch (Exception e) + { + LOG.error("Caught exception executing service logic for "+ rpcName, e); + statusBuilder.setCode(LcmResponseCode.FAILURE_DG_FAILURE.getValue()); + statusBuilder.setMessage("FAILURE - DG FAILURE ("+e.getMessage()+")"); + throw new LcmRpcInvocationException(statusBuilder.build(), hBuilder.build()); + } + } else { + LOG.error("No service logic active for LCM: '" + rpcName + "'"); + + statusBuilder.setCode(LcmResponseCode.REJECT_DG_NOT_FOUND.getValue()); + statusBuilder.setMessage("FAILURE - DG not found for action "+rpcName); + throw new LcmRpcInvocationException(statusBuilder.build(), hBuilder.build()); + } + } + catch (Exception e) + { + LOG.error("Caught exception looking for service logic", e); + + statusBuilder.setCode(LcmResponseCode.FAILURE_DG_FAILURE.getValue()); + statusBuilder.setMessage("FAILURE - Unexpected error looking for DG ("+e.getMessage()+")"); + throw new LcmRpcInvocationException(statusBuilder.build(), hBuilder.build()); + } + + + StatusBuilder sBuilder = new StatusBuilder(); + MdsalHelper.toBuilder(respProps, sBuilder); + MdsalHelper.toBuilder(respProps, hBuilder); + + Payload payload = null; + String payloadValue = respProps.getProperty("payload"); + if (payloadValue != null) { + payload = new Payload(payloadValue); + } + + String statusCode = sBuilder.getCode().toString(); + + if (!"400".equals(statusCode)) { + LOG.error("Returned FAILED for "+rpcName+" error code: '" + statusCode + "'"); + } else { + LOG.info("Returned SUCCESS for "+rpcName+" "); + } + + return new CommonLcmFields(sBuilder, hBuilder, payload); + + } + +} diff --git a/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmResponseCode.java b/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmResponseCode.java new file mode 100644 index 000000000..76001c860 --- /dev/null +++ b/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmResponseCode.java @@ -0,0 +1,51 @@ +package org.onap.ccsdk.sli.northbound; + +public enum LcmResponseCode { + + // Accepted category + ACCEPT_ACCEPTED(100), + // Error category + ERROR_UNEXPECTED_ERROR(200), + // Rejected category + REJECT_REJECTED(300), + REJECT_INVALID_INPUT(301), + REJECT_MISSING_PARAM(302), + REJECT_PARSING_FAILED(303), + REJECT_NO_TRANSITION(304), + REJECT_ACTION_NOT_SUPPORTED(305), + REJECT_VNF_NOT_FOUND(306), + REJECT_DG_NOT_FOUND(307), + REJECT_WORKFLOW_NOT_FOUND(308), + REJECT_UNSTABLE_VNF(309), + REJECT_LOCKING_FAILURE(310), + REJECT_EXPIRED_REQUEST(311), + REJECT_DUPLICATE_REQUEST(312), + REJECT_MISSING_AAI_DATA(313), + REJECT_MULTIPLE_REQUESTS_FOR_SEARCH(315), + REJECT_POLICY_VALIDATION_FAILURE(316), + // Success category + SUCCESS(400), + // Failure category + FAILURE_DG_FAILURE(401), + FAILURE_NO_TRANSITION(402), + FAILURE_AAI_FAILURE(403), + FAILURE_EXPIRED_REQUEST(404), + FAILURE_UNEXPECTED_FAILURE(405), + FAILURE_UNSTABLE_VNF(406), + FAILURE_REQUEST_NOT_SUPPORTED(450), + // Partial success + PARTIAL_SUCCESS(500); + + + + private int value; + private LcmResponseCode(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + + +} diff --git a/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmRpcInvocationException.java b/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmRpcInvocationException.java new file mode 100644 index 000000000..2ae2200a8 --- /dev/null +++ b/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmRpcInvocationException.java @@ -0,0 +1,25 @@ +package org.onap.ccsdk.sli.northbound; + +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.common.header.CommonHeader; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.status.Status; + +public class LcmRpcInvocationException extends SvcLogicException { + + private Status status; + private CommonHeader commonHeader; + + public LcmRpcInvocationException(Status status, CommonHeader commonHeader) { + this.status = status; + this.commonHeader = commonHeader; + } + + public Status getStatus() { + return status; + } + + public CommonHeader getCommonHeader() { + return commonHeader; + } + +} 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 new file mode 100644 index 000000000..54e53c776 --- /dev/null +++ b/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmSliClient.java @@ -0,0 +1,99 @@ +package org.onap.ccsdk.sli.northbound; +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * Modifications Copyright © 2018 IBM. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + + + +import java.util.Properties; + +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService; +import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class LcmSliClient { + + private static final Logger LOG = LoggerFactory.getLogger(LcmSliClient.class); + + private final SvcLogicService svcLogicService; + + private String ErrorCode = "error-code"; + + public LcmSliClient(final SvcLogicService svcLogicService) { + this.svcLogicService = svcLogicService; + } + + public boolean hasGraph(String module, String rpc, String version, String mode) throws SvcLogicException + { + return svcLogicService.hasGraph(module, rpc, version, mode); + } + + + public Properties execute(String module, String rpc, String version, String mode, Properties parms, DOMDataBroker dataBroker) + throws SvcLogicException { + + + if (LOG.isDebugEnabled()) + { + LOG.debug("Parameters passed to SLI"); + + for (Object key : parms.keySet()) { + String parmName = (String) key; + String parmValue = parms.getProperty(parmName); + + LOG.debug(parmName+" = "+parmValue); + + } + } + + Properties respProps = svcLogicService.execute(module, rpc, version, mode, parms, dataBroker); + + if (LOG.isDebugEnabled()) + { + LOG.debug("Parameters returned by SLI"); + + for (Object key : respProps.keySet()) { + String parmName = (String) key; + String parmValue = respProps.getProperty(parmName); + + LOG.debug(parmName+" = "+parmValue); + + } + } + + if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) { + + if (!respProps.containsKey(ErrorCode)) { + respProps.setProperty(ErrorCode, "500"); + } + } else { + if (!respProps.containsKey(ErrorCode)) { + respProps.setProperty(ErrorCode, "200"); + } + } + + + return respProps; + } + +} 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ 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 new file mode 100644 index 000000000..5597d0801 --- /dev/null +++ b/northbound/lcm/provider/src/main/resources/org/opendaylight/blueprint/lcm-blueprint.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file 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 new file mode 100644 index 000000000..b73151e8d --- /dev/null +++ b/northbound/lcm/provider/src/test/java/org/onap/ccsdk/sli/northbound/TestLcmProvider.java @@ -0,0 +1,1601 @@ +package org.onap.ccsdk.sli.northbound; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; +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; +import java.util.Date; +import java.util.Properties; +import java.util.concurrent.ExecutionException; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.onap.ccsdk.sli.core.sli.SvcLogicLoader; +import org.onap.ccsdk.sli.core.sli.SvcLogicStore; +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.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.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; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.AuditOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.CheckLockInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.CheckLockOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ConfigBackupDeleteInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ConfigBackupDeleteOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ConfigBackupInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ConfigBackupOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ConfigExportInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ConfigExportOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ConfigModifyInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ConfigModifyOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ConfigRestoreInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ConfigRestoreOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ConfigScaleOutInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ConfigScaleOutOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ConfigureInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ConfigureOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.DetachVolumeInputBuilder; +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.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; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.HealthCheckOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.LCMService; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.LiveUpgradeInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.LiveUpgradeOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.LockInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.LockOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.MigrateInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.MigrateOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.Payload; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.QueryInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.QueryOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.QuiesceTrafficInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.QuiesceTrafficOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.RebootInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.RebootOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.RestartInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.RestartOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ResumeTrafficInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ResumeTrafficOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.RollbackInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.RollbackOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.SnapshotInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.SnapshotOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.SoftwareUploadInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.SoftwareUploadOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.StartApplicationInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.StartApplicationOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.StartInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.StartOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.StopApplicationInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.StopApplicationOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.StopInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.StopOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.SyncInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.SyncOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.TerminateInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.TerminateOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.TestInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.TestOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.UnlockInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.UnlockOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.UpgradeBackoutInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.UpgradeBackoutOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.UpgradeBackupInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.UpgradeBackupOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.UpgradePostCheckInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.UpgradePostCheckOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.UpgradePreCheckInputBuilder; +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.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class TestLcmProvider { + + Logger LOG = LoggerFactory.getLogger(LcmProvider.class); + private LcmProvider provider; + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception { + DataBroker dataBroker = mock(DataBroker.class); + NotificationPublishService notifyService = mock(NotificationPublishService.class); + RpcProviderRegistry rpcRegistry = mock(RpcProviderRegistry.class); + BindingAwareBroker.RpcRegistration rpcRegistration = (BindingAwareBroker.RpcRegistration) mock(BindingAwareBroker.RpcRegistration.class); + when(rpcRegistry.addRpcImplementation(any(Class.class), any(LCMService.class))).thenReturn(rpcRegistration); + + + // Load svclogic.properties and get a SvcLogicStore + InputStream propStr = TestLcmProvider.class.getResourceAsStream("/svclogic.properties"); + Properties svcprops = new Properties(); + svcprops.load(propStr); + + SvcLogicStore store = SvcLogicStoreFactory.getSvcLogicStore(svcprops); + + assertNotNull(store); + + URL graphUrl = TestLcmProvider.class.getClassLoader().getResource("graphs"); + + if (graphUrl == null) { + fail("Cannot find graphs directory"); + } + + SvcLogicLoader loader = new SvcLogicLoader(graphUrl.getPath(), store); + loader.loadAndActivate(); + + // Create a ServiceLogicService + SvcLogicServiceImpl svc = new SvcLogicServiceImpl(new SvcLogicPropertiesProviderImpl(), + new SvcLogicClassResolver()); + + // Finally ready to create sliapiProvider + LcmSliClient client = new LcmSliClient(svc); + provider = new LcmProvider(dataBroker, notifyService, rpcRegistry, client); + } + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + provider.close(); + } + + + @Test + public void testCheckLock() { + CheckLockInputBuilder builder = new CheckLockInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.CheckLock); + + try { + CheckLockOutput results = provider.checkLock(builder.build()).get().getResult(); + LOG.info("CheckLock returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("CheckLock threw exception"); + } + + } + + @Test + public void testReboot() { + RebootInputBuilder builder = new RebootInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.Reboot); + builder.setPayload(mock(Payload.class)); + + + try { + RebootOutput results = provider.reboot(builder.build()).get().getResult(); + LOG.info("Reboot returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("Reboot threw exception"); + } + } + + @Test + public void testUpgradeBackup() { + UpgradeBackupInputBuilder builder = new UpgradeBackupInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.UpgradeBackup); + builder.setPayload(mock(Payload.class)); + + + + try { + UpgradeBackupOutput results = provider.upgradeBackup(builder.build()).get().getResult(); + LOG.info("UpgradeBackout returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("CheckLock threw exception"); + } + } + + @Test + public void testRollback() { + RollbackInputBuilder builder = new RollbackInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.Rollback); + builder.setPayload(mock(Payload.class)); + + + try { + RollbackOutput results = provider.rollback(builder.build()).get().getResult(); + LOG.info("Rollback returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("Rollback threw exception"); + } + } + + @Test + public void testSync() { + SyncInputBuilder builder = new SyncInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.Sync); + builder.setPayload(mock(Payload.class)); + + + try { + SyncOutput results = provider.sync(builder.build()).get().getResult(); + LOG.info("Sync returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("Sync threw exception"); + } + } + + @Test + public void testQuery() { + QueryInputBuilder builder = new QueryInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.Query); + + + try { + QueryOutput results = provider.query(builder.build()).get().getResult(); + LOG.info("Query returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("Query threw exception"); + } + + } + + @Test + public void testConfigExport() { + ConfigExportInputBuilder builder = new ConfigExportInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.ConfigExport); + + + try { + ConfigExportOutput results = provider.configExport(builder.build()).get().getResult(); + LOG.info("ConfigExport returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("ConfigExport threw exception"); + } + } + + @Test + public void testStopApplication() { + + StopApplicationInputBuilder builder = new StopApplicationInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.StopApplication); + builder.setPayload(mock(Payload.class)); + + + try { + StopApplicationOutput results = provider.stopApplication(builder.build()).get().getResult(); + LOG.info("StopApplication returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("StopApplication threw exception"); + } + } + + @Test + public void testSoftwareUpload() { + SoftwareUploadInputBuilder builder = new SoftwareUploadInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.SoftwareUpload); + builder.setPayload(mock(Payload.class)); + + + try { + SoftwareUploadOutput results = provider.softwareUpload(builder.build()).get().getResult(); + LOG.info("SoftwareUpload returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("SoftwareUpload threw exception"); + } + } + + @Test + public void testResumeTraffic() { + ResumeTrafficInputBuilder builder = new ResumeTrafficInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.ResumeTraffic); + builder.setPayload(mock(Payload.class)); + + + try { + ResumeTrafficOutput results = provider.resumeTraffic(builder.build()).get().getResult(); + LOG.info("ResumeTraffic returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("ResumeTraffic threw exception"); + } + } + + @Test + public void testDistributeTraffic() { + DistributeTrafficInputBuilder builder = new DistributeTrafficInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.DistributeTraffic); + builder.setPayload(mock(Payload.class)); + + + try { + DistributeTrafficOutput results = provider.distributeTraffic(builder.build()).get().getResult(); + LOG.info("DistributeTraffic returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("DistributeTraffic threw exception"); + } + } + + @Test + public void testConfigure() { + ConfigureInputBuilder builder = new ConfigureInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.Configure); + builder.setPayload(mock(Payload.class)); + + + try { + ConfigureOutput results = provider.configure(builder.build()).get().getResult(); + LOG.info("Configure returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("Configure threw exception"); + } + } + + @Test + public void testActionStatus() { + ActionStatusInputBuilder builder = new ActionStatusInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.ActionStatus); + builder.setPayload(mock(Payload.class)); + + + try { + ActionStatusOutput results = provider.actionStatus(builder.build()).get().getResult(); + LOG.info("ActionStatus returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("ActionStatus threw exception"); + } + } + + @Test + public void testUpgradePreCheck() { + UpgradePreCheckInputBuilder builder = new UpgradePreCheckInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.UpgradePreCheck); + builder.setPayload(mock(Payload.class)); + + + try { + UpgradePreCheckOutput results = provider.upgradePreCheck(builder.build()).get().getResult(); + LOG.info("UpgradePreCheck returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("UpgradePreCheck threw exception"); + } + } + + @Test + public void testLiveUpgrade() { + LiveUpgradeInputBuilder builder = new LiveUpgradeInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.LiveUpgrade); + builder.setPayload(mock(Payload.class)); + + + try { + LiveUpgradeOutput results = provider.liveUpgrade(builder.build()).get().getResult(); + LOG.info("LiveUpgrade returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("LiveUpgrade threw exception"); + } + } + + @Test + public void testConfigModify() { + ConfigModifyInputBuilder builder = new ConfigModifyInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.ConfigModify); + builder.setPayload(mock(Payload.class)); + + + try { + ConfigModifyOutput results = provider.configModify(builder.build()).get().getResult(); + LOG.info("ConfigModify returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("ConfigModify threw exception"); + } + } + + @Test + public void testRestart() { + RestartInputBuilder builder = new RestartInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.Restart); + builder.setPayload(mock(Payload.class)); + + + try { + RestartOutput results = provider.restart(builder.build()).get().getResult(); + LOG.info("Restart returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("Restart threw exception"); + } + } + + @Test + public void testHealthCheck() { + HealthCheckInputBuilder builder = new HealthCheckInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.HealthCheck); + builder.setPayload(mock(Payload.class)); + + + try { + HealthCheckOutput results = provider.healthCheck(builder.build()).get().getResult(); + LOG.info("HealthCheck returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("HealthCheck threw exception"); + } + } + + @Test + public void testLock() { + LockInputBuilder builder = new LockInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.Lock); + builder.setPayload(mock(Payload.class)); + + + try { + LockOutput results = provider.lock(builder.build()).get().getResult(); + LOG.info("Lock returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("Lock threw exception"); + } + } + + @Test + public void testTerminate() { + TerminateInputBuilder builder = new TerminateInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.Terminate); + builder.setPayload(mock(Payload.class)); + + + try { + TerminateOutput results = provider.terminate(builder.build()).get().getResult(); + LOG.info("Terminate returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("Terminate threw exception"); + } + } + + @Test + public void testAttachVolume() { + AttachVolumeInputBuilder builder = new AttachVolumeInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.AttachVolume); + builder.setPayload(mock(Payload.class)); + + + try { + AttachVolumeOutput results = provider.attachVolume(builder.build()).get().getResult(); + LOG.info("AttachVolume returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("AttachVolume threw exception"); + } + } + + @Test + public void testMigrate() { + MigrateInputBuilder builder = new MigrateInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.Migrate); + builder.setPayload(mock(Payload.class)); + + + try { + MigrateOutput results = provider.migrate(builder.build()).get().getResult(); + LOG.info("Migrate returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("Migrate threw exception"); + } + } + + @Test + public void testQuiesceTraffic() { + QuiesceTrafficInputBuilder builder = new QuiesceTrafficInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.QuiesceTraffic); + builder.setPayload(mock(Payload.class)); + + + try { + QuiesceTrafficOutput results = provider.quiesceTraffic(builder.build()).get().getResult(); + LOG.info("QuiesceTraffic returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("QuiesceTraffic threw exception"); + } + } + + @Test + public void testConfigRestore() { + ConfigRestoreInputBuilder builder = new ConfigRestoreInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.ConfigRestore); + builder.setPayload(mock(Payload.class)); + + + try { + ConfigRestoreOutput results = provider.configRestore(builder.build()).get().getResult(); + LOG.info("ConfigRestore returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("ConfigRestore threw exception"); + } + } + + @Test + public void testUpgradeBackout() { + UpgradeBackoutInputBuilder builder = new UpgradeBackoutInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.UpgradeBackout); + builder.setPayload(mock(Payload.class)); + + + try { + UpgradeBackoutOutput results = provider.upgradeBackout(builder.build()).get().getResult(); + LOG.info("UpgradeBackout returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("UpgradeBackout threw exception"); + } + } + + @Test + public void testEvacuate() { + EvacuateInputBuilder builder = new EvacuateInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.Evacuate); + builder.setPayload(mock(Payload.class)); + + + try { + EvacuateOutput results = provider.evacuate(builder.build()).get().getResult(); + LOG.info("Evacuate returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("Evacuate threw exception"); + } + } + + @Test + public void testUnlock() { + UnlockInputBuilder builder = new UnlockInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.Unlock); + builder.setPayload(mock(Payload.class)); + + + try { + UnlockOutput results = provider.unlock(builder.build()).get().getResult(); + LOG.info("Unlock returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("Unlock threw exception"); + } + } + + @Test + public void testConfigBackupDelete() { + ConfigBackupDeleteInputBuilder builder = new ConfigBackupDeleteInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.ConfigBackupDelete); + + + try { + ConfigBackupDeleteOutput results = provider.configBackupDelete(builder.build()).get().getResult(); + LOG.info("ConfigBackupDelete returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("ConfigBackupDelete threw exception"); + } + } + + @Test + public void testUpgradeSoftware() { + UpgradeSoftwareInputBuilder builder = new UpgradeSoftwareInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.UpgradeSoftware); + builder.setPayload(mock(Payload.class)); + + + try { + UpgradeSoftwareOutput results = provider.upgradeSoftware(builder.build()).get().getResult(); + LOG.info("UpgradeSoftware returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("UpgradeSoftware threw exception"); + } + } + + @Test + public void testDownloadNESw() { + DownloadNESwInputBuilder builder = new DownloadNESwInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setPnfName("my-pnf"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.DownloadNESw); + builder.setPayload(mock(Payload.class)); + + + try { + DownloadNESwOutput results = provider.downloadNESw(builder.build()).get().getResult(); + LOG.info("DownloadNESw returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("DownloadNESw threw exception"); + } + } + + @Test + public void testActivateNESw() { + ActivateNESwInputBuilder builder = new ActivateNESwInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setPnfName("my-pnf"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.ActivateNESw); + builder.setPayload(mock(Payload.class)); + + + try { + ActivateNESwOutput results = provider.activateNESw(builder.build()).get().getResult(); + LOG.info("ActivateNESw returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("ActivateNESw threw exception"); + } + } + + @Test + public void testStop() { + StopInputBuilder builder = new StopInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.Stop); + builder.setPayload(mock(Payload.class)); + + + try { + StopOutput results = provider.stop(builder.build()).get().getResult(); + LOG.info("Stop returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("Stop threw exception"); + } + } + + @Test + public void testDetachVolume() { + DetachVolumeInputBuilder builder = new DetachVolumeInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.DetachVolume); + builder.setPayload(mock(Payload.class)); + + + try { + DetachVolumeOutput results = provider.detachVolume(builder.build()).get().getResult(); + LOG.info("DetachVolume returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("DetachVolume threw exception"); + } + } + + @Test + public void testConfigScaleOut() { + ConfigScaleOutInputBuilder builder = new ConfigScaleOutInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.ConfigScaleOut); + builder.setPayload(mock(Payload.class)); + + + try { + ConfigScaleOutOutput results = provider.configScaleOut(builder.build()).get().getResult(); + LOG.info("ConfigScaleOut returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("ConfigScaleOut threw exception"); + } + } + + @Test + public void testUpgradePostCheck() { + UpgradePostCheckInputBuilder builder = new UpgradePostCheckInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.UpgradePostCheck); + builder.setPayload(mock(Payload.class)); + + + try { + UpgradePostCheckOutput results = provider.upgradePostCheck(builder.build()).get().getResult(); + LOG.info("UpgradePostCheck returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("UpgradePostCheck threw exception"); + } + } + + @Test + public void testTest() { + TestInputBuilder builder = new TestInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.Test); + builder.setPayload(mock(Payload.class)); + + + try { + TestOutput results = provider.test(builder.build()).get().getResult(); + LOG.info("Test returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("Test threw exception"); + } + } + + @Test + public void testStartApplication() { + StartApplicationInputBuilder builder = new StartApplicationInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.StartApplication); + builder.setPayload(mock(Payload.class)); + + + try { + StartApplicationOutput results = provider.startApplication(builder.build()).get().getResult(); + LOG.info("StartApplication returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("StartApplication threw exception"); + } + } + + @Test + public void testConfigBackup() { + ConfigBackupInputBuilder builder = new ConfigBackupInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.ConfigBackup); + builder.setPayload(mock(Payload.class)); + + + try { + ConfigBackupOutput results = provider.configBackup(builder.build()).get().getResult(); + LOG.info("ConfigBackup returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("ConfigBackup threw exception"); + } + } + + @Test + public void testRebuild() { + ConfigBackupInputBuilder builder = new ConfigBackupInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.ConfigBackup); + builder.setPayload(mock(Payload.class)); + + + try { + ConfigBackupOutput results = provider.configBackup(builder.build()).get().getResult(); + LOG.info("ConfigBackup returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("ConfigBackup threw exception"); + } + } + + @Test + public void testAudit() { + AuditInputBuilder builder = new AuditInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.Audit); + builder.setPayload(mock(Payload.class)); + + + try { + AuditOutput results = provider.audit(builder.build()).get().getResult(); + LOG.info("Audit returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("Audit threw exception"); + } + } + + @Test + public void testStart() { + StartInputBuilder builder = new StartInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.Start); + builder.setPayload(mock(Payload.class)); + + + try { + StartOutput results = provider.start(builder.build()).get().getResult(); + LOG.info("Start returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("Start threw exception"); + } + } + + @Test + public void testSnapshot() { + SnapshotInputBuilder builder = new SnapshotInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.Snapshot); + builder.setPayload(mock(Payload.class)); + + + try { + SnapshotOutput results = provider.snapshot(builder.build()).get().getResult(); + LOG.info("Snapshot returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("Snapshot threw exception"); + } + } + +} diff --git a/northbound/lcm/provider/src/test/java/org/onap/ccsdk/sli/northbound/TestLcmRpcInvocationException.java b/northbound/lcm/provider/src/test/java/org/onap/ccsdk/sli/northbound/TestLcmRpcInvocationException.java new file mode 100644 index 000000000..f95e83250 --- /dev/null +++ b/northbound/lcm/provider/src/test/java/org/onap/ccsdk/sli/northbound/TestLcmRpcInvocationException.java @@ -0,0 +1,20 @@ +package org.onap.ccsdk.sli.northbound; + +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.common.header.CommonHeader; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.status.Status; + +public class TestLcmRpcInvocationException { + + @Test(expected = SvcLogicException.class) + public void testLcmRpcInvocationException() throws SvcLogicException{ + Status status = null; + CommonHeader commonHeader = null; + LcmRpcInvocationException exception = new LcmRpcInvocationException(status, commonHeader); + assert(exception.getStatus() == status); + assert(exception.getCommonHeader() == commonHeader); + throw exception; + } +} diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Audit.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Audit.xml new file mode 100644 index 000000000..34c84ed9a --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Audit.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Configure.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Configure.xml new file mode 100644 index 000000000..a37f0675a --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Configure.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Evacuate.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Evacuate.xml new file mode 100644 index 000000000..216bd418b --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Evacuate.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Lock.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Lock.xml new file mode 100644 index 000000000..6479d3ec5 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Lock.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Migrate.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Migrate.xml new file mode 100644 index 000000000..9c8959681 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Migrate.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Query.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Query.xml new file mode 100644 index 000000000..5d0312292 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Query.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Reboot.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Reboot.xml new file mode 100644 index 000000000..f117f9606 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Reboot.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Rebuild.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Rebuild.xml new file mode 100644 index 000000000..e721bc5a7 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Rebuild.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Restart.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Restart.xml new file mode 100644 index 000000000..b47091af2 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Restart.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Rollback.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Rollback.xml new file mode 100644 index 000000000..6844d0482 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Rollback.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Snapshot.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Snapshot.xml new file mode 100644 index 000000000..6d0f8b039 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Snapshot.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Start.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Start.xml new file mode 100644 index 000000000..5998614ab --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Start.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Stop.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Stop.xml new file mode 100644 index 000000000..f752725de --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Stop.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Sync.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Sync.xml new file mode 100644 index 000000000..5741175cf --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Sync.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Terminate.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Terminate.xml new file mode 100644 index 000000000..0f2758a89 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Terminate.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Test.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Test.xml new file mode 100644 index 000000000..5ce002d0c --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Test.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Unlock.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Unlock.xml new file mode 100644 index 000000000..d506c2fd5 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Unlock.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_action-status.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_action-status.xml new file mode 100644 index 000000000..435a62d95 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_action-status.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_activate-n-e-sw.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_activate-n-e-sw.xml new file mode 100644 index 000000000..44343dd5f --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_activate-n-e-sw.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_attach-volume.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_attach-volume.xml new file mode 100644 index 000000000..b073f9b7e --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_attach-volume.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_check-lock.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_check-lock.xml new file mode 100644 index 000000000..e07bf133d --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_check-lock.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-backup-delete.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-backup-delete.xml new file mode 100644 index 000000000..5366c30a0 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-backup-delete.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-backup.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-backup.xml new file mode 100644 index 000000000..e32e5fe5b --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-backup.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-export.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-export.xml new file mode 100644 index 000000000..fd6596bac --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-export.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-modify.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-modify.xml new file mode 100644 index 000000000..76782f432 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-modify.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-restore.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-restore.xml new file mode 100644 index 000000000..e0ed71b8a --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-restore.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-scale-out.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-scale-out.xml new file mode 100644 index 000000000..5200feb8a --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-scale-out.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_detach-volume.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_detach-volume.xml new file mode 100644 index 000000000..117a3e31a --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_detach-volume.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_distribute-traffic.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_distribute-traffic.xml new file mode 100644 index 000000000..14ff1134c --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_distribute-traffic.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_download-n-e-sw.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_download-n-e-sw.xml new file mode 100644 index 000000000..6bb0e765c --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_download-n-e-sw.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_health-check.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_health-check.xml new file mode 100644 index 000000000..cf0f773e6 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_health-check.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_live-upgrade.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_live-upgrade.xml new file mode 100644 index 000000000..02fb050f8 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_live-upgrade.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_quiesce-traffic.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_quiesce-traffic.xml new file mode 100644 index 000000000..0770b3dfc --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_quiesce-traffic.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_resume-traffic.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_resume-traffic.xml new file mode 100644 index 000000000..7e0f1d6b3 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_resume-traffic.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_software-upload.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_software-upload.xml new file mode 100644 index 000000000..a9eb58ac4 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_software-upload.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_start-application.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_start-application.xml new file mode 100644 index 000000000..9b422a83c --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_start-application.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_stop-application.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_stop-application.xml new file mode 100644 index 000000000..91dc4fca6 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_stop-application.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_update-software.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_update-software.xml new file mode 100644 index 000000000..75440c2a0 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_update-software.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_upgrade-backout.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_upgrade-backout.xml new file mode 100644 index 000000000..d48d6817a --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_upgrade-backout.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_upgrade-backup.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_upgrade-backup.xml new file mode 100644 index 000000000..d81651a83 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_upgrade-backup.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_upgrade-post-check.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_upgrade-post-check.xml new file mode 100644 index 000000000..ba2798a41 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_upgrade-post-check.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_upgrade-pre-check.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_upgrade-pre-check.xml new file mode 100644 index 000000000..1aaf18fff --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_upgrade-pre-check.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/graph.versions b/northbound/lcm/provider/src/test/resources/graphs/lcm/graph.versions new file mode 100644 index 000000000..420bcf619 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/graph.versions @@ -0,0 +1,42 @@ +LCM restart 1.0.0 sync +LCM rebuild 1.0.0 sync +LCM migrate 1.0.0 sync +LCM evacuate 1.0.0 sync +LCM snapshot 1.0.0 sync +LCM rollback 1.0.0 sync +LCM sync 1.0.0 sync +LCM audit 1.0.0 sync +LCM stop 1.0.0 sync +LCM start 1.0.0 sync +LCM terminate 1.0.0 sync +LCM software-upload 1.0.0 sync +LCM health-check 1.0.0 sync +LCM live-upgrade 1.0.0 sync +LCM lock 1.0.0 sync +LCM unlock 1.0.0 sync +LCM test 1.0.0 sync +LCM check-lock 1.0.0 sync +LCM configure 1.0.0 sync +LCM config-modify 1.0.0 sync +LCM config-scale-out 1.0.0 sync +LCM config-restore 1.0.0 sync +LCM config-backup 1.0.0 sync +LCM config-backup-delete 1.0.0 sync +LCM config-export 1.0.0 sync +LCM stop-application 1.0.0 sync +LCM start-application 1.0.0 sync +LCM quiesce-traffic 1.0.0 sync +LCM resume-traffic 1.0.0 sync +LCM distribute-traffic 1.0.0 sync +LCM upgrade-pre-check 1.0.0 sync +LCM upgrade-software 1.0.0 sync +LCM download-n-e-sw 1.0.0 sync +LCM activate-n-e-sw 1.0.0 sync +LCM upgrade-post-check 1.0.0 sync +LCM upgrade-backup 1.0.0 sync +LCM upgrade-backout 1.0.0 sync +LCM action-status 1.0.0 sync +LCM query 1.0.0 sync +LCM reboot 1.0.0 sync +LCM attach-volume 1.0.0 sync +LCM detach-volume 1.0.0 sync diff --git a/northbound/lcm/provider/src/test/resources/simplelogger.properties b/northbound/lcm/provider/src/test/resources/simplelogger.properties new file mode 100644 index 000000000..001dfd427 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/simplelogger.properties @@ -0,0 +1,22 @@ +### +# ============LICENSE_START======================================================= +# ONAP : CCSDK +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. All rights +# reserved. +# ================================================================================ +# 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. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +### + +org.slf4j.simpleLogger.defaultLogLevel=debug diff --git a/northbound/lcm/provider/src/test/resources/svclogic.properties b/northbound/lcm/provider/src/test/resources/svclogic.properties new file mode 100644 index 000000000..426960f76 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/svclogic.properties @@ -0,0 +1,27 @@ +### +# ============LICENSE_START======================================================= +# ONAP : CCSDK +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. All rights +# reserved. +# ================================================================================ +# 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. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +### + +org.onap.ccsdk.sli.dbtype = jdbc +org.onap.ccsdk.sli.jdbc.url=jdbc:derby:memory:sdnctl;create=true +org.onap.ccsdk.sli.jdbc.driver=org.apache.derby.jdbc.EmbeddedDriver +org.onap.ccsdk.sli.jdbc.database = sdnctl +org.onap.ccsdk.sli.jdbc.user = test +org.onap.ccsdk.sli.jdbc.password = test -- cgit 1.2.3-korg