aboutsummaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
authorseshukm <seshu.kumar.m@huawei.com>2017-09-18 12:58:10 +0530
committerseshukm <seshu.kumar.m@huawei.com>2017-09-18 12:58:10 +0530
commit043f000141590ef5c5944b6d717c7a592df69c47 (patch)
tree32a29bf25d81be8e5c08ce793d395ff2a9f43a3e /adapters
parent5e2aa1fec3c51e8eb0e6b43285c8414105a51b2f (diff)
Fixed issues in adapter package
Issue-Id: SO-141 Change-Id: I1a6905aa7e1328e47b3d0f7580a1dca33c6a069c Signed-off-by: seshukm <seshu.kumar.m@huawei.com>
Diffstat (limited to 'adapters')
-rw-r--r--adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/BpelRestClient.java7
-rw-r--r--adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterAsyncImpl.java28
-rw-r--r--adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterImpl.java55
-rw-r--r--adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/NetworkAdapterRest.java35
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCRestClient.java16
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/notify/SDNCNotifyResource.java7
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/BPRestCallback.java5
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterUtils.java20
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java23
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCEventParser.java19
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java8
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java20
-rw-r--r--adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsyncImpl.java55
13 files changed, 169 insertions, 129 deletions
diff --git a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/BpelRestClient.java b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/BpelRestClient.java
index 83cadb8878..b7ab5043f3 100644
--- a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/BpelRestClient.java
+++ b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/BpelRestClient.java
@@ -143,9 +143,10 @@ public class BpelRestClient {
}
public void setRetryCount(int retryCount) {
+ int retCnt = 0;
if (retryCount < 0)
- retryCount = DEFAULT_RETRY_COUNT;
- this.retryCount = retryCount;
+ retCnt = DEFAULT_RETRY_COUNT;
+ this.retryCount = retCnt;
}
public int getRetryInterval() {
@@ -172,7 +173,7 @@ public class BpelRestClient {
}
public void setRetryList(String retryList) {
- Set<Integer> s = new TreeSet<Integer>();
+ Set<Integer> s = new TreeSet<>();
for (String t : retryList.split("[, ]")) {
try {
s.add(Integer.parseInt(t));
diff --git a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterAsyncImpl.java b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterAsyncImpl.java
index 0878bc54c9..74c39af68a 100644
--- a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterAsyncImpl.java
+++ b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterAsyncImpl.java
@@ -3,6 +3,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.
@@ -131,10 +132,10 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
MsoNetworkAdapter networkAdapter = new MsoNetworkAdapterImpl (msoPropertiesFactory,cloudConfigFactory);
// Synchronous Web Service Outputs
- Holder <String> networkId = new Holder <String> ();
- Holder <String> neutronNetworkId = new Holder <String> ();
- Holder <NetworkRollback> networkRollback = new Holder <NetworkRollback> ();
- Holder <Map <String, String>> subnetIdMap = new Holder <Map <String, String>> ();
+ Holder <String> networkId = new Holder <> ();
+ Holder <String> neutronNetworkId = new Holder <> ();
+ Holder <NetworkRollback> networkRollback = new Holder <> ();
+ Holder <Map <String, String>> subnetIdMap = new Holder <> ();
try {
networkAdapter.createNetwork (cloudSiteId,
@@ -423,8 +424,6 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
MsoRequest msoRequest,
String notificationUrl) {
String error;
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis ();
MsoLogger.setLogContext (msoRequest);
String serviceName = "DeleteNetworkA";
MsoLogger.setServiceName (serviceName);
@@ -434,7 +433,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
MsoNetworkAdapter networkAdapter = new MsoNetworkAdapterImpl (msoPropertiesFactory,cloudConfigFactory);
// Synchronous Web Service Outputs
- Holder <Boolean> networkDeleted = new Holder <Boolean> ();
+ Holder <Boolean> networkDeleted = new Holder <> ();
try {
networkAdapter.deleteNetwork (cloudSiteId, tenantId, networkType, modelCustomizationUuid, networkId, msoRequest, networkDeleted);
@@ -488,8 +487,6 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
String error;
String serviceName = "RollbackNetworkA";
MsoLogger.setServiceName (serviceName);
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis ();
// rollback may be null (e.g. if network already existed when Create was called)
if (rollback == null) {
LOGGER.warn (MessageEnum.RA_ROLLBACK_NULL, "", "", MsoLogger.ErrorCode.SchemaError, "Rollback is null");
@@ -602,13 +599,16 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
if(null != epUrl) {
LOGGER.debug ("Notification Endpoint URL: " + epUrl.toExternalForm ());
+ bp.getRequestContext ().put (BindingProvider.ENDPOINT_ADDRESS_PROPERTY, epUrl.toExternalForm ());
+ }
+ else {
+ LOGGER.debug ("Notification Endpoint URL is NULL: ");
}
- bp.getRequestContext ().put (BindingProvider.ENDPOINT_ADDRESS_PROPERTY, epUrl.toExternalForm ());
// authentication
try {
Map <String, Object> reqCtx = bp.getRequestContext ();
- Map <String, List <String>> headers = new HashMap <String, List <String>> ();
+ Map <String, List <String>> headers = new HashMap <> ();
String userCredentials = msoPropertiesFactory.getMsoJavaProperties (MSO_PROP_NETWORK_ADAPTER).getEncryptedProperty (BPEL_AUTH_PROP,
"",
@@ -631,7 +631,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
CreateNetworkNotification.SubnetIdMap subnetIdMap = new CreateNetworkNotification.SubnetIdMap ();
if (hMap != null && hMap.value != null) {
- Map <String, String> sMap = new HashMap <String, String> ();
+ Map <String, String> sMap = new HashMap <> ();
sMap = hMap.value;
CreateNetworkNotification.SubnetIdMap.Entry entry = new CreateNetworkNotification.SubnetIdMap.Entry ();
@@ -649,7 +649,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
UpdateNetworkNotification.SubnetIdMap subnetIdMap = new UpdateNetworkNotification.SubnetIdMap ();
if (hMap != null && hMap.value != null) {
- Map <String, String> sMap = new HashMap <String, String> ();
+ Map <String, String> sMap = new HashMap <> ();
sMap = hMap.value;
UpdateNetworkNotification.SubnetIdMap.Entry entry = new UpdateNetworkNotification.SubnetIdMap.Entry ();
@@ -667,7 +667,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
QueryNetworkNotification.SubnetIdMap subnetIdMap = new QueryNetworkNotification.SubnetIdMap ();
if (hMap != null && hMap.value != null) {
- Map <String, String> sMap = new HashMap <String, String> ();
+ Map <String, String> sMap = new HashMap <> ();
sMap = hMap.value;
QueryNetworkNotification.SubnetIdMap.Entry entry = new QueryNetworkNotification.SubnetIdMap.Entry ();
diff --git a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterImpl.java
index cf61d9af73..ccac38a58c 100644
--- a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterImpl.java
+++ b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterImpl.java
@@ -3,6 +3,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.
@@ -127,7 +128,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
Holder <String> neutronNetworkId,
Holder <Map <String, String>> subnetIdMap,
Holder <NetworkRollback> rollback) throws NetworkException {
- Holder <String> networkFqdn = new Holder <String> ();
+ Holder <String> networkFqdn = new Holder <> ();
createNetwork (cloudSiteId,
tenantId,
networkType,
@@ -315,13 +316,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
LOGGER.recordMetricEvent (queryNetworkStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Response successfully received from OpenStack", "OpenStack", "QueryNetwork", null);
} catch (MsoException me) {
LOGGER.recordMetricEvent (queryNetworkStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while querying network from OpenStack", "OpenStack", "QueryNetwork", null);
- String error = "Create Network (neutron): query network " + networkName
- + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + me;
LOGGER.error (MessageEnum.RA_QUERY_NETWORK_EXC, networkName, cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception while querying network from OpenStack", me);
me.addContext (CREATE_NETWORK_CONTEXT);
LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while querying network from OpenStack");
@@ -472,7 +466,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
networkFqdn.value = (String) heatStack.getOutputs().get(NETWORK_FQDN);
}
Map <String, Object> outputs = heatStack.getOutputs ();
- Map <String, String> sMap = new HashMap <String, String> ();
+ Map <String, String> sMap = new HashMap <> ();
if (outputs != null) {
for (String key : outputs.keySet ()) {
if (key != null && key.startsWith ("subnet")) {
@@ -490,7 +484,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
}
subnetIdMap.value = sMap;
- String msg = "Found Existing network stack, status=" + heatStack.getStatus () + " for Heat mode";
LOGGER.warn (MessageEnum.RA_NETWORK_ALREADY_EXIST, networkName, cloudSiteId, tenantId, "", "", MsoLogger.ErrorCode.DataError, "Found Existing network stack, status=" + heatStack.getStatus ());
LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Suc, "Found Existing network stack");
}
@@ -588,7 +581,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// Deploy the network stack
// Ignore MsoStackAlreadyExists exception because we already checked.
- long createStackStartTime = System.currentTimeMillis ();
try {
if (backout == null)
backout = true;
@@ -628,7 +620,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
networkFqdn.value = (String) heatStack.getOutputs().get(NETWORK_FQDN);
}
Map <String, Object> outputs = heatStack.getOutputs ();
- Map <String, String> sMap = new HashMap <String, String> ();
+ Map <String, String> sMap = new HashMap <> ();
if (outputs != null) {
for (String key : outputs.keySet ()) {
if (key != null && key.startsWith ("subnet")) {
@@ -943,7 +935,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
String previousNetworkName = (String) heatParams.get("network_name");
String previousPhysicalNetwork = (String) heatParams.get(PHYSICAL_NETWORK);
- List<Integer> previousVlans = new ArrayList<Integer>();
+ List<Integer> previousVlans = new ArrayList<>();
String vlansParam = (String) heatParams.get(VLANS);
if (vlansParam != null) {
for (String vlan : vlansParam.split(",")) {
@@ -1087,7 +1079,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
Map<String, Object> outputs = heatStack.getOutputs();
- Map<String, String> sMap = new HashMap<String, String>();
+ Map<String, String> sMap = new HashMap<>();
if (outputs != null) {
for (String key : outputs.keySet()) {
if (key != null && key.startsWith("subnet")) {
@@ -1108,7 +1100,12 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// Reach this point if createStack is successful.
// Populate remaining rollback info and response parameters.
networkRollback.setNetworkStackId(heatStack.getCanonicalName());
- networkRollback.setNeutronNetworkId((String) outputs.get(NETWORK_ID));
+ if(null != outputs) {
+ networkRollback.setNeutronNetworkId((String) outputs.get(NETWORK_ID));
+ }
+ else {
+ LOGGER.debug("outputs is NULL");
+ }
networkRollback.setNetworkType(networkType);
// Save previous parameters
networkRollback.setNetworkName(previousNetworkName);
@@ -1332,8 +1329,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
MsoHeatUtils heat = new MsoHeatUtils (MSO_PROP_NETWORK_ADAPTER,msoPropertiesFactory,cloudConfigFactory);
MsoNeutronUtils neutron = new MsoNeutronUtils (MSO_PROP_NETWORK_ADAPTER, cloudConfigFactory);
- String mode = null;
- String neutronId = null;
+ String mode;
+ String neutronId;
// Try Heat first, since networks may be named the same as the Heat stack
StackInfo heatStack = null;
long queryStackStarttime = System.currentTimeMillis ();
@@ -1362,7 +1359,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
neutronId = (String) outputs.get (NETWORK_ID);
mode = "HEAT";
- Map <String, String> sMap = new HashMap <String, String> ();
+ Map <String, String> sMap = new HashMap <> ();
if (outputs != null) {
for (String key : outputs.keySet ()) {
if (key != null && key.startsWith ("subnet_id_")) //multiples subnet_%aaid% outputs
@@ -1726,7 +1723,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
String external,
boolean aic3template) {
// Build the common set of HEAT template parameters
- Map <String, Object> stackParams = new HashMap <String, Object> ();
+ Map <String, Object> stackParams = new HashMap <> ();
stackParams.put ("network_name", networkName);
if (neutronNetworkType == NetworkType.PROVIDER) {
@@ -1758,9 +1755,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
if (!isNullOrEmpty(rt))
{
if (aic3template)
- buf.append (sep).append ("target:" + rt.toString ());
+ buf.append (sep).append ("target:" + rt);
else
- buf.append (sep).append (rt.toString ());
+ buf.append (sep).append (rt);
sep = ",";
}
@@ -1802,7 +1799,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
**/
private void mergePolicyRefs(List <String> pFqdns, Map <String, Object> stackParams) throws MsoException {
//Resource Property
- List<ContrailPolicyRef> prlist = new ArrayList <ContrailPolicyRef> ();
+ List<ContrailPolicyRef> prlist = new ArrayList <> ();
int index = 1;
for (String pf : pFqdns) {
if (!isNullOrEmpty(pf))
@@ -1837,7 +1834,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
for (String pf : pFqdns) {
if (!isNullOrEmpty(pf))
{
- buf.append (sep).append (pf.toString ());
+ buf.append (sep).append (pf);
sep = ",";
}
}
@@ -1860,7 +1857,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
for (String rtf : rtFqdns) {
if (!isNullOrEmpty(rtf))
{
- buf.append (sep).append (rtf.toString ());
+ buf.append (sep).append (rtf);
sep = ",";
}
}
@@ -1929,7 +1926,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
private String mergeSubnetsAIC3 (String heatTemplate, List <Subnet> subnets, Map <String, Object> stackParams) throws MsoException {
//Resource Property
- List<ContrailSubnet> cslist = new ArrayList <ContrailSubnet> ();
+ List<ContrailSubnet> cslist = new ArrayList <> ();
for (Subnet subnet : subnets) {
ContrailSubnet cs = new ContrailSubnet();
LOGGER.debug("Input Subnet:" + subnet.toString());
@@ -1990,8 +1987,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
String outputTempl = " subnet_id_%subnetId%:\n" + " description: Openstack subnet identifier\n"
+ " value: {get_resource: subnet_%subnetId%}\n";
- String curR = "";
- String curO = "";
+ String curR;
+ String curO;
StringBuilder resourcesBuf = new StringBuilder ();
StringBuilder outputsBuf = new StringBuilder ();
for (Subnet subnet : subnets) {
@@ -2063,7 +2060,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
private Map <String, String> getSubnetUUId(String key, Map <String, Object> outputs, List <Subnet> subnets) {
- Map <String, String> sMap = new HashMap <String, String> ();
+ Map <String, String> sMap = new HashMap <> ();
try{
Object obj = outputs.get(key);
@@ -2107,7 +2104,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
private static String insertStr (String template, String snippet, int index) {
- String updatedTemplate = "";
+ String updatedTemplate;
LOGGER.debug ("Index:" + index + " Snippet:" + snippet);
diff --git a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/NetworkAdapterRest.java b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/NetworkAdapterRest.java
index b90bfdf9d6..7c775eeb88 100644
--- a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/NetworkAdapterRest.java
+++ b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/NetworkAdapterRest.java
@@ -3,6 +3,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.
@@ -135,11 +136,11 @@ public class NetworkAdapterRest {
LOGGER.debug ("CreateNetworkTask start");
try {
// Synchronous Web Service Outputs
- Holder<String> networkId = new Holder<String>();
- Holder<String> neutronNetworkId = new Holder<String>();
- Holder<String> networkFqdn = new Holder<String>();
- Holder<Map<String, String>> subnetIdMap = new Holder<Map<String, String>>();
- Holder<NetworkRollback> rollback = new Holder<NetworkRollback>();
+ Holder<String> networkId = new Holder<>();
+ Holder<String> neutronNetworkId = new Holder<>();
+ Holder<String> networkFqdn = new Holder<>();
+ Holder<Map<String, String>> subnetIdMap = new Holder<>();
+ Holder<NetworkRollback> rollback = new Holder<>();
String cloudsite = req.getCloudSiteId();
if (cloudsite != null && cloudsite.equals(TESTING_KEYWORD)) {
@@ -211,6 +212,7 @@ public class NetworkAdapterRest {
rollback.value,
req.getMessageId());
} catch (NetworkException e) {
+ LOGGER.debug ("Exception:", e);
eresp = new CreateNetworkError(
e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId());
}
@@ -292,7 +294,7 @@ public class NetworkAdapterRest {
public void run() {
LOGGER.debug("DeleteNetworkTask start");
try {
- Holder<Boolean> networkDeleted = new Holder<Boolean>();
+ Holder<Boolean> networkDeleted = new Holder<>();
if (req.getCloudSiteId().equals(TESTING_KEYWORD)) {
networkDeleted.value = true;
} else {
@@ -307,6 +309,7 @@ public class NetworkAdapterRest {
}
response = new DeleteNetworkResponse(req.getNetworkId(), networkDeleted.value, req.getMessageId());
} catch (NetworkException e) {
+ LOGGER.debug ("Exception:", e);
eresp = new DeleteNetworkError(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId());
}
if (!req.isSynchronous()) {
@@ -337,12 +340,12 @@ public class NetworkAdapterRest {
try {
int respStatus = HttpStatus.SC_OK;
QueryNetworkResponse resp = new QueryNetworkResponse(networkStackId, null, networkStackId, null, null);
- Holder<Boolean> networkExists = new Holder<Boolean>();
- Holder<String> networkId = new Holder<String>();
- Holder<String> neutronNetworkId = new Holder<String>();
- Holder<NetworkStatus> status = new Holder<NetworkStatus>();
- Holder<List<String>> routeTargets = new Holder<List<String>>();
- Holder<Map<String, String>> subnetIdMap = new Holder<Map<String, String>>();
+ Holder<Boolean> networkExists = new Holder<>();
+ Holder<String> networkId = new Holder<>();
+ Holder<String> neutronNetworkId = new Holder<>();
+ Holder<NetworkStatus> status = new Holder<>();
+ Holder<List<String>> routeTargets = new Holder<>();
+ Holder<Map<String, String>> subnetIdMap = new Holder<>();
adapter.queryNetworkContrail(cloudSiteId, tenantId, aaiNetworkId, msoRequest,
networkExists, networkId, neutronNetworkId, status, routeTargets, subnetIdMap);
@@ -441,6 +444,7 @@ public class NetworkAdapterRest {
adapter.rollbackNetwork(nwr);
response = new RollbackNetworkResponse(true, req.getMessageId());
} catch (NetworkException e) {
+ LOGGER.debug ("Exception:", e);
eresp = new RollbackNetworkError(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId());
}
if (!req.isSynchronous()) {
@@ -521,8 +525,8 @@ public class NetworkAdapterRest {
public void run() {
LOGGER.debug("UpdateNetworkTask start");
try {
- Holder<Map<String, String>> subnetIdMap = new Holder<Map<String, String>>();
- Holder<NetworkRollback> rollback = new Holder<NetworkRollback> ();
+ Holder<Map<String, String>> subnetIdMap = new Holder<>();
+ Holder<NetworkRollback> rollback = new Holder<> ();
if (req.getCloudSiteId().equals(TESTING_KEYWORD)) {
subnetIdMap.value = testMap();
@@ -579,6 +583,7 @@ public class NetworkAdapterRest {
subnetIdMap.value,
req.getMessageId());
} catch (NetworkException e) {
+ LOGGER.debug ("Exception:", e);
eresp = new UpdateNetworkError(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId());
}
if (!req.isSynchronous()) {
@@ -591,7 +596,7 @@ public class NetworkAdapterRest {
}
public static Map<String, String> testMap() {
- Map<String, String> m = new HashMap<String, String>();
+ Map<String, String> m = new HashMap<>();
m.put("mickey", "7");
m.put("clyde", "10");
m.put("wayne", "99");
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCRestClient.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCRestClient.java
index 28f5403afd..757ea8207d 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCRestClient.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCRestClient.java
@@ -3,6 +3,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.
@@ -271,7 +272,7 @@ public class SDNCRestClient implements Runnable {
msoLogger.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with SDNC", e);
alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, respMsg);
- return(sdncResp);
+ return sdncResp;
}
finally
{
@@ -308,18 +309,23 @@ public class SDNCRestClient implements Runnable {
SDNCCallbackAdapterPortType cbPort = cbSvc.getSDNCCallbackAdapterSoapHttpPort();
BindingProvider bp = (BindingProvider)cbPort;
-
+
+ if(null != wsdlUrl) {
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, wsdlUrl.toExternalForm());
+ }
+ else {
+ msoLogger.debug("wsdlUrl is NULL:");
+ }
//authentication
try
{
- Map<String, Object> req_ctx = bp.getRequestContext();
- Map<String, List<String>> headers = new HashMap<String, List<String>>();
+ Map<String, Object> reqCtx = bp.getRequestContext();
+ Map<String, List<String>> headers = new HashMap<>();
String userCredentials = msoPropertiesFactoryp.getMsoJavaProperties(MSO_PROP_SDNC_ADAPTER).getEncryptedProperty(Constants.BPEL_AUTH_PROP, Constants.DEFAULT_BPEL_AUTH, Constants.ENCRYPTION_KEY);
String basicAuth = "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes());
- req_ctx.put(MessageContext.HTTP_REQUEST_HEADERS, headers);
+ reqCtx.put(MessageContext.HTTP_REQUEST_HEADERS, headers);
headers.put ("Authorization", Collections.singletonList(basicAuth));
}
catch (Exception e2) {
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/notify/SDNCNotifyResource.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/notify/SDNCNotifyResource.java
index 656334f2e7..d41291420e 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/notify/SDNCNotifyResource.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/notify/SDNCNotifyResource.java
@@ -3,6 +3,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.
@@ -171,7 +172,7 @@ public class SDNCNotifyResource {
msoLogger.error (MessageEnum.RA_MISSING_PARAM, Constants.SDNC_SVCCFGRESP_ROOT + Constants.SDNC_RESP_MSG, "SDNC", "SDNCNotify", MsoLogger.ErrorCode.DataError, "Exception - Missing param", e);
}
- String bpelUrl = null;
+ String bpelUrl;
/*
* TODO Hibernate
* try {
@@ -182,8 +183,10 @@ public class SDNCNotifyResource {
* logger.error("Unable to get SDNC_CALLBACK_URL from ActiveRequests, using default for reqid:" + reqId, e);
* }
*/
+
+ bpelUrl = SDNCAdapterPortTypeImpl.getProperty (Constants.BPEL_URL_PROP, Constants.DEFAULT_BPEL_URL,msoPropertiesFactory);
if (bpelUrl == null) {
- bpelUrl = SDNCAdapterPortTypeImpl.getProperty (Constants.BPEL_URL_PROP, Constants.DEFAULT_BPEL_URL,msoPropertiesFactory);
+ msoLogger.debug("bpelUrl is NULL:");
}
SDNCResponse sdncResp = new SDNCResponse (reqId);
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/BPRestCallback.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/BPRestCallback.java
index 5b18002f22..0622c48c41 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/BPRestCallback.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/BPRestCallback.java
@@ -3,6 +3,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.
@@ -155,7 +156,7 @@ public class BPRestCallback {
try {
EntityUtils.consume(httpResponse.getEntity());
} catch (Exception e) {
- // Ignore
+ LOGGER.debug("Exception:", e);
}
}
@@ -163,7 +164,7 @@ public class BPRestCallback {
try {
method.reset();
} catch (Exception e) {
- // Ignore
+ LOGGER.debug("Exception:", e);
}
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterUtils.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterUtils.java
index 1e28920ab2..893ff82f11 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterUtils.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterUtils.java
@@ -3,6 +3,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.
@@ -27,16 +28,24 @@ import org.w3c.dom.NodeList;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
+import org.openecomp.mso.logger.MsoLogger;
/**
* Utility methods used by SDNCAdapterRest.
*/
public final class SDNCAdapterUtils {
- /**
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
+ /**
+ * Instantiation is not allowed.
+ */
+ private SDNCAdapterUtils() {
+ }
+
+ /**
* Returns a node's child elements in a list.
*/
public static List<Element> childElements(Node node) {
- List<Element> elements = new ArrayList<Element>();
+ List<Element> elements = new ArrayList<>();
NodeList nodeList = node.getChildNodes();
for (int i = 0; i < nodeList.getLength(); i++) {
@@ -58,13 +67,8 @@ public final class SDNCAdapterUtils {
try {
return UriUtils.encodePathSegment(pathSegment, "UTF-8");
} catch (UnsupportedEncodingException e) {
+ LOGGER.debug("Exception:", e);
throw new RuntimeException("UTF-8 encoding is not supported");
}
}
-
- /**
- * Instantiation is not allowed.
- */
- private SDNCAdapterUtils() {
- }
} \ No newline at end of file
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java
index 19a93da5b5..262d23bd09 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java
@@ -3,6 +3,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.
@@ -103,9 +104,15 @@ public abstract class SDNCConnector {
String userCredentials = SDNCAdapterProperties.getEncryptedProperty(Constants.SDNC_AUTH_PROP,
Constants.DEFAULT_SDNC_AUTH, Constants.ENCRYPTION_KEY);
String authorization = "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes());
- method.setHeader("Authorization", authorization);
+ if(null != method) {
+ method.setHeader("Authorization", authorization);
+ method.setHeader("Accept", "application/yang.data+xml");
+ }
+ else {
+ LOGGER.debug("method is NULL:");
+ }
- method.setHeader("Accept", "application/yang.data+xml");
+
httpResponse = client.execute(method);
@@ -134,8 +141,14 @@ public abstract class SDNCConnector {
}
httpResponse = null;
+
+ if(null != method) {
+ method.reset();
+ }
+ else {
+ LOGGER.debug("method is NULL:");
+ }
- method.reset();
method = null;
LOGGER.info(MessageEnum.RA_RESPONSE_FROM_SDNC, responseContent, "SDNC", "");
@@ -161,7 +174,7 @@ public abstract class SDNCConnector {
try {
EntityUtils.consume(httpResponse.getEntity());
} catch (Exception e) {
- // Ignore
+ LOGGER.debug("Exception:", e);
}
}
@@ -169,7 +182,7 @@ public abstract class SDNCConnector {
try {
method.reset();
} catch (Exception e) {
- // Ignore
+ LOGGER.debug("Exception:", e);
}
}
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCEventParser.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCEventParser.java
index 6ea43d828c..2263ab74df 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCEventParser.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCEventParser.java
@@ -3,6 +3,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.
@@ -20,6 +21,7 @@
package org.openecomp.mso.adapters.sdnc.sdncrest;
import org.openecomp.mso.adapters.sdncrest.SDNCEvent;
+import org.openecomp.mso.logger.MsoLogger;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.InputSource;
@@ -33,7 +35,13 @@ import java.text.ParseException;
* SDNCConnector for "agnostic" API services.
*/
public class SDNCEventParser {
- /**
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
+
+ // Instantiation is not allowed.
+ private SDNCEventParser() {
+ }
+
+ /**
* Parses SDNC event XML. If the content can be parsed and contains all required
* elements, then an object is returned. Otherwise, a ParseException is thrown.
* This method performs no logging or alarming.
@@ -79,7 +87,7 @@ public class SDNCEventParser {
} else if ("event-correlator".equals(child.getNodeName())) {
eventCorrelator = child.getTextContent();
} else if ("event-parameters".equals(child.getNodeName())) {
- eventParameters = (Element) child;
+ eventParameters = child;
}
}
@@ -146,11 +154,8 @@ public class SDNCEventParser {
} catch (ParseException e) {
throw e;
} catch (Exception e) {
- throw new ParseException("Failed to parse SDNC event", 0);
+ LOGGER.debug("Exception:", e);
+ throw new ParseException("Failed to parse SDNC event:", 0 );
}
}
-
- // Instantiation is not allowed.
- private SDNCEventParser() {
- }
} \ No newline at end of file
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java
index e12384071c..f0fcf18afd 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java
@@ -3,6 +3,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,12 +35,14 @@ import java.net.HttpURLConnection;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
+import org.openecomp.mso.logger.MsoLogger;
/**
* SDNCConnector for "agnostic" API services.
*/
public class SDNCServiceRequestConnector extends SDNCConnector {
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
@Override
protected SDNCResponseCommon createResponseFromContent(int statusCode, String statusMessage,
String responseContent, TypedRequestTunables rt) {
@@ -99,7 +102,7 @@ public class SDNCServiceRequestConnector extends SDNCConnector {
String responseMessage = null;
String svcRequestId = null;
String ackFinalIndicator = null;
- List<Element> responseParameters = new ArrayList<Element>();
+ List<Element> responseParameters = new ArrayList<>();
for (Element child : SDNCAdapterUtils.childElements(configurationResponseCommon)) {
if ("response-code".equals(child.getNodeName())) {
@@ -133,7 +136,7 @@ public class SDNCServiceRequestConnector extends SDNCConnector {
ackFinalIndicator = "Y";
}
- if (!ackFinalIndicator.equals("Y") && !ackFinalIndicator.equals("N")) {
+ if (!ackFinalIndicator.equals("Y") && !"N".equals(ackFinalIndicator)) {
throw new ParseException("Invalid ack-final-indicator in SDNC response: '" + ackFinalIndicator + "'", 0);
}
@@ -189,6 +192,7 @@ public class SDNCServiceRequestConnector extends SDNCConnector {
} catch (ParseException e) {
throw e;
} catch (Exception e) {
+ LOGGER.debug("Exception:", e);
throw new ParseException("Failed to parse SDNC response", 0);
}
}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java
index dfedce8531..8e5f0b4274 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java
@@ -130,31 +130,37 @@ public class RestfulUtil {
if(httpResponse.getStatusLine().getStatusCode() >= 300) {
String errMsg = "VFC returned " + statusCode + " " + statusMessage;
logError(errMsg);
- return CreateResponse(statusCode, errMsg);
+ return createResponse(statusCode, errMsg);
}
httpResponse = null;
- method.reset();
+ if(null != method) {
+ method.reset();
+ }
+ else {
+ LOGGER.debug("method is NULL:");
+ }
+
method = null;
LOGGER.info(MessageEnum.RA_RESPONSE_FROM_SDNC, responseContent, "SDNC", "");
- return CreateResponse(statusCode, responseContent);
+ return createResponse(statusCode, responseContent);
} catch(SocketTimeoutException e) {
String errMsg = "Request to SDNC timed out";
logError(errMsg, e);
- return CreateResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg);
+ return createResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg);
} catch(ConnectTimeoutException e) {
String errMsg = "Request to SDNC timed out";
logError(errMsg, e);
- return CreateResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg);
+ return createResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg);
} catch(Exception e) {
String errMsg = "Error processing request to SDNC";
logError(errMsg, e);
- return CreateResponse(HttpURLConnection.HTTP_INTERNAL_ERROR, errMsg);
+ return createResponse(HttpURLConnection.HTTP_INTERNAL_ERROR, errMsg);
} finally {
if(httpResponse != null) {
@@ -185,7 +191,7 @@ public class RestfulUtil {
ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg);
}
- private static RestfulResponse CreateResponse(int statusCode, String content) {
+ private static RestfulResponse createResponse(int statusCode, String content) {
RestfulResponse rsp = new RestfulResponse();
rsp.setStatus(statusCode);
rsp.setResponseContent(content);
diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsyncImpl.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsyncImpl.java
index ff2e93b426..b3756c4ccb 100644
--- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsyncImpl.java
+++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsyncImpl.java
@@ -3,6 +3,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.
@@ -58,7 +59,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
CloudConfigFactory cloudConfigFactory=new CloudConfigFactory();
public static final String MSO_PROP_VNF_ADAPTER="MSO_PROP_VNF_ADAPTER";
- private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
private static final String BPEL_AUTH_PROP = "org.openecomp.mso.adapters.vnf.bpelauth";
private static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f";
@@ -129,15 +130,13 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
MsoLogger.setLogContext (msoRequest);
MsoLogger.setServiceName (serviceName);
LOGGER.info (MessageEnum.RA_ASYNC_CREATE_VNF, vnfName, vnfType, cloudSiteId, tenantId, "", "createVnfA");
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis ();
// Use the synchronous method to perform the actual Create
MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl (msoPropertiesFactory, cloudConfigFactory);
// Synchronous Web Service Outputs
- Holder <String> vnfId = new Holder <String> ();
- Holder <Map <String, String>> outputs = new Holder <Map <String, String>> ();
- Holder <VnfRollback> vnfRollback = new Holder <VnfRollback> ();
+ Holder <String> vnfId = new Holder <> ();
+ Holder <Map <String, String>> outputs = new Holder <> ();
+ Holder <VnfRollback> vnfRollback = new Holder <> ();
try {
vnfAdapter.createVnf (cloudSiteId,
@@ -216,17 +215,15 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
String serviceName = "UpdateVnfA";
MsoLogger.setServiceName (serviceName);
MsoLogger.setLogContext (msoRequest);
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis ();
LOGGER.info (MessageEnum.RA_ASYNC_UPDATE_VNF, vnfName, vnfType, cloudSiteId, tenantId, "", "UpdateVnfA");
// Use the synchronous method to perform the actual Create
MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl (msoPropertiesFactory,cloudConfigFactory);
// Synchronous Web Service Outputs
- Holder <String> vnfId = new Holder <String> ();
- Holder <Map <String, String>> outputs = new Holder <Map <String, String>> ();
- Holder <VnfRollback> vnfRollback = new Holder <VnfRollback> ();
+ Holder <String> vnfId = new Holder <> ();
+ Holder <Map <String, String>> outputs = new Holder <> ();
+ Holder <VnfRollback> vnfRollback = new Holder <> ();
try {
vnfAdapter.updateVnf (cloudSiteId, tenantId, vnfType,vnfVersion, vnfName, requestType, volumeGroupHeatStackId, inputs, msoRequest, outputs, vnfRollback);
@@ -299,18 +296,16 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
String serviceName = "QueryVnfA";
MsoLogger.setServiceName (serviceName);
MsoLogger.setLogContext (msoRequest);
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis ();
LOGGER.info (MessageEnum.RA_ASYNC_QUERY_VNF, vnfName, cloudSiteId, tenantId);
// Use the synchronous method to perform the actual query
MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl (msoPropertiesFactory,cloudConfigFactory);
// Synchronous Web Service Outputs
- Holder <Boolean> vnfExists = new Holder <Boolean> ();
- Holder <String> vnfId = new Holder <String> ();
- Holder <VnfStatus> status = new Holder <VnfStatus> ();
- Holder <Map <String, String>> outputs = new Holder <Map <String, String>> ();
+ Holder <Boolean> vnfExists = new Holder <> ();
+ Holder <String> vnfId = new Holder <> ();
+ Holder <VnfStatus> status = new Holder <> ();
+ Holder <Map <String, String>> outputs = new Holder <> ();
try {
vnfAdapter.queryVnf (cloudSiteId, tenantId, vnfName, msoRequest, vnfExists, vnfId, status, outputs);
@@ -391,8 +386,6 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
String serviceName = "DeleteVnfA";
MsoLogger.setServiceName (serviceName);
MsoLogger.setLogContext (msoRequest);
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis ();
LOGGER.info (MessageEnum.RA_ASYNC_DELETE_VNF, vnfName, cloudSiteId, tenantId);
// Use the synchronous method to perform the actual delete
@@ -453,8 +446,6 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
public void rollbackVnfA (VnfRollback rollback, String messageId, String notificationUrl) {
String serviceName = "RollbackVnfA";
MsoLogger.setServiceName (serviceName);
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis ();
String error;
// rollback may be null (e.g. if stack already existed when Create was called)
if (rollback == null) {
@@ -542,7 +533,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
CreateVnfNotification.Outputs outputs = new CreateVnfNotification.Outputs ();
if (hMap != null && hMap.value != null) {
- Map <String, String> sMap = new HashMap <String, String> ();
+ Map <String, String> sMap = new HashMap <> ();
sMap = hMap.value;
CreateVnfNotification.Outputs.Entry entry = new CreateVnfNotification.Outputs.Entry ();
@@ -560,7 +551,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
UpdateVnfNotification.Outputs outputs = new UpdateVnfNotification.Outputs ();
if (hMap != null && hMap.value != null) {
- Map <String, String> sMap = new HashMap <String, String> ();
+ Map <String, String> sMap = new HashMap <> ();
sMap = hMap.value;
UpdateVnfNotification.Outputs.Entry entry = new UpdateVnfNotification.Outputs.Entry ();
@@ -578,7 +569,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
QueryVnfNotification.Outputs outputs = new QueryVnfNotification.Outputs ();
if (hMap != null && hMap.value != null) {
- Map <String, String> sMap = new HashMap <String, String> ();
+ Map <String, String> sMap = new HashMap <> ();
sMap = hMap.value;
QueryVnfNotification.Outputs.Entry entry = new QueryVnfNotification.Outputs.Entry ();
@@ -625,21 +616,25 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
LOGGER.error (MessageEnum.RA_INIT_NOTIF_EXC, "", "getNotifyEP", MsoLogger.ErrorCode.BusinessProcesssError, "MalformedURLException", e1);
}
- LOGGER.debug ("Notification Endpoint URL: " + epUrl.toExternalForm ());
-
- bp.getRequestContext ().put (BindingProvider.ENDPOINT_ADDRESS_PROPERTY, epUrl.toExternalForm ());
+ if(null != epUrl) {
+ LOGGER.debug ("Notification Endpoint URL: " + epUrl.toExternalForm ());
+ bp.getRequestContext ().put (BindingProvider.ENDPOINT_ADDRESS_PROPERTY, epUrl.toExternalForm ());
+ }
+ else {
+ LOGGER.debug ("epUrl is NULL:");
+ }
// authentication
try {
- Map <String, Object> req_ctx = bp.getRequestContext ();
- Map <String, List <String>> headers = new HashMap <String, List <String>> ();
+ Map <String, Object> reqCtx = bp.getRequestContext ();
+ Map <String, List <String>> headers = new HashMap <> ();
String userCredentials = msoPropertiesFactory.getMsoJavaProperties (MSO_PROP_VNF_ADAPTER).getEncryptedProperty (BPEL_AUTH_PROP,
"",
ENCRYPTION_KEY);
String basicAuth = "Basic " + DatatypeConverter.printBase64Binary (userCredentials.getBytes ());
- req_ctx.put (MessageContext.HTTP_REQUEST_HEADERS, headers);
+ reqCtx.put (MessageContext.HTTP_REQUEST_HEADERS, headers);
headers.put ("Authorization", Collections.singletonList (basicAuth));
} catch (Exception e) {
LOGGER.error (MessageEnum.RA_SET_CALLBACK_AUTH_EXC, "", "getNotifyEP", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - Unable to set authorization in callback request", e);