summaryrefslogtreecommitdiffstats
path: root/appc-adapters
diff options
context:
space:
mode:
authorMamtha <mamtha.sabesan@in.ibm.com>2020-04-17 18:55:35 +0530
committerTakamune Cho <takamune.cho@att.com>2020-04-17 20:37:08 +0000
commitb7e91dd7ef25b497f2358a71e059f48fb657b6c1 (patch)
treefed2182be562eaf914c8694aa42c2ada09894d5f /appc-adapters
parent9bdb8c9c563a8ace784a2efeefc2428ad177ed43 (diff)
Code smell fix for appc-ansible-adapter-bundle module
Issue-ID: APPC-1858 Change-Id: I20362c71c8c54def706bb2fe94970ab18965d62d Signed-off-by: Mamtha <mamtha.sabesan@in.ibm.com>
Diffstat (limited to 'appc-adapters')
-rw-r--r--appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/pom.xml7
-rw-r--r--appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/main/java/org/onap/appc/adapter/ansible/impl/AnsibleAdapterImpl.java22
2 files changed, 11 insertions, 18 deletions
diff --git a/appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/pom.xml b/appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/pom.xml
index 3af242d4c..1a71a37cb 100644
--- a/appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/pom.xml
+++ b/appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/pom.xml
@@ -172,13 +172,6 @@
<artifactId>guava</artifactId>
</dependency>
- <!--
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- <version>2.8.0</version>
- </dependency>
- -->
</dependencies>
diff --git a/appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/main/java/org/onap/appc/adapter/ansible/impl/AnsibleAdapterImpl.java b/appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/main/java/org/onap/appc/adapter/ansible/impl/AnsibleAdapterImpl.java
index 4c59b4e18..901fe03ad 100644
--- a/appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/main/java/org/onap/appc/adapter/ansible/impl/AnsibleAdapterImpl.java
+++ b/appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/main/java/org/onap/appc/adapter/ansible/impl/AnsibleAdapterImpl.java
@@ -95,7 +95,7 @@ public class AnsibleAdapterImpl implements AnsibleAdapter {
private static final String PASSWORD = "Password";
private static final String APPC_PROPS = "/appc.properties";
private static final String SDNC_CONFIG_DIR = "SDNC_CONFIG_DIR";
- private static final String propDir = System.getenv(SDNC_CONFIG_DIR);
+ private static final String PROPDIR = System.getenv(SDNC_CONFIG_DIR);
private static final String SERVERIP = "ServerIP";
private Properties props;
private int defaultTimeout = 600 * 1000;
@@ -109,7 +109,7 @@ public class AnsibleAdapterImpl implements AnsibleAdapter {
/**
* Connection object
**/
- private ConnectionBuilder httpClient;
+ //private ConnectionBuilder httpClient;
/**
* Ansible API Message Handlers
@@ -174,7 +174,7 @@ public class AnsibleAdapterImpl implements AnsibleAdapter {
* data
*/
private void initialize() {
- String path = propDir + APPC_PROPS;
+ String path = PROPDIR + APPC_PROPS;
File propFile = new File(path);
props = new Properties();
try {
@@ -217,7 +217,7 @@ public class AnsibleAdapterImpl implements AnsibleAdapter {
private ConnectionBuilder getHttpConn(int timeout, String serverIP) {
- String path = propDir + APPC_PROPS;
+ String path = PROPDIR + APPC_PROPS;
File propFile = new File(path);
props = new Properties();
InputStream input;
@@ -347,10 +347,9 @@ public class AnsibleAdapterImpl implements AnsibleAdapter {
doFailure(ctx, testResult.getStatusCode(),
"Error posting request. Reason = " + testResult.getStatusMessage());
}
- String output = StringUtils.EMPTY;
code = testResult.getStatusCode();
message = testResult.getStatusMessage();
- output = testResult.getOutput();
+ String output = testResult.getOutput();
ctx.setAttribute(OUTPUT_ATTRIBUTE_NAME, output);
String serverIp = testResult.getServerIp();
if (StringUtils.isBlank(serverIp))
@@ -414,6 +413,7 @@ public class AnsibleAdapterImpl implements AnsibleAdapter {
String vmKey = "tmp.vnfInfo.vm[" + Integer.toString(i) + "]";
logger.info("Looking for attributes of: " + vmKey);
if (ctx.getAttribute(vmKey + ".vnfc-name") != null) {
+ String debugText = "Auto Node List candidate ";
String vmVnfcName = ctx.getAttribute(vmKey + ".vnfc-name");
String vmVnfcIpv4Address = ctx.getAttribute(vmKey + ".vnfc-ipaddress-v4-oam-vip");
String vmVnfcType = ctx.getAttribute(vmKey + ".vnfc-type");
@@ -423,31 +423,31 @@ public class AnsibleAdapterImpl implements AnsibleAdapter {
if (vServerId != null) {
String vmVserverId = ctx.getAttribute(vmKey + ".vserver-id");
if (vmVserverId == null || !vmVserverId.equals(vServerId)) {
- logger.debug("Auto Node List candidate " + vmVnfcName + " dropped. vserver-id mismatch");
+ logger.debug(debugText + vmVnfcName + " dropped. vserver-id mismatch");
continue;
}
}
if (vfModuleId != null) {
String vmVfModuleId = ctx.getAttribute(vmKey + ".vf-module-id");
if (vmVfModuleId == null || !vmVfModuleId.equals(vfModuleId)) {
- logger.debug("Auto Node List candidate " + vmVnfcName + " dropped. vf-module-id mismatch");
+ logger.debug(debugText + vmVnfcName + " dropped. vf-module-id mismatch");
continue;
}
}
if (vnfcName != null) {
if (!vmVnfcName.equals(vnfcName)) {
- logger.debug("Auto Node List candidate " + vmVnfcName + " dropped. vnfc-name mismatch");
+ logger.debug(debugText + vmVnfcName + " dropped. vnfc-name mismatch");
continue;
}
}
if (vnfcType != null) {
if (!vmVnfcType.equals(vnfcType)) {
- logger.debug("Auto Node List candidate " + vmVnfcType + " dropped. vnfc-type mismatch");
+ logger.debug(debugText + vmVnfcType + " dropped. vnfc-type mismatch");
continue;
}
}
- logger.info("Auto Node List candidate " + vmVnfcName + " [" + vmVnfcIpv4Address + "," + vmVnfcType + "]");
+ logger.info(debugText + vmVnfcName + " [" + vmVnfcIpv4Address + "," + vmVnfcType + "]");
JSONObject vnfTypeCandidates = null;
JSONArray vmList = null;