summaryrefslogtreecommitdiffstats
path: root/appc-config/appc-flow-controller/provider/src/main
diff options
context:
space:
mode:
authorGeorge, Lina (lg941u) <lg941u@att.com>2018-03-30 12:16:21 -0400
committerSkip Wonnell <skip@att.com>2018-03-30 13:35:20 -0500
commitb32e6f295fc0aaf37b78140aedd417d8064c1020 (patch)
tree9eb85b0c7a8b06b41e015cf7931fe5c6d2be20e4 /appc-config/appc-flow-controller/provider/src/main
parent4ca53fd0b0e79e6c361a1495a1ac70f502ac829a (diff)
Changes to get properties from southbound propfile
Issue-ID: APPC-816 Change-Id: If08eb895526ba3998faf059be9b9c595b0f82b4d 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/executorImpl/RestExecutor.java57
-rw-r--r--appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/ResourceUriExtractor.java96
-rw-r--r--appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/RestServiceNode.java158
-rw-r--r--appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/utils/FlowControllerConstants.java15
4 files changed, 162 insertions, 164 deletions
diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/executorImpl/RestExecutor.java b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/executorImpl/RestExecutor.java
index d18f2a3e2..45c00215e 100644
--- a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/executorImpl/RestExecutor.java
+++ b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/executorImpl/RestExecutor.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
- * Copyright (C) 2017-18 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 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.
@@ -15,9 +15,7 @@
* 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=========================================================
+ * * ============LICENSE_END=========================================================
*/
package org.onap.appc.flow.controller.executorImpl;
@@ -51,7 +49,7 @@ public class RestExecutor implements FlowExecutorInterface {
private static final EELFLogger log = EELFManager.getInstance().getLogger(RestExecutor.class);
@Override
- public Map<String, String> execute(Transaction transaction, SvcLogicContext ctx) throws Exception{
+ public Map<String, String> execute(Transaction transaction, SvcLogicContext ctx) throws Exception {
log.info("Configuring Rest Operation....." + transaction.toString());
Map<String, String> outputMessage = new HashMap<>();
Client client = null;
@@ -61,35 +59,29 @@ public class RestExecutor implements FlowExecutorInterface {
SSLContext sslContext = SSLContext.getInstance("SSL");
sslContext.init(null, new javax.net.ssl.TrustManager[] {new SecureRestClientTrustManager()}, null);
DefaultClientConfig defaultClientConfig = new DefaultClientConfig();
- defaultClientConfig.getProperties().put(
- HTTPSProperties.PROPERTY_HTTPS_PROPERTIES,
+ defaultClientConfig.getProperties().put(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES,
new HTTPSProperties(getHostnameVerifier(), sslContext));
client = createClient(defaultClientConfig);
- client.addFilter(new HTTPBasicAuthFilter(transaction.getuId(), transaction.getPswd()));
+ if ((transaction.getuId() != null) && (transaction.getPswd() != null)) {
+ client.addFilter(new HTTPBasicAuthFilter(transaction.getuId(), transaction.getPswd()));
+ }
WebResource webResource = client.resource(new URI(transaction.getExecutionEndPoint()));
webResource.setProperty("Content-Type", "application/json;charset=UTF-8");
- ClientResponse clientResponse = getClientResponse(transaction, webResource)
- .orElseThrow(() -> new Exception(
- "Cannot determine the state of : "
- + transaction.getActionLevel()
- + " HTTP response is null"));
+ ClientResponse clientResponse = getClientResponse(transaction, webResource).orElseThrow(() -> new Exception(
+ "Cannot determine the state of : " + transaction.getActionLevel() + " HTTP response is null"));
processClientResponse(clientResponse, transaction, outputMessage);
log.info("Completed Rest Operation.....");
} catch (Exception e) {
- log.debug("failed in RESTCONT Action ("
- + transaction.getExecutionRPC()
- + ") for the resource "
- + transaction.getExecutionEndPoint()
- + ", fault message :"
- + e.getMessage());
+ log.debug("failed in RESTCONT Action (" + transaction.getExecutionRPC() + ") for the resource "
+ + transaction.getExecutionEndPoint() + ", fault message :" + e.getMessage());
throw new Exception("Error While Sending Rest Request", e);
} finally {
- if(client != null) {
+ if (client != null) {
client.destroy();
}
}
@@ -105,28 +97,27 @@ public class RestExecutor implements FlowExecutorInterface {
}
private Optional<ClientResponse> getClientResponse(Transaction transaction, WebResource webResource) {
- String responseDataType=MediaType.APPLICATION_JSON;
- String requestDataType=MediaType.APPLICATION_JSON;
+ String responseDataType = MediaType.APPLICATION_JSON;
+ String requestDataType = MediaType.APPLICATION_JSON;
ClientResponse clientResponse = null;
log.info("Starting Rest Operation.....");
- if(HttpMethod.GET.equalsIgnoreCase(transaction.getExecutionRPC())) {
+ if (HttpMethod.GET.equalsIgnoreCase(transaction.getExecutionRPC())) {
clientResponse = webResource.accept(responseDataType).get(ClientResponse.class);
- }else if(HttpMethod.POST.equalsIgnoreCase(transaction.getExecutionRPC())) {
+ } else if (HttpMethod.POST.equalsIgnoreCase(transaction.getExecutionRPC())) {
clientResponse = webResource.type(requestDataType).post(ClientResponse.class, transaction.getPayload());
- }else if(HttpMethod.PUT.equalsIgnoreCase(transaction.getExecutionRPC())) {
+ } else if (HttpMethod.PUT.equalsIgnoreCase(transaction.getExecutionRPC())) {
clientResponse = webResource.type(requestDataType).put(ClientResponse.class, transaction.getPayload());
- }else if(HttpMethod.DELETE.equalsIgnoreCase(transaction.getExecutionRPC())) {
+ } else if (HttpMethod.DELETE.equalsIgnoreCase(transaction.getExecutionRPC())) {
clientResponse = webResource.delete(ClientResponse.class);
}
return Optional.ofNullable(clientResponse);
}
- private void processClientResponse (ClientResponse clientResponse,
- Transaction transaction,
- Map<String, String> outputMessage ) throws Exception {
+ private void processClientResponse(ClientResponse clientResponse, Transaction transaction,
+ Map<String, String> outputMessage) throws Exception {
- if(clientResponse.getStatus() == Status.OK.getStatusCode()) {
+ if (clientResponse.getStatus() == Status.OK.getStatusCode()) {
Response response = new Response();
response.setResponseCode(String.valueOf(Status.OK.getStatusCode()));
transaction.setResponses(Collections.singletonList(response));
@@ -136,10 +127,8 @@ public class RestExecutor implements FlowExecutorInterface {
if (StringUtils.isNotBlank(errorMsg)) {
log.debug("Error Message from Client Response" + errorMsg);
}
- throw new Exception("Cannot determine the state of : "
- + transaction.getActionLevel()
- + " HTTP error code : "
- + clientResponse.getStatus());
+ throw new Exception("Cannot determine the state of : " + transaction.getActionLevel()
+ + " HTTP error code : " + clientResponse.getStatus());
}
}
}
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 c36a74be7..af65b1259 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
@@ -2,13 +2,15 @@
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
- * Copyright (C) 2018 Nokia. All rights reserved.
+ * Copyright (C) 2018 Nokia. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2018 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
+ * 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,
@@ -22,68 +24,74 @@ 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_PORT_NUMBER;
import static org.onap.appc.flow.controller.utils.FlowControllerConstants.INPUT_REQUEST_ACTION;
import static org.onap.appc.flow.controller.utils.FlowControllerConstants.INPUT_SUB_CONTEXT;
import static org.onap.appc.flow.controller.utils.FlowControllerConstants.INPUT_URL;
-
+import static org.onap.appc.flow.controller.utils.FlowControllerConstants.VNF_TYPE;
+import static org.onap.appc.flow.controller.utils.FlowControllerConstants.REST_PROTOCOL;
+import static org.onap.appc.flow.controller.utils.FlowControllerConstants.REST_PORT;
+import static org.onap.appc.flow.controller.utils.FlowControllerConstants.REST_CONTEXT_URL;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import java.util.Properties;
import org.apache.commons.lang.StringUtils;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
/**
* Helper class for RestServiceNode
*/
class ResourceUriExtractor {
- private static final EELFLogger log = EELFManager.getInstance().getLogger(RestServiceNode.class);
+ private static final EELFLogger log = EELFManager.getInstance().getLogger(RestServiceNode.class);
- String extractResourceUri(SvcLogicContext ctx, Properties prop) throws Exception {
- String resourceUri = ctx.getAttribute(INPUT_URL);
+ String extractResourceUri(SvcLogicContext ctx, Properties prop) throws Exception {
+ String resourceUri = ctx.getAttribute(INPUT_URL);
- if (StringUtils.isBlank(resourceUri)) {
- resourceUri = getAddress(ctx);
- log.info("resourceUri= " + resourceUri);
- resourceUri += getContext(ctx, prop);
- log.info("resourceUri= " + resourceUri);
- resourceUri += getSubContext(ctx, prop);
- }
- log.info("resourceUri= " + resourceUri);
+ if (StringUtils.isBlank(resourceUri)) {
+ resourceUri = getAddress(ctx, prop);
+ log.info("resourceUri= " + resourceUri);
+ resourceUri += getContext(ctx, prop);
+ log.info("resourceUri= " + resourceUri);
+ resourceUri += getSubContext(ctx, prop);
+ }
+ log.info("resourceUri= " + resourceUri);
- return resourceUri;
- }
+ return resourceUri;
+ }
- private String getAddress(SvcLogicContext ctx) {
- String address = ctx.getAttribute(INPUT_HOST_IP_ADDRESS);
- String port = ctx.getAttribute(INPUT_PORT_NUMBER);
- return HTTP + address + ":" + port;
- }
+ private String getAddress(SvcLogicContext ctx, Properties prop) {
+ String address = ctx.getAttribute(INPUT_HOST_IP_ADDRESS);
+ String portPath = ctx.getAttribute(VNF_TYPE) + "." + (REST_PROTOCOL) + "."
+ + ctx.getAttribute(INPUT_REQUEST_ACTION) + "." + (REST_PORT);
+ String port = prop.getProperty(portPath);
+ return HTTP + address + ":" + port;
+ }
- private String getContext(SvcLogicContext ctx, Properties prop) throws Exception {
- String context;
- if (StringUtils.isNotBlank(ctx.getAttribute(INPUT_CONTEXT))) {
- context = "/" + ctx.getAttribute(INPUT_CONTEXT);
- } else if (prop.getProperty(ctx.getAttribute(INPUT_REQUEST_ACTION) + ".context") != null) {
- context = "/" + prop.getProperty(ctx.getAttribute(INPUT_REQUEST_ACTION) + ".context");
- } else {
- throw new Exception("Could Not found the context for operation " + ctx.getAttribute(INPUT_REQUEST_ACTION));
+ private String getContext(SvcLogicContext ctx, Properties prop) throws Exception {
+ String context;
+ String urlPath = ctx.getAttribute(VNF_TYPE) + "." + REST_PROTOCOL + "." + ctx.getAttribute(INPUT_REQUEST_ACTION)
+ + "." + REST_CONTEXT_URL;
+ if (StringUtils.isNotBlank(ctx.getAttribute(INPUT_CONTEXT))) {
+ context = "/" + ctx.getAttribute(INPUT_CONTEXT);
+ } else if (prop.getProperty(urlPath) != null) {
+ context = "/" + prop.getProperty(urlPath);
+ } else {
+ throw new Exception("Could not find the context for operation " + ctx.getAttribute(INPUT_REQUEST_ACTION));
+ }
+ return context;
}
- return context;
- }
- private String getSubContext(SvcLogicContext ctx, Properties prop) throws Exception {
- String subContext;
- if (StringUtils.isNotBlank(ctx.getAttribute(INPUT_SUB_CONTEXT))) {
- subContext = "/" + ctx.getAttribute(INPUT_SUB_CONTEXT);
- } else if (prop.getProperty(ctx.getAttribute(INPUT_REQUEST_ACTION) + ".sub-context") != null) {
- subContext = "/" + prop.getProperty(ctx.getAttribute(INPUT_REQUEST_ACTION) + ".sub-context");
- } else {
- throw new Exception("Could Not found the sub context for operation " + ctx.getAttribute(INPUT_REQUEST_ACTION));
+ private String getSubContext(SvcLogicContext ctx, Properties prop) throws Exception {
+ String subContext;
+ if (StringUtils.isNotBlank(ctx.getAttribute(INPUT_SUB_CONTEXT))) {
+ subContext = "/" + ctx.getAttribute(INPUT_SUB_CONTEXT);
+ } else if (prop.getProperty(ctx.getAttribute(INPUT_REQUEST_ACTION) + ".sub-context") != null) {
+ subContext = "/" + prop.getProperty(ctx.getAttribute(INPUT_REQUEST_ACTION) + ".sub-context");
+ } else {
+ throw new Exception(
+ "Could not find the sub context for operation " + ctx.getAttribute(INPUT_REQUEST_ACTION));
+ }
+ return subContext;
}
- return subContext;
- }
-} \ No newline at end of file
+}
diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/RestServiceNode.java b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/RestServiceNode.java
index 184ba3b1b..b8625db84 100644
--- a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/RestServiceNode.java
+++ b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/RestServiceNode.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP : APPC
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 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.
@@ -15,21 +15,18 @@
* 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=========================================================
+ * * ============LICENSE_END=========================================================
*/
package org.onap.appc.flow.controller.node;
-import static org.onap.appc.flow.controller.utils.FlowControllerConstants.APPC_FLOW_CONTROLLER;
+import static org.onap.appc.flow.controller.utils.FlowControllerConstants.APPC_SOUTHBOUND;
import static org.onap.appc.flow.controller.utils.FlowControllerConstants.INPUT_PARAM_RESPONSE_PREFIX;
import static org.onap.appc.flow.controller.utils.FlowControllerConstants.OUTPUT_PARAM_ERROR_MESSAGE;
import static org.onap.appc.flow.controller.utils.FlowControllerConstants.OUTPUT_PARAM_STATUS;
import static org.onap.appc.flow.controller.utils.FlowControllerConstants.OUTPUT_STATUS_FAILURE;
import static org.onap.appc.flow.controller.utils.FlowControllerConstants.OUTPUT_STATUS_MESSAGE;
import static org.onap.appc.flow.controller.utils.FlowControllerConstants.OUTPUT_STATUS_SUCCESS;
-
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.fasterxml.jackson.databind.JsonNode;
@@ -44,82 +41,81 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
public class RestServiceNode implements SvcLogicJavaPlugin {
- private static final EELFLogger log = EELFManager.getInstance().getLogger(RestServiceNode.class);
- private static final String SDNC_CONFIG_DIR_VAR = "SDNC_CONFIG_DIR";
-
- static final String REST_RESPONSE = "restResponse";
-
- private final TransactionHandler transactionHandler;
- private final RestExecutor restExecutor;
- private final ResourceUriExtractor resourceUriExtractor;
- private final EnvVariables envVariables;
-
- public RestServiceNode() {
- this.transactionHandler = new TransactionHandler();
- this.restExecutor = new RestExecutor();
- this.resourceUriExtractor = new ResourceUriExtractor();
- this.envVariables = new EnvVariables();
- }
-
- /**
- * Constructor for tests, prefer to use no arg constructor
- */
- RestServiceNode(TransactionHandler transactionHandler, RestExecutor restExecutor,
- ResourceUriExtractor uriExtractor, EnvVariables envVariables) {
- this.transactionHandler = transactionHandler;
- this.restExecutor = restExecutor;
- this.resourceUriExtractor = uriExtractor;
- this.envVariables = envVariables;
- }
-
- public void sendRequest(Map<String, String> inParams, SvcLogicContext ctx)
- throws SvcLogicException {
- String fn = "RestServiceNode.sendRequest";
- log.info("Received processParamKeys call with params : " + inParams);
- String responsePrefix = inParams.get(INPUT_PARAM_RESPONSE_PREFIX);
- try {
- responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix + ".") : "";
- //Remove below for Block
- for (String key : ctx.getAttributeKeySet()) {
- log.info(fn + "Getting Key = " + key + "and Value = " + ctx.getAttribute(key));
- }
-
- Properties prop = loadProperties();
- log.info("Loaded Properties " + prop.toString());
-
- String resourceUri = resourceUriExtractor.extractResourceUri(ctx, prop);
-
- log.info("Rest Constructed URL : " + resourceUri);
-
- Transaction transaction = transactionHandler.buildTransaction(ctx, prop, resourceUri);
- Map<String, String> output = restExecutor.execute(transaction, ctx);
-
- String json = output.get(REST_RESPONSE);
- log.info("Received response from Interface " + json);
-
- JsonNode validatedJson = JsonValidator.validate(json);
-
- if (validatedJson != null) {
- log.info("state is " + validatedJson.findValue("state"));
- ctx.setAttribute(responsePrefix + OUTPUT_STATUS_MESSAGE, output.get(REST_RESPONSE));
- }
-
- ctx.setAttribute(responsePrefix + OUTPUT_PARAM_STATUS, OUTPUT_STATUS_SUCCESS);
-
- } catch (Exception e) {
- ctx.setAttribute(responsePrefix + OUTPUT_PARAM_STATUS, OUTPUT_STATUS_FAILURE);
- ctx.setAttribute(responsePrefix + OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
- log.error("Error Message : " + e.getMessage(), e);
- throw new SvcLogicException(e.getMessage());
+ private static final EELFLogger log = EELFManager.getInstance().getLogger(RestServiceNode.class);
+ public static final String APPC_CONFIG_DIR_VAR = "APPC_CONFIG_DIR";
+
+ static final String REST_RESPONSE = "restResponse";
+
+ private final TransactionHandler transactionHandler;
+ private final RestExecutor restExecutor;
+ private final ResourceUriExtractor resourceUriExtractor;
+ private final EnvVariables envVariables;
+
+ public RestServiceNode() {
+ this.transactionHandler = new TransactionHandler();
+ this.restExecutor = new RestExecutor();
+ this.resourceUriExtractor = new ResourceUriExtractor();
+ this.envVariables = new EnvVariables();
+ }
+
+ /**
+ * Constructor for tests, prefer to use no arg constructor
+ */
+ RestServiceNode(TransactionHandler transactionHandler, RestExecutor restExecutor, ResourceUriExtractor uriExtractor,
+ EnvVariables envVariables) {
+ this.transactionHandler = transactionHandler;
+ this.restExecutor = restExecutor;
+ this.resourceUriExtractor = uriExtractor;
+ this.envVariables = envVariables;
+ }
+
+ public void sendRequest(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+ String fn = "RestServiceNode.sendRequest";
+ log.info("Received processParamKeys call with params : " + inParams);
+ String responsePrefix = inParams.get(INPUT_PARAM_RESPONSE_PREFIX);
+ try {
+ responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix + ".") : "";
+ // Remove below for Block
+ for (String key : ctx.getAttributeKeySet()) {
+ log.info(fn + "Getting Key = " + key + "and Value = " + ctx.getAttribute(key));
+ }
+
+ Properties prop = loadProperties();
+ log.info("Loaded Properties " + prop.toString());
+
+ String resourceUri = resourceUriExtractor.extractResourceUri(ctx, prop);
+
+ log.info("Rest Constructed URL : " + resourceUri);
+
+ Transaction transaction = transactionHandler.buildTransaction(ctx, prop, resourceUri);
+ Map<String, String> output = restExecutor.execute(transaction, ctx);
+
+ String json = output.get(REST_RESPONSE);
+ log.info("Received response from Interface " + json);
+
+ JsonNode validatedJson = JsonValidator.validate(json);
+
+ if (validatedJson != null) {
+ log.info("state is " + validatedJson.findValue("state"));
+ ctx.setAttribute(responsePrefix + OUTPUT_STATUS_MESSAGE, output.get(REST_RESPONSE));
+ }
+
+ ctx.setAttribute(responsePrefix + OUTPUT_PARAM_STATUS, OUTPUT_STATUS_SUCCESS);
+
+ } catch (Exception e) {
+ ctx.setAttribute(responsePrefix + OUTPUT_PARAM_STATUS, OUTPUT_STATUS_FAILURE);
+ ctx.setAttribute(responsePrefix + OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
+ log.error("Error Message : " + e.getMessage(), e);
+ throw new SvcLogicException(e.getMessage());
+ }
}
- }
- private Properties loadProperties() throws Exception {
- String directory = envVariables.getenv(SDNC_CONFIG_DIR_VAR);
- if (directory == null) {
- throw new Exception("Cannot find Property file: " + SDNC_CONFIG_DIR_VAR);
+ private Properties loadProperties() throws Exception {
+ String directory = envVariables.getenv(APPC_CONFIG_DIR_VAR);
+ if (directory == null) {
+ throw new Exception("Cannot find Property file: " + APPC_CONFIG_DIR_VAR);
+ }
+ String path = directory + APPC_SOUTHBOUND;
+ return PropertiesLoader.load(path);
}
- String path = directory + APPC_FLOW_CONTROLLER;
- return PropertiesLoader.load(path);
- }
}
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 502438c31..275dd431f 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 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 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.
@@ -15,9 +15,7 @@
* 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=========================================================
+ * * ============LICENSE_END=========================================================
*/
package org.onap.appc.flow.controller.utils;
@@ -42,6 +40,7 @@ public class FlowControllerConstants {
public static final String DESINGTIME = "DesignTime";
public static final String RUNTIME = "RunTime";
public static final String APPC_FLOW_CONTROLLER = "/appc-flow-controller.properties";
+ public static final String APPC_SOUTHBOUND = "/appc_southbound.properties";
public static final String VNF_TYPE = "vnf-type";
public static final String ACTION = "action";
public static final String VNFC_TYPE = "vnfc-type";
@@ -98,7 +97,7 @@ public class FlowControllerConstants {
public static final String OUTPUT_STATUS_MESSAGE = "status-message";
public static final String HEALTHY = "healthy";
public static final String INPUT_URL = "input.url";
- public static final String INPUT_HOST_IP_ADDRESS = "host-ip-address";
+ public static final String INPUT_HOST_IP_ADDRESS = "request-parameters.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,4 +115,10 @@ public class FlowControllerConstants {
public static final String VF_MODULE = "vf-module";
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="password";
+ public static final String REST_PORT="port";
+ public static final String REST_CONTEXT_URL="url";
}