summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbeili.zhou <beili.zhou@amdocs.com>2017-08-10 14:54:42 -0400
committerbeili.zhou <beili.zhou@amdocs.com>2017-08-11 09:22:57 -0400
commitfe0e98940048cad839c629821da78b3fcf33b6d2 (patch)
tree0d7a90c79c85413f6c73798f1aa6005c841a6ca8
parentb51814c63253df3379cc60561c31765bc74ee266 (diff)
[APPC-44] APPC Lifecycle Management refactor
Pull APPC lifecycle Management out of APPC dispatcher, so that it can be used by both APPC dispatcher and APPC OAM. This is the pre-step of introducing APPC OAM operations. Issue-Id: APPC-44 Change-Id: Icbde399b5121fae9e1919cfdd5c77bbe55d61188 Signed-off-by: beili.zhou <beili.zhou@amdocs.com>
-rw-r--r--appc-common/src/main/java/org/openecomp/appc/exceptions/InvalidInputException.java (renamed from appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/InvalidInputException.java)44
-rw-r--r--appc-common/src/main/java/org/openecomp/appc/exceptions/InvalidStateException.java31
-rw-r--r--appc-dispatcher/appc-dispatcher-common/pom.xml17
-rw-r--r--appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/StateMachineImpl.java96
-rw-r--r--appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/test/java/org/openecomp/appc/statemachine/TestStateMachine.java95
-rw-r--r--appc-dispatcher/appc-license-manager/appc-license-manager-core/pom.xml5
-rw-r--r--appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/.settings/org.eclipse.wst.common.project.facet.core.xml4
-rw-r--r--appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/pom.xml36
-rw-r--r--appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/.settings/org.eclipse.wst.common.project.facet.core.xml4
-rw-r--r--appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/main/java/org/openecomp/appc/lifecyclemanager/helper/MetadataReader.java443
-rw-r--r--appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/main/java/org/openecomp/appc/lifecyclemanager/impl/LifecycleManagerImpl.java98
-rw-r--r--appc-dispatcher/appc-lifecycle-management/pom.xml22
-rw-r--r--appc-dispatcher/pom.xml127
-rw-r--r--appc-lifecycle-management/.gitignore (renamed from appc-dispatcher/appc-dispatcher-common/state-machine-lib/.gitignore)0
-rw-r--r--appc-lifecycle-management/appc-lifecycle-management-api/.gitignore (renamed from appc-dispatcher/appc-lifecycle-management/.gitignore)0
-rw-r--r--appc-lifecycle-management/appc-lifecycle-management-api/.settings/org.eclipse.wst.common.project.facet.core.xml (renamed from appc-dispatcher/appc-dispatcher-common/state-machine-lib/.settings/org.eclipse.wst.common.project.facet.core.xml)0
-rw-r--r--appc-lifecycle-management/appc-lifecycle-management-api/pom.xml (renamed from appc-dispatcher/appc-dispatcher-common/state-machine-lib/pom.xml)23
-rw-r--r--appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/LifecycleManager.java (renamed from appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/LifecycleManager.java)48
-rw-r--r--appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/LCMResponse.java (renamed from appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/LCMResponse.java)54
-rw-r--r--appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/LifecycleException.java (renamed from appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/LifecycleException.java)55
-rw-r--r--appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/NoTransitionDefinedException.java (renamed from appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/NoTransitionDefinedException.java)55
-rw-r--r--appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/VNFOperationOutcome.java (renamed from appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/VNFOperationOutcome.java)46
-rw-r--r--appc-lifecycle-management/appc-lifecycle-management-core/.gitignore (renamed from appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/.gitignore)0
-rw-r--r--appc-lifecycle-management/appc-lifecycle-management-core/pom.xml (renamed from appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/pom.xml)21
-rw-r--r--appc-lifecycle-management/appc-lifecycle-management-core/src/main/java/org/openecomp/appc/lifecyclemanager/impl/LifecycleManagerImpl.java102
-rw-r--r--appc-lifecycle-management/appc-lifecycle-management-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml (renamed from appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml)59
-rw-r--r--appc-lifecycle-management/appc-lifecycle-management-core/src/main/resources/org/openecomp/appc/default.properties (renamed from appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/main/resources/org/openecomp/appc/default.properties)66
-rw-r--r--appc-lifecycle-management/appc-lifecycle-management-core/src/test/java/org/openecomp/appc/LifecycleManagerTest.java (renamed from appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/test/java/org/openecomp/appc/TestLifecycleManager.java)340
-rw-r--r--appc-lifecycle-management/appc-lifecycle-management-core/src/test/java/org/openecomp/appc/OamLifeCycleManagerTest.java152
-rw-r--r--appc-lifecycle-management/appc-lifecycle-management-features/.gitignore (renamed from appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/.gitignore)0
-rw-r--r--appc-lifecycle-management/appc-lifecycle-management-features/pom.xml (renamed from appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-features/pom.xml)28
-rw-r--r--appc-lifecycle-management/appc-lifecycle-management-features/src/main/resources/features.xml (renamed from appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-features/src/main/resources/features.xml)64
-rw-r--r--appc-lifecycle-management/appc-lifecycle-management-installer/.gitignore2
-rw-r--r--appc-lifecycle-management/appc-lifecycle-management-installer/pom.xml137
-rw-r--r--appc-lifecycle-management/appc-lifecycle-management-installer/src/assembly/assemble_installer_zip.xml60
-rw-r--r--appc-lifecycle-management/appc-lifecycle-management-installer/src/assembly/assemble_mvnrepo_zip.xml51
-rw-r--r--appc-lifecycle-management/appc-lifecycle-management-installer/src/main/resources/scripts/install-feature.sh63
-rw-r--r--appc-lifecycle-management/pom.xml50
-rw-r--r--appc-lifecycle-management/state-machine-lib/.gitignore (renamed from appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-features/.gitignore)0
-rw-r--r--appc-lifecycle-management/state-machine-lib/.settings/org.eclipse.wst.common.project.facet.core.xml (renamed from appc-dispatcher/appc-lifecycle-management/.settings/org.eclipse.wst.common.project.facet.core.xml)0
-rw-r--r--appc-lifecycle-management/state-machine-lib/pom.xml42
-rw-r--r--appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/StateMachine.java (renamed from appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/StateMachine.java)48
-rw-r--r--appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/StateMetaDataReader.java (renamed from appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Event.java)75
-rw-r--r--appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/StateMachineFactory.java (renamed from appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/StateMachineFactory.java)68
-rw-r--r--appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/StateMachineImpl.java98
-rw-r--r--appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/readers/AppcOamMetaDataReader.java107
-rw-r--r--appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/readers/AppcOamStates.java56
-rw-r--r--appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/readers/VnfMetaDataReader.java483
-rw-r--r--appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Event.java (renamed from appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/State.java)129
-rw-r--r--appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Response.java (renamed from appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Response.java)47
-rw-r--r--appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/State.java77
-rw-r--r--appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/StateMachineMetadata.java (renamed from appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/StateMachineMetadata.java)142
-rw-r--r--appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/StateMachineResponse.java (renamed from appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/StateMachineResponse.java)84
-rw-r--r--appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Transition.java (renamed from appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/Transition.java)78
-rw-r--r--appc-lifecycle-management/state-machine-lib/src/test/java/org/openecomp/appc/statemachine/impl/readers/AppcOamStatesTest.java71
-rw-r--r--pom.xml9
56 files changed, 2402 insertions, 1710 deletions
diff --git a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/InvalidInputException.java b/appc-common/src/main/java/org/openecomp/appc/exceptions/InvalidInputException.java
index 1ed842120..dff456444 100644
--- a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/InvalidInputException.java
+++ b/appc-common/src/main/java/org/openecomp/appc/exceptions/InvalidInputException.java
@@ -1,31 +1,31 @@
-/*-
+/*-
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.statemachine.objects;
-
-public class InvalidInputException extends Exception{
- public InvalidInputException(String message){
- super(message);
- }
-}
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.exceptions;
+
+public class InvalidInputException extends Exception {
+ public InvalidInputException(String message){
+ super(message);
+ }
+}
diff --git a/appc-common/src/main/java/org/openecomp/appc/exceptions/InvalidStateException.java b/appc-common/src/main/java/org/openecomp/appc/exceptions/InvalidStateException.java
new file mode 100644
index 000000000..19c9e3888
--- /dev/null
+++ b/appc-common/src/main/java/org/openecomp/appc/exceptions/InvalidStateException.java
@@ -0,0 +1,31 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.exceptions;
+
+public class InvalidStateException extends Exception {
+ public InvalidStateException(String message) {
+ super(message);
+ }
+}
diff --git a/appc-dispatcher/appc-dispatcher-common/pom.xml b/appc-dispatcher/appc-dispatcher-common/pom.xml
index 4562b9457..c1d240901 100644
--- a/appc-dispatcher/appc-dispatcher-common/pom.xml
+++ b/appc-dispatcher/appc-dispatcher-common/pom.xml
@@ -10,18 +10,17 @@
<packaging>pom</packaging>
<name>APPC Dispatcher Common</name>
<description>APPC Dispatcher Common</description>
-
- <!-- ================================================================================== -->
- <!-- The modules we build -->
- <!-- ================================================================================== -->
- <modules>
- <module>appc-data-access-lib</module>
- <module>execution-queue-management-lib</module>
- <module>state-machine-lib</module>
+
+ <!-- ================================================================================== -->
+ <!-- The modules we build -->
+ <!-- ================================================================================== -->
+ <modules>
+ <module>appc-data-access-lib</module>
+ <module>execution-queue-management-lib</module>
<module>ranking-framework-lib</module>
<module>lock-manager-lib</module>
<module>domain-model-lib</module>
<module>transaction-recorder</module>
</modules>
-
+
</project> \ No newline at end of file
diff --git a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/StateMachineImpl.java b/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/StateMachineImpl.java
deleted file mode 100644
index 212edf8ac..000000000
--- a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/StateMachineImpl.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.statemachine.impl;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.openecomp.appc.statemachine.StateMachine;
-import org.openecomp.appc.statemachine.objects.*;
-
-
-public class StateMachineImpl implements StateMachine {
-
- private final Set<State> states;
-
- private final Set<Event> events;
-
- StateMachineImpl(StateMachineMetadata metadata){
- this.states = new HashSet<State>();
- this.states.addAll(metadata.getStates());
- this.events = new HashSet<Event>();
- this.events.addAll(metadata.getEvents());
- }
-
- 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 );
- }
-
- StateMachineResponse response = new StateMachineResponse();
- State currentState = null,nextState = null;
- for(State stateInSet:states){
- if(stateInSet.equals(inputState)){
- currentState = stateInSet;
- break;
- }
- }
- for(Transition transition : currentState.getTransitions()){
- if(event.equals(transition.getEvent())){
- nextState = transition.getNextState();
- }
- }
- if(nextState == null){
- response.setResponse(Response.NO_TRANSITION_DEFINED);
- }
- else if(inputState.equals(nextState)){
- response.setResponse(Response.NO_STATE_CHANGE);
- }
- else{
- response.setResponse(Response.VALID_TRANSITION);
- }
- response.setNextState(nextState);
- return response;
- }
-
- private boolean validateInputs(State state,Event event){
- if(state ==null || event == null){
- return false;
- }
- if(!(this.states.contains(state) && this.events.contains(event))){
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- return "StateMachineImpl{" +
- "states=" + states +
- ", events=" + events +
- '}';
- }
-}
diff --git a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/test/java/org/openecomp/appc/statemachine/TestStateMachine.java b/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/test/java/org/openecomp/appc/statemachine/TestStateMachine.java
deleted file mode 100644
index c2f79ec15..000000000
--- a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/test/java/org/openecomp/appc/statemachine/TestStateMachine.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.statemachine;
-
-
-import org.junit.Test;
-import org.openecomp.appc.statemachine.objects.InvalidInputException;
-
-
-public class TestStateMachine {
-
- @Test
- public void handleEvent() throws InvalidInputException {
-
-// MetadataReader metadataReader = new MetadataReader();
-// StateMachineMetadata metadata = metadataReader.readMetadata(null);
-//
-// StateMachine machine = StateMachineFactory.getStateMachine(metadata);
-//
-// /*
-// Testing Positive Scenario passing the valid events and validating the StateMachineResponse
-// */
-// for(State state:metadata.getStates()){
-//
-// for(Transition transition:state.getTransitions()){
-// Event event = transition.getEvent();
-// State nextState = transition.getNextState();
-//
-// StateMachineResponse response = machine.handleEvent(state,event);
-// Assert.assertEquals(response.getNextState(),nextState);
-// Assert.assertEquals(response.getResponse(),Response.VALID_TRANSITION);
-// }
-// }
-//
-// /*
-// Testing Negative Scenarios, 1. Passing the valid Events for which Transition is not defined in
-// Metadata and validating the StateMachineResponse 2. Passing the invalid events which are not
-// registered as events in the StateMachineMetadata and validating StateMachineResponse
-// */
-// for(State state:metadata.getStates()){
-//
-// for(Transition transition:state.getTransitions()){
-// List<Event> negativeEvents = getNegativeEvents(state,metadata.getEvents());
-//
-// for(Event negativeEvent:negativeEvents){
-// StateMachineResponse response = machine.handleEvent(state,negativeEvent);
-// Assert.assertEquals(response.getNextState(),null);
-// Assert.assertEquals(response.getResponse(),Response.NO_TRANSITION_DEFINED);
-//
-// boolean flag =false;
-// try{
-// response = machine.handleEvent(state,new Event("PUT"));
-// }
-// catch(InvalidInputException e){
-// flag = true;
-// }
-// Assert.assertTrue(flag);
-//
-// }
-// }
-// }
- }
-
-// private List<Event> getNegativeEvents(State state,Set<Event> events) {
-// List<Event> negativeEventList = new ArrayList<>();
-// negativeEventList.addAll(events);
-//
-// for(Transition transition: state.getTransitions()){
-// negativeEventList.remove(transition.getEvent());
-// }
-// return negativeEventList;
-// }
-}
diff --git a/appc-dispatcher/appc-license-manager/appc-license-manager-core/pom.xml b/appc-dispatcher/appc-license-manager/appc-license-manager-core/pom.xml
index 99ab538ca..522ca234e 100644
--- a/appc-dispatcher/appc-license-manager/appc-license-manager-core/pom.xml
+++ b/appc-dispatcher/appc-license-manager/appc-license-manager-core/pom.xml
@@ -35,11 +35,6 @@
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.openecomp.sdnc.core</groupId>
<artifactId>sli-provider</artifactId>
</dependency>
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/.settings/org.eclipse.wst.common.project.facet.core.xml b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/.settings/org.eclipse.wst.common.project.facet.core.xml
deleted file mode 100644
index f4ef8aa0a..000000000
--- a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/.settings/org.eclipse.wst.common.project.facet.core.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<faceted-project>
- <installed facet="java" version="1.8"/>
-</faceted-project>
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/pom.xml b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/pom.xml
deleted file mode 100644
index cea316c4e..000000000
--- a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/pom.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.openecomp.appc</groupId>
- <artifactId>appc-lifecycle-management</artifactId>
- <version>1.1.0-SNAPSHOT</version>
- </parent>
-
- <groupId>org.openecomp.appc</groupId>
- <artifactId>appc-lifecycle-management-api</artifactId>
- <version>1.1.0-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
- <name>appc-lifecycle-management-api</name>
- <url>http://maven.apache.org</url>
-
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
- <Bundle-Version>${project.version}</Bundle-Version>
- <Export-Package>org.openecomp.appc.lifecyclemanager.*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/.settings/org.eclipse.wst.common.project.facet.core.xml b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/.settings/org.eclipse.wst.common.project.facet.core.xml
deleted file mode 100644
index f4ef8aa0a..000000000
--- a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/.settings/org.eclipse.wst.common.project.facet.core.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<faceted-project>
- <installed facet="java" version="1.8"/>
-</faceted-project>
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/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
deleted file mode 100644
index cad3db7e8..000000000
--- a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/main/java/org/openecomp/appc/lifecyclemanager/helper/MetadataReader.java
+++ /dev/null
@@ -1,443 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.lifecyclemanager.helper;
-
-
-import org.openecomp.appc.domainmodel.lcm.VNFOperation;
-import org.openecomp.appc.lifecyclemanager.objects.VNFOperationOutcome;
-import org.openecomp.appc.statemachine.objects.Event;
-import org.openecomp.appc.statemachine.objects.State;
-import org.openecomp.appc.statemachine.objects.StateMachineMetadata;
-
-
-public class MetadataReader {
-
- private enum VNFStates {
- Not_Instantiated, Instantiated, Configuring, Configured, Testing, Tested, Rebuilding, Restarting, Starting, Error, Running, Unknown, Terminating, Stopping, Stopped,
- Backing_Up, Snapshotting, Software_Uploading, Upgrading, Rollbacking, Licensing, Migrating, Evacuating , NOT_ORCHESTRATED("NOT ORCHESTRATED"),Created;
-
- String stateName;
-
- VNFStates(String name){
- this.stateName = name;
- }
-
- VNFStates(){
- this.stateName = name();
- }
-
- public String toString(){
- return this.stateName.toLowerCase();
- }
- }
-
- @SuppressWarnings("unused")
- public StateMachineMetadata readMetadata(String vnfType){
- State NOT_INSTANTIATED = new State(VNFStates.Not_Instantiated.toString());
- State INSTANTIATED = new State(VNFStates.Instantiated.toString());
- State CONFIGURING = new State(VNFStates.Configuring.toString());
- State CONFIGURED = new State(VNFStates.Configured.toString());
- State TESTING = new State(VNFStates.Testing.toString());
- State TESTED = new State(VNFStates.Tested.toString());
- State REBUILDING = new State(VNFStates.Rebuilding.toString());
- State RESTARTING = new State(VNFStates.Restarting.toString());
- State 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 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 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(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.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);
- 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(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);
- 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(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(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(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(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);
-
- return builder.build();
-
- }
-
-}
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/main/java/org/openecomp/appc/lifecyclemanager/impl/LifecycleManagerImpl.java b/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/main/java/org/openecomp/appc/lifecyclemanager/impl/LifecycleManagerImpl.java
deleted file mode 100644
index 8741b1b25..000000000
--- a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/main/java/org/openecomp/appc/lifecyclemanager/impl/LifecycleManagerImpl.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.lifecyclemanager.impl;
-
-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.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 java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-
-public class LifecycleManagerImpl implements LifecycleManager{
-
- private MetadataReader metadataReader;
- private static Map<String,StateMachine> stateMachineMap = new ConcurrentHashMap<String,StateMachine>();
- private static final EELFLogger logger = EELFManager.getInstance().getLogger(LifecycleManagerImpl.class);
- private static EELFLogger errorLogger = EELFManager.getInstance().getErrorLogger();
- public LifecycleManagerImpl(){
- this.metadataReader = new MetadataReader();
- }
-
- @Override
- public String getNextState(String vnfType, String currentState, String event) throws NoTransitionDefinedException,LifecycleException{
- if (logger.isTraceEnabled()) {
- logger.trace("Entering to getNextState with vnfType = "+ vnfType + ", currentState = " + currentState + ", event = " + event);
- }
-
- State nextState = null;
- StateMachine machine = null;
- StateMachineResponse response;
- try {
- machine = this.getStateMachine(vnfType);
- response = machine.handleEvent(new State(currentState.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);
- }
- nextState = response.getNextState();
- } catch (InvalidInputException e) {
- logger.error(e.getMessage());
- throw new LifecycleException(e,currentState,event);
- }
- if (logger.isTraceEnabled()) {
- logger.trace("Exiting from getNextState with (nextState = "+nextState.getStateName()!=null?nextState.getStateName():"null"+")");
- }
- return nextState.getStateName();
- }
-
- private StateMachine getStateMachine(String vnfType){
- if (logger.isTraceEnabled()) {
- logger.trace("Entering to getNextState with vnfType = "+ vnfType);
- }
- if(vnfType == null){
- vnfType = "DEFAULT";
- }
- StateMachine machine = stateMachineMap.get(vnfType);
- if(machine == null){
- StateMachineMetadata metadata = metadataReader.readMetadata(vnfType);
- machine = StateMachineFactory.getStateMachine(metadata);
- stateMachineMap.put(vnfType,machine);
- }
-
- logger.trace("Exiting getStateMachine with (StateMachine = "+stateMachineMap.get(vnfType)!=null?stateMachineMap.get(vnfType).toString():"null"+")");
- return stateMachineMap.get(vnfType);
- }
-
-}
diff --git a/appc-dispatcher/appc-lifecycle-management/pom.xml b/appc-dispatcher/appc-lifecycle-management/pom.xml
deleted file mode 100644
index 335f162c5..000000000
--- a/appc-dispatcher/appc-lifecycle-management/pom.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.openecomp.appc</groupId>
- <artifactId>appc-dispatcher</artifactId>
- <version>1.1.0-SNAPSHOT</version>
- </parent>
- <artifactId>appc-lifecycle-management</artifactId>
- <packaging>pom</packaging>
- <name>APPC Lifecycle Management</name>
- <description>APPC Lifecycle Management</description>
-
- <!-- ================================================================================== -->
- <!-- The modules we build -->
- <!-- ================================================================================== -->
- <modules>
- <module>appc-lifecycle-management-api</module>
- <module>appc-lifecycle-management-core</module>
- <module>appc-lifecycle-management-features</module>
- </modules>
-
-</project> \ No newline at end of file
diff --git a/appc-dispatcher/pom.xml b/appc-dispatcher/pom.xml
index e54c5a744..a813a668b 100644
--- a/appc-dispatcher/pom.xml
+++ b/appc-dispatcher/pom.xml
@@ -9,69 +9,68 @@
<packaging>pom</packaging>
<name>APPC Dispatcher</name>
<description>APPC Dispatcher</description>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito</artifactId>
- <version>1.6.2</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-module-junit4</artifactId>
- <version>1.6.2</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.objenesis</groupId>
- <artifactId>objenesis</artifactId>
- <version>2.2</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
- <!-- ================================================================================== -->
- <!-- The modules we build -->
- <!-- ================================================================================== -->
- <modules>
- <module>appc-dispatcher-common</module>
- <module>appc-lifecycle-management</module>
- <module>appc-workflow-management</module>
- <module>appc-command-executor</module>
- <module>appc-request-handler</module>
- <module>appc-license-manager</module>
- <module>appc-dispatcher-features</module>
- <module>appc-dispatcher-installer</module>
- </modules>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-mockito</artifactId>
+ <version>1.6.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-module-junit4</artifactId>
+ <version>1.6.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.objenesis</groupId>
+ <artifactId>objenesis</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+ <!-- ================================================================================== -->
+ <!-- The modules we build -->
+ <!-- ================================================================================== -->
+ <modules>
+ <module>appc-dispatcher-common</module>
+ <module>appc-workflow-management</module>
+ <module>appc-command-executor</module>
+ <module>appc-request-handler</module>
+ <module>appc-license-manager</module>
+ <module>appc-dispatcher-features</module>
+ <module>appc-dispatcher-installer</module>
+ </modules>
</project>
diff --git a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/.gitignore b/appc-lifecycle-management/.gitignore
index b83d22266..b83d22266 100644
--- a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/.gitignore
+++ b/appc-lifecycle-management/.gitignore
diff --git a/appc-dispatcher/appc-lifecycle-management/.gitignore b/appc-lifecycle-management/appc-lifecycle-management-api/.gitignore
index b83d22266..b83d22266 100644
--- a/appc-dispatcher/appc-lifecycle-management/.gitignore
+++ b/appc-lifecycle-management/appc-lifecycle-management-api/.gitignore
diff --git a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/.settings/org.eclipse.wst.common.project.facet.core.xml b/appc-lifecycle-management/appc-lifecycle-management-api/.settings/org.eclipse.wst.common.project.facet.core.xml
index f4ef8aa0a..f4ef8aa0a 100644
--- a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/.settings/org.eclipse.wst.common.project.facet.core.xml
+++ b/appc-lifecycle-management/appc-lifecycle-management-api/.settings/org.eclipse.wst.common.project.facet.core.xml
diff --git a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/pom.xml b/appc-lifecycle-management/appc-lifecycle-management-api/pom.xml
index f3a085e45..ffd8669e5 100644
--- a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/pom.xml
+++ b/appc-lifecycle-management/appc-lifecycle-management-api/pom.xml
@@ -1,19 +1,21 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.openecomp.appc</groupId>
- <artifactId>appc-dispatcher-common</artifactId>
+ <artifactId>appc-lifecycle-management</artifactId>
<version>1.1.0-SNAPSHOT</version>
</parent>
- <artifactId>state-machine-lib</artifactId>
- <packaging>bundle</packaging>
- <name>state-machine-lib</name>
- <url>http://maven.apache.org</url>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>appc-lifecycle-management-api</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <packaging>bundle</packaging>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
+ <name>appc-lifecycle-management-api</name>
+ <url>http://maven.apache.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
<build>
<plugins>
<plugin>
@@ -23,10 +25,11 @@
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Version>${project.version}</Bundle-Version>
- <Export-Package>org.openecomp.appc.statemachine.*</Export-Package>
+ <Export-Package>org.openecomp.appc.lifecyclemanager.*</Export-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
+
</project>
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/LifecycleManager.java b/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/LifecycleManager.java
index c6ffdc578..352bf4b8c 100644
--- a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/LifecycleManager.java
+++ b/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/LifecycleManager.java
@@ -1,33 +1,33 @@
-/*-
+/*-
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.lifecyclemanager;
-
-
-import org.openecomp.appc.lifecyclemanager.objects.LifecycleException;
-import org.openecomp.appc.lifecyclemanager.objects.NoTransitionDefinedException;
-
-public interface LifecycleManager {
- String getNextState(String vnfType, String currentState, String event) throws NoTransitionDefinedException,LifecycleException;
-}
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.lifecyclemanager;
+
+import org.openecomp.appc.lifecyclemanager.objects.LifecycleException;
+import org.openecomp.appc.lifecyclemanager.objects.NoTransitionDefinedException;
+
+public interface LifecycleManager {
+ String getNextState(String vnfType, String currentState, String event)
+ throws NoTransitionDefinedException,LifecycleException;
+}
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/LCMResponse.java b/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/LCMResponse.java
index 2626dc1c0..13b2173d6 100644
--- a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/LCMResponse.java
+++ b/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/LCMResponse.java
@@ -1,36 +1,36 @@
-/*-
+/*-
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.lifecyclemanager.objects;
-
-public enum LCMResponse {
- INVALID_INPUT_PARAMETERS,
- NO_STATE_CHANGE,
- NO_TRANSITION_DEFINED,
- VALID_TRANSITION;
-
- public String toString(){
- return this.name();
- }
-}
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.lifecyclemanager.objects;
+
+public enum LCMResponse {
+ INVALID_INPUT_PARAMETERS,
+ NO_STATE_CHANGE,
+ NO_TRANSITION_DEFINED,
+ VALID_TRANSITION;
+
+ public String toString(){
+ return this.name();
+ }
+}
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/LifecycleException.java b/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/LifecycleException.java
index dfe246e0a..5d6690045 100644
--- a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/LifecycleException.java
+++ b/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/LifecycleException.java
@@ -1,37 +1,36 @@
-/*-
+/*-
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.lifecyclemanager.objects;
-
-
-public class LifecycleException extends Exception {
- public final String currentState;
- public final String event;
- public LifecycleException(Exception e,String currentState,String event){
- super(e);
- this.currentState = currentState;
- this.event = event;
-
- }
-}
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.lifecyclemanager.objects;
+
+public class LifecycleException extends Exception {
+ public final String currentState;
+ public final String event;
+
+ public LifecycleException(Exception e,String currentState,String event){
+ super(e);
+ this.currentState = currentState;
+ this.event = event;
+ }
+}
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/NoTransitionDefinedException.java b/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/NoTransitionDefinedException.java
index 5ab867656..f6670eb70 100644
--- a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/NoTransitionDefinedException.java
+++ b/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/NoTransitionDefinedException.java
@@ -1,37 +1,36 @@
-/*-
+/*-
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.lifecyclemanager.objects;
-
-
-public class NoTransitionDefinedException extends Exception {
- public final String currentState;
- public final String event;
- public NoTransitionDefinedException(String message,String currentState,String event){
- super(message);
- this.currentState = currentState;
- this.event = event;
-
- }
-}
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.lifecyclemanager.objects;
+
+public class NoTransitionDefinedException extends Exception {
+ public final String currentState;
+ public final String event;
+
+ public NoTransitionDefinedException(String message,String currentState,String event){
+ super(message);
+ this.currentState = currentState;
+ this.event = event;
+ }
+}
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/VNFOperationOutcome.java b/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/VNFOperationOutcome.java
index a291c479b..8d92e352c 100644
--- a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/VNFOperationOutcome.java
+++ b/appc-lifecycle-management/appc-lifecycle-management-api/src/main/java/org/openecomp/appc/lifecyclemanager/objects/VNFOperationOutcome.java
@@ -1,32 +1,32 @@
-/*-
+/*-
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.lifecyclemanager.objects;
-
-public enum VNFOperationOutcome {
- SUCCESS,FAILURE,EXPIRE;
- public String toString(){
- return this.name();
- }
-}
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.lifecyclemanager.objects;
+
+public enum VNFOperationOutcome {
+ SUCCESS,FAILURE,EXPIRE;
+ public String toString(){
+ return this.name();
+ }
+}
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/.gitignore b/appc-lifecycle-management/appc-lifecycle-management-core/.gitignore
index b83d22266..b83d22266 100644
--- a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-api/.gitignore
+++ b/appc-lifecycle-management/appc-lifecycle-management-core/.gitignore
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/pom.xml b/appc-lifecycle-management/appc-lifecycle-management-core/pom.xml
index 00bb686d4..f7e911555 100644
--- a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/pom.xml
+++ b/appc-lifecycle-management/appc-lifecycle-management-core/pom.xml
@@ -19,12 +19,13 @@
limitations under the License.
-->
+ <parent>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-lifecycle-management</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
<modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.openecomp.appc</groupId>
- <artifactId>appc-lifecycle-management</artifactId>
- <version>1.1.0-SNAPSHOT</version>
- </parent>
<artifactId>appc-lifecycle-management-core</artifactId>
<packaging>bundle</packaging>
@@ -46,16 +47,6 @@
<groupId>com.att.eelf</groupId>
<artifactId>eelf-core</artifactId>
</dependency>
- <dependency>
- <groupId>org.openecomp.appc</groupId>
- <artifactId>appc-common</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.appc</groupId>
- <artifactId>domain-model-lib</artifactId>
- <version>${project.version}</version>
- </dependency>
</dependencies>
<build>
diff --git a/appc-lifecycle-management/appc-lifecycle-management-core/src/main/java/org/openecomp/appc/lifecyclemanager/impl/LifecycleManagerImpl.java b/appc-lifecycle-management/appc-lifecycle-management-core/src/main/java/org/openecomp/appc/lifecyclemanager/impl/LifecycleManagerImpl.java
new file mode 100644
index 000000000..890218e92
--- /dev/null
+++ b/appc-lifecycle-management/appc-lifecycle-management-core/src/main/java/org/openecomp/appc/lifecyclemanager/impl/LifecycleManagerImpl.java
@@ -0,0 +1,102 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.lifecyclemanager.impl;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.att.eelf.i18n.EELFResourceManager;
+import org.openecomp.appc.exceptions.InvalidInputException;
+import org.openecomp.appc.i18n.Msg;
+import org.openecomp.appc.lifecyclemanager.LifecycleManager;
+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.StateMetaDataReader;
+import org.openecomp.appc.statemachine.impl.StateMachineFactory;
+import org.openecomp.appc.statemachine.impl.readers.AppcOamMetaDataReader;
+import org.openecomp.appc.statemachine.impl.readers.VnfMetaDataReader;
+import org.openecomp.appc.statemachine.objects.*;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class LifecycleManagerImpl implements LifecycleManager{
+
+ private StateMetaDataReader metadataReader;
+ private static Map<String,StateMachine> stateMachineMap = new ConcurrentHashMap<>();
+ private final EELFLogger logger = EELFManager.getInstance().getLogger(LifecycleManagerImpl.class);
+ private final EELFLogger errorLogger = EELFManager.getInstance().getErrorLogger();
+
+ @Override
+ public String getNextState(String vnfType, String currentState, String event) throws NoTransitionDefinedException,LifecycleException{
+ if (logger.isTraceEnabled()) {
+ logger.trace("Entering to getNextState with vnfType = "+ vnfType + ", currentState = " + currentState + ", event = " + event);
+ }
+
+ State nextState;
+ StateMachine machine;
+ StateMachineResponse response;
+ try {
+ machine = this.getStateMachine(vnfType);
+ response = machine.handleEvent(new State(currentState),new Event(event));
+ if(Response.NO_TRANSITION_DEFINED.equals(response.getResponse())){
+ errorLogger.error(EELFResourceManager.format(Msg.VF_ILLEGAL_COMMAND, vnfType,event,currentState));
+ throw new NoTransitionDefinedException("No Transition Defined for currentState = " + currentState + ", event = " + event,currentState,event);
+ }
+ nextState = response.getNextState();
+ } catch (InvalidInputException e) {
+ logger.error(e.getMessage());
+ throw new LifecycleException(e,currentState,event);
+ }
+ if (logger.isTraceEnabled()) {
+ logger.trace("Exiting from getNextState with (nextState = " + nextState.getStateName() + ")");
+ }
+ return nextState.getStateName();
+ }
+
+ private StateMachine getStateMachine(String vnfType){
+ if (logger.isTraceEnabled()) {
+ logger.trace("Entering to getNextState with vnfType = "+ vnfType);
+ }
+ if(vnfType == null){
+ vnfType = "DEFAULT";
+ }
+ StateMachine machine = stateMachineMap.get(vnfType);
+ if(machine == null){
+ metadataReader = getMetadataReader(vnfType);
+ StateMachineMetadata metadata = metadataReader.readMetadata();
+ machine = StateMachineFactory.getStateMachine(metadata);
+ stateMachineMap.put(vnfType,machine);
+ }
+
+ logger.trace("Exiting getStateMachine with StateMachine = " + stateMachineMap.get(vnfType).toString());
+ return stateMachineMap.get(vnfType);
+ }
+
+ private StateMetaDataReader getMetadataReader(String vnfType) {
+ return vnfType.equals("APPC") ? new AppcOamMetaDataReader() : new VnfMetaDataReader();
+ }
+
+}
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/appc-lifecycle-management/appc-lifecycle-management-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index b8689a6cd..77725db6c 100644
--- a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/appc-lifecycle-management/appc-lifecycle-management-core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -1,37 +1,34 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
============LICENSE_START=======================================================
ONAP : APPC
================================================================================
Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
================================================================================
- Copyright (C) 2017 Amdocs
- =============================================================================
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
+ Copyright (C) 2017 Amdocs
+ =============================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
ECOMP is a trademark and service mark of AT&T Intellectual Property.
- ============LICENSE_END=========================================================
- -->
-
-<!--
- Starter Blueprint Camel Definition appc-aai-adapter-blueprint
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
- <bean id="lifecycleManagerBean" class="org.openecomp.appc.lifecyclemanager.impl.LifecycleManagerImpl" scope="singleton" >
-</bean>
-
- <service id="lcmService" interface="org.openecomp.appc.lifecyclemanager.LifecycleManager" ref="lifecycleManagerBean"/>
-
-</blueprint>
+ ============LICENSE_END=========================================================
+ -->
+
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+ <bean id="lifecycleManagerBean" class="org.openecomp.appc.lifecyclemanager.impl.LifecycleManagerImpl" scope="singleton">
+ </bean>
+
+ <service id="lcmService" interface="org.openecomp.appc.lifecyclemanager.LifecycleManager" ref="lifecycleManagerBean"/>
+
+</blueprint>
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/main/resources/org/openecomp/appc/default.properties b/appc-lifecycle-management/appc-lifecycle-management-core/src/main/resources/org/openecomp/appc/default.properties
index 99d728335..6b634cad7 100644
--- a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/main/resources/org/openecomp/appc/default.properties
+++ b/appc-lifecycle-management/appc-lifecycle-management-core/src/main/resources/org/openecomp/appc/default.properties
@@ -1,39 +1,39 @@
-###
+###
# ============LICENSE_START=======================================================
# ONAP : APPC
# ================================================================================
# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
# ================================================================================
-# Copyright (C) 2017 Amdocs
-# =============================================================================
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
+# Copyright (C) 2017 Amdocs
+# =============================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-# ============LICENSE_END=========================================================
-###
-
-# Define the name and path of any user-provided configuration (bootstrap) file that can be loaded
-# to supply configuration options
-org.openecomp.appc.bootstrap.file=appc.properties
-org.openecomp.appc.bootstrap.path=/opt/openecomp/appc/data/properties,${user.home},.
-
-#Property below provided by appc.properties
-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
-
-
+# ============LICENSE_END=========================================================
+###
+
+# Define the name and path of any user-provided configuration (bootstrap) file that can be loaded
+# to supply configuration options
+org.openecomp.appc.bootstrap.file=appc.properties
+org.openecomp.appc.bootstrap.path=/opt/openecomp/appc/data/properties,${user.home},.
+
+#Property below provided by appc.properties
+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
+
+
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/test/java/org/openecomp/appc/TestLifecycleManager.java b/appc-lifecycle-management/appc-lifecycle-management-core/src/test/java/org/openecomp/appc/LifecycleManagerTest.java
index 7ba78c732..e58dcc901 100644
--- a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/src/test/java/org/openecomp/appc/TestLifecycleManager.java
+++ b/appc-lifecycle-management/appc-lifecycle-management-core/src/test/java/org/openecomp/appc/LifecycleManagerTest.java
@@ -1,173 +1,185 @@
-/*-
+/*-
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.openecomp.appc.domainmodel.lcm.VNFOperation;
-import org.openecomp.appc.lifecyclemanager.LifecycleManager;
-import org.openecomp.appc.lifecyclemanager.helper.MetadataReader;
-import org.openecomp.appc.lifecyclemanager.impl.LifecycleManagerImpl;
-import org.openecomp.appc.lifecyclemanager.objects.LifecycleException;
-import org.openecomp.appc.lifecyclemanager.objects.NoTransitionDefinedException;
-import org.openecomp.appc.statemachine.objects.*;
-
-import java.util.*;
-
-
-public class TestLifecycleManager {
-
- private static final State[] VALID_LOCK_STATES = new State[] {
- new State("instantiated"),
- new State("configured"),
- new State("tested"),
- new State("running"),
- new State("error"),
- new State("unknown"),
- new State("created"),
- new State("not orchestrated"),
- new State("stopped"),
- };
-
- @Test
- public void handleEvent() throws InvalidInputException, LifecycleException, NoTransitionDefinedException {
-
- MetadataReader metadataReader = new MetadataReader();
- StateMachineMetadata metadata = metadataReader.readMetadata(null);
-
- LifecycleManagerImpl lifecycleManager = new LifecycleManagerImpl();
-
- /*
- Testing Positive Scenario passing the valid events and validating the StateMachineResponse
- */
- for(State state:metadata.getStates()){
-
- for(Transition transition:state.getTransitions()){
- Event event = transition.getEvent();
- State nextStateFromMetadata = transition.getNextState();
-
- String expectedNextState = lifecycleManager.getNextState(null,state.toString(),event.toString());
- Assert.assertEquals(expectedNextState,nextStateFromMetadata.toString());
- }
- }
-
- /*
- Testing Negative Scenarios, 1. Passing the valid Events for which Transition is not defined in
- Metadata and validating the StateMachineResponse 2. Passing the invalid events which are not
- registered as events in the StateMachineMetadata and validating StateMachineResponse
- */
- for(State state:metadata.getStates()){
-
- for(Transition transition:state.getTransitions()){
- List<Event> negativeEvents = getNegativeEvents(state,metadata.getEvents());
-
- for(Event negativeEvent:negativeEvents){
- boolean flag =false;
- try{
- String response = lifecycleManager.getNextState(null,state.toString(),negativeEvent.toString());
-
- }
- catch (NoTransitionDefinedException e){
- flag =true;
- }
- Assert.assertEquals(flag,true);
-
- flag =false;
- try{
- String response = lifecycleManager.getNextState(null,state.toString(),"PUT");
- }
- catch(LifecycleException e){
- flag = true;
- }
- Assert.assertTrue(flag);
-
- }
- }
- }
- }
-
- @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);
-
- for(Transition transition: state.getTransitions()){
- negativeEventList.remove(transition.getEvent());
- }
- return negativeEventList;
- }
-
- @Test
- public void testLockStates() throws LifecycleException, NoTransitionDefinedException {
- MetadataReader metadataReader = new MetadataReader();
- StateMachineMetadata metadata = metadataReader.readMetadata(null);
- LifecycleManager lifecycleManager = new LifecycleManagerImpl();
- for(State state: metadata.getStates()) {
- if(isValidState(state, VALID_LOCK_STATES)) {
- assertSameNextState(lifecycleManager, state, VNFOperation.Lock);
- assertSameNextState(lifecycleManager, state, VNFOperation.Unlock);
- assertSameNextState(lifecycleManager, state, VNFOperation.CheckLock);
- } else {
- assertNoNextState(lifecycleManager, state, VNFOperation.Lock);
- assertNoNextState(lifecycleManager, state, VNFOperation.Unlock);
- assertNoNextState(lifecycleManager, state, VNFOperation.CheckLock);
- }
- }
- }
-
- private boolean isValidState(State state, State[] validStates) {
- for(State validState: validStates) {
- if(validState.equals(state)) {
- return true;
- }
- }
- return false;
- }
-
- private void assertSameNextState(LifecycleManager lifecycleManager, State state, VNFOperation operation) throws LifecycleException, NoTransitionDefinedException {
- Assert.assertEquals(state.getStateName(), lifecycleManager.getNextState("no-matter", state.getStateName(), operation.toString()));
- }
-
- private void assertNoNextState(LifecycleManager lifecycleManager, State state, VNFOperation operation) throws LifecycleException {
- try {
- lifecycleManager.getNextState("no-matter", state.getStateName(), operation.toString());
- Assert.fail("lifecycleManager.getNextState() should fail for state [" + state + "], operation [" + operation + "]");
- } catch(NoTransitionDefinedException e) {
- // this exception is excepted
- }
- }
-}
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openecomp.appc.exceptions.InvalidInputException;
+import org.openecomp.appc.lifecyclemanager.LifecycleManager;
+import org.openecomp.appc.statemachine.StateMetaDataReader;
+import org.openecomp.appc.lifecyclemanager.impl.LifecycleManagerImpl;
+import org.openecomp.appc.lifecyclemanager.objects.LifecycleException;
+import org.openecomp.appc.lifecyclemanager.objects.NoTransitionDefinedException;
+import org.openecomp.appc.statemachine.impl.readers.VnfMetaDataReader;
+import org.openecomp.appc.statemachine.impl.readers.VnfMetaDataReader.VNFOperation;
+import org.openecomp.appc.statemachine.objects.Event;
+import org.openecomp.appc.statemachine.objects.State;
+import org.openecomp.appc.statemachine.objects.StateMachineMetadata;
+import org.openecomp.appc.statemachine.objects.Transition;
+
+import java.util.*;
+
+
+public class LifecycleManagerTest {
+
+ 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("created"),
+ new State("not orchestrated"),
+ new State("stopped"),
+ };
+
+ @Test
+ public void handleEvent() throws InvalidInputException, LifecycleException, NoTransitionDefinedException {
+
+ StateMachineMetadata metadata = getMetaDataReader().readMetadata();
+ LifecycleManagerImpl lifecycleManager = new LifecycleManagerImpl();
+
+ /*
+ * Testing Positive Scenario passing the valid events and validating the StateMachineResponse
+ */
+ for(State state:metadata.getStates()){
+
+ for(Transition transition:state.getTransitions()){
+ Event event = transition.getEvent();
+ State nextStateFromMetadata = transition.getNextState();
+
+ String expectedNextState = lifecycleManager.getNextState(null,state.toString(),event.toString());
+ Assert.assertEquals(expectedNextState,nextStateFromMetadata.toString());
+ }
+ }
+
+ /*
+ Testing Negative Scenarios, 1. Passing the valid Events for which Transition is not defined in
+ Metadata and validating the StateMachineResponse 2. Passing the invalid events which are not
+ registered as events in the StateMachineMetadata and validating StateMachineResponse
+ */
+ for(State state:metadata.getStates()){
+
+ for(Transition transition:state.getTransitions()){
+ List<Event> negativeEvents = getNegativeEvents(state,metadata.getEvents());
+
+ for(Event negativeEvent:negativeEvents){
+ boolean flag =false;
+ try{
+ lifecycleManager.getNextState(null,state.toString(),negativeEvent.toString());
+
+ }
+ catch (NoTransitionDefinedException e){
+ flag =true;
+ }
+ Assert.assertEquals(flag,true);
+
+ flag = false;
+ try{
+ lifecycleManager.getNextState(null,state.toString(),"PUT");
+ }
+ catch(LifecycleException e){
+ flag = true;
+ }
+ Assert.assertTrue(flag);
+
+ }
+ }
+ }
+ }
+
+ @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();
+ 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);
+
+ for(Transition transition: state.getTransitions()){
+ negativeEventList.remove(transition.getEvent());
+ }
+ return negativeEventList;
+ }
+
+ @Test
+ public void testLockStates() throws LifecycleException, NoTransitionDefinedException {
+ StateMachineMetadata metadata = getMetaDataReader().readMetadata();
+ LifecycleManagerImpl lifecycleManager = new LifecycleManagerImpl();
+
+ for(State state: metadata.getStates()) {
+ if(isValidState(state, VALID_LOCK_STATES)) {
+ assertSameNextState(lifecycleManager, state, VNFOperation.Lock);
+ assertSameNextState(lifecycleManager, state, VnfMetaDataReader.VNFOperation.Unlock);
+ assertSameNextState(lifecycleManager, state, VNFOperation.CheckLock);
+ } else {
+ assertNoNextState(lifecycleManager, state, VNFOperation.Lock);
+ assertNoNextState(lifecycleManager, state, VNFOperation.Unlock);
+ assertNoNextState(lifecycleManager, state, VNFOperation.CheckLock);
+ }
+ }
+ }
+
+ private boolean isValidState(State state, State[] validStates) {
+ for(State validState: validStates) {
+ if(validState.equals(state)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void assertSameNextState(LifecycleManager lifecycleManager, State state, VNFOperation operation)
+ throws LifecycleException, NoTransitionDefinedException {
+ Assert.assertEquals(state.getStateName(),
+ lifecycleManager.getNextState("no-matter", state.getStateName(), operation.toString()));
+ }
+
+ private void assertNoNextState(LifecycleManager lifecycleManager, State state, VNFOperation operation)
+ throws LifecycleException {
+ try {
+ lifecycleManager.getNextState("no-matter", state.getStateName(), operation.toString());
+ Assert.fail("lifecycleManager.getNextState() should fail for state [" + state
+ + "], operation [" + operation + "]");
+ } catch(NoTransitionDefinedException e) {
+ // this exception is excepted
+ }
+ }
+
+ private StateMetaDataReader getMetaDataReader() {
+ return new VnfMetaDataReader();
+ }
+}
diff --git a/appc-lifecycle-management/appc-lifecycle-management-core/src/test/java/org/openecomp/appc/OamLifeCycleManagerTest.java b/appc-lifecycle-management/appc-lifecycle-management-core/src/test/java/org/openecomp/appc/OamLifeCycleManagerTest.java
new file mode 100644
index 000000000..d3fe3eae7
--- /dev/null
+++ b/appc-lifecycle-management/appc-lifecycle-management-core/src/test/java/org/openecomp/appc/OamLifeCycleManagerTest.java
@@ -0,0 +1,152 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.openecomp.appc.lifecyclemanager.impl.LifecycleManagerImpl;
+import org.openecomp.appc.lifecyclemanager.objects.LifecycleException;
+import org.openecomp.appc.lifecyclemanager.objects.NoTransitionDefinedException;
+import org.openecomp.appc.statemachine.impl.readers.AppcOamMetaDataReader;
+import org.openecomp.appc.statemachine.impl.readers.AppcOamStates;
+
+import java.util.Arrays;
+import java.util.List;
+
+
+public class OamLifeCycleManagerTest {
+ private static final String VNF_TYPE_APPC = "APPC";
+ private static final String NO_DEFINITION_FORMAT = "No Transition Defined for currentState = %s, event = %s";
+
+ private LifecycleManagerImpl lifecycleManager;
+
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
+ @Before
+ public void setUp() throws Exception {
+ lifecycleManager = new LifecycleManagerImpl();
+ }
+
+ private void validateProper(String state, String event, String expectedResult)
+ throws LifecycleException, NoTransitionDefinedException {
+ String nextState = lifecycleManager.getNextState(VNF_TYPE_APPC, state, event);
+ Assert.assertEquals(String.format("Should return %s", expectedResult), expectedResult, nextState);
+ }
+
+ private void validateException(String state, String event) throws LifecycleException, NoTransitionDefinedException {
+ expectedException.expect(NoTransitionDefinedException.class);
+ expectedException.expectMessage(String.format(NO_DEFINITION_FORMAT, state, event));
+ lifecycleManager.getNextState(VNF_TYPE_APPC, state, event);
+
+ // Reset to no expectation
+ expectedException = ExpectedException.none();
+ }
+
+ @Test
+ public void testOamStateTransitionForMaintenanceMode() throws Exception {
+ String event = AppcOamMetaDataReader.AppcOperation.MaintenanceMode.name();
+ String expecteResult = AppcOamStates.EnteringMaintenanceMode.toString();
+
+ for (AppcOamStates appcOamStates : AppcOamStates.values()) {
+ String state = appcOamStates.toString();
+ if (appcOamStates == AppcOamStates.Started) {
+ validateProper(state, event, expecteResult);
+ } else {
+ validateException(state, event);
+ }
+ }
+ }
+
+ @Test
+ public void testOamStateTransitionForStart() throws Exception {
+ String event = AppcOamMetaDataReader.AppcOperation.Start.name();
+ String expectResult = AppcOamStates.Starting.toString();
+
+ List<AppcOamStates> goodStates = Arrays.asList(
+ AppcOamStates.MaintenanceMode,
+ AppcOamStates.Stopped,
+ AppcOamStates.Stopping);
+
+ for (AppcOamStates appcOamStates : AppcOamStates.values()) {
+ String state = appcOamStates.toString();
+ if (goodStates.contains(appcOamStates)) {
+ validateProper(state, event, expectResult);
+ } else {
+ validateException(state, event);
+ }
+ }
+ }
+
+ @Test
+ public void testOamStateTransitionForStop() throws Exception {
+ String event = AppcOamMetaDataReader.AppcOperation.Stop.name();
+ String expectResult = AppcOamStates.Stopping.toString();
+
+ List<AppcOamStates> goodStates = Arrays.asList(
+ AppcOamStates.Error,
+ AppcOamStates.EnteringMaintenanceMode,
+ AppcOamStates.MaintenanceMode,
+ AppcOamStates.Started,
+ AppcOamStates.Starting);
+
+ for (AppcOamStates appcOamStates : AppcOamStates.values()) {
+ String state = appcOamStates.toString();
+ if (goodStates.contains(appcOamStates)) {
+ validateProper(state, event, expectResult);
+ } else {
+ validateException(state, event);
+ }
+ }
+ }
+
+
+ @Test
+ public void testOamStateTransitionForRestart() throws Exception {
+ String event = AppcOamMetaDataReader.AppcOperation.Restart.name();
+ String expectResult = AppcOamStates.Restarting.toString();
+
+ List<AppcOamStates> goodStates = Arrays.asList(
+ AppcOamStates.Error,
+ AppcOamStates.EnteringMaintenanceMode,
+ AppcOamStates.MaintenanceMode,
+ AppcOamStates.Started,
+ AppcOamStates.Starting,
+ AppcOamStates.Stopped,
+ AppcOamStates.Stopping);
+
+ for (AppcOamStates appcOamStates : AppcOamStates.values()) {
+ String state = appcOamStates.toString();
+ if (goodStates.contains(appcOamStates)) {
+ validateProper(state, event, expectResult);
+ } else {
+ validateException(state, event);
+ }
+ }
+ }
+}
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/.gitignore b/appc-lifecycle-management/appc-lifecycle-management-features/.gitignore
index b83d22266..b83d22266 100644
--- a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-core/.gitignore
+++ b/appc-lifecycle-management/appc-lifecycle-management-features/.gitignore
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-features/pom.xml b/appc-lifecycle-management/appc-lifecycle-management-features/pom.xml
index afd2581df..c3ceedc03 100644
--- a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-features/pom.xml
+++ b/appc-lifecycle-management/appc-lifecycle-management-features/pom.xml
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>appc-lifecycle-management</artifactId>
<groupId>org.openecomp.appc</groupId>
<version>1.1.0-SNAPSHOT</version>
</parent>
+ <modelVersion>4.0.0</modelVersion>
<name>appc-lifecycle-management-features</name>
<artifactId>appc-lifecycle-management-features</artifactId>
@@ -46,32 +46,6 @@
</execution>
</executions>
</plugin>
- <!--<plugin>
- &lt;!&ndash; launches the feature test, which validates that your karaf feature
- can be installed inside of a karaf container. It doesn't validate that your
- functionality works correctly, just that you have all of the dependent bundles
- defined correctly. &ndash;&gt;
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.16</version>
- <configuration>
- <systemPropertyVariables>
- <karaf.distro.groupId>org.opendaylight.controller</karaf.distro.groupId>
- <karaf.distro.artifactId>opendaylight-karaf-empty</karaf.distro.artifactId>
- <karaf.distro.version>${odl.karaf.empty.distro.version}</karaf.distro.version>
- </systemPropertyVariables>
- <dependenciesToScan>
- <dependency>org.opendaylight.yangtools:features-test</dependency>
- </dependenciesToScan>
- <classpathDependencyExcludes>
- &lt;!&ndash; The dependencies which bring in AbstractDataBrokerTest class
- brings in a second PaxExam container which results in the feature tests failing
- with a message similar to: "ERROR o.ops4j.pax.exam.spi.PaxExamRuntime - Ambiguous
- TestContainer ..." This excludes the container we don't want to use. &ndash;&gt;
- <classpathDependencyExcludes>org.ops4j.pax.exam:pax-exam-container-native</classpathDependencyExcludes>
- </classpathDependencyExcludes>
- </configuration>
- </plugin>-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-features/src/main/resources/features.xml b/appc-lifecycle-management/appc-lifecycle-management-features/src/main/resources/features.xml
index dac925d8f..9700f77b7 100644
--- a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-features/src/main/resources/features.xml
+++ b/appc-lifecycle-management/appc-lifecycle-management-features/src/main/resources/features.xml
@@ -1,38 +1,38 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
============LICENSE_START=======================================================
ONAP : APPC
================================================================================
Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
================================================================================
- Copyright (C) 2017 Amdocs
- =============================================================================
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
+ Copyright (C) 2017 Amdocs
+ =============================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
ECOMP is a trademark and service mark of AT&T Intellectual Property.
- ============LICENSE_END=========================================================
- -->
-
-
-<features name="appc-lifecycle-management-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
-
- <feature name='appc-lifecycle-management' description="application executor" version='${project.version}'>
- <bundle dependency="true">mvn:org.openecomp.appc/domain-model-lib/${project.version}</bundle>
- <bundle>mvn:org.openecomp.appc/state-machine-lib/${project.version}</bundle>
- <bundle>mvn:org.openecomp.appc/appc-lifecycle-management-api/${project.version}</bundle>
- <bundle>mvn:org.openecomp.appc/appc-lifecycle-management-core/${project.version}</bundle>
- </feature>
-
-</features>
+ ============LICENSE_END=========================================================
+ -->
+
+
+<features name="appc-lifecycle-management-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
+
+ <feature name='appc-lifecycle-management' description="application executor" version='${project.version}'>
+ <bundle dependency="true">mvn:org.openecomp.appc/appc-common/${project.version}</bundle>
+ <bundle>mvn:org.openecomp.appc/state-machine-lib/${project.version}</bundle>
+ <bundle>mvn:org.openecomp.appc/appc-lifecycle-management-api/${project.version}</bundle>
+ <bundle>mvn:org.openecomp.appc/appc-lifecycle-management-core/${project.version}</bundle>
+ </feature>
+
+</features>
diff --git a/appc-lifecycle-management/appc-lifecycle-management-installer/.gitignore b/appc-lifecycle-management/appc-lifecycle-management-installer/.gitignore
new file mode 100644
index 000000000..731eb433c
--- /dev/null
+++ b/appc-lifecycle-management/appc-lifecycle-management-installer/.gitignore
@@ -0,0 +1,2 @@
+/target/
+/.settings/
diff --git a/appc-lifecycle-management/appc-lifecycle-management-installer/pom.xml b/appc-lifecycle-management/appc-lifecycle-management-installer/pom.xml
new file mode 100644
index 000000000..f9d70452a
--- /dev/null
+++ b/appc-lifecycle-management/appc-lifecycle-management-installer/pom.xml
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-lifecycle-management</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>appc-lifecycle-management-installer</artifactId>
+ <name>APPC LifeCycle Management - Karaf Installer</name>
+ <packaging>pom</packaging>
+
+ <properties>
+ <application.name>appc-lifecycle-management</application.name>
+ <features.boot>appc-lifecycle-management</features.boot>
+ <features.repositories>
+ mvn:org.openecomp.appc/appc-lifecycle-management-features/${project.version}/xml/features
+ </features.repositories>
+ <include.transitive.dependencies>false</include.transitive.dependencies>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-lifecycle-management-features</artifactId>
+ <version>${project.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-lifecycle-management-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-lifecycle-management-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>maven-repo-zip</id>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <appendAssemblyId>false</appendAssemblyId>
+ <attach>false</attach>
+ <finalName>stage/${application.name}-${project.version}</finalName>
+ <descriptors>
+ <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ <execution>
+ <id>installer-zip</id>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <appendAssemblyId>false</appendAssemblyId>
+ <attach>true</attach>
+ <finalName>${application.name}-${project.version}</finalName>
+ <descriptors>
+ <descriptor>src/assembly/assemble_installer_zip.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-dependencies</id>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <phase>prepare-package</phase>
+ <configuration>
+ <outputDirectory>${project.build.directory}/assembly/system</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ <overWriteIfNewer>true</overWriteIfNewer>
+ <useRepositoryLayout>true</useRepositoryLayout>
+ <addParentPoms>false</addParentPoms>
+ <copyPom>false</copyPom>
+ <excludeGroupIds>org.opendaylight</excludeGroupIds>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-version</id>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <!-- here the phase you need -->
+ <phase>validate</phase>
+ <configuration>
+ <outputDirectory>${basedir}/target/stage</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/resources/scripts</directory>
+ <includes>
+ <include>install-feature.sh</include>
+ </includes>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/appc-lifecycle-management/appc-lifecycle-management-installer/src/assembly/assemble_installer_zip.xml b/appc-lifecycle-management/appc-lifecycle-management-installer/src/assembly/assemble_installer_zip.xml
new file mode 100644
index 000000000..4b7b6f3ec
--- /dev/null
+++ b/appc-lifecycle-management/appc-lifecycle-management-installer/src/assembly/assemble_installer_zip.xml
@@ -0,0 +1,60 @@
+<!--
+ ============LICENSE_START=======================================================
+ ONAP : APPC
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ Copyright (C) 2017 Amdocs
+ =============================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ ============LICENSE_END=========================================================
+ -->
+
+<!-- Defines how we build the .zip file which is our distribution. -->
+
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+ <id>controller</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <!-- we want "system" and related files right at the root level
+ as this file is suppose to be unzip on top of a karaf
+ distro. -->
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <fileSet>
+ <directory>target/stage/</directory>
+ <outputDirectory>${application.name}</outputDirectory>
+ <fileMode>755</fileMode>
+ <includes>
+ <include>*.sh</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>target/stage/</directory>
+ <outputDirectory>${application.name}</outputDirectory>
+ <fileMode>644</fileMode>
+ <excludes>
+ <exclude>*.sh</exclude>
+ </excludes>
+ </fileSet>
+ </fileSets>
+
+</assembly>
diff --git a/appc-lifecycle-management/appc-lifecycle-management-installer/src/assembly/assemble_mvnrepo_zip.xml b/appc-lifecycle-management/appc-lifecycle-management-installer/src/assembly/assemble_mvnrepo_zip.xml
new file mode 100644
index 000000000..e735845e5
--- /dev/null
+++ b/appc-lifecycle-management/appc-lifecycle-management-installer/src/assembly/assemble_mvnrepo_zip.xml
@@ -0,0 +1,51 @@
+<!--
+ ============LICENSE_START=======================================================
+ ONAP : APPC
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ Copyright (C) 2017 Amdocs
+ =============================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ ============LICENSE_END=========================================================
+ -->
+
+<!-- Defines how we build the .zip file which is our distribution. -->
+
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0
+ http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+ <id>controller</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <!-- we want "system" and related files right at the root level
+ as this file is suppose to be unzip on top of a karaf
+ distro. -->
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <fileSet>
+ <directory>target/assembly/</directory>
+ <outputDirectory>.</outputDirectory>
+ <excludes>
+ </excludes>
+ </fileSet>
+ </fileSets>
+
+</assembly>
diff --git a/appc-lifecycle-management/appc-lifecycle-management-installer/src/main/resources/scripts/install-feature.sh b/appc-lifecycle-management/appc-lifecycle-management-installer/src/main/resources/scripts/install-feature.sh
new file mode 100644
index 000000000..4a7e7a1a4
--- /dev/null
+++ b/appc-lifecycle-management/appc-lifecycle-management-installer/src/main/resources/scripts/install-feature.sh
@@ -0,0 +1,63 @@
+###
+# ============LICENSE_START=======================================================
+# ONAP : APPC
+# ================================================================================
+# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Copyright (C) 2017 Amdocs
+# =============================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+# ============LICENSE_END=========================================================
+###
+
+#!/bin/bash
+
+ODL_HOME=${ODL_HOME:-/opt/opendaylight/current}
+ODL_KARAF_CLIENT=${ODL_KARAF_CLIENT:-${ODL_HOME}/bin/client}
+ODL_KARAF_CLIENT_OPTS=${ODL_KARAF_CLIENT_OPTS:-"-u karaf"}
+INSTALLERDIR=$(dirname $0)
+
+REPOZIP=${INSTALLERDIR}/${features.boot}-${project.version}.zip
+
+if [ -f ${REPOZIP} ]
+then
+ unzip -n -d ${ODL_HOME} ${REPOZIP}
+else
+ echo "ERROR : repo zip ($REPOZIP) not found"
+ exit 1
+fi
+
+COUNT=0
+while [ $COUNT -lt 10 ]; do
+ ${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:repo-add ${features.repositories} 2> /tmp/installErr
+ cat /tmp/installErr
+ if grep -q 'Failed to get the session' /tmp/installErr; then
+ sleep 10
+ else
+ let COUNT=10
+ fi
+ let COUNT=COUNT+1
+done
+COUNT=0
+while [ $COUNT -lt 10 ]; do
+ ${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:install ${features.boot} 2> /tmp/installErr
+ cat /tmp/installErr
+ if grep -q 'Failed to get the session' /tmp/installErr; then
+ sleep 10
+ else
+ let COUNT=10
+ fi
+ let COUNT=COUNT+1
+done
diff --git a/appc-lifecycle-management/pom.xml b/appc-lifecycle-management/pom.xml
new file mode 100644
index 000000000..9b5dcfe0d
--- /dev/null
+++ b/appc-lifecycle-management/pom.xml
@@ -0,0 +1,50 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>appc-lifecycle-management</artifactId>
+ <packaging>pom</packaging>
+ <name>APPC Lifecycle Management</name>
+ <description>APPC Lifecycle Management</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+ <!-- ================================================================================== -->
+ <!-- The modules we build -->
+ <!-- ================================================================================== -->
+ <modules>
+ <module>appc-lifecycle-management-api</module>
+ <module>state-machine-lib</module>
+ <module>appc-lifecycle-management-core</module>
+ <module>appc-lifecycle-management-features</module>
+ <module>appc-lifecycle-management-installer</module>
+ </modules>
+
+</project> \ No newline at end of file
diff --git a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-features/.gitignore b/appc-lifecycle-management/state-machine-lib/.gitignore
index b83d22266..b83d22266 100644
--- a/appc-dispatcher/appc-lifecycle-management/appc-lifecycle-management-features/.gitignore
+++ b/appc-lifecycle-management/state-machine-lib/.gitignore
diff --git a/appc-dispatcher/appc-lifecycle-management/.settings/org.eclipse.wst.common.project.facet.core.xml b/appc-lifecycle-management/state-machine-lib/.settings/org.eclipse.wst.common.project.facet.core.xml
index f4ef8aa0a..f4ef8aa0a 100644
--- a/appc-dispatcher/appc-lifecycle-management/.settings/org.eclipse.wst.common.project.facet.core.xml
+++ b/appc-lifecycle-management/state-machine-lib/.settings/org.eclipse.wst.common.project.facet.core.xml
diff --git a/appc-lifecycle-management/state-machine-lib/pom.xml b/appc-lifecycle-management/state-machine-lib/pom.xml
new file mode 100644
index 000000000..9618d61b3
--- /dev/null
+++ b/appc-lifecycle-management/state-machine-lib/pom.xml
@@ -0,0 +1,42 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-lifecycle-management</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>state-machine-lib</artifactId>
+ <packaging>bundle</packaging>
+
+ <name>state-machine-lib</name>
+ <url>http://maven.apache.org</url>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-lifecycle-management-api</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+ <Bundle-Version>${project.version}</Bundle-Version>
+ <Export-Package>org.openecomp.appc.statemachine.*</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/StateMachine.java b/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/StateMachine.java
index dc1c01512..1c74861c3 100644
--- a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/StateMachine.java
+++ b/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/StateMachine.java
@@ -1,32 +1,34 @@
-/*-
+/*-
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.statemachine;
-
-import org.openecomp.appc.statemachine.objects.*;
-
-
-public interface StateMachine {
- StateMachineResponse handleEvent(State currentState, Event event) throws InvalidInputException;
-}
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.statemachine;
+
+import org.openecomp.appc.exceptions.InvalidInputException;
+import org.openecomp.appc.statemachine.objects.Event;
+import org.openecomp.appc.statemachine.objects.State;
+import org.openecomp.appc.statemachine.objects.StateMachineResponse;
+
+public interface StateMachine {
+ StateMachineResponse handleEvent(State currentState, Event event) throws InvalidInputException;
+}
diff --git a/appc-dispatcher/appc-dispatcher-common/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/StateMetaDataReader.java
index 66672a548..0ddbd2f90 100644
--- a/appc-dispatcher/appc-dispatcher-common/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/StateMetaDataReader.java
@@ -1,62 +1,31 @@
-/*-
+/*-
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.statemachine.objects;
-
-public class Event{
-
- private String eventName;
-
- private Event(){
-
- }
- @Override
- public int hashCode(){
- return this.eventName.hashCode();
- }
- @Override
- public boolean equals(Object obj){
- if(obj == null){
- return false;
- }
- if(!(obj instanceof Event)){
- return false;
- }
- Event event = (Event)obj;
- return this.eventName.equals(event.getEventName());
- }
-
- public Event(String eventName){
- this();
- this.eventName = eventName;
- }
-
- public String getEventName() {
- return eventName;
- }
- @Override
- public String toString(){
- return this.eventName;
- }
-}
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.statemachine;
+
+import org.openecomp.appc.statemachine.objects.StateMachineMetadata;
+
+public interface StateMetaDataReader {
+ StateMachineMetadata readMetadata();
+}
diff --git a/appc-dispatcher/appc-dispatcher-common/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 034091839..6c7951f84 100644
--- a/appc-dispatcher/appc-dispatcher-common/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
@@ -1,46 +1,40 @@
-/*-
+/*-
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.statemachine.impl;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.openecomp.appc.statemachine.StateMachine;
-import org.openecomp.appc.statemachine.objects.Event;
-import org.openecomp.appc.statemachine.objects.State;
-import org.openecomp.appc.statemachine.objects.StateMachineMetadata;
-
-
-public class StateMachineFactory {
-
- private StateMachineFactory(){
-
- }
-
- public static StateMachine getStateMachine(StateMachineMetadata metadata){
- StateMachine machine = new StateMachineImpl(metadata);
- return machine;
- }
-}
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.statemachine.impl;
+
+import org.openecomp.appc.statemachine.StateMachine;
+import org.openecomp.appc.statemachine.objects.StateMachineMetadata;
+
+
+public class StateMachineFactory {
+
+ private StateMachineFactory(){
+
+ }
+
+ public static StateMachine getStateMachine(StateMachineMetadata metadata){
+ return new StateMachineImpl(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
new file mode 100644
index 000000000..124cf36d1
--- /dev/null
+++ b/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/StateMachineImpl.java
@@ -0,0 +1,98 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.statemachine.impl;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.openecomp.appc.exceptions.InvalidInputException;
+import org.openecomp.appc.statemachine.StateMachine;
+import org.openecomp.appc.statemachine.objects.Event;
+import org.openecomp.appc.statemachine.objects.Response;
+import org.openecomp.appc.statemachine.objects.State;
+import org.openecomp.appc.statemachine.objects.StateMachineMetadata;
+import org.openecomp.appc.statemachine.objects.StateMachineResponse;
+import org.openecomp.appc.statemachine.objects.Transition;
+
+
+public class StateMachineImpl implements StateMachine {
+
+ private final Set<State> states;
+
+ private final Set<Event> events;
+
+ StateMachineImpl(StateMachineMetadata metadata){
+ this.states = new HashSet<>();
+ this.states.addAll(metadata.getStates());
+ this.events = new HashSet<>();
+ this.events.addAll(metadata.getEvents());
+ }
+
+ 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 );
+ }
+
+ StateMachineResponse response = new StateMachineResponse();
+ State currentState = null,nextState = null;
+ for(State stateInSet:states){
+ if(stateInSet.equals(inputState)){
+ currentState = stateInSet;
+ break;
+ }
+ }
+ if (currentState != null) {
+ for (Transition transition : currentState.getTransitions()) {
+ if (event.equals(transition.getEvent())) {
+ nextState = transition.getNextState();
+ }
+ }
+ }
+ if(nextState == null){
+ response.setResponse(Response.NO_TRANSITION_DEFINED);
+ }
+ else if(inputState.equals(nextState)){
+ response.setResponse(Response.NO_STATE_CHANGE);
+ }
+ else{
+ response.setResponse(Response.VALID_TRANSITION);
+ }
+ response.setNextState(nextState);
+ return response;
+ }
+
+ private 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 +
+ '}';
+ }
+}
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
new file mode 100644
index 000000000..e160e7f0e
--- /dev/null
+++ b/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/readers/AppcOamMetaDataReader.java
@@ -0,0 +1,107 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.statemachine.impl.readers;
+
+import org.openecomp.appc.statemachine.StateMetaDataReader;
+import org.openecomp.appc.statemachine.objects.Event;
+import org.openecomp.appc.statemachine.objects.State;
+import org.openecomp.appc.statemachine.objects.StateMachineMetadata;
+
+public class AppcOamMetaDataReader implements StateMetaDataReader {
+
+ public enum AppcOperation {
+ MaintenanceMode,
+ Restart,
+ Start,
+ Stop
+ }
+
+ @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());
+
+ 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());
+
+ 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.addEvent(START);
+ builder = builder.addEvent(STOP);
+ builder = builder.addEvent(RESTART);
+ builder = builder.addEvent(MAINTENANCE_MODE_EVENT);
+
+ /*
+ * 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);
+ // 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);
+ // maintenance mode
+ builder = builder.addTransition(
+ STARTED, MAINTENANCE_MODE_EVENT, ENTERING_MAINTENANCE_MODE);
+ // 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);
+
+ return builder.build();
+ }
+}
diff --git a/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/readers/AppcOamStates.java b/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/readers/AppcOamStates.java
new file mode 100644
index 000000000..2f000d9cd
--- /dev/null
+++ b/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/readers/AppcOamStates.java
@@ -0,0 +1,56 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.statemachine.impl.readers;
+
+import org.osgi.framework.Bundle;
+
+public enum AppcOamStates {
+ EnteringMaintenanceMode(0),
+ Error(0),
+ Instantiated(Bundle.INSTALLED),
+ MaintenanceMode(0),
+ NotInstantiated(Bundle.UNINSTALLED),
+ Restarting(0),
+ Started(Bundle.ACTIVE),
+ Starting(Bundle.STARTING),
+ Stopped(Bundle.RESOLVED),
+ Stopping(Bundle.STOPPING),
+ Unknown(0);
+
+ int osgiBundleState;
+
+ AppcOamStates(Integer bundleState) {
+ osgiBundleState = bundleState;
+ }
+
+ public static AppcOamStates getOamStateFromBundleState(int bundleState) {
+ for (AppcOamStates aState : values()) {
+ if (aState.osgiBundleState == bundleState) {
+ return aState;
+ }
+ }
+ return Unknown;
+ }
+}
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
new file mode 100644
index 000000000..e3e72f6d1
--- /dev/null
+++ b/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/impl/readers/VnfMetaDataReader.java
@@ -0,0 +1,483 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.statemachine.impl.readers;
+
+import org.openecomp.appc.statemachine.StateMetaDataReader;
+import org.openecomp.appc.lifecyclemanager.objects.VNFOperationOutcome;
+import org.openecomp.appc.statemachine.objects.Event;
+import org.openecomp.appc.statemachine.objects.State;
+import org.openecomp.appc.statemachine.objects.StateMachineMetadata;
+
+public class VnfMetaDataReader implements StateMetaDataReader {
+
+ public enum VNFOperation {
+
+ Configure, Test, HealthCheck, Start, Terminate, Restart, Rebuild, Stop, ConfigModify,
+ ConfigScaleOut,ConfigRestore,Backup, Snapshot,
+ SoftwareUpload, LiveUpgrade, Rollback, Sync, Audit, Test_lic, Migrate, Evacuate,
+ ConfigBackup, ConfigBackupDelete, ConfigExport,
+ Lock(true), Unlock(true), CheckLock(true), StartApplication,StopApplication;
+
+ private boolean builtIn;
+
+ VNFOperation(boolean builtIn) {
+ this.builtIn = builtIn;
+ }
+
+ VNFOperation() {
+ this(false);
+ }
+ }
+
+ 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"), Created;
+
+ String stateName;
+
+ VNFStates(String name) {
+ this.stateName = name;
+ }
+
+ VNFStates() {
+ this.stateName = name();
+ }
+
+ @Override
+ public String toString() {
+ return this.stateName;
+ }
+ }
+
+ 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();
+
+ }
+ }
+}
diff --git a/appc-dispatcher/appc-dispatcher-common/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/Event.java
index e2089f63a..0808b1b55 100644
--- a/appc-dispatcher/appc-dispatcher-common/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/Event.java
@@ -1,82 +1,65 @@
-/*-
+/*-
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.statemachine.objects;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-
-
-public class State{
- private String stateName;
- private List<Transition> transitions;
-
- private State(){
-
- }
-
- public State(String state){
- this();
- this.stateName = state;
- this.transitions = new ArrayList<Transition>();
- }
-
- @Override
- public int hashCode(){
- return this.stateName.hashCode();
- }
-
- @Override
- public boolean equals(Object obj){
- if(obj == null){
- return false;
- }
- if(!(obj instanceof State)){
- return false;
- }
- State state = (State)obj;
- return this.stateName.equals(state.getStateName());
- }
-
-
- public String getStateName(){
- return stateName;
- }
-
- void addTransition(Transition transition){
- this.transitions.add(transition);
- }
-
- public List<Transition> getTransitions() {
- return transitions;
- }
-
- @Override
- public String toString(){
- return this.stateName;
- }
-}
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.statemachine.objects;
+
+public class Event{
+
+ private String eventName;
+
+ private Event(){
+ // do nothing
+ }
+
+ @Override
+ public int hashCode(){
+ return this.eventName.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj){
+ if(obj == null){
+ return false;
+ }
+ if(!(obj instanceof Event)){
+ return false;
+ }
+ Event event = (Event)obj;
+ return this.eventName.equals(event.getEventName());
+ }
+
+ public Event(String eventName){
+ this();
+ this.eventName = eventName;
+ }
+
+ private String getEventName() {
+ return eventName;
+ }
+
+ @Override
+ public String toString(){
+ return this.eventName;
+ }
+}
diff --git a/appc-dispatcher/appc-dispatcher-common/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 073ee70a4..622a4274a 100644
--- a/appc-dispatcher/appc-dispatcher-common/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
@@ -1,33 +1,32 @@
-/*-
+/*-
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.statemachine.objects;
-
-
-public enum Response {
- NO_TRANSITION_DEFINED,NO_STATE_CHANGE,VALID_TRANSITION;
- public String toString(){
- return this.name();
- }
-}
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.statemachine.objects;
+
+public enum Response {
+ NO_TRANSITION_DEFINED,NO_STATE_CHANGE,VALID_TRANSITION;
+ 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
new file mode 100644
index 000000000..99d6a0ac2
--- /dev/null
+++ b/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/State.java
@@ -0,0 +1,77 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+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
+ }
+
+ public State(String state){
+ this();
+ this.stateName = state;
+ this.transitions = new ArrayList<>();
+ }
+
+ @Override
+ public int hashCode(){
+ return this.stateName.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj){
+ if(obj == null){
+ return false;
+ }
+ if(!(obj instanceof State)){
+ return false;
+ }
+ State state = (State)obj;
+ return this.stateName.equalsIgnoreCase(state.getStateName());
+ }
+
+ public String getStateName(){
+ return stateName;
+ }
+
+ void addTransition(Transition transition){
+ this.transitions.add(transition);
+ }
+
+ public List<Transition> getTransitions() {
+ return transitions;
+ }
+
+ @Override
+ public String toString(){
+ return this.stateName;
+ }
+}
diff --git a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/StateMachineMetadata.java b/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/StateMachineMetadata.java
index 18767fa59..5a8984c73 100644
--- a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/StateMachineMetadata.java
+++ b/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/StateMachineMetadata.java
@@ -1,82 +1,78 @@
-/*-
+/*-
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.statemachine.objects;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-
-public class StateMachineMetadata {
-
- Set<State> states;
- Set<Event> events;
-
- private StateMachineMetadata(StateMachineMetadataBuilder builder){
- states = builder.states;
- events = builder.events;
- }
-
- public Set<State> getStates() {
- return states;
- }
-
- public Set<Event> getEvents() {
- return events;
- }
-
- public static class StateMachineMetadataBuilder{
-
- private Set<State> states;
- private Set<Event> events;
-
- public StateMachineMetadataBuilder(){
- states = new HashSet<State>();
- events = new HashSet<Event>();
- }
-
- public StateMachineMetadataBuilder addState(State state){
- this.states.add(state);
- return this;
- }
-
- public StateMachineMetadataBuilder addEvent(Event event){
- this.events.add(event);
- return this;
- }
-
- public StateMachineMetadataBuilder addTransition(State currentState,Event event,State nextState){
- Transition transition = new Transition(event,nextState);
- currentState.addTransition(transition);
- return this;
- }
-
- public StateMachineMetadata build(){
- StateMachineMetadata machine = new StateMachineMetadata(this);
- return machine;
- }
- }
-}
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.statemachine.objects;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class StateMachineMetadata {
+
+ private Set<State> states;
+ private Set<Event> events;
+
+ private StateMachineMetadata(StateMachineMetadataBuilder builder){
+ states = builder.states;
+ events = builder.events;
+ }
+
+ public Set<State> getStates() {
+ return states;
+ }
+
+ public Set<Event> getEvents() {
+ return events;
+ }
+
+ public static class StateMachineMetadataBuilder{
+
+ private Set<State> states;
+ private Set<Event> events;
+
+ public StateMachineMetadataBuilder(){
+ states = new HashSet<>();
+ events = new HashSet<>();
+ }
+
+ public StateMachineMetadataBuilder addState(State state){
+ this.states.add(state);
+ return this;
+ }
+
+ public StateMachineMetadataBuilder addEvent(Event event){
+ this.events.add(event);
+ return this;
+ }
+
+ public StateMachineMetadataBuilder addTransition(State currentState,Event event,State nextState){
+ Transition transition = new Transition(event,nextState);
+ currentState.addTransition(transition);
+ return this;
+ }
+
+ public StateMachineMetadata build(){
+ return new StateMachineMetadata(this);
+ }
+ }
+}
diff --git a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/StateMachineResponse.java b/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/StateMachineResponse.java
index a6cab8be3..7f78087fa 100644
--- a/appc-dispatcher/appc-dispatcher-common/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/StateMachineResponse.java
+++ b/appc-lifecycle-management/state-machine-lib/src/main/java/org/openecomp/appc/statemachine/objects/StateMachineResponse.java
@@ -1,51 +1,51 @@
-/*-
+/*-
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.statemachine.objects;
-
-
-public class StateMachineResponse {
- State nextState;
- Response response;
-
- public StateMachineResponse(){
-
- }
-
- public State getNextState() {
- return nextState;
- }
-
- public Response getResponse() {
- return response;
- }
-
- public void setNextState(State nextState) {
- this.nextState = nextState;
- }
-
- public void setResponse(Response response) {
- this.response = response;
- }
-}
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.statemachine.objects;
+
+
+public class StateMachineResponse {
+ private State nextState;
+ private Response response;
+
+ public StateMachineResponse(){
+ // do nothing
+ }
+
+ public State getNextState() {
+ return nextState;
+ }
+
+ public Response getResponse() {
+ return response;
+ }
+
+ public void setNextState(State nextState) {
+ this.nextState = nextState;
+ }
+
+ public void setResponse(Response response) {
+ this.response = response;
+ }
+}
diff --git a/appc-dispatcher/appc-dispatcher-common/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 5bc94f45d..b050268eb 100644
--- a/appc-dispatcher/appc-dispatcher-common/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
@@ -1,48 +1,48 @@
-/*-
+/*-
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.appc.statemachine.objects;
-
-
-public class Transition {
- private Event event;
- private State nextState;
-
- private Transition(){
-
- }
- public Transition(Event event,State nextState){
- this();
- this.event = event;
- this.nextState = nextState;
- }
-
- public Event getEvent() {
- return event;
- }
-
- public State getNextState() {
- return nextState;
- }
-}
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.statemachine.objects;
+
+public class Transition {
+ private Event event;
+ private State nextState;
+
+ private Transition(){
+ // do nothing
+ }
+
+ Transition(Event event, State nextState){
+ this();
+ this.event = event;
+ this.nextState = nextState;
+ }
+
+ public Event getEvent() {
+ return event;
+ }
+
+ public State getNextState() {
+ return nextState;
+ }
+}
diff --git a/appc-lifecycle-management/state-machine-lib/src/test/java/org/openecomp/appc/statemachine/impl/readers/AppcOamStatesTest.java b/appc-lifecycle-management/state-machine-lib/src/test/java/org/openecomp/appc/statemachine/impl/readers/AppcOamStatesTest.java
new file mode 100644
index 000000000..af0823423
--- /dev/null
+++ b/appc-lifecycle-management/state-machine-lib/src/test/java/org/openecomp/appc/statemachine/impl/readers/AppcOamStatesTest.java
@@ -0,0 +1,71 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.statemachine.impl.readers;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class AppcOamStatesTest {
+
+ @Test
+ public void testBasicFunctions() {
+ AppcOamStates aState = AppcOamStates.EnteringMaintenanceMode;
+ Assert.assertEquals("name() does not match", "EnteringMaintenanceMode", aState.name());
+ Assert.assertEquals("toString() does not match", "EnteringMaintenanceMode", aState.toString());
+ Assert.assertEquals("osgiBundleState does not match", 0, aState.osgiBundleState);
+ }
+
+ @Test
+ public void testGetOamStateFromBundleState() {
+ Map<Integer, AppcOamStates> resultMap = new HashMap<Integer, AppcOamStates>() {
+ {
+ put(Bundle.UNINSTALLED, AppcOamStates.NotInstantiated);
+ put(Bundle.INSTALLED, AppcOamStates.Instantiated);
+ put(Bundle.RESOLVED, AppcOamStates.Stopped);
+ put(Bundle.STARTING, AppcOamStates.Starting);
+ put(Bundle.STOPPING, AppcOamStates.Stopping);
+ put(Bundle.ACTIVE, AppcOamStates.Started);
+ }
+ };
+ for (Map.Entry<Integer, AppcOamStates> aEntry : resultMap.entrySet()) {
+ Integer bundleState = aEntry.getKey();
+ AppcOamStates oamState = aEntry.getValue();
+ Assert.assertEquals(String.format("OSGI bundle state(%d) shoule associate with oamState(%s)",
+ bundleState, oamState), oamState, AppcOamStates.getOamStateFromBundleState(bundleState));
+ }
+
+ int bundleState = Bundle.START_TRANSIENT;
+ Assert.assertEquals(String.format("OSGI bundle state(%d) shoule associate with NotInstantiated state.",
+ bundleState), AppcOamStates.NotInstantiated, AppcOamStates.getOamStateFromBundleState(bundleState));
+
+ bundleState = Bundle.STOP_TRANSIENT;
+ Assert.assertEquals(String.format("OSGI bundle state(%d) shoule associate with NotInstantiated state.",
+ bundleState), AppcOamStates.NotInstantiated, AppcOamStates.getOamStateFromBundleState(bundleState));
+ }
+}
diff --git a/pom.xml b/pom.xml
index 169556567..fa874f67e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -98,7 +98,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
- <version>2.10.4</version>
+ <version>2.10</version>
<configuration>
<excludePackageNames>org.openecomp.sdnc</excludePackageNames>
<failOnError>false</failOnError>
@@ -591,7 +591,7 @@
</configuration> <executions> <execution> <id>create-bdio-file</id> <phase>package</phase>
<goals> <goal>build-bom</goal> </goals> </execution> </executions> </plugin> -->
- <!-- force Eclipse to skip the additional-install step specified in the
+ <!-- force Eclipse to skip the additional-install step specified in the
org.opendaylight.odlparent:odlparent-lite:1.7.1-Boron-SR1.pom profile -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -599,13 +599,9 @@
<executions>
<execution>
<id>additional-install</id>
- <phase></phase>
<goals>
<goal>install-file</goal>
</goals>
- <configuration>
- <skip>true</skip>
- </configuration>
</execution>
</executions>
</plugin>
@@ -640,6 +636,7 @@
<module>appc-provider</module>
<module>appc-event-listener</module>
<module>appc-asdc-listener</module>
+ <module>appc-lifecycle-management</module>
<module>appc-oam</module>
</modules>
</profile>