aboutsummaryrefslogtreecommitdiffstats
path: root/appc-config/appc-flow-controller/provider/src/main
diff options
context:
space:
mode:
authorGeorge, Lina (lg941u) <lg941u@att.com>2019-02-07 11:33:37 -0500
committerPatrick Brady <patrick.brady@att.com>2019-02-08 16:58:52 +0000
commit899c2f1520b1ec529bf6b4faef6623ea566634dd (patch)
tree85e92286f1a52bb22a22651d71c142746cbcacee /appc-config/appc-flow-controller/provider/src/main
parent3188cd1b2770159eca5de4fbb64a5d1c90aa803e (diff)
Changes to config bundle for vnf level enhancement
Issue-ID: APPC-1380 Change-Id: Icfdc202a4763b7e708007573505e5b3be9d1454e Signed-off-by: George, Lina (lg941u) <lg941u@att.com>
Diffstat (limited to 'appc-config/appc-flow-controller/provider/src/main')
-rw-r--r--appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/ResponseHandlerImpl/DefaultResponseHandler.java15
-rw-r--r--appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/interfaceData/Capabilities.java78
-rw-r--r--appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/interfaceData/Vnfcslist.java56
-rw-r--r--appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/CapabilitiesDataExtractor.java109
-rw-r--r--appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/FlowControlNode.java381
-rw-r--r--appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/InventoryInfoExtractor.java99
-rw-r--r--appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/ResourceUriExtractor.java5
-rw-r--r--appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/utils/FlowControllerConstants.java21
8 files changed, 405 insertions, 359 deletions
diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/ResponseHandlerImpl/DefaultResponseHandler.java b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/ResponseHandlerImpl/DefaultResponseHandler.java
index 4c37a7afa..95740e9cc 100644
--- a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/ResponseHandlerImpl/DefaultResponseHandler.java
+++ b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/ResponseHandlerImpl/DefaultResponseHandler.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 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.
@@ -21,28 +21,33 @@
package org.onap.appc.flow.controller.ResponseHandlerImpl;
+import org.apache.commons.lang3.StringUtils;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import org.onap.appc.flow.controller.data.Response;
import org.onap.appc.flow.controller.data.ResponseAction;
import org.onap.appc.flow.controller.data.Transaction;
+import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
public class DefaultResponseHandler {
private static final EELFLogger log = EELFManager.getInstance().getLogger(DefaultResponseHandler.class);
- public ResponseAction handlerResponse(Transaction transaction) {
+ public ResponseAction handlerResponse(Transaction transaction, SvcLogicContext ctx) {
log.info("Transaction Input params " + transaction.toString());
ResponseAction responseAction = new ResponseAction();
if (transaction.getResponses() != null && !transaction.getResponses().isEmpty()) {
for (Response response : transaction.getResponses()) {
- if (response.getResponseCode() != null
- && response.getResponseCode().equals(transaction.getStatusCode())) {
+ if ((StringUtils.isNotBlank(ctx.getAttribute("error-code"))
+ && !StringUtils.equals(ctx.getAttribute("error-code"), "400"))
+ || ((StringUtils.isNotBlank(transaction.getStatusCode()))
+ && !StringUtils.equals(transaction.getStatusCode(), "400"))) {
+
responseAction = response.getResponseAction();
break;
}
}
}
- return responseAction ;
+ return responseAction;
}
}
diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/interfaceData/Capabilities.java b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/interfaceData/Capabilities.java
index 3ee2ceb49..200fbde2a 100644
--- a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/interfaceData/Capabilities.java
+++ b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/interfaceData/Capabilities.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 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.
@@ -25,11 +25,12 @@
// Generated on: 2017.07.31 at 10:30:39 AM EDT
//
-
package org.onap.appc.flow.controller.interfaceData;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
@@ -40,14 +41,8 @@ import javax.xml.bind.annotation.XmlType;
import com.fasterxml.jackson.annotation.JsonProperty;
-
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = {
- "vnf",
- "vfModule",
- "vm",
- "vnfc"
-})
+@XmlType(name = "", propOrder = { "vnf", "vfModule", "vm", "vnfc" })
@XmlRootElement(name = "capabilities")
public class Capabilities {
@@ -60,7 +55,7 @@ public class Capabilities {
protected List<String> vfModule;
@XmlList
@XmlElement(required = true)
- protected List<String> vm;
+ protected Map<String, List<String>> vm;
@XmlList
@XmlElement(required = true)
protected List<String> vnfc;
@@ -69,21 +64,21 @@ public class Capabilities {
* Gets the value of the vnf property.
*
* <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the vnf property.
+ * This accessor method returns a reference to the live list, not a snapshot.
+ * Therefore any modification you make to the returned list will be present
+ * inside the JAXB object. This is why there is not a <CODE>set</CODE> method
+ * for the vnf property.
*
* <p>
* For example, to add a new item, do as follows:
+ *
* <pre>
- * getVnf().add(newItem);
+ * getVnf().add(newItem);
* </pre>
*
*
* <p>
- * Objects of the following type(s) are allowed in the list
- * {@link String }
+ * Objects of the following type(s) are allowed in the list {@link String }
*
*
*/
@@ -98,21 +93,21 @@ public class Capabilities {
* Gets the value of the vfModule property.
*
* <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the vfModule property.
+ * This accessor method returns a reference to the live list, not a snapshot.
+ * Therefore any modification you make to the returned list will be present
+ * inside the JAXB object. This is why there is not a <CODE>set</CODE> method
+ * for the vfModule property.
*
* <p>
* For example, to add a new item, do as follows:
+ *
* <pre>
- * getVfModule().add(newItem);
+ * getVfModule().add(newItem);
* </pre>
*
*
* <p>
- * Objects of the following type(s) are allowed in the list
- * {@link String }
+ * Objects of the following type(s) are allowed in the list {@link String }
*
*
*/
@@ -127,27 +122,27 @@ public class Capabilities {
* Gets the value of the vm property.
*
* <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the vm property.
+ * This accessor method returns a reference to the live list, not a snapshot.
+ * Therefore any modification you make to the returned list will be present
+ * inside the JAXB object. This is why there is not a <CODE>set</CODE> method
+ * for the vm property.
*
* <p>
* For example, to add a new item, do as follows:
+ *
* <pre>
- * getVm().add(newItem);
+ * getVm().add(newItem);
* </pre>
*
*
* <p>
- * Objects of the following type(s) are allowed in the list
- * {@link String }
+ * Objects of the following type(s) are allowed in the list {@link Map}
*
*
*/
- public List<String> getVm() {
+ public Map<String, List<String>> getVm() {
if (vm == null) {
- vm = new ArrayList<String>();
+ vm = new HashMap<String, List<String>>();
}
return this.vm;
}
@@ -156,21 +151,21 @@ public class Capabilities {
* Gets the value of the vnfc property.
*
* <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the vnfc property.
+ * This accessor method returns a reference to the live list, not a snapshot.
+ * Therefore any modification you make to the returned list will be present
+ * inside the JAXB object. This is why there is not a <CODE>set</CODE> method
+ * for the vnfc property.
*
* <p>
* For example, to add a new item, do as follows:
+ *
* <pre>
- * getVnfc().add(newItem);
+ * getVnfc().add(newItem);
* </pre>
*
*
* <p>
- * Objects of the following type(s) are allowed in the list
- * {@link String }
+ * Objects of the following type(s) are allowed in the list {@link String }
*
*
*/
@@ -183,8 +178,7 @@ public class Capabilities {
@Override
public String toString() {
- return "Capabilities [vnf=" + vnf + ", vfModule=" + vfModule + ", vm="
- + vm + ", vnfc=" + vnfc + "]";
+ return "Capabilities [vnf=" + vnf + ", vfModule=" + vfModule + ", vm=" + vm + ", vnfc=" + vnfc + "]";
}
}
diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/interfaceData/Vnfcslist.java b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/interfaceData/Vnfcslist.java
index 110c89201..4c83ce6fe 100644
--- a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/interfaceData/Vnfcslist.java
+++ b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/interfaceData/Vnfcslist.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 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.
@@ -25,7 +25,6 @@
// Generated on: 2017.07.31 at 10:30:39 AM EDT
//
-
package org.onap.appc.flow.controller.interfaceData;
import javax.xml.bind.annotation.XmlAccessType;
@@ -35,11 +34,13 @@ import javax.xml.bind.annotation.XmlType;
import com.fasterxml.jackson.annotation.JsonProperty;
-
/**
- * <p>Java class for vnfcslist complex type.
+ * <p>
+ * Java class for vnfcslist complex type.
*
- * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * The following schema fragment specifies the expected content contained within
+ * this class.
*
* <pre>
* &lt;complexType name="vnfcslist">
@@ -57,10 +58,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "vnfcslist", propOrder = {
- "vnfcType",
- "vnfcName"
-})
+@XmlType(name = "vnfcslist", propOrder = { "vnfcType", "vnfcName" })
public class Vnfcslist {
@XmlElement(name = "vnfc-type", required = true)
@@ -69,13 +67,14 @@ public class Vnfcslist {
@XmlElement(name = "vnfc-name", required = true)
@JsonProperty("vnfc-name")
protected String vnfcName;
+ @XmlElement(name = "vnfc-function-code", required = true)
+ @JsonProperty("vnfc-function-code")
+ protected String vnfcFunctionCode;
/**
* Gets the value of the vnfcType property.
*
- * @return
- * possible object is
- * {@link String }
+ * @return possible object is {@link String }
*
*/
public String getVnfcType() {
@@ -86,8 +85,7 @@ public class Vnfcslist {
* Sets the value of the vnfcType property.
*
* @param value
- * allowed object is
- * {@link String }
+ * allowed object is {@link String }
*
*/
public void setVnfcType(String value) {
@@ -97,9 +95,7 @@ public class Vnfcslist {
/**
* Gets the value of the vnfcName property.
*
- * @return
- * possible object is
- * {@link String }
+ * @return possible object is {@link String }
*
*/
public String getVnfcName() {
@@ -110,17 +106,37 @@ public class Vnfcslist {
* Sets the value of the vnfcName property.
*
* @param value
- * allowed object is
- * {@link String }
+ * allowed object is {@link String }
*
*/
public void setVnfcName(String value) {
this.vnfcName = value;
}
+ /**
+ * Gets the value of the vnfcFunctionCode property.
+ *
+ * @return possible object is {@link String }
+ *
+ */
+ public String getVnfcFunctionCode() {
+ return vnfcFunctionCode;
+ }
+
+ /**
+ * Sets the value of the vnfcName property.
+ *
+ * @param value
+ * allowed object is {@link String }
+ *
+ */
+ public void setVnfcFunctionCode(String value) {
+ this.vnfcFunctionCode = value;
+ }
+
@Override
public String toString() {
- return "Vnfcslist [vnfcType=" + vnfcType + ", vnfcName=" + vnfcName
+ return "Vnfcslist [vnfcType=" + vnfcType + ", vnfcName=" + vnfcName + ", vnfcFunctionCode=" + vnfcFunctionCode
+ "]";
}
diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/CapabilitiesDataExtractor.java b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/CapabilitiesDataExtractor.java
index b740e4feb..a98d3268e 100644
--- a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/CapabilitiesDataExtractor.java
+++ b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/CapabilitiesDataExtractor.java
@@ -3,6 +3,7 @@
* ONAP : APPC
* ================================================================================
* Copyright (C) 2018 Nokia. All rights reserved.
+ * Copyright (C) 2019 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.
@@ -32,7 +33,13 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.apache.commons.lang3.StringUtils;
import org.onap.appc.flow.controller.dbervices.FlowControlDBService;
import org.onap.appc.flow.controller.interfaceData.Capabilities;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
@@ -40,56 +47,80 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicException;
public class CapabilitiesDataExtractor {
- private static final EELFLogger log = EELFManager.getInstance().getLogger(CapabilitiesDataExtractor.class);
+ private static final EELFLogger log = EELFManager.getInstance().getLogger(CapabilitiesDataExtractor.class);
- private final FlowControlDBService dbService;
- private final ObjectMapper mapper;
+ private final FlowControlDBService dbService;
+ private final ObjectMapper mapper;
- public CapabilitiesDataExtractor() {
- this(FlowControlDBService.initialise());
- }
+ public CapabilitiesDataExtractor() {
+ this(FlowControlDBService.initialise());
+ }
- /**
- * Ctor for tests, prefer to use default one
- */
- public CapabilitiesDataExtractor(FlowControlDBService dbService) {
- this.dbService = dbService;
+ /**
+ * Ctor for tests, prefer to use default one
+ */
+ public CapabilitiesDataExtractor(FlowControlDBService dbService) {
+ this.dbService = dbService;
- mapper = new ObjectMapper();
- mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
- mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
- }
+ mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ }
- Capabilities getCapabilitiesData(SvcLogicContext ctx) throws SvcLogicException, IOException {
+ Capabilities getCapabilitiesData(SvcLogicContext ctx) throws SvcLogicException, IOException {
- String fn = "FlowExecutorNode.getCapabilitiesData";
- String capabilitiesData = dbService.getCapabilitiesData(ctx);
- log.info(fn + "capabilitiesDataInput:" + capabilitiesData);
+ String fn = "FlowExecutorNode.getCapabilitiesData";
+ String capabilitiesData = dbService.getCapabilitiesData(ctx);
+ log.info(fn + ":capabilitiesDataInput:" + capabilitiesData);
- Capabilities capabilities = new Capabilities();
- if (capabilitiesData == null) {
- return capabilities;
- }
+ Capabilities capabilities = new Capabilities();
+ if (StringUtils.isBlank(capabilitiesData)) {
+ return capabilities;
+ }
- JsonNode capabilitiesNode = mapper.readTree(capabilitiesData);
- log.info("capabilitiesNode:" + capabilitiesNode.toString());
+ JsonNode capabilitiesNode = mapper.readTree(capabilitiesData);
+ JsonNode capNode = capabilitiesNode.get("capabilities");
+ log.info("capabilitiesNode:" + capabilitiesNode.toString());
- capabilities.getVfModule().addAll(extractParameterList(capabilitiesNode, VF_MODULE));
- capabilities.getVnfc().addAll(extractParameterList(capabilitiesNode, VNFC));
- capabilities.getVnf().addAll(extractParameterList(capabilitiesNode, VNF));
- capabilities.getVm().addAll(extractParameterList(capabilitiesNode, VM));
+ capabilities.getVfModule().addAll(extractParameterList(capNode, VF_MODULE));
+ capabilities.getVnfc().addAll(extractParameterList(capNode, VNFC));
+ capabilities.getVnf().addAll(extractParameterList(capNode, VNF));
+ capabilities.getVm().putAll(extractParameterMap(capNode, VM));
- log.info("Capabilities Output:" + capabilities.toString());
+ log.info("Capabilities Output:" + capabilities.toString());
- return capabilities;
- }
+ return capabilities;
+ }
- private <T> List<T> extractParameterList(JsonNode root, String parameter) throws IOException {
- JsonNode parameterNode = root.get(parameter);
- if (parameterNode == null) {
- return new ArrayList<>();
+ private List<String> extractParameterList(JsonNode root, String parameter) throws IOException {
+ JsonNode parameterNode = root.get(parameter);
+ if (parameterNode == null) {
+ return new ArrayList<>();
+ }
+ return mapper.readValue(parameterNode.toString(), new TypeReference<List<String>>() {
+ });
}
- return mapper.readValue(parameterNode.toString(), new TypeReference<List<T>>() {});
- }
-} \ No newline at end of file
+ private HashMap<String, List<String>> extractParameterMap(JsonNode root, String parameter) throws IOException {
+ JsonNode parameterNode = root.get(parameter);
+ HashMap<String, List<String>> hm = new HashMap<>();
+ if (parameterNode == null || !parameterNode.isArray()) {
+ return hm;
+ }
+ for (JsonNode n : parameterNode) {
+ Iterator<Map.Entry<String, JsonNode>> fldIter = n.fields();
+ while (fldIter.hasNext()) {
+ Map.Entry<String, JsonNode> currentEntry = fldIter.next();
+ if (currentEntry.getValue().isArray()) {
+ Iterator<JsonNode> nodeIter = currentEntry.getValue().elements();
+ List<String> listOfT = new ArrayList<>();
+ while (nodeIter.hasNext()) {
+ listOfT.add((nodeIter.next().asText()));
+ }
+ hm.put(currentEntry.getKey(), listOfT);
+ }
+ }
+ }
+ return hm;
+ }
+}
diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/FlowControlNode.java b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/FlowControlNode.java
index 1bbf8d0d1..34d40dd55 100644
--- a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/FlowControlNode.java
+++ b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/FlowControlNode.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 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.
@@ -95,212 +95,205 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
public class FlowControlNode implements SvcLogicJavaPlugin {
- private static final EELFLogger log = EELFManager.getInstance().getLogger(FlowControlNode.class);
-
- private final FlowControlDBService dbService;
- private final FlowSequenceGenerator flowSequenceGenerator;
-
- public FlowControlNode() {
- this.dbService = FlowControlDBService.initialise();
- this.flowSequenceGenerator = new FlowSequenceGenerator();
- }
-
- FlowControlNode(FlowControlDBService dbService, FlowSequenceGenerator flowSequenceGenerator) {
- this.dbService = dbService;
- this.flowSequenceGenerator = flowSequenceGenerator;
- }
-
- public void processFlow(Map<String, String> inParams, SvcLogicContext ctx)
- throws SvcLogicException {
- log.debug("Received processParamKeys call with params : " + inParams);
- String responsePrefix = inParams.get(INPUT_PARAM_RESPONSE_PREFIX);
- try {
- responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix + ".") : "";
- SvcLogicContext localContext = new SvcLogicContext();
-
- localContext.setAttribute(REQUEST_ID, ctx.getAttribute(REQUEST_ID));
- localContext.setAttribute(VNF_TYPE, ctx.getAttribute(VNF_TYPE));
- localContext.setAttribute(REQUEST_ACTION, ctx.getAttribute(REQUEST_ACTION));
- localContext.setAttribute(ACTION_LEVEL, ctx.getAttribute(ACTION_LEVEL));
- localContext.setAttribute(RESPONSE_PREFIX, responsePrefix);
- ctx.setAttribute(RESPONSE_PREFIX, responsePrefix);
-
- dbService.getFlowReferenceData(ctx, inParams, localContext);
-
- for (String key : localContext.getAttributeKeySet()) {
- log.debug("processFlow " + key + "=" + ctx.getAttribute(key));
- }
- processFlowSequence(inParams, ctx, localContext);
- if (!ctx.getAttribute(responsePrefix + OUTPUT_PARAM_STATUS).equals(OUTPUT_STATUS_SUCCESS)) {
- throw new SvcLogicException(ctx.getAttribute(responsePrefix + OUTPUT_STATUS_MESSAGE));
- }
- } catch (Exception e) {
- ctx.setAttribute(responsePrefix + OUTPUT_PARAM_STATUS, OUTPUT_STATUS_FAILURE);
- ctx.setAttribute(responsePrefix + OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
- log.error("Error occurred in processFlow ", e);
- throw new SvcLogicException(e.getMessage());
+ private static final EELFLogger log = EELFManager.getInstance().getLogger(FlowControlNode.class);
+
+ private final FlowControlDBService dbService;
+ private final FlowSequenceGenerator flowSequenceGenerator;
+
+ public FlowControlNode() {
+ this.dbService = FlowControlDBService.initialise();
+ this.flowSequenceGenerator = new FlowSequenceGenerator();
}
- }
-
- private void processFlowSequence(Map<String, String> inParams, SvcLogicContext ctx, SvcLogicContext localContext)
- throws Exception {
-
- String fn = "FlowExecutorNode.processflowSequence";
- log.debug(fn + "Received model for flow : " + localContext.toString());
-
- localContext
- .getAttributeKeySet()
- .forEach(key -> log.debug(key + "=" + ctx.getAttribute(key)));
-
- String flowSequence = flowSequenceGenerator.getFlowSequence(inParams, ctx, localContext);
-
- log.debug("Received Flow Sequence : " + flowSequence);
- HashMap<Integer, Transaction> transactionMap = createTransactionMap(flowSequence, localContext);
- executeAllTransaction(transactionMap, ctx);
- log.info("Executed all the transaction successfully");
- }
-
- private void executeAllTransaction(HashMap<Integer, Transaction> transactionMap, SvcLogicContext ctx)
- throws Exception {
-
- String fn = "FlowExecutorNode.executeAllTransaction ";
- int retry = 0;
- FlowExecutorInterface flowExecutor;
- for (int key = 1; key <= transactionMap.size(); key++) {
- log.debug(fn + "Starting transactions ID " + key + " :)=" + retry);
- Transaction transaction = transactionMap.get(key);
- if (!preProcessor(transactionMap, transaction)) {
- log.info("Skipping Transaction ID " + transaction.getTransactionId());
- continue;
- }
- if (transaction.getExecutionType() != null) {
- switch (transaction.getExecutionType()) {
- case GRAPH:
- flowExecutor = new GraphExecutor();
- break;
- case NODE:
- flowExecutor = new NodeExecutor();
- break;
- case REST:
- flowExecutor = new RestExecutor();
- break;
- default:
- throw new Exception("No Executor found for transaction ID" + transaction.getTransactionId());
- }
- flowExecutor.execute(transaction, ctx);
- ResponseAction responseAction = handleResponse(transaction);
- if (responseAction.getWait() != null && Integer.parseInt(responseAction.getWait()) > 0) {
- log.debug(fn + "Going to Sleep .... " + responseAction.getWait());
- Thread.sleep(Integer.parseInt(responseAction.getWait()) * 1000L);
- }
- if (responseAction.isIntermediateMessage()) {
- log.debug(fn + "Sending Intermediate Message back .... ");
- sendIntermediateMessage();
- }
- if (responseAction.getRetry() != null && Integer.parseInt(responseAction.getRetry()) > retry) {
- log.debug(fn + "Ooppss!!! We will retry again ....... ");
- key--;
- retry++;
- log.debug(fn + "key =" + key + "retry =" + retry);
- }
- if (responseAction.isIgnore()) {
- log.debug(fn + "Ignoring this Error and moving ahead ....... ");
- continue;
- }
- if (responseAction.isStop()) {
- log.debug(fn + "Need to Stop ....... ");
- break;
+ FlowControlNode(FlowControlDBService dbService, FlowSequenceGenerator flowSequenceGenerator) {
+ this.dbService = dbService;
+ this.flowSequenceGenerator = flowSequenceGenerator;
+ }
+
+ public void processFlow(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+ log.debug("Received processParamKeys call with params : " + inParams);
+ String responsePrefix = inParams.get(INPUT_PARAM_RESPONSE_PREFIX);
+ try {
+ responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix + ".") : "";
+ SvcLogicContext localContext = new SvcLogicContext();
+
+ localContext.setAttribute(REQUEST_ID, ctx.getAttribute(REQUEST_ID));
+ localContext.setAttribute(VNF_TYPE, ctx.getAttribute(VNF_TYPE));
+ localContext.setAttribute(REQUEST_ACTION, ctx.getAttribute(REQUEST_ACTION));
+ localContext.setAttribute(ACTION_LEVEL, ctx.getAttribute(ACTION_LEVEL));
+ localContext.setAttribute(RESPONSE_PREFIX, responsePrefix);
+ ctx.setAttribute(RESPONSE_PREFIX, responsePrefix);
+
+ dbService.getFlowReferenceData(ctx, inParams, localContext);
+
+ for (String key : localContext.getAttributeKeySet()) {
+ log.debug("processFlow " + key + "=" + ctx.getAttribute(key));
+ }
+ processFlowSequence(inParams, ctx, localContext);
+ if (!ctx.getAttribute(responsePrefix + OUTPUT_PARAM_STATUS).equals(OUTPUT_STATUS_SUCCESS)) {
+ throw new SvcLogicException(ctx.getAttribute(responsePrefix + OUTPUT_STATUS_MESSAGE));
+ }
+ } catch (Exception e) {
+ ctx.setAttribute(responsePrefix + OUTPUT_PARAM_STATUS, OUTPUT_STATUS_FAILURE);
+ ctx.setAttribute(responsePrefix + OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
+ log.error("Error occurred in processFlow ", e);
+ throw new SvcLogicException(e.getMessage());
}
- if (responseAction.getJump() != null && Integer.parseInt(responseAction.getJump()) > 0) {
- key = Integer.parseInt(responseAction.getJump());
- key--;
+ }
+
+ private void processFlowSequence(Map<String, String> inParams, SvcLogicContext ctx, SvcLogicContext localContext)
+ throws Exception {
+
+ String fn = "FlowExecutorNode.processflowSequence";
+ log.debug(fn + "Received model for flow : " + localContext.toString());
+
+ localContext.getAttributeKeySet().forEach(key -> log.debug(key + "=" + ctx.getAttribute(key)));
+
+ String flowSequence = flowSequenceGenerator.getFlowSequence(inParams, ctx, localContext);
+
+ log.debug("Received Flow Sequence : " + flowSequence);
+ HashMap<Integer, Transaction> transactionMap = createTransactionMap(flowSequence, localContext);
+ executeAllTransaction(transactionMap, ctx);
+ log.info("Executed all the transaction successfully");
+ }
+
+ private void executeAllTransaction(HashMap<Integer, Transaction> transactionMap, SvcLogicContext ctx)
+ throws Exception {
+
+ String fn = "FlowExecutorNode.executeAllTransaction ";
+ int retry = 0;
+ FlowExecutorInterface flowExecutor;
+ for (int key = 1; key <= transactionMap.size(); key++) {
+ log.debug(fn + "Starting transactions ID " + key + " :)=" + retry);
+ Transaction transaction = transactionMap.get(key);
+ if (!preProcessor(transactionMap, transaction)) {
+ log.info("Skipping Transaction ID " + transaction.getTransactionId());
+ continue;
+ }
+ if (transaction.getExecutionType() != null) {
+ switch (transaction.getExecutionType()) {
+ case GRAPH:
+ flowExecutor = new GraphExecutor();
+ break;
+ case NODE:
+ flowExecutor = new NodeExecutor();
+ break;
+ case REST:
+ flowExecutor = new RestExecutor();
+ break;
+ default:
+ throw new Exception("No Executor found for transaction ID" + transaction.getTransactionId());
+ }
+ flowExecutor.execute(transaction, ctx);
+ ResponseAction responseAction = handleResponse(transaction, ctx);
+
+ if (responseAction.getWait() != null && Integer.parseInt(responseAction.getWait()) > 0) {
+ log.debug(fn + "Going to Sleep .... " + responseAction.getWait());
+ Thread.sleep(Integer.parseInt(responseAction.getWait()) * 1000L);
+ }
+ if (responseAction.isIntermediateMessage()) {
+ log.debug(fn + "Sending Intermediate Message back .... ");
+ sendIntermediateMessage();
+ }
+ if (responseAction.getRetry() != null && Integer.parseInt(responseAction.getRetry()) > retry) {
+ log.debug(fn + "Ooppss!!! We will retry again ....... ");
+ key--;
+ retry++;
+ log.debug(fn + "key =" + key + "retry =" + retry);
+ }
+ if (responseAction.isIgnore()) {
+ log.debug(fn + "Ignoring this Error and moving ahead ....... ");
+ continue;
+ }
+ if (responseAction.isStop()) {
+ log.debug(fn + "Need to Stop ....... ");
+ break;
+ }
+ if (responseAction.getJump() != null && Integer.parseInt(responseAction.getJump()) > 0) {
+ key = Integer.parseInt(responseAction.getJump());
+ key--;
+ }
+ log.debug(fn + "key =" + key + "retry =" + retry);
+
+ } else {
+ throw new Exception("Don't know how to execute transaction ID " + transaction.getTransactionId());
+ }
}
- log.debug(fn + "key =" + key + "retry =" + retry);
+ }
- } else {
- throw new Exception("Don't know how to execute transaction ID " + transaction.getTransactionId());
- }
+ private void sendIntermediateMessage() {
+ // TODO Auto-generated method stub
}
- }
-
- private void sendIntermediateMessage() {
- // TODO Auto-generated method stub
- }
-
- private ResponseAction handleResponse(Transaction transaction) {
- log.info("Handling Response for transaction Id " + transaction.getTransactionId());
- DefaultResponseHandler defaultHandler = new DefaultResponseHandler();
- return defaultHandler.handlerResponse(transaction);
- }
-
- private boolean preProcessor(HashMap<Integer, Transaction> transactionMap, Transaction transaction)
- throws IOException {
-
- log.debug("Starting Preprocessing Logic ");
- boolean runThisStep = false;
- try {
- if (transaction.getPrecheck() != null
- && transaction.getPrecheck().getPrecheckOptions() != null
- && !transaction.getPrecheck().getPrecheckOptions().isEmpty()) {
-
- List<PrecheckOption> precheckOptions = transaction.getPrecheck().getPrecheckOptions();
- for (PrecheckOption precheck : precheckOptions) {
- Transaction trans = transactionMap.get(precheck.getpTransactionID());
- ObjectMapper mapper = new ObjectMapper();
- log.info("Mapper= " + mapper.writeValueAsString(trans));
- HashMap trmap = mapper.readValue(mapper.writeValueAsString(trans), HashMap.class);
- runThisStep = trmap.get(precheck.getParamName()) != null
- && ((String) trmap.get(precheck.getParamName()))
- .equalsIgnoreCase(precheck.getParamValue());
-
- if (("any").equalsIgnoreCase(transaction.getPrecheck().getPrecheckOperator()) && runThisStep) {
- break;
- }
+
+ private ResponseAction handleResponse(Transaction transaction, SvcLogicContext ctx) {
+ log.info("Handling Response for transaction Id " + transaction.getTransactionId());
+ DefaultResponseHandler defaultHandler = new DefaultResponseHandler();
+ return defaultHandler.handlerResponse(transaction, ctx);
+ }
+
+ private boolean preProcessor(HashMap<Integer, Transaction> transactionMap, Transaction transaction)
+ throws IOException {
+
+ log.debug("Starting Preprocessing Logic ");
+ boolean runThisStep = false;
+ try {
+ if (transaction.getPrecheck() != null && transaction.getPrecheck().getPrecheckOptions() != null
+ && !transaction.getPrecheck().getPrecheckOptions().isEmpty()) {
+
+ List<PrecheckOption> precheckOptions = transaction.getPrecheck().getPrecheckOptions();
+ for (PrecheckOption precheck : precheckOptions) {
+ Transaction trans = transactionMap.get(precheck.getpTransactionID());
+ ObjectMapper mapper = new ObjectMapper();
+ log.info("Mapper= " + mapper.writeValueAsString(trans));
+ HashMap trmap = mapper.readValue(mapper.writeValueAsString(trans), HashMap.class);
+ runThisStep = trmap.get(precheck.getParamName()) != null
+ && ((String) trmap.get(precheck.getParamName())).equalsIgnoreCase(precheck.getParamValue());
+
+ if (("any").equalsIgnoreCase(transaction.getPrecheck().getPrecheckOperator()) && runThisStep) {
+ break;
+ }
+ }
+ } else {
+ log.debug("No Pre check defined for transaction ID " + transaction.getTransactionId());
+ runThisStep = true;
+ }
+ } catch (Exception e) {
+ log.error("Error occured when Preprocessing Logic ", e);
+ throw e;
}
- } else {
- log.debug("No Pre check defined for transaction ID " + transaction.getTransactionId());
- runThisStep = true;
- }
- } catch (Exception e) {
- log.error("Error occured when Preprocessing Logic ", e);
- throw e;
+ log.debug("Returing process current Transaction = " + runThisStep);
+ return runThisStep;
}
- log.debug("Returing process current Transaction = " + runThisStep);
- return runThisStep;
- }
-
- private HashMap<Integer, Transaction> createTransactionMap(String flowSequence, SvcLogicContext localContext)
- throws Exception {
-
- ObjectMapper mapper = new ObjectMapper();
- Transactions transactions = mapper.readValue(flowSequence, Transactions.class);
- HashMap<Integer, Transaction> transMap = new HashMap<>();
- for (Transaction transaction : transactions.getTransactions()) {
- compileFlowDependencies(transaction, localContext);
- //parse the Transactions Object and create records in process_flow_status table
- //loadTransactionIntoStatus(transactions, ctx);
- transMap.put(transaction.getTransactionId(), transaction);
+
+ private HashMap<Integer, Transaction> createTransactionMap(String flowSequence, SvcLogicContext localContext)
+ throws Exception {
+
+ ObjectMapper mapper = new ObjectMapper();
+ Transactions transactions = mapper.readValue(flowSequence, Transactions.class);
+ HashMap<Integer, Transaction> transMap = new HashMap<>();
+ for (Transaction transaction : transactions.getTransactions()) {
+ compileFlowDependencies(transaction, localContext);
+ // parse the Transactions Object and create records in process_flow_status table
+ // loadTransactionIntoStatus(transactions, ctx);
+ transMap.put(transaction.getTransactionId(), transaction);
+ }
+ return transMap;
}
- return transMap;
- }
- private void compileFlowDependencies(Transaction transaction, SvcLogicContext localContext)
- throws Exception {
+ private void compileFlowDependencies(Transaction transaction, SvcLogicContext localContext) throws Exception {
- dbService.populateModuleAndRPC(transaction, localContext.getAttribute(VNF_TYPE));
- ObjectMapper mapper = new ObjectMapper();
- log.debug("Individual Transaction Details :" + transaction.toString());
+ dbService.populateModuleAndRPC(transaction, localContext.getAttribute(VNF_TYPE));
+ ObjectMapper mapper = new ObjectMapper();
+ log.debug("Individual Transaction Details :" + transaction.toString());
- if ((localContext.getAttribute(SEQUENCE_TYPE) == null)
- || (localContext.getAttribute(SEQUENCE_TYPE) != null
- && !localContext.getAttribute(SEQUENCE_TYPE)
- .equalsIgnoreCase(DESINGTIME))) {
+ if ((localContext.getAttribute(SEQUENCE_TYPE) == null) || (localContext.getAttribute(SEQUENCE_TYPE) != null
+ && !localContext.getAttribute(SEQUENCE_TYPE).equalsIgnoreCase(DESINGTIME))) {
- localContext.setAttribute("artifact-content", mapper.writeValueAsString(transaction));
- dbService.loadSequenceIntoDB(localContext);
+ localContext.setAttribute("artifact-content", mapper.writeValueAsString(transaction));
+ dbService.loadSequenceIntoDB(localContext);
+ }
+ // get a field in transction class as transactionhandle interface and register
+ // the Handler here for each transactions
}
- //get a field in transction class as transactionhandle interface and register the Handler here for each trnactions
- }
}
diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/InventoryInfoExtractor.java b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/InventoryInfoExtractor.java
index 4e2706514..b45d6366a 100644
--- a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/InventoryInfoExtractor.java
+++ b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/InventoryInfoExtractor.java
@@ -3,7 +3,7 @@
* ONAP : APPC
* ================================================================================
* Copyright (C) 2018 Nokia. All rights reserved.
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-2019 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.
@@ -34,66 +34,65 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
*/
class InventoryInfoExtractor {
- private static final EELFLogger log = EELFManager.getInstance().getLogger(InventoryInfoExtractor.class);
+ private static final EELFLogger log = EELFManager.getInstance().getLogger(InventoryInfoExtractor.class);
- InventoryInfo getInventoryInfo(SvcLogicContext ctx, String vnfId) {
- String fn = "InventoryInfoExtractor.getInventoryInfo";
+ InventoryInfo getInventoryInfo(SvcLogicContext ctx, String vnfId) {
+ String fn = "InventoryInfoExtractor.getInventoryInfo";
- VnfInfo vnfInfo = new VnfInfo();
- vnfInfo.setVnfId(vnfId);
- vnfInfo.setVnfName(ctx.getAttribute("tmp.vnfInfo.vnf.vnf-name"));
- vnfInfo.setVnfType(ctx.getAttribute("tmp.vnfInfo.vnf.vnf-type"));
- vnfInfo.setIdentityUrl(getIdentityUrl(ctx,vnfInfo,vnfId));
+ VnfInfo vnfInfo = new VnfInfo();
+ vnfInfo.setVnfId(vnfId);
+ vnfInfo.setVnfName(ctx.getAttribute("tmp.vnfInfo.vnf.vnf-name"));
+ vnfInfo.setVnfType(ctx.getAttribute("tmp.vnfInfo.vnf.vnf-type"));
+ vnfInfo.setIdentityUrl(getIdentityUrl(ctx, vnfInfo, vnfId));
- String vmcount = ctx.getAttribute("tmp.vnfInfo.vm-count");
- log.info(fn + "vmcount:" + vmcount);
+ String vmcount = ctx.getAttribute("tmp.vnfInfo.vm-count");
+ log.info(fn + "vmcount:" + vmcount);
- int vmCount = (StringUtils.isNotBlank(vmcount)) ? Integer.parseInt(vmcount) : 0;
+ int vmCount = (StringUtils.isNotBlank(vmcount)) ? Integer.parseInt(vmcount) : 0;
- for (int i = 0; i < vmCount; i++) {
- processVm(ctx, vnfInfo, i);
- }
-
- InventoryInfo inventoryInfo = new InventoryInfo();
- inventoryInfo.setVnfInfo(vnfInfo);
- log.info(fn + "Inventory Output:" + inventoryInfo.toString());
+ for (int i = 0; i < vmCount; i++) {
+ processVm(ctx, vnfInfo, i);
+ }
- return inventoryInfo;
- }
+ InventoryInfo inventoryInfo = new InventoryInfo();
+ inventoryInfo.setVnfInfo(vnfInfo);
+ log.info(fn + "Inventory Output:" + inventoryInfo.toString());
- private void processVm(SvcLogicContext ctx, VnfInfo vnfInfo, int index) {
- Vm vm = new Vm();
- vm.setVserverId(ctx.getAttribute("tmp.vnfInfo.vm[" + index + "].vserver-id"));
- vm.setVmId(ctx.getAttribute("tmp.vnfInfo.vm[" + index + "].vserver-selflink"));
- int vnfcCount = Integer.parseInt(ctx.getAttribute("tmp.vnfInfo.vm[" + index + "].vnfc-count"));
- if (vnfcCount > 0) {
- Vnfcslist vnfc = new Vnfcslist();
- vnfc.setVnfcName(ctx.getAttribute("tmp.vnfInfo.vm[" + index + "].vnfc-name"));
- vnfc.setVnfcType(ctx.getAttribute("tmp.vnfInfo.vm[" + index + "].vnfc-type"));
- vm.setVnfc(vnfc);
+ return inventoryInfo;
}
- vnfInfo.getVm().add(vm);
- }
+ private void processVm(SvcLogicContext ctx, VnfInfo vnfInfo, int index) {
+ Vm vm = new Vm();
+ vm.setVserverId(ctx.getAttribute("tmp.vnfInfo.vm[" + index + "].vserver-id"));
+ vm.setVmId(ctx.getAttribute("tmp.vnfInfo.vm[" + index + "].vserver-selflink"));
+ int vnfcCount = Integer.parseInt(ctx.getAttribute("tmp.vnfInfo.vm[" + index + "].vnfc-count"));
+ if (vnfcCount > 0) {
+ Vnfcslist vnfc = new Vnfcslist();
+ vnfc.setVnfcName(ctx.getAttribute("tmp.vnfInfo.vm[" + index + "].vnfc-name"));
+ vnfc.setVnfcType(ctx.getAttribute("tmp.vnfInfo.vm[" + index + "].vnfc-type"));
+ vnfc.setVnfcFunctionCode(ctx.getAttribute("tmp.vnfInfo.vm[" + index + "].vnfc-function-code"));
+ vm.setVnfc(vnfc);
+ }
+ vnfInfo.getVm().add(vm);
+ }
- public String getIdentityUrl(SvcLogicContext ctx, VnfInfo vnfInfo, String vnfId) {
- String identityUrl = "";
- for (String key : ctx.getAttributeKeySet()) {
+ public String getIdentityUrl(SvcLogicContext ctx, VnfInfo vnfInfo, String vnfId) {
+ String identityUrl = "";
+ for (String key : ctx.getAttributeKeySet()) {
log.debug("InventoryData " + key + "=" + ctx.getAttribute(key));
- }
- String urlFromPayload= ctx.getAttribute("identity-url");
- log.info("Url from payload:" + urlFromPayload);
- String urlFromAAI=ctx.getAttribute("tmp.vnfInfo.cloud-region.identity-url");
- log.info("Url from AAI:" + urlFromAAI);
+ }
+ String urlFromPayload = ctx.getAttribute("identity-url");
+ log.info("Url from payload:" + urlFromPayload);
+ String urlFromAAI = ctx.getAttribute("tmp.vnfInfo.cloud-region.identity-url");
+ log.info("Url from AAI:" + urlFromAAI);
+
+ if (StringUtils.isNotBlank(urlFromPayload)) {
+ identityUrl = urlFromPayload;
+ } else if (StringUtils.isNotBlank(urlFromAAI)) {
+ identityUrl = urlFromAAI;
+ }
+ return identityUrl;
- if(StringUtils.isNotBlank(urlFromPayload)){
- identityUrl=urlFromPayload;
- }else if(StringUtils.isNotBlank(urlFromAAI)){
- identityUrl=urlFromAAI;
- }
- return identityUrl;
-
-
- }
+ }
}
diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/ResourceUriExtractor.java b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/ResourceUriExtractor.java
index bd5144004..051d22fc6 100644
--- a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/ResourceUriExtractor.java
+++ b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/ResourceUriExtractor.java
@@ -4,7 +4,7 @@
* ================================================================================
* Copyright (C) 2018 Nokia. All rights reserved.
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-2019 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.
@@ -24,6 +24,7 @@ package org.onap.appc.flow.controller.node;
import static org.onap.appc.flow.controller.utils.FlowControllerConstants.HTTP;
import static org.onap.appc.flow.controller.utils.FlowControllerConstants.INPUT_CONTEXT;
import static org.onap.appc.flow.controller.utils.FlowControllerConstants.INPUT_HOST_IP_ADDRESS;
+import static org.onap.appc.flow.controller.utils.FlowControllerConstants.INPUT_HOST_IP_ADDRESS_ALT;
import static org.onap.appc.flow.controller.utils.FlowControllerConstants.INPUT_REQUEST_ACTION;
import static org.onap.appc.flow.controller.utils.FlowControllerConstants.INPUT_URL;
import static org.onap.appc.flow.controller.utils.FlowControllerConstants.REST_PORT;
@@ -57,6 +58,8 @@ class ResourceUriExtractor {
private String getAddress(SvcLogicContext ctx) {
String address = ctx.getAttribute(INPUT_HOST_IP_ADDRESS);
+ if (address == null || address.length() == 0)
+ address = ctx.getAttribute(INPUT_HOST_IP_ADDRESS_ALT);
String port = ctx.getAttribute(REST_PORT);
return HTTP + address + ":" + port;
}
diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/utils/FlowControllerConstants.java b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/utils/FlowControllerConstants.java
index fee6b677a..c4000dfe1 100644
--- a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/utils/FlowControllerConstants.java
+++ b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/utils/FlowControllerConstants.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 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.
@@ -61,9 +61,13 @@ public class FlowControllerConstants {
public static final String ACTION_LEVEL = "action-level";
public static final String ARTIFACT_NAME = "artifact-name";
- public enum EndPointType { DG, REST, NODE }
+ public enum EndPointType {
+ DG, REST, NODE
+ }
- public enum FlowStatus { PENDING, IN_PROCESS, COMPLETED }
+ public enum FlowStatus {
+ PENDING, IN_PROCESS, COMPLETED
+ }
public static final String GENERATION_NODE = "GENERATION-NODE";
public static final String SEQUENCE_TYPE = "SEQUENCE-TYPE";
@@ -98,6 +102,7 @@ public class FlowControllerConstants {
public static final String HEALTHY = "healthy";
public static final String INPUT_URL = "input.url";
public static final String INPUT_HOST_IP_ADDRESS = "request-parameters.host-ip-address";
+ public static final String INPUT_HOST_IP_ADDRESS_ALT = "host-ip-address";
public static final String INPUT_PORT_NUMBER = "port-number";
public static final String INPUT_CONTEXT = "context";
public static final String INPUT_SUB_CONTEXT = "sub-context";
@@ -116,9 +121,9 @@ public class FlowControllerConstants {
public static final String VNFC_NAME = "vnfc-name";
public static final String AAI_VNF_TYPE = "aai-vnf-type";
public static final String REST_PROTOCOL = "REST";
- public static final String HEALTHCHECK ="HealthCheck";
- public static final String REST_USER="user";
- public static final String REST_PWD="pwd";
- public static final String REST_PORT="port";
- public static final String REST_CONTEXT_URL="url";
+ public static final String HEALTHCHECK = "HealthCheck";
+ public static final String REST_USER = "user";
+ public static final String REST_PWD = "pwd";
+ public static final String REST_PORT = "port";
+ public static final String REST_CONTEXT_URL = "url";
}