summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Dudycz <jakub.dudycz@nokia.com>2018-02-26 12:59:33 +0100
committerPatrick Brady <pb071s@att.com>2018-02-26 19:11:25 +0000
commitcccb65875f5716aaca9494d28233aaf6285312e2 (patch)
tree35b6509765b350ece33b43b810111ab731c54840
parent312e9f071ef0a8b3482278e8909f66f4c986ba89 (diff)
appc-network-client-provider sonar fixes part 1
Initial code reformat and imports rearrangement Change-Id: Iacc8f3b4313415da2fb7215dd4a529c1f06de039 Issue-ID: APPC-672 Signed-off-by: Jakub Dudycz <jakub.dudycz@nokia.com>
-rw-r--r--appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/aai/data/AaiVmInfo.java1
-rw-r--r--appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/aai/data/AaiVnfcInfo.java2
-rw-r--r--appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/aai/interfaceImpl/AaiInterfaceRulesHandler.java104
-rw-r--r--appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/aai/utils/AaiClientConstant.java4
-rw-r--r--appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/InstarClientActivator.java44
-rw-r--r--appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/dme2client/SecureRestClientTrustManager.java38
-rw-r--r--appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/interfaceImpl/InstarResponseHandlerImpl.java65
-rw-r--r--appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/interfaceImpl/InstarRestClientImpl.java57
-rw-r--r--appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/interfaceImpl/InterfaceIpAddressImpl.java91
-rw-r--r--appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/interfaces/ResponseHandlerInterface.java3
-rw-r--r--appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/interfaces/RestClientInterface.java4
-rw-r--r--appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/interfaces/RuleHandlerInterface.java3
-rw-r--r--appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/utils/InstarClientConstant.java61
13 files changed, 227 insertions, 250 deletions
diff --git a/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/aai/data/AaiVmInfo.java b/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/aai/data/AaiVmInfo.java
index 000242450..266b29000 100644
--- a/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/aai/data/AaiVmInfo.java
+++ b/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/aai/data/AaiVmInfo.java
@@ -27,6 +27,7 @@ package org.onap.appc.aai.data;
import java.util.List;
public class AaiVmInfo {
+
public String getVserverId() {
return vserverId;
}
diff --git a/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/aai/data/AaiVnfcInfo.java b/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/aai/data/AaiVnfcInfo.java
index 89c8ce0a4..d62148f89 100644
--- a/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/aai/data/AaiVnfcInfo.java
+++ b/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/aai/data/AaiVnfcInfo.java
@@ -62,6 +62,4 @@ public class AaiVnfcInfo {
public void setVnfcOamIpAddress(String vnfcOamIpAddress) {
this.vnfcOamIpAddress = vnfcOamIpAddress;
}
-
-
}
diff --git a/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/aai/interfaceImpl/AaiInterfaceRulesHandler.java b/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/aai/interfaceImpl/AaiInterfaceRulesHandler.java
index b5c39de61..e97d84f34 100644
--- a/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/aai/interfaceImpl/AaiInterfaceRulesHandler.java
+++ b/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/aai/interfaceImpl/AaiInterfaceRulesHandler.java
@@ -24,22 +24,20 @@
package org.onap.appc.aai.interfaceImpl;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import java.util.ArrayList;
import java.util.List;
-
import org.apache.commons.lang.StringUtils;
import org.json.JSONObject;
import org.onap.appc.aai.data.AaiVmInfo;
import org.onap.appc.aai.data.AaiVnfInfo;
import org.onap.appc.aai.data.AaiVnfcInfo;
-import org.onap.appc.instar.interfaces.RuleHandlerInterface;
import org.onap.appc.aai.utils.AaiClientConstant;
+import org.onap.appc.instar.interfaces.RuleHandlerInterface;
+import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.sdnc.config.params.data.Parameter;
import org.onap.sdnc.config.params.data.ResponseKey;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
public class AaiInterfaceRulesHandler implements RuleHandlerInterface {
@@ -68,19 +66,25 @@ public class AaiInterfaceRulesHandler implements RuleHandlerInterface {
for (ResponseKey filterKeys : responseKeyList) {
- if (null == filterKeys)
+ if (null == filterKeys) {
continue;
+ }
- if (StringUtils.isNotBlank(filterKeys.getUniqueKeyName()))
+ if (StringUtils.isNotBlank(filterKeys.getUniqueKeyName())) {
respKeys.setUniqueKeyName(filterKeys.getUniqueKeyName());
- if (StringUtils.isNotBlank(filterKeys.getUniqueKeyValue()))
+ }
+ if (StringUtils.isNotBlank(filterKeys.getUniqueKeyValue())) {
respKeys.setUniqueKeyValue(filterKeys.getUniqueKeyValue());
- if (StringUtils.isNotBlank(filterKeys.getFieldKeyName()))
+ }
+ if (StringUtils.isNotBlank(filterKeys.getFieldKeyName())) {
respKeys.setFieldKeyName(filterKeys.getFieldKeyName());
- if (StringUtils.isNotBlank(filterKeys.getFilterByField()))
+ }
+ if (StringUtils.isNotBlank(filterKeys.getFilterByField())) {
respKeys.setFilterByField(filterKeys.getFilterByField());
- if (StringUtils.isNotBlank(filterKeys.getFilterByValue()))
+ }
+ if (StringUtils.isNotBlank(filterKeys.getFilterByValue())) {
respKeys.setFilterByValue(filterKeys.getFilterByValue());
+ }
}
processKeys(respKeys, parameters.getName());
@@ -106,11 +110,11 @@ public class AaiInterfaceRulesHandler implements RuleHandlerInterface {
}
if (StringUtils.equalsIgnoreCase(filterKey.getUniqueKeyValue(), "vnfc")) {
values = getVnfcDetailsFromContext(filterKey.getFieldKeyName(), filterKey.getFilterByField(),
- filterKey.getFilterByValue());
+ filterKey.getFilterByValue());
}
if (StringUtils.equalsIgnoreCase(filterKey.getUniqueKeyValue(), "vserver")) {
values = getVServerDetailsFromContext(filterKey.getFieldKeyName(), filterKey.getFilterByField(),
- filterKey.getFilterByValue());
+ filterKey.getFilterByValue());
}
aaiKeyValues.put(aaiKey, values);
context.setAttribute(AaiClientConstant.AAI_KEY_VALUES, aaiKeyValues.toString());
@@ -121,7 +125,7 @@ public class AaiInterfaceRulesHandler implements RuleHandlerInterface {
String fn = "AaiInterfaceRulesHander::getVServerDetailsFromContext():";
String values = "";
log.info(fn + "FieldKeyName:" + fieldKeyName + " FilterByName:" + filterByField + " FilterByValue:"
- + filterByValue);
+ + filterByValue);
if (!StringUtils.equalsIgnoreCase(fieldKeyName, "vserver-name")) {
log.info(fn + "Returning values:" + values);
@@ -129,104 +133,105 @@ public class AaiInterfaceRulesHandler implements RuleHandlerInterface {
}
if (StringUtils.isNotEmpty(filterByField)
- && StringUtils.isNotEmpty(filterByValue) ) {
+ && StringUtils.isNotEmpty(filterByValue)) {
int vmIndex = -1;
for (AaiVmInfo vm : vnfInfoData.getVmInfo()) {
vmIndex++;
- if (!StringUtils.equalsIgnoreCase(filterByField, "vm-number"))
+ if (!StringUtils.equalsIgnoreCase(filterByField, "vm-number")) {
continue;
+ }
int vmNumber = Integer.parseInt(filterByValue);
- if (vmNumber != vmIndex)
+ if (vmNumber != vmIndex) {
continue;
+ }
- if (StringUtils.isBlank(values))
+ if (StringUtils.isBlank(values)) {
values = vm.getVserverName();
- else
+ } else {
values = values + "," + vm.getVserverName();
+ }
}
} else {
for (AaiVmInfo vm : vnfInfoData.getVmInfo()) {
- if (StringUtils.isBlank(values))
+ if (StringUtils.isBlank(values)) {
values = vm.getVserverName();
- else
+ } else {
values = values + "," + vm.getVserverName();
+ }
}
}
log.info(fn + "Returning values:" + values);
return values;
-
}
//split from getVnfcDetailsFromContext
- private String add2ValuesIpaddressV4OamVipNotEmpty(String values, String filterByField, String filterByValue )
- {
+ private String add2ValuesIpaddressV4OamVipNotEmpty(String values, String filterByField, String filterByValue) {
for (AaiVmInfo vm : vnfInfoData.getVmInfo()) {
for (AaiVnfcInfo vnfcInfo : vm.getVnfcInfo()) {
if (!StringUtils.equalsIgnoreCase(filterByField, "vnfc-function-code")
- || !StringUtils.equalsIgnoreCase(filterByValue, vnfcInfo.getVnfcFunctionCode()))
+ || !StringUtils.equalsIgnoreCase(filterByValue, vnfcInfo.getVnfcFunctionCode())) {
continue;
+ }
- if (StringUtils.isBlank(values))
+ if (StringUtils.isBlank(values)) {
values = vnfcInfo.getVnfcOamIpAddress();
- else
+ } else {
values = values + "," + vnfcInfo.getVnfcOamIpAddress();
+ }
}
}
-
return values;
}
//split from getVnfcDetailsFromContext
- private String add2ValuesIpaddressV4OamVipEmpty(String values, String filterByField, String filterByValue )
- {
+ private String add2ValuesIpaddressV4OamVipEmpty(String values, String filterByField, String filterByValue) {
for (AaiVmInfo vm : vnfInfoData.getVmInfo()) {
for (AaiVnfcInfo vnfcInfo : vm.getVnfcInfo()) {
- if (StringUtils.isBlank(values))
+ if (StringUtils.isBlank(values)) {
values = vnfcInfo.getVnfcOamIpAddress();
- else
+ } else {
values = values + "," + vnfcInfo.getVnfcOamIpAddress();
+ }
}
}
-
return values;
}
//split from getVnfcDetailsFromContext
- private String add2ValuesVnfcNameNotEmpty(String values, String filterByField, String filterByValue )
- {
+ private String add2ValuesVnfcNameNotEmpty(String values, String filterByField, String filterByValue) {
for (AaiVmInfo vm : vnfInfoData.getVmInfo()) {
for (AaiVnfcInfo vnfcInfo : vm.getVnfcInfo()) {
if (!StringUtils.equalsIgnoreCase(filterByField, "vnfc-function-code")
- || !StringUtils.equalsIgnoreCase(filterByValue, vnfcInfo.getVnfcFunctionCode()))
+ || !StringUtils.equalsIgnoreCase(filterByValue, vnfcInfo.getVnfcFunctionCode())) {
continue;
+ }
- if (StringUtils.isBlank(values))
+ if (StringUtils.isBlank(values)) {
values = vnfcInfo.getVnfcName();
- else
+ } else {
values = values + "," + vnfcInfo.getVnfcName();
+ }
}
}
-
return values;
}
//split from getVnfcDetailsFromContext
- private String add2ValuesVnfcNameEmpty(String values, String filterByField, String filterByValue )
- {
+ private String add2ValuesVnfcNameEmpty(String values, String filterByField, String filterByValue) {
for (AaiVmInfo vm : vnfInfoData.getVmInfo()) {
for (AaiVnfcInfo vnfcInfo : vm.getVnfcInfo()) {
- if (StringUtils.isBlank(values))
+ if (StringUtils.isBlank(values)) {
values = vnfcInfo.getVnfcName();
- else
+ } else {
values = values + "," + vnfcInfo.getVnfcName();
+ }
}
}
-
return values;
}
@@ -234,7 +239,7 @@ public class AaiInterfaceRulesHandler implements RuleHandlerInterface {
String fn = "AaiInterfaceRulesHander::getVnfcDetailsFromContext()";
String values = "";
log.info(fn + "FieldKeyName:" + fieldKeyName + " FilterByField:" + filterByField + " FilterByValue:"
- + filterByValue);
+ + filterByValue);
if (StringUtils.equalsIgnoreCase(fieldKeyName, "ipaddress-v4-oam-vip")) {
if (StringUtils.isNotEmpty(filterByField) && StringUtils.isNotEmpty(filterByValue)) {
values = add2ValuesIpaddressV4OamVipNotEmpty(values, filterByField, filterByValue);
@@ -251,7 +256,6 @@ public class AaiInterfaceRulesHandler implements RuleHandlerInterface {
}
log.info(fn + "Returning values:" + values);
return values;
-
}
private String getVnfDetailsFromContext(String fieldKeyName) {
@@ -289,8 +293,9 @@ public class AaiInterfaceRulesHandler implements RuleHandlerInterface {
String vmcount = context.getAttribute("tmp.vnfInfo.vm-count");
int vmCount = 0;
- if (!StringUtils.isBlank(vmcount))
+ if (!StringUtils.isBlank(vmcount)) {
vmCount = Integer.parseInt(vmcount);
+ }
log.info("generateAaiVnfInfoData::" + "vmCount:" + vmCount);
AaiVnfInfo vnfInfo = new AaiVnfInfo();
vnfInfo.setVnfName("vnf-name");
@@ -306,7 +311,7 @@ public class AaiInterfaceRulesHandler implements RuleHandlerInterface {
vnfcInfo.setVnfcName(context.getAttribute("tmp.vnfInfo.vm[" + i + "].vnfc-name"));
vnfcInfo.setVnfcFunctionCode(context.getAttribute("tmp.vnfInfo.vm[" + i + "].vnfc-function-code"));
vnfcInfo.setVnfcOamIpAddress(
- context.getAttribute("tmp.vnfInfo.vm[" + i + "].vnfc-ipaddress-v4-oam-vip"));
+ context.getAttribute("tmp.vnfInfo.vm[" + i + "].vnfc-ipaddress-v4-oam-vip"));
vnfcInfoList.add(vnfcInfo);
}
vm.setVnfcInfo(vnfcInfoList);
@@ -317,5 +322,4 @@ public class AaiInterfaceRulesHandler implements RuleHandlerInterface {
vnfInfo.setVmInfo(vmList);
return vnfInfo;
}
-
} \ No newline at end of file
diff --git a/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/aai/utils/AaiClientConstant.java b/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/aai/utils/AaiClientConstant.java
index 134d58a43..9b7bd80e4 100644
--- a/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/aai/utils/AaiClientConstant.java
+++ b/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/aai/utils/AaiClientConstant.java
@@ -25,7 +25,9 @@
package org.onap.appc.aai.utils;
public class AaiClientConstant {
- private AaiClientConstant() {}//hidden public constructor
+
+ private AaiClientConstant() {
+ }//hidden public constructor
public static final String INPUT_PARAM_RESPONSE_PRIFIX = "responsePrefix";
public static final String OUTPUT_PARAM_STATUS = "status";
diff --git a/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/InstarClientActivator.java b/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/InstarClientActivator.java
index 09021daa4..f36ede8a6 100644
--- a/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/InstarClientActivator.java
+++ b/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/InstarClientActivator.java
@@ -24,41 +24,35 @@
package org.onap.appc.instar;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import java.util.LinkedList;
import java.util.List;
-
import org.onap.appc.instar.node.InstarClientNode;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class InstarClientActivator implements BundleActivator{
-
- private List<ServiceRegistration> registrations = new LinkedList<ServiceRegistration>();
- private static final EELFLogger log = EELFManager.getInstance().getLogger(InstarClientActivator.class);
+public class InstarClientActivator implements BundleActivator {
- @Override
- public void start(BundleContext ctx) throws Exception
- {
+ private List<ServiceRegistration> registrations = new LinkedList<ServiceRegistration>();
+ private static final EELFLogger log = EELFManager.getInstance().getLogger(InstarClientActivator.class);
- InstarClientNode instarClientNode = new InstarClientNode();
- log.info("Registering service "+ instarClientNode.getClass().getName());
- registrations.add(ctx.registerService(instarClientNode.getClass().getName(), instarClientNode, null));
- log.info("Registering service sccessful for "+ instarClientNode.getClass().getName());
+ @Override
+ public void start(BundleContext ctx) throws Exception {
- }
- @Override
- public void stop(BundleContext arg0) throws Exception
- {
- for (ServiceRegistration registration: registrations)
- {
- registration.unregister();
- registration = null;
- }
+ InstarClientNode instarClientNode = new InstarClientNode();
+ log.info("Registering service " + instarClientNode.getClass().getName());
+ registrations.add(ctx.registerService(instarClientNode.getClass().getName(), instarClientNode, null));
+ log.info("Registering service sccessful for " + instarClientNode.getClass().getName());
+ }
- }
+ @Override
+ public void stop(BundleContext arg0) throws Exception {
+ for (ServiceRegistration registration : registrations) {
+ registration.unregister();
+ registration = null;
+ }
+ }
}
diff --git a/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/dme2client/SecureRestClientTrustManager.java b/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/dme2client/SecureRestClientTrustManager.java
index 86c2d99b3..12aba769a 100644
--- a/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/dme2client/SecureRestClientTrustManager.java
+++ b/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/dme2client/SecureRestClientTrustManager.java
@@ -26,33 +26,31 @@ package org.onap.appc.instar.dme2client;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
-
import javax.net.ssl.X509TrustManager;
public class SecureRestClientTrustManager implements X509TrustManager {
- @Override
- public void checkClientTrusted(X509Certificate[] arg0, String arg1)
- throws CertificateException {
- }
-
- @Override
- public void checkServerTrusted(X509Certificate[] arg0, String arg1)
- throws CertificateException {
- }
+ @Override
+ public void checkClientTrusted(X509Certificate[] arg0, String arg1)
+ throws CertificateException {
+ }
- @Override
- public X509Certificate[] getAcceptedIssuers() {
- return new X509Certificate[0];
- }
+ @Override
+ public void checkServerTrusted(X509Certificate[] arg0, String arg1)
+ throws CertificateException {
+ }
- public boolean isClientTrusted(X509Certificate[] arg0) {
- return true;
- }
+ @Override
+ public X509Certificate[] getAcceptedIssuers() {
+ return new X509Certificate[0];
+ }
- public boolean isServerTrusted(X509Certificate[] arg0) {
- return true;
- }
+ public boolean isClientTrusted(X509Certificate[] arg0) {
+ return true;
+ }
+ public boolean isServerTrusted(X509Certificate[] arg0) {
+ return true;
+ }
}
diff --git a/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/interfaceImpl/InstarResponseHandlerImpl.java b/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/interfaceImpl/InstarResponseHandlerImpl.java
index c556e9ce9..3cd965620 100644
--- a/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/interfaceImpl/InstarResponseHandlerImpl.java
+++ b/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/interfaceImpl/InstarResponseHandlerImpl.java
@@ -24,15 +24,14 @@
package org.onap.appc.instar.interfaceImpl;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import org.json.JSONArray;
import org.json.JSONObject;
import org.onap.appc.instar.interfaces.ResponseHandlerInterface;
import org.onap.appc.instar.utils.InstarClientConstant;
-import org.onap.sdnc.config.params.data.ResponseKey;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
+import org.onap.sdnc.config.params.data.ResponseKey;
public class InstarResponseHandlerImpl implements ResponseHandlerInterface {
@@ -54,47 +53,43 @@ public class InstarResponseHandlerImpl implements ResponseHandlerInterface {
JSONObject instarKeyValues;
- log.info("Instar Data in Context : "+ ctxt.getAttribute(InstarClientConstant.INSTAR_KEY_VALUES));
- if(ctxt.getAttribute(InstarClientConstant.INSTAR_KEY_VALUES) != null){
+ log.info("Instar Data in Context : " + ctxt.getAttribute(InstarClientConstant.INSTAR_KEY_VALUES));
+ if (ctxt.getAttribute(InstarClientConstant.INSTAR_KEY_VALUES) != null) {
instarKeyValues = new JSONObject(ctxt.getAttribute(InstarClientConstant.INSTAR_KEY_VALUES));
log.info("Instar data already exsits : " + instarKeyValues.toString());
- }
- else
+ } else {
instarKeyValues = new JSONObject();
- JSONArray instarResponses = new JSONObject(instarResponse).getJSONArray(InstarClientConstant.INSTAR_RESPONSE_BLOCK_NAME);
- for (int i = 0; i < instarResponses.length(); i++){
+ }
+ JSONArray instarResponses = new JSONObject(instarResponse)
+ .getJSONArray(InstarClientConstant.INSTAR_RESPONSE_BLOCK_NAME);
+ for (int i = 0; i < instarResponses.length(); i++) {
JSONObject res = instarResponses.getJSONObject(i);
- log.info(fn + "Instar Block :" + i + " Values :" + res.toString());
- log.info(fn + "Appc Filter Key :" + ctxt.getAttribute(InstarClientConstant.VNF_NAME) + resKey.getUniqueKeyValue());
+ log.info(fn + "Instar Block :" + i + " Values :" + res.toString());
+ log.info(fn + "Appc Filter Key :" + ctxt.getAttribute(InstarClientConstant.VNF_NAME) + resKey
+ .getUniqueKeyValue());
- if(res.getString(InstarClientConstant.FDQN) != null &&
- res.getString(InstarClientConstant.FDQN).equalsIgnoreCase(ctxt.getAttribute(InstarClientConstant.VNF_NAME) + resKey.getUniqueKeyValue())) {
- if(resKey.getFieldKeyName().equals(InstarClientConstant.V4_ADDRESS)) {
- instarKeyValues.put(instarKey, res.getString(InstarClientConstant.INSTAR_V4_ADDRESS));
- }
- else if (resKey.getFieldKeyName().equals(InstarClientConstant.INSTAR_V4_SUBNET)) {
- instarKeyValues.put(instarKey, res.getString(InstarClientConstant.INSTAR_V4_SUBNET) );
- }
- else if (resKey.getFieldKeyName().equals(InstarClientConstant.INSTAR_V4_DEFAULT_GATEWAY)) {
- instarKeyValues.put(instarKey, res.getString(InstarClientConstant.INSTAR_V4_DEFAULT_GATEWAY));
- }
- else if(resKey.getFieldKeyName().equals(InstarClientConstant.V6_ADDRESS)) {
- instarKeyValues.put(instarKey, res.getString(InstarClientConstant.INSTAR_V6_ADDRESS));
- }
- else if (resKey.getFieldKeyName().equals(InstarClientConstant.INSTAR_V6_SUBNET)) {
- instarKeyValues.put(instarKey, res.getString(InstarClientConstant.INSTAR_V6_SUBNET) );
- }
- else if (resKey.getFieldKeyName().equals(InstarClientConstant.INSTAR_V6_DEFAULT_GATEWAY)) {
- instarKeyValues.put(instarKey, res.getString(InstarClientConstant.INSTAR_V6_DEFAULT_GATEWAY));
- }
- break;
+ if (res.getString(InstarClientConstant.FDQN) != null &&
+ res.getString(InstarClientConstant.FDQN)
+ .equalsIgnoreCase(ctxt.getAttribute(InstarClientConstant.VNF_NAME) + resKey.getUniqueKeyValue())) {
+ if (resKey.getFieldKeyName().equals(InstarClientConstant.V4_ADDRESS)) {
+ instarKeyValues.put(instarKey, res.getString(InstarClientConstant.INSTAR_V4_ADDRESS));
+ } else if (resKey.getFieldKeyName().equals(InstarClientConstant.INSTAR_V4_SUBNET)) {
+ instarKeyValues.put(instarKey, res.getString(InstarClientConstant.INSTAR_V4_SUBNET));
+ } else if (resKey.getFieldKeyName().equals(InstarClientConstant.INSTAR_V4_DEFAULT_GATEWAY)) {
+ instarKeyValues.put(instarKey, res.getString(InstarClientConstant.INSTAR_V4_DEFAULT_GATEWAY));
+ } else if (resKey.getFieldKeyName().equals(InstarClientConstant.V6_ADDRESS)) {
+ instarKeyValues.put(instarKey, res.getString(InstarClientConstant.INSTAR_V6_ADDRESS));
+ } else if (resKey.getFieldKeyName().equals(InstarClientConstant.INSTAR_V6_SUBNET)) {
+ instarKeyValues.put(instarKey, res.getString(InstarClientConstant.INSTAR_V6_SUBNET));
+ } else if (resKey.getFieldKeyName().equals(InstarClientConstant.INSTAR_V6_DEFAULT_GATEWAY)) {
+ instarKeyValues.put(instarKey, res.getString(InstarClientConstant.INSTAR_V6_DEFAULT_GATEWAY));
+ }
+ break;
}
}
log.info(fn + "Instar KeyValues :" + instarKeyValues);
ctxt.setAttribute(InstarClientConstant.INSTAR_KEY_VALUES, instarKeyValues.toString());
-
return instarKeyValues;
}
-
}
diff --git a/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/interfaceImpl/InstarRestClientImpl.java b/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/interfaceImpl/InstarRestClientImpl.java
index bb0786be5..bb4656772 100644
--- a/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/interfaceImpl/InstarRestClientImpl.java
+++ b/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/interfaceImpl/InstarRestClientImpl.java
@@ -24,45 +24,42 @@
package org.onap.appc.instar.interfaceImpl;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import java.util.HashMap;
-
import org.onap.appc.instar.dme2client.Dme2Client;
import org.onap.appc.instar.interfaces.RestClientInterface;
import org.onap.appc.instar.utils.InstarClientConstant;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
public class InstarRestClientImpl implements RestClientInterface {
-
- private static final EELFLogger log = EELFManager.getInstance().getLogger(InstarRestClientImpl.class);
- HashMap<String, String> requestData = null;
- Dme2Client dme2Client;
- public InstarRestClientImpl(HashMap<String, String> instarRequestData) {
-
- this.requestData = instarRequestData;
- }
+ private static final EELFLogger log = EELFManager.getInstance().getLogger(InstarRestClientImpl.class);
+ HashMap<String, String> requestData = null;
+ Dme2Client dme2Client;
- @Override
- public String sendRequest(String operation) throws Exception {
-
- String instarResponse = null;
- try {
- if(operation !=null && operation.equalsIgnoreCase(InstarClientConstant.OPERATION_GET_IPADDRESS_BY_VNF_NAME)){
- dme2Client = new Dme2Client(operation, InstarClientConstant.VNF_NAME, requestData);
- }
- instarResponse = dme2Client.send();
- log.info("Resposne in InstarRestClientImpl = " + instarResponse);
- if(instarResponse == null || instarResponse.length() < 0)
- throw new Exception ("No Data received from Instar for this call " + operation);
- } catch (Exception e) {
- e.printStackTrace();
- throw e;
- }
- return instarResponse;
- }
+ public InstarRestClientImpl(HashMap<String, String> instarRequestData) {
+ this.requestData = instarRequestData;
+ }
+ @Override
+ public String sendRequest(String operation) throws Exception {
+ String instarResponse = null;
+ try {
+ if (operation != null && operation
+ .equalsIgnoreCase(InstarClientConstant.OPERATION_GET_IPADDRESS_BY_VNF_NAME)) {
+ dme2Client = new Dme2Client(operation, InstarClientConstant.VNF_NAME, requestData);
+ }
+ instarResponse = dme2Client.send();
+ log.info("Resposne in InstarRestClientImpl = " + instarResponse);
+ if (instarResponse == null || instarResponse.length() < 0) {
+ throw new Exception("No Data received from Instar for this call " + operation);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw e;
+ }
+ return instarResponse;
+ }
}
diff --git a/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/interfaceImpl/InterfaceIpAddressImpl.java b/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/interfaceImpl/InterfaceIpAddressImpl.java
index 5014059fc..bef613fa2 100644
--- a/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/interfaceImpl/InterfaceIpAddressImpl.java
+++ b/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/interfaceImpl/InterfaceIpAddressImpl.java
@@ -24,68 +24,63 @@
package org.onap.appc.instar.interfaceImpl;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import java.util.HashMap;
import java.util.List;
-
import org.onap.appc.instar.interfaces.ResponseHandlerInterface;
import org.onap.appc.instar.interfaces.RestClientInterface;
import org.onap.appc.instar.interfaces.RuleHandlerInterface;
-import org.onap.appc.instar.node.InstarClientNode;
import org.onap.appc.instar.utils.InstarClientConstant;
+import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.sdnc.config.params.data.Parameter;
import org.onap.sdnc.config.params.data.ResponseKey;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
public class InterfaceIpAddressImpl implements RuleHandlerInterface {
- private static final EELFLogger log = EELFManager.getInstance().getLogger(InterfaceIpAddressImpl.class);
- private Parameter parameters;
- private SvcLogicContext context;
+ private static final EELFLogger log = EELFManager.getInstance().getLogger(InterfaceIpAddressImpl.class);
+ private Parameter parameters;
+ private SvcLogicContext context;
+
+ public InterfaceIpAddressImpl(Parameter params, SvcLogicContext ctx) {
+ this.parameters = params;
+ this.context = ctx;
+ }
+
+ @Override
+ public void processRule() throws Exception {
- public InterfaceIpAddressImpl(Parameter params, SvcLogicContext ctx) {
- this.parameters = params;
- this.context = ctx;
- }
+ String fn = "InterfaceIpAddressHandler.processRule";
+ log.info(fn + "Processing rule :" + parameters.getRuleType());
+ String operationName;
- @Override
- public void processRule() throws Exception {
+ RestClientInterface restClient = null;
+ ResponseHandlerInterface responseHandler = null;
- String fn = "InterfaceIpAddressHandler.processRule";
- log.info(fn + "Processing rule :" + parameters.getRuleType());
- String operationName ;
-
- RestClientInterface restClient = null;
- ResponseHandlerInterface responseHandler = null;
+ List<ResponseKey> responseKeyList = parameters.getResponseKeys();
+ if (responseKeyList != null && responseKeyList.size() > 0) {
+ for (ResponseKey filterKeys : responseKeyList) {
+ //response.setUniqueKeyValue(response.getUniqueKeyValue()+ context.getAttribute(InstarClientConstant.VNF_NAME));
+ switch (parameters.getSource()) {
+ case InstarClientConstant.SOURCE_SYSTEM_INSTAR:
+ restClient = new InstarRestClientImpl(createInstarRequestData(context));
+ responseHandler = new InstarResponseHandlerImpl(filterKeys, context);
+ operationName = "getIpAddressByVnf";
+ break;
+ default:
+ throw new Exception("No Client registered for : " + parameters.getSource());
- List<ResponseKey> responseKeyList = parameters.getResponseKeys();
- if(responseKeyList != null && responseKeyList.size() > 0){
- for(ResponseKey filterKeys : responseKeyList){
- //response.setUniqueKeyValue(response.getUniqueKeyValue()+ context.getAttribute(InstarClientConstant.VNF_NAME));
- switch(parameters.getSource()){
- case InstarClientConstant.SOURCE_SYSTEM_INSTAR:
- restClient = new InstarRestClientImpl(createInstarRequestData(context));
- responseHandler = new InstarResponseHandlerImpl(filterKeys, context );
- operationName = "getIpAddressByVnf";
- break;
- default:
- throw new Exception("No Client registered for : " + parameters.getSource());
-
- }
- responseHandler.processResponse(restClient.sendRequest(operationName),parameters.getName() );
- }
- }
- else
- {
- throw new Exception("NO response Keys set for : " + parameters.getRuleType());
- }
- }
+ }
+ responseHandler.processResponse(restClient.sendRequest(operationName), parameters.getName());
+ }
+ } else {
+ throw new Exception("NO response Keys set for : " + parameters.getRuleType());
+ }
+ }
- private HashMap<String, String> createInstarRequestData(SvcLogicContext ctxt) {
- HashMap<String, String> requestParams = new HashMap<String, String>();
- requestParams.put(InstarClientConstant.VNF_NAME, ctxt.getAttribute(InstarClientConstant.VNF_NAME));
- return requestParams;
- }
+ private HashMap<String, String> createInstarRequestData(SvcLogicContext ctxt) {
+ HashMap<String, String> requestParams = new HashMap<String, String>();
+ requestParams.put(InstarClientConstant.VNF_NAME, ctxt.getAttribute(InstarClientConstant.VNF_NAME));
+ return requestParams;
+ }
}
diff --git a/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/interfaces/ResponseHandlerInterface.java b/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/interfaces/ResponseHandlerInterface.java
index 8211967b0..52323c223 100644
--- a/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/interfaces/ResponseHandlerInterface.java
+++ b/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/interfaces/ResponseHandlerInterface.java
@@ -26,6 +26,5 @@ package org.onap.appc.instar.interfaces;
public interface ResponseHandlerInterface {
- public Object processResponse(String response, String instarKey);
-
+ public Object processResponse(String response, String instarKey);
}
diff --git a/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/interfaces/RestClientInterface.java b/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/interfaces/RestClientInterface.java
index bf6c5b34d..37c8dbeb4 100644
--- a/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/interfaces/RestClientInterface.java
+++ b/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/interfaces/RestClientInterface.java
@@ -26,7 +26,5 @@ package org.onap.appc.instar.interfaces;
public interface RestClientInterface {
-
- public String sendRequest(String operation) throws Exception;
-
+ public String sendRequest(String operation) throws Exception;
}
diff --git a/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/interfaces/RuleHandlerInterface.java b/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/interfaces/RuleHandlerInterface.java
index 86f31d2fa..4d75ff44d 100644
--- a/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/interfaces/RuleHandlerInterface.java
+++ b/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/interfaces/RuleHandlerInterface.java
@@ -27,6 +27,5 @@ package org.onap.appc.instar.interfaces;
public interface RuleHandlerInterface {
- public void processRule() throws Exception;
-
+ public void processRule() throws Exception;
}
diff --git a/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/utils/InstarClientConstant.java b/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/utils/InstarClientConstant.java
index 800bbe28f..4fbe023f6 100644
--- a/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/utils/InstarClientConstant.java
+++ b/appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/utils/InstarClientConstant.java
@@ -24,8 +24,8 @@
package org.onap.appc.instar.utils;
-public class InstarClientConstant
-{
+public class InstarClientConstant {
+
public static String INPUT_PARAM_RESPONSE_PRIFIX = "responsePrefix";
public static String OUTPUT_PARAM_STATUS = "status";
public static String OUTPUT_PARAM_ERROR_MESSAGE = "error-message";
@@ -33,7 +33,6 @@ public class InstarClientConstant
public static String OUTPUT_STATUS_FAILURE = "failure";
public static final String INSTAR_KEYS = "instarKeys";
-
public static final String INTERFACE_IP_ADDRESS = "interface-ip-address";
public static final String SOURCE_SYSTEM_INSTAR = "INSTAR";
public static final String VNF_TYPE = "vnf-type";
@@ -43,42 +42,40 @@ public class InstarClientConstant
public static final String INSTAR_RESPONSE_BLOCK_NAME = "vnfConfigurationParameterDetails";
public static final String FDQN = "fqdn";
+ public static final String MOCK_INSTAR = "mock_instar";
+ public static final String AFT_LATITUDE = "aft_latitude";
+ public static final String AFT_LONGITUDE = "aft_latitude";
+ public static final String AFT_ENVIRONMENT = "aft_environment";
+ public static final String SCLD_PLATFORM = "scld_platform";
+ public static final String AUTHORIZATION = "authorization";
+ public static final String DME2_CLIENT_TIMEOUTMS = "dme2_client_timeoutms";
+ public static final String DME2_CLIENT_SENDANDWAIT = "dme2_client_sendandwait";
+ public static final String BASE_URL = "_base_url";
+ public static final String HTTP_HEADERS = "_http_headers";
- public static final String MOCK_INSTAR="mock_instar";
- public static final String AFT_LATITUDE="aft_latitude";
- public static final String AFT_LONGITUDE="aft_latitude";
- public static final String AFT_ENVIRONMENT="aft_environment";
- public static final String SCLD_PLATFORM="scld_platform";
- public static final String AUTHORIZATION="authorization";
- public static final String DME2_CLIENT_TIMEOUTMS="dme2_client_timeoutms";
- public static final String DME2_CLIENT_SENDANDWAIT="dme2_client_sendandwait";
- public static final String BASE_URL="_base_url";
- public static final String HTTP_HEADERS="_http_headers";
+ public static final String V6_ADDRESS = "ipaddress-v6";
+ public static final String INSTAR_V6_ADDRESS = "v6IPAddress";
+ public static final String INSTAR_V6_SUBNET = "v6Subnet";
+ public static final String INSTAR_V6_DEFAULT_GATEWAY = "v6DefaultGateway";
- public static final String V6_ADDRESS="ipaddress-v6";
- public static final String INSTAR_V6_ADDRESS="v6IPAddress";
- public static final String INSTAR_V6_SUBNET="v6Subnet";
- public static final String INSTAR_V6_DEFAULT_GATEWAY="v6DefaultGateway";
-
- public static final String V4_ADDRESS="ipaddress-v4";
- public static final String INSTAR_V4_ADDRESS="v4IPAddress";
- public static final String INSTAR_V4_SUBNET="v4Subnet";
- public static final String INSTAR_V4_DEFAULT_GATEWAY="v4DefaultGateway";
- public static final String SUB_CONTEXT_BYIPADDRESS="_sub_context_byipaddress";
- public static final String SUB_CONTEXT_BYMASK="_sub_context_bymask";
- public static final String SUB_CONTEXT="_sub_context";
- public static final String URL_SUFFIX="_suffix";
- public static final String VERSION="_version";
- public static final String ENV_CONTEXT="_env_context";
- public static final String ROUTEOFFER="_routeoffer";
+ public static final String V4_ADDRESS = "ipaddress-v4";
+ public static final String INSTAR_V4_ADDRESS = "v4IPAddress";
+ public static final String INSTAR_V4_SUBNET = "v4Subnet";
+ public static final String INSTAR_V4_DEFAULT_GATEWAY = "v4DefaultGateway";
+ public static final String SUB_CONTEXT_BYIPADDRESS = "_sub_context_byipaddress";
+ public static final String SUB_CONTEXT_BYMASK = "_sub_context_bymask";
+ public static final String SUB_CONTEXT = "_sub_context";
+ public static final String URL_SUFFIX = "_suffix";
+ public static final String VERSION = "_version";
+ public static final String ENV_CONTEXT = "_env_context";
+ public static final String ROUTEOFFER = "_routeoffer";
public static final String APPC_PROPERTIES = "appc.properties";
- public static final String METHOD="_method";
+ public static final String METHOD = "_method";
public static final String OPERATION_GET_IPADDRESS_BY_VNF_NAME = "getIpAddressByVnf";
- public static final String OUTBOUND_PROPERTIES= "/outbound.properties";
+ public static final String OUTBOUND_PROPERTIES = "/outbound.properties";
public static String CONTENT_TYPE = "application/json";
public static String RETURNED_RESPONSE_TYPE = "application/json";
-
}