aboutsummaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
Diffstat (limited to 'adapters')
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java4
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/beans/DeploymentInfoBuilder.java16
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyWorkflowException.java4
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java6
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java41
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java13
9 files changed, 30 insertions, 60 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java
index f717144562..35c928c3b5 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java
@@ -72,9 +72,7 @@ public class KeystoneV3Authentication {
OpenStackRequest<Token> v3Request = keystoneTenantClient.tokens().authenticate(v3Credentials);
- KeystoneAuthHolder holder = makeRequest(v3Request, type, region);
-
- return holder;
+ return makeRequest(v3Request, type, region);
}
protected KeystoneAuthHolder makeRequest(OpenStackRequest<Token> v3Request, String type, String region) {
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/beans/DeploymentInfoBuilder.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/beans/DeploymentInfoBuilder.java
index 02ace5665d..072bf404e7 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/beans/DeploymentInfoBuilder.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/beans/DeploymentInfoBuilder.java
@@ -72,22 +72,22 @@ public final class DeploymentInfoBuilder {
this.errorMessage = execution.getError();
// Compute the status based on the last workflow
- if (lastAction.equals("install")) {
- if (actionStatus.equals("terminated")) {
+ if (("install").equals(lastAction)) {
+ if (("terminated").equals(actionStatus)) {
this.deploymentStatus = DeploymentStatus.INSTALLED;
- } else if (actionStatus.equals("failed")) {
+ } else if (("failed").equals(actionStatus)) {
this.deploymentStatus = DeploymentStatus.FAILED;
- } else if (actionStatus.equals("started") || actionStatus.equals("pending")) {
+ } else if (("started").equals(actionStatus) || ("pending").equals(actionStatus)) {
this.deploymentStatus = DeploymentStatus.INSTALLING;
} else {
this.deploymentStatus = DeploymentStatus.UNKNOWN;
}
- } else if (lastAction.equals("uninstall")) {
- if (actionStatus.equals("terminated")) {
+ } else if (("uninstall").equals(lastAction)) {
+ if (("terminated").equals(actionStatus)) {
this.deploymentStatus = DeploymentStatus.CREATED;
- } else if (actionStatus.equals("failed")) {
+ } else if (("failed").equals(actionStatus)) {
this.deploymentStatus = DeploymentStatus.FAILED;
- } else if (actionStatus.equals("started") || actionStatus.equals("pending")) {
+ } else if (("started").equals(actionStatus) || ("pending").equals(actionStatus)) {
this.deploymentStatus = DeploymentStatus.UNINSTALLING;
} else {
this.deploymentStatus = DeploymentStatus.UNKNOWN;
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyWorkflowException.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyWorkflowException.java
index 5c2348dffa..2251575671 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyWorkflowException.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyWorkflowException.java
@@ -38,8 +38,8 @@ public class MsoCloudifyWorkflowException extends MsoCloudifyException {
super(0, "Workflow Exception",
"Workflow " + workflowId + " failed on deployment " + deploymentId + ": " + message);
this.workflowStatus = workflowStatus;
- if (workflowStatus.equals("pending") || workflowStatus.equals("started") || workflowStatus.equals("cancelling")
- || workflowStatus.equals("force_cancelling")) {
+ if (("pending").equals(workflowStatus) || ("started").equals(workflowStatus)
+ || ("cancelling").equals(workflowStatus) || ("force_cancelling").equals(workflowStatus)) {
workflowStillRunning = true;
}
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java
index e550394931..c1acc319f7 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java
@@ -104,7 +104,7 @@ public class QueryAllottedResourceCustomization extends CatalogQuery {
first = false;
- boolean arNull = o.getAllottedResource() == null ? true : false;
+ boolean arNull = o.getAllottedResource() == null;
put(valueMap, "MODEL_NAME", arNull ? null : o.getAllottedResource().getModelName());
put(valueMap, "MODEL_UUID", arNull ? null : o.getAllottedResource().getModelUUID());
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
index 96ea797631..5573b23a8d 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
@@ -104,7 +104,7 @@ public class QueryServiceNetworks extends CatalogQuery {
if (first)
sb.append("\n");
first = false;
- boolean nrNull = o.getNetworkResource() == null ? true : false;
+ boolean nrNull = o.getNetworkResource() == null;
put(valueMap, "MODEL_NAME", nrNull ? null : o.getNetworkResource().getModelName());
put(valueMap, "MODEL_UUID", nrNull ? null : o.getNetworkResource().getModelUUID());
put(valueMap, "MODEL_INVARIANT_ID", nrNull ? null : o.getNetworkResource().getModelInvariantUUID());
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
index b1bdeda445..f786f25361 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
@@ -101,7 +101,7 @@ public class QueryServiceVnfs extends CatalogQuery {
sb.append("\n");
first = false;
- boolean vrNull = o.getVnfResources() == null ? true : false;
+ boolean vrNull = o.getVnfResources() == null;
put(valueMap, "MODEL_NAME", vrNull ? null : o.getVnfResources().getModelName());
put(valueMap, "MODEL_UUID", vrNull ? null : o.getVnfResources().getModelUUID());
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java
index 1dec9cecae..1604e99a72 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java
@@ -97,7 +97,7 @@ public class QueryVfModule extends CatalogQuery {
sb.append("\n");
first = false;
- boolean vfNull = o.getVfModule() == null ? true : false;
+ boolean vfNull = o.getVfModule() == null;
boolean hasVolumeGroup = false;
HeatEnvironment envt = o.getVolumeHeatEnv();
if (envt != null) {
@@ -109,10 +109,10 @@ public class QueryVfModule extends CatalogQuery {
put(valueMap, "MODEL_INVARIANT_ID", vfNull ? null : o.getVfModule().getModelInvariantUUID());
put(valueMap, "MODEL_VERSION", vfNull ? null : o.getVfModule().getModelVersion());
put(valueMap, "MODEL_CUSTOMIZATION_UUID", o.getModelCustomizationUUID());
- put(valueMap, "IS_BASE", vfNull ? false : o.getVfModule().getIsBase() ? true : false);
+ put(valueMap, "IS_BASE", !vfNull && (o.getVfModule().getIsBase()));
put(valueMap, "VF_MODULE_LABEL", o.getLabel());
put(valueMap, "INITIAL_COUNT", o.getInitialCount());
- put(valueMap, "HAS_VOLUME_GROUP", new Boolean(hasVolumeGroup));
+ put(valueMap, "HAS_VOLUME_GROUP", hasVolumeGroup);
sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap));
sep = ",\n";
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
index b59a1fa79a..bac41a1f8b 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
@@ -6,6 +6,7 @@
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
+ * Modifications Copyright (c) 2019 IBM
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -66,7 +67,6 @@ import org.onap.so.entity.MsoRequest;
import org.onap.so.logger.ErrorCode;
import org.onap.so.heatbridge.HeatBridgeApi;
import org.onap.so.heatbridge.HeatBridgeImpl;
-import org.onap.so.heatbridge.openstack.api.OpenstackClient;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.HeatStatus;
import org.onap.so.openstack.beans.StackInfo;
@@ -189,7 +189,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
String vfModuleId = "";
// Create a hook here to catch shortcut createVf requests:
if (requestType != null && requestType.startsWith("VFMOD")) {
- logger.debug("Calling createVfModule from createVnf -- requestType=" + requestType);
+ logger.debug("Calling createVfModule from createVnf -- requestType={}", requestType);
String newRequestType = requestType.substring(5);
String vfVolGroupHeatStackId = "";
String vfBaseHeatStackId = "";
@@ -251,13 +251,11 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
Holder<Boolean> vnfExists, Holder<String> vnfId, Holder<VnfStatus> status,
Holder<Map<String, String>> outputs) throws VnfException {
- logger.debug("Querying VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId);
+ logger.debug("Querying VNF {} in {}/{}", vnfName, cloudSiteId, tenantId);
// Will capture execution time for metrics
- long startTime = System.currentTimeMillis();
- StackInfo heatStack = null;
- long subStartTime = System.currentTimeMillis();
+ StackInfo heatStack;
try {
heatStack = heat.queryStack(cloudSiteId, cloudOwner, tenantId, vnfName);
} catch (MsoException me) {
@@ -310,14 +308,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
throws VnfException {
logger.debug("Deleting VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId);
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis();
- // Use the MsoHeatUtils to delete the stack. Set the polling flag to true.
- // The possible outcomes of deleteStack are a StackInfo object with status
- // of NOTFOUND (on success) or FAILED (on error). Also, MsoOpenstackException
- // could be thrown.
- long subStartTime = System.currentTimeMillis();
try {
heat.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, true);
} catch (MsoException me) {
@@ -344,7 +335,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
*/
@Override
public void rollbackVnf(VnfRollback rollback) throws VnfException {
- long startTime = System.currentTimeMillis();
// rollback may be null (e.g. if stack already existed when Create was called)
if (rollback == null) {
logger.info(MessageEnum.RA_ROLLBACK_NULL.toString(), OPENSTACK, "rollbackVnf");
@@ -437,13 +427,13 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
logger.debug(" HeatBridgeMain.py returned {} with code {}", wait, p.exitValue());
return wait && p.exitValue() == 0;
} catch (IOException e) {
- logger.debug(" HeatBridgeMain.py failed with IO Exception! " + e);
+ logger.debug(" HeatBridgeMain.py failed with IO Exception! {}", e);
return false;
} catch (RuntimeException e) {
- logger.debug(" HeatBridgeMain.py failed during runtime!" + e);
+ logger.debug(" HeatBridgeMain.py failed during runtime! {}", e);
return false;
} catch (Exception e) {
- logger.debug(" HeatBridgeMain.py failed for unknown reasons! " + e);
+ logger.debug(" HeatBridgeMain.py failed for unknown reasons! {}", e);
return false;
}
}
@@ -461,7 +451,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
HeatBridgeApi heatBridgeClient =
new HeatBridgeImpl(new AAIResourcesClient(), cloudIdentity, cloudOwner, cloudSiteId, tenantId);
- OpenstackClient openstackClient = heatBridgeClient.authenticate();
List<Resource> stackResources = heatBridgeClient.queryNestedHeatStackResources(heatStackId);
List<Server> osServers = heatBridgeClient.getAllOpenstackServers(stackResources);
@@ -590,7 +579,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
useMCUuid = false;
mcu = "";
} else {
- logger.debug("Found modelCustomizationUuid! Will use that: " + mcu);
+ logger.debug("Found modelCustomizationUuid! Will use that: {}", mcu);
useMCUuid = true;
}
}
@@ -1277,7 +1266,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
logger.debug("VF Module {} successfully created", vfModuleName);
// call heatbridge
heatbridge(heatStack, cloudOwner, cloudSiteId, tenantId, genericVnfName, vfModuleId);
- return;
} catch (Exception e) {
logger.debug("unhandled exception in create VF", e);
throw new VnfException("Exception during create VF " + e.getMessage());
@@ -1290,7 +1278,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
logger.debug("Deleting VF {} in ", vnfName, cloudOwner + "/" + cloudSiteId + "/" + tenantId);
// Will capture execution time for metrics
- long startTime = System.currentTimeMillis();
// 1702 capture the output parameters on a delete
// so we'll need to query first
@@ -1323,11 +1310,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
msoRequest, failRequestOnValetFailure);
}
- // Use the MsoHeatUtils to delete the stack. Set the polling flag to true.
- // The possible outcomes of deleteStack are a StackInfo object with status
- // of NOTFOUND (on success) or FAILED (on error). Also, MsoOpenstackException
- // could be thrown.
- long subStartTime = System.currentTimeMillis();
try {
heat.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, true);
} catch (MsoException me) {
@@ -2033,7 +2015,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
outputs.value = copyStringOutputs(heatStack.getOutputs());
rollback.value = vfRollback;
- return;
}
private String getVfModuleNameFromModuleStackId(String vfModuleStackId) {
@@ -2199,13 +2180,13 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
Map<String, Object> newInputs = vur.getParameters();
if (newInputs != null) {
Map<String, Object> oldGold = goldenInputs;
- logger.debug("parameters before being modified by valet:{}", oldGold.toString());
- goldenInputs = new HashMap<String, Object>();
+ logger.debug("parameters before being modified by valet:{}", oldGold);
+ goldenInputs = new HashMap<>();
for (String key : newInputs.keySet()) {
goldenInputs.put(key, newInputs.get(key));
}
valetModifiedParamsHolder.value = goldenInputs;
- logger.debug("parameters after being modified by valet:{}", goldenInputs.toString());
+ logger.debug("parameters after being modified by valet:{}", goldenInputs);
valetSucceeded = true;
}
} else {
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
index 21ce06eaf1..7d412b77ad 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
@@ -5,7 +5,7 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
- * Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (C) 2019 IBM.
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -77,13 +77,12 @@ public class SDNCRestClient {
private static Logger logger = LoggerFactory.getLogger(SDNCRestClient.class);
private static final String EXCEPTION_MSG = "Exception while evaluate xpath";
- private static final String MSO_INTERNAL_ERROR = "MsoInternalError";
private static final String CAMUNDA = "Camunda";
@Async
public void executeRequest(SDNCAdapterRequest bpelRequest) {
- logger.debug("BPEL Request:" + bpelRequest.toString());
+ logger.debug("BPEL Request: {}", bpelRequest);
// Added delay to allow completion of create request to SDNC
// before executing activate of create request.
@@ -96,8 +95,6 @@ public class SDNCRestClient {
Thread.currentThread().interrupt();
}
- String action = bpelRequest.getRequestHeader().getSvcAction();
- String operation = bpelRequest.getRequestHeader().getSvcOperation();
String bpelReqId = bpelRequest.getRequestHeader().getRequestId();
String callbackUrl = bpelRequest.getRequestHeader().getCallbackUrl();
@@ -118,12 +115,9 @@ public class SDNCRestClient {
Document reqDoc = node.getOwnerDocument();
sdncReqBody = Utils.genSdncPutReq(reqDoc, rt);
}
- long sdncStartTime = System.currentTimeMillis();
SDNCResponse sdncResp = getSdncResp(sdncReqBody, rt);
logger.debug("Got the SDNC Response: {}", sdncResp.getSdncRespXml());
- long bpelStartTime = System.currentTimeMillis();
sendRespToBpel(callbackUrl, sdncResp);
- return;
}
public SDNCResponse getSdncResp(String sdncReqBody, RequestTunables rt) {
@@ -288,7 +282,6 @@ public class SDNCRestClient {
try {
wsdlUrl = new URL(bpelUrl);
} catch (MalformedURLException e1) {
- error = "Caught exception initializing Callback wsdl " + e1.getMessage();
logger.error("{} {} {} {}", MessageEnum.RA_INIT_CALLBACK_WSDL_ERR.toString(), CAMUNDA,
ErrorCode.DataError.getValue(), "Exception initializing Callback wsdl", e1);
@@ -317,7 +310,6 @@ public class SDNCRestClient {
reqCtx.put(MessageContext.HTTP_REQUEST_HEADERS, headers);
headers.put("Authorization", Collections.singletonList(basicAuth));
} catch (Exception e2) {
- error = "Unable to set authorization in callback request " + e2.getMessage();
logger.error("{} {} {} {}", MessageEnum.RA_SET_CALLBACK_AUTH_EXC.toString(), CAMUNDA,
ErrorCode.BusinessProcesssError.getValue(),
"Exception - Unable to set authorization in callback request", e2);
@@ -333,6 +325,5 @@ public class SDNCRestClient {
MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), error, e);
}
logger.info(MessageEnum.RA_CALLBACK_BPEL_COMPLETE.name(), CAMUNDA);
- return;
}
}