aboutsummaryrefslogtreecommitdiffstats
path: root/appc-config
diff options
context:
space:
mode:
authorBalaji, Ramya (rb111y) <rb111y@att.com>2018-06-21 15:20:26 -0400
committerTakamune Cho <tc012c@att.com>2018-06-22 16:13:20 +0000
commitdc093f5f5cde53fb427712095f88bcebf225c599 (patch)
tree843f61add7950bc539b3337e7f1ba9ecf5a9c232 /appc-config
parentf03b15e20876902629d6a97f8b2f56049dbc7567 (diff)
Changes needed for MultiStep Actions
Issue-ID: APPC-921 Change-Id: I6abee6fbc389dde0be9e5e963524a2ab2b9cb823 Signed-off-by: Balaji, Ramya (rb111y) <rb111y@att.com>
Diffstat (limited to 'appc-config')
-rw-r--r--appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/executorImpl/GraphExecutor.java12
-rw-r--r--appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/interfaceData/Vm.java14
-rw-r--r--appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/interfaceData/VnfInfo.java13
-rw-r--r--appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/InputParamsCollector.java5
-rw-r--r--appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/InventoryInfoExtractor.java25
-rw-r--r--appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/ResourceUriExtractor.java38
-rw-r--r--appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/RestServiceNode.java18
-rw-r--r--appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/TransactionHandler.java23
-rw-r--r--appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/utils/FlowControllerConstants.java2
-rw-r--r--appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/InputParamsCollectorTest.java6
-rw-r--r--appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/InventoryInfoExtractorTest.java58
-rw-r--r--appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/ResourceUriExtractorTest.java28
-rw-r--r--appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/TestRestServiceNode.java15
-rw-r--r--appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/TransactionHandlerTest.java23
14 files changed, 165 insertions, 115 deletions
diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/executorImpl/GraphExecutor.java b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/executorImpl/GraphExecutor.java
index 565fbb766..76e791a6e 100644
--- a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/executorImpl/GraphExecutor.java
+++ b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/executorImpl/GraphExecutor.java
@@ -20,6 +20,7 @@
*/
package org.onap.appc.flow.controller.executorImpl;
+import org.json.JSONObject;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import java.util.Enumeration;
@@ -82,6 +83,17 @@ public class GraphExecutor implements FlowExecutorInterface {
String fn = "GraphExecutor.execute ";
log.debug(fn + "About to execute graph : " + transaction.getExecutionRPC());
+ String payload = transaction.getPayload();
+ log.debug("payload:" + payload);
+
+ JSONObject json = new JSONObject(payload);
+ for (Object key : json.keySet()) {
+ String keyStr = (String)key;
+ Object keyvalue = json.get(keyStr);
+ String value= keyvalue.toString();
+ ctx.setAttribute(keyStr, value);
+ log.debug("key: "+ keyStr + " value: " + keyvalue);
+ }
Properties parms = new Properties();
for (Object key : ctx.getAttributeKeySet()) {
String parmName = (String) key;
diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/interfaceData/Vm.java b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/interfaceData/Vm.java
index 2ff99328a..4808b53a2 100644
--- a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/interfaceData/Vm.java
+++ b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/interfaceData/Vm.java
@@ -40,6 +40,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"vserverId",
+ "vmId",
"vnfc"
})
@XmlRootElement(name = "vm")
@@ -49,6 +50,9 @@ public class Vm {
@JsonProperty("vserver-id")
protected String vserverId;
@XmlElement(required = true)
+ @JsonProperty("vm-id")
+ protected String vmId;
+ @XmlElement(required = true)
@JsonProperty("vnfc")
protected Vnfcslist vnfc;
@@ -102,7 +106,15 @@ public class Vm {
@Override
public String toString() {
- return "Vm [vserverId=" + vserverId + ", vnfc=" + vnfc + "]";
+ return "Vm [vserverId=" + vserverId + ", vmId=" + vmId + ", vnfc=" + vnfc + "]";
+ }
+
+ public String getVmId() {
+ return vmId;
+ }
+
+ public void setVmId(String vmId) {
+ this.vmId = vmId;
}
}
diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/interfaceData/VnfInfo.java b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/interfaceData/VnfInfo.java
index dce3238ba..eaf387dc8 100644
--- a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/interfaceData/VnfInfo.java
+++ b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/interfaceData/VnfInfo.java
@@ -59,6 +59,9 @@ public class VnfInfo {
@XmlElement(name = "vnf-type", required = true)
@JsonProperty("vnf-type")
protected String vnfType;
+ @XmlElement(name = "identity-url")
+ @JsonProperty("identity-url")
+ protected String identityUrl;
@JsonProperty("vm")
protected List<Vm> vm;
@@ -166,7 +169,15 @@ public class VnfInfo {
@Override
public String toString() {
return "VnfInfo [vnfId=" + vnfId + ", vnfName=" + vnfName
- + ", vnfType=" + vnfType + ", vm=" + vm + "]";
+ + ", vnfType=" + vnfType + ", identityUrl=" + identityUrl + ", vm=" + vm + "]";
+ }
+
+ public String getIdentityUrl() {
+ return identityUrl;
+ }
+
+ public void setIdentityUrl(String identityUrl) {
+ this.identityUrl = identityUrl;
}
}
diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/InputParamsCollector.java b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/InputParamsCollector.java
index 1a7e2bc00..51595d576 100644
--- a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/InputParamsCollector.java
+++ b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/InputParamsCollector.java
@@ -3,6 +3,7 @@
* ONAP : APPC
* ================================================================================
* 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.
@@ -119,10 +120,10 @@ class InputParamsCollector {
InventoryInfo inventoryInfo = new InventoryInfoExtractor().getInventoryInfo(ctx, vnfId);
Capabilities capabilities = new CapabilitiesDataExtractor(dbService).getCapabilitiesData(ctx);
- DependencyInfo dependencyInfo = getDependencyInfo(ctx);
+ ctx.setAttribute("artifact-content", null);
log.info("Enter InputData");
- Input input = getInput(requestInfo, inventoryInfo, dependencyInfo, capabilities);
+ Input input = getInput(requestInfo, inventoryInfo, null, capabilities);
log.info(fn + "Input parameters:" + input.toString());
ObjectMapper mapper = new ObjectMapper();
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 79a8635ab..631b72cc0 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,6 +3,7 @@
* ONAP : APPC
* ================================================================================
* 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.
@@ -35,13 +36,14 @@ class InventoryInfoExtractor {
private static final EELFLogger log = EELFManager.getInstance().getLogger(InventoryInfoExtractor.class);
- InventoryInfo getInventoryInfo(SvcLogicContext ctx, String vnfId) {
+ 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));
String vmcount = ctx.getAttribute("tmp.vnfInfo.vm-count");
log.info(fn + "vmcount:" + vmcount);
@@ -62,6 +64,7 @@ class InventoryInfoExtractor {
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();
@@ -72,4 +75,24 @@ class InventoryInfoExtractor {
vnfInfo.getVm().add(vm);
}
+
+ 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("AICIdentity");
+ log.info("Url from payload:" + urlFromPayload);
+ String urlFromAAI=ctx.getAttribute("tmp.vnfInfo.identity-url");
+
+ 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 22011e773..bd5144004 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,7 +2,7 @@
* ============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.
* =============================================================================
@@ -25,15 +25,11 @@ 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_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;
@@ -44,51 +40,37 @@ class ResourceUriExtractor {
private static final EELFLogger log = EELFManager.getInstance().getLogger(RestServiceNode.class);
- String extractResourceUri(SvcLogicContext ctx, Properties prop) throws Exception {
+ String extractResourceUri(SvcLogicContext ctx) throws Exception {
String resourceUri = ctx.getAttribute(INPUT_URL);
if (StringUtils.isBlank(resourceUri)) {
- resourceUri = getAddress(ctx, prop);
+ resourceUri = getAddress(ctx);
log.info("resourceUri= " + resourceUri);
- resourceUri += getContext(ctx, prop);
+ resourceUri += getContext(ctx);
log.info("resourceUri= " + resourceUri);
- resourceUri += getSubContext(ctx, prop);
+
}
log.info("resourceUri= " + resourceUri);
return resourceUri;
}
- private String getAddress(SvcLogicContext ctx, Properties prop) {
+ private String getAddress(SvcLogicContext ctx) {
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);
+ String port = ctx.getAttribute(REST_PORT);
return HTTP + address + ":" + port;
}
- private String getContext(SvcLogicContext ctx, Properties prop) throws Exception {
+ private String getContext(SvcLogicContext ctx) 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 if (StringUtils.isNotBlank(ctx.getAttribute(REST_CONTEXT_URL))) {
+ context = "/" + ctx.getAttribute(REST_CONTEXT_URL);
} else {
throw new Exception("Could not find the context for operation " + ctx.getAttribute(INPUT_REQUEST_ACTION));
}
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");
- }
- return subContext;
- }
-
}
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 b8625db84..074310986 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
@@ -31,7 +31,6 @@ import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.fasterxml.jackson.databind.JsonNode;
import java.util.Map;
-import java.util.Properties;
import org.apache.commons.lang3.StringUtils;
import org.onap.appc.flow.controller.data.Transaction;
import org.onap.appc.flow.controller.executorImpl.RestExecutor;
@@ -42,7 +41,6 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
public class RestServiceNode implements SvcLogicJavaPlugin {
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";
@@ -80,14 +78,11 @@ public class RestServiceNode implements SvcLogicJavaPlugin {
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);
+ String resourceUri = resourceUriExtractor.extractResourceUri(ctx);
log.info("Rest Constructed URL : " + resourceUri);
- Transaction transaction = transactionHandler.buildTransaction(ctx, prop, resourceUri);
+ Transaction transaction = transactionHandler.buildTransaction(ctx, resourceUri);
Map<String, String> output = restExecutor.execute(transaction, ctx);
String json = output.get(REST_RESPONSE);
@@ -110,12 +105,5 @@ public class RestServiceNode implements SvcLogicJavaPlugin {
}
}
- 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);
- }
+
}
diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/TransactionHandler.java b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/TransactionHandler.java
index 71ab8f7aa..3a0a6a633 100644
--- a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/TransactionHandler.java
+++ b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/node/TransactionHandler.java
@@ -3,6 +3,7 @@
* ONAP : APPC
* ================================================================================
* 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.
@@ -21,10 +22,9 @@ package org.onap.appc.flow.controller.node;
import static org.onap.appc.flow.controller.utils.FlowControllerConstants.INPUT_REQUEST_ACTION;
import static org.onap.appc.flow.controller.utils.FlowControllerConstants.INPUT_REQUEST_ACTION_TYPE;
-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_USER;
+import static org.onap.appc.flow.controller.utils.FlowControllerConstants.REST_PWD;
-import java.util.Properties;
import org.apache.commons.lang3.StringUtils;
import org.onap.appc.flow.controller.data.Transaction;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
@@ -34,16 +34,12 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
*/
class TransactionHandler {
- Transaction buildTransaction(SvcLogicContext ctx, Properties prop, String resourceUri)
+ Transaction buildTransaction(SvcLogicContext ctx, String resourceUri)
throws Exception {
String inputRequestAction = ctx.getAttribute(INPUT_REQUEST_ACTION);
String inputRequestActionType = ctx.getAttribute(INPUT_REQUEST_ACTION_TYPE);
- String vnfType = ctx.getAttribute(VNF_TYPE);
- if (StringUtils.isBlank(vnfType)) {
- throw new Exception("Don't know vnf type to send REST request for " + INPUT_REQUEST_ACTION + " - " +vnfType);
- }
if (StringUtils.isBlank(inputRequestActionType)) {
throw new Exception("Don't know REST operation for Action " + inputRequestActionType);
}
@@ -56,13 +52,10 @@ class TransactionHandler {
transaction.setExecutionRPC(inputRequestActionType);
transaction.setAction(INPUT_REQUEST_ACTION);
- String userKey = vnfType + "." + REST_PROTOCOL + "." + inputRequestAction + ".user";
- String passwordKey = vnfType + "." + REST_PROTOCOL + "." + inputRequestAction + ".password";
- transaction.setuId(prop.getProperty(userKey));
- transaction.setPswd(prop.getProperty(passwordKey));
- if (StringUtils.isBlank(transaction.getuId()) || StringUtils.isBlank(transaction.getPswd())) {
- throw new Exception ("User Id or Password is not set !!!");
- }
+
+ transaction.setuId(ctx.getAttribute(REST_USER));
+ transaction.setPswd(ctx.getAttribute(REST_PWD));
+
return transaction;
}
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 275dd431f..fee6b677a 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
@@ -118,7 +118,7 @@ public class FlowControllerConstants {
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_PWD="pwd";
public static final String REST_PORT="port";
public static final String REST_CONTEXT_URL="url";
}
diff --git a/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/InputParamsCollectorTest.java b/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/InputParamsCollectorTest.java
index dbf821e99..951c38dc5 100644
--- a/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/InputParamsCollectorTest.java
+++ b/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/InputParamsCollectorTest.java
@@ -3,6 +3,7 @@
* ONAP : APPC
* ================================================================================
* 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.
@@ -80,8 +81,7 @@ public class InputParamsCollectorTest {
Transaction transaction = inputParamsCollector.collectInputParams(ctx);
- Assert.assertEquals(
- "{\"input\":{\"request-info\":{\"action\":\"some-request-action\",\"payload\":\"some-payload\",\"action-level\":\"some-action-level\",\"action-identifier\":{\"vnf-id\":\"some-vnf-id\",\"vserver-id\":\"some-vserver-id\",\"vnfc-name\":\"some-vnfc-name\"}},\"inventory-info\":{\"vnf-info\":{\"vnf-id\":\"some-vnf-id\",\"vm\":[]}},\"dependency-info\":{\"vnfcs\":[{\"vnfc-type\":\"some-type\",\"mandatory\":\"some-mandatory\",\"resilience\":\"some-resilience\",\"parents\":[]},{\"vnfc-type\":\"some-type\",\"mandatory\":\"some-mandatory\",\"resilience\":\"some-resilience\",\"parents\":[]}]},\"capabilities\":{\"vnf\":[\"vnf-1\",\"vnf-2\"],\"vm\":[\"vm-1\",\"vm-2\"],\"vnfc\":[\"vnfc-1\",\"vnfc-2\"],\"vf-module\":[\"vf-module-1\",\"vf-module-2\"]}}}",
+ Assert.assertEquals("{\"input\":{\"request-info\":{\"action\":\"some-request-action\",\"payload\":\"some-payload\",\"action-level\":\"some-action-level\",\"action-identifier\":{\"vnf-id\":\"some-vnf-id\",\"vserver-id\":\"some-vserver-id\",\"vnfc-name\":\"some-vnfc-name\"}},\"inventory-info\":{\"vnf-info\":{\"vnf-id\":\"some-vnf-id\",\"identity-url\":\"\",\"vm\":[]}},\"capabilities\":{\"vnf\":[\"vnf-1\",\"vnf-2\"],\"vm\":[\"vm-1\",\"vm-2\"],\"vnfc\":[\"vnfc-1\",\"vnfc-2\"],\"vf-module\":[\"vf-module-1\",\"vf-module-2\"]}}}",
transaction.getPayload());
Assert.assertEquals("POST", transaction.getExecutionRPC());
Assert.assertEquals("seq-generator-uid", transaction.getuId());
@@ -127,4 +127,4 @@ public class InputParamsCollectorTest {
return new ObjectMapper().writeValueAsString(input);
}
-} \ No newline at end of file
+}
diff --git a/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/InventoryInfoExtractorTest.java b/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/InventoryInfoExtractorTest.java
index 66484da1e..314c0ed05 100644
--- a/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/InventoryInfoExtractorTest.java
+++ b/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/InventoryInfoExtractorTest.java
@@ -3,6 +3,7 @@
* ONAP : APPC
* ================================================================================
* 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.
@@ -26,6 +27,7 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.onap.appc.flow.controller.interfaceData.InventoryInfo;
+import org.onap.appc.flow.controller.interfaceData.VnfInfo;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
public class InventoryInfoExtractorTest {
@@ -55,11 +57,15 @@ public class InventoryInfoExtractorTest {
when(ctx.getAttribute("tmp.vnfInfo.vm[1].vnfc-name")).thenReturn("some-vnfc-name-1");
when(ctx.getAttribute("tmp.vnfInfo.vm[1].vnfc-type")).thenReturn("some-vnfc-type-1");
+ when(ctx.getAttribute("tmp.vnfInfo.identity-url")).thenReturn("some-url");
+
String vnfId = "some-vnf-id";
InventoryInfo inventoryInfo = inventoryInfoExtractor.getInventoryInfo(ctx, vnfId);
Assert.assertEquals(
- "InventoryInfo [vnfInfo=VnfInfo [vnfId=some-vnf-id, vnfName=some-vnf-name, vnfType=some-vnf-type, vm=[Vm [vserverId=some-id-0, vnfc=Vnfcslist [vnfcType=some-vnfc-type-0, vnfcName=some-vnfc-name-0]], Vm [vserverId=some-id-1, vnfc=Vnfcslist [vnfcType=some-vnfc-type-1, vnfcName=some-vnfc-name-1]]]]]",
+ "InventoryInfo [vnfInfo=VnfInfo [vnfId=some-vnf-id, vnfName=some-vnf-name, vnfType=some-vnf-type, " +
+ "identityUrl=some-url, vm=[Vm [vserverId=some-id-0, vmId=null, " +
+ "vnfc=Vnfcslist [vnfcType=some-vnfc-type-0, vnfcName=some-vnfc-name-0]], Vm [vserverId=some-id-1, vmId=null, vnfc=Vnfcslist [vnfcType=some-vnfc-type-1, vnfcName=some-vnfc-name-1]]]]]",
inventoryInfo.toString());
}
@@ -68,6 +74,7 @@ public class InventoryInfoExtractorTest {
when(ctx.getAttribute("tmp.vnfInfo.vnf.vnf-name")).thenReturn("some-vnf-name");
when(ctx.getAttribute("tmp.vnfInfo.vnf.vnf-type")).thenReturn("some-vnf-type");
when(ctx.getAttribute("tmp.vnfInfo.vm-count")).thenReturn("2");
+ when(ctx.getAttribute("tmp.vnfInfo.identity-url")).thenReturn("some-url");
when(ctx.getAttribute("tmp.vnfInfo.vm[0].vserver-id")).thenReturn("some-id-0");
when(ctx.getAttribute("tmp.vnfInfo.vm[0].vnfc-count")).thenReturn("2");
@@ -83,8 +90,11 @@ public class InventoryInfoExtractorTest {
InventoryInfo inventoryInfo = inventoryInfoExtractor.getInventoryInfo(ctx, vnfId);
Assert.assertEquals(
- "InventoryInfo [vnfInfo=VnfInfo [vnfId=some-vnf-id, vnfName=some-vnf-name, vnfType=some-vnf-type, vm=[Vm [vserverId=some-id-0, vnfc=Vnfcslist [vnfcType=some-vnfc-type-0, vnfcName=some-vnfc-name-0]], Vm [vserverId=some-id-1, vnfc=null]]]]",
- inventoryInfo.toString());
+ "InventoryInfo [vnfInfo=VnfInfo [vnfId=some-vnf-id, vnfName=some-vnf-name, "
+ + "vnfType=some-vnf-type, identityUrl=some-url, vm=[Vm [vserverId=some-id-0, "
+ + "vmId=null, vnfc=Vnfcslist [vnfcType=some-vnfc-type-0, vnfcName=some-vnfc-name-0]], "
+ + "Vm [vserverId=some-id-1, vmId=null, vnfc=null]]]]",
+ inventoryInfo.toString());
}
@Test
@@ -92,6 +102,8 @@ public class InventoryInfoExtractorTest {
when(ctx.getAttribute("tmp.vnfInfo.vnf.vnf-name")).thenReturn("some-vnf-name");
when(ctx.getAttribute("tmp.vnfInfo.vnf.vnf-type")).thenReturn("some-vnf-type");
when(ctx.getAttribute("tmp.vnfInfo.vm-count")).thenReturn("0");
+ when(ctx.getAttribute("tmp.vnfInfo.identity-url")).thenReturn("some-url");
+
when(ctx.getAttribute("tmp.vnfInfo.vm[0].vserver-id")).thenReturn("some-id-0");
when(ctx.getAttribute("tmp.vnfInfo.vm[0].vnfc-count")).thenReturn("2");
@@ -106,9 +118,9 @@ public class InventoryInfoExtractorTest {
String vnfId = "some-vnf-id";
InventoryInfo inventoryInfo = inventoryInfoExtractor.getInventoryInfo(ctx, vnfId);
- Assert.assertEquals(
- "InventoryInfo [vnfInfo=VnfInfo [vnfId=some-vnf-id, vnfName=some-vnf-name, vnfType=some-vnf-type, vm=null]]",
- inventoryInfo.toString());
+ Assert.assertEquals("InventoryInfo [vnfInfo=VnfInfo [vnfId=some-vnf-id, vnfName=some-vnf-name, "
+ + "vnfType=some-vnf-type, identityUrl=some-url, vm=null]]",
+ inventoryInfo.toString());
}
@Test
@@ -116,6 +128,7 @@ public class InventoryInfoExtractorTest {
when(ctx.getAttribute("tmp.vnfInfo.vnf.vnf-name")).thenReturn("some-vnf-name");
when(ctx.getAttribute("tmp.vnfInfo.vnf.vnf-type")).thenReturn("some-vnf-type");
when(ctx.getAttribute("tmp.vnfInfo.vm-count")).thenReturn("");
+ when(ctx.getAttribute("tmp.vnfInfo.identity-url")).thenReturn("some-url");
when(ctx.getAttribute("tmp.vnfInfo.vm[0].vserver-id")).thenReturn("some-id-0");
when(ctx.getAttribute("tmp.vnfInfo.vm[0].vnfc-count")).thenReturn("2");
@@ -131,8 +144,9 @@ public class InventoryInfoExtractorTest {
InventoryInfo inventoryInfo = inventoryInfoExtractor.getInventoryInfo(ctx, vnfId);
Assert.assertEquals(
- "InventoryInfo [vnfInfo=VnfInfo [vnfId=some-vnf-id, vnfName=some-vnf-name, vnfType=some-vnf-type, vm=null]]",
- inventoryInfo.toString());
+ "InventoryInfo [vnfInfo=VnfInfo [vnfId=some-vnf-id, vnfName=some-vnf-name, "
+ + "vnfType=some-vnf-type, identityUrl=some-url, vm=null]]",
+ inventoryInfo.toString());
}
@Test
@@ -140,6 +154,7 @@ public class InventoryInfoExtractorTest {
when(ctx.getAttribute("tmp.vnfInfo.vnf.vnf-name")).thenReturn("some-vnf-name");
when(ctx.getAttribute("tmp.vnfInfo.vnf.vnf-type")).thenReturn("some-vnf-type");
when(ctx.getAttribute("tmp.vnfInfo.vm-count")).thenReturn(null);
+ when(ctx.getAttribute("tmp.vnfInfo.identity-url")).thenReturn("some-url");
when(ctx.getAttribute("tmp.vnfInfo.vm[0].vserver-id")).thenReturn("some-id-0");
when(ctx.getAttribute("tmp.vnfInfo.vm[0].vnfc-count")).thenReturn("2");
@@ -155,8 +170,29 @@ public class InventoryInfoExtractorTest {
InventoryInfo inventoryInfo = inventoryInfoExtractor.getInventoryInfo(ctx, vnfId);
Assert.assertEquals(
- "InventoryInfo [vnfInfo=VnfInfo [vnfId=some-vnf-id, vnfName=some-vnf-name, vnfType=some-vnf-type, vm=null]]",
- inventoryInfo.toString());
+ "InventoryInfo [vnfInfo=VnfInfo [vnfId=some-vnf-id, vnfName=some-vnf-name, "
+ + "vnfType=some-vnf-type, identityUrl=some-url, vm=null]]",
+ inventoryInfo.toString());
+ }
+
+ @Test
+ public void testGetIdentityUrl_from_payload() throws Exception{
+ InventoryInfoExtractor info = new InventoryInfoExtractor();
+ when(ctx.getAttribute("AICIdentity")).thenReturn("some_url");
+ VnfInfo vnfInfo = new VnfInfo();
+ String url=info.getIdentityUrl(ctx, vnfInfo, "123");
+ System.out.println(info.toString());
+ Assert.assertEquals(url, "some_url");
+ }
+
+ @Test
+ public void testGetIdentityUrl_from_Inventory() throws Exception{
+ InventoryInfoExtractor info = new InventoryInfoExtractor();
+ when(ctx.getAttribute("tmp.vnfInfo.identity-url")).thenReturn("some_url_from_inventory");
+ VnfInfo vnfInfo = new VnfInfo();
+ String url=info.getIdentityUrl(ctx, vnfInfo, "123");
+ System.out.println(info.toString());
+ Assert.assertEquals(url, "some_url_from_inventory");
}
-} \ No newline at end of file
+}
diff --git a/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/ResourceUriExtractorTest.java b/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/ResourceUriExtractorTest.java
index 34227587a..67a4e36e0 100644
--- a/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/ResourceUriExtractorTest.java
+++ b/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/ResourceUriExtractorTest.java
@@ -62,7 +62,7 @@ public class ResourceUriExtractorTest {
when(ctx.getAttribute(INPUT_URL)).thenReturn("http://localhost:8080");
resourceUriExtractor = new ResourceUriExtractor();
- String resourceUri = resourceUriExtractor.extractResourceUri(ctx, prop);
+ String resourceUri = resourceUriExtractor.extractResourceUri(ctx);
Assert.assertEquals("http://localhost:8080", resourceUri);
}
@@ -71,15 +71,13 @@ public class ResourceUriExtractorTest {
public void should_extract_url_input_if_context_input_provided() throws Exception {
when(ctx.getAttribute(INPUT_URL)).thenReturn("");
when(ctx.getAttribute(INPUT_HOST_IP_ADDRESS)).thenReturn("localhost");
- when(prop.getProperty(ctx.getAttribute(VNF_TYPE) + "." + (REST_PROTOCOL) + "."
- + ctx.getAttribute(INPUT_REQUEST_ACTION) + "." + (REST_PORT))).thenReturn("8080");
+ when(ctx.getAttribute(REST_PORT)).thenReturn("8080");
when(ctx.getAttribute(INPUT_CONTEXT)).thenReturn("input-context");
- when(ctx.getAttribute(INPUT_SUB_CONTEXT)).thenReturn("input-sub-context");
- String resourceUri = resourceUriExtractor.extractResourceUri(ctx, prop);
+ String resourceUri = resourceUriExtractor.extractResourceUri(ctx);
- Assert.assertEquals("http://localhost:8080/input-context/input-sub-context", resourceUri);
+ Assert.assertEquals("http://localhost:8080/input-context", resourceUri);
}
@Test
@@ -87,29 +85,27 @@ public class ResourceUriExtractorTest {
when(ctx.getAttribute(INPUT_REQUEST_ACTION)).thenReturn("request-action");
when(ctx.getAttribute(INPUT_URL)).thenReturn("");
when(ctx.getAttribute(INPUT_HOST_IP_ADDRESS)).thenReturn("localhost");
- when(prop.getProperty(ctx.getAttribute(VNF_TYPE) + "." + (REST_PROTOCOL) + "."
- + ctx.getAttribute(INPUT_REQUEST_ACTION) + "." + (REST_PORT))).thenReturn("8080");
-
- when(prop.getProperty(ctx.getAttribute(VNF_TYPE) + "." + REST_PROTOCOL + "."
- + ctx.getAttribute(INPUT_REQUEST_ACTION) + "." + REST_CONTEXT_URL)).thenReturn("ra-context");
+ when(ctx.getAttribute(REST_PORT)).thenReturn("8080");
+ when(ctx.getAttribute(INPUT_CONTEXT)).thenReturn("ra-context");
when(prop.getProperty("request-action.sub-context")).thenReturn("ra-sub-context");
- String resourceUri = resourceUriExtractor.extractResourceUri(ctx, prop);
+ String resourceUri = resourceUriExtractor.extractResourceUri(ctx);
- Assert.assertEquals("http://localhost:8080/ra-context/ra-sub-context", resourceUri);
+ Assert.assertEquals("http://localhost:8080/ra-context", resourceUri);
}
@Test
public void should_throw_exception_if_missing_context() throws Exception {
when(ctx.getAttribute(INPUT_URL)).thenReturn("");
when(ctx.getAttribute(INPUT_HOST_IP_ADDRESS)).thenReturn("localhost");
- when(prop.getProperty(ctx.getAttribute(VNF_TYPE) + "." + (REST_PROTOCOL) + "."
- + ctx.getAttribute(INPUT_REQUEST_ACTION) + "." + (REST_PORT))).thenReturn("8080");
+ when(ctx.getAttribute(INPUT_HOST_IP_ADDRESS)).thenReturn("localhost");
+ when(prop.getProperty(ctx.getAttribute(VNF_TYPE)+"."+(REST_PROTOCOL)+"."+ctx.getAttribute(INPUT_REQUEST_ACTION)
+ +"."+(REST_PORT))).thenReturn("8080");
expectedException.expect(Exception.class);
expectedException.expectMessage("Could not find the context for operation null");
- resourceUriExtractor.extractResourceUri(ctx, prop);
+ resourceUriExtractor.extractResourceUri(ctx);
}
}
diff --git a/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/TestRestServiceNode.java b/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/TestRestServiceNode.java
index 001581402..e49db45d4 100644
--- a/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/TestRestServiceNode.java
+++ b/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/TestRestServiceNode.java
@@ -25,12 +25,10 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;
-import static org.onap.appc.flow.controller.node.RestServiceNode.APPC_CONFIG_DIR_VAR;
import static org.onap.appc.flow.controller.node.RestServiceNode.REST_RESPONSE;
import static org.onap.appc.flow.controller.utils.FlowControllerConstants.INPUT_PARAM_RESPONSE_PREFIX;
import java.util.HashMap;
import java.util.Map;
-import java.util.Properties;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
@@ -75,14 +73,13 @@ public class TestRestServiceNode {
HashMap<String, String> restResponseMap = new HashMap<>();
restResponseMap.put(REST_RESPONSE, REST_BODY_RESPONSE.replaceAll("'", "\""));
- when(uriExtractorMock.extractResourceUri(any(SvcLogicContext.class), any(Properties.class)))
+ when(uriExtractorMock.extractResourceUri(any(SvcLogicContext.class)))
.thenReturn(RESOURCE_URI);
- when(transactionHandlerMock.buildTransaction(any(SvcLogicContext.class), any(Properties.class),
+ when(transactionHandlerMock.buildTransaction(any(SvcLogicContext.class),
eq(RESOURCE_URI))).thenReturn(transaction);
when(restExecutorMock.execute(eq(transaction), any(SvcLogicContext.class))).thenReturn(restResponseMap);
EnvVariables envVariables = mock(EnvVariables.class);
- when(envVariables.getenv(APPC_CONFIG_DIR_VAR)).thenReturn("src/test/resources");
restServiceNode = new RestServiceNode(transactionHandlerMock, restExecutorMock, uriExtractorMock, envVariables);
}
@@ -95,15 +92,15 @@ public class TestRestServiceNode {
restServiceNode.sendRequest(params, ctxMock);
// then
- verify(uriExtractorMock).extractResourceUri(eq(ctxMock), any(Properties.class));
- verify(transactionHandlerMock).buildTransaction(eq(ctxMock), any(Properties.class), eq(RESOURCE_URI));
+ verify(uriExtractorMock).extractResourceUri(eq(ctxMock));
+ verify(transactionHandlerMock).buildTransaction(eq(ctxMock), eq(RESOURCE_URI));
verify(restExecutorMock).execute(transaction, ctxMock);
verifyNoMoreInteractions(uriExtractorMock, transactionHandlerMock, restExecutorMock);
}
@Test
public void should_rethrow_exception_from_uri_extractor() throws Exception {
- when(uriExtractorMock.extractResourceUri(eq(ctxMock), any(Properties.class)))
+ when(uriExtractorMock.extractResourceUri(eq(ctxMock)))
.thenThrow(new Exception("resource uri exception"));
expectedException.expect(SvcLogicException.class);
@@ -114,7 +111,7 @@ public class TestRestServiceNode {
@Test
public void should_rethrow_exception_from_transaction_handler() throws Exception {
- when(transactionHandlerMock.buildTransaction(eq(ctxMock), any(Properties.class), eq(RESOURCE_URI)))
+ when(transactionHandlerMock.buildTransaction(eq(ctxMock), eq(RESOURCE_URI)))
.thenThrow(new Exception("transaction exception"));
expectedException.expect(SvcLogicException.class);
diff --git a/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/TransactionHandlerTest.java b/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/TransactionHandlerTest.java
index a57a8c043..007f33b6f 100644
--- a/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/TransactionHandlerTest.java
+++ b/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/node/TransactionHandlerTest.java
@@ -3,6 +3,7 @@
* ONAP : APPC
* ================================================================================
* 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.
@@ -59,9 +60,9 @@ public class TransactionHandlerTest {
when(ctx.getAttribute(INPUT_REQUEST_ACTION_TYPE)).thenReturn("");
expectedException.expect(Exception.class);
- expectedException.expectMessage("Don't know vnf type to send REST request for request-action - null");
+ expectedException.expectMessage("Don't know REST operation for Action");
transactionHandler = new TransactionHandler();
- transactionHandler.buildTransaction(ctx, prop, RESOURCE_URI);
+ transactionHandler.buildTransaction(ctx, RESOURCE_URI);
}
@Test
@@ -70,8 +71,8 @@ public class TransactionHandlerTest {
when(ctx.getAttribute(INPUT_REQUEST_ACTION_TYPE)).thenReturn("foo");
expectedException.expect(Exception.class);
- expectedException.expectMessage("Don't know vnf type to send REST request for request-action - null");
- transactionHandler.buildTransaction(ctx, prop, "some uri");
+ expectedException.expectMessage("Don't know request-action request-action");
+ transactionHandler.buildTransaction(ctx, "some uri");
}
@Test
@@ -80,18 +81,16 @@ public class TransactionHandlerTest {
when(ctx.getAttribute(INPUT_REQUEST_ACTION_TYPE)).thenReturn("input-ra-type");
when(ctx.getAttribute(INPUT_REQUEST_ACTION)).thenReturn("input-ra");
when(ctx.getAttribute(VNF_TYPE)).thenReturn("vnf");
-
- String userKey = ctx.getAttribute(VNF_TYPE) + "." + REST_PROTOCOL + "." + ctx.getAttribute(INPUT_REQUEST_ACTION)
+
+ String userKey = ctx.getAttribute(VNF_TYPE) + "." + REST_PROTOCOL + "." + ctx.getAttribute(INPUT_REQUEST_ACTION)
+ ".user";
- String passwordKey = ctx.getAttribute(VNF_TYPE) + "." + REST_PROTOCOL + "." + ctx.getAttribute(INPUT_REQUEST_ACTION)
+ String passwordKey = ctx.getAttribute(VNF_TYPE) + "." + REST_PROTOCOL + "." + ctx.getAttribute(INPUT_REQUEST_ACTION)
+ ".password";
- when(prop.getProperty(userKey))
- .thenReturn("rest-user");
- when(prop.getProperty(passwordKey))
- .thenReturn("rest-pass");
+ when(ctx.getAttribute("user")).thenReturn("rest-user");
+ when(ctx.getAttribute("pwd")).thenReturn("rest-pass");
- Transaction transaction = transactionHandler.buildTransaction(ctx, prop, "some uri");
+ Transaction transaction = transactionHandler.buildTransaction(ctx,"some uri");
Assert.assertEquals(INPUT_REQUEST_ACTION, transaction.getAction());
Assert.assertEquals("input-ra-type", transaction.getExecutionRPC());