diff options
author | Patrick Brady <pb071s@att.com> | 2017-07-28 11:29:23 -0700 |
---|---|---|
committer | Patrick Brady <pb071s@att.com> | 2017-08-02 15:43:44 +0000 |
commit | 38713207b817ed4700f630748c681116338d32f0 (patch) | |
tree | 9eb2097cee8d85ac14f17e3a280ae8aefb69d9de /appc-dispatcher/appc-lifecycle-management | |
parent | 771ac55e29d099d8bbf783612de975047d75ab12 (diff) |
Merging in bug fixes
Change-Id: I85da90b9ba0d03149f42035a820c76ef0285e413
Signed-off-by: Patrick Brady <pb071s@att.com>
Issue: APPC-100
Diffstat (limited to 'appc-dispatcher/appc-lifecycle-management')
4 files changed, 68 insertions, 20 deletions
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 index 859e4a514..00bb686d4 100644 --- a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/pom.xml +++ b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/pom.xml @@ -45,7 +45,6 @@ <dependency> <groupId>com.att.eelf</groupId> <artifactId>eelf-core</artifactId> - <version>${eelf.version}</version> </dependency> <dependency> <groupId>org.openecomp.appc</groupId> 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 index 3ac4b60e5..cad3db7e8 100644 --- 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 @@ -36,7 +36,7 @@ public class MetadataReader { private enum VNFStates { Not_Instantiated, Instantiated, Configuring, Configured, Testing, Tested, Rebuilding, Restarting, Starting, Error, Running, Unknown, Terminating, Stopping, Stopped, - Backing_Up, Snapshotting, Software_Uploading, Upgrading, Rollbacking, Licensing, Migrating, Evacuating , NOT_ORCHESTRATED("NOT ORCHESTRATED"); + Backing_Up, Snapshotting, Software_Uploading, Upgrading, Rollbacking, Licensing, Migrating, Evacuating , NOT_ORCHESTRATED("NOT ORCHESTRATED"),Created; String stateName; @@ -49,7 +49,7 @@ public class MetadataReader { } public String toString(){ - return this.stateName; + return this.stateName.toLowerCase(); } } @@ -80,6 +80,7 @@ public class MetadataReader { State MIGRATING = new State(VNFStates.Migrating.toString()); State EVACUATING = new State(VNFStates.Evacuating.toString()); + State CREATED= new State(VNFStates.Created.toString()); Event CONFIGURE = new Event(VNFOperation.Configure.toString()); Event HEALTHCHECK = new Event(VNFOperation.HealthCheck.toString()); @@ -138,6 +139,7 @@ public class MetadataReader { builder = builder.addState(MIGRATING); builder = builder.addState(EVACUATING); builder = builder.addState(NOT_ORCHESTRATED); + builder = builder.addState(CREATED); builder = builder.addEvent(CONFIGURE); builder = builder.addEvent(TEST); @@ -169,6 +171,27 @@ public class MetadataReader { builder = builder.addEvent(CONFIG_EXPORT); builder = builder.addTransition(NOT_ORCHESTRATED,CONFIGURE,CONFIGURING); + builder = builder.addTransition(NOT_ORCHESTRATED,TEST,TESTING); + builder = builder.addTransition(NOT_ORCHESTRATED,START,STARTING); + builder = builder.addTransition(NOT_ORCHESTRATED,TERMINATE,TERMINATING); + builder = builder.addTransition(NOT_ORCHESTRATED,RESTART,RESTARTING); + builder = builder.addTransition(NOT_ORCHESTRATED,REBUILD,REBUILDING); + builder = builder.addTransition(NOT_ORCHESTRATED,STOP,STOPPING); + builder = builder.addTransition(NOT_ORCHESTRATED,CONFIG_MODIFY,CONFIGURING); + builder = builder.addTransition(NOT_ORCHESTRATED,CONFIG_SCALEOUT,CONFIGURING); + builder = builder.addTransition(NOT_ORCHESTRATED,CONFIG_RESTORE,CONFIGURING); + builder = builder.addTransition(NOT_ORCHESTRATED,HEALTHCHECK,TESTING); + builder = builder.addTransition(NOT_ORCHESTRATED,BACKUP,BACKING_UP); + builder = builder.addTransition(NOT_ORCHESTRATED,SNAPSHOT,SNAPSHOTTING); + builder = builder.addTransition(NOT_ORCHESTRATED,SOFTWARE_UPLOAD,SOFTWARE_UPLOADING); + builder = builder.addTransition(NOT_ORCHESTRATED,LIVE_UPGRADE,UPGRADING); + builder = builder.addTransition(NOT_ORCHESTRATED,ROLLBACK,ROLLBACKING); + builder = builder.addTransition(NOT_ORCHESTRATED,MIGRATE,MIGRATING); + builder = builder.addTransition(NOT_ORCHESTRATED,EVACUATE,EVACUATING); + builder = builder.addTransition(NOT_ORCHESTRATED,LOCK,NOT_ORCHESTRATED); + builder = builder.addTransition(NOT_ORCHESTRATED,UNLOCK,NOT_ORCHESTRATED); + builder = builder.addTransition(NOT_ORCHESTRATED,CHECKLOCK,NOT_ORCHESTRATED); + builder = builder.addTransition(NOT_ORCHESTRATED,CONFIG_BACKUP,NOT_ORCHESTRATED); builder = builder.addTransition(INSTANTIATED,CONFIGURE,CONFIGURING); builder = builder.addTransition(INSTANTIATED,TEST,TESTING); @@ -219,6 +242,29 @@ public class MetadataReader { builder = builder.addTransition(CONFIGURED,CONFIG_BACKUP_DELETE,CONFIGURED); builder = builder.addTransition(CONFIGURED,CONFIG_EXPORT,CONFIGURED); + builder = builder.addTransition(CREATED,CONFIGURE,CONFIGURING); + builder = builder.addTransition(CREATED,TEST,TESTING); + builder = builder.addTransition(CREATED,START,STARTING); + builder = builder.addTransition(CREATED,TERMINATE,TERMINATING); + builder = builder.addTransition(CREATED,RESTART,RESTARTING); + builder = builder.addTransition(CREATED,REBUILD,REBUILDING); + builder = builder.addTransition(CREATED,STOP,STOPPING); + builder = builder.addTransition(CREATED,CONFIG_MODIFY,CONFIGURING); + builder = builder.addTransition(CREATED,CONFIG_SCALEOUT,CONFIGURING); + builder = builder.addTransition(CREATED,CONFIG_RESTORE,CONFIGURING); + builder = builder.addTransition(CREATED,HEALTHCHECK,TESTING); + builder = builder.addTransition(CREATED,BACKUP,BACKING_UP); + builder = builder.addTransition(CREATED,SNAPSHOT,SNAPSHOTTING); + builder = builder.addTransition(CREATED,SOFTWARE_UPLOAD,SOFTWARE_UPLOADING); + builder = builder.addTransition(CREATED,LIVE_UPGRADE,UPGRADING); + builder = builder.addTransition(CREATED,ROLLBACK,ROLLBACKING); + builder = builder.addTransition(CREATED,MIGRATE,MIGRATING); + builder = builder.addTransition(CREATED,EVACUATE,EVACUATING); + builder = builder.addTransition(CREATED,LOCK,CREATED); + builder = builder.addTransition(CREATED,UNLOCK,CREATED); + builder = builder.addTransition(CREATED,CHECKLOCK,CREATED); + builder = builder.addTransition(CREATED,CONFIG_BACKUP,CREATED); + builder = builder.addTransition(TESTED,CONFIGURE,CONFIGURING); builder = builder.addTransition(TESTED,TEST,TESTING); builder = builder.addTransition(TESTED,START,STARTING); 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 index a9690f912..8741b1b25 100644 --- 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 @@ -24,19 +24,20 @@ package org.openecomp.appc.lifecyclemanager.impl; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.att.eelf.i18n.EELFResourceManager; 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.lifecyclemanager.objects.LifecycleException; +import org.openecomp.appc.lifecyclemanager.objects.NoTransitionDefinedException; +import org.openecomp.appc.statemachine.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; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class LifecycleManagerImpl implements LifecycleManager{ @@ -60,7 +61,7 @@ public class LifecycleManagerImpl implements LifecycleManager{ StateMachineResponse response; try { machine = this.getStateMachine(vnfType); - response = machine.handleEvent(new State(currentState),new Event(event)); + response = machine.handleEvent(new State(currentState.toLowerCase()),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); 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 index 41de2d8df..7ba78c732 100644 --- 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 @@ -40,13 +40,15 @@ 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"), + new State("instantiated"), + new State("configured"), + new State("tested"), + new State("running"), + new State("error"), + new State("unknown"), + new State("created"), + new State("not orchestrated"), + new State("stopped"), }; @Test @@ -110,7 +112,7 @@ public class TestLifecycleManager { public void testNotOrchestratedState() throws LifecycleException, NoTransitionDefinedException { LifecycleManager lifecycleManager = new LifecycleManagerImpl(); String nextState = lifecycleManager.getNextState(null,"NOT ORCHESTRATED",VNFOperation.Configure.toString()); - Assert.assertEquals(nextState,"Configuring"); + Assert.assertEquals(nextState,"configuring"); } @Test(expected = NoTransitionDefinedException.class) |