aboutsummaryrefslogtreecommitdiffstats
path: root/appc-lifecycle-management/state-machine-lib/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'appc-lifecycle-management/state-machine-lib/src/main/java')
-rw-r--r--appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/StateMachineFactory.java6
-rw-r--r--appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/StateMachineImpl.java25
-rw-r--r--appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/readers/AppcOamMetaDataReader.java96
-rw-r--r--appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/readers/VnfMetaDataReader.java826
-rw-r--r--appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Event.java32
-rw-r--r--appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Response.java9
-rw-r--r--appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/State.java40
-rw-r--r--appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Transition.java15
8 files changed, 544 insertions, 505 deletions
diff --git a/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/StateMachineFactory.java b/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/StateMachineFactory.java
index c4b49b7a1..3e38231b1 100644
--- a/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/StateMachineFactory.java
+++ b/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/StateMachineFactory.java
@@ -27,11 +27,13 @@ package org.openecomp.appc.statemachine.impl;
import org.openecomp.appc.statemachine.StateMachine;
import org.openecomp.appc.statemachine.objects.StateMachineMetadata;
-
+/**
+ * Factory of StateMachine
+ */
public class StateMachineFactory {
private StateMachineFactory(){
-
+ throw new IllegalAccessError("StateMachineFactory");
}
public static StateMachine getStateMachine(StateMachineMetadata metadata){
diff --git a/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/StateMachineImpl.java b/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/StateMachineImpl.java
index 9fc1233cd..f0cb4919b 100644
--- a/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/StateMachineImpl.java
+++ b/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/StateMachineImpl.java
@@ -36,11 +36,14 @@ import org.openecomp.appc.statemachine.objects.StateMachineMetadata;
import org.openecomp.appc.statemachine.objects.StateMachineResponse;
import org.openecomp.appc.statemachine.objects.Transition;
-
+/**
+ * Implementation of StateMachine
+ */
public class StateMachineImpl implements StateMachine {
+ private final String invalidInputFormat = "VNF State or incoming event is invalid. State = %s event = %s";
+ final String toStringFormat = "StateMachineImpl{states=%s, events=%s}";
private final Set<State> states;
-
private final Set<Event> events;
StateMachineImpl(StateMachineMetadata metadata){
@@ -50,14 +53,16 @@ public class StateMachineImpl implements StateMachine {
this.events.addAll(metadata.getEvents());
}
+ @Override
public StateMachineResponse handleEvent(State inputState, Event event) throws InvalidInputException{
if(!validateInputs(inputState,event)){
- throw new InvalidInputException("VNF State or incoming event is invalid. State = " +inputState + " event = " + event );
+ throw new InvalidInputException(String.format(invalidInputFormat, inputState, event));
}
StateMachineResponse response = new StateMachineResponse();
- State currentState = null,nextState = null;
+ State currentState = null;
+ State nextState = null;
for(State stateInSet:states){
if(stateInSet.equals(inputState)){
currentState = stateInSet;
@@ -84,15 +89,15 @@ public class StateMachineImpl implements StateMachine {
return response;
}
- private boolean validateInputs(State state,Event event) {
- return state != null && event != null && this.states.contains(state) && this.events.contains(event);
+ boolean validateInputs(State state,Event event) {
+ return state != null
+ && event != null
+ && this.states.contains(state)
+ && this.events.contains(event);
}
@Override
public String toString() {
- return "StateMachineImpl{" +
- "states=" + states +
- ", events=" + events +
- '}';
+ return String.format(toStringFormat, states, events);
}
}
diff --git a/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/readers/AppcOamMetaDataReader.java b/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/readers/AppcOamMetaDataReader.java
index 3c1f0945d..637136bed 100644
--- a/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/readers/AppcOamMetaDataReader.java
+++ b/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/readers/AppcOamMetaDataReader.java
@@ -29,8 +29,14 @@ import org.openecomp.appc.statemachine.objects.Event;
import org.openecomp.appc.statemachine.objects.State;
import org.openecomp.appc.statemachine.objects.StateMachineMetadata;
+/**
+ * Reader for APPC OAM MetaData
+ */
public class AppcOamMetaDataReader implements StateMetaDataReader {
+ /**
+ * APPC Operation Enum
+ */
public enum AppcOperation {
MaintenanceMode,
Restart,
@@ -40,67 +46,67 @@ public class AppcOamMetaDataReader implements StateMetaDataReader {
@Override
public StateMachineMetadata readMetadata() {
- State NOT_INSTANTIATED = new State(AppcOamStates.NotInstantiated.toString());
- State INSTANTIATED = new State(AppcOamStates.Instantiated.toString());
- State RESTARTING = new State(AppcOamStates.Restarting.toString());
- State STARTING = new State(AppcOamStates.Starting.toString());
- State STARTED = new State(AppcOamStates.Started.toString());
- State ENTERING_MAINTENANCE_MODE = new State(AppcOamStates.EnteringMaintenanceMode.toString());
- State MAINTENANCE_MODE = new State(AppcOamStates.MaintenanceMode.toString());
- State ERROR = new State(AppcOamStates.Error.toString());
- State UNKNOWN = new State(AppcOamStates.Unknown.toString());
- State STOPPING = new State(AppcOamStates.Stopping.toString());
- State STOPPED = new State(AppcOamStates.Stopped.toString());
+ State notInstantiated = new State(AppcOamStates.NotInstantiated.toString());
+ State instantiated = new State(AppcOamStates.Instantiated.toString());
+ State restarting = new State(AppcOamStates.Restarting.toString());
+ State starting = new State(AppcOamStates.Starting.toString());
+ State started = new State(AppcOamStates.Started.toString());
+ State enteringMaintenanceMode = new State(AppcOamStates.EnteringMaintenanceMode.toString());
+ State maintenanceMode = new State(AppcOamStates.MaintenanceMode.toString());
+ State error = new State(AppcOamStates.Error.toString());
+ State unknown = new State(AppcOamStates.Unknown.toString());
+ State stopping = new State(AppcOamStates.Stopping.toString());
+ State stopped = new State(AppcOamStates.Stopped.toString());
- Event START = new Event(AppcOperation.Start.toString());
- Event STOP = new Event(AppcOperation.Stop.toString());
- Event MAINTENANCE_MODE_EVENT = new Event(AppcOperation.MaintenanceMode.toString());
- Event RESTART = new Event(AppcOperation.Restart.toString());
+ Event start = new Event(AppcOperation.Start.toString());
+ Event stop = new Event(AppcOperation.Stop.toString());
+ Event maintenanceModeEvent = new Event(AppcOperation.MaintenanceMode.toString());
+ Event restart = new Event(AppcOperation.Restart.toString());
StateMachineMetadata.StateMachineMetadataBuilder builder = new StateMachineMetadata
.StateMachineMetadataBuilder();
- builder = builder.addState(NOT_INSTANTIATED);
- builder = builder.addState(INSTANTIATED);
- builder = builder.addState(STARTING);
- builder = builder.addState(STARTED);
- builder = builder.addState(ERROR);
- builder = builder.addState(UNKNOWN);
- builder = builder.addState(STOPPING);
- builder = builder.addState(STOPPED);
- builder = builder.addState(ENTERING_MAINTENANCE_MODE);
- builder = builder.addState(MAINTENANCE_MODE);
- builder = builder.addState(RESTARTING);
+ builder = builder.addState(notInstantiated);
+ builder = builder.addState(instantiated);
+ builder = builder.addState(starting);
+ builder = builder.addState(started);
+ builder = builder.addState(error);
+ builder = builder.addState(unknown);
+ builder = builder.addState(stopping);
+ builder = builder.addState(stopped);
+ builder = builder.addState(enteringMaintenanceMode);
+ builder = builder.addState(maintenanceMode);
+ builder = builder.addState(restarting);
- builder = builder.addEvent(START);
- builder = builder.addEvent(STOP);
- builder = builder.addEvent(RESTART);
- builder = builder.addEvent(MAINTENANCE_MODE_EVENT);
+ builder = builder.addEvent(start);
+ builder = builder.addEvent(stop);
+ builder = builder.addEvent(restart);
+ builder = builder.addEvent(maintenanceModeEvent);
/*
* for addTransition:
* param 1: current state; param 2: received command/request; param 3: new transition state
*/
// start
- builder = builder.addTransition(STOPPED, START, STARTING);
- builder = builder.addTransition(MAINTENANCE_MODE, START, STARTING);
- builder = builder.addTransition(ERROR, START, STARTING);
+ builder = builder.addTransition(stopped, start, starting);
+ builder = builder.addTransition(maintenanceMode, start, starting);
+ builder = builder.addTransition(error, start, starting);
// stop
- builder = builder.addTransition(STARTED, STOP, STOPPING);
- builder = builder.addTransition(STARTING, STOP, STOPPING);
- builder = builder.addTransition(ENTERING_MAINTENANCE_MODE, STOP, STOPPING);
- builder = builder.addTransition(MAINTENANCE_MODE, STOP, STOPPING);
- builder = builder.addTransition(ERROR, STOP, STOPPING);
+ builder = builder.addTransition(started, stop, stopping);
+ builder = builder.addTransition(starting, stop, stopping);
+ builder = builder.addTransition(enteringMaintenanceMode, stop, stopping);
+ builder = builder.addTransition(maintenanceMode, stop, stopping);
+ builder = builder.addTransition(error, stop, stopping);
// maintenance mode
builder = builder.addTransition(
- STARTED, MAINTENANCE_MODE_EVENT, ENTERING_MAINTENANCE_MODE);
+ started, maintenanceModeEvent, enteringMaintenanceMode);
// restart
- builder = builder.addTransition(STOPPED, RESTART, RESTARTING);
- builder = builder.addTransition(STARTING, RESTART, RESTARTING);
- builder = builder.addTransition(STARTED, RESTART, RESTARTING);
- builder = builder.addTransition(ENTERING_MAINTENANCE_MODE, RESTART, RESTARTING);
- builder = builder.addTransition(MAINTENANCE_MODE, RESTART, RESTARTING);
- builder = builder.addTransition(ERROR, RESTART, RESTARTING);
+ builder = builder.addTransition(stopped, restart, restarting);
+ builder = builder.addTransition(starting, restart, restarting);
+ builder = builder.addTransition(started, restart, restarting);
+ builder = builder.addTransition(enteringMaintenanceMode, restart, restarting);
+ builder = builder.addTransition(maintenanceMode, restart, restarting);
+ builder = builder.addTransition(error, restart, restarting);
return builder.build();
}
diff --git a/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/readers/VnfMetaDataReader.java b/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/readers/VnfMetaDataReader.java
index 8f2a69f84..cd573918b 100644
--- a/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/readers/VnfMetaDataReader.java
+++ b/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/readers/VnfMetaDataReader.java
@@ -30,8 +30,14 @@ import org.openecomp.appc.statemachine.objects.Event;
import org.openecomp.appc.statemachine.objects.State;
import org.openecomp.appc.statemachine.objects.StateMachineMetadata;
+/**
+ * Reader for VNF MetaData
+ */
public class VnfMetaDataReader implements StateMetaDataReader {
+ /**
+ * VNF Operations
+ */
public enum VNFOperation {
Configure, Test, HealthCheck, Start, Terminate, Restart, Rebuild, Stop, ConfigModify,
@@ -51,10 +57,15 @@ public class VnfMetaDataReader implements StateMetaDataReader {
}
}
- private enum VNFStates {
- Not_Instantiated, Instantiated, Configuring, Configured, Testing, Tested, Rebuilding, Restarting, Starting,
+ /**
+ * VNF States
+ */
+ 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,
+ Backing_Up, Snapshotting, Software_Uploading, Upgrading,
+ Rollbacking, Licensing, Migrating, Evacuating,
NOT_ORCHESTRATED("NOT ORCHESTRATED"), Created;
String stateName;
@@ -73,411 +84,410 @@ public class VnfMetaDataReader implements StateMetaDataReader {
}
}
+ @Override
public StateMachineMetadata readMetadata() {
- {
- 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 STARTING = new State(VNFStates.Starting.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 NOT_ORCHESTRATED = new State(VNFStates.NOT_ORCHESTRATED.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());
- State CREATED= new State(VNFStates.Created.toString());
-
- Event START_APPLICATION = new Event(VNFOperation.StartApplication.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 CONFIG_MODIFY = new Event(VNFOperation.ConfigModify.toString());
- Event CONFIG_SCALEOUT = new Event(VNFOperation.ConfigScaleOut.toString());
- Event CONFIG_RESTORE = new Event(VNFOperation.ConfigRestore.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 CONFIG_BACKUP = new Event(VNFOperation.ConfigBackup.toString());
- Event CONFIG_BACKUP_DELETE = new Event(VNFOperation.ConfigBackupDelete.toString());
- Event CONFIG_EXPORT = new Event(VNFOperation.ConfigExport.toString());
- Event STOP_APPLICATION= new Event(VNFOperation.StopApplication.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(STARTING);
- 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(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.addState(NOT_ORCHESTRATED);
- builder = builder.addState(CREATED);
- builder = builder.addEvent(START_APPLICATION);
- 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(CONFIG_MODIFY);
- builder = builder.addEvent(CONFIG_SCALEOUT);
- builder = builder.addEvent(CONFIG_RESTORE);
- 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.addEvent(CONFIG_BACKUP);
- builder = builder.addEvent(CONFIG_BACKUP_DELETE);
- builder = builder.addEvent(CONFIG_EXPORT);
- builder = builder.addEvent(STOP_APPLICATION);
-
- 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,START_APPLICATION,STARTING);
- builder = builder.addTransition(NOT_ORCHESTRATED,STOP_APPLICATION,STOPPING);
- builder = builder.addTransition(NOT_ORCHESTRATED,CONFIG_BACKUP,NOT_ORCHESTRATED);
-
- 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,START_APPLICATION,STARTING);
- builder = builder.addTransition(CREATED,STOP_APPLICATION,STOPPING);
- builder = builder.addTransition(CREATED,CONFIG_BACKUP,CREATED);
-
- builder = builder.addTransition(INSTANTIATED,CONFIGURE,CONFIGURING);
- builder = builder.addTransition(INSTANTIATED,TEST,TESTING);
- builder = builder.addTransition(INSTANTIATED,START,STARTING);
- 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,CONFIG_MODIFY,CONFIGURING);
- builder = builder.addTransition(INSTANTIATED,CONFIG_SCALEOUT,CONFIGURING);
- builder = builder.addTransition(INSTANTIATED,CONFIG_RESTORE,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,STARTING);
- 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,CONFIG_MODIFY,CONFIGURING);
- builder = builder.addTransition(CONFIGURED,CONFIG_SCALEOUT,CONFIGURING);
- builder = builder.addTransition(CONFIGURED,CONFIG_RESTORE,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(CONFIGURED,CONFIG_BACKUP,CONFIGURED);
- builder = builder.addTransition(CONFIGURED,CONFIG_BACKUP_DELETE,CONFIGURED);
- builder = builder.addTransition(CONFIGURED,CONFIG_EXPORT,CONFIGURED);
- builder = builder.addTransition(CONFIGURED,STOP_APPLICATION,STOPPING);
-
- builder = builder.addTransition(TESTED,CONFIGURE,CONFIGURING);
- builder = builder.addTransition(TESTED,TEST,TESTING);
- builder = builder.addTransition(TESTED,START,STARTING);
- 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,CONFIG_MODIFY,CONFIGURING);
- builder = builder.addTransition(TESTED,CONFIG_SCALEOUT,CONFIGURING);
- builder = builder.addTransition(TESTED,CONFIG_RESTORE,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(TESTED,CONFIG_BACKUP,TESTED);
- builder = builder.addTransition(TESTED,CONFIG_BACKUP_DELETE,TESTED);
- builder = builder.addTransition(TESTED,CONFIG_EXPORT,TESTED);
- builder = builder.addTransition(TESTED,STOP_APPLICATION,STOPPING);
-
- builder = builder.addTransition(RUNNING,CONFIGURE,CONFIGURING);
- builder = builder.addTransition(RUNNING,TEST,TESTING);
- builder = builder.addTransition(RUNNING,START,STARTING);
- 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,CONFIG_MODIFY,CONFIGURING);
- builder = builder.addTransition(RUNNING,CONFIG_SCALEOUT,CONFIGURING);
- builder = builder.addTransition(RUNNING,CONFIG_RESTORE,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(RUNNING,CONFIG_BACKUP,RUNNING);
- builder = builder.addTransition(RUNNING,CONFIG_BACKUP_DELETE,RUNNING);
- builder = builder.addTransition(RUNNING,CONFIG_EXPORT,RUNNING);
- builder = builder.addTransition(RUNNING,STOP_APPLICATION,STOPPING);
-
- builder = builder.addTransition(ERROR,CONFIGURE,CONFIGURING);
- builder = builder.addTransition(ERROR,TEST,TESTING);
- builder = builder.addTransition(ERROR,START,STARTING);
- 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,CONFIG_MODIFY,CONFIGURING);
- builder = builder.addTransition(ERROR,CONFIG_SCALEOUT,CONFIGURING);
- builder = builder.addTransition(ERROR,CONFIG_RESTORE,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(ERROR,CONFIG_BACKUP,ERROR);
- builder = builder.addTransition(ERROR,CONFIG_BACKUP_DELETE,ERROR);
- builder = builder.addTransition(ERROR,CONFIG_EXPORT,ERROR);
- builder = builder.addTransition(ERROR,STOP_APPLICATION,STOPPING);
-
- builder = builder.addTransition(UNKNOWN,CONFIGURE,CONFIGURING);
- builder = builder.addTransition(UNKNOWN,TEST,TESTING);
- builder = builder.addTransition(UNKNOWN,START,STARTING);
- 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,CONFIG_MODIFY,CONFIGURING);
- builder = builder.addTransition(UNKNOWN,CONFIG_SCALEOUT,CONFIGURING);
- builder = builder.addTransition(UNKNOWN,CONFIG_RESTORE,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(UNKNOWN,CONFIG_BACKUP,UNKNOWN);
- builder = builder.addTransition(UNKNOWN,CONFIG_BACKUP_DELETE,UNKNOWN);
- builder = builder.addTransition(UNKNOWN,CONFIG_EXPORT,UNKNOWN);
- builder = builder.addTransition(UNKNOWN,STOP_APPLICATION,STOPPING);
-
- builder = builder.addTransition(STOPPED,CONFIGURE,CONFIGURING);
- builder = builder.addTransition(STOPPED,TEST,TESTING);
- builder = builder.addTransition(STOPPED,START,STARTING);
- builder = builder.addTransition(STOPPED,TERMINATE,TERMINATING);
- builder = builder.addTransition(STOPPED,RESTART,RESTARTING);
- builder = builder.addTransition(STOPPED,REBUILD,REBUILDING);
- builder = builder.addTransition(STOPPED,CONFIG_MODIFY,CONFIGURING);
- builder = builder.addTransition(STOPPED,CONFIG_SCALEOUT,CONFIGURING);
- builder = builder.addTransition(STOPPED,CONFIG_RESTORE,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(STARTING,SUCCESS,RUNNING);
- builder = builder.addTransition(STARTING,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(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);
-
-
- builder = builder.addTransition(CONFIGURED,START_APPLICATION,STARTING);
- builder = builder.addTransition(TESTED,START_APPLICATION,STARTING);
- builder = builder.addTransition(ERROR,START_APPLICATION,STARTING);
- builder = builder.addTransition(UNKNOWN,START_APPLICATION,STARTING);
- builder = builder.addTransition(RUNNING,START_APPLICATION,STARTING);
-
- return builder.build();
-
- }
+ State notInstantiated = 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 starting = new State(VNFStates.Starting.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 notOrchestrated = new State(VNFStates.NOT_ORCHESTRATED.toString());
+
+ State backingUp = new State(VNFStates.Backing_Up.toString());
+ State snapshotting = new State(VNFStates.Snapshotting.toString());
+ State softwareUploading = 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());
+ State created= new State(VNFStates.Created.toString());
+
+ Event startApplication = new Event(VNFOperation.StartApplication.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 configModify = new Event(VNFOperation.ConfigModify.toString());
+ Event configScaleout = new Event(VNFOperation.ConfigScaleOut.toString());
+ Event configRestore = new Event(VNFOperation.ConfigRestore.toString());
+ Event backup = new Event(VNFOperation.Backup.toString());
+ Event snapshot = new Event(VNFOperation.Snapshot.toString());
+ Event softwareUpload = new Event(VNFOperation.SoftwareUpload.toString());
+ Event liveUpgrade = 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 configBackup = new Event(VNFOperation.ConfigBackup.toString());
+ Event configBackupDelete = new Event(VNFOperation.ConfigBackupDelete.toString());
+ Event configExport = new Event(VNFOperation.ConfigExport.toString());
+ Event stopApplication= new Event(VNFOperation.StopApplication.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(notInstantiated);
+ 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(starting);
+ 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(backingUp);
+ builder = builder.addState(snapshotting);
+ builder = builder.addState(softwareUploading);
+ builder = builder.addState(upgrading);
+ builder = builder.addState(rollbacking);
+ builder = builder.addState(migrating);
+ builder = builder.addState(evacuating);
+ builder = builder.addState(notOrchestrated);
+ builder = builder.addState(created);
+ builder = builder.addEvent(startApplication);
+ 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(configModify);
+ builder = builder.addEvent(configScaleout);
+ builder = builder.addEvent(configRestore);
+ builder = builder.addEvent(healthcheck);
+ builder = builder.addEvent(backup);
+ builder = builder.addEvent(snapshot);
+ builder = builder.addEvent(softwareUpload);
+ builder = builder.addEvent(liveUpgrade);
+ 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.addEvent(configBackup);
+ builder = builder.addEvent(configBackupDelete);
+ builder = builder.addEvent(configExport);
+ builder = builder.addEvent(stopApplication);
+
+ builder = builder.addTransition(notOrchestrated,configure,configuring);
+ builder = builder.addTransition(notOrchestrated,test,testing);
+ builder = builder.addTransition(notOrchestrated,start,starting);
+ builder = builder.addTransition(notOrchestrated,terminate,terminating);
+ builder = builder.addTransition(notOrchestrated,restart,restarting);
+ builder = builder.addTransition(notOrchestrated,rebuild,rebuilding);
+ builder = builder.addTransition(notOrchestrated,stop,stopping);
+ builder = builder.addTransition(notOrchestrated,configModify,configuring);
+ builder = builder.addTransition(notOrchestrated,configScaleout,configuring);
+ builder = builder.addTransition(notOrchestrated,configRestore,configuring);
+ builder = builder.addTransition(notOrchestrated,healthcheck,testing);
+ builder = builder.addTransition(notOrchestrated,backup,backingUp);
+ builder = builder.addTransition(notOrchestrated,snapshot,snapshotting);
+ builder = builder.addTransition(notOrchestrated,softwareUpload,softwareUploading);
+ builder = builder.addTransition(notOrchestrated,liveUpgrade,upgrading);
+ builder = builder.addTransition(notOrchestrated,rollback,rollbacking);
+ builder = builder.addTransition(notOrchestrated,migrate,migrating);
+ builder = builder.addTransition(notOrchestrated,evacuate,evacuating);
+ builder = builder.addTransition(notOrchestrated,lock,notOrchestrated);
+ builder = builder.addTransition(notOrchestrated,unlock,notOrchestrated);
+ builder = builder.addTransition(notOrchestrated,checklock,notOrchestrated);
+ builder = builder.addTransition(notOrchestrated,startApplication,starting);
+ builder = builder.addTransition(notOrchestrated,stopApplication,stopping);
+ builder = builder.addTransition(notOrchestrated,configBackup,notOrchestrated);
+
+ 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,configModify,configuring);
+ builder = builder.addTransition(created,configScaleout,configuring);
+ builder = builder.addTransition(created,configRestore,configuring);
+ builder = builder.addTransition(created,healthcheck,testing);
+ builder = builder.addTransition(created,backup,backingUp);
+ builder = builder.addTransition(created,snapshot,snapshotting);
+ builder = builder.addTransition(created,softwareUpload,softwareUploading);
+ builder = builder.addTransition(created,liveUpgrade,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,startApplication,starting);
+ builder = builder.addTransition(created,stopApplication,stopping);
+ builder = builder.addTransition(created,configBackup,created);
+
+ builder = builder.addTransition(instantiated,configure,configuring);
+ builder = builder.addTransition(instantiated,test,testing);
+ builder = builder.addTransition(instantiated,start,starting);
+ 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,configModify,configuring);
+ builder = builder.addTransition(instantiated,configScaleout,configuring);
+ builder = builder.addTransition(instantiated,configRestore,configuring);
+ builder = builder.addTransition(instantiated,healthcheck,testing);
+ builder = builder.addTransition(instantiated,backup,backingUp);
+ builder = builder.addTransition(instantiated,snapshot,snapshotting);
+ builder = builder.addTransition(instantiated,softwareUpload,softwareUploading);
+ builder = builder.addTransition(instantiated,liveUpgrade,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,starting);
+ 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,configModify,configuring);
+ builder = builder.addTransition(configured,configScaleout,configuring);
+ builder = builder.addTransition(configured,configRestore,configuring);
+ builder = builder.addTransition(configured,healthcheck,testing);
+ builder = builder.addTransition(configured,backup,backingUp);
+ builder = builder.addTransition(configured,snapshot,snapshotting);
+ builder = builder.addTransition(configured,softwareUpload,softwareUploading);
+ builder = builder.addTransition(configured,liveUpgrade,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(configured,configBackup,configured);
+ builder = builder.addTransition(configured,configBackupDelete,configured);
+ builder = builder.addTransition(configured,configExport,configured);
+ builder = builder.addTransition(configured,stopApplication,stopping);
+
+ builder = builder.addTransition(tested,configure,configuring);
+ builder = builder.addTransition(tested,test,testing);
+ builder = builder.addTransition(tested,start,starting);
+ 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,configModify,configuring);
+ builder = builder.addTransition(tested,configScaleout,configuring);
+ builder = builder.addTransition(tested,configRestore,configuring);
+ builder = builder.addTransition(tested,healthcheck,testing);
+ builder = builder.addTransition(tested,backup,backingUp);
+ builder = builder.addTransition(tested,snapshot,snapshotting);
+ builder = builder.addTransition(tested,softwareUpload,softwareUploading);
+ builder = builder.addTransition(tested,liveUpgrade,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(tested,configBackup,tested);
+ builder = builder.addTransition(tested,configBackupDelete,tested);
+ builder = builder.addTransition(tested,configExport,tested);
+ builder = builder.addTransition(tested,stopApplication,stopping);
+
+ builder = builder.addTransition(running,configure,configuring);
+ builder = builder.addTransition(running,test,testing);
+ builder = builder.addTransition(running,start,starting);
+ 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,configModify,configuring);
+ builder = builder.addTransition(running,configScaleout,configuring);
+ builder = builder.addTransition(running,configRestore,configuring);
+ builder = builder.addTransition(running,healthcheck,testing);
+ builder = builder.addTransition(running,backup,backingUp);
+ builder = builder.addTransition(running,snapshot,snapshotting);
+ builder = builder.addTransition(running,softwareUpload,softwareUploading);
+ builder = builder.addTransition(running,liveUpgrade,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(running,configBackup,running);
+ builder = builder.addTransition(running,configBackupDelete,running);
+ builder = builder.addTransition(running,configExport,running);
+ builder = builder.addTransition(running,stopApplication,stopping);
+
+ builder = builder.addTransition(error,configure,configuring);
+ builder = builder.addTransition(error,test,testing);
+ builder = builder.addTransition(error,start,starting);
+ 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,configModify,configuring);
+ builder = builder.addTransition(error,configScaleout,configuring);
+ builder = builder.addTransition(error,configRestore,configuring);
+ builder = builder.addTransition(error,healthcheck,testing);
+ builder = builder.addTransition(error,backup,backingUp);
+ builder = builder.addTransition(error,snapshot,snapshotting);
+ builder = builder.addTransition(error,softwareUpload,softwareUploading);
+ builder = builder.addTransition(error,liveUpgrade,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(error,configBackup,error);
+ builder = builder.addTransition(error,configBackupDelete,error);
+ builder = builder.addTransition(error,configExport,error);
+ builder = builder.addTransition(error,stopApplication,stopping);
+
+ builder = builder.addTransition(unknown,configure,configuring);
+ builder = builder.addTransition(unknown,test,testing);
+ builder = builder.addTransition(unknown,start,starting);
+ 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,configModify,configuring);
+ builder = builder.addTransition(unknown,configScaleout,configuring);
+ builder = builder.addTransition(unknown,configRestore,configuring);
+ builder = builder.addTransition(unknown,healthcheck,testing);
+ builder = builder.addTransition(unknown,backup,backingUp);
+ builder = builder.addTransition(unknown,snapshot,snapshotting);
+ builder = builder.addTransition(unknown,softwareUpload,softwareUploading);
+ builder = builder.addTransition(unknown,liveUpgrade,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(unknown,configBackup,unknown);
+ builder = builder.addTransition(unknown,configBackupDelete,unknown);
+ builder = builder.addTransition(unknown,configExport,unknown);
+ builder = builder.addTransition(unknown,stopApplication,stopping);
+
+ builder = builder.addTransition(stopped,configure,configuring);
+ builder = builder.addTransition(stopped,test,testing);
+ builder = builder.addTransition(stopped,start,starting);
+ builder = builder.addTransition(stopped,terminate,terminating);
+ builder = builder.addTransition(stopped,restart,restarting);
+ builder = builder.addTransition(stopped,rebuild,rebuilding);
+ builder = builder.addTransition(stopped,configModify,configuring);
+ builder = builder.addTransition(stopped,configScaleout,configuring);
+ builder = builder.addTransition(stopped,configRestore,configuring);
+ builder = builder.addTransition(stopped,healthcheck,testing);
+ builder = builder.addTransition(stopped,backup,backingUp);
+ builder = builder.addTransition(stopped,snapshot,snapshotting);
+ builder = builder.addTransition(stopped,softwareUpload,softwareUploading);
+ builder = builder.addTransition(stopped,liveUpgrade,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(starting,success,running);
+ builder = builder.addTransition(starting,failure,error);
+
+ builder = builder.addTransition(terminating,success,notInstantiated);
+ 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(backingUp,success,running);
+ builder = builder.addTransition(backingUp,failure,error);
+
+ builder = builder.addTransition(snapshotting,success,running);
+ builder = builder.addTransition(snapshotting,failure,error);
+
+ builder = builder.addTransition(softwareUploading,success,running);
+ builder = builder.addTransition(softwareUploading,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);
+
+
+ builder = builder.addTransition(configured,startApplication,starting);
+ builder = builder.addTransition(tested,startApplication,starting);
+ builder = builder.addTransition(error,startApplication,starting);
+ builder = builder.addTransition(unknown,startApplication,starting);
+ builder = builder.addTransition(running,startApplication,starting);
+
+ return builder.build();
}
}
diff --git a/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Event.java b/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Event.java
index 33de6077d..c6e5fcb6c 100644
--- a/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Event.java
+++ b/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Event.java
@@ -24,21 +24,28 @@
package org.openecomp.appc.statemachine.objects;
+/**
+ * Event Object
+ */
public class Event{
+ private final String eventName;
+ private final int hashCode;
- private String eventName;
-
- private Event(){
- // do nothing
+ /**
+ * Constructor
+ * @param eventName String of the event name
+ */
+ public Event(String eventName) {
+ this.eventName = eventName;
+ this.hashCode = this.eventName.toLowerCase().hashCode();
}
@Override
- public int hashCode(){
- return this.eventName.hashCode();
+ public int hashCode() {
+ return hashCode;
}
-
@Override
- public boolean equals(Object obj){
+ public boolean equals(Object obj) {
if(obj == null){
return false;
}
@@ -46,15 +53,10 @@ public class Event{
return false;
}
Event event = (Event)obj;
- return this.eventName.equals(event.getEventName());
- }
-
- public Event(String eventName){
- this();
- this.eventName = eventName;
+ return this.eventName.equalsIgnoreCase(event.getEventName());
}
- private String getEventName() {
+ public String getEventName() {
return eventName;
}
diff --git a/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Response.java b/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Response.java
index 36201204f..283bbfba4 100644
--- a/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Response.java
+++ b/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Response.java
@@ -24,8 +24,15 @@
package org.openecomp.appc.statemachine.objects;
+/**
+ * Response object
+ */
public enum Response {
- NO_TRANSITION_DEFINED,NO_STATE_CHANGE,VALID_TRANSITION;
+ NO_TRANSITION_DEFINED,
+ NO_STATE_CHANGE,
+ VALID_TRANSITION;
+
+ @Override
public String toString(){
return this.name();
}
diff --git a/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/State.java b/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/State.java
index 8dc8c3ccf..20d3c59e2 100644
--- a/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/State.java
+++ b/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/State.java
@@ -27,42 +27,46 @@ package org.openecomp.appc.statemachine.objects;
import java.util.ArrayList;
import java.util.List;
-public class State{
- private String stateName;
- private List<Transition> transitions;
-
- private State(){
- // do nothing
- }
+/**
+ * State Object
+ */
+public class State {
+ private final String stateName;
+ private final int hashCode;
+ private final List<Transition> transitions;
- public State(String state){
- this();
- this.stateName = state;
+ /**
+ * Constructor
+ * @param stateName String of the state name
+ */
+ public State(String stateName) {
+ this.stateName = stateName;
+ this.hashCode = stateName.toLowerCase().hashCode();
this.transitions = new ArrayList<>();
}
@Override
- public int hashCode(){
- return this.stateName.hashCode();
+ public int hashCode() {
+ return hashCode;
}
@Override
- public boolean equals(Object obj){
- if(obj == null){
+ public boolean equals(Object obj) {
+ if (obj == null) {
return false;
}
- if(!(obj instanceof State)){
+ if (!(obj instanceof State)) {
return false;
}
State state = (State)obj;
return this.stateName.equalsIgnoreCase(state.getStateName());
}
- public String getStateName(){
+ public String getStateName() {
return stateName;
}
- void addTransition(Transition transition){
+ void addTransition(Transition transition) {
this.transitions.add(transition);
}
@@ -71,7 +75,7 @@ public class State{
}
@Override
- public String toString(){
+ public String toString() {
return this.stateName;
}
}
diff --git a/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Transition.java b/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Transition.java
index d777ef8a5..5bdf64980 100644
--- a/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Transition.java
+++ b/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Transition.java
@@ -24,16 +24,19 @@
package org.openecomp.appc.statemachine.objects;
+/**
+ * Transition Object
+ */
public class Transition {
private Event event;
private State nextState;
- private Transition(){
- // do nothing
- }
-
- Transition(Event event, State nextState){
- this();
+ /**
+ * Constructor
+ * @param event which triggers the transition
+ * @param nextState of State which indicates the transition targeted state
+ */
+ Transition(Event event, State nextState) {
this.event = event;
this.nextState = nextState;
}