diff options
author | Patrick Brady <pb071s@att.com> | 2017-06-01 10:45:37 -0700 |
---|---|---|
committer | Patrick Brady <pb071s@att.com> | 2017-06-02 13:05:15 -0700 |
commit | c7d0075d223eab9f89fd28853c4b138792059be9 (patch) | |
tree | 40aa3e41e598ea7a59bcf6899a2004c1abab11c2 /appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core | |
parent | 8aac2df744820304ee29354333661699e9695939 (diff) |
Merge of new rebased code
Change-Id: I9b8d1f69eb3e0af1935ed8304fea4bf54c1aac47
Signed-off-by: Patrick Brady <pb071s@att.com>
Diffstat (limited to 'appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core')
4 files changed, 104 insertions, 40 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 e2231e8a6..859e4a514 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 @@ -25,7 +25,6 @@ <artifactId>appc-lifecycle-management</artifactId> <version>1.1.0-SNAPSHOT</version> </parent> - <groupId>org.openecomp.appc</groupId> <artifactId>appc-lifecycle-management-core</artifactId> <packaging>bundle</packaging> @@ -69,10 +68,12 @@ <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> + <Import-Package> + org.openecomp.appc.lifecyclemanager.*, + *;resolution:=optional + </Import-Package> </instructions> </configuration> </plugin> 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 82c497d58..965d61a7b 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 @@ -32,8 +32,22 @@ 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; + 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"); + + String stateName; + + VNFStates(String name){ + this.stateName = name; + } + + VNFStates(){ + this.stateName = name(); + } + + public String toString(){ + return this.stateName; + } } @SuppressWarnings("unused") @@ -46,12 +60,14 @@ public class MetadataReader { 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()); @@ -70,7 +86,9 @@ public class MetadataReader { 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 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()); @@ -80,6 +98,9 @@ public class MetadataReader { 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 LOCK = new Event(VNFOperation.Lock.toString()); Event UNLOCK = new Event(VNFOperation.Unlock.toString()); @@ -99,6 +120,7 @@ public class MetadataReader { 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); @@ -112,6 +134,7 @@ public class MetadataReader { builder = builder.addState(ROLLBACKING); builder = builder.addState(MIGRATING); builder = builder.addState(EVACUATING); + builder = builder.addState(NOT_ORCHESTRATED); builder = builder.addEvent(CONFIGURE); builder = builder.addEvent(TEST); @@ -122,7 +145,9 @@ public class MetadataReader { builder = builder.addEvent(SUCCESS); builder = builder.addEvent(FAILURE); builder = builder.addEvent(STOP); - builder = builder.addEvent(MODIFY_CONFIG); + 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); @@ -136,15 +161,22 @@ public class MetadataReader { 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.addTransition(NOT_ORCHESTRATED,CONFIGURE,CONFIGURING); builder = builder.addTransition(INSTANTIATED,CONFIGURE,CONFIGURING); builder = builder.addTransition(INSTANTIATED,TEST,TESTING); - builder = builder.addTransition(INSTANTIATED,START,RESTARTING); + 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,MODIFY_CONFIG,CONFIGURING); + 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); @@ -159,12 +191,14 @@ public class MetadataReader { builder = builder.addTransition(CONFIGURED,CONFIGURE,CONFIGURING); builder = builder.addTransition(CONFIGURED,TEST,TESTING); - builder = builder.addTransition(CONFIGURED,START,RESTARTING); + 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,MODIFY_CONFIG,CONFIGURING); + 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); @@ -178,15 +212,20 @@ public class MetadataReader { 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(TESTED,CONFIGURE,CONFIGURING); builder = builder.addTransition(TESTED,TEST,TESTING); - builder = builder.addTransition(TESTED,START,RESTARTING); + 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,MODIFY_CONFIG,CONFIGURING); + 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); @@ -200,15 +239,20 @@ public class MetadataReader { 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(RUNNING,CONFIGURE,CONFIGURING); builder = builder.addTransition(RUNNING,TEST,TESTING); - builder = builder.addTransition(RUNNING,START,RESTARTING); + 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,MODIFY_CONFIG,CONFIGURING); + 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); @@ -222,15 +266,20 @@ public class MetadataReader { 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(ERROR,CONFIGURE,CONFIGURING); builder = builder.addTransition(ERROR,TEST,TESTING); - builder = builder.addTransition(ERROR,START,RESTARTING); + 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,MODIFY_CONFIG,CONFIGURING); + 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); @@ -244,15 +293,20 @@ public class MetadataReader { 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(UNKNOWN,CONFIGURE,CONFIGURING); builder = builder.addTransition(UNKNOWN,TEST,TESTING); - builder = builder.addTransition(UNKNOWN,START,RESTARTING); + 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,MODIFY_CONFIG,CONFIGURING); + 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); @@ -266,14 +320,19 @@ public class MetadataReader { 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(STOPPED,CONFIGURE,CONFIGURING); builder = builder.addTransition(STOPPED,TEST,TESTING); - builder = builder.addTransition(STOPPED,START,RESTARTING); + 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,MODIFY_CONFIG,CONFIGURING); + 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); @@ -295,6 +354,9 @@ public class MetadataReader { 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); 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 index 63711c27f..2fbb0daab 100644 --- 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 @@ -25,24 +25,12 @@ 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 +appc.LCM.provider.url=https://localhost:8443/restconf/operations/appc-provider-lcm +appc.LCM.poolMembers=<DMAAP_IP>:3904 +appc.LCM.service=dmaap +appc.LCM.topic.write=APPC-TEST2 +appc.LCM.client.name=APPC-TEST-CLIENT-LC-MGMT-MAIN +appc.LCM.provider.user=test +appc.LCM.provider.pass=test -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 index 4c14e90bd..50b434956 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 @@ -103,6 +103,19 @@ public class TestLifecycleManager { } } + @Test + public void testNotOrchestratedState() throws LifecycleException, NoTransitionDefinedException { + LifecycleManager lifecycleManager = new LifecycleManagerImpl(); + String nextState = lifecycleManager.getNextState(null,"NOT ORCHESTRATED",VNFOperation.Configure.toString()); + Assert.assertEquals(nextState,"Configuring"); + } + + @Test(expected = NoTransitionDefinedException.class) + public void testBakckingUpState() throws LifecycleException, NoTransitionDefinedException { + LifecycleManager lifecycleManager = new LifecycleManagerImpl(); + String nextState = lifecycleManager.getNextState(null,"Software_Uploading",VNFOperation.Configure.toString()); + } + private List<Event> getNegativeEvents(State state,Set<Event> events) { List<Event> negativeEventList = new ArrayList<>(); negativeEventList.addAll(events); |