summaryrefslogtreecommitdiffstats
path: root/appc-dispatcher/appc-lifecycle-management
diff options
context:
space:
mode:
authorPatrick Brady <pb071s@att.com>2017-02-15 23:11:26 -0800
committerPatrick Brady <pb071s@att.com>2017-02-15 23:13:06 -0800
commit1c192d2dd68724e292b6a30f463085a262e1e813 (patch)
treed0e2b3a396e169863cd0efaa835c8675e9d5aaac /appc-dispatcher/appc-lifecycle-management
parentc69ba05c7508aa7d7f675189a45c8c87569369ef (diff)
Moving all files to root directory
Change-Id: Ica5535fd6ec85f350fe1640b42137b49f83f10f0 Signed-off-by: Patrick Brady <pb071s@att.com>
Diffstat (limited to 'appc-dispatcher/appc-lifecycle-management')
-rw-r--r--appc-dispatcher/appc-lifecycle-management/.gitignore1
-rw-r--r--appc-dispatcher/appc-lifecycle-management/.settings/org.eclipse.wst.common.project.facet.core.xml4
-rw-r--r--appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/.gitignore1
-rw-r--r--appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/.settings/org.eclipse.wst.common.project.facet.core.xml4
-rw-r--r--appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/pom.xml36
-rw-r--r--appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/LifecycleManager.java30
-rw-r--r--appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/LCMResponse.java33
-rw-r--r--appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/LifecycleException.java34
-rw-r--r--appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/NoTransitionDefinedException.java34
-rw-r--r--appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/VNFOperationOutcome.java29
-rw-r--r--appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/.gitignore1
-rw-r--r--appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/.settings/org.eclipse.wst.common.project.facet.core.xml4
-rw-r--r--appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/pom.xml82
-rw-r--r--appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/main/java/org/openecomp/appc/lifecyclemanager/helper/MetadataReader.java337
-rw-r--r--appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/main/java/org/openecomp/appc/lifecyclemanager/impl/LifecycleManagerImpl.java94
-rw-r--r--appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml34
-rw-r--r--appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/main/resources/org/openecomp/appc/default.properties48
-rw-r--r--appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/test/java/org/openecomp/appc/TestLifecycleManager.java155
-rw-r--r--appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-features/.gitignore1
-rw-r--r--appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-features/pom.xml108
-rw-r--r--appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-features/src/main/resources/features.xml35
-rw-r--r--appc-dispatcher/appc-lifecycle-management/pom.xml22
22 files changed, 1127 insertions, 0 deletions
diff --git a/appc-dispatcher/appc-lifecycle-management/.gitignore b/appc-dispatcher/appc-lifecycle-management/.gitignore
new file mode 100644
index 000000000..b83d22266
--- /dev/null
+++ b/appc-dispatcher/appc-lifecycle-management/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git a/appc-dispatcher/appc-lifecycle-management/.settings/org.eclipse.wst.common.project.facet.core.xml b/appc-dispatcher/appc-lifecycle-management/.settings/org.eclipse.wst.common.project.facet.core.xml
new file mode 100644
index 000000000..f4ef8aa0a
--- /dev/null
+++ b/appc-dispatcher/appc-lifecycle-management/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faceted-project>
+ <installed facet="java" version="1.8"/>
+</faceted-project>
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/.gitignore b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/.gitignore
new file mode 100644
index 000000000..b83d22266
--- /dev/null
+++ b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/.settings/org.eclipse.wst.common.project.facet.core.xml b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/.settings/org.eclipse.wst.common.project.facet.core.xml
new file mode 100644
index 000000000..f4ef8aa0a
--- /dev/null
+++ b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faceted-project>
+ <installed facet="java" version="1.8"/>
+</faceted-project>
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/pom.xml b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/pom.xml
new file mode 100644
index 000000000..67e52a2a6
--- /dev/null
+++ b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/pom.xml
@@ -0,0 +1,36 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-lifecycle-management</artifactId>
+ <version>1.0.0</version>
+ </parent>
+
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-lifecycle-management-api</artifactId>
+ <version>1.0.0</version>
+ <packaging>bundle</packaging>
+
+ <name>appc-lifecycle-management-api</name>
+ <url>http://maven.apache.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+ <Bundle-Version>${project.version}</Bundle-Version>
+ <Export-Package>org.openecomp.appc.lifecyclemanager.*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/LifecycleManager.java b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/LifecycleManager.java
new file mode 100644
index 000000000..795e340e0
--- /dev/null
+++ b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/LifecycleManager.java
@@ -0,0 +1,30 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : APP-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=========================================================
+ */
+
+package org.openecomp.appc.lifecyclemanager;
+
+
+import org.openecomp.appc.lifecyclemanager.objects.LifecycleException;
+import org.openecomp.appc.lifecyclemanager.objects.NoTransitionDefinedException;
+
+public interface LifecycleManager {
+ String getNextState(String vnfType, String currentState, String event) throws NoTransitionDefinedException,LifecycleException;
+}
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/LCMResponse.java b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/LCMResponse.java
new file mode 100644
index 000000000..70aefee26
--- /dev/null
+++ b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/LCMResponse.java
@@ -0,0 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : APP-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=========================================================
+ */
+
+package org.openecomp.appc.lifecyclemanager.objects;
+
+public enum LCMResponse {
+ INVALID_INPUT_PARAMETERS,
+ NO_STATE_CHANGE,
+ NO_TRANSITION_DEFINED,
+ VALID_TRANSITION;
+
+ public String toString(){
+ return this.name();
+ }
+}
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/LifecycleException.java b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/LifecycleException.java
new file mode 100644
index 000000000..d729ca161
--- /dev/null
+++ b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/LifecycleException.java
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : APP-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=========================================================
+ */
+
+package org.openecomp.appc.lifecyclemanager.objects;
+
+
+public class LifecycleException extends Exception {
+ public final String currentState;
+ public final String event;
+ public LifecycleException(Exception e,String currentState,String event){
+ super(e);
+ this.currentState = currentState;
+ this.event = event;
+
+ }
+}
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/NoTransitionDefinedException.java b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/NoTransitionDefinedException.java
new file mode 100644
index 000000000..688be531d
--- /dev/null
+++ b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/NoTransitionDefinedException.java
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : APP-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=========================================================
+ */
+
+package org.openecomp.appc.lifecyclemanager.objects;
+
+
+public class NoTransitionDefinedException extends Exception {
+ public final String currentState;
+ public final String event;
+ public NoTransitionDefinedException(String message,String currentState,String event){
+ super(message);
+ this.currentState = currentState;
+ this.event = event;
+
+ }
+}
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/VNFOperationOutcome.java b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/VNFOperationOutcome.java
new file mode 100644
index 000000000..9ad1cc701
--- /dev/null
+++ b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/VNFOperationOutcome.java
@@ -0,0 +1,29 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : APP-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=========================================================
+ */
+
+package org.openecomp.appc.lifecyclemanager.objects;
+
+public enum VNFOperationOutcome {
+ SUCCESS,FAILURE,EXPIRE;
+ public String toString(){
+ return this.name();
+ }
+}
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/.gitignore b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/.gitignore
new file mode 100644
index 000000000..b83d22266
--- /dev/null
+++ b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/.settings/org.eclipse.wst.common.project.facet.core.xml b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/.settings/org.eclipse.wst.common.project.facet.core.xml
new file mode 100644
index 000000000..f4ef8aa0a
--- /dev/null
+++ b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faceted-project>
+ <installed facet="java" version="1.8"/>
+</faceted-project>
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/pom.xml b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/pom.xml
new file mode 100644
index 000000000..b8535cb62
--- /dev/null
+++ b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/pom.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+ -->
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-lifecycle-management</artifactId>
+ <version>1.0.0</version>
+ </parent>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-lifecycle-management-core</artifactId>
+ <packaging>bundle</packaging>
+
+ <name>appc-lifecycle-management-core Bundle</name>
+ <description>appc-lifecycle-management-core OSGi bundle project.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-lifecycle-management-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>state-machine-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.att.eelf</groupId>
+ <artifactId>eelf-core</artifactId>
+ <version>${eelf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>domain-model-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+ <Bundle-Version>${project.version}</Bundle-Version>
+ <Embed-Dependency>appc-common,eelf-core,logback-core,logback-classic;scope=compile|runtime;inline=false</Embed-Dependency>
+ <Embed-Transitive>true</Embed-Transitive>
+ <Export-Service>org.openecomp.appc.lifecyclemanager.LifecycleManager</Export-Service>
+ <Import-Package>org.openecomp.appc.lifecyclemanager.*,!groovy.lang,!javax.*,!org.apache.log,!org.apache.log4j.*,!org.codehaus.jackson.*,!org.codehaus.jackson.map.*,!org.codehaus.commons.compiler,!org.codehaus.groovy.*,!org.apache.commons.lang3,!org.codehaus.janino,!org.jasypt.*,!com.ibm.icu.*,!com.sun.faces.*,*</Import-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/main/java/org/openecomp/appc/lifecyclemanager/helper/MetadataReader.java b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/main/java/org/openecomp/appc/lifecyclemanager/helper/MetadataReader.java
new file mode 100644
index 000000000..516bb7e4b
--- /dev/null
+++ b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/main/java/org/openecomp/appc/lifecyclemanager/helper/MetadataReader.java
@@ -0,0 +1,337 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : APP-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=========================================================
+ */
+
+package org.openecomp.appc.lifecyclemanager.helper;
+
+
+import org.openecomp.appc.domainmodel.lcm.VNFOperation;
+import org.openecomp.appc.lifecyclemanager.objects.VNFOperationOutcome;
+import org.openecomp.appc.statemachine.objects.Event;
+import org.openecomp.appc.statemachine.objects.State;
+import org.openecomp.appc.statemachine.objects.StateMachineMetadata;
+
+
+public class MetadataReader {
+
+ private enum VNFStates {
+ Not_Instantiated, Instantiated, Configuring, Configured, Testing, Tested, Rebuilding, Restarting, Error, Running, Unknown, Terminating, Stopping, Stopped,
+ Backing_Up, Snapshotting, Software_Uploading, Upgrading, Rollbacking, Licensing, Migrating, Evacuating;
+ }
+
+ @SuppressWarnings("unused")
+ public StateMachineMetadata readMetadata(String vnfType){
+ State NOT_INSTANTIATED = new State(VNFStates.Not_Instantiated.toString());
+ State INSTANTIATED = new State(VNFStates.Instantiated.toString());
+ State CONFIGURING = new State(VNFStates.Configuring.toString());
+ State CONFIGURED = new State(VNFStates.Configured.toString());
+ State TESTING = new State(VNFStates.Testing.toString());
+ State TESTED = new State(VNFStates.Tested.toString());
+ State REBUILDING = new State(VNFStates.Rebuilding.toString());
+ State RESTARTING = new State(VNFStates.Restarting.toString());
+ State ERROR = new State(VNFStates.Error.toString());
+ State RUNNING = new State(VNFStates.Running.toString());
+ State UNKNOWN = new State(VNFStates.Unknown.toString());
+ State TERMINATING = new State(VNFStates.Terminating.toString());
+ State STOPPING = new State(VNFStates.Stopping.toString());
+ State STOPPED = new State(VNFStates.Stopped.toString());
+
+// State PRE_UPGRADE_TESTING = new State(VNFStates.Pre_Upgrade_Testing.toString());
+ State BACKING_UP = new State(VNFStates.Backing_Up.toString());
+ State SNAPSHOTTING = new State(VNFStates.Snapshotting.toString());
+ State SOFTWARE_UPLOADING = new State(VNFStates.Software_Uploading.toString());
+ State UPGRADING = new State(VNFStates.Upgrading.toString());
+ State ROLLBACKING = new State(VNFStates.Rollbacking.toString());
+
+ State MIGRATING = new State(VNFStates.Migrating.toString());
+ State EVACUATING = new State(VNFStates.Evacuating.toString());
+
+ Event CONFIGURE = new Event(VNFOperation.Configure.toString());
+ Event HEALTHCHECK = new Event(VNFOperation.HealthCheck.toString());
+ Event TEST = new Event(VNFOperation.Test.toString());
+ Event START = new Event(VNFOperation.Start.toString());
+ Event TERMINATE = new Event(VNFOperation.Terminate.toString());
+ Event RESTART = new Event(VNFOperation.Restart.toString());
+ Event REBUILD = new Event(VNFOperation.Rebuild.toString());
+ Event STOP = new Event(VNFOperation.Stop.toString());
+ Event MODIFY_CONFIG = new Event(VNFOperation.ModifyConfig.toString());
+ Event BACKUP = new Event(VNFOperation.Backup.toString());
+ Event SNAPSHOT = new Event(VNFOperation.Snapshot.toString());
+ Event SOFTWARE_UPLOAD = new Event(VNFOperation.SoftwareUpload.toString());
+ Event LIVE_UPGRADE = new Event(VNFOperation.LiveUpgrade.toString());
+ Event ROLLBACK = new Event(VNFOperation.Rollback.toString());
+ Event SYNC = new Event(VNFOperation.Sync.toString());
+ Event AUDIT = new Event(VNFOperation.Audit.toString());
+ Event MIGRATE = new Event(VNFOperation.Migrate.toString());
+ Event EVACUATE = new Event(VNFOperation.Evacuate.toString());
+
+ Event LOCK = new Event(VNFOperation.Lock.toString());
+ Event UNLOCK = new Event(VNFOperation.Unlock.toString());
+ Event CHECKLOCK = new Event(VNFOperation.CheckLock.toString());
+
+ Event SUCCESS = new Event(VNFOperationOutcome.SUCCESS.toString());
+ Event FAILURE = new Event(VNFOperationOutcome.FAILURE.toString());
+
+
+ StateMachineMetadata.StateMachineMetadataBuilder builder = new StateMachineMetadata.StateMachineMetadataBuilder();
+
+ builder = builder.addState(NOT_INSTANTIATED);
+ builder = builder.addState(INSTANTIATED);
+ builder = builder.addState(CONFIGURING);
+ builder = builder.addState(CONFIGURED);
+ builder = builder.addState(TESTING);
+ builder = builder.addState(TESTED);
+ builder = builder.addState(REBUILDING);
+ builder = builder.addState(RESTARTING);
+ builder = builder.addState(ERROR);
+ builder = builder.addState(RUNNING);
+ builder = builder.addState(UNKNOWN);
+ builder = builder.addState(TERMINATING);
+ builder = builder.addState(STOPPING);
+ builder = builder.addState(STOPPED);
+// builder = builder.addState(PRE_UPGRADE_TESTING);
+ builder = builder.addState(BACKING_UP);
+ builder = builder.addState(SNAPSHOTTING);
+ builder = builder.addState(SOFTWARE_UPLOADING);
+ builder = builder.addState(UPGRADING);
+ builder = builder.addState(ROLLBACKING);
+ builder = builder.addState(MIGRATING);
+ builder = builder.addState(EVACUATING);
+
+ builder = builder.addEvent(CONFIGURE);
+ builder = builder.addEvent(TEST);
+ builder = builder.addEvent(START);
+ builder = builder.addEvent(TERMINATE);
+ builder = builder.addEvent(RESTART);
+ builder = builder.addEvent(REBUILD);
+ builder = builder.addEvent(SUCCESS);
+ builder = builder.addEvent(FAILURE);
+ builder = builder.addEvent(STOP);
+ builder = builder.addEvent(MODIFY_CONFIG);
+ builder = builder.addEvent(HEALTHCHECK);
+ builder = builder.addEvent(BACKUP);
+ builder = builder.addEvent(SNAPSHOT);
+ builder = builder.addEvent(SOFTWARE_UPLOAD);
+ builder = builder.addEvent(LIVE_UPGRADE);
+ builder = builder.addEvent(ROLLBACK);
+ builder = builder.addEvent(SYNC);
+ builder = builder.addEvent(AUDIT);
+ builder = builder.addEvent(MIGRATE);
+ builder = builder.addEvent(EVACUATE);
+ builder = builder.addEvent(LOCK);
+ builder = builder.addEvent(UNLOCK);
+ builder = builder.addEvent(CHECKLOCK);
+
+ builder = builder.addTransition(INSTANTIATED,CONFIGURE,CONFIGURING);
+ builder = builder.addTransition(INSTANTIATED,TEST,TESTING);
+ builder = builder.addTransition(INSTANTIATED,START,RESTARTING);
+ builder = builder.addTransition(INSTANTIATED,TERMINATE,TERMINATING);
+ builder = builder.addTransition(INSTANTIATED,RESTART,RESTARTING);
+ builder = builder.addTransition(INSTANTIATED,REBUILD,REBUILDING);
+ builder = builder.addTransition(INSTANTIATED,STOP,STOPPING);
+ builder = builder.addTransition(INSTANTIATED,MODIFY_CONFIG,CONFIGURING);
+ builder = builder.addTransition(INSTANTIATED,HEALTHCHECK,TESTING);
+ builder = builder.addTransition(INSTANTIATED,BACKUP,BACKING_UP);
+ builder = builder.addTransition(INSTANTIATED,SNAPSHOT,SNAPSHOTTING);
+ builder = builder.addTransition(INSTANTIATED,SOFTWARE_UPLOAD,SOFTWARE_UPLOADING);
+ builder = builder.addTransition(INSTANTIATED,LIVE_UPGRADE,UPGRADING);
+ builder = builder.addTransition(INSTANTIATED,ROLLBACK,ROLLBACKING);
+ builder = builder.addTransition(INSTANTIATED,MIGRATE,MIGRATING);
+ builder = builder.addTransition(INSTANTIATED,EVACUATE,EVACUATING);
+ builder = builder.addTransition(INSTANTIATED,LOCK,INSTANTIATED);
+ builder = builder.addTransition(INSTANTIATED,UNLOCK,INSTANTIATED);
+ builder = builder.addTransition(INSTANTIATED,CHECKLOCK,INSTANTIATED);
+
+ builder = builder.addTransition(CONFIGURED,CONFIGURE,CONFIGURING);
+ builder = builder.addTransition(CONFIGURED,TEST,TESTING);
+ builder = builder.addTransition(CONFIGURED,START,RESTARTING);
+ builder = builder.addTransition(CONFIGURED,TERMINATE,TERMINATING);
+ builder = builder.addTransition(CONFIGURED,RESTART,RESTARTING);
+ builder = builder.addTransition(CONFIGURED,REBUILD,REBUILDING);
+ builder = builder.addTransition(CONFIGURED,STOP,STOPPING);
+ builder = builder.addTransition(CONFIGURED,MODIFY_CONFIG,CONFIGURING);
+ builder = builder.addTransition(CONFIGURED,HEALTHCHECK,TESTING);
+ builder = builder.addTransition(CONFIGURED,BACKUP,BACKING_UP);
+ builder = builder.addTransition(CONFIGURED,SNAPSHOT,SNAPSHOTTING);
+ builder = builder.addTransition(CONFIGURED,SOFTWARE_UPLOAD,SOFTWARE_UPLOADING);
+ builder = builder.addTransition(CONFIGURED,LIVE_UPGRADE,UPGRADING);
+ builder = builder.addTransition(CONFIGURED,ROLLBACK,ROLLBACKING);
+ builder = builder.addTransition(CONFIGURED,SYNC,CONFIGURED);
+ builder = builder.addTransition(CONFIGURED,AUDIT,CONFIGURED);
+ builder = builder.addTransition(CONFIGURED,MIGRATE,MIGRATING);
+ builder = builder.addTransition(CONFIGURED,EVACUATE,EVACUATING);
+ builder = builder.addTransition(CONFIGURED,LOCK,CONFIGURED);
+ builder = builder.addTransition(CONFIGURED,UNLOCK,CONFIGURED);
+ builder = builder.addTransition(CONFIGURED,CHECKLOCK,CONFIGURED);
+
+ builder = builder.addTransition(TESTED,CONFIGURE,CONFIGURING);
+ builder = builder.addTransition(TESTED,TEST,TESTING);
+ builder = builder.addTransition(TESTED,START,RESTARTING);
+ builder = builder.addTransition(TESTED,TERMINATE,TERMINATING);
+ builder = builder.addTransition(TESTED,RESTART,RESTARTING);
+ builder = builder.addTransition(TESTED,REBUILD,REBUILDING);
+ builder = builder.addTransition(TESTED,STOP,STOPPING);
+ builder = builder.addTransition(TESTED,MODIFY_CONFIG,CONFIGURING);
+ builder = builder.addTransition(TESTED,HEALTHCHECK,TESTING);
+ builder = builder.addTransition(TESTED,BACKUP,BACKING_UP);
+ builder = builder.addTransition(TESTED,SNAPSHOT,SNAPSHOTTING);
+ builder = builder.addTransition(TESTED,SOFTWARE_UPLOAD,SOFTWARE_UPLOADING);
+ builder = builder.addTransition(TESTED,LIVE_UPGRADE,UPGRADING);
+ builder = builder.addTransition(TESTED,ROLLBACK,ROLLBACKING);
+ builder = builder.addTransition(TESTED,SYNC,TESTED);
+ builder = builder.addTransition(TESTED,AUDIT,TESTED);
+ builder = builder.addTransition(TESTED,MIGRATE,MIGRATING);
+ builder = builder.addTransition(TESTED,EVACUATE,EVACUATING);
+ builder = builder.addTransition(TESTED,LOCK,TESTED);
+ builder = builder.addTransition(TESTED,UNLOCK,TESTED);
+ builder = builder.addTransition(TESTED,CHECKLOCK,TESTED);
+
+ builder = builder.addTransition(RUNNING,CONFIGURE,CONFIGURING);
+ builder = builder.addTransition(RUNNING,TEST,TESTING);
+ builder = builder.addTransition(RUNNING,START,RESTARTING);
+ builder = builder.addTransition(RUNNING,TERMINATE,TERMINATING);
+ builder = builder.addTransition(RUNNING,RESTART,RESTARTING);
+ builder = builder.addTransition(RUNNING,REBUILD,REBUILDING);
+ builder = builder.addTransition(RUNNING,STOP,STOPPING);
+ builder = builder.addTransition(RUNNING,MODIFY_CONFIG,CONFIGURING);
+ builder = builder.addTransition(RUNNING,HEALTHCHECK,TESTING);
+ builder = builder.addTransition(RUNNING,BACKUP,BACKING_UP);
+ builder = builder.addTransition(RUNNING,SNAPSHOT,SNAPSHOTTING);
+ builder = builder.addTransition(RUNNING,SOFTWARE_UPLOAD,SOFTWARE_UPLOADING);
+ builder = builder.addTransition(RUNNING,LIVE_UPGRADE,UPGRADING);
+ builder = builder.addTransition(RUNNING,ROLLBACK,ROLLBACKING);
+ builder = builder.addTransition(RUNNING,SYNC,RUNNING);
+ builder = builder.addTransition(RUNNING,AUDIT,RUNNING);
+ builder = builder.addTransition(RUNNING,MIGRATE,MIGRATING);
+ builder = builder.addTransition(RUNNING,EVACUATE,EVACUATING);
+ builder = builder.addTransition(RUNNING,LOCK,RUNNING);
+ builder = builder.addTransition(RUNNING,UNLOCK,RUNNING);
+ builder = builder.addTransition(RUNNING,CHECKLOCK,RUNNING);
+
+ builder = builder.addTransition(ERROR,CONFIGURE,CONFIGURING);
+ builder = builder.addTransition(ERROR,TEST,TESTING);
+ builder = builder.addTransition(ERROR,START,RESTARTING);
+ builder = builder.addTransition(ERROR,TERMINATE,TERMINATING);
+ builder = builder.addTransition(ERROR,RESTART,RESTARTING);
+ builder = builder.addTransition(ERROR,REBUILD,REBUILDING);
+ builder = builder.addTransition(ERROR,STOP,STOPPING);
+ builder = builder.addTransition(ERROR,MODIFY_CONFIG,CONFIGURING);
+ builder = builder.addTransition(ERROR,HEALTHCHECK,TESTING);
+ builder = builder.addTransition(ERROR,BACKUP,BACKING_UP);
+ builder = builder.addTransition(ERROR,SNAPSHOT,SNAPSHOTTING);
+ builder = builder.addTransition(ERROR,SOFTWARE_UPLOAD,SOFTWARE_UPLOADING);
+ builder = builder.addTransition(ERROR,LIVE_UPGRADE,UPGRADING);
+ builder = builder.addTransition(ERROR,ROLLBACK,ROLLBACKING);
+ builder = builder.addTransition(ERROR,SYNC,ERROR);
+ builder = builder.addTransition(ERROR,AUDIT,ERROR);
+ builder = builder.addTransition(ERROR,MIGRATE,MIGRATING);
+ builder = builder.addTransition(ERROR,EVACUATE,EVACUATING);
+ builder = builder.addTransition(ERROR,LOCK,ERROR);
+ builder = builder.addTransition(ERROR,UNLOCK,ERROR);
+ builder = builder.addTransition(ERROR,CHECKLOCK,ERROR);
+
+ builder = builder.addTransition(UNKNOWN,CONFIGURE,CONFIGURING);
+ builder = builder.addTransition(UNKNOWN,TEST,TESTING);
+ builder = builder.addTransition(UNKNOWN,START,RESTARTING);
+ builder = builder.addTransition(UNKNOWN,TERMINATE,TERMINATING);
+ builder = builder.addTransition(UNKNOWN,RESTART,RESTARTING);
+ builder = builder.addTransition(UNKNOWN,REBUILD,REBUILDING);
+ builder = builder.addTransition(UNKNOWN,STOP,STOPPING);
+ builder = builder.addTransition(UNKNOWN,MODIFY_CONFIG,CONFIGURING);
+ builder = builder.addTransition(UNKNOWN,HEALTHCHECK,TESTING);
+ builder = builder.addTransition(UNKNOWN,BACKUP,BACKING_UP);
+ builder = builder.addTransition(UNKNOWN,SNAPSHOT,SNAPSHOTTING);
+ builder = builder.addTransition(UNKNOWN,SOFTWARE_UPLOAD,SOFTWARE_UPLOADING);
+ builder = builder.addTransition(UNKNOWN,LIVE_UPGRADE,UPGRADING);
+ builder = builder.addTransition(UNKNOWN,ROLLBACK,ROLLBACKING);
+ builder = builder.addTransition(UNKNOWN,SYNC,UNKNOWN);
+ builder = builder.addTransition(UNKNOWN,AUDIT,UNKNOWN);
+ builder = builder.addTransition(UNKNOWN,MIGRATE,MIGRATING);
+ builder = builder.addTransition(UNKNOWN,EVACUATE,EVACUATING);
+ builder = builder.addTransition(UNKNOWN,LOCK,UNKNOWN);
+ builder = builder.addTransition(UNKNOWN,UNLOCK,UNKNOWN);
+ builder = builder.addTransition(UNKNOWN,CHECKLOCK,UNKNOWN);
+
+ builder = builder.addTransition(STOPPED,CONFIGURE,CONFIGURING);
+ builder = builder.addTransition(STOPPED,TEST,TESTING);
+ builder = builder.addTransition(STOPPED,START,RESTARTING);
+ builder = builder.addTransition(STOPPED,TERMINATE,TERMINATING);
+ builder = builder.addTransition(STOPPED,RESTART,RESTARTING);
+ builder = builder.addTransition(STOPPED,REBUILD,REBUILDING);
+ builder = builder.addTransition(STOPPED,MODIFY_CONFIG,CONFIGURING);
+ builder = builder.addTransition(STOPPED,HEALTHCHECK,TESTING);
+ builder = builder.addTransition(STOPPED,BACKUP,BACKING_UP);
+ builder = builder.addTransition(STOPPED,SNAPSHOT,SNAPSHOTTING);
+ builder = builder.addTransition(STOPPED,SOFTWARE_UPLOAD,SOFTWARE_UPLOADING);
+ builder = builder.addTransition(STOPPED,LIVE_UPGRADE,UPGRADING);
+ builder = builder.addTransition(STOPPED,ROLLBACK,ROLLBACKING);
+ builder = builder.addTransition(STOPPED,MIGRATE,MIGRATING);
+ builder = builder.addTransition(STOPPED,EVACUATE,EVACUATING);
+ builder = builder.addTransition(STOPPED,LOCK,STOPPED);
+ builder = builder.addTransition(STOPPED,UNLOCK,STOPPED);
+ builder = builder.addTransition(STOPPED,CHECKLOCK,STOPPED);
+
+ builder = builder.addTransition(CONFIGURING,SUCCESS,CONFIGURED);
+ builder = builder.addTransition(CONFIGURING,FAILURE,ERROR);
+
+ builder = builder.addTransition(TESTING,SUCCESS,TESTED);
+ builder = builder.addTransition(TESTING,FAILURE,ERROR);
+
+ builder = builder.addTransition(RESTARTING,SUCCESS,RUNNING);
+ builder = builder.addTransition(RESTARTING,FAILURE,ERROR);
+
+ builder = builder.addTransition(TERMINATING,SUCCESS,NOT_INSTANTIATED);
+ builder = builder.addTransition(TERMINATING,FAILURE,ERROR);
+
+ builder = builder.addTransition(REBUILDING,SUCCESS,RUNNING);
+ builder = builder.addTransition(REBUILDING,FAILURE,ERROR);
+
+ builder = builder.addTransition(STOPPING,SUCCESS,STOPPED);
+ builder = builder.addTransition(STOPPING,FAILURE,ERROR);
+
+// builder = builder.addTransition(PRE_UPGRADE_TESTING,SUCCESS,TESTED);
+// builder = builder.addTransition(PRE_UPGRADE_TESTING,FAILURE,ERROR);
+
+ builder = builder.addTransition(BACKING_UP,SUCCESS,RUNNING);
+ builder = builder.addTransition(BACKING_UP,FAILURE,ERROR);
+
+ builder = builder.addTransition(SNAPSHOTTING,SUCCESS,RUNNING);
+ builder = builder.addTransition(SNAPSHOTTING,FAILURE,ERROR);
+
+ builder = builder.addTransition(SOFTWARE_UPLOADING,SUCCESS,RUNNING);
+ builder = builder.addTransition(SOFTWARE_UPLOADING,FAILURE,ERROR);
+
+ builder = builder.addTransition(UPGRADING,SUCCESS,RUNNING);
+ builder = builder.addTransition(UPGRADING,FAILURE,ERROR);
+
+ builder = builder.addTransition(ROLLBACKING,SUCCESS,RUNNING);
+ builder = builder.addTransition(ROLLBACKING,FAILURE,ERROR);
+
+ builder = builder.addTransition(MIGRATING,SUCCESS,RUNNING);
+ builder = builder.addTransition(MIGRATING,FAILURE,ERROR);
+
+ builder = builder.addTransition(EVACUATING,SUCCESS,RUNNING);
+ builder = builder.addTransition(EVACUATING,FAILURE,ERROR);
+
+ return builder.build();
+
+ }
+
+}
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/main/java/org/openecomp/appc/lifecyclemanager/impl/LifecycleManagerImpl.java b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/main/java/org/openecomp/appc/lifecyclemanager/impl/LifecycleManagerImpl.java
new file mode 100644
index 000000000..ffaab140a
--- /dev/null
+++ b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/main/java/org/openecomp/appc/lifecyclemanager/impl/LifecycleManagerImpl.java
@@ -0,0 +1,94 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : APP-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=========================================================
+ */
+
+package org.openecomp.appc.lifecyclemanager.impl;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.openecomp.appc.i18n.Msg;
+import org.openecomp.appc.lifecyclemanager.LifecycleManager;
+import org.openecomp.appc.lifecyclemanager.helper.MetadataReader;
+import org.openecomp.appc.lifecyclemanager.objects.*;
+import org.openecomp.appc.statemachine.*;
+import org.openecomp.appc.statemachine.impl.StateMachineFactory;
+import org.openecomp.appc.statemachine.objects.*;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.att.eelf.i18n.EELFResourceManager;
+
+
+public class LifecycleManagerImpl implements LifecycleManager{
+
+ private MetadataReader metadataReader;
+ private static Map<String,StateMachine> stateMachineMap = new ConcurrentHashMap<String,StateMachine>();
+ private static final EELFLogger logger = EELFManager.getInstance().getLogger(LifecycleManagerImpl.class);
+ private static EELFLogger errorLogger = EELFManager.getInstance().getErrorLogger();
+ public LifecycleManagerImpl(){
+ this.metadataReader = new MetadataReader();
+ }
+
+ @Override
+ public String getNextState(String vnfType, String currentState, String event) throws NoTransitionDefinedException,LifecycleException{
+ if (logger.isTraceEnabled()) {
+ logger.trace("Entering to getNextState with vnfType = "+ vnfType + ", currentState = " + currentState + ", event = " + event);
+ }
+
+ State nextState = null;
+ StateMachine machine = null;
+ StateMachineResponse response;
+ try {
+ machine = this.getStateMachine(vnfType);
+ response = machine.handleEvent(new State(currentState),new Event(event));
+ if(Response.NO_TRANSITION_DEFINED.equals(response.getResponse())){
+ errorLogger.error(EELFResourceManager.format(Msg.VF_ILLEGAL_COMMAND, vnfType,event,currentState));
+ throw new NoTransitionDefinedException("No Transition Defined for currentState = " + currentState + ", event = " + event,currentState,event);
+ }
+ nextState = response.getNextState();
+ } catch (InvalidInputException e) {
+ logger.error(e.getMessage());
+ throw new LifecycleException(e,currentState,event);
+ }
+ if (logger.isTraceEnabled()) {
+ logger.trace("Exiting from getNextState with (nextState = "+nextState.getStateName()!=null?nextState.getStateName():"null"+")");
+ }
+ return nextState.getStateName();
+ }
+
+ private StateMachine getStateMachine(String vnfType){
+ if (logger.isTraceEnabled()) {
+ logger.trace("Entering to getNextState with vnfType = "+ vnfType);
+ }
+ if(vnfType == null){
+ vnfType = "DEFAULT";
+ }
+ StateMachine machine = stateMachineMap.get(vnfType);
+ if(machine == null){
+ StateMachineMetadata metadata = metadataReader.readMetadata(vnfType);
+ machine = StateMachineFactory.getStateMachine(metadata);
+ stateMachineMap.put(vnfType,machine);
+ }
+
+ logger.trace("Exiting getStateMachine with (StateMachine = "+stateMachineMap.get(vnfType)!=null?stateMachineMap.get(vnfType).toString():"null"+")");
+ return stateMachineMap.get(vnfType);
+ }
+
+}
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
new file mode 100644
index 000000000..a7d0b83ea
--- /dev/null
+++ b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ openECOMP : APP-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=========================================================
+ -->
+
+<!--
+ Starter Blueprint Camel Definition appc-aai-adapter-blueprint
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+ <bean id="lifecycleManagerBean" class="org.openecomp.appc.lifecyclemanager.impl.LifecycleManagerImpl" scope="singleton" >
+</bean>
+
+ <service id="lcmService" interface="org.openecomp.appc.lifecyclemanager.LifecycleManager" ref="lifecycleManagerBean"/>
+
+</blueprint>
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/main/resources/org/openecomp/appc/default.properties b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/main/resources/org/openecomp/appc/default.properties
new file mode 100644
index 000000000..63711c27f
--- /dev/null
+++ b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/main/resources/org/openecomp/appc/default.properties
@@ -0,0 +1,48 @@
+###
+# ============LICENSE_START=======================================================
+# openECOMP : APP-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=========================================================
+###
+
+# Define the name and path of any user-provided configuration (bootstrap) file that can be loaded
+# to supply configuration options
+org.openecomp.appc.bootstrap.file=appc.properties
+org.openecomp.appc.bootstrap.path=/opt/openecomp/appc/data/properties,${user.home},.
+
+#Property below provided by appc.properties
+#dmaap.poolMembers=<DMAAP_IP>:3904
+
+dmaap.topic.read=APPC-TEST2
+dmaap.topic.write=APPC-TEST2
+#dmaap.topic.read.filter={"class":"Assigned","field":"request"}
+dmaap.topic.read.filter={"class": "And","filters": [{"class": "Assigned","field": "request"},{"class": "Unassigned","field": "response"}]}
+dmaap.client.name=APPC-TEST-CLIENT-LC-MGMT-MAIN
+dmaap.client.name.id=0
+#dmaap.client.key=random
+#dmaap.client.secret=random
+
+dmaap.threads.queuesize.min=1
+dmaap.threads.queuesize.max=1000
+dmaap.threads.poolsize.min=1
+dmaap.threads.poolsize.max=2
+
+#
+# This needs to be changed so that the action can be appended to the end of the URL path
+#
+#provider.urls.topology=https://admin:password@<IP_ADDRESS>:8443/restconf/operations/appc-provider:topology-service
+#provider.urls.topology=https://admin:password@<IP_ADDRESS>:8443/restconf/operations/appc-provider:
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/test/java/org/openecomp/appc/TestLifecycleManager.java b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/test/java/org/openecomp/appc/TestLifecycleManager.java
new file mode 100644
index 000000000..4c14e90bd
--- /dev/null
+++ b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/test/java/org/openecomp/appc/TestLifecycleManager.java
@@ -0,0 +1,155 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : APP-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=========================================================
+ */
+
+package org.openecomp.appc;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openecomp.appc.domainmodel.lcm.VNFOperation;
+import org.openecomp.appc.lifecyclemanager.LifecycleManager;
+import org.openecomp.appc.lifecyclemanager.helper.MetadataReader;
+import org.openecomp.appc.lifecyclemanager.impl.LifecycleManagerImpl;
+import org.openecomp.appc.lifecyclemanager.objects.LifecycleException;
+import org.openecomp.appc.lifecyclemanager.objects.NoTransitionDefinedException;
+import org.openecomp.appc.statemachine.objects.*;
+
+import java.util.*;
+
+
+public class TestLifecycleManager {
+
+ private static final State[] VALID_LOCK_STATES = new State[] {
+ new State("Instantiated"),
+ new State("Configured"),
+ new State("Tested"),
+ new State("Running"),
+ new State("Error"),
+ new State("Unknown"),
+ new State("Stopped"),
+ };
+
+ @Test
+ public void handleEvent() throws InvalidInputException, LifecycleException, NoTransitionDefinedException {
+
+ MetadataReader metadataReader = new MetadataReader();
+ StateMachineMetadata metadata = metadataReader.readMetadata(null);
+
+ LifecycleManagerImpl lifecycleManager = new LifecycleManagerImpl();
+
+ /*
+ Testing Positive Scenario passing the valid events and validating the StateMachineResponse
+ */
+ for(State state:metadata.getStates()){
+
+ for(Transition transition:state.getTransitions()){
+ Event event = transition.getEvent();
+ State nextStateFromMetadata = transition.getNextState();
+
+ String expectedNextState = lifecycleManager.getNextState(null,state.toString(),event.toString());
+ Assert.assertEquals(expectedNextState,nextStateFromMetadata.toString());
+ }
+ }
+
+ /*
+ Testing Negative Scenarios, 1. Passing the valid Events for which Transition is not defined in
+ Metadata and validating the StateMachineResponse 2. Passing the invalid events which are not
+ registered as events in the StateMachineMetadata and validating StateMachineResponse
+ */
+ for(State state:metadata.getStates()){
+
+ for(Transition transition:state.getTransitions()){
+ List<Event> negativeEvents = getNegativeEvents(state,metadata.getEvents());
+
+ for(Event negativeEvent:negativeEvents){
+ boolean flag =false;
+ try{
+ String response = lifecycleManager.getNextState(null,state.toString(),negativeEvent.toString());
+
+ }
+ catch (NoTransitionDefinedException e){
+ flag =true;
+ }
+ Assert.assertEquals(flag,true);
+
+ flag =false;
+ try{
+ String response = lifecycleManager.getNextState(null,state.toString(),"PUT");
+ }
+ catch(LifecycleException e){
+ flag = true;
+ }
+ Assert.assertTrue(flag);
+
+ }
+ }
+ }
+ }
+
+ private List<Event> getNegativeEvents(State state,Set<Event> events) {
+ List<Event> negativeEventList = new ArrayList<>();
+ negativeEventList.addAll(events);
+
+ for(Transition transition: state.getTransitions()){
+ negativeEventList.remove(transition.getEvent());
+ }
+ return negativeEventList;
+ }
+
+ @Test
+ public void testLockStates() throws LifecycleException, NoTransitionDefinedException {
+ MetadataReader metadataReader = new MetadataReader();
+ StateMachineMetadata metadata = metadataReader.readMetadata(null);
+ LifecycleManager lifecycleManager = new LifecycleManagerImpl();
+ for(State state: metadata.getStates()) {
+ if(isValidState(state, VALID_LOCK_STATES)) {
+ assertSameNextState(lifecycleManager, state, VNFOperation.Lock);
+ assertSameNextState(lifecycleManager, state, VNFOperation.Unlock);
+ assertSameNextState(lifecycleManager, state, VNFOperation.CheckLock);
+ } else {
+ assertNoNextState(lifecycleManager, state, VNFOperation.Lock);
+ assertNoNextState(lifecycleManager, state, VNFOperation.Unlock);
+ assertNoNextState(lifecycleManager, state, VNFOperation.CheckLock);
+ }
+ }
+ }
+
+ private boolean isValidState(State state, State[] validStates) {
+ for(State validState: validStates) {
+ if(validState.equals(state)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void assertSameNextState(LifecycleManager lifecycleManager, State state, VNFOperation operation) throws LifecycleException, NoTransitionDefinedException {
+ Assert.assertEquals(state.getStateName(), lifecycleManager.getNextState("no-matter", state.getStateName(), operation.toString()));
+ }
+
+ private void assertNoNextState(LifecycleManager lifecycleManager, State state, VNFOperation operation) throws LifecycleException {
+ try {
+ lifecycleManager.getNextState("no-matter", state.getStateName(), operation.toString());
+ Assert.fail("lifecycleManager.getNextState() should fail for state [" + state + "], operation [" + operation + "]");
+ } catch(NoTransitionDefinedException e) {
+ // this exception is excepted
+ }
+ }
+}
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-features/.gitignore b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-features/.gitignore
new file mode 100644
index 000000000..b83d22266
--- /dev/null
+++ b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-features/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-features/pom.xml b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-features/pom.xml
new file mode 100644
index 000000000..00886e75f
--- /dev/null
+++ b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-features/pom.xml
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>appc-lifecycle-management</artifactId>
+ <groupId>org.openecomp.appc</groupId>
+ <version>1.0.0</version>
+ </parent>
+ <name>appc-lifecycle-management-features</name>
+ <artifactId>appc-lifecycle-management-features</artifactId>
+
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-lifecycle-management-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-lifecycle-management-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <filtering>true</filtering>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>filter</id>
+ <goals>
+ <goal>resources</goal>
+ </goals>
+ <phase>generate-resources</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <!--<plugin>
+ &lt;!&ndash; launches the feature test, which validates that your karaf feature
+ can be installed inside of a karaf container. It doesn't validate that your
+ functionality works correctly, just that you have all of the dependent bundles
+ defined correctly. &ndash;&gt;
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.16</version>
+ <configuration>
+ <systemPropertyVariables>
+ <karaf.distro.groupId>org.opendaylight.controller</karaf.distro.groupId>
+ <karaf.distro.artifactId>opendaylight-karaf-empty</karaf.distro.artifactId>
+ <karaf.distro.version>${odl.karaf.empty.distro.version}</karaf.distro.version>
+ </systemPropertyVariables>
+ <dependenciesToScan>
+ <dependency>org.opendaylight.yangtools:features-test</dependency>
+ </dependenciesToScan>
+ <classpathDependencyExcludes>
+ &lt;!&ndash; The dependencies which bring in AbstractDataBrokerTest class
+ brings in a second PaxExam container which results in the feature tests failing
+ with a message similar to: "ERROR o.ops4j.pax.exam.spi.PaxExamRuntime - Ambiguous
+ TestContainer ..." This excludes the container we don't want to use. &ndash;&gt;
+ <classpathDependencyExcludes>org.ops4j.pax.exam:pax-exam-container-native</classpathDependencyExcludes>
+ </classpathDependencyExcludes>
+ </configuration>
+ </plugin>-->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-artifacts</id>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>${project.build.directory}/classes/${features.file}</file>
+ <type>xml</type>
+ <classifier>features</classifier>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- Skipping ODL feature test -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skipTests>true</skipTests>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-features/src/main/resources/features.xml b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-features/src/main/resources/features.xml
new file mode 100644
index 000000000..b74afa93f
--- /dev/null
+++ b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-features/src/main/resources/features.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ openECOMP : APP-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=========================================================
+ -->
+
+
+<features name="appc-lifecycle-management-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
+
+ <feature name='appc-lifecycle-management' description="application executor" version='${project.version}'>
+ <bundle dependency="true">mvn:org.openecomp.appc/domain-model-lib/${project.version}</bundle>
+ <bundle>mvn:org.openecomp.appc/state-machine-lib/${project.version}</bundle>
+ <bundle>mvn:org.openecomp.appc/appc-lifecycle-management-api/${project.version}</bundle>
+ <bundle>mvn:org.openecomp.appc/appc-lifecycle-management-core/${project.version}</bundle>
+ </feature>
+
+</features>
diff --git a/appc-dispatcher/appc-lifecycle-management/pom.xml b/appc-dispatcher/appc-lifecycle-management/pom.xml
new file mode 100644
index 000000000..7d75c0fd4
--- /dev/null
+++ b/appc-dispatcher/appc-lifecycle-management/pom.xml
@@ -0,0 +1,22 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-dispatcher</artifactId>
+ <version>1.0.0</version>
+ </parent>
+ <artifactId>appc-lifecycle-management</artifactId>
+ <packaging>pom</packaging>
+ <name>APPC Lifecycle Management</name>
+ <description>APPC Lifecycle Management</description>
+
+ <!-- ================================================================================== -->
+ <!-- The modules we build -->
+ <!-- ================================================================================== -->
+ <modules>
+ <module>appc-lifecycle-management-api</module>
+ <module>appc-lifecycle-management-core</module>
+ <module>appc-lifecycle-management-features</module>
+ </modules>
+
+</project> \ No newline at end of file