aboutsummaryrefslogtreecommitdiffstats
path: root/appc-sequence-generator/appc-sequence-generator-bundle/src
diff options
context:
space:
mode:
Diffstat (limited to 'appc-sequence-generator/appc-sequence-generator-bundle/src')
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/appc/sequencegenerator/impl/rev170706/SequenceGeneratorModule.java51
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/appc/sequencegenerator/impl/rev170706/SequenceGeneratorModuleFactory.java33
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/SequenceGenerator.java43
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/dgplugin/SequenceGeneratorPlugin.java31
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/dgplugin/impl/SequenceGeneratorPluginImpl.java243
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/impl/SequenceGeneratorFactory.java54
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/impl/StartSequenceGenerator.java291
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/impl/StopSequenceGenerator.java183
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/ActionIdentifier.java63
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/Constants.java123
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/PreCheckOption.java74
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/RequestInfo.java72
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/RequestInfoBuilder.java76
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/Response.java65
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/SequenceGeneratorInput.java93
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/SequenceGeneratorInputBuilder.java85
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/Transaction.java142
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/provider/SequenceGeneratorProvider.java352
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml29
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/main/resources/initial/appc-sequence-generator.xml71
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/main/resources/org.openecomp.appc/default.properties54
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/main/resources/org.openecomp.appc/logback.xml283
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/main/yang/sequence-generator.yang62
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/test/java/org/openecomp/appc/seqgen/TestSequenceGeneratorPlugin.java256
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/cyclic.json198
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/mandatory-vnfc.json177
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/missingrequestinfo.json186
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/no-strategy.json195
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/optional-vnfc-data.json196
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/optional-vnfc.json176
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/start-single-vm-duplicate.json92
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/start-single-vm-per-vnfc.json93
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/start-single-vm.json84
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/start-without-dependency.json156
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/start.json196
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/stop-action-level-val.json196
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/stop-single-vm-per-vnfc.json92
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/stop-single-vm.json84
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/stop-without-dep.json197
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/stop.json197
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/wrongaction.json196
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/wrongnumber.json196
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/optional-vnfc-with-data.json3
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/optional-vnfc.json3
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/start-single-vm-per-vnfc.json3
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/start-single-vm.json3
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/start-without-dependency.json3
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/start.json3
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/stop-single-vm-per-vnfc.json3
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/stop-single-vm.json3
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/stop-without-dep.json3
-rw-r--r--appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/stop.json3
52 files changed, 5766 insertions, 0 deletions
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/appc/sequencegenerator/impl/rev170706/SequenceGeneratorModule.java b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/appc/sequencegenerator/impl/rev170706/SequenceGeneratorModule.java
new file mode 100644
index 000000000..7fa1dcb4e
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/appc/sequencegenerator/impl/rev170706/SequenceGeneratorModule.java
@@ -0,0 +1,51 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.opendaylight.yang.gen.v1.org.openecomp.appc.sequencegenerator.impl.rev170706;
+
+import org.openecomp.appc.seqgen.provider.SequenceGeneratorProvider;
+
+public class SequenceGeneratorModule extends org.opendaylight.yang.gen.v1.org.openecomp.appc.sequencegenerator.impl.rev170706.AbstractSequenceGeneratorModule {
+ public SequenceGeneratorModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ super(identifier, dependencyResolver);
+ }
+
+ public SequenceGeneratorModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.org.openecomp.appc.sequencegenerator.impl.rev170706.SequenceGeneratorModule oldModule, java.lang.AutoCloseable oldInstance) {
+ super(identifier, dependencyResolver, oldModule, oldInstance);
+ }
+
+ @Override
+ public void customValidation() {
+ // add custom validation form module attributes here.
+ }
+
+ @Override
+ public java.lang.AutoCloseable createInstance() {
+ final SequenceGeneratorProvider provider = new SequenceGeneratorProvider(getDataBrokerDependency(), getNotificationServiceDependency(), getRpcRegistryDependency());
+ return new AutoCloseable() {
+
+ @Override
+ public void close() throws Exception {
+ provider.close();
+ }
+ };
+ }
+
+}
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/appc/sequencegenerator/impl/rev170706/SequenceGeneratorModuleFactory.java b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/appc/sequencegenerator/impl/rev170706/SequenceGeneratorModuleFactory.java
new file mode 100644
index 000000000..3ebba2076
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/appc/sequencegenerator/impl/rev170706/SequenceGeneratorModuleFactory.java
@@ -0,0 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/*
+* Generated file
+*
+* Generated from: yang module name: sequence-generator-impl yang module local name: sequence-generator-impl
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Thu Aug 10 15:48:17 IST 2017
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.yang.gen.v1.org.openecomp.appc.sequencegenerator.impl.rev170706;
+public class SequenceGeneratorModuleFactory extends org.opendaylight.yang.gen.v1.org.openecomp.appc.sequencegenerator.impl.rev170706.AbstractSequenceGeneratorModuleFactory {
+
+}
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/SequenceGenerator.java b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/SequenceGenerator.java
new file mode 100644
index 000000000..0eba668ef
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/SequenceGenerator.java
@@ -0,0 +1,43 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.seqgen;
+
+
+import org.openecomp.appc.dg.objects.VnfcFlowModel;
+import org.openecomp.appc.exceptions.APPCException;
+import org.openecomp.appc.seqgen.objects.SequenceGeneratorInput;
+import org.openecomp.appc.seqgen.objects.Transaction;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Sequence Generator API generates runtime sequence for LCM operations execution
+ */
+public interface SequenceGenerator {
+ /**
+ *
+ * @param input Sequence Generator Input containing request info, vnf capabilites and tunable parameters
+ * @return returns runtime sequence for LCM operation execution
+ * @throws APPCException
+ */
+ List<Transaction> generateSequence(SequenceGeneratorInput input) throws APPCException;
+}
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/dgplugin/SequenceGeneratorPlugin.java b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/dgplugin/SequenceGeneratorPlugin.java
new file mode 100644
index 000000000..2264751cf
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/dgplugin/SequenceGeneratorPlugin.java
@@ -0,0 +1,31 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.seqgen.dgplugin;
+
+import org.openecomp.sdnc.sli.SvcLogicContext;
+import org.openecomp.sdnc.sli.SvcLogicJavaPlugin;
+
+import java.util.Map;
+
+public interface SequenceGeneratorPlugin extends SvcLogicJavaPlugin{
+
+ void generateSequence(Map<String,String> params, SvcLogicContext context);
+}
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/dgplugin/impl/SequenceGeneratorPluginImpl.java b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/dgplugin/impl/SequenceGeneratorPluginImpl.java
new file mode 100644
index 000000000..6671203e7
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/dgplugin/impl/SequenceGeneratorPluginImpl.java
@@ -0,0 +1,243 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.seqgen.dgplugin.impl;
+
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.commons.lang3.StringUtils;
+import org.openecomp.appc.dg.objects.*;
+import org.openecomp.appc.domainmodel.Vnf;
+import org.openecomp.appc.domainmodel.Vnfc;
+import org.openecomp.appc.domainmodel.Vserver;
+import org.openecomp.appc.domainmodel.lcm.VNFOperation;
+import org.openecomp.appc.exceptions.APPCException;
+import org.openecomp.appc.seqgen.SequenceGenerator;
+import org.openecomp.appc.seqgen.dgplugin.SequenceGeneratorPlugin;
+import org.openecomp.appc.seqgen.impl.SequenceGeneratorFactory;
+import org.openecomp.appc.seqgen.objects.Constants;
+import org.openecomp.appc.seqgen.objects.SequenceGeneratorInput;
+import org.openecomp.appc.seqgen.objects.Transaction;
+import org.openecomp.sdnc.sli.SvcLogicContext;
+
+import java.io.IOException;
+import java.util.*;
+
+public class SequenceGeneratorPluginImpl implements SequenceGeneratorPlugin {
+
+ private static final EELFLogger logger = EELFManager.getInstance().getLogger(SequenceGeneratorPluginImpl.class);
+
+ @Override
+ public void generateSequence(Map<String, String> params, SvcLogicContext context) {
+ ObjectMapper objectMapper = new ObjectMapper();
+ String inputJSON = context.getAttribute("inputJSON");
+ logger.debug("Input to Sequence Generator " + inputJSON);
+ try {
+ SequenceGeneratorInput sequenceGeneratorInput = buildSequenceGeneratorInput(inputJSON);
+ List<Transaction> sequence = generateSequence(sequenceGeneratorInput);
+ String output = objectMapper.writeValueAsString(sequence);
+ logger.debug("Sequence Generator Output " + output);
+
+ context.setAttribute("output", output);
+ } catch (Exception e) {
+ logger.error("Error generating sequence", e);
+ context.setAttribute("error-code", "401");
+ context.setAttribute("error-message", "Error generating sequence " + e.getMessage());
+ }
+ }
+
+ private SequenceGeneratorInput buildSequenceGeneratorInput(String inputJson) throws IOException, APPCException {
+ ObjectMapper objectMapper = new ObjectMapper();
+ SequenceGeneratorInput sequenceGeneratorInput ;
+ objectMapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
+ objectMapper.configure(JsonParser.Feature.ALLOW_COMMENTS, true);
+ sequenceGeneratorInput = objectMapper.readValue(inputJson, SequenceGeneratorInput.class);
+
+ InventoryModel inventoryModel = buildInventoryModel(inputJson);
+ sequenceGeneratorInput.setInventoryModel(inventoryModel);
+
+ VnfcDependencyModel dependencyModel = buildDependencyModel(inputJson);
+ sequenceGeneratorInput.setDependencyModel(dependencyModel);
+
+ return sequenceGeneratorInput;
+ }
+ private List<Transaction> generateSequence(SequenceGeneratorInput sequenceGeneratorInput) throws APPCException {
+ if (sequenceGeneratorInput.getRequestInfo() == null) {
+ throw new APPCException("Request info is not provided in the input");
+ }
+ String action = sequenceGeneratorInput.getRequestInfo().getAction();
+ VNFOperation operation = VNFOperation.findByString(action);
+ if (operation == null) {
+ throw new APPCException("Invalid Action " + action);
+ }
+ SequenceGenerator sequenceGenerator = SequenceGeneratorFactory.getInstance().createSequenceGenerator(operation);
+ return sequenceGenerator.generateSequence(sequenceGeneratorInput);
+ }
+
+ // Dependency model is an optional attribute and may contain null values
+ private VnfcDependencyModel buildDependencyModel(String inputJson) throws IOException, APPCException {
+ Set<Node<Vnfc>> dependency = new HashSet<>();
+ ObjectMapper objectMapper = new ObjectMapper();
+ objectMapper.configure(JsonParser.Feature.ALLOW_COMMENTS, true);
+ JsonNode rootNode = objectMapper.readTree(inputJson);
+ JsonNode vnfcs = getVnfcsNode(rootNode);
+ if (vnfcs != null) {
+ for (JsonNode vnfcNode : vnfcs) {
+ String vnfcType = readVnfcType(vnfcNode);
+ String mandatory = readMandatory(vnfcNode);
+ String resilience = readResilience(vnfcNode);
+ Vnfc vnfc = new Vnfc(vnfcType, resilience, null, Boolean.parseBoolean(mandatory));
+ Node<Vnfc> currentNode = getNode(dependency, vnfcType);
+ if (currentNode == null) {
+ currentNode = new Node<>(vnfc);
+ dependency.add(currentNode);
+ } else {
+ currentNode.getChild().setMandatory(Boolean.valueOf(mandatory));
+ currentNode.getChild().setResilienceType(resilience);
+ }
+ JsonNode parents = vnfcNode.get("parents");
+ for (JsonNode parent : parents) {
+ String parentVnfcType = parent.asText();
+ Node<Vnfc> parentNode = getNode(dependency, parentVnfcType);
+ if (parentNode != null) {
+ currentNode.addParent(parentNode.getChild());
+ } else {
+ Vnfc parentVnfc = new Vnfc(parentVnfcType, null, null, false);
+ parentNode = new Node<>(parentVnfc);
+ currentNode.addParent(parentVnfc);
+ dependency.add(parentNode);
+ }
+ }
+
+ }
+ return new VnfcDependencyModel(dependency);
+ }
+ return null;
+ }
+
+ private String readResilience(JsonNode vnfcNode) {
+ String resilience = null;
+ if (vnfcNode.get("resilience") != null) {
+ resilience = vnfcNode.get("resilience").asText();
+ }
+ return resilience;
+ }
+
+ private String readMandatory(JsonNode vnfcNode) {
+ String mandatory ;
+ JsonNode mandatoryNode = vnfcNode.get("mandatory");
+ if (mandatoryNode == null) {
+ mandatory = "false";
+ } else {
+ mandatory = mandatoryNode.asText();
+ }
+ return mandatory;
+ }
+
+ private String readVnfcType(JsonNode vnfcNode) throws APPCException {
+ JsonNode vnfcTypeNode = vnfcNode.get(Constants.VNFC_TYPE);
+ if (vnfcTypeNode == null) {
+ throw new APPCException("vnfc-type is not available in dependency info");
+ }
+ return vnfcTypeNode.asText();
+ }
+
+ private JsonNode getVnfcsNode(JsonNode rootNode) {
+ JsonNode dependencyInfo = rootNode.get("dependency-info");
+ JsonNode vnfcs = null;
+ if (dependencyInfo != null) {
+ vnfcs = dependencyInfo.get("vnfcs");
+ }
+ return vnfcs;
+ }
+
+ private Node<Vnfc> getNode(Set<Node<Vnfc>> dependency, String vnfcType) {
+ for (Node<Vnfc> node : dependency) {
+ if (node.getChild().getVnfcType().equals(vnfcType)) {
+ return node;
+ }
+ }
+ return null;
+ }
+
+ private InventoryModel buildInventoryModel(String inputJson) throws IOException, APPCException {
+ ObjectMapper objectMapper = new ObjectMapper();
+ objectMapper.configure(JsonParser.Feature.ALLOW_COMMENTS, true);
+ JsonNode jsonNode = objectMapper.readTree(inputJson);
+ JsonNode inventoryInfo = jsonNode.get("inventory-info");
+ if (inventoryInfo == null) {
+ throw new APPCException("inventory-info is not provided in the input");
+ }
+ JsonNode vnfInfo = inventoryInfo.get("vnf-info");
+ if (vnfInfo == null) {
+ throw new APPCException("vnf-info is not provided in the input");
+ }
+
+ String vnfId = vnfInfo.get("vnf-id").asText();
+ String vnfType = vnfInfo.get("vnf-type").asText();
+ String vnfVersion = vnfInfo.get("vnf-version").asText();
+
+ Vnf vnf = new Vnf(vnfId, vnfType, vnfVersion);
+
+ JsonNode vms = vnfInfo.get("vm");
+
+ Map<Vnfc, List<Vserver>> vfcs = new HashMap<>();
+ for (JsonNode vm : vms) {
+ if(vm.get("vserver-id")== null){
+ throw new APPCException("vserver-id not found ");
+ }
+ String vserverId = vm.get("vserver-id").asText();
+ Vserver vserver = new Vserver(null, null, vserverId, null, null);
+ JsonNode vnfc = vm.get("vnfc");
+ if (vnfc.get("vnfc-name") == null) {
+ throw new APPCException("vnfc-name not found for vserver " + vserverId);
+ }
+ String vnfcName = vnfc.get("vnfc-name").asText();
+ if (vnfc.get("vnfc-type") == null) {
+ throw new APPCException("vnfc-type not found for vserver " + vserverId);
+ }
+ String vnfcType = vnfc.get("vnfc-type").asText();
+ if (StringUtils.isEmpty(vnfcType)) {
+ throw new APPCException("vserver " + vserverId + " is not associated with any vnfc");
+ }
+ Vnfc vfc = new Vnfc(vnfcType, null, vnfcName);
+ List<Vserver> vServers = vfcs.get(vfc);
+ if (vServers == null) {
+ vServers = new LinkedList<>();
+ vfcs.put(vfc, vServers);
+ }
+ vServers.add(vserver);
+ }
+
+ for (Map.Entry<Vnfc, List<Vserver>> entry : vfcs.entrySet()) {
+ Vnfc vnfc = entry.getKey();
+ List<Vserver> vServers = vfcs.get(vnfc);
+ vnfc.addVms(vServers);
+ vnf.addVnfc(vnfc);
+ }
+
+ return new InventoryModel(vnf);
+ }
+}
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/impl/SequenceGeneratorFactory.java b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/impl/SequenceGeneratorFactory.java
new file mode 100644
index 000000000..5d41fffe1
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/impl/SequenceGeneratorFactory.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.seqgen.impl;
+
+import org.openecomp.appc.domainmodel.lcm.VNFOperation;
+import org.openecomp.appc.exceptions.APPCException;
+import org.openecomp.appc.seqgen.SequenceGenerator;
+
+public class SequenceGeneratorFactory {
+
+ private static class ReferenceHolder {
+ private static SequenceGeneratorFactory instance = new SequenceGeneratorFactory();
+ private ReferenceHolder(){
+
+ }
+ }
+
+ private SequenceGeneratorFactory(){
+
+ }
+
+ public static SequenceGeneratorFactory getInstance(){
+ return ReferenceHolder.instance;
+ }
+
+ public SequenceGenerator createSequenceGenerator(VNFOperation operation) throws APPCException {
+ switch (operation){
+ case Start:
+ return new StartSequenceGenerator();
+ case Stop:
+ return new StopSequenceGenerator();
+ default:
+ throw new APPCException("Sequence Generator does not support operation " + operation.name());
+ }
+ }
+}
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/impl/StartSequenceGenerator.java b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/impl/StartSequenceGenerator.java
new file mode 100644
index 000000000..acdeddd30
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/impl/StartSequenceGenerator.java
@@ -0,0 +1,291 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.seqgen.impl;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import org.apache.commons.lang3.StringUtils;
+import org.openecomp.appc.dg.flowbuilder.FlowBuilder;
+import org.openecomp.appc.dg.flowbuilder.impl.FlowBuilderFactory;
+import org.openecomp.appc.dg.objects.FlowStrategies;
+import org.openecomp.appc.dg.objects.InventoryModel;
+import org.openecomp.appc.dg.objects.VnfcDependencyModel;
+import org.openecomp.appc.dg.objects.VnfcFlowModel;
+import org.openecomp.appc.domainmodel.Vnfc;
+import org.openecomp.appc.domainmodel.Vserver;
+import org.openecomp.appc.exceptions.APPCException;
+import org.openecomp.appc.seqgen.SequenceGenerator;
+import org.openecomp.appc.seqgen.objects.*;
+
+import java.util.*;
+
+import static org.openecomp.appc.seqgen.objects.Constants.*;
+
+public class StartSequenceGenerator implements SequenceGenerator {
+
+ private static final EELFLogger logger = EELFManager.getInstance().getLogger(StartSequenceGenerator.class);
+
+ private List<Transaction> generateSequenceWithOutDependency(SequenceGeneratorInput input) throws APPCException {
+
+ List<Transaction> transactionList = new LinkedList<>();
+ Integer transactionId = 1;
+ List<Vnfc> invVnfcList = input.getInventoryModel().getVnf().getVnfcs();
+ boolean singleTransaction=checkSingleTransaction(invVnfcList);
+ for (Vnfc vnfc : invVnfcList) {
+ List<Vserver> vms = vnfc.getVserverList();
+ List<Integer> transactionIds = new LinkedList<>();
+ for (Vserver vm : vms) {
+ Transaction transaction = new Transaction();
+ transaction.setTransactionId(transactionId);
+ transactionIds.add(transactionId++);
+ transaction.setAction(Action.START.getActionType());
+ transaction.setActionLevel(ActionLevel.VM.getAction());
+ ActionIdentifier actionIdentifier = new ActionIdentifier();
+ actionIdentifier.setvServerId(vm.getId());
+ transaction.setActionIdentifier(actionIdentifier);
+ transaction.setPayload(input.getRequestInfo().getPayload());
+ if(!singleTransaction){
+ updateResponse(transaction);
+ }
+
+ transactionList.add(transaction);
+ }
+ }
+ return transactionList;
+ }
+
+ private boolean checkSingleTransaction(List<Vnfc> invVnfcList) {
+ int vServerCount=0;
+ for(Vnfc vnfc : invVnfcList) {
+ List<Vserver> vms = vnfc.getVserverList();
+ vServerCount=vServerCount+vms.size();
+ }
+ return vServerCount <= 1;
+ }
+
+ private void updateResponse(Transaction transaction) {
+ Response ignoreResponse = new Response();
+ ignoreResponse.setResponseMessage(ResponseMessage.FAILURE.getResponse());
+ Map<String, String> ignoreAction = new HashMap<>();
+ ignoreAction.put(ResponseAction.IGNORE.getAction(), Boolean.TRUE.toString());
+ ignoreResponse.setResponseAction(ignoreAction);
+ transaction.addResponse(ignoreResponse);
+ }
+
+ private List<Transaction> generateSequenceWithDependencyModel(VnfcFlowModel flowModel, SequenceGeneratorInput input) throws APPCException {
+ Integer waitTime = readWaitTime(input);
+ Integer retryCount = readRetryCount(input);
+ List<Transaction> transactionList = new LinkedList<>();
+ Integer transactionId = 1;
+ Iterator<List<Vnfc>> itr = flowModel.getModelIterator();
+ while (itr.hasNext()) {
+ List<Vnfc> vnfcs = itr.next();
+ for (Vnfc vnfc : vnfcs) {
+ List<Vserver> vms = vnfc.getVserverList();
+ List<Integer> transactionIds = new LinkedList<>();
+ transactionId = updateTransactions(input, transactionList, transactionId, vms, transactionIds);
+
+ boolean startApplicationSupported = readApplicationStartCapability(input);
+ transactionId = checkAndUpdateStartApplication(input, transactionList, transactionId, vnfc, transactionIds, startApplicationSupported);
+
+ boolean healthCheckSupported = readHealthCheckCapabilites(input.getCapability());
+ transactionId = checkAndUpdateHealthCheck(input, waitTime, retryCount, transactionList, transactionId, vnfc, healthCheckSupported);
+ }
+ }
+ return transactionList;
+ }
+
+ private Integer checkAndUpdateHealthCheck(SequenceGeneratorInput input, Integer waitTime, Integer retryCount, List<Transaction> transactionList, Integer transactionId, Vnfc vnfc, boolean healthCheckSupported) {
+ if (healthCheckSupported) {
+ Transaction healthCheckTransaction = new Transaction();
+ healthCheckTransaction.setTransactionId(transactionId++);
+ healthCheckTransaction.setAction(Action.HEALTH_CHECK.getActionType());
+ healthCheckTransaction.setActionLevel(ActionLevel.VNFC.getAction());
+ ActionIdentifier healthCheckActionIdentifier = new ActionIdentifier();
+ healthCheckActionIdentifier.setVnfcName(vnfc.getVnfcName());
+ healthCheckTransaction.setActionIdentifier(healthCheckActionIdentifier);
+ healthCheckTransaction.setPayload(input.getRequestInfo().getPayload());
+
+ Response retryResponse = new Response();
+ retryResponse.setResponseMessage(ResponseMessage.UNHEALTHY.getResponse());
+ Map<String, String> retryAction = new HashMap<>();
+ retryAction.put(ResponseAction.RETRY.getAction(), retryCount.toString());
+ retryAction.put(ResponseAction.WAIT.getAction(), waitTime.toString());
+ retryResponse.setResponseAction(retryAction);
+ healthCheckTransaction.addResponse(retryResponse);
+
+ Response healthyResponse = new Response();
+ healthyResponse.setResponseMessage(ResponseMessage.HEALTHY.getResponse());
+ Map<String, String> healthyAction = new HashMap<>();
+ healthyAction.put(ResponseAction.CONTINUE.getAction().toLowerCase(), Boolean.TRUE.toString());
+ healthyResponse.setResponseAction(healthyAction);
+ healthCheckTransaction.addResponse(healthyResponse);
+
+ Response failureResponse = new Response();
+ failureResponse.setResponseMessage(ResponseMessage.FAILURE.getResponse());
+ Map<String, String> failureResonseAction = new HashMap<>();
+ failureResonseAction.put(ResponseAction.STOP.getAction(), Boolean.TRUE.toString());
+ failureResponse.setResponseAction(failureResonseAction);
+ healthCheckTransaction.addResponse(failureResponse);
+ transactionList.add(healthCheckTransaction);
+ }
+ return transactionId;
+ }
+
+ private Integer checkAndUpdateStartApplication(SequenceGeneratorInput input, List<Transaction> transactionList, Integer transactionId, Vnfc vnfc, List<Integer> transactionIds, boolean startApplicationSupported) {
+ if (startApplicationSupported) {
+ Transaction startAppTransaction = new Transaction();
+ startAppTransaction.setTransactionId(transactionId++);
+ startAppTransaction.setAction(Action.START_APPLICATION.getActionType());
+ startAppTransaction.setActionLevel(ActionLevel.VNFC.getAction());
+ ActionIdentifier startActionIdentifier = new ActionIdentifier();
+ startActionIdentifier.setVnfcName(vnfc.getVnfcName());
+ startAppTransaction.setActionIdentifier(startActionIdentifier);
+ startAppTransaction.setPayload(input.getRequestInfo().getPayload());
+
+ List<PreCheckOption> preCheckOptions = new LinkedList<>();
+ for (Integer vmTransactionId : transactionIds) {
+ setPreCheckOptions(preCheckOptions, vmTransactionId);
+ }
+ startAppTransaction.setPreCheckOperator(PreCheckOperator.ANY.getOperator());
+ startAppTransaction.setPrecheckOptions(preCheckOptions);
+ transactionList.add(startAppTransaction);
+ }
+ return transactionId;
+ }
+
+ private Integer updateTransactions(SequenceGeneratorInput input, List<Transaction> transactionList, Integer transactionId, List<Vserver> vms, List<Integer> transactionIds) {
+ for (Vserver vm : vms) {
+ Transaction transaction = new Transaction();
+ transaction.setTransactionId(transactionId);
+ transactionIds.add(transactionId++);
+ transaction.setAction(Action.START.getActionType());
+ transaction.setActionLevel(ActionLevel.VM.getAction());
+ ActionIdentifier actionIdentifier = new ActionIdentifier();
+ actionIdentifier.setvServerId(vm.getId());
+ transaction.setActionIdentifier(actionIdentifier);
+ transaction.setPayload(input.getRequestInfo().getPayload());
+
+ updateResponse(transaction);
+ transactionList.add(transaction);
+ }
+ return transactionId;
+ }
+
+ private void setPreCheckOptions(List<PreCheckOption> preCheckOptions, Integer vmTransactionId) {
+ PreCheckOption option = new PreCheckOption();
+ option.setPreTransactionId(vmTransactionId);
+ option.setParamName("status");
+ option.setParamValue("success");
+ preCheckOptions.add(option);
+ }
+
+ @Override
+ public List<Transaction> generateSequence(SequenceGeneratorInput input) throws APPCException {
+ if(input.getRequestInfo().getActionLevel().equals(ActionLevel.VM.getAction())||input.getRequestInfo().getActionLevel().equals(ActionLevel.VNFC.getAction())||
+ input.getRequestInfo().getActionLevel().equals(ActionLevel.VNF.getAction())||input.getRequestInfo().getActionLevel().equals(ActionLevel.VF_MODULE.getAction())) {
+ if (input.getRequestInfo().getActionLevel().equals(ActionLevel.VNF.getAction()) && input.getDependencyModel() != null) {
+ FlowStrategies flowStrategy = readStartFlowStrategy(input);
+ VnfcFlowModel flowModel = buildFlowModel(input.getInventoryModel()
+ , input.getDependencyModel(), flowStrategy);
+ logger.debug("Flow Model " + flowModel);
+ return generateSequenceWithDependencyModel(flowModel, input);
+ } else {
+ logger.info("Generating sequence without dependency model");
+ return generateSequenceWithOutDependency(input);
+ }
+ }throw new APPCException("Invalid action level "+input.getRequestInfo().getActionLevel());
+ }
+
+ private VnfcFlowModel buildFlowModel(InventoryModel inventoryModel, VnfcDependencyModel dependencyModel, FlowStrategies flowStrategy) throws APPCException {
+ FlowBuilder flowBuilder = FlowBuilderFactory.getInstance().getFlowBuilder(flowStrategy);
+ if (flowBuilder == null) {
+ throw new APPCException("Flow Strategy not supported " + flowStrategy);
+ }
+ return flowBuilder.buildFlowModel(dependencyModel, inventoryModel);
+ }
+
+ private FlowStrategies readStartFlowStrategy(SequenceGeneratorInput sequenceGeneratorInput) throws APPCException {
+ Map<String, String> tunableParams = sequenceGeneratorInput.getTunableParams();
+ FlowStrategies strategy;
+ String strategyStr = null;
+ if (tunableParams != null) {
+ strategyStr = tunableParams.get(Constants.STRATEGY);
+ if (StringUtils.isBlank(strategyStr)) {
+ return FlowStrategies.FORWARD;
+ }
+
+ strategy = FlowStrategies.findByString(strategyStr);
+ if (strategy != null) {
+ return strategy;
+ }
+ }
+ throw new APPCException("Invalid Strategy " + strategyStr);
+ }
+
+ private boolean readHealthCheckCapabilites(Map<String, List<String>> capabilities) {
+ if (capabilities != null) {
+ List<String> vnfcCapabilities = capabilities.get(CapabilityLevel.VNFC.getLevel());
+ if (vnfcCapabilities != null)
+ return vnfcCapabilities.stream()
+ .anyMatch(p -> Capabilties.HEALTH_CHECK.getCapability().equalsIgnoreCase(p));
+ }
+ return false;
+ }
+
+ private boolean readApplicationStartCapability(SequenceGeneratorInput input) {
+ Map<String, List<String>> capability = input.getCapability();
+ if (capability != null) {
+ List<String> vnfcCapabilities = capability.get(CapabilityLevel.VNFC.getLevel());
+ if (vnfcCapabilities != null)
+ return vnfcCapabilities.stream().anyMatch(p -> Capabilties.START_APPLICATION.getCapability().equalsIgnoreCase(p));
+ }
+ return false;
+ }
+
+ private Integer readRetryCount(SequenceGeneratorInput input) throws APPCException {
+ String paramValStr = input.getTunableParams().get(RETRY_COUNT);
+ if (StringUtils.isEmpty(paramValStr)) {
+ return RETRY_COUNT_VALUE;
+ }
+ try {
+ return Integer.parseInt(paramValStr);
+ } catch (NumberFormatException e) {
+ String message = "Invalid Number for Retry Count " + paramValStr;
+ logger.error(message, e);
+ throw new APPCException(message);
+ }
+ }
+
+ private Integer readWaitTime(SequenceGeneratorInput input) throws APPCException {
+ String paramValStr = input.getTunableParams().get(WAIT_TIME);
+ if (StringUtils.isEmpty(paramValStr)) {
+ return WAIT_TIME_VALUE;
+ }
+ try {
+ return Integer.parseInt(paramValStr);
+ } catch (NumberFormatException e) {
+ String message = "Invalid Number for Wait Time " + paramValStr;
+ logger.error(message, e);
+ throw new APPCException(message);
+ }
+ }
+}
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/impl/StopSequenceGenerator.java b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/impl/StopSequenceGenerator.java
new file mode 100644
index 000000000..6dec0e61f
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/impl/StopSequenceGenerator.java
@@ -0,0 +1,183 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.seqgen.impl;
+
+import org.apache.commons.lang3.StringUtils;
+import org.openecomp.appc.dg.flowbuilder.FlowBuilder;
+import org.openecomp.appc.dg.flowbuilder.impl.FlowBuilderFactory;
+import org.openecomp.appc.dg.objects.FlowStrategies;
+import org.openecomp.appc.dg.objects.InventoryModel;
+import org.openecomp.appc.dg.objects.VnfcDependencyModel;
+import org.openecomp.appc.dg.objects.VnfcFlowModel;
+import org.openecomp.appc.domainmodel.Vnfc;
+import org.openecomp.appc.domainmodel.Vserver;
+import org.openecomp.appc.exceptions.APPCException;
+import org.openecomp.appc.seqgen.SequenceGenerator;
+import org.openecomp.appc.seqgen.objects.*;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+import java.util.*;
+
+import static org.openecomp.appc.seqgen.objects.Constants.*;
+
+public class StopSequenceGenerator implements SequenceGenerator {
+
+ private static final EELFLogger logger = EELFManager.getInstance().getLogger(StartSequenceGenerator.class);
+
+ @Override
+ public List<Transaction> generateSequence(SequenceGeneratorInput input) throws APPCException {
+ if(input.getRequestInfo().getActionLevel().equals(ActionLevel.VM.getAction())||input.getRequestInfo().getActionLevel().equals(ActionLevel.VNFC.getAction())||
+ input.getRequestInfo().getActionLevel().equals(ActionLevel.VNF.getAction())||input.getRequestInfo().getActionLevel().equals(ActionLevel.VF_MODULE.getAction())) {
+ if (input.getRequestInfo().getActionLevel().equals(ActionLevel.VNF.getAction()) && input.getDependencyModel() != null) {
+ FlowStrategies flowStrategy = readStopFlowStrategy(input);
+ VnfcFlowModel flowModel = buildFlowModel(input.getInventoryModel()
+ , input.getDependencyModel(), flowStrategy);
+ logger.debug("Flow Model " + flowModel);
+ return generateSequenceWithDependencyModel(flowModel, input);
+ } else {
+ logger.info("Generating sequence without dependency model");
+ return generateSequenceWithOutDependency(input);
+ }
+ }throw new APPCException("Invalid action level "+input.getRequestInfo().getActionLevel());
+
+ }
+ private List<Transaction> generateSequenceWithOutDependency(SequenceGeneratorInput input){
+ List<Transaction> transactionList = new LinkedList<>();
+ Integer transactionId = 1;
+ List<Integer> transactionIds = new LinkedList<>();
+ List<Vnfc> invVnfcList = input.getInventoryModel().getVnf().getVnfcs();
+ boolean singleTransaction=checkSingleTransaction(invVnfcList);
+ for (Vnfc vnfc : invVnfcList) {
+ List<Vserver> vms = vnfc.getVserverList();
+ for(Vserver vm:vms){
+ Transaction transaction = new Transaction();
+ transaction.setTransactionId(transactionId);
+ transactionIds.add(transactionId++);
+ transaction.setAction(Action.STOP.getActionType());
+ transaction.setActionLevel(ActionLevel.VM.getAction());
+ ActionIdentifier actionIdentifier = new ActionIdentifier();
+ actionIdentifier.setvServerId(vm.getId());
+ transaction.setActionIdentifier(actionIdentifier);
+ transaction.setPayload(input.getRequestInfo().getPayload());
+ if(!singleTransaction){
+ updateStopResponse(transaction);
+ }
+ transactionList.add(transaction);
+ }
+ }
+ return transactionList;
+ }
+
+ private void updateStopResponse(Transaction transaction) {
+ Response failureResponse = new Response();
+ failureResponse.setResponseMessage(ResponseMessage.FAILURE.getResponse());
+ Map<String,String> failureAction = new HashMap<>();
+ failureAction.put(ResponseAction.IGNORE.getAction(),Boolean.TRUE.toString());
+ failureResponse.setResponseAction(failureAction);
+ transaction.addResponse(failureResponse);
+ }
+ private boolean checkSingleTransaction(List<Vnfc> invVnfcList) {
+ int vServerCount=0;
+ for(Vnfc vnfc : invVnfcList) {
+ List<Vserver> vms = vnfc.getVserverList();
+ vServerCount=vServerCount+vms.size();
+ }
+ return vServerCount <= 1;
+ }
+
+ private List<Transaction> generateSequenceWithDependencyModel(VnfcFlowModel flowModel,SequenceGeneratorInput input){
+ List<Transaction> transactionList = new LinkedList<>();
+ Integer transactionId = 1;
+ List<Integer> transactionIds = new LinkedList<>();
+ Iterator<List<Vnfc>> itr = flowModel.getModelIterator();
+ while (itr.hasNext()){
+ List<Vnfc> vnfcs = itr.next();
+ for(Vnfc vnfc:vnfcs){
+ boolean stopApplicationSupported = readApplicationStopCapability(input);
+ if(stopApplicationSupported){
+ Transaction stopAppTransaction = new Transaction();
+ stopAppTransaction.setTransactionId(transactionId++);
+ stopAppTransaction.setAction(Action.STOP_APPLICATION.getActionType());
+ stopAppTransaction.setActionLevel(ActionLevel.VNFC.getAction());
+ ActionIdentifier stopActionIdentifier = new ActionIdentifier();
+ stopActionIdentifier .setVnfcName(vnfc.getVnfcName());
+ stopAppTransaction.setActionIdentifier(stopActionIdentifier );
+ stopAppTransaction.setPayload(input.getRequestInfo().getPayload());
+ updateStopResponse(stopAppTransaction);
+ transactionList.add(stopAppTransaction);
+ }
+ List<Vserver> vms = vnfc.getVserverList();
+ for(Vserver vm:vms){
+ Transaction transaction = new Transaction();
+ transaction.setTransactionId(transactionId);
+ transactionIds.add(transactionId++);
+ transaction.setAction(Action.STOP.getActionType());
+ transaction.setActionLevel(ActionLevel.VM.getAction());
+ ActionIdentifier actionIdentifier = new ActionIdentifier();
+ actionIdentifier.setvServerId(vm.getId());
+ transaction.setActionIdentifier(actionIdentifier);
+ transaction.setPayload(input.getRequestInfo().getPayload());
+
+ updateStopResponse(transaction);
+ transactionList.add(transaction);
+ }
+ }
+ }
+ return transactionList;
+ }
+
+ private VnfcFlowModel buildFlowModel(InventoryModel inventoryModel, VnfcDependencyModel dependencyModel, FlowStrategies flowStrategy) throws APPCException {
+ FlowBuilder flowBuilder = FlowBuilderFactory.getInstance().getFlowBuilder(flowStrategy);
+ if (flowBuilder == null) {
+ throw new APPCException("Flow Strategy not supported " + flowStrategy);
+ }
+ return flowBuilder.buildFlowModel(dependencyModel, inventoryModel);
+ }
+
+ private FlowStrategies readStopFlowStrategy(SequenceGeneratorInput sequenceGeneratorInput) throws APPCException {
+ Map<String, String> tunableParams = sequenceGeneratorInput.getTunableParams();
+ FlowStrategies strategy;
+ String strategyStr = null;
+ if (tunableParams != null) {
+ strategyStr = tunableParams.get(Constants.STRATEGY);
+ if (StringUtils.isBlank(strategyStr)) {
+ return FlowStrategies.REVERSE;
+ }
+ strategy = FlowStrategies.findByString(strategyStr);
+ if (strategy != null) {
+ return strategy;
+ }
+ }
+ throw new APPCException("Invalid Strategy " + strategyStr);
+ }
+ private boolean readApplicationStopCapability(SequenceGeneratorInput input) {
+ Map<String,List<String>> capability = input.getCapability();
+ if(capability!= null){
+ List<String> vnfcCapabilities = capability.get(Constants.CapabilityLevel.VNFC.getLevel());
+ if(vnfcCapabilities!=null)
+ return vnfcCapabilities.stream().anyMatch(p -> Capabilties.STOP_APPLICATION.getCapability().equalsIgnoreCase(p));
+ }
+ return false;
+ }
+
+
+}
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/ActionIdentifier.java b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/ActionIdentifier.java
new file mode 100644
index 000000000..ae3ed942d
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/ActionIdentifier.java
@@ -0,0 +1,63 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.seqgen.objects;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+
+@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class ActionIdentifier {
+
+ @JsonProperty("vnf-id")
+ private String vnfId;
+
+ @JsonProperty("vnfc-name")
+ private String vnfcName;
+
+ @JsonProperty("vserver-id")
+ private String vServerId;
+
+ public String getVnfId() {
+ return vnfId;
+ }
+
+ public void setVnfId(String vnfId) {
+ this.vnfId = vnfId;
+ }
+
+ public String getVnfcName() {
+ return vnfcName;
+ }
+
+ public void setVnfcName(String vnfcName) {
+ this.vnfcName = vnfcName;
+ }
+
+ public String getvServerId() {
+ return vServerId;
+ }
+
+ public void setvServerId(String vServerId) {
+ this.vServerId = vServerId;
+ }
+}
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/Constants.java b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/Constants.java
new file mode 100644
index 000000000..354145f02
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/Constants.java
@@ -0,0 +1,123 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.seqgen.objects;
+
+public class Constants {
+ public static final String RETRY_COUNT = "retry-count";
+ public static final String WAIT_TIME = "wait-time";
+ public static final Integer WAIT_TIME_VALUE = 60;
+ public static final Integer RETRY_COUNT_VALUE = 4;
+ public static final String STRATEGY = "strategy";
+ public static final String VNFC_TYPE = "vnfc-type";
+
+ public enum CapabilityLevel{
+ VNF("vnf"),VNFC("vnfc"),VM("vm");
+ private String level;
+ CapabilityLevel(String level) {
+ this.level=level;
+ }
+
+ public String getLevel() {
+ return level;
+ }
+ }
+
+ public enum Capabilties{
+ START_APPLICATION("StartApplication"),HEALTH_CHECK("HealthCheck"),STOP_APPLICATION("StopApplication");
+ private String capability;
+
+ Capabilties(String capability) {
+ this.capability=capability;
+ }
+ public String getCapability(){
+ return capability;
+ }
+ }
+
+ public enum ResponseMessage{
+ HEALTHY("healthy"),UNHEALTHY("unhealthy"),SUCCESS("success"),FAILURE("failure");
+
+ public String getResponse() {
+ return response;
+ }
+
+ private String response;
+ ResponseMessage(String response){
+ this.response=response;
+ }
+
+ }
+
+ public enum ResponseAction{
+ STOP("stop"),RETRY("retry"),IGNORE("ignore"),WAIT("wait"),CONTINUE("Continue");
+
+ ResponseAction(String action) {
+ this.action=action;
+ }
+
+ private String action;
+
+ public String getAction() {
+ return action;
+ }
+
+ }
+
+ public enum Action{
+ START("Start"),START_APPLICATION("StartApplication"),HEALTH_CHECK("HealthCheck"),STOP_APPLICATION("StopApplication"),STOP("Stop");
+
+ Action(String actionType) {
+ this.actionType=actionType;
+ }
+
+ public String getActionType() {
+ return actionType;
+ }
+
+ private String actionType;
+
+ }
+ public enum ActionLevel{
+ VM("vm"),VNFC("vnfc"),VNF("vnf"),VF_MODULE("vf-module");
+ private String action;
+ ActionLevel(String action){
+ this.action=action;
+ }
+ public String getAction() {
+ return action;
+ }
+ }
+
+ public enum PreCheckOperator{
+ ANY("any"),ALL("all");
+
+ PreCheckOperator(String operator){
+ this.operator=operator;
+ }
+
+ public String getOperator() {
+ return operator;
+ }
+
+ private String operator;
+
+ }
+}
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/PreCheckOption.java b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/PreCheckOption.java
new file mode 100644
index 000000000..860fac7e2
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/PreCheckOption.java
@@ -0,0 +1,74 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.seqgen.objects;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+
+@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class PreCheckOption {
+
+ @JsonProperty("pre-transactionID")
+ private Integer preTransactionId;
+
+ @JsonProperty("param-name")
+ private String paramName;
+
+ @JsonProperty("param-value")
+ private String paramValue;
+
+ private String rule;
+
+
+ public Integer getPreTransactionId() {
+ return preTransactionId;
+ }
+
+ public void setPreTransactionId(Integer preTransactionId) {
+ this.preTransactionId = preTransactionId;
+ }
+
+ public String getParamName() {
+ return paramName;
+ }
+
+ public void setParamName(String paramName) {
+ this.paramName = paramName;
+ }
+
+ public String getParamValue() {
+ return paramValue;
+ }
+
+ public void setParamValue(String paramValue) {
+ this.paramValue = paramValue;
+ }
+
+ public String getRule() {
+ return rule;
+ }
+
+ public void setRule(String rule) {
+ this.rule = rule;
+ }
+}
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/RequestInfo.java b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/RequestInfo.java
new file mode 100644
index 000000000..697e13e3b
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/RequestInfo.java
@@ -0,0 +1,72 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.seqgen.objects;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+
+@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class RequestInfo {
+
+ private String action;
+
+ @JsonProperty("action-level")
+ private String actionLevel;
+
+ @JsonProperty("action-identifier")
+ private ActionIdentifier actionIdentifier;
+
+ private String payload;
+
+ public String getAction() {
+ return action;
+ }
+
+ public void setAction(String action) {
+ this.action = action;
+ }
+
+ public String getActionLevel() {
+ return actionLevel;
+ }
+
+ public void setActionLevel(String actionLevel) {
+ this.actionLevel = actionLevel;
+ }
+
+ public ActionIdentifier getActionIdentifier() {
+ return actionIdentifier;
+ }
+
+ public void setActionIdentifier(ActionIdentifier actionIdentifier) {
+ this.actionIdentifier = actionIdentifier;
+ }
+
+ public String getPayload() {
+ return payload;
+ }
+
+ public void setPayload(String payload) {
+ this.payload = payload;
+ }
+}
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/RequestInfoBuilder.java b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/RequestInfoBuilder.java
new file mode 100644
index 000000000..70d4e9a0c
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/RequestInfoBuilder.java
@@ -0,0 +1,76 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.seqgen.objects;
+
+public class RequestInfoBuilder {
+
+ private String action;
+
+ private String actionLevel;
+
+ private ActionIdentifier actionIdentifier;
+
+ private String payload;
+
+ public RequestInfoBuilder actionIdentifier(){
+ this.actionIdentifier = new ActionIdentifier();
+ return this;
+ }
+
+ public RequestInfoBuilder vnfId(String vnfId){
+ this.actionIdentifier.setVnfId(vnfId);
+ return this;
+ }
+
+ public RequestInfoBuilder vnfcName(String vnfcName){
+ this.actionIdentifier.setVnfcName(vnfcName);
+ return this;
+ }
+
+ public RequestInfoBuilder vServerId(String vServerId){
+ this.actionIdentifier.setvServerId(vServerId);
+ return this;
+ }
+
+ public RequestInfoBuilder action(String action){
+ this.action = action;
+ return this;
+ }
+
+ public RequestInfoBuilder actionLevel(String actionLevel){
+ this.actionLevel = actionLevel;
+ return this;
+ }
+
+ public RequestInfoBuilder payload(String payload){
+ this.payload = payload;
+ return this;
+ }
+
+ public RequestInfo build(){
+ RequestInfo requestInfo = new RequestInfo();
+ requestInfo.setAction(this.action);
+ requestInfo.setActionIdentifier(this.actionIdentifier);
+ requestInfo.setActionLevel(this.actionLevel);
+ requestInfo.setPayload(this.payload);
+ return requestInfo;
+ }
+}
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/Response.java b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/Response.java
new file mode 100644
index 000000000..9247e6e7f
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/Response.java
@@ -0,0 +1,65 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.seqgen.objects;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+
+import java.util.Map;
+
+@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class Response {
+
+ @JsonProperty("response-code")
+ private String responseCode;
+
+ @JsonProperty("response-message")
+ private String responseMessage;
+
+ @JsonProperty("response-action")
+ private Map<String,String> responseAction;
+
+ public String getResponseCode() {
+ return responseCode;
+ }
+
+ public void setResponseCode(String responseCode) {
+ this.responseCode = responseCode;
+ }
+
+ public String getResponseMessage() {
+ return responseMessage;
+ }
+
+ public void setResponseMessage(String responseMessage) {
+ this.responseMessage = responseMessage;
+ }
+
+ public Map<String, String> getResponseAction() {
+ return responseAction;
+ }
+
+ public void setResponseAction(Map<String, String> responseAction) {
+ this.responseAction = responseAction;
+ }
+}
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/SequenceGeneratorInput.java b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/SequenceGeneratorInput.java
new file mode 100644
index 000000000..851a07582
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/SequenceGeneratorInput.java
@@ -0,0 +1,93 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.seqgen.objects;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import org.openecomp.appc.dg.objects.InventoryModel;
+import org.openecomp.appc.dg.objects.VnfcDependencyModel;
+
+import javax.validation.constraints.NotNull;
+import java.util.List;
+import java.util.Map;
+
+@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class SequenceGeneratorInput {
+
+ @NotNull
+ @JsonProperty("request-info")
+ private RequestInfo requestInfo;
+
+ @JsonIgnore
+ private InventoryModel inventoryModel;
+
+ @JsonIgnore
+ private VnfcDependencyModel dependencyModel;
+
+ @JsonProperty("tunable-parameters")
+ private Map<String,String> tunableParams;
+
+ @JsonProperty("capabilities")
+ private Map<String,List<String>> capability;
+
+ public RequestInfo getRequestInfo() {
+ return requestInfo;
+ }
+
+ public void setRequestInfo(RequestInfo requestInfo) {
+ this.requestInfo = requestInfo;
+ }
+
+ public InventoryModel getInventoryModel() {
+ return inventoryModel;
+ }
+
+ public void setInventoryModel(InventoryModel inventoryModel) {
+ this.inventoryModel = inventoryModel;
+ }
+
+ public VnfcDependencyModel getDependencyModel() {
+ return dependencyModel;
+ }
+
+ public void setDependencyModel(VnfcDependencyModel dependencyModel) {
+ this.dependencyModel = dependencyModel;
+ }
+
+ public Map<String, String> getTunableParams() {
+ return tunableParams;
+ }
+
+ public void setTunableParams(Map<String, String> tunableParams) {
+ this.tunableParams = tunableParams;
+ }
+
+ public Map<String, List<String>> getCapability() {
+ return capability;
+ }
+
+ public void setCapability(Map<String, List<String>> capability) {
+ this.capability = capability;
+ }
+}
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/SequenceGeneratorInputBuilder.java b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/SequenceGeneratorInputBuilder.java
new file mode 100644
index 000000000..b72e46e7e
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/SequenceGeneratorInputBuilder.java
@@ -0,0 +1,85 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.seqgen.objects;
+
+import org.openecomp.appc.dg.objects.InventoryModel;
+import org.openecomp.appc.dg.objects.VnfcDependencyModel;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class SequenceGeneratorInputBuilder {
+
+ private RequestInfo requestInfo;
+
+ private InventoryModel inventoryModel;
+
+ private VnfcDependencyModel dependencyModel;
+
+ private Map<String,String> tunableParams;
+
+ private Map<String,List<String>> capability;
+
+ public SequenceGeneratorInputBuilder requestInfo(RequestInfo requestInfo){
+ this.requestInfo = requestInfo;
+ return this;
+ }
+
+ public SequenceGeneratorInputBuilder capability(String level,List<String> capabilities){
+ if(this.capability ==null){
+ this.capability = new HashMap<>();
+ }
+ this.capability.put(level,capabilities);
+ return this;
+ }
+
+ public SequenceGeneratorInputBuilder tunableParameter(String key,String value){
+ if(this.tunableParams ==null){
+ this.tunableParams = new HashMap<>();
+ }
+ this.tunableParams.put(key,value);
+ return this;
+ }
+
+ public SequenceGeneratorInputBuilder inventoryModel(InventoryModel model){
+ this.inventoryModel = model;
+ return this;
+ }
+
+ public SequenceGeneratorInputBuilder dependendcyModel(VnfcDependencyModel model){
+ this.dependencyModel = model;
+ return this;
+ }
+
+ public SequenceGeneratorInput build(){
+ SequenceGeneratorInput input = new SequenceGeneratorInput();
+ input.setRequestInfo(this.requestInfo);
+ input.setCapability(this.capability);
+ input.setInventoryModel(this.inventoryModel);
+ input.setDependencyModel(this.dependencyModel);
+ input.setTunableParams(this.tunableParams);
+ return input;
+ }
+
+
+
+}
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/Transaction.java b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/Transaction.java
new file mode 100644
index 000000000..b49d1323a
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/objects/Transaction.java
@@ -0,0 +1,142 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.seqgen.objects;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class Transaction {
+
+ @JsonProperty("transactionId")
+ private Integer transactionId;
+
+ @JsonProperty("action")
+ private String action;
+
+ @JsonProperty("action-level")
+ private String actionLevel;
+
+ @JsonProperty("action-identifier")
+ private ActionIdentifier actionIdentifier;
+
+ @JsonProperty("payload")
+ private String payload;
+
+ @JsonProperty("parameters")
+ private Map<String,String> parameters;
+
+ @JsonProperty("precheck-operator")
+ private String preCheckOperator;
+
+
+ @JsonProperty("precheck-options")
+ private List<PreCheckOption> precheckOptions;
+
+ @JsonProperty("responses")
+ private List<Response> responses;
+
+ public Transaction(){
+ responses = new LinkedList<>();
+ }
+
+ public Integer getTransactionId() {
+ return transactionId;
+ }
+
+ public void setTransactionId(Integer transactionId) {
+ this.transactionId = transactionId;
+ }
+
+ public String getAction() {
+ return action;
+ }
+
+ public void setAction(String action) {
+ this.action = action;
+ }
+
+ public String getActionLevel() {
+ return actionLevel;
+ }
+
+ public void setActionLevel(String actionLevel) {
+ this.actionLevel = actionLevel;
+ }
+
+ public ActionIdentifier getActionIdentifier() {
+ return actionIdentifier;
+ }
+
+ public void setActionIdentifier(ActionIdentifier actionIdentifier) {
+ this.actionIdentifier = actionIdentifier;
+ }
+
+ public String getPayload() {
+ return payload;
+ }
+
+ public void setPayload(String payload) {
+ this.payload = payload;
+ }
+
+ public Map<String, String> getParameters() {
+ return parameters;
+ }
+
+ public void setParameters(Map<String, String> parameters) {
+ this.parameters = parameters;
+ }
+
+ public List<Response> getResponses() {
+ return responses;
+ }
+
+ public void setResponses(List<Response> responses) {
+ this.responses = responses;
+ }
+
+ public void addResponse(Response response){
+ this.responses.add(response);
+ }
+
+ public String getPreCheckOperator() {
+ return preCheckOperator;
+ }
+
+ public void setPreCheckOperator(String preCheckOperator) {
+ this.preCheckOperator = preCheckOperator;
+ }
+
+ public List<PreCheckOption> getPrecheckOptions() {
+ return precheckOptions;
+ }
+
+ public void setPrecheckOptions(List<PreCheckOption> precheckOptions) {
+ this.precheckOptions = precheckOptions;
+ }
+}
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/provider/SequenceGeneratorProvider.java b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/provider/SequenceGeneratorProvider.java
new file mode 100644
index 000000000..b3aab54e1
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/java/org/openecomp/appc/seqgen/provider/SequenceGeneratorProvider.java
@@ -0,0 +1,352 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.seqgen.provider;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.google.common.util.concurrent.Futures;
+import org.apache.commons.lang.StringUtils;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
+import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.sequencegenerator.rev170706.GenerateSequenceInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.sequencegenerator.rev170706.GenerateSequenceOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.sequencegenerator.rev170706.GenerateSequenceOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.sequencegenerator.rev170706.SequenceGeneratorService;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.sequencegenerator.rev170706.dependency.info.dependency.info.Vnfcs;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.sequencegenerator.rev170706.inventory.info.inventory.info.vnf.info.Vm;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.sequencegenerator.rev170706.response.StatusBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.sequencegenerator.rev170706.response.Transactions;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.sequencegenerator.rev170706.response.TransactionsBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.sequencegenerator.rev170706.response.transactions.ActionIdentifier;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.sequencegenerator.rev170706.response.transactions.*;
+import org.opendaylight.yang.gen.v1.org.openecomp.appc.sequencegenerator.rev170706.response.transactions.responses.ResponseActionBuilder;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.openecomp.appc.dg.objects.InventoryModel;
+import org.openecomp.appc.dg.objects.Node;
+import org.openecomp.appc.dg.objects.VnfcDependencyModel;
+import org.openecomp.appc.domainmodel.Vnf;
+import org.openecomp.appc.domainmodel.Vserver;
+import org.openecomp.appc.domainmodel.lcm.VNFOperation;
+import org.openecomp.appc.exceptions.APPCException;
+import org.openecomp.appc.seqgen.SequenceGenerator;
+import org.openecomp.appc.seqgen.impl.SequenceGeneratorFactory;
+import org.openecomp.appc.seqgen.objects.*;
+
+import java.util.*;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+
+
+public class SequenceGeneratorProvider implements AutoCloseable,SequenceGeneratorService{
+ protected DataBroker dataBroker;
+ protected RpcProviderRegistry rpcRegistry;
+ protected NotificationProviderService notificationService;
+ protected BindingAwareBroker.RpcRegistration<SequenceGeneratorService> rpcRegistration;
+ private final EELFLogger log = EELFManager.getInstance().getLogger(SequenceGeneratorProvider.class);
+ private final ExecutorService executor;
+ private final static String APP_NAME = "SequenceGeneratorProvider";
+
+ public SequenceGeneratorProvider(DataBroker dataBroker2, NotificationProviderService notificationProviderService
+ , RpcProviderRegistry rpcRegistry2) {
+ log.info("Creating provider for " + APP_NAME);
+ executor = Executors.newFixedThreadPool(1);
+ this.dataBroker = dataBroker2;
+ this.notificationService = notificationProviderService;
+
+ this.rpcRegistry = rpcRegistry2;
+
+ if (this.rpcRegistry != null) {
+ rpcRegistration = rpcRegistry.addRpcImplementation(SequenceGeneratorService.class, this);
+ }
+ log.info("Initialization complete for " + APP_NAME);
+ }
+
+ @Override
+ public void close() throws Exception {
+ log.info("Closing provider for " + APP_NAME);
+ if(this.executor != null){
+ executor.shutdown();
+ }
+ if(this.rpcRegistration != null){
+ rpcRegistration.close();
+ }
+ log.info("Successfully closed provider for " + APP_NAME);
+ }
+
+ @Override
+ public Future<RpcResult<GenerateSequenceOutput>> generateSequence(GenerateSequenceInput input) {
+ RpcResult<GenerateSequenceOutput> rpcResult=null;
+ log.debug("Received input = " + input );
+ try {
+ SequenceGenerator seqGenerator = SequenceGeneratorFactory.getInstance()
+ .createSequenceGenerator(VNFOperation.findByString(input.getRequestInfo().getAction().name()));
+ SequenceGeneratorInput seqGenInput = buildSeqGenInput(input);
+ List<Transaction> transactions = seqGenerator.generateSequence(seqGenInput);
+ rpcResult = buildSuccessResponse(transactions);
+ } catch (APPCException e) {
+ log.error("Error Generating Sequence",e);
+ rpcResult = buildFailureResponse(e.getMessage());
+ }
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ private RpcResult<GenerateSequenceOutput> buildSuccessResponse(List<Transaction> transactions) {
+
+ List<Transactions> transactionList = new LinkedList<>();
+ for(Transaction transaction:transactions){
+ ActionIdentifier actionIdentifier = null;
+ if(transaction.getActionIdentifier() != null){
+ actionIdentifier = new ActionIdentifierBuilder()
+ .setVnfId(transaction.getActionIdentifier().getVnfId())
+ .setVnfcName(transaction.getActionIdentifier().getVnfcName())
+ .setVserverId(transaction.getActionIdentifier().getvServerId())
+ .build();
+ }
+
+ List<PrecheckOptions> precheckOptions = new LinkedList<>();
+ if(transaction.getPrecheckOptions()!=null){
+ for(PreCheckOption option:transaction.getPrecheckOptions()){
+ PrecheckOptions precheckOption = new PrecheckOptionsBuilder()
+ .setParamName(option.getParamName())
+ .setParamValue(option.getParamValue())
+ .setPreTransactionId(option.getPreTransactionId())
+ .setRule(option.getRule())
+ .build();
+ precheckOptions.add(precheckOption);
+ }
+ }
+
+ List<Responses> responseList = getResponses(transaction);
+
+ Transactions transactionObj
+ = new TransactionsBuilder()
+ .setActionIdentifier(actionIdentifier)
+ .setAction(transaction.getAction())
+ .setActionLevel(transaction.getActionLevel())
+ .setPrecheckOperator(transaction.getPreCheckOperator())
+ .setPayload(transaction.getPayload())
+ .setTransactionId(transaction.getTransactionId())
+ .setPrecheckOptions(precheckOptions)
+ .setResponses(responseList)
+ .build();
+ transactionList.add(transactionObj);
+ }
+
+ GenerateSequenceOutputBuilder builder = new GenerateSequenceOutputBuilder()
+ .setTransactions(transactionList);
+
+ return RpcResultBuilder
+ .<GenerateSequenceOutput> status(true)
+ .withResult(builder.build()).build();
+ }
+
+ private List<Responses> getResponses(Transaction transaction) {
+ List<Responses> responseList = new LinkedList<>();
+ for(Response resp : transaction.getResponses()){
+ Map<String,String> responseActions = resp.getResponseAction();
+ ResponseActionBuilder responseActionBuilder = new ResponseActionBuilder();
+ if(responseActions.get(Constants.ResponseAction.WAIT.getAction())!=null){
+ responseActionBuilder = responseActionBuilder.setWait(Integer.parseInt(responseActions.get(Constants.ResponseAction.WAIT.getAction())));
+ }
+ if(responseActions.get(Constants.ResponseAction.RETRY.getAction())!=null){
+ responseActionBuilder = responseActionBuilder.setRetry(Integer.parseInt(responseActions.get(Constants.ResponseAction.RETRY.getAction())));
+ }
+ if(responseActions.get(Constants.ResponseAction.CONTINUE.getAction().toLowerCase())!=null){
+ responseActionBuilder = responseActionBuilder
+ .setContinue(Boolean.parseBoolean(responseActions.get(Constants.ResponseAction.CONTINUE.getAction().toLowerCase())));
+ }
+ if(responseActions.get(Constants.ResponseAction.IGNORE.getAction()) !=null){
+ responseActionBuilder = responseActionBuilder.setIgnore(Boolean.parseBoolean(responseActions.get(Constants.ResponseAction.IGNORE.getAction())));
+ }
+ if(responseActions.get(Constants.ResponseAction.STOP.getAction()) !=null){
+ responseActionBuilder = responseActionBuilder.setStop(Boolean.parseBoolean(responseActions.get(Constants.ResponseAction.STOP.getAction())));
+ }
+ Responses response = new ResponsesBuilder()
+ .setResponseMessage(resp.getResponseMessage())
+ .setResponseAction(responseActionBuilder.build())
+ .build();
+ responseList.add(response);
+ }
+ return responseList;
+ }
+
+ private SequenceGeneratorInput buildSeqGenInput(GenerateSequenceInput input) throws APPCException {
+
+ validateMandatory(input);
+
+ RequestInfoBuilder requestInfobuilder = new RequestInfoBuilder()
+ .action(input.getRequestInfo().getAction().name())
+ .actionLevel(input.getRequestInfo().getActionLevel().getName().toLowerCase())
+ .payload(input.getRequestInfo().getPayload());
+
+ if(input.getRequestInfo().getActionIdentifier() !=null){
+ requestInfobuilder = requestInfobuilder
+ .actionIdentifier()
+ .vnfId(input.getRequestInfo().getActionIdentifier().getVnfId())
+ .vnfcName(input.getRequestInfo().getActionIdentifier().getVnfcName())
+ .vServerId(input.getRequestInfo().getActionIdentifier().getVserverId());
+ }
+
+ RequestInfo requestInfo = requestInfobuilder.build();
+
+ InventoryModel inventoryModel = readInventoryModel(input);
+
+ VnfcDependencyModel dependencyModel = readDependencyModel(input);
+
+ SequenceGeneratorInputBuilder builder = new SequenceGeneratorInputBuilder()
+ .requestInfo(requestInfo)
+ .inventoryModel(inventoryModel)
+ .dependendcyModel(dependencyModel);
+
+ if(input.getCapabilities() !=null){
+ if(input.getCapabilities().getVnf()!=null){
+ builder = builder.capability("vnf",input.getCapabilities().getVnf());
+ }
+ if(input.getCapabilities().getVnfc()!=null){
+ builder = builder.capability("vnfc",input.getCapabilities().getVnfc());
+ }
+ if(input.getCapabilities().getVm()!=null){
+ builder = builder.capability("vm",input.getCapabilities().getVm());
+ }
+ if(input.getCapabilities().getVfModule()!=null){
+ builder = builder.capability("vf-module",input.getCapabilities().getVfModule());
+ }
+ }
+
+ if(input.getTunableParameters() != null){
+ builder = builder.tunableParameter(Constants.RETRY_COUNT,String.valueOf(input.getTunableParameters().getRetryCount()))
+ .tunableParameter(Constants.WAIT_TIME,String.valueOf(input.getTunableParameters().getWaitTime()));
+ if(input.getTunableParameters().getStrategy() !=null){
+ builder = builder.tunableParameter(Constants.STRATEGY,input.getTunableParameters().getStrategy().name());
+ }
+ }
+ return builder.build();
+ }
+
+
+ private void validateMandatory(GenerateSequenceInput input) throws APPCException {
+ if(input.getRequestInfo() ==null){
+ throw new APPCException("Request Info is not present in the request");
+ }
+ if(input.getRequestInfo().getAction() ==null){
+ throw new APPCException("Action is not present in the request");
+ }
+ if(input.getInventoryInfo() ==null){
+ throw new APPCException("inventoryInfo is not provided in the input");
+ }
+ }
+
+ private VnfcDependencyModel readDependencyModel(GenerateSequenceInput input) {
+ if(input.getDependencyInfo() == null || input.getDependencyInfo().getVnfcs() ==null || input.getDependencyInfo().getVnfcs().isEmpty()){
+ return null;
+ }
+ List<Vnfcs> vnfcs = input.getDependencyInfo().getVnfcs();
+ Set<Node<org.openecomp.appc.domainmodel.Vnfc>> dependencies = new HashSet<>();
+ for(Vnfcs vnfcObj:vnfcs){
+ org.openecomp.appc.domainmodel.Vnfc vnfc;
+ Node<org.openecomp.appc.domainmodel.Vnfc> currentNode = readNode(vnfcObj.getVnfcType(),dependencies);
+ if(currentNode == null){
+ vnfc = new org.openecomp.appc.domainmodel.Vnfc(vnfcObj.getVnfcType(),vnfcObj.getResilience());
+ currentNode = new Node<>(vnfc);
+ dependencies.add(currentNode);
+ }
+ else{
+ currentNode.getChild().setResilienceType(vnfcObj.getResilience());
+ currentNode.getChild().setMandatory(vnfcObj.isMandatory());
+ }
+ for(String parentVnfcType:vnfcObj.getParents()){
+ Node<org.openecomp.appc.domainmodel.Vnfc> parentNode = readNode(parentVnfcType,dependencies);
+ if(parentNode == null){
+ org.openecomp.appc.domainmodel.Vnfc parentVnfc = new org.openecomp.appc.domainmodel.Vnfc(parentVnfcType,null);
+ parentNode = new Node<>(parentVnfc);
+ currentNode.addParent(parentVnfc);
+ dependencies.add(parentNode);
+ }
+ else{
+ currentNode.addParent(parentNode.getChild());
+ }
+ }
+ }
+ return new VnfcDependencyModel(dependencies);
+ }
+
+ private Node<org.openecomp.appc.domainmodel.Vnfc> readNode(String vnfcType, Set<Node<org.openecomp.appc.domainmodel.Vnfc>> dependencies) {
+ for(Node<org.openecomp.appc.domainmodel.Vnfc> node : dependencies){
+ if(node.getChild().getVnfcType().equalsIgnoreCase(vnfcType)){
+ return node;
+ }
+ }
+ return null;
+ }
+
+ private InventoryModel readInventoryModel(GenerateSequenceInput input) throws APPCException {
+ if (input.getInventoryInfo().getVnfInfo()== null) {
+ throw new APPCException("vnfInfo is not provided in the input");
+ }
+
+ Vnf vnf = new Vnf(input.getInventoryInfo().getVnfInfo().getVnfId(),
+ input.getInventoryInfo().getVnfInfo().getVnfType(),null);
+
+ Map<org.openecomp.appc.domainmodel.Vnfc,List<Vserver>> map = new HashMap<>();
+ for(Vm vm:input.getInventoryInfo().getVnfInfo().getVm()){
+ if(StringUtils.isBlank(vm.getVserverId())){
+ throw new APPCException("vserver-id not found ");
+ }
+ if(StringUtils.isBlank(vm.getVnfc().getVnfcType())){
+ throw new APPCException("vnfc-type not found for vserver " + vm.getVserverId());
+ }
+ if(StringUtils.isBlank(vm.getVnfc().getVnfcName())){
+ throw new APPCException("vnfc-name not found for vserver " + vm.getVserverId());
+ }
+
+ org.openecomp.appc.domainmodel.Vnfc vnfc = new org.openecomp.appc.domainmodel.Vnfc(vm.getVnfc().getVnfcType(),null,vm.getVnfc().getVnfcName());
+ List<Vserver> vms = map.get(vnfc);
+ if(vms ==null){
+ vms = new LinkedList<>();
+ map.put(vnfc,vms);
+ }
+ vms.add(new Vserver(null,null,vm.getVserverId(),null,null));
+ }
+ for(Map.Entry<org.openecomp.appc.domainmodel.Vnfc,List<Vserver>> entry:map.entrySet()){
+ org.openecomp.appc.domainmodel.Vnfc vnfc = entry.getKey();
+ List<Vserver> vmList = entry.getValue();
+ vnfc.addVms(vmList);
+ vnf.addVnfc(vnfc);
+ }
+ return new InventoryModel(vnf);
+ }
+
+ private RpcResult<GenerateSequenceOutput> buildFailureResponse(String errorMessage){
+ GenerateSequenceOutputBuilder sequenceGeneratorOutputBuilder=new GenerateSequenceOutputBuilder();
+ StatusBuilder statusBuilder =new StatusBuilder();
+ statusBuilder.setCode(401);
+ statusBuilder.setMessage(errorMessage);
+ sequenceGeneratorOutputBuilder.setStatus(statusBuilder.build());
+ return RpcResultBuilder
+ .<GenerateSequenceOutput> status(true)
+ .withResult(sequenceGeneratorOutputBuilder.build())
+ .build();
+ }
+}
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml
new file mode 100644
index 000000000..9422bd33a
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ ONAP : APP-C
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ -->
+
+<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="sequenceGeneratorDGPlugin" class="org.openecomp.appc.seqgen.dgplugin.impl.SequenceGeneratorPluginImpl"/>
+ <service interface="org.openecomp.appc.seqgen.dgplugin.SequenceGeneratorPlugin" ref="sequenceGeneratorDGPlugin"/>
+
+</blueprint>
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/main/resources/initial/appc-sequence-generator.xml b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/resources/initial/appc-sequence-generator.xml
new file mode 100644
index 000000000..fb48c2567
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/resources/initial/appc-sequence-generator.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ ONAP : APP-C
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ -->
+
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<snapshot>
+ <configuration>
+ <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+ <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+ <module>
+
+ <!-- This xmlns:prefix should match the namespace in the *-impl.yang file
+ The prefix: inside type should match the prefix of the yang file. -->
+ <type xmlns:prefix="org:openecomp:appc:sequencegenerator:impl">
+ prefix:sequence-generator-impl
+ </type>
+ <name>sequence-generator-impl</name>
+
+ <!-- The following sections contain bindings to services defined in the
+ *-impl yang file. For example the rpc-registry is required
+ because we have a dependency (or augmentation) named "rpc-registry"
+ and which binds to the md-sa-binding-registry. If you remove those
+ dependencies from the yang file then you can remove them from here. -->
+ <rpc-registry>
+ <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-rpc-registry</type>
+ <name>binding-rpc-broker</name>
+ </rpc-registry>
+
+ <data-broker>
+ <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type>
+ <name>binding-data-broker</name>
+ </data-broker>
+
+ <notification-service>
+ <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">
+ binding:binding-notification-service
+ </type>
+ <name>binding-notification-broker</name>
+ </notification-service>
+ </module>
+
+ </modules>
+ </data>
+
+ </configuration>
+
+ <!-- Required capabilities are basically a listing of all modules that need to be imported before
+ our service can be resolved. Capabilities for dependencies defined above are implied which is
+ why we do not have define a required capability for the data broker, for example. -->
+ <required-capabilities>
+ <capability>org:openecomp:appc:sequencegenerator:impl?module=sequence-generator-impl&amp;revision=2017-07-06</capability>
+ </required-capabilities>
+
+</snapshot>
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/main/resources/org.openecomp.appc/default.properties b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/resources/org.openecomp.appc/default.properties
new file mode 100644
index 000000000..a3e3f8ac8
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/resources/org.openecomp.appc/default.properties
@@ -0,0 +1,54 @@
+###
+# ============LICENSE_START=======================================================
+# ONAP : APP-C
+# ================================================================================
+# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+###
+
+#
+# This property file supplies the configuration defaults for the APP-C controller
+#
+# Default values are supplied so that all defined properties have well-known values and are
+# valid even if a configuration file is not supplied. This is done to ensure that a runnable,
+# stable, and defined configuration exists at all times. The reason the defaults are supplied
+# via this property file and not in the code is so that the properties can be changed
+# easily if needed in the future. Use of the "getProperty(name, default)" method is
+# discouraged because if the default value needs to be changed, everywhere in the code it
+# is used would have to be changed. By loading the defaults in this property file, all
+# values can be defined in one place and support is easier. This does mean that all
+# properties that are defined must have a default value supplied here. Which also means
+# this file documents all defined properties (not a bad thing either).
+#
+#--------------------------------------------------------------------------------------------
+# The path and file used to load user-supplied configuration settings, if any
+org.openecomp.appc.bootstrap.file=appc.properties
+org.openecomp.appc.bootstrap.path=/opt/openecomp/appc/data/properties,${user.home},.
+
+appc.application.name=APPC
+
+#
+# The path to search for logging configuration document, and the name of the document
+#
+org.openecomp.appc.logging.path=${user.home},etc,../etc,.
+org.openecomp.appc.logging.file=logback.xml
+
+#
+# The DG properties
+#
+appc.service.logic.module.name=APPC
+appc.topology.dg.method=topology-operation-all
+appc.topology.dg.version=2.0.0
+
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/main/resources/org.openecomp.appc/logback.xml b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/resources/org.openecomp.appc/logback.xml
new file mode 100644
index 000000000..0cefc8cf7
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/resources/org.openecomp.appc/logback.xml
@@ -0,0 +1,283 @@
+<!--
+ ============LICENSE_START=======================================================
+ ONAP : APP-C
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ -->
+
+<configuration scan="true" scanPeriod="3 seconds" debug="true">
+ <!--<jmxConfigurator /> -->
+ <property name="logDirectory" value="logs" />
+ <property name="debugLogDirectory" value="debug-logs" />
+ <!-- Example evaluator filter applied against console appender -->
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>%d{MM/dd-HH:mm:ss.SSS} [%-16thread] %.-5level
+ %-36.36logger - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <!-- ============================================================================ -->
+ <!-- CDP Appenders -->
+ <!-- ============================================================================ -->
+
+ <!-- The CDPAppender is used to record events to the general CDP application
+ log. This is the log file used by default as the application root log, if
+ no other log is defined or the application creates specialized loggers of
+ the form com.att.cdp.x.y.z where the name occupied by the "x" is NOT security,
+ perf, server, coordinator, gui, or policy. These are defined as specialization
+ loggers for various business purposes. -->
+ <appender name="CDP"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${logDirectory}/cdp.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${logDirectory}/cdp.%i.log.zip
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>9</maxIndex>
+ </rollingPolicy>
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>5MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <!-- <pattern>"%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} -
+ %msg%n"</pattern> -->
+ <pattern>%d{MM/dd-HH:mm:ss.SSS} [%-16thread] %.-5level
+ %-36.36logger [%X{User} %X{RemoteHost} %X{RequestId} %X{Method}
+ %X{Path}] - %msg%n</pattern>
+ </encoder>
+ </appender>
+ <appender name="asyncCDP" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="CDP" />
+ </appender>
+
+ <!-- CDP Security Appender. This appender is used to record security events
+ to the security log file. Security events are separate from other loggers
+ in CDP so that security log records can be captured and managed in a secure
+ way separate from the other logs. This appender is set to never discard any
+ events. -->
+ <appender name="CDPSecurity"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${logDirectory}/cdp-security.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${logDirectory}/cdp-security.%i.log.zip
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>9</maxIndex>
+ </rollingPolicy>
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>5MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <!-- <pattern>"%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} -
+ %msg%n"</pattern> -->
+ <pattern>%d{MM/dd-HH:mm:ss.SSS} [%-16thread] %.-5level
+ %-36.36logger [%X{User} %X{RemoteHost} %X{RequestId} %X{Method}
+ %X{Path}] - %msg%n</pattern>
+ </encoder>
+ </appender>
+ <appender name="asyncCDPSecurity" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <discardingThreshold>0</discardingThreshold>
+ <appender-ref ref="CDPSecurity" />
+ </appender>
+
+ <!-- CDP Performance Appender. This appender is used to record performance
+ records. -->
+ <appender name="CDPPerformance"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${logDirectory}/cdp-performance.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${logDirectory}/cdp-performance.%i.log.zip
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>9</maxIndex>
+ </rollingPolicy>
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>5MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <outputPatternAsHeader>true</outputPatternAsHeader>
+ <pattern>%d{MM/dd-HH:mm:ss.SSS} [%-16thread] %.-5level
+ %-36.36logger [%X{User} %X{RemoteHost} %X{RequestId} %X{Method}
+ %X{Path}] - %msg%n</pattern>
+ </encoder>
+ </appender>
+ <appender name="asyncCDPPerformance" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="CDPPerformance" />
+ </appender>
+
+ <!-- CDP Server Appender. This appender is used to record Server related
+ logging events. The Server logger and appender are specializations of the
+ CDP application root logger and appender. This can be used to segregate Server
+ events from other components, or it can be eliminated to record these events
+ as part of the application root log. -->
+ <appender name="CDPServer"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${logDirectory}/cdp-server.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${logDirectory}/cdp-server.%i.log.zip
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>9</maxIndex>
+ </rollingPolicy>
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>5MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <!-- <pattern>"%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} -
+ %msg%n"</pattern> -->
+ <pattern>%d{MM/dd-HH:mm:ss.SSS} [%-16thread] %.-5level
+ %-36.36logger [%X{User} %X{RemoteHost} %X{RequestId} %X{Method}
+ %X{Path}] - %msg%n</pattern>
+ </encoder>
+ </appender>
+ <appender name="asyncCDPServer" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="CDPServer" />
+ </appender>
+
+ <!-- CDP Coordinator Appender. This appender is used to record Coordinator
+ related logging events. The Coordinator logger and appender are specializations
+ of the CDP application root logger and appender. This can be used to segregate
+ Coordinator events from other components, or it can be eliminated to record
+ these events as part of the application root log. -->
+ <appender name="CDPCoordinator"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${logDirectory}/cdp-coordinator.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${logDirectory}/cdp-coordinator.%i.log.zip
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>9</maxIndex>
+ </rollingPolicy>
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>5MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <!-- <pattern>"%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} -
+ %msg%n"</pattern> -->
+ <pattern>%d{MM/dd-HH:mm:ss.SSS} [%-16thread] %.-5level
+ %-36.36logger - %msg%n</pattern>
+ </encoder>
+ </appender>
+ <appender name="asyncCDPCoordinator" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="CDPCoordinator" />
+ </appender>
+
+ <!-- CDP Policy Appender. This appender is used to record Policy engine
+ related logging events. The Policy logger and appender are specializations
+ of the CDP application root logger and appender. This can be used to segregate
+ Policy engine events from other components, or it can be eliminated to record
+ these events as part of the application root log. -->
+ <appender name="CDPPolicy"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${logDirectory}/cdp-policy.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${logDirectory}/cdp-policy.%i.log.zip
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>9</maxIndex>
+ </rollingPolicy>
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>5MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <!-- <pattern>"%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} -
+ %msg%n"</pattern> -->
+ <pattern>%d{MM/dd-HH:mm:ss.SSS} [%-16thread] %.-5level
+ %-36.36logger - %msg%n</pattern>
+ </encoder>
+ </appender>
+ <appender name="asyncCDPPolicy" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="CDPPolicy" />
+ </appender>
+ <appender name="CommandExecutor"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${debugLogDirectory}/appc-debug.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${logDirectory}/command-executor.%i.log.zip
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>9</maxIndex>
+ </rollingPolicy>
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>5MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <!--<Pattern>
+ %d{yyyy-MM-dd'T'HH:mm:ss.SSSZ}|%X{RequestID}|%X{ServiceInstanceID}|%thread|%X{ServerName}|%X{ServiceName}|%X{UUID}|%-5.5p|%X{Severity}|%X{ServerIPAddress}|%X{Server}|%X{IPAddress}|[%c{3}]|%X{Timer}| - %msg%n
+ </Pattern>-->
+ <Pattern>
+ %d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%t|%X{ServiceName} - %X{bundle.id} - %X{bundle.name} - %X{bundle.version}|%X{InstanceUUID}|%-5.5p|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}|%X{Timer}|[%c{3}]|%m%n
+ </Pattern>
+ </encoder>
+ </appender>
+
+ <logger name="org.openecomp.appc" level="DEBUG" additivity="false">
+ <appender-ref ref="CommandExecutor" />
+ </logger>
+
+ <!-- ============================================================================ -->
+ <!-- CDP loggers -->
+ <!-- ============================================================================ -->
+ <logger name="com.att.cdp" level="info" additivity="false">
+ <appender-ref ref="asyncCDP" />
+ </logger>
+ <logger name="com.att.cdp.security" level="info" additivity="false">
+ <appender-ref ref="asyncCDPSecurity" />
+ </logger>
+ <logger name="com.att.cdp.perf" level="info" additivity="false">
+ <appender-ref ref="asyncCDPPerformance" />
+ </logger>
+ <logger name="com.att.cdp.server" level="debug" additivity="false">
+ <appender-ref ref="asyncCDPServer" />
+ </logger>
+ <logger name="com.att.cdp.coordinator" level="info" additivity="false">
+ <appender-ref ref="asyncCDPCoordinator" />
+ </logger>
+ <logger name="com.att.cdp.policy" level="info" additivity="false">
+ <appender-ref ref="asyncCDPPolicy" />
+ </logger>
+
+ <!-- The OpenStack connector logger -->
+ <logger name="os" level="debug" additivity="false">
+ <appender-ref ref="asyncCDPServer" />
+ </logger>
+
+ <root level="WARN">
+ <appender-ref ref="STDOUT" />
+ </root>
+
+</configuration>
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/main/yang/sequence-generator.yang b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/yang/sequence-generator.yang
new file mode 100644
index 000000000..50c00979b
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/main/yang/sequence-generator.yang
@@ -0,0 +1,62 @@
+module sequence-generator-impl {
+
+ yang-version 1;
+ namespace "org:openecomp:appc:sequencegenerator:impl";
+ prefix "sequence-generator-impl";
+
+ import config { prefix config; revision-date 2013-04-05; }
+ import opendaylight-md-sal-binding { prefix mdsal; revision-date 2013-10-28; }
+
+ description
+ "This module contains the base YANG definitions for
+ sequence-generator-impl implementation.";
+
+ revision "2017-07-06" {
+ description
+ "Initial revision.";
+ }
+
+ // This is the definition of the service implementation as a module identity.
+ identity sequence-generator-impl {
+ base config:module-type;
+
+ // Specifies the prefix for generated java classes.
+ config:java-name-prefix SequenceGenerator;
+ }
+
+ // Augments the 'configuration' choice node under modules/module.
+ // We consume the two main services, RPCs and DataStore
+ // Notification service is not used
+ augment "/config:modules/config:module/config:configuration" {
+ case sequence-generator-impl {
+ when "/config:modules/config:module/config:type = 'sequence-generator-impl'";
+
+ container rpc-registry {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity mdsal:binding-rpc-registry;
+ }
+ }
+ }
+
+ container notification-service {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity mdsal:binding-notification-service;
+ }
+ }
+ }
+
+ container data-broker {
+ uses config:service-ref {
+ refine type {
+ mandatory false;
+ config:required-identity mdsal:binding-async-data-broker;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/test/java/org/openecomp/appc/seqgen/TestSequenceGeneratorPlugin.java b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/java/org/openecomp/appc/seqgen/TestSequenceGeneratorPlugin.java
new file mode 100644
index 000000000..2bb9cd6e2
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/java/org/openecomp/appc/seqgen/TestSequenceGeneratorPlugin.java
@@ -0,0 +1,256 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.seqgen;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import org.junit.Assert;
+import org.junit.Test;
+import org.openecomp.appc.seqgen.dgplugin.SequenceGeneratorPlugin;
+import org.openecomp.appc.seqgen.dgplugin.impl.SequenceGeneratorPluginImpl;
+import org.openecomp.sdnc.sli.SvcLogicContext;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.util.HashMap;
+import java.util.Map;
+
+public class TestSequenceGeneratorPlugin {
+
+ private static final EELFLogger logger = EELFManager.getInstance().getLogger(TestSequenceGeneratorPlugin.class);
+
+ @Test
+ public void testGenerateSequenceStart() throws URISyntaxException, IOException {
+ String inputJSON = readInput("/input/start.json");
+
+ Map<String,String> params = new HashMap<>();
+ SvcLogicContext context = new SvcLogicContext();
+ context.setAttribute("inputJSON",inputJSON);
+
+ SequenceGeneratorPlugin plugin = new SequenceGeneratorPluginImpl();
+ plugin.generateSequence(params,context);
+
+ String outputJSON = context.getAttribute("output");
+ String actualOutput = readOutput("/output/start.json");
+ Assert.assertEquals(outputJSON.trim(),actualOutput.trim());
+ }
+
+
+
+ @Test
+ public void testGenerateSequenceSingleVM()throws URISyntaxException, IOException {
+ String inputJSON = readInput("/input/start-single-vm.json");
+
+ Map<String,String> params = new HashMap<>();
+ SvcLogicContext context = new SvcLogicContext();
+ context.setAttribute("inputJSON",inputJSON);
+
+ SequenceGeneratorPlugin plugin = new SequenceGeneratorPluginImpl();
+ plugin.generateSequence(params,context);
+
+ String outputJSON = context.getAttribute("output");
+ String actualOutput = readOutput("/output/start-single-vm.json");
+ Assert.assertEquals(outputJSON.trim(),actualOutput.trim());
+ }
+
+ @Test
+ public void testGenerateSequenceNoStrategy() throws URISyntaxException, IOException {
+ String inputJSON = readInput("/input/no-strategy.json");
+
+ Map<String,String> params = new HashMap<>();
+ SvcLogicContext context = new SvcLogicContext();
+ context.setAttribute("inputJSON",inputJSON);
+
+ SequenceGeneratorPlugin plugin = new SequenceGeneratorPluginImpl();
+ plugin.generateSequence(params,context);
+
+ String outputJSON = context.getAttribute("output");
+ String actualOutput = readOutput("/output/start.json");
+
+ Assert.assertEquals(outputJSON.trim(),actualOutput.trim());
+ }
+
+ @Test
+ public void testGenerateSequenceStop() throws URISyntaxException, IOException {
+ String inputJSON = readInput("/input/stop.json");
+
+ Map<String,String> params = new HashMap<>();
+ SvcLogicContext context = new SvcLogicContext();
+ context.setAttribute("inputJSON",inputJSON);
+
+ SequenceGeneratorPlugin plugin = new SequenceGeneratorPluginImpl();
+ plugin.generateSequence(params,context);
+
+ String outputJSON = context.getAttribute("output");
+ String actualOutput = readOutput("/output/stop.json");
+
+ Assert.assertEquals(outputJSON.trim(),actualOutput.trim());
+ }
+
+ @Test
+ public void testGenerateSequenceWrongNumber() throws URISyntaxException, IOException {
+ String inputJSON = readInput("/input/wrongnumber.json");
+
+ Map<String,String> params = new HashMap<>();
+ SvcLogicContext context = new SvcLogicContext();
+ context.setAttribute("inputJSON",inputJSON);
+
+ SequenceGeneratorPlugin plugin = new SequenceGeneratorPluginImpl();
+ plugin.generateSequence(params,context);
+
+ String errorCode = context.getAttribute("error-code");
+ String errorMessage = context.getAttribute("error-message");
+ logger.debug("errorCode = " + errorCode);
+ Assert.assertEquals(errorCode,"401");
+ Assert.assertEquals(errorMessage,"Error generating sequence Invalid Number for Wait Time 6a");
+ }
+
+
+ @Test
+ public void testGenerateSequenceCyclic() throws URISyntaxException, IOException {
+ String inputJSON = readInput("/input/cyclic.json");
+
+ Map<String,String> params = new HashMap<>();
+ SvcLogicContext context = new SvcLogicContext();
+ context.setAttribute("inputJSON",inputJSON);
+
+ SequenceGeneratorPlugin plugin = new SequenceGeneratorPluginImpl();
+ plugin.generateSequence(params,context);
+
+ String errorCode = context.getAttribute("error-code");
+ String errorMessage = context.getAttribute("error-message");
+ logger.debug("errorCode = " + errorCode);
+ Assert.assertEquals(errorCode,"401");
+ Assert.assertEquals(errorMessage,"Error generating sequence There seems to be no Root/Independent node for Vnfc dependencies");
+ }
+
+
+ @Test
+ public void testGenerateSequenceWrongAction() throws URISyntaxException, IOException {
+ String inputJSON = readInput("/input/wrongaction.json");
+
+ Map<String,String> params = new HashMap<>();
+ SvcLogicContext context = new SvcLogicContext();
+ context.setAttribute("inputJSON",inputJSON);
+
+ SequenceGeneratorPlugin plugin = new SequenceGeneratorPluginImpl();
+ plugin.generateSequence(params,context);
+
+ String errorCode = context.getAttribute("error-code");
+ String errorMessage = context.getAttribute("error-message");
+ logger.debug("errorCode = " + errorCode);
+ Assert.assertEquals(errorCode,"401");
+ Assert.assertEquals(errorMessage,"Error generating sequence Invalid Action start");
+ }
+
+
+ @Test
+ public void testGenerateSequenceMissingRequestInfo() throws URISyntaxException, IOException {
+ String inputJSON = readInput("/input/missingrequestinfo.json");
+
+ Map<String,String> params = new HashMap<>();
+ SvcLogicContext context = new SvcLogicContext();
+ context.setAttribute("inputJSON",inputJSON);
+
+ SequenceGeneratorPlugin plugin = new SequenceGeneratorPluginImpl();
+ plugin.generateSequence(params,context);
+
+ String errorCode = context.getAttribute("error-code");
+ String errorMessage = context.getAttribute("error-message");
+ logger.debug("errorCode = " + errorCode);
+ Assert.assertEquals(errorCode,"401");
+ Assert.assertEquals(errorMessage,"Error generating sequence Request info is not provided in the input");
+ }
+
+ @Test
+ public void testGenerateSequenceStopSingleVM() throws URISyntaxException, IOException{
+ String inputJSON = readInput("/input/stop-single-vm.json");
+
+ Map<String,String> params = new HashMap<>();
+ SvcLogicContext context = new SvcLogicContext();
+ context.setAttribute("inputJSON",inputJSON);
+
+ SequenceGeneratorPlugin plugin = new SequenceGeneratorPluginImpl();
+ plugin.generateSequence(params,context);
+
+ String outputJSON = context.getAttribute("output");
+ String actualOutput = readOutput("/output/stop-single-vm.json");
+ Assert.assertEquals(outputJSON.trim(),actualOutput.trim());
+ }
+
+ @Test
+ public void testGenerateSequenceStopSingleVmPerVnfc() throws URISyntaxException, IOException{
+ String inputJSON = readInput("/input/stop-single-vm-per-vnfc.json");
+
+ Map<String,String> params = new HashMap<>();
+ SvcLogicContext context = new SvcLogicContext();
+ context.setAttribute("inputJSON",inputJSON);
+
+ SequenceGeneratorPlugin plugin = new SequenceGeneratorPluginImpl();
+ plugin.generateSequence(params,context);
+
+ String outputJSON = context.getAttribute("output");
+ String actualOutput = readOutput("/output/stop-single-vm-per-vnfc.json");
+ Assert.assertEquals(outputJSON.trim(),actualOutput.trim());
+ }
+
+ @Test
+ public void testGenerateSequenceStartSingleVmPerVnfc() throws URISyntaxException, IOException{
+ String inputJSON = readInput("/input/start-single-vm-per-vnfc.json");
+
+ Map<String,String> params = new HashMap<>();
+ SvcLogicContext context = new SvcLogicContext();
+ context.setAttribute("inputJSON",inputJSON);
+
+ SequenceGeneratorPlugin plugin = new SequenceGeneratorPluginImpl();
+ plugin.generateSequence(params,context);
+
+ String outputJSON = context.getAttribute("output");
+ String actualOutput = readOutput("/output/start-single-vm-per-vnfc.json");
+ Assert.assertEquals(outputJSON.trim(),actualOutput.trim());
+ }
+
+ private String readInput(String inputFile) throws URISyntaxException, IOException {
+ File file = new File(this.getClass().getResource(inputFile).toURI());
+
+ byte[] bFile = new byte[(int) file.length()];
+ FileInputStream fileInputStream = new FileInputStream(file);
+ fileInputStream.read(bFile);
+ fileInputStream.close();
+ return new String(bFile);
+ }
+ private String readOutput(String outputFile) throws IOException,URISyntaxException {
+ File file = new File(this.getClass().getResource(outputFile).toURI());
+
+ byte[] bFile = new byte[(int) file.length()];
+ FileInputStream fileInputStream = new FileInputStream(file);
+ fileInputStream.read(bFile);
+ fileInputStream.close();
+
+ String output=new String(bFile);
+ int start=output.indexOf("[");
+ int last=output.length()-1;
+ return output.substring(start,last);
+
+ }
+}
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/cyclic.json b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/cyclic.json
new file mode 100644
index 000000000..522b99692
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/cyclic.json
@@ -0,0 +1,198 @@
+/*-
+ * ============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=========================================================
+ */
+
+
+
+
+{
+ "request-info":
+ {
+ "action": "Start",
+ "action-level": "vnf",
+ "action-identifier":
+ {
+ "vnf-id": "dbgx0001v"
+ },
+ "payload": "ABC"
+ },
+ "inventory-info":
+ {
+ "vnf-info":
+ {
+ "vnf-id" : "abc",
+ "vnf-name": "vVNF",
+ "vnf-type": "vVNF",
+ "vnf-version" : "1.0",
+ "vm": [
+ {
+ "vserver-id" : "vnfc2_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc3_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC3",
+ "vnfc-name": "VNFC3 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc3_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC3",
+ "vnfc-name": "VNFC3 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid3",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc1_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC1",
+ "vnfc-name": "VNFC1 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc1_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC1",
+ "vnfc-name": "VNFC1 - Name"
+ }
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid4",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid5",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ }
+ ]
+ }
+ },
+ "dependency-info" :
+ {
+ "vnfcs" :
+ [
+ {
+ "vnfc-type" : "VNFC2",
+ "mandatory" : "true",
+ "resilience": "Active-Active",
+ "parents" :
+ [
+ "VNFC1"
+ ]
+ },
+ {
+ "vnfc-type" : "VNFC3",
+ "mandatory" : "true",
+ "resilience": "Active-Active",
+ "parents" :
+ [
+ "VNFC2"
+ ]
+ },
+ {
+ "vnfc-type" : "VNFC1",
+ "mandatory" : "true",
+ "resilience": "Active-Passive",
+ "parents" :
+ [
+ "VNFC3"
+ ]
+ }
+ ]
+ },
+ "tunable-parameters" :
+ {
+ "strategy" : "FORWARD",
+ "wait-time" : "120",
+ "retry-count" : "5"
+ },
+ "capabilities" :
+ {
+ "vnf":
+ [
+ "Stop",
+ "Start",
+ "StartApplication",
+ "StopApplication"
+ ],
+ "vf-module":
+ [
+ "Stop",
+ "Start"
+ ],
+ "vm" :
+ [
+ "Stop",
+ "Start"
+ ],
+ "vnfc":
+ [
+ "StopApplication",
+ "StartApplication",
+ "HealthCheck"
+ ]
+ }
+}
+
+
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/mandatory-vnfc.json b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/mandatory-vnfc.json
new file mode 100644
index 000000000..3e96b5654
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/mandatory-vnfc.json
@@ -0,0 +1,177 @@
+/*-
+ * ============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=========================================================
+ */
+
+
+
+
+{
+ "request-info":
+ {
+ "action": "Start",
+ "action-level": "vnf",
+ "action-identifier":
+ {
+ "vnf-id": "dbgx0001v"
+ },
+ "payload": "ABC"
+ },
+ "inventory-info":
+ {
+ "vnf-info":
+ {
+ "vnf-id" : "abc",
+ "vnf-name": "vVNF",
+ "vnf-type": "vVNF",
+ "vnf-version" : "1.0",
+ "vm": [
+ {
+ "vserver-id" : "vnfc2_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid3",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc1_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC1",
+ "vnfc-name": "VNFC1 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc1_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC1",
+ "vnfc-name": "VNFC1 - Name"
+ }
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid4",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid5",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ }
+ ]
+ }
+ },
+ "dependency-info":
+ {
+ "vnfcs" :
+ [
+ {
+ "vnfc-type" : "VNFC2",
+ "mandatory" : "true",
+ "resilience": "Active-Active",
+ "parents" :
+ [
+ "VNFC1"
+ ]
+ },
+ {
+ "vnfc-type" : "VNFC3",
+ "mandatory" : "true",
+ "resilience": "Active-Active",
+ "parents" :
+ [
+ "VNFC2"
+ ]
+ },
+ {
+ "vnfc-type" : "VNFC1",
+ "mandatory" : "true",
+ "resilience": "Active-Passive",
+ "parents" : []
+ }
+ ]
+ },
+ "tunable-parameters":
+ {
+ "strategy" : "FORWARD",
+ "wait-time": "120",
+ "retry-count": "5"
+ },
+ "capabilities" :
+ {
+ "vnf":
+ [
+ "Stop",
+ "Start",
+ "StartApplication",
+ "StopApplication"
+ ],
+ "vf-module":
+ [
+ "Stop",
+ "Start"
+ ],
+ "vm" :
+ [
+ "Stop",
+ "Start"
+ ],
+ "vnfc":
+ [
+ "StopApplication",
+ "StartApplication",
+ "HealthCheck"
+ ]
+ }
+}
+
+
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/missingrequestinfo.json b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/missingrequestinfo.json
new file mode 100644
index 000000000..c5bc7ead2
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/missingrequestinfo.json
@@ -0,0 +1,186 @@
+/*-
+ * ============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=========================================================
+ */
+
+
+
+
+{
+ "inventory-info":
+ {
+ "vnf-info":
+ {
+ "vnf-id" : "abc",
+ "vnf-name": "vVNF",
+ "vnf-type": "vVNF",
+ "vnf-version" : "1.0",
+ "vm":
+ [
+ {
+ "vserver-id" : "vnfc2_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc3_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC3",
+ "vnfc-name": "VNFC3 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc3_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC3",
+ "vnfc-name": "VNFC3 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid3",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc1_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC1",
+ "vnfc-name": "VNFC1 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc1_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC1",
+ "vnfc-name": "VNFC1 - Name"
+ }
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid4",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid5",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ }
+ ]
+ }
+ },
+ "dependency-info":
+ {
+ "vnfcs" :
+ [
+ {
+ "vnfc-type" : "VNFC2",
+ "mandatory" : "true",
+ "resilience": "Active-Active",
+ "parents" :
+ [
+ "VNFC1"
+ ]
+ },
+ {
+ "vnfc-type" : "VNFC3",
+ "mandatory" : "true",
+ "resilience": "Active-Active",
+ "parents" :
+ [
+ "VNFC2"
+ ]
+ },
+ {
+ "vnfc-type" : "VNFC1",
+ "mandatory" : "true",
+ "resilience": "Active-Passive",
+ "parents" : []
+ }
+ ]
+ },
+ "tunable-parameters":
+ {
+ "strategy" : "FORWARD",
+ "wait-time": "120",
+ "retry-count": "5"
+ },
+ "capabilities" :
+ {
+ "vnf":
+ [
+ "Stop",
+ "Start",
+ "StartApplication",
+ "StopApplication"
+ ],
+ "vf-module":
+ [
+ "Stop",
+ "Start"
+ ],
+ "vm" :
+ [
+ "Stop",
+ "Start"
+ ],
+ "vnfc":
+ [
+ "StopApplication",
+ "StartApplication",
+ "HealthCheck"
+ ]
+ }
+}
+
+
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/no-strategy.json b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/no-strategy.json
new file mode 100644
index 000000000..1371d2273
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/no-strategy.json
@@ -0,0 +1,195 @@
+/*-
+ * ============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=========================================================
+ */
+
+
+
+
+{
+ "request-info":
+ {
+ "action": "Start",
+ "action-level": "vnf",
+ "action-identifier":
+ {
+ "vnf-id": "dbgx0001v"
+ },
+ "payload": "ABC"
+ },
+ "inventory-info":
+ {
+ "vnf-info":
+ {
+ "vnf-id" : "abc",
+ "vnf-name": "vVNF",
+ "vnf-type": "vVNF",
+ "vnf-version" : "1.0",
+ "vm": [
+ {
+ "vserver-id" : "vnfc2_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc3_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC3",
+ "vnfc-name": "VNFC3 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc3_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC3",
+ "vnfc-name": "VNFC3 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid3",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc1_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC1",
+ "vnfc-name": "VNFC1 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc1_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC1",
+ "vnfc-name": "VNFC1 - Name"
+ }
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid4",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid5",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ }
+ ]
+ }
+ },
+ "dependency-info":
+ {
+ "vnfcs" :
+ [
+ {
+ "vnfc-type" : "VNFC2",
+ "mandatory" : "true",
+ "resilience": "Active-Active",
+ "parents" :
+ [
+ "VNFC1"
+ ]
+ },
+ {
+ "vnfc-type" : "VNFC3",
+ "mandatory" : "true",
+ "resilience": "Active-Active",
+ "parents" :
+ [
+ "VNFC2"
+ ]
+ },
+ {
+ "vnfc-type" : "VNFC1",
+ "mandatory" : "true",
+ "resilience": "Active-Passive",
+ "parents" : []
+ }
+ ]
+ },
+ "tunable-parameters":
+ {
+ "strategy" : "",
+ "wait-time": "120",
+ "retry-count": "5"
+ },
+ "capabilities" :
+ {
+ "vnf":
+ [
+ "Stop",
+ "Start",
+ "StartApplication",
+ "StopApplication"
+ ],
+ "vf-module":
+ [
+ "Stop",
+ "Start"
+ ],
+ "vm" :
+ [
+ "Stop",
+ "Start"
+ ],
+ "vnfc":
+ [
+ "StopApplication",
+ "StartApplication",
+ "HealthCheck"
+ ]
+ }
+}
+
+
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/optional-vnfc-data.json b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/optional-vnfc-data.json
new file mode 100644
index 000000000..cc5d3a0c4
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/optional-vnfc-data.json
@@ -0,0 +1,196 @@
+/*-
+ * ============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=========================================================
+ */
+
+
+
+
+{
+ "request-info":
+ {
+ "action": "Start",
+ "action-level": "vnf",
+ "action-identifier":
+ {
+ "vnf-id": "dbgx0001v"
+ },
+ "payload": "ABC"
+ },
+ "inventory-info":
+ {
+ "vnf-info":
+ {
+ "vnf-id" : "abc",
+ "vnf-name": "vVNF",
+ "vnf-type": "vVNF",
+ "vnf-version" : "1.0",
+ "vm":
+ [
+ {
+ "vserver-id" : "vnfc2_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc3_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC3",
+ "vnfc-name": "VNFC3 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc3_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC3",
+ "vnfc-name": "VNFC3 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid3",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc1_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC1",
+ "vnfc-name": "VNFC1 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc1_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC1",
+ "vnfc-name": "VNFC1 - Name"
+ }
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid4",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid5",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ }
+ ]
+ }
+ },
+ "dependency-info":
+ {
+ "vnfcs" :
+ [
+ {
+ "vnfc-type" : "VNFC2",
+ "mandatory" : "true",
+ "resilience": "Active-Active",
+ "parents" :
+ [
+ "VNFC1"
+ ]
+ },
+ {
+ "vnfc-type" : "VNFC3",
+ "mandatory" : "false",
+ "resilience": "Active-Active",
+ "parents" :
+ [
+ "VNFC2"
+ ]
+ },
+ {
+ "vnfc-type" : "VNFC1",
+ "mandatory" : "true",
+ "resilience": "Active-Passive",
+ "parents" : []
+ }
+ ]
+ },
+ "tunable-parameters":
+ {
+ "strategy" : "FORWARD",
+ "wait-time": "120",
+ "retry-count": "5"
+ },
+ "capabilities" :
+ {
+ "vnf":
+ [
+ "Stop",
+ "Start",
+ "StartApplication",
+ "StopApplication"
+ ],
+ "vf-module":
+ [
+ "Stop",
+ "Start"
+ ],
+ "vm" :
+ [
+ "Stop",
+ "Start"
+ ],
+ "vnfc":
+ [
+ "StopApplication",
+ "StartApplication",
+ "HealthCheck"
+ ]
+ }
+}
+
+
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/optional-vnfc.json b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/optional-vnfc.json
new file mode 100644
index 000000000..a3067697d
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/optional-vnfc.json
@@ -0,0 +1,176 @@
+/*-
+ * ============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=========================================================
+ */
+
+
+
+
+{
+ "request-info":
+ {
+ "action": "Start",
+ "action-level": "vnf",
+ "action-identifier":
+ {
+ "vnf-id": "dbgx0001v"
+ },
+ "payload": "ABC"
+ },
+ "inventory-info":
+ {
+ "vnf-info":
+ {
+ "vnf-id" : "abc",
+ "vnf-name": "vVNF",
+ "vnf-type": "vVNF",
+ "vnf-version" : "1.0",
+ "vm":
+ [
+ {
+ "vserver-id" : "vnfc2_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid3",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc1_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC1",
+ "vnfc-name": "VNFC1 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc1_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC1",
+ "vnfc-name": "VNFC1 - Name"
+ }
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid4",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid5",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ }
+ ]
+ }
+ },
+ "dependency-info":
+ {
+ "vnfcs" :
+ [
+ {
+ "vnfc-type" : "VNFC2",
+ "mandatory" : "true",
+ "resilience": "Active-Active",
+ "parents" :
+ [
+ "VNFC1"
+ ]
+ },
+ {
+ "vnfc-type" : "VNFC3",
+ "mandatory" : "false",
+ "resilience": "Active-Active",
+ "parents" : [
+ "VNFC2"
+ ]
+ },
+ {
+ "vnfc-type" : "VNFC1",
+ "mandatory" : "true",
+ "resilience": "Active-Passive",
+ "parents" : []
+ }
+ ]
+ },
+ "tunable-parameters":
+ {
+ "strategy" : "FORWARD",
+ "wait-time": "120",
+ "retry-count": "5"
+ },
+ "capabilities" : {
+ "vnf":
+ [
+ "Stop",
+ "Start",
+ "StartApplication",
+ "StopApplication"
+ ],
+ "vf-module":
+ [
+ "Stop",
+ "Start"
+ ],
+ "vm" :
+ [
+ "Stop",
+ "Start"
+ ],
+ "vnfc":
+ [
+ "StopApplication",
+ "StartApplication",
+ "HealthCheck"
+ ]
+ }
+}
+
+
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/start-single-vm-duplicate.json b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/start-single-vm-duplicate.json
new file mode 100644
index 000000000..3f22fd669
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/start-single-vm-duplicate.json
@@ -0,0 +1,92 @@
+/*-
+ * ============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=========================================================
+ */
+
+
+
+
+{
+ "request-info":
+ {
+ "action": "Start",
+ "action-level": "vm",
+ "action-identifier":
+ {
+ "vserver-id": "dbgx0001v"
+ },
+ "payload": "ABC"
+ },
+ "inventory-info":
+ {
+ "vnf-info":
+ {
+ "vnf-id" : "abc",
+ "vnf-name": "vVNF",
+ "vnf-type": "vVNF",
+ "vnf-version" : "1.0",
+ "vm":
+ [
+ {
+ "vserver-id" : "vnfc2_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+ }
+ ]
+ }
+ },
+ "dependency-info":
+ {
+
+ },
+ "tunable-parameters":
+ {
+
+ },
+ "capabilities" :
+ {
+ "vm" :
+ [
+ "Stop",
+ "Start"
+ ],
+ "vnfc":
+ [
+ "StopApplication",
+ "StartApplication",
+ "HealthCheck"
+ ]
+ }
+}
+
+
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/start-single-vm-per-vnfc.json b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/start-single-vm-per-vnfc.json
new file mode 100644
index 000000000..dac5028b9
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/start-single-vm-per-vnfc.json
@@ -0,0 +1,93 @@
+/*-
+ * ============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=========================================================
+ */
+
+
+
+
+{
+ "request-info":
+ {
+ "action": "Start",
+ "action-level": "vm",
+ "action-identifier":
+ {
+ "vserver-id": "dbgx0001v"
+ },
+ "payload": "ABC"
+ },
+ "inventory-info":
+ {
+ "vnf-info":
+ {
+ "vnf-id" : "abc",
+ "vnf-name": "vVNF",
+ "vnf-type": "vVNF",
+ "vnf-version" : "1.0",
+ "vm":
+ [
+ {
+ "vserver-id" : "vnfc2_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+ },
+ {
+ "vserver-id" : "vnfc1_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC1",
+ "vnfc-name": "VNFC1 - Name"
+ }
+
+ }
+ ]
+ }
+ },
+ "dependency-info":
+ {
+
+ },
+ "tunable-parameters":
+ {
+
+ },
+ "capabilities" :
+ {
+ "vm" :
+ [
+ "Stop",
+ "Start"
+ ],
+ "vnfc":
+ [
+ "StopApplication",
+ "StartApplication",
+ "HealthCheck"
+ ]
+ }
+}
+
+
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/start-single-vm.json b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/start-single-vm.json
new file mode 100644
index 000000000..ef76ec240
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/start-single-vm.json
@@ -0,0 +1,84 @@
+/*-
+ * ============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=========================================================
+ */
+
+
+
+
+{
+ "request-info":
+ {
+ "action": "Start",
+ "action-level": "vm",
+ "action-identifier":
+ {
+ "vserver-id": "dbgx0001v"
+ },
+ "payload": "ABC"
+ },
+ "inventory-info":
+ {
+ "vnf-info":
+ {
+ "vnf-id" : "abc",
+ "vnf-name": "vVNF",
+ "vnf-type": "vVNF",
+ "vnf-version" : "1.0",
+ "vm":
+ [
+ {
+ "vserver-id" : "vnfc2_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+ }
+ ]
+ }
+ },
+ "dependency-info":
+ {
+
+ },
+ "tunable-parameters":
+ {
+
+ },
+ "capabilities" :
+ {
+ "vm" :
+ [
+ "Stop",
+ "Start"
+ ],
+ "vnfc":
+ [
+ "StopApplication",
+ "StartApplication",
+ "HealthCheck"
+ ]
+ }
+}
+
+
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/start-without-dependency.json b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/start-without-dependency.json
new file mode 100644
index 000000000..ec6a2b7ba
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/start-without-dependency.json
@@ -0,0 +1,156 @@
+/*-
+ * ============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=========================================================
+ */
+
+
+
+
+{
+ "request-info":
+ {
+ "action": "Start",
+ "action-level": "vm",
+ "action-identifier":
+ {
+ "vnf-id": "dbgx0001v"
+ },
+ "payload": "ABC"
+ },
+ "inventory-info":
+ {
+ "vnf-info":
+ {
+ "vnf-id" : "abc",
+ "vnf-name": "vVNF",
+ "vnf-type": "vVNF",
+ "vnf-version" : "1.0",
+ "vm":
+ [
+ {
+ "vserver-id" : "vnfc2_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc3_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC3",
+ "vnfc-name": "VNFC3 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc3_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC3",
+ "vnfc-name": "VNFC3 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid3",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc1_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC1",
+ "vnfc-name": "VNFC1 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc1_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC1",
+ "vnfc-name": "VNFC1 - Name"
+ }
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid4",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid5",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ }
+ ]
+ }
+ },
+ "dependency-info":
+ {
+
+ },
+ "tunable-parameters":
+ {
+
+ },
+ "capabilities" :
+ {
+ "vm" :
+ [
+ "Stop",
+ "Start"
+ ],
+ "vnfc":
+ [
+ "StopApplication",
+ "StartApplication",
+ "HealthCheck"
+ ]
+ }
+}
+
+
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/start.json b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/start.json
new file mode 100644
index 000000000..143b41d23
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/start.json
@@ -0,0 +1,196 @@
+/*-
+ * ============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=========================================================
+ */
+
+
+
+
+{
+ "request-info":
+ {
+ "action": "Start",
+ "action-level": "vnf",
+ "action-identifier":
+ {
+ "vnf-id": "dbgx0001v"
+ },
+ "payload": "ABC"
+ },
+ "inventory-info":
+ {
+ "vnf-info":
+ {
+ "vnf-id" : "abc",
+ "vnf-name": "vVNF",
+ "vnf-type": "vVNF",
+ "vnf-version" : "1.0",
+ "vm":
+ [
+ {
+ "vserver-id" : "vnfc2_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc3_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC3",
+ "vnfc-name": "VNFC3 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc3_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC3",
+ "vnfc-name": "VNFC3 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid3",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc1_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC1",
+ "vnfc-name": "VNFC1 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc1_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC1",
+ "vnfc-name": "VNFC1 - Name"
+ }
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid4",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid5",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ }
+ ]
+ }
+ },
+ "dependency-info" :
+ {
+ "vnfcs" :
+ [
+ {
+ "vnfc-type" : "VNFC2",
+ "mandatory" : "true",
+ "resilience": "Active-Active",
+ "parents" :
+ [
+ "VNFC1"
+ ]
+ },
+ {
+ "vnfc-type" : "VNFC3",
+ "mandatory" : "true",
+ "resilience": "Active-Active",
+ "parents" :
+ [
+ "VNFC2"
+ ]
+ },
+ {
+ "vnfc-type" : "VNFC1",
+ "mandatory" : "true",
+ "resilience": "Active-Passive",
+ "parents" : []
+ }
+ ]
+ },
+ "tunable-parameters" :
+ {
+ "strategy" : "FORWARD",
+ "wait-time" : "120",
+ "retry-count" : "5"
+ },
+ "capabilities" :
+ {
+ "vnf":
+ [
+ "Stop",
+ "Start",
+ "StartApplication",
+ "StopApplication"
+ ],
+ "vf-module":
+ [
+ "Stop",
+ "Start"
+ ],
+ "vm" :
+ [
+ "Stop",
+ "Start"
+ ],
+ "vnfc":
+ [
+ "StopApplication",
+ "StartApplication",
+ "HealthCheck"
+ ]
+ }
+}
+
+
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/stop-action-level-val.json b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/stop-action-level-val.json
new file mode 100644
index 000000000..f089748f6
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/stop-action-level-val.json
@@ -0,0 +1,196 @@
+/*-
+ * ============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=========================================================
+ */
+
+
+
+
+{
+ "request-info":
+ {
+ "action": "Stop",
+ "action-level": "heel ",
+ "action-identifier":
+ {
+ "vnf-id": "dbgx0001v"
+ },
+ "payload": "ABC"
+ },
+ "inventory-info":
+ {
+ "vnf-info":
+ {
+ "vnf-id" : "abc",
+ "vnf-name": "vVNF",
+ "vnf-type": "vVNF",
+ "vnf-version" : "1.0",
+ "vm":
+ [
+ {
+ "vserver-id" : "vnfc2_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc3_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC3",
+ "vnfc-name": "VNFC3 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc3_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC3",
+ "vnfc-name": "VNFC3 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid3",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc1_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC1",
+ "vnfc-name": "VNFC1 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc1_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC1",
+ "vnfc-name": "VNFC1 - Name"
+ }
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid4",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid5",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ }
+ ]
+ }
+ },
+ "dependency-info":
+ {
+ "vnfcs" :
+ [
+ {
+ "vnfc-type" : "VNFC2",
+ "mandatory" : "true",
+ "resilience": "Active-Active",
+ "parents" :
+ [
+ "VNFC1"
+ ]
+ },
+ {
+ "vnfc-type" : "VNFC3",
+ "mandatory" : "true",
+ "resilience": "Active-Active",
+ "parents" :
+ [
+ "VNFC2"
+ ]
+ },
+ {
+ "vnfc-type" : "VNFC1",
+ "mandatory" : "true",
+ "resilience": "Active-Passive",
+ "parents" : []
+ }
+ ]
+ },
+ "tunable-parameters":
+ {
+ "strategy" : "FORWARD",
+ "wait-time": "120",
+ "retry-count": "5"
+ },
+ "capabilities" :
+ {
+ "vnf":
+ [
+ "Stop",
+ "Start",
+ "StartApplication",
+ "StopApplication"
+ ],
+ "vf-module":
+ [
+ "Stop",
+ "Start"
+ ],
+ "vm" :
+ [
+ "Stop",
+ "Start"
+ ],
+ "vnfc":
+ [
+ "StopApplication",
+ "StartApplication",
+ "HealthCheck"
+ ]
+ }
+}
+
+
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/stop-single-vm-per-vnfc.json b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/stop-single-vm-per-vnfc.json
new file mode 100644
index 000000000..210f9ac0e
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/stop-single-vm-per-vnfc.json
@@ -0,0 +1,92 @@
+/*-
+ * ============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=========================================================
+ */
+
+
+
+
+{
+ "request-info":
+ {
+ "action": "Stop",
+ "action-level": "vm",
+ "action-identifier":
+ {
+ "vserver-id": "dbgx0001v"
+ },
+ "payload": "ABC"
+ },
+ "inventory-info":
+ {
+ "vnf-info":
+ {
+ "vnf-id" : "abc",
+ "vnf-name": "vVNF",
+ "vnf-type": "vVNF",
+ "vnf-version" : "1.0",
+ "vm":
+ [
+ {
+ "vserver-id" : "vnfc2_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+ },
+ {
+ "vserver-id" : "vnfc1_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC1",
+ "vnfc-name": "VNFC1 - Name"
+ }
+
+ }
+ ]
+ }},
+ "dependency-info":
+ {
+
+ },
+ "tunable-parameters":
+ {
+
+ },
+ "capabilities" :
+ {
+ "vm" :
+ [
+ "Stop",
+ "Start"
+ ],
+ "vnfc":
+ [
+ "StopApplication",
+ "StartApplication",
+ "HealthCheck"
+ ]
+ }
+}
+
+
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/stop-single-vm.json b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/stop-single-vm.json
new file mode 100644
index 000000000..9679c9ba9
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/stop-single-vm.json
@@ -0,0 +1,84 @@
+/*-
+ * ============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=========================================================
+ */
+
+
+
+
+{
+ "request-info":
+ {
+ "action": "Stop",
+ "action-level": "vm",
+ "action-identifier":
+ {
+ "vserver-id": "dbgx0001v"
+ },
+ "payload": "ABC"
+ },
+ "inventory-info":
+ {
+ "vnf-info":
+ {
+ "vnf-id" : "abc",
+ "vnf-name": "vVNF",
+ "vnf-type": "vVNF",
+ "vnf-version" : "1.0",
+ "vm":
+ [
+ {
+ "vserver-id" : "vnfc2_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+ }
+ ]
+ }
+ },
+ "dependency-info":
+ {
+
+ },
+ "tunable-parameters":
+ {
+
+ },
+ "capabilities" :
+ {
+ "vm" :
+ [
+ "Stop",
+ "Start"
+ ],
+ "vnfc":
+ [
+ "StopApplication",
+ "StartApplication",
+ "HealthCheck"
+ ]
+ }
+}
+
+
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/stop-without-dep.json b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/stop-without-dep.json
new file mode 100644
index 000000000..6f70cca23
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/stop-without-dep.json
@@ -0,0 +1,197 @@
+/*-
+ * ============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=========================================================
+ */
+
+
+
+
+{
+ "request-info":
+ {
+ "action": "Stop",
+ "action-level": "vm",
+ "action-identifier":
+ {
+ "vnf-id": "dbgx0001v"
+ },
+ "payload": " {\"vnf-host-ip-address\": \"10.147.124.163\" }"
+
+ },
+ "inventory-info":
+ {
+ "vnf-info":
+ {
+ "vnf-id" : "abc",
+ "vnf-name": "vVNF",
+ "vnf-type": "vVNF",
+ "vnf-version" : "1.0",
+ "vm":
+ [
+ {
+ "vserver-id" : "vnfc2_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc3_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC3",
+ "vnfc-name": "VNFC3 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc3_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC3",
+ "vnfc-name": "VNFC3 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid3",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc1_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC1",
+ "vnfc-name": "VNFC1 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc1_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC1",
+ "vnfc-name": "VNFC1 - Name"
+ }
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid4",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid5",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ }
+ ]
+ }
+ },
+ "dependency-info":
+ {
+ "vnfcs" :
+ [
+ {
+ "vnfc-type" : "VNFC2",
+ "mandatory" : "true",
+ "resilience": "Active-Active",
+ "parents" :
+ [
+ "VNFC1"
+ ]
+ },
+ {
+ "vnfc-type" : "VNFC3",
+ "mandatory" : "true",
+ "resilience": "Active-Active",
+ "parents" :
+ [
+ "VNFC2"
+ ]
+ },
+ {
+ "vnfc-type" : "VNFC1",
+ "mandatory" : "true",
+ "resilience": "Active-Passive",
+ "parents" : []
+ }
+ ]
+ },
+ "tunable-parameters":
+ {
+ "strategy" : "FORWARD",
+ "wait-time": "120",
+ "retry-count": "5"
+ },
+ "capabilities" :
+ {
+ "vnf":
+ [
+ "Stop",
+ "Start",
+ "StartApplication",
+ "StopApplication"
+ ],
+ "vf-module":
+ [
+ "Stop",
+ "Start"
+ ],
+ "vm" :
+ [
+ "Stop",
+ "Start"
+ ],
+ "vnfc":
+ [
+ "StopApplication",
+ "StartApplication",
+ "HealthCheck"
+ ]
+ }
+}
+
+
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/stop.json b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/stop.json
new file mode 100644
index 000000000..9131a652b
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/stop.json
@@ -0,0 +1,197 @@
+/*-
+ * ============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=========================================================
+ */
+
+
+
+
+{
+ "request-info":
+ {
+ "action": "Stop",
+ "action-level": "vnf",
+ "action-identifier":
+ {
+ "vnf-id": "dbgx0001v"
+ },
+ "payload": " {\"vnf-host-ip-address\": \"10.147.124.163\" }"
+
+ },
+ "inventory-info":
+ {
+ "vnf-info":
+ {
+ "vnf-id" : "abc",
+ "vnf-name": "vVNF",
+ "vnf-type": "vVNF",
+ "vnf-version" : "1.0",
+ "vm":
+ [
+ {
+ "vserver-id" : "vnfc2_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc3_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC3",
+ "vnfc-name": "VNFC3 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc3_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC3",
+ "vnfc-name": "VNFC3 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid3",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc1_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC1",
+ "vnfc-name": "VNFC1 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc1_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC1",
+ "vnfc-name": "VNFC1 - Name"
+ }
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid4",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid5",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ }
+ ]
+ }
+ },
+ "dependency-info":
+ {
+ "vnfcs" :
+ [
+ {
+ "vnfc-type" : "VNFC2",
+ "mandatory" : "true",
+ "resilience": "Active-Active",
+ "parents" :
+ [
+ "VNFC1"
+ ]
+ },
+ {
+ "vnfc-type" : "VNFC3",
+ "mandatory" : "true",
+ "resilience": "Active-Active",
+ "parents" :
+ [
+ "VNFC2"
+ ]
+ },
+ {
+ "vnfc-type" : "VNFC1",
+ "mandatory" : "true",
+ "resilience": "Active-Passive",
+ "parents" : []
+ }
+ ]
+ },
+ "tunable-parameters":
+ {
+ "strategy" : "FORWARD",
+ "wait-time": "120",
+ "retry-count": "5"
+ },
+ "capabilities" :
+ {
+ "vnf":
+ [
+ "Stop",
+ "Start",
+ "StartApplication",
+ "StopApplication"
+ ],
+ "vf-module":
+ [
+ "Stop",
+ "Start"
+ ],
+ "vm" :
+ [
+ "Stop",
+ "Start"
+ ],
+ "vnfc":
+ [
+ "StopApplication",
+ "StartApplication",
+ "HealthCheck"
+ ]
+ }
+}
+
+
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/wrongaction.json b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/wrongaction.json
new file mode 100644
index 000000000..72f6ed87f
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/wrongaction.json
@@ -0,0 +1,196 @@
+/*-
+ * ============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=========================================================
+ */
+
+
+
+
+{
+ "request-info":
+ {
+ "action": "start",
+ "action-level": "vnf",
+ "action-identifier":
+ {
+ "vnf-id": "dbgx0001v"
+ },
+ "payload": "ABC"
+ },
+ "inventory-info":
+ {
+ "vnf-info":
+ {
+ "vnf-id" : "abc",
+ "vnf-name": "vVNF",
+ "vnf-type": "vVNF",
+ "vnf-version" : "1.0",
+ "vm":
+ [
+ {
+ "vserver-id" : "vnfc2_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc3_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC3",
+ "vnfc-name": "VNFC3 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc3_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC3",
+ "vnfc-name": "VNFC3 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid3",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc1_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC1",
+ "vnfc-name": "VNFC1 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc1_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC1",
+ "vnfc-name": "VNFC1 - Name"
+ }
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid4",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid5",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ }
+ ]
+ }
+ },
+ "dependency-info":
+ {
+ "vnfcs" :
+ [
+ {
+ "vnfc-type" : "VNFC2",
+ "mandatory" : "true",
+ "resilience": "Active-Active",
+ "parents" :
+ [
+ "VNFC1"
+ ]
+ },
+ {
+ "vnfc-type" : "VNFC3",
+ "mandatory" : "true",
+ "resilience": "Active-Active",
+ "parents" :
+ [
+ "VNFC2"
+ ]
+ },
+ {
+ "vnfc-type" : "VNFC1",
+ "mandatory" : "true",
+ "resilience": "Active-Passive",
+ "parents" : []
+ }
+ ]
+ },
+ "tunable-parameters":
+ {
+ "strategy" : "FORWARD",
+ "wait-time": "120",
+ "retry-count": "5"
+ },
+ "capabilities" :
+ {
+ "vnf":
+ [
+ "Stop",
+ "Start",
+ "StartApplication",
+ "StopApplication"
+ ],
+ "vf-module":
+ [
+ "Stop",
+ "Start"
+ ],
+ "vm" :
+ [
+ "Stop",
+ "Start"
+ ],
+ "vnfc":
+ [
+ "StopApplication",
+ "StartApplication",
+ "HealthCheck"
+ ]
+ }
+}
+
+
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/wrongnumber.json b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/wrongnumber.json
new file mode 100644
index 000000000..958df0379
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/input/wrongnumber.json
@@ -0,0 +1,196 @@
+/*-
+ * ============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=========================================================
+ */
+
+
+
+
+{
+ "request-info":
+ {
+ "action": "Start",
+ "action-level": "vnf",
+ "action-identifier":
+ {
+ "vnf-id": "dbgx0001v"
+ },
+ "payload": "ABC"
+ },
+ "inventory-info":
+ {
+ "vnf-info":
+ {
+ "vnf-id" : "abc",
+ "vnf-name": "vVNF",
+ "vnf-type": "vVNF",
+ "vnf-version" : "1.0",
+ "vm":
+ [
+ {
+ "vserver-id" : "vnfc2_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc3_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC3",
+ "vnfc-name": "VNFC3 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc3_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC3",
+ "vnfc-name": "VNFC3 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid3",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc1_vserverid1",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC1",
+ "vnfc-name": "VNFC1 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc1_vserverid2",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC1",
+ "vnfc-name": "VNFC1 - Name"
+ }
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid4",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ },
+ {
+ "vserver-id" : "vnfc2_vserverid5",
+ "vnfc":
+ {
+ "vnfc-type": "VNFC2",
+ "vnfc-name": "VNFC2 - Name"
+ }
+
+ }
+ ]
+ }
+ },
+ "dependency-info":
+ {
+ "vnfcs" :
+ [
+ {
+ "vnfc-type" : "VNFC2",
+ "mandatory" : "true",
+ "resilience": "Active-Active",
+ "parents" :
+ [
+ "VNFC1"
+ ]
+ },
+ {
+ "vnfc-type" : "VNFC3",
+ "mandatory" : "true",
+ "resilience": "Active-Active",
+ "parents" :
+ [
+ "VNFC2"
+ ]
+ },
+ {
+ "vnfc-type" : "VNFC1",
+ "mandatory" : "true",
+ "resilience": "Active-Passive",
+ "parents" : []
+ }
+ ]
+ },
+ "tunable-parameters":
+ {
+ "strategy" : "FORWARD",
+ "wait-time": "6a",
+ "retry-count": "5"
+ },
+ "capabilities" :
+ {
+ "vnf":
+ [
+ "Stop",
+ "Start",
+ "StartApplication",
+ "StopApplication"
+ ],
+ "vf-module":
+ [
+ "Stop",
+ "Start"
+ ],
+ "vm" :
+ [
+ "Stop",
+ "Start"
+ ],
+ "vnfc":
+ [
+ "StopApplication",
+ "StartApplication",
+ "HealthCheck"
+ ]
+ }
+}
+
+
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/optional-vnfc-with-data.json b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/optional-vnfc-with-data.json
new file mode 100644
index 000000000..15e7faa7e
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/optional-vnfc-with-data.json
@@ -0,0 +1,3 @@
+
+
+[{"transactionId":1,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc1_vserverid1"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":2,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc1_vserverid2"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":3,"action":"StartApplication","action-level":"vnfc","action-identifier":{"vnfc-name":"VNFC1 - Name"},"payload":"ABC","precheck-operator":"any","precheck-options":[{"pre-transactionID":1,"param-name":"status","param-value":"success"},{"pre-transactionID":2,"param-name":"status","param-value":"success"}],"responses":[]},{"transactionId":4,"action":"HealthCheck","action-level":"vnfc","action-identifier":{"vnfc-name":"VNFC1 - Name"},"payload":"ABC","responses":[{"response-message":"unhealthy","response-action":{"wait":"120","retry":"5"}},{"response-message":"healthy","response-action":{"continue":"true"}},{"response-message":"failure","response-action":{"stop":"true"}}]},{"transactionId":5,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc2_vserverid1"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":6,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc2_vserverid2"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":7,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc2_vserverid3"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":8,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc2_vserverid4"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":9,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc2_vserverid5"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":10,"action":"StartApplication","action-level":"vnfc","action-identifier":{"vnfc-name":"VNFC2 - Name"},"payload":"ABC","precheck-operator":"any","precheck-options":[{"pre-transactionID":5,"param-name":"status","param-value":"success"},{"pre-transactionID":6,"param-name":"status","param-value":"success"},{"pre-transactionID":7,"param-name":"status","param-value":"success"},{"pre-transactionID":8,"param-name":"status","param-value":"success"},{"pre-transactionID":9,"param-name":"status","param-value":"success"}],"responses":[]},{"transactionId":11,"action":"HealthCheck","action-level":"vnfc","action-identifier":{"vnfc-name":"VNFC2 - Name"},"payload":"ABC","responses":[{"response-message":"unhealthy","response-action":{"wait":"120","retry":"5"}},{"response-message":"healthy","response-action":{"continue":"true"}},{"response-message":"failure","response-action":{"stop":"true"}}]},{"transactionId":12,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc3_vserverid1"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":13,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc3_vserverid2"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":14,"action":"StartApplication","action-level":"vnfc","action-identifier":{"vnfc-name":"VNFC3 - Name"},"payload":"ABC","precheck-operator":"any","precheck-options":[{"pre-transactionID":12,"param-name":"status","param-value":"success"},{"pre-transactionID":13,"param-name":"status","param-value":"success"}],"responses":[]},{"transactionId":15,"action":"HealthCheck","action-level":"vnfc","action-identifier":{"vnfc-name":"VNFC3 - Name"},"payload":"ABC","responses":[{"response-message":"unhealthy","response-action":{"wait":"120","retry":"5"}},{"response-message":"healthy","response-action":{"continue":"true"}},{"response-message":"failure","response-action":{"stop":"true"}}]}]
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/optional-vnfc.json b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/optional-vnfc.json
new file mode 100644
index 000000000..1981427d3
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/optional-vnfc.json
@@ -0,0 +1,3 @@
+
+
+[{"transactionId":1,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc1_vserverid1"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":2,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc1_vserverid2"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":3,"action":"StartApplication","action-level":"vnfc","action-identifier":{"vnfc-name":"VNFC1 - Name"},"payload":"ABC","precheck-operator":"any","precheck-options":[{"pre-transactionID":1,"param-name":"status","param-value":"success"},{"pre-transactionID":2,"param-name":"status","param-value":"success"}],"responses":[]},{"transactionId":4,"action":"HealthCheck","action-level":"vnfc","action-identifier":{"vnfc-name":"VNFC1 - Name"},"payload":"ABC","responses":[{"response-message":"unhealthy", "response-action":{"wait":"120","retry":"5"}},{"response-message":"healthy","response-action":{"continue":"true"}},{"response-message":"failure","response-action":{"stop":"true"}}]},{"transactionId":5,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc2_vserverid1"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":6,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc2_vserverid2"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":7,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc2_vserverid3"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":8,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc2_vserverid4"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":9,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc2_vserverid5"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":10,"action":"StartApplication","action-level":"vnfc","action-identifier":{"vnfc-name":"VNFC2 - Name"},"payload":"ABC","precheck-operator":"any","precheck-options":[{"pre-transactionID":5,"param-name":"status","param-value":"success"},{"pre-transactionID":6,"param-name":"status","param-value":"success"},{"pre-transactionID":7,"param-name":"status","param-value":"success"},{"pre-transactionID":8,"param-name":"status","param-value":"success"},{"pre-transactionID":9,"param-name":"status","param-value":"success"}],"responses":[]},{"transactionId":11,"action":"HealthCheck","action-level":"vnfc","action-identifier":{"vnfc-name":"VNFC2 - Name"},"payload":"ABC","responses":[{"response-message":"unhealthy","response-action":{"wait":"120","retry":"5"}},{"response-message":"healthy","response-action":{"continue":"true"}},{"response-message":"failure","response-action":{"stop":"true"}}]}]
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/start-single-vm-per-vnfc.json b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/start-single-vm-per-vnfc.json
new file mode 100644
index 000000000..600e315b2
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/start-single-vm-per-vnfc.json
@@ -0,0 +1,3 @@
+
+
+[{"transactionId":1,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc2_vserverid1"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":2,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc1_vserverid1"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]}]
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/start-single-vm.json b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/start-single-vm.json
new file mode 100644
index 000000000..be4dc57b8
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/start-single-vm.json
@@ -0,0 +1,3 @@
+
+
+[{"transactionId":1,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc2_vserverid1"},"payload":"ABC","responses":[]}]
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/start-without-dependency.json b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/start-without-dependency.json
new file mode 100644
index 000000000..2bb344598
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/start-without-dependency.json
@@ -0,0 +1,3 @@
+
+
+[{"transactionId":1,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc3_vserverid1"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":2,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc3_vserverid2"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":3,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc2_vserverid1"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":4,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc2_vserverid2"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":5,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc2_vserverid3"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":6,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc2_vserverid4"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":7,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc2_vserverid5"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":8,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc1_vserverid1"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":9,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc1_vserverid2"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]}]
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/start.json b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/start.json
new file mode 100644
index 000000000..15e7faa7e
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/start.json
@@ -0,0 +1,3 @@
+
+
+[{"transactionId":1,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc1_vserverid1"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":2,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc1_vserverid2"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":3,"action":"StartApplication","action-level":"vnfc","action-identifier":{"vnfc-name":"VNFC1 - Name"},"payload":"ABC","precheck-operator":"any","precheck-options":[{"pre-transactionID":1,"param-name":"status","param-value":"success"},{"pre-transactionID":2,"param-name":"status","param-value":"success"}],"responses":[]},{"transactionId":4,"action":"HealthCheck","action-level":"vnfc","action-identifier":{"vnfc-name":"VNFC1 - Name"},"payload":"ABC","responses":[{"response-message":"unhealthy","response-action":{"wait":"120","retry":"5"}},{"response-message":"healthy","response-action":{"continue":"true"}},{"response-message":"failure","response-action":{"stop":"true"}}]},{"transactionId":5,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc2_vserverid1"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":6,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc2_vserverid2"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":7,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc2_vserverid3"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":8,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc2_vserverid4"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":9,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc2_vserverid5"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":10,"action":"StartApplication","action-level":"vnfc","action-identifier":{"vnfc-name":"VNFC2 - Name"},"payload":"ABC","precheck-operator":"any","precheck-options":[{"pre-transactionID":5,"param-name":"status","param-value":"success"},{"pre-transactionID":6,"param-name":"status","param-value":"success"},{"pre-transactionID":7,"param-name":"status","param-value":"success"},{"pre-transactionID":8,"param-name":"status","param-value":"success"},{"pre-transactionID":9,"param-name":"status","param-value":"success"}],"responses":[]},{"transactionId":11,"action":"HealthCheck","action-level":"vnfc","action-identifier":{"vnfc-name":"VNFC2 - Name"},"payload":"ABC","responses":[{"response-message":"unhealthy","response-action":{"wait":"120","retry":"5"}},{"response-message":"healthy","response-action":{"continue":"true"}},{"response-message":"failure","response-action":{"stop":"true"}}]},{"transactionId":12,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc3_vserverid1"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":13,"action":"Start","action-level":"vm","action-identifier":{"vserver-id":"vnfc3_vserverid2"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":14,"action":"StartApplication","action-level":"vnfc","action-identifier":{"vnfc-name":"VNFC3 - Name"},"payload":"ABC","precheck-operator":"any","precheck-options":[{"pre-transactionID":12,"param-name":"status","param-value":"success"},{"pre-transactionID":13,"param-name":"status","param-value":"success"}],"responses":[]},{"transactionId":15,"action":"HealthCheck","action-level":"vnfc","action-identifier":{"vnfc-name":"VNFC3 - Name"},"payload":"ABC","responses":[{"response-message":"unhealthy","response-action":{"wait":"120","retry":"5"}},{"response-message":"healthy","response-action":{"continue":"true"}},{"response-message":"failure","response-action":{"stop":"true"}}]}]
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/stop-single-vm-per-vnfc.json b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/stop-single-vm-per-vnfc.json
new file mode 100644
index 000000000..97d2d1be5
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/stop-single-vm-per-vnfc.json
@@ -0,0 +1,3 @@
+
+
+[{"transactionId":1,"action":"Stop","action-level":"vm","action-identifier":{"vserver-id":"vnfc2_vserverid1"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":2,"action":"Stop","action-level":"vm","action-identifier":{"vserver-id":"vnfc1_vserverid1"},"payload":"ABC","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]}]
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/stop-single-vm.json b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/stop-single-vm.json
new file mode 100644
index 000000000..b237fe6f7
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/stop-single-vm.json
@@ -0,0 +1,3 @@
+
+
+[{"transactionId":1,"action":"Stop","action-level":"vm","action-identifier":{"vserver-id":"vnfc2_vserverid1"},"payload":"ABC","responses":[]}]
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/stop-without-dep.json b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/stop-without-dep.json
new file mode 100644
index 000000000..85f3b9650
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/stop-without-dep.json
@@ -0,0 +1,3 @@
+
+
+[{"transactionId":1,"action":"Stop","action-level":"vm","action-identifier":{"vserver-id":"vnfc3_vserverid1"},"payload":" {\"vnf-host-ip-address\": \"10.147.124.163\" }","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":2,"action":"Stop","action-level":"vm","action-identifier":{"vserver-id":"vnfc3_vserverid2"},"payload":" {\"vnf-host-ip-address\": \"10.147.124.163\" }","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":3,"action":"Stop","action-level":"vm","action-identifier":{"vserver-id":"vnfc2_vserverid1"},"payload":" {\"vnf-host-ip-address\": \"10.147.124.163\" }","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":4,"action":"Stop","action-level":"vm","action-identifier":{"vserver-id":"vnfc2_vserverid2"},"payload":" {\"vnf-host-ip-address\": \"10.147.124.163\" }","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":5,"action":"Stop","action-level":"vm","action-identifier":{"vserver-id":"vnfc2_vserverid3"},"payload":" {\"vnf-host-ip-address\": \"10.147.124.163\" }","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":6,"action":"Stop","action-level":"vm","action-identifier":{"vserver-id":"vnfc2_vserverid4"},"payload":" {\"vnf-host-ip-address\": \"10.147.124.163\" }","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":7,"action":"Stop","action-level":"vm","action-identifier":{"vserver-id":"vnfc2_vserverid5"},"payload":" {\"vnf-host-ip-address\": \"10.147.124.163\" }","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":8,"action":"Stop","action-level":"vm","action-identifier":{"vserver-id":"vnfc1_vserverid1"},"payload":" {\"vnf-host-ip-address\": \"10.147.124.163\" }","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":9,"action":"Stop","action-level":"vm","action-identifier":{"vserver-id":"vnfc1_vserverid2"},"payload":" {\"vnf-host-ip-address\": \"10.147.124.163\" }","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]}]
diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/stop.json b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/stop.json
new file mode 100644
index 000000000..c401ed6a2
--- /dev/null
+++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/resources/output/stop.json
@@ -0,0 +1,3 @@
+
+
+[{"transactionId":1,"action":"StopApplication","action-level":"vnfc","action-identifier":{"vnfc-name":"VNFC1 - Name"},"payload":" {\"vnf-host-ip-address\": \"10.147.124.163\" }","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":2,"action":"Stop","action-level":"vm","action-identifier":{"vserver-id":"vnfc1_vserverid1"},"payload":" {\"vnf-host-ip-address\": \"10.147.124.163\" }","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":3,"action":"Stop","action-level":"vm","action-identifier":{"vserver-id":"vnfc1_vserverid2"},"payload":" {\"vnf-host-ip-address\": \"10.147.124.163\" }","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":4,"action":"StopApplication","action-level":"vnfc","action-identifier":{"vnfc-name":"VNFC2 - Name"},"payload":" {\"vnf-host-ip-address\": \"10.147.124.163\" }","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":5,"action":"Stop","action-level":"vm","action-identifier":{"vserver-id":"vnfc2_vserverid1"},"payload":" {\"vnf-host-ip-address\": \"10.147.124.163\" }","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":6,"action":"Stop","action-level":"vm","action-identifier":{"vserver-id":"vnfc2_vserverid2"},"payload":" {\"vnf-host-ip-address\": \"10.147.124.163\" }","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":7,"action":"Stop","action-level":"vm","action-identifier":{"vserver-id":"vnfc2_vserverid3"},"payload":" {\"vnf-host-ip-address\": \"10.147.124.163\" }","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":8,"action":"Stop","action-level":"vm","action-identifier":{"vserver-id":"vnfc2_vserverid4"},"payload":" {\"vnf-host-ip-address\": \"10.147.124.163\" }","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":9,"action":"Stop","action-level":"vm","action-identifier":{"vserver-id":"vnfc2_vserverid5"},"payload":" {\"vnf-host-ip-address\": \"10.147.124.163\" }","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":10,"action":"StopApplication","action-level":"vnfc","action-identifier":{"vnfc-name":"VNFC3 - Name"},"payload":" {\"vnf-host-ip-address\": \"10.147.124.163\" }","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":11,"action":"Stop","action-level":"vm","action-identifier":{"vserver-id":"vnfc3_vserverid1"},"payload":" {\"vnf-host-ip-address\": \"10.147.124.163\" }","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]},{"transactionId":12,"action":"Stop","action-level":"vm","action-identifier":{"vserver-id":"vnfc3_vserverid2"},"payload":" {\"vnf-host-ip-address\": \"10.147.124.163\" }","responses":[{"response-message":"failure","response-action":{"ignore":"true"}}]}]