From b039682a6805507445139e2b2430144f92724b09 Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Thu, 12 Apr 2018 19:13:59 -0400 Subject: Copy LCM interface from APP-C Change-Id: Idc18aa00bcbcee3f51473339b6b4ad90f6b4bffc Issue-ID: CCSDK-219 Signed-off-by: Timoney, Dan (dt5972) --- .gitignore | 2 + lcm/features/ccsdk-lcm/pom.xml | 47 + lcm/features/features-lcm/pom.xml | 29 + lcm/features/pom.xml | 23 + lcm/installer/pom.xml | 147 ++ .../src/assembly/assemble_installer_zip.xml | 59 + .../src/assembly/assemble_mvnrepo_zip.xml | 47 + .../src/main/resources/scripts/install-feature.sh | 39 + lcm/model/pom.xml | 32 + lcm/model/src/main/yang/lcm.yang | 1309 +++++++++++++++++ lcm/pom.xml | 27 + lcm/provider/pom.xml | 94 ++ .../org/onap/ccsdk/sli/northbound/LcmProvider.java | 1037 ++++++++++++++ .../onap/ccsdk/sli/northbound/LcmResponseCode.java | 51 + .../sli/northbound/LcmRpcInvocationException.java | 25 + .../onap/ccsdk/sli/northbound/LcmSliClient.java | 96 ++ .../resources/org/onap/appc/default.properties | 58 + .../src/main/resources/org/onap/appc/logback.xml | 287 ++++ .../onap/ccsdk/sli/northbound/TestLcmProvider.java | 1514 ++++++++++++++++++++ .../test/resources/graphs/lcm/LCM_ActionStatus.xml | 30 + .../test/resources/graphs/lcm/LCM_AttachVolume.xml | 30 + .../src/test/resources/graphs/lcm/LCM_Audit.xml | 30 + .../test/resources/graphs/lcm/LCM_CheckLock.xml | 30 + .../test/resources/graphs/lcm/LCM_ConfigBackup.xml | 30 + .../graphs/lcm/LCM_ConfigBackupDelete.xml | 30 + .../test/resources/graphs/lcm/LCM_ConfigExport.xml | 30 + .../test/resources/graphs/lcm/LCM_ConfigModify.xml | 30 + .../resources/graphs/lcm/LCM_ConfigRestore.xml | 30 + .../resources/graphs/lcm/LCM_ConfigScaleOut.xml | 30 + .../test/resources/graphs/lcm/LCM_Configure.xml | 30 + .../test/resources/graphs/lcm/LCM_DetachVolume.xml | 30 + .../src/test/resources/graphs/lcm/LCM_Evacuate.xml | 30 + .../test/resources/graphs/lcm/LCM_HealthCheck.xml | 30 + .../test/resources/graphs/lcm/LCM_LiveUpgrade.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 + .../resources/graphs/lcm/LCM_QuiesceTraffic.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 + .../resources/graphs/lcm/LCM_ResumeTraffic.xml | 30 + .../src/test/resources/graphs/lcm/LCM_Rollback.xml | 30 + .../src/test/resources/graphs/lcm/LCM_Snapshot.xml | 30 + .../resources/graphs/lcm/LCM_SoftwareUpload.xml | 30 + .../src/test/resources/graphs/lcm/LCM_Start.xml | 30 + .../resources/graphs/lcm/LCM_StartApplication.xml | 30 + .../src/test/resources/graphs/lcm/LCM_Stop.xml | 30 + .../resources/graphs/lcm/LCM_StopApplication.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_UpgradeBackout.xml | 30 + .../resources/graphs/lcm/LCM_UpgradeBackup.xml | 30 + .../resources/graphs/lcm/LCM_UpgradePostCheck.xml | 30 + .../resources/graphs/lcm/LCM_UpgradePreCheck.xml | 30 + .../resources/graphs/lcm/LCM_UpgradeSoftware.xml | 30 + .../src/test/resources/graphs/lcm/graph.versions | 39 + .../src/test/resources/svclogic.properties | 27 + pom.xml | 1 + 61 files changed, 6160 insertions(+) create mode 100644 lcm/features/ccsdk-lcm/pom.xml create mode 100644 lcm/features/features-lcm/pom.xml create mode 100755 lcm/features/pom.xml create mode 100755 lcm/installer/pom.xml create mode 100644 lcm/installer/src/assembly/assemble_installer_zip.xml create mode 100644 lcm/installer/src/assembly/assemble_mvnrepo_zip.xml create mode 100644 lcm/installer/src/main/resources/scripts/install-feature.sh create mode 100755 lcm/model/pom.xml create mode 100644 lcm/model/src/main/yang/lcm.yang create mode 100755 lcm/pom.xml create mode 100755 lcm/provider/pom.xml create mode 100644 lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmProvider.java create mode 100644 lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmResponseCode.java create mode 100644 lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmRpcInvocationException.java create mode 100644 lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmSliClient.java create mode 100644 lcm/provider/src/main/resources/org/onap/appc/default.properties create mode 100644 lcm/provider/src/main/resources/org/onap/appc/logback.xml create mode 100644 lcm/provider/src/test/java/org/onap/ccsdk/sli/northbound/TestLcmProvider.java create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_ActionStatus.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_AttachVolume.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_Audit.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_CheckLock.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_ConfigBackup.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_ConfigBackupDelete.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_ConfigExport.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_ConfigModify.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_ConfigRestore.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_ConfigScaleOut.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_Configure.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_DetachVolume.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_Evacuate.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_HealthCheck.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_LiveUpgrade.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_Lock.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_Migrate.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_Query.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_QuiesceTraffic.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_Reboot.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_Rebuild.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_Restart.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_ResumeTraffic.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_Rollback.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_Snapshot.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_SoftwareUpload.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_Start.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_StartApplication.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_Stop.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_StopApplication.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_Sync.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_Terminate.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_Test.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_Unlock.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_UpgradeBackout.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_UpgradeBackup.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_UpgradePostCheck.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_UpgradePreCheck.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/LCM_UpgradeSoftware.xml create mode 100644 lcm/provider/src/test/resources/graphs/lcm/graph.versions create mode 100644 lcm/provider/src/test/resources/svclogic.properties diff --git a/.gitignore b/.gitignore index d11ed581b..f9dd2d58a 100755 --- a/.gitignore +++ b/.gitignore @@ -26,12 +26,14 @@ dist *.ipr *.iml *.iws +*.log classes out/ .DS_STORE .metadata provider/src/main/java/META-INF/ provider/src/main/java/inventory/ +model/src/main/yang-gen-sal ## BlackDuck generated file sdnc-northbound_bdio.jsonld diff --git a/lcm/features/ccsdk-lcm/pom.xml b/lcm/features/ccsdk-lcm/pom.xml new file mode 100644 index 000000000..e7440c6d8 --- /dev/null +++ b/lcm/features/ccsdk-lcm/pom.xml @@ -0,0 +1,47 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + single-feature-parent + 1.0.1-SNAPSHOT + + + + org.onap.ccsdk.sli.northbound + ccsdk-lcm + 0.2.1-SNAPSHOT + feature + + ccsdk-sli-northbound :: lcm :: ${project.artifactId} + + + + + org.opendaylight.controller + odl-mdsal-broker + xml + features + + + org.onap.ccsdk.sli.core + ccsdk-sli + ${ccsdk.sli.core.version} + xml + features + + + ${project.groupId} + lcm-model + ${project.version} + + + ${project.groupId} + lcm-provider + ${project.version} + + + + diff --git a/lcm/features/features-lcm/pom.xml b/lcm/features/features-lcm/pom.xml new file mode 100644 index 000000000..6af726dc2 --- /dev/null +++ b/lcm/features/features-lcm/pom.xml @@ -0,0 +1,29 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + feature-repo-parent + 1.0.1-SNAPSHOT + + + + org.onap.ccsdk.sli.northbound + features-lcm + 0.2.1-SNAPSHOT + feature + + ccsdk-sli-northbound :: lcm :: ${project.artifactId} + + + + ${project.groupId} + ccsdk-lcm + ${project.version} + xml + features + + + + diff --git a/lcm/features/pom.xml b/lcm/features/pom.xml new file mode 100755 index 000000000..590d5aa29 --- /dev/null +++ b/lcm/features/pom.xml @@ -0,0 +1,23 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + odlparent-lite + 1.0.1-SNAPSHOT + + + org.onap.ccsdk.sli.northbound + lcm-features + 0.2.1-SNAPSHOT + pom + + ccsdk-sli-northbound :: lcm :: ${project.artifactId} + + + ccsdk-lcm + features-lcm + + diff --git a/lcm/installer/pom.xml b/lcm/installer/pom.xml new file mode 100755 index 000000000..7c9c827d8 --- /dev/null +++ b/lcm/installer/pom.xml @@ -0,0 +1,147 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + odlparent-lite + 1.0.1-SNAPSHOT + + + + org.onap.ccsdk.sli.northbound + lcm-installer + 0.2.1-SNAPSHOT + pom + + ccsdk-sli-northbound :: lcm :: ${project.artifactId} + + + ccsdk-lcm + ${application.name} + mvn:org.onap.ccsdk.sli.northbound/${features.boot}/${project.version}/xml/features + false + + + + + + org.onap.ccsdk.sli.northbound + ${application.name} + ${project.version} + xml + features + + + * + * + + + + + org.onap.ccsdk.sli.northbound + lcm-model + ${project.version} + + + org.onap.ccsdk.sli.northbound + lcm-provider + ${project.version} + + + + + + + + + maven-assembly-plugin + 2.6 + + + maven-repo-zip + + single + + package + + false + stage/${application.name}-${project.version} + + src/assembly/assemble_mvnrepo_zip.xml + + false + + + + installer-zip + + single + + package + + true + ${application.name}-${project.version}-installer + + src/assembly/assemble_installer_zip.xml + + false + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-dependencies + + copy-dependencies + + prepare-package + + false + ${project.build.directory}/assembly/system + false + true + true + true + false + false + org.onap.ccsdk.sli.northbound + provided + + + + + + maven-resources-plugin + 2.6 + + + copy-version + + copy-resources + + validate + + ${basedir}/target/stage + + + src/main/resources/scripts + + install-feature.sh + + true + + + + + + + + + + + diff --git a/lcm/installer/src/assembly/assemble_installer_zip.xml b/lcm/installer/src/assembly/assemble_installer_zip.xml new file mode 100644 index 000000000..3bed4b5ef --- /dev/null +++ b/lcm/installer/src/assembly/assemble_installer_zip.xml @@ -0,0 +1,59 @@ + + + + + + installer_zip + + zip + + + + false + + + + target/stage/ + ${application.name} + 755 + + *.sh + + + + target/stage/ + ${application.name} + 644 + + *.sh + + + + + + + diff --git a/lcm/installer/src/assembly/assemble_mvnrepo_zip.xml b/lcm/installer/src/assembly/assemble_mvnrepo_zip.xml new file mode 100644 index 000000000..21e271d42 --- /dev/null +++ b/lcm/installer/src/assembly/assemble_mvnrepo_zip.xml @@ -0,0 +1,47 @@ + + + + + + mvnrepo_zip + + zip + + + + false + + + + target/assembly/ + . + + + + + + diff --git a/lcm/installer/src/main/resources/scripts/install-feature.sh b/lcm/installer/src/main/resources/scripts/install-feature.sh new file mode 100644 index 000000000..cee4a4952 --- /dev/null +++ b/lcm/installer/src/main/resources/scripts/install-feature.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +### +# ============LICENSE_START======================================================= +# openECOMP : SDN-C +# ================================================================================ +# 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========================================================= +### + +ODL_HOME=${ODL_HOME:-/opt/opendaylight/current} +ODL_KARAF_CLIENT=${ODL_KARAF_CLIENT:-${ODL_HOME}/bin/client} +INSTALLERDIR=$(dirname $0) + +REPOZIP=${INSTALLERDIR}/${features.boot}-${project.version}.zip + +if [ -f ${REPOZIP} ] +then + unzip -d ${ODL_HOME} ${REPOZIP} +else + echo "ERROR : repo zip ($REPOZIP) not found" + exit 1 +fi + +${ODL_KARAF_CLIENT} feature:repo-add ${features.repositories} +${ODL_KARAF_CLIENT} feature:install ${features.boot} diff --git a/lcm/model/pom.xml b/lcm/model/pom.xml new file mode 100755 index 000000000..6d8589e19 --- /dev/null +++ b/lcm/model/pom.xml @@ -0,0 +1,32 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + binding-parent + 1.0.1-SNAPSHOT + + + + org.onap.ccsdk.sli.northbound + lcm-model + 0.2.1-SNAPSHOT + bundle + + ccsdk-sli-northbound :: lcm :: ${project.artifactId} + + + + + org.opendaylight.mdsal.model + ietf-inet-types + + + org.opendaylight.mdsal.model + ietf-yang-types + + + + + diff --git a/lcm/model/src/main/yang/lcm.yang b/lcm/model/src/main/yang/lcm.yang new file mode 100644 index 000000000..9976dd9e5 --- /dev/null +++ b/lcm/model/src/main/yang/lcm.yang @@ -0,0 +1,1309 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * 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. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +/* + * Yang model for the Application Controller (APP-C) component of ECOMP + * + * This model is used to define the data and services of the Application Controller + * component of ECOMP. The APP-C controller initiates the processing of directed + * graphs, which define the actual process implementations used. The name of the + * directed graph is set by properties and cannot be changed dynamically. + * + * The services exposed by this provider are: + * + * restart-vnf: + * Used to request a restart of a virtual network function (a VM). + * + * rebuild-vnf: + * Used to request a rebuild of a virtual network function (a VM). + * + */ + +module LCM { + + yang-version 1; + namespace "org:onap:ccsdk:sli:northbound:lcm"; + prefix lcm; + + description + "Defines the services and request/response requirements for the CCSDK LCM component."; + + /* + * Note, the revision changes the package name of the generated java code. Do not + * change the revision unless you also update all references to the bindings. + */ + revision "2018-03-29" { + description + "CCSDK LCM interface version 0.2.1"; + } + + /********************************************************************************** + * Data type definitions + * + * The following data type definitions are used to define common data structures, + * define constraints, or to impart special meanings to data objects related to the + * APP-C controller functions. + **********************************************************************************/ + + typedef ZULU { + description "Define a common definition of a time stamp (expressed as a formatted + string) as follows yyyy-MM-ddTHH:mm:ss.SSSSSSSSZ"; + type string { + length "16..28"; + pattern "[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}T[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}.[0-9]{1,6}Z"; + } + } + + typedef payload { + type string ; + description "The payload can be any valid JSON string value. Json escape characters need to be added when required to include an inner json within the payload to make it a valid json string value"; + } + + typedef action { + type enumeration { + enum "Restart"; + enum "Rebuild"; + enum "Migrate"; + enum "Evacuate"; + enum "Snapshot"; + enum "Rollback"; + enum "Sync"; + enum "Audit"; + enum "Stop"; + enum "Start"; + enum "Terminate"; + enum "SoftwareUpload"; + enum "HealthCheck"; + enum "LiveUpgrade"; + enum "Lock"; + enum "Unlock"; + enum "Test"; + enum "CheckLock"; + enum "Configure"; + enum "ConfigModify"; + enum "ConfigScaleOut"; + enum "ConfigRestore"; + enum "ConfigBackup"; + enum "ConfigBackupDelete"; + enum "ConfigExport"; + enum "StopApplication"; + enum "StartApplication"; + enum "QuiesceTraffic"; + enum "ResumeTraffic"; + enum "UpgradePreCheck"; + enum "UpgradeSoftware"; + enum "UpgradePostCheck"; + enum "UpgradeBackup"; + enum "UpgradeBackout"; + enum "ActionStatus"; + enum "Query"; + enum "Reboot"; + enum "AttachVolume"; + enum "DetachVolume"; + + } + description "The action to be taken by APP-C, e.g. Restart, Rebuild, Migrate"; + } + + typedef vm-state { + description "The state of a VM"; + type enumeration { + enum "active"; + enum "standby"; + enum "inactive"; + enum "unknown"; + } + } + + typedef vm-status { + description "The status of a VM"; + type enumeration { + enum "healthy"; + enum "unhealthy"; + enum "unknown"; + } + } + + + /********************************************************************************** + * Basic manipulation of a VNF (or VM) will typically include querying the current + * state, restarting, rebuilding, stopping, starting, etc. In all of these basic + * "state"-type operations, the services require the identification of the VNF to + * be operated on, and the region or LCP that contains that resource. This + * information is used across all of these services, so it has been defined as a + * common structure here and is referenced in the appropriate RPC definitions. + **********************************************************************************/ + + + /********************************************************************************** + * All requests will include this standard header + * + * The standard request header is used to define a correlation identification for + * the request that is returned on all responses. This correlation identifier + * (called the service-request-id) is meaningful to the caller and is included on + * all responses from the services. + **********************************************************************************/ + + /********************************************************************************** + * All responses will include this standard header + * + * The standard response header includes the time of completion as well as a + * success|failure indication + **********************************************************************************/ + + grouping common-header { + description "A common header for all APP-C requests"; + container common-header { + description "A common header for all APP-C requests"; + leaf timestamp { + description "timestamp is in ISO 8601 timestamp format ZULU offset"; + type ZULU; + mandatory true; + } + + leaf api-ver { + description "api-ver is the API version identifier. A given release of APPC + should support all previous versions of APPC API (correlate with + general requirements)"; + type string { + pattern "[2]\.\d\d" { + error-message "API Version 2.XX is supported at this end point"; + } + } + mandatory true; + } + + leaf originator-id { + description "originator-id an identifier of the calling system which can be + used addressing purposes, i.e. returning asynchronous response + to the proper destination over DMaaP (especially in case of multiple + consumers of APP-C APIs)"; + type string; + mandatory true; + } + + leaf request-id { + description "UUID for the request ID. An OSS/BSS identifier for the request + that caused the current action. Multiple API calls may be made + with the same request-id The request-id shall be recorded throughout + the operations on a single request"; + type string; + mandatory true; + } + + leaf sub-request-id { + description "Uniquely identifies a specific LCM action. It is persistent over + the life-cycle of a single request"; + type string; + mandatory false; + } + + + /********************************************************************************** + * Flags are generic flags that apply to any and all commands, all are optional + * force = TRUE/FALSE - Execute command even if target is in unstable (i.e. locked, transiting, etc) + * state. Specific behaviour of forced commands varies, but implies cancellation + * of previous command and an override by the new command. The FALSE value is + * used by default. + * ttl = <0....N> - The timeout value for command execution, expressed in seconds + * mode = EXCLUSIVE/NORMAL - defines execution mode as follows: + * - EXCLUSIVE ? on encountering an exclusive command, the APP-C will: + * * Cease accepting additional command requests + * * Complete execution of outstanding commands + * * Execute the exclusive command to completion + * * Optionally report the result of the command + * * Optionally resume command acceptance and processing + * - NORMAL - Obverse of EXCLUSIVE, the default one. + **********************************************************************************/ + container flags { + description "Flags are generic flags that apply to any and all commands, all are optional"; + leaf mode { + type enumeration { + enum "EXCLUSIVE"; + enum "NORMAL"; + } + description "EXCLUSIVE (accept no queued requests on this VNF while processing) + or NORMAL (queue other requests until complete)"; + mandatory false; + } + leaf force { + type enumeration { + enum "TRUE"; + enum "FALSE"; + } + description "TRUE/FALSE - Execute action even if target is in unstable (i.e. + locked, transiting, etc.) state"; + mandatory false; + } + leaf ttl { + description "<0....N> - The timeout value (expressed in seconds) for action + execution, between action being received by APPC and action initiation"; + type uint16; + mandatory false; + } + } + } + } + + + grouping action-identifiers { + description "A block containing the action arguments. These are used to specify + the object upon which APP-C LCM command is to operate"; + container action-identifiers { + description "A block containing the action arguments. These are used to specify + the object upon which APP-C LCM command is to operate"; + leaf service-instance-id { + description "identifies a specific service the command refers to. When multiple + APP-C instances are used and applied to a subset of services, + this will become significant . The field is mandatory when the + vnf-id is empty"; + type string; + mandatory false; + } + leaf vnf-id { + description "identifies the VNF to which this action is to be applied(vnf-id + uniquely identifies the service-instance referred to). Note that + some actions are applied to multiple VNFs in the same service. + When this is the case, vnf-id may be left out, but service-instance-id + must appear. The field is mandatory when service-instance-id is + empty"; + type string; + mandatory false; + } + leaf vf-module-id { + description "identifies the VF module to which this action is to be applied."; + type string; + mandatory false; + } + leaf vnfc-name { + description "identifies the VNFC to which this action is to be applied. Some + actions apply only to a component within a VNF (e.g. RESTART is + sometimes applied to on VM only). In such a case, the name of + the VNFC is used to search for the component within the VNF"; + type string; + mandatory false; + } + leaf vserver-id { + description "identifies a specific VM within the given service/vnf to which + this action is to be applied"; + type string; + mandatory false; + } + } + } + + + grouping status { + description "The specific response codes are to be aligned with SDC reference doc + (main table removed to avoid duplication and digression from main table). + See SDC and ECOMP Distribution Consumer Interface Agreement"; + container status { + description "The specific response codes are to be aligned with SDC reference doc + (main table removed to avoid duplication and digression from main table). + See SDC and ECOMP Distribution Consumer Interface Agreement"; + leaf code { + description "Response code"; + type uint16; + mandatory true; + } + leaf message { + description "Response message"; + type string; + mandatory true; + } + } + } + + typedef lcm-action-status { + type enumeration { + enum "IN_PROGRESS"; + enum "SUCCESSFUL"; + enum "FAILED"; + enum "NOT_FOUND"; + enum "ABORTED"; + enum "MULTIPLE_REQUESTS_FOUND"; + } + description "The status of the requested LCM action"; + } + + /********************************************************************************** + * Define the restart service + **********************************************************************************/ + rpc restart { + description "An operation to restart a virtual network function (or VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the rebuild service + **********************************************************************************/ + rpc rebuild { + description "An operation to rebuild a virtual network function (or VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the migrate service + **********************************************************************************/ + rpc migrate { + description "An operation to migrate a virtual network function (or VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the evacuate service + **********************************************************************************/ + rpc evacuate { + description "An operation to evacuate a virtual network function (or VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the snapshot service + **********************************************************************************/ + rpc snapshot { + description "An operation to create a snapshot of a virtual network function (or VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + leaf identity-url { + type string; + mandatory true; + } + } + output { + uses common-header; + uses status; + leaf snapshot-id { + type string; + } + } + } + /********************************************************************************** + * Define the VNF quiesce traffic service + **********************************************************************************/ + rpc quiesce-traffic { + description "An operation to stop traffic gracefully on the VF. + It stops traffic gracefully without stopping the application"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory true; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the VNF resume traffic service + **********************************************************************************/ + rpc resume-traffic { + description "An operation to resume traffic gracefully on the VF. + It resumes traffic gracefully without stopping the application"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory true; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the VNF UpgradePreCheck service + **********************************************************************************/ + rpc upgrade-pre-check { + description "An operation to check that the VNF has the correct software version needed for a software upgrade."; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory true; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the VNF UpgradeSoftware service + **********************************************************************************/ + rpc upgrade-software { + description "An operation to upgrade the target VNF to a new version and expected that the VNF is in a quiesced status ."; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory true; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the VNF UpgradePostCheck service + **********************************************************************************/ + rpc upgrade-post-check { + description "An operation to check the VNF upgrade has been successful completed and all processes are running properly."; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory true; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the VNF UpgradeBackup service + **********************************************************************************/ + rpc upgrade-backup { + description "An operation to do full backup of the VNF data prior to an upgrade."; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory true; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the VNF UpgradeBackout service + **********************************************************************************/ + rpc upgrade-backout { + description "An operation does a backout after an UpgradeSoftware is completed (either successfully or unsuccessfully)."; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory true; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the rollback service + **********************************************************************************/ + rpc rollback { + description "An operation to rollback to particular snapshot of a virtual network function (or VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + leaf identity-url { + type string; + mandatory true; + } + leaf snapshot-id { + type string; + mandatory true; + } + } + output { + uses common-header; + uses status; + } + } + + + /********************************************************************************** + * Additional RPCs added here... + **********************************************************************************/ + + + /********************************************************************************** + * Define the sync service + **********************************************************************************/ + rpc sync { + description "An operation to sync the configurations of a virtual network function (or VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + leaf payload { + type payload; + mandatory false; + } + } + } + + /********************************************************************************** + * Define the terminate service + **********************************************************************************/ + rpc terminate { + description "An operation to terminate the configurations of a virtual network function (or VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + } + } + + + rpc configure { + description "An operation to configure the configurations of a virtual network + function (or VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + leaf payload { + type payload; + mandatory false; + } + } + } + + rpc config-modify { + description "Use the ModifyConfig command when a full configuration cycle is either not required + or is considered too costly. The ModifyConfig LCM action affects only a subset of the + total configuration data of a VNF. The set of configuration parameters to be affected + is a subset of the total configuration data of the target VNF type. The payload Stop + Application must contain the configuration parameters to be modified and their values. + A successful modify returns a success response. A failed modify returns a failure + response and the specific failure messages in the response payload Stop Application"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + leaf payload { + type payload; + mandatory false; + } + } + } + + rpc config-scale-out { + description "An operation to Modify the configuration or other action to support + a ConfigScaleOut of a VNF."; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + leaf payload { + type payload; + mandatory false; + } + } + } + + rpc config-restore { + description "An operation to restore the configurations of a virtual network + function (or VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + leaf payload { + type payload; + mandatory false; + } + } + } + + /********************************************************************************** + * Define the test service + **********************************************************************************/ + rpc test { + description "An operation to test the configurations of a virtual network function (or VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the stop service + **********************************************************************************/ + rpc stop { + description "An operation to stop the configurations of a virtual network function (or VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + } + } + + rpc start { + description "An operation to start a virtual network function (or VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the audit service + **********************************************************************************/ + rpc audit { + description "An operation to audit the configurations of a virtual network function (or VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + leaf payload { + type payload; + mandatory false; + } + } + } + + /********************************************************************************** + * Define the SoftwareUpload vSCP service + **********************************************************************************/ + rpc software-upload { + description "An operation to upload a new version of vSCP image to vSCP for updating it"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the PreHealthCheck vSCP service + **********************************************************************************/ + rpc health-check { + description "An operation to perform health check of vSCP prior its upgrading"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + } + } + + + /********************************************************************************** + * Define the Upgrade vSCP service + **********************************************************************************/ + rpc live-upgrade { + description "An operation to perform upgrade of vSCP"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + } + } + + + /********************************************************************************** + * Define the VNF lock service + **********************************************************************************/ + rpc lock { + description "An operation to perform VNF lock operation"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the VNF unlock service + **********************************************************************************/ + rpc unlock { + description "An operation to perform VNF unlock operation"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the VNF check lock service + **********************************************************************************/ + rpc check-lock { + description "An operation to check VNF lock status"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + } + output { + uses common-header; + uses status; + leaf locked { + type enumeration { + enum "TRUE"; + enum "FALSE"; + } + description "TRUE/FALSE - returns TRUE when the given VNF was locked, otherwise returns FALSE"; + mandatory false; + } + } + } + + + rpc config-backup { + description "An operation to Backup configurations of a virtual network function + (or VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + leaf payload { + type payload; + mandatory false; + } + } + } + + rpc config-backup-delete { + description "An operation to Delete backup configurations of a virtual network + function (or VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + } + output { + uses common-header; + uses status; + leaf payload { + type payload; + mandatory false; + } + } + } + + rpc config-export { + description "An operation to Export configurations of a virtual network function + (or VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + } + output { + uses common-header; + uses status; + } + } + rpc stop-application { + description "An operation to Stop Application traffic to a virtual network function"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the VNF Start Application service + **********************************************************************************/ + rpc start-application { + description "An operation to perform VNF Start Application operation"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + } + } + + + /********************************************************************************** + * Gets the current state of the previously submitted LCM request + **********************************************************************************/ + rpc action-status { + description "An operation to get the current state of the previously submitted LCM request"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + leaf payload { + type payload; + } + } + } + + /********************************************************************************** + * Define the VNF Query service + **********************************************************************************/ + rpc query { + description "An operation to query the status of a targe VNF. + Returns information on each VM, including state (active or standby) + and status (healthy or unhealthy)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + } + output { + uses common-header; + uses status; + list query-results { + leaf vserver-id { + description "Identifier of a VM"; + type string; + mandatory true; + } + leaf vm-state { + description "The state of the VM"; + type vm-state; + mandatory true; + } + leaf vm-status { + description "the status of the VM"; + type vm-status; + mandatory true; + } + } + } + } + + /********************************************************************************** + * Define the Reboot service + **********************************************************************************/ + rpc reboot { + description "An operation to reboot a specified virtual machine (VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the VM attach volume service + **********************************************************************************/ + rpc attach-volume { + description "An operation to attach a cinder volume to a VM"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory true; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the VM detach volume service + **********************************************************************************/ + rpc detach-volume { + description "An operation to detach a cinder volume from a VM"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory true; + } + } + output { + uses common-header; + uses status; + } + } + + + + /********************************************************************************** + * Additional RPCs added here... + **********************************************************************************/ +} diff --git a/lcm/pom.xml b/lcm/pom.xml new file mode 100755 index 000000000..6bf401f2e --- /dev/null +++ b/lcm/pom.xml @@ -0,0 +1,27 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + odlparent-lite + 1.0.1-SNAPSHOT + + + + org.onap.ccsdk.sli.northbound + lcm + 0.2.1-SNAPSHOT + pom + + ccsdk-sli-northbound :: lcm + + + model + features + provider + installer + + + + diff --git a/lcm/provider/pom.xml b/lcm/provider/pom.xml new file mode 100755 index 000000000..ce9e6eb91 --- /dev/null +++ b/lcm/provider/pom.xml @@ -0,0 +1,94 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + binding-parent + 1.0.1-SNAPSHOT + + + + org.onap.ccsdk.sli.northbound + lcm-provider + 0.2.1-SNAPSHOT + bundle + + ccsdk-sli-northbound :: lcm :: ${project.artifactId} + + + + + org.opendaylight.controller + mdsal-artifacts + 1.6.1 + pom + import + + + + + + + org.onap.ccsdk.sli.northbound + lcm-model + ${project.version} + + + org.opendaylight.controller + sal-binding-config + + + + org.opendaylight.controller + sal-binding-api + + + + org.opendaylight.controller + sal-common-util + + + + org.onap.ccsdk.sli.core + sli-common + + + org.onap.ccsdk.sli.core + sli-provider + + + + 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 + 10.12.1.1 + test + + + + + diff --git a/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmProvider.java b/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmProvider.java new file mode 100644 index 000000000..14d3d9e53 --- /dev/null +++ b/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmProvider.java @@ -0,0 +1,1037 @@ +package org.onap.ccsdk.sli.northbound; +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * 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========================================================= + */ + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Properties; +import java.util.concurrent.ExecutionException; +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.api.ReadOnlyTransaction; +import org.opendaylight.controller.md.sal.binding.api.WriteTransaction; +import org.opendaylight.controller.md.sal.binding.impl.AbstractForwardedDataBroker; +import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; +import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; +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.Status; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.status.StatusBuilder; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.opendaylight.yangtools.yang.common.RpcResult; +import org.opendaylight.yangtools.yang.common.RpcResultBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.base.Optional; +import com.google.common.util.concurrent.CheckedFuture; +import com.google.common.util.concurrent.Futures; + +import 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; + + public CommonLcmFields(StatusBuilder statusBuilder, CommonHeaderBuilder commonHeaderBuilder) { + this.statusBuilder = statusBuilder; + this.commonHeaderBuilder = commonHeaderBuilder; + } + + public StatusBuilder getStatusBuilder() { + return statusBuilder; + } + + public CommonHeaderBuilder getCommonHeaderBuilder() { + return commonHeaderBuilder; + } + } + + private static final Logger LOG = LoggerFactory.getLogger(LcmProvider.class); + + private static final String ACTIVE_VERSION = "active"; + + 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 Future> checkLock(CheckLockInput input) { + CheckLockInputBuilder iBuilder = new CheckLockInputBuilder(input); + CheckLockOutputBuilder oBuilder = new CheckLockOutputBuilder(); + + try { + CommonLcmFields retval = callDG("CheckLock", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug("Caught exception", 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 Future> 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("Caught exception", 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 Future> upgradeBackup(UpgradeBackupInput input) { + UpgradeBackupInputBuilder iBuilder = new UpgradeBackupInputBuilder(input); + UpgradeBackupOutputBuilder oBuilder = new UpgradeBackupOutputBuilder(); + + try { + CommonLcmFields retval = callDG("UpgradeBackup", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + + } catch (LcmRpcInvocationException e) { + LOG.debug("Caught exception", 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 Future> 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()); + } catch (LcmRpcInvocationException e) { + LOG.debug("Caught exception", 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 Future> 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("Caught exception", 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 Future> 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("Caught exception", 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 Future> configExport(ConfigExportInput input) { + ConfigExportInputBuilder iBuilder = new ConfigExportInputBuilder(input); + ConfigExportOutputBuilder oBuilder = new ConfigExportOutputBuilder(); + + try { + CommonLcmFields retval = callDG("ConfigExport", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug("Caught exception", 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 Future> stopApplication(StopApplicationInput input) { + StopApplicationInputBuilder iBuilder = new StopApplicationInputBuilder(input); + StopApplicationOutputBuilder oBuilder = new StopApplicationOutputBuilder(); + + try { + CommonLcmFields retval = callDG("StopApplication", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug("Caught exception", 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 Future> softwareUpload(SoftwareUploadInput input) { + SoftwareUploadInputBuilder iBuilder = new SoftwareUploadInputBuilder(input); + SoftwareUploadOutputBuilder oBuilder = new SoftwareUploadOutputBuilder(); + + try { + CommonLcmFields retval = callDG("SoftwareUpload", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug("Caught exception", 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 Future> resumeTraffic(ResumeTrafficInput input) { + ResumeTrafficInputBuilder iBuilder = new ResumeTrafficInputBuilder(input); + ResumeTrafficOutputBuilder oBuilder = new ResumeTrafficOutputBuilder(); + + try { + CommonLcmFields retval = callDG("ResumeTraffic", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug("Caught exception", 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 Future> 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("Caught exception", 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 Future> actionStatus(ActionStatusInput input) { + ActionStatusInputBuilder iBuilder = new ActionStatusInputBuilder(input); + ActionStatusOutputBuilder oBuilder = new ActionStatusOutputBuilder(); + + try { + CommonLcmFields retval = callDG("ActionStatus", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug("Caught exception", 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 Future> upgradePreCheck(UpgradePreCheckInput input) { + UpgradePreCheckInputBuilder iBuilder = new UpgradePreCheckInputBuilder(input); + UpgradePreCheckOutputBuilder oBuilder = new UpgradePreCheckOutputBuilder(); + + try { + CommonLcmFields retval = callDG("UpgradePreCheck", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug("Caught exception", 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 Future> liveUpgrade(LiveUpgradeInput input) { + LiveUpgradeInputBuilder iBuilder = new LiveUpgradeInputBuilder(input); + LiveUpgradeOutputBuilder oBuilder = new LiveUpgradeOutputBuilder(); + + try { + CommonLcmFields retval = callDG("LiveUpgrade", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug("Caught exception", 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 Future> configModify(ConfigModifyInput input) { + ConfigModifyInputBuilder iBuilder = new ConfigModifyInputBuilder(input); + ConfigModifyOutputBuilder oBuilder = new ConfigModifyOutputBuilder(); + + try { + CommonLcmFields retval = callDG("ConfigModify", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug("Caught exception", 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 Future> 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("Caught exception", 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 Future> healthCheck(HealthCheckInput input) { + HealthCheckInputBuilder iBuilder = new HealthCheckInputBuilder(input); + HealthCheckOutputBuilder oBuilder = new HealthCheckOutputBuilder(); + + try { + CommonLcmFields retval = callDG("HealthCheck", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug("Caught exception", 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 Future> 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("Caught exception", 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 Future> 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("Caught exception", 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 Future> attachVolume(AttachVolumeInput input) { + AttachVolumeInputBuilder iBuilder = new AttachVolumeInputBuilder(input); + AttachVolumeOutputBuilder oBuilder = new AttachVolumeOutputBuilder(); + + try { + CommonLcmFields retval = callDG("AttachVolume", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug("Caught exception", 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 Future> 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("Caught exception", 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 Future> quiesceTraffic(QuiesceTrafficInput input) { + QuiesceTrafficInputBuilder iBuilder = new QuiesceTrafficInputBuilder(input); + QuiesceTrafficOutputBuilder oBuilder = new QuiesceTrafficOutputBuilder(); + + try { + CommonLcmFields retval = callDG("QuiesceTraffic", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug("Caught exception", 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 Future> configRestore(ConfigRestoreInput input) { + ConfigRestoreInputBuilder iBuilder = new ConfigRestoreInputBuilder(input); + ConfigRestoreOutputBuilder oBuilder = new ConfigRestoreOutputBuilder(); + + try { + CommonLcmFields retval = callDG("ConfigRestore", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug("Caught exception", 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 Future> upgradeBackout(UpgradeBackoutInput input) { + UpgradeBackoutInputBuilder iBuilder = new UpgradeBackoutInputBuilder(input); + UpgradeBackoutOutputBuilder oBuilder = new UpgradeBackoutOutputBuilder(); + + try { + CommonLcmFields retval = callDG("UpgradeBackout", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug("Caught exception", 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 Future> 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("Caught exception", 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 Future> 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("Caught exception", 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 Future> configBackupDelete(ConfigBackupDeleteInput input) { + ConfigBackupDeleteInputBuilder iBuilder = new ConfigBackupDeleteInputBuilder(input); + ConfigBackupDeleteOutputBuilder oBuilder = new ConfigBackupDeleteOutputBuilder(); + + try { + CommonLcmFields retval = callDG("ConfigBackupDelete", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug("Caught exception", 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 Future> upgradeSoftware(UpgradeSoftwareInput input) { + UpgradeSoftwareInputBuilder iBuilder = new UpgradeSoftwareInputBuilder(input); + UpgradeSoftwareOutputBuilder oBuilder = new UpgradeSoftwareOutputBuilder(); + + try { + CommonLcmFields retval = callDG("UpgradeSoftware", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug("Caught exception", 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 Future> 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("Caught exception", 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 Future> detachVolume(DetachVolumeInput input) { + DetachVolumeInputBuilder iBuilder = new DetachVolumeInputBuilder(input); + DetachVolumeOutputBuilder oBuilder = new DetachVolumeOutputBuilder(); + + try { + CommonLcmFields retval = callDG("DetachVolume", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug("Caught exception", 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 Future> configScaleOut(ConfigScaleOutInput input) { + ConfigScaleOutInputBuilder iBuilder = new ConfigScaleOutInputBuilder(input); + ConfigScaleOutOutputBuilder oBuilder = new ConfigScaleOutOutputBuilder(); + + try { + CommonLcmFields retval = callDG("ConfigScaleOut", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug("Caught exception", 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 Future> upgradePostCheck(UpgradePostCheckInput input) { + UpgradePostCheckInputBuilder iBuilder = new UpgradePostCheckInputBuilder(input); + UpgradePostCheckOutputBuilder oBuilder = new UpgradePostCheckOutputBuilder(); + + try { + CommonLcmFields retval = callDG("UpgradePostCheck", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug("Caught exception", 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 Future> 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("Caught exception", 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 Future> startApplication(StartApplicationInput input) { + StartApplicationInputBuilder iBuilder = new StartApplicationInputBuilder(input); + StartApplicationOutputBuilder oBuilder = new StartApplicationOutputBuilder(); + + try { + CommonLcmFields retval = callDG("StartApplication", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug("Caught exception", 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 Future> configBackup(ConfigBackupInput input) { + ConfigBackupInputBuilder iBuilder = new ConfigBackupInputBuilder(input); + ConfigBackupOutputBuilder oBuilder = new ConfigBackupOutputBuilder(); + + try { + CommonLcmFields retval = callDG("ConfigBackup", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug("Caught exception", 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 Future> 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("Caught exception", 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 Future> 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("Caught exception", 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 Future> 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("Caught exception", 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 Future> 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("Caught exception", 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); + + 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); + + } + +} diff --git a/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmResponseCode.java b/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmResponseCode.java new file mode 100644 index 000000000..76001c860 --- /dev/null +++ b/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/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmRpcInvocationException.java b/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmRpcInvocationException.java new file mode 100644 index 000000000..2ae2200a8 --- /dev/null +++ b/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/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmSliClient.java b/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmSliClient.java new file mode 100644 index 000000000..9fcc92c88 --- /dev/null +++ b/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmSliClient.java @@ -0,0 +1,96 @@ +package org.onap.ccsdk.sli.northbound; +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * 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========================================================= + */ + + + +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; + + 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("error-code")) { + respProps.setProperty("error-code", "500"); + } + } else { + if (!respProps.containsKey("error-code")) { + respProps.setProperty("error-code", "200"); + } + } + + + return respProps; + } + +} diff --git a/lcm/provider/src/main/resources/org/onap/appc/default.properties b/lcm/provider/src/main/resources/org/onap/appc/default.properties new file mode 100644 index 000000000..693cd37a8 --- /dev/null +++ b/lcm/provider/src/main/resources/org/onap/appc/default.properties @@ -0,0 +1,58 @@ +### +# ============LICENSE_START======================================================= +# ONAP : APPC +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Copyright (C) 2017 Amdocs +# ============================================================================= +# 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. +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# ============LICENSE_END========================================================= +### + +# +# This property file supplies the configuration defaults for the APP-C controller +# +# Default values are supplied so that all defined properties have well-known values and are +# valid even if a configuration file is not supplied. This is done to ensure that a runnable, +# stable, and defined configuration exists at all times. The reason the defaults are supplied +# via this property file and not in the code is so that the properties can be changed +# easily if needed in the future. Use of the "getProperty(name, default)" method is +# discouraged because if the default value needs to be changed, everywhere in the code it +# is used would have to be changed. By loading the defaults in this property file, all +# values can be defined in one place and support is easier. This does mean that all +# properties that are defined must have a default value supplied here. Which also means +# this file documents all defined properties (not a bad thing either). +# +#-------------------------------------------------------------------------------------------- +# The path and file used to load user-supplied configuration settings, if any +org.onap.appc.bootstrap.file=appc.properties +org.onap.appc.bootstrap.path=/opt/onap/appc/data/properties,${user.home},. + +appc.application.name=APPC + +# +# The path to search for logging configuration document, and the name of the document +# +org.onap.appc.logging.path=${user.home},etc,../etc,. +org.onap.appc.logging.file=logback.xml + +# +# The DG properties +# +appc.service.logic.module.name=APPC +appc.topology.dg.method=topology-operation-all +appc.topology.dg.version=2.0.0 + diff --git a/lcm/provider/src/main/resources/org/onap/appc/logback.xml b/lcm/provider/src/main/resources/org/onap/appc/logback.xml new file mode 100644 index 000000000..0dffe75e0 --- /dev/null +++ b/lcm/provider/src/main/resources/org/onap/appc/logback.xml @@ -0,0 +1,287 @@ + + + + + + + + + + %d{MM/dd-HH:mm:ss.SSS} [%-16thread] %.-5level + %-36.36logger - %msg%n + + + + + + + + + + ${logDirectory}/cdp.log + + ${logDirectory}/cdp.%i.log.zip + + 1 + 9 + + + 5MB + + + + %d{MM/dd-HH:mm:ss.SSS} [%-16thread] %.-5level + %-36.36logger [%X{User} %X{RemoteHost} %X{RequestId} %X{Method} + %X{Path}] - %msg%n + + + + 256 + + + + + + ${logDirectory}/cdp-security.log + + ${logDirectory}/cdp-security.%i.log.zip + + 1 + 9 + + + 5MB + + + + %d{MM/dd-HH:mm:ss.SSS} [%-16thread] %.-5level + %-36.36logger [%X{User} %X{RemoteHost} %X{RequestId} %X{Method} + %X{Path}] - %msg%n + + + + 256 + 0 + + + + + + ${logDirectory}/cdp-performance.log + + ${logDirectory}/cdp-performance.%i.log.zip + + 1 + 9 + + + 5MB + + + true + %d{MM/dd-HH:mm:ss.SSS} [%-16thread] %.-5level + %-36.36logger [%X{User} %X{RemoteHost} %X{RequestId} %X{Method} + %X{Path}] - %msg%n + + + + 256 + + + + + + ${logDirectory}/cdp-server.log + + ${logDirectory}/cdp-server.%i.log.zip + + 1 + 9 + + + 5MB + + + + %d{MM/dd-HH:mm:ss.SSS} [%-16thread] %.-5level + %-36.36logger [%X{User} %X{RemoteHost} %X{RequestId} %X{Method} + %X{Path}] - %msg%n + + + + 256 + + + + + + ${logDirectory}/cdp-coordinator.log + + ${logDirectory}/cdp-coordinator.%i.log.zip + + 1 + 9 + + + 5MB + + + + %d{MM/dd-HH:mm:ss.SSS} [%-16thread] %.-5level + %-36.36logger - %msg%n + + + + 256 + + + + + + ${logDirectory}/cdp-policy.log + + ${logDirectory}/cdp-policy.%i.log.zip + + 1 + 9 + + + 5MB + + + + %d{MM/dd-HH:mm:ss.SSS} [%-16thread] %.-5level + %-36.36logger - %msg%n + + + + 256 + + + + ${debugLogDirectory}/appc-debug.log + + ${logDirectory}/command-executor.%i.log.zip + + 1 + 9 + + + 5MB + + + + + %d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%t|%X{ServiceName} - %X{bundle.id} - %X{bundle.name} - %X{bundle.version}|%X{InstanceUUID}|%-5.5p|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}|%X{Timer}|[%c{3}]|%m%n + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lcm/provider/src/test/java/org/onap/ccsdk/sli/northbound/TestLcmProvider.java b/lcm/provider/src/test/java/org/onap/ccsdk/sli/northbound/TestLcmProvider.java new file mode 100644 index 000000000..38920e0ba --- /dev/null +++ b/lcm/provider/src/test/java/org/onap/ccsdk/sli/northbound/TestLcmProvider.java @@ -0,0 +1,1514 @@ +package org.onap.ccsdk.sli.northbound; + +import static org.junit.Assert.*; +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.HashMap; +import java.util.Map; +import java.util.Properties; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; + +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.SvcLogicParser; +import org.onap.ccsdk.sli.core.sli.SvcLogicStore; +import org.onap.ccsdk.sli.core.sli.SvcLogicStoreFactory; +import org.onap.ccsdk.sli.core.sli.provider.BlockNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.CallNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.ConfigureNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.DeleteNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.ExecuteNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.ExistsNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.ForNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.GetResourceNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.IsAvailableNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.NotifyNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.RecordNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.ReleaseNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.ReserveNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.ReturnNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.SaveNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.SetNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.SvcLogicNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.SvcLogicPropertiesProviderImpl; +import org.onap.ccsdk.sli.core.sli.provider.SvcLogicServiceImpl; +import org.onap.ccsdk.sli.core.sli.provider.SwitchNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.UpdateNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.WhileNodeExecutor; +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.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.ZULU; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.action.identifiers.ActionIdentifiersBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.common.header.CommonHeaderBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; +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()); + + // 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 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 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/lcm/provider/src/test/resources/graphs/lcm/LCM_ActionStatus.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_ActionStatus.xml new file mode 100644 index 000000000..831071c4d --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_ActionStatus.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_AttachVolume.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_AttachVolume.xml new file mode 100644 index 000000000..ab95cf847 --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_AttachVolume.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_Audit.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_Audit.xml new file mode 100644 index 000000000..b122fe646 --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_Audit.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_CheckLock.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_CheckLock.xml new file mode 100644 index 000000000..8fc467b50 --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_CheckLock.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_ConfigBackup.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_ConfigBackup.xml new file mode 100644 index 000000000..42ae23561 --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_ConfigBackup.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_ConfigBackupDelete.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_ConfigBackupDelete.xml new file mode 100644 index 000000000..d7758e800 --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_ConfigBackupDelete.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_ConfigExport.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_ConfigExport.xml new file mode 100644 index 000000000..f3b69b3ce --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_ConfigExport.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_ConfigModify.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_ConfigModify.xml new file mode 100644 index 000000000..09e313e3e --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_ConfigModify.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_ConfigRestore.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_ConfigRestore.xml new file mode 100644 index 000000000..6ed6d99fc --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_ConfigRestore.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_ConfigScaleOut.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_ConfigScaleOut.xml new file mode 100644 index 000000000..3fd12941b --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_ConfigScaleOut.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_Configure.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_Configure.xml new file mode 100644 index 000000000..13805e6d0 --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_Configure.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_DetachVolume.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_DetachVolume.xml new file mode 100644 index 000000000..78644b745 --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_DetachVolume.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_Evacuate.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_Evacuate.xml new file mode 100644 index 000000000..ba1bdf1d3 --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_Evacuate.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_HealthCheck.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_HealthCheck.xml new file mode 100644 index 000000000..6b362ce3b --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_HealthCheck.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_LiveUpgrade.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_LiveUpgrade.xml new file mode 100644 index 000000000..88e850d5a --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_LiveUpgrade.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_Lock.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_Lock.xml new file mode 100644 index 000000000..f9eee0b04 --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_Lock.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_Migrate.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_Migrate.xml new file mode 100644 index 000000000..c4620d899 --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_Migrate.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_Query.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_Query.xml new file mode 100644 index 000000000..8732b977e --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_Query.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_QuiesceTraffic.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_QuiesceTraffic.xml new file mode 100644 index 000000000..e54eeff6c --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_QuiesceTraffic.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_Reboot.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_Reboot.xml new file mode 100644 index 000000000..89b654dfa --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_Reboot.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_Rebuild.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_Rebuild.xml new file mode 100644 index 000000000..90b7e23f0 --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_Rebuild.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_Restart.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_Restart.xml new file mode 100644 index 000000000..c0d545fa3 --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_Restart.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_ResumeTraffic.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_ResumeTraffic.xml new file mode 100644 index 000000000..fd7b979ed --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_ResumeTraffic.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_Rollback.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_Rollback.xml new file mode 100644 index 000000000..980f263cd --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_Rollback.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_Snapshot.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_Snapshot.xml new file mode 100644 index 000000000..1ef50c516 --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_Snapshot.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_SoftwareUpload.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_SoftwareUpload.xml new file mode 100644 index 000000000..d372a370d --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_SoftwareUpload.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_Start.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_Start.xml new file mode 100644 index 000000000..0e3ae889d --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_Start.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_StartApplication.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_StartApplication.xml new file mode 100644 index 000000000..ff68805be --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_StartApplication.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_Stop.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_Stop.xml new file mode 100644 index 000000000..7e2da11bf --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_Stop.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_StopApplication.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_StopApplication.xml new file mode 100644 index 000000000..affecdd23 --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_StopApplication.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_Sync.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_Sync.xml new file mode 100644 index 000000000..e33096542 --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_Sync.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_Terminate.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_Terminate.xml new file mode 100644 index 000000000..32a800bdf --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_Terminate.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_Test.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_Test.xml new file mode 100644 index 000000000..4f0e1f3ae --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_Test.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_Unlock.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_Unlock.xml new file mode 100644 index 000000000..735d891f7 --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_Unlock.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_UpgradeBackout.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_UpgradeBackout.xml new file mode 100644 index 000000000..b12054ea0 --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_UpgradeBackout.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_UpgradeBackup.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_UpgradeBackup.xml new file mode 100644 index 000000000..c1f7afc84 --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_UpgradeBackup.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_UpgradePostCheck.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_UpgradePostCheck.xml new file mode 100644 index 000000000..89f3a3c02 --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_UpgradePostCheck.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_UpgradePreCheck.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_UpgradePreCheck.xml new file mode 100644 index 000000000..e2ff7991d --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_UpgradePreCheck.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/LCM_UpgradeSoftware.xml b/lcm/provider/src/test/resources/graphs/lcm/LCM_UpgradeSoftware.xml new file mode 100644 index 000000000..98642de1e --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/LCM_UpgradeSoftware.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/lcm/provider/src/test/resources/graphs/lcm/graph.versions b/lcm/provider/src/test/resources/graphs/lcm/graph.versions new file mode 100644 index 000000000..e949f496a --- /dev/null +++ b/lcm/provider/src/test/resources/graphs/lcm/graph.versions @@ -0,0 +1,39 @@ +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 SoftwareUpload 1.0.0 sync +LCM HealthCheck 1.0.0 sync +LCM LiveUpgrade 1.0.0 sync +LCM Lock 1.0.0 sync +LCM Unlock 1.0.0 sync +LCM Test 1.0.0 sync +LCM CheckLock 1.0.0 sync +LCM Configure 1.0.0 sync +LCM ConfigModify 1.0.0 sync +LCM ConfigScaleOut 1.0.0 sync +LCM ConfigRestore 1.0.0 sync +LCM ConfigBackup 1.0.0 sync +LCM ConfigBackupDelete 1.0.0 sync +LCM ConfigExport 1.0.0 sync +LCM StopApplication 1.0.0 sync +LCM StartApplication 1.0.0 sync +LCM QuiesceTraffic 1.0.0 sync +LCM ResumeTraffic 1.0.0 sync +LCM UpgradePreCheck 1.0.0 sync +LCM UpgradeSoftware 1.0.0 sync +LCM UpgradePostCheck 1.0.0 sync +LCM UpgradeBackup 1.0.0 sync +LCM UpgradeBackout 1.0.0 sync +LCM ActionStatus 1.0.0 sync +LCM Query 1.0.0 sync +LCM Reboot 1.0.0 sync +LCM AttachVolume 1.0.0 sync +LCM DetachVolume 1.0.0 sync diff --git a/lcm/provider/src/test/resources/svclogic.properties b/lcm/provider/src/test/resources/svclogic.properties new file mode 100644 index 000000000..426960f76 --- /dev/null +++ b/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 diff --git a/pom.xml b/pom.xml index 63bcb6ead..c83f83a20 100644 --- a/pom.xml +++ b/pom.xml @@ -106,6 +106,7 @@ asdcApi dataChange + lcm dmaap-listener ueb-listener -- cgit 1.2.3-korg