aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailPolicyRef.java18
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java23
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java150
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java581
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java84
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java95
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/TenantAdapterRest.java40
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java35
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java162
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java36
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java11
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java252
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCNotificationCallBack.java15
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java24
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/DistributionClientEmulator.java12
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java23
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java32
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java19
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java56
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java39
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java56
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/util/NotificationLogging.java9
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/xml/XmlTool.java15
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/utils/CamundaDBSetup.java16
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java10
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java18
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java8
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.java4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegate.java (renamed from bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java)20
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java12
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java12
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java (renamed from bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationId.java)16
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java24
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagement.java4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java8
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegateTest.java (renamed from bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java)22
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java8
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java18
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java16
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java8
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementThrowingException.java4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java (renamed from bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationIdTest.java)30
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java28
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn14
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn2
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService_simplified.bpmn2
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesRequest.java11
-rw-r--r--common/src/test/java/org/onap/so/client/grm/exception/GRMClientCallFailedTest.java36
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java18
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java10
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java2
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java14
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java4
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java14
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/exceptions/AAIClientCallFailedTest.java35
-rw-r--r--so-monitoring/so-monitoring-service/src/test/resources/camundaResponses/processInstanceVariables.json6
64 files changed, 1055 insertions, 1212 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailPolicyRef.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailPolicyRef.java
index 46fb651afe..613ab0d2f9 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailPolicyRef.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailPolicyRef.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -21,15 +23,17 @@
package org.onap.so.adapters.network;
-import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class ContrailPolicyRef {
- private static final MsoLogger logger = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, ContrailPolicyRef.class);
+
+ private static final Logger logger = LoggerFactory.getLogger(ContrailPolicyRef.class);
@JsonProperty("network_policy_refs_data_sequence")
private ContrailPolicyRefSeq seq;
@@ -44,7 +48,8 @@ public class ContrailPolicyRef {
}
catch (Exception e)
{
- logger.error (MessageEnum.RA_MARSHING_ERROR, "Error creating JsonString for Contrail Policy Ref", "", "", MsoLogger.ErrorCode.SchemaError, "Exception creating JsonString for Contrail Policy Ref", e);
+ logger.error("{} {} Error creating JsonString for Contrail Policy Ref: ", MessageEnum.RA_MARSHING_ERROR,
+ MsoLogger.ErrorCode.SchemaError.getValue(), e);
}
return node;
@@ -60,7 +65,8 @@ public class ContrailPolicyRef {
}
catch (Exception e)
{
- logger.error (MessageEnum.RA_MARSHING_ERROR, "Error creating JsonString for Contrail Policy Ref", "", "", MsoLogger.ErrorCode.SchemaError, "Exception creating JsonString for Contrail Policy Ref", e);
+ logger.error("{} {} Error creating JsonString for Contrail Policy Ref: ", MessageEnum.RA_MARSHING_ERROR,
+ MsoLogger.ErrorCode.SchemaError.getValue(), e);
}
return jsonString;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java
index 019963b242..6f80e0ee15 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -20,23 +22,24 @@
package org.onap.so.adapters.network;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.ArrayList;
import java.util.List;
-
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
import org.onap.so.openstack.beans.HostRoute;
import org.onap.so.openstack.beans.Pool;
import org.onap.so.openstack.beans.Subnet;
import org.onap.so.openstack.utils.MsoCommonUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
public class ContrailSubnet {
- private static final MsoLogger logger = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, ContrailSubnet.class);
+
+ private static final Logger logger = LoggerFactory.getLogger(ContrailSubnet.class);
@Autowired
private MsoCommonUtils msoCommonUtils;
@@ -129,8 +132,8 @@ public class ContrailSubnet {
}
catch (Exception e)
{
- String error = "Error creating JsonNode for Contrail Subnet:" + subnetName;
- logger.error (MessageEnum.RA_MARSHING_ERROR, error, "", "", MsoLogger.ErrorCode.SchemaError, "Exception creating JsonNode for Contrail Subnet", e);
+ logger.error("{} {} Error creating JsonNode for Contrail Subnet: {} ", MessageEnum.RA_MARSHING_ERROR,
+ MsoLogger.ErrorCode.SchemaError.getValue(), subnetName, e);
}
return node;
@@ -146,8 +149,8 @@ public class ContrailSubnet {
}
catch (Exception e)
{
- String error = "Error creating JsonString for Contrail Subnet:" + subnetName;
- logger.error (MessageEnum.RA_MARSHING_ERROR, error, "", "", MsoLogger.ErrorCode.SchemaError, "Exception creating JsonString for Contrail Subnet", e);
+ logger.error("{} {} Error creating JsonString for Contrail Subnet: {} ", MessageEnum.RA_MARSHING_ERROR,
+ MsoLogger.ErrorCode.SchemaError.getValue(), subnetName, e);
}
return jsonString;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java
index 8181714c0a..80333d6c7e 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java
@@ -6,6 +6,7 @@
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +23,7 @@
*/
package org.onap.so.adapters.network;
-
+
import java.net.MalformedURLException;
import java.net.URL;
@@ -31,14 +32,12 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
import javax.jws.WebService;
import javax.xml.bind.DatatypeConverter;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Holder;
import javax.xml.ws.handler.MessageContext;
-
import org.onap.so.adapters.network.async.client.CreateNetworkNotification;
import org.onap.so.adapters.network.async.client.MsoExceptionCategory;
import org.onap.so.adapters.network.async.client.NetworkAdapterNotify;
@@ -48,12 +47,13 @@ import org.onap.so.adapters.network.async.client.UpdateNetworkNotification;
import org.onap.so.adapters.network.exceptions.NetworkException;
import org.onap.so.entity.MsoRequest;
import org.onap.so.logger.MessageEnum;
-
import org.onap.so.logger.MsoLogger;
import org.onap.so.openstack.beans.NetworkRollback;
import org.onap.so.openstack.beans.NetworkStatus;
import org.onap.so.openstack.beans.Subnet;
import org.onap.so.utils.CryptoUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@@ -62,14 +62,14 @@ import org.springframework.stereotype.Component;
@WebService(serviceName = "NetworkAdapterAsync", endpointInterface = "org.onap.so.adapters.network.MsoNetworkAdapterAsync", targetNamespace = "http://org.onap.so/networkA")
public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,MsoNetworkAdapterAsyncImpl.class);
+ private static final Logger logger = LoggerFactory.getLogger(MsoNetworkAdapterAsyncImpl.class);
private static final String BPEL_AUTH_PROP = "org.onap.so.adapters.network.bpelauth";
private static final String ENCRYPTION_KEY_PROP = "org.onap.so.adapters.network.encryptionKey";
private static final String NETWORK_EXCEPTION_MSG="Got a NetworkException on createNetwork: ";
- private static final String CREATE_NETWORK_ERROR_MSG="Error sending createNetwork notification ";
- private static final String CREATE_NETWORK_EXCEPTON_MSG="Exception sending createNetwork notification";
- private static final String MSO_INTERNAL_ERROR_MSG="MsoInternalError";
+ private static final String CREATE_NETWORK_ERROR_LOGMSG ="{} {} Error sending createNetwork notification {} ";
+ private static final String FAULT_INFO_ERROR_LOGMSG = "{} {} Exception - fault info ";
+
@Autowired
private Environment environment;
@@ -80,7 +80,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
*/
@Override
public void healthCheckA () {
- LOGGER.debug ("Health check call in Network Adapter");
+ logger.debug ("Health check call in Network Adapter");
}
/**
@@ -130,13 +130,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
MsoLogger.setLogContext (msoRequest);
MsoLogger.setServiceName ("CreateNetworkA");
- LOGGER.debug ("Async Create Network: " + networkName
- + " of type "
- + networkType
- + " in "
- + cloudSiteId
- + "/"
- + tenantId);
+ logger.debug("Async Create Network: {} of type {} in {}/{}", networkName, networkType, cloudSiteId, tenantId);
// Use the synchronous method to perform the actual Create
@@ -177,27 +171,28 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
subnetIdMap,
networkRollback);
} catch (NetworkException e) {
- LOGGER.debug (NETWORK_EXCEPTION_MSG, e);
+ logger.debug (NETWORK_EXCEPTION_MSG, e);
MsoExceptionCategory exCat = null;
String eMsg = null;
try {
eMsg = e.getFaultInfo ().getMessage ();
exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ());
} catch (Exception e1) {
- LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - fault info", e1);
+ logger.error(FAULT_INFO_ERROR_LOGMSG, MessageEnum.RA_FAULT_INFO_EXC,
+ MsoLogger.ErrorCode.DataError.getValue(), e1);
}
// Build and send Asynchronous error response
try {
NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
notifyPort.createNetworkNotification (messageId, false, exCat, eMsg, null, null, null, null);
} catch (Exception e1) {
- error = CREATE_NETWORK_ERROR_MSG + e1.getMessage ();
- LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError,CREATE_NETWORK_EXCEPTON_MSG, e1);
+ logger.error(CREATE_NETWORK_ERROR_LOGMSG, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC,
+ MsoLogger.ErrorCode.DataError.getValue(), e1.getMessage(), e1);
}
return;
}
- LOGGER.debug ("Async Create Network:Name " + networkName + " physicalNetworkName:" + physicalNetworkName);
+ logger.debug("Async Create Network:Name {} physicalNetworkName:{}", networkName, physicalNetworkName);
// Build and send Asynchronous response
try {
NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
@@ -210,8 +205,8 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
copyCreateSubnetIdMap (subnetIdMap),
copyNrb (networkRollback));
} catch (Exception e) {
- error = CREATE_NETWORK_ERROR_MSG + e.getMessage ();
- LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, CREATE_NETWORK_EXCEPTON_MSG, e);
+ logger.error(CREATE_NETWORK_ERROR_LOGMSG, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC,
+ MsoLogger.ErrorCode.DataError.getValue(), e.getMessage(), e);
}
return;
@@ -262,13 +257,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
String serviceName = "UpdateNetworkA";
MsoLogger.setServiceName (serviceName);
MsoLogger.setLogContext (msoRequest);
- LOGGER.debug ("Async Update Network: " + networkId
- + " of type "
- + networkType
- + "in "
- + cloudSiteId
- + "/"
- + tenantId);
+ logger.debug("Async Update Network: {} of type {} in {}/{}", networkId, networkType, cloudSiteId, tenantId);
// Use the synchronous method to perform the actual Create
@@ -306,27 +295,29 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
MsoLogger.setServiceName (serviceName);
} catch (NetworkException e) {
MsoLogger.setServiceName (serviceName);
- LOGGER.debug ("Got a NetworkException on updateNetwork: ", e);
+ logger.debug ("Got a NetworkException on updateNetwork: ", e);
MsoExceptionCategory exCat = null;
String eMsg = null;
try {
eMsg = e.getFaultInfo ().getMessage ();
exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ());
} catch (Exception e1) {
- LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - fault info", e1);
+ logger.error(FAULT_INFO_ERROR_LOGMSG, MessageEnum.RA_FAULT_INFO_EXC,
+ MsoLogger.ErrorCode.DataError.getValue(), e1);
}
// Build and send Asynchronous error response
try {
NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
notifyPort.updateNetworkNotification (messageId, false, exCat, eMsg, null, copyNrb (networkRollback));
} catch (Exception e1) {
- error = "Error sending updateNetwork notification " + e1.getMessage ();
- LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending updateNetwork notification", e1);
+ logger.error("{} {} Error sending updateNetwork notification {} ",
+ MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, MsoLogger.ErrorCode.DataError.getValue(), e1.getMessage(),
+ e1);
}
return;
}
- LOGGER.debug ("Async Update Network:Name " + networkName + " NetworkId:" + networkId);
+ logger.debug("Async Update Network:Name {} NetworkId:{}", networkName, networkId);
// Build and send Asynchronous response
try {
NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
@@ -337,9 +328,8 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
copyUpdateSubnetIdMap (subnetIdMap),
copyNrb (networkRollback));
} catch (Exception e) {
- error = "Error sending updateNotification request" + e.getMessage ();
- LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending updateNotification request", e);
-
+ logger.error("{} {} Error sending updateNotification request {} ", MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC,
+ MsoLogger.ErrorCode.DataError.getValue(), e.getMessage(), e);
}
return;
}
@@ -363,7 +353,8 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
MsoLogger.setLogContext (msoRequest);
String serviceName = "QueryNetworkA";
MsoLogger.setServiceName (serviceName);
- LOGGER.debug ("Async Query Network " + networkNameOrId + " in " + cloudSiteId + "/" + tenantId);
+ logger.debug("Async Query Network {} in {}/{}", networkNameOrId, cloudSiteId, tenantId);
+ String errorCreateNetworkMessage = "{} {} Error sending createNetwork notification {} ";
// Use the synchronous method to perform the actual Create
@@ -390,27 +381,27 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
MsoLogger.setServiceName (serviceName);
} catch (NetworkException e) {
MsoLogger.setServiceName (serviceName);
- LOGGER.debug (NETWORK_EXCEPTION_MSG, e);
+ logger.debug (NETWORK_EXCEPTION_MSG, e);
MsoExceptionCategory exCat = null;
String eMsg = null;
try {
eMsg = e.getFaultInfo ().getMessage ();
exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ());
} catch (Exception e1) {
- LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - fault info", e1);
+ logger.error(FAULT_INFO_ERROR_LOGMSG, MessageEnum.RA_FAULT_INFO_EXC,
+ MsoLogger.ErrorCode.DataError.getValue(), e1);
}
// Build and send Asynchronous error response
try {
NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
notifyPort.queryNetworkNotification (messageId, false, exCat, eMsg, null, null, null, null, null, null);
} catch (Exception e1) {
- error = "Error sending createNetwork notification " + e1.getMessage ();
- LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e1);
-
+ logger.error(errorCreateNetworkMessage, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC,
+ MsoLogger.ErrorCode.DataError.getValue(), e1.getMessage(), e1);
}
return;
}
- LOGGER.debug ("Async Query Network:NameOrId " + networkNameOrId + " tenantId:" + tenantId);
+ logger.debug("Async Query Network:NameOrId {} tenantId:{}", networkNameOrId, tenantId);
// Build and send Asynchronous response
try {
NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
@@ -426,9 +417,8 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
vlans.value,
copyQuerySubnetIdMap (subnetIdMap));
} catch (Exception e) {
- error = "Error sending createNetwork notification " + e.getMessage ();
- LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e);
-
+ logger.error(errorCreateNetworkMessage, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC,
+ MsoLogger.ErrorCode.DataError.getValue(), e.getMessage(), e);
}
return;
}
@@ -464,7 +454,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
MsoLogger.setLogContext (msoRequest);
String serviceName = "DeleteNetworkA";
MsoLogger.setServiceName (serviceName);
- LOGGER.debug ("Async Delete Network " + networkId + " in " + cloudSiteId + "/" + tenantId);
+ logger.debug("Async Delete Network {} in {}/{}", networkId, cloudSiteId, tenantId);
// Use the synchronous method to perform the actual Create
@@ -477,34 +467,36 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
MsoLogger.setServiceName (serviceName);
} catch (NetworkException e) {
MsoLogger.setServiceName (serviceName);
- LOGGER.debug (NETWORK_EXCEPTION_MSG, e);
+ logger.debug (NETWORK_EXCEPTION_MSG, e);
MsoExceptionCategory exCat = null;
String eMsg = null;
try {
eMsg = e.getFaultInfo ().getMessage ();
exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ());
} catch (Exception e1) {
- LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - fault info", e1);
+ logger.error(FAULT_INFO_ERROR_LOGMSG, MessageEnum.RA_FAULT_INFO_EXC,
+ MsoLogger.ErrorCode.DataError.getValue(), e1);
}
// Build and send Asynchronous error response
try {
NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
notifyPort.deleteNetworkNotification (messageId, false, exCat, eMsg, null);
} catch (Exception e1) {
- error = "Error sending createNetwork notification " + e1.getMessage ();
- LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e1);
+ logger.error("{} {} Error sending createNetwork notification {} ",
+ MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, MsoLogger.ErrorCode.DataError.getValue(), e1.getMessage(),
+ e1);
}
return;
}
- LOGGER.debug ("Async Delete NetworkId: " + networkId + " tenantId:" + tenantId);
+ logger.debug("Async Delete NetworkId: {} tenantId:{}", networkId, tenantId);
// Build and send Asynchronous response
try {
NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
notifyPort.deleteNetworkNotification (messageId, true, null, null, networkDeleted.value);
} catch (Exception e) {
- error = "Error sending deleteNetwork notification " + e.getMessage ();
- LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending deleteNetwork notification", e);
+ logger.error("{} {} Error sending deleteNetwork notification {} ", MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC,
+ MsoLogger.ErrorCode.DataError.getValue(), e.getMessage(), e);
}
return;
@@ -526,12 +518,13 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
MsoLogger.setServiceName (serviceName);
// 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");
+ logger.warn("{} {} Rollback is null", MessageEnum.RA_ROLLBACK_NULL,
+ MsoLogger.ErrorCode.SchemaError.getValue());
return;
}
MsoLogger.setLogContext (rollback.getMsoRequest ());
- LOGGER.info (MessageEnum.RA_ASYNC_ROLLBACK, rollback.getNetworkStackId (), "", "");
+ logger.info("{} {}", MessageEnum.RA_ASYNC_ROLLBACK, rollback.getNetworkStackId());
// Use the synchronous method to perform the actual Create
@@ -540,7 +533,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
MsoLogger.setServiceName (serviceName);
} catch (NetworkException e) {
MsoLogger.setServiceName (serviceName);
- LOGGER.debug ("Got a NetworkException on rollbackNetwork: ", e);
+ logger.debug ("Got a NetworkException on rollbackNetwork: ", e);
// Build and send Asynchronous error response
MsoExceptionCategory exCat = null;
String eMsg = null;
@@ -548,27 +541,29 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
eMsg = e.getFaultInfo ().getMessage ();
exCat = MsoExceptionCategory.fromValue (e.getFaultInfo ().getCategory ().name ());
} catch (Exception e1) {
- LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception in get fault info", e1);
+ logger.error("{} {} Exception in get fault info ", MessageEnum.RA_FAULT_INFO_EXC,
+ MsoLogger.ErrorCode.DataError.getValue(), e1);
}
// Build and send Asynchronous error response
try {
NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
notifyPort.rollbackNetworkNotification (rollback.getMsoRequest ().getRequestId (), false, exCat, eMsg);
} catch (Exception e1) {
- error = CREATE_NETWORK_ERROR_MSG + e1.getMessage ();
- LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception in sending createNetwork notification ", e1);
+ logger.error(CREATE_NETWORK_ERROR_LOGMSG, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC,
+ MsoLogger.ErrorCode.DataError.getValue(), e1.getMessage(), e1);
}
return;
}
- LOGGER.debug ("Async Rollback NetworkId: " + rollback.getNetworkStackId () + " tenantId:" + rollback.getTenantId ());
+ logger.debug("Async Rollback NetworkId: {} tenantId:{}", rollback.getNetworkStackId(), rollback.getTenantId());
// Build and send Asynchronous response
try {
NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
notifyPort.rollbackNetworkNotification (rollback.getMsoRequest ().getRequestId (), true, null, null);
} catch (Exception e) {
- error = "Error sending rollbackNetwork notification " + e.getMessage ();
- LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception in sending rollbackNetwork notification", e);
+ logger
+ .error("{} {} Error sending rollbackNetwork notification {} ", MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC,
+ MsoLogger.ErrorCode.DataError.getValue(), e.getMessage(), e);
}
return;
@@ -607,15 +602,18 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
try {
warWsdlLoc = Thread.currentThread ().getContextClassLoader ().getResource ("NetworkAdapterNotify.wsdl");
} catch (Exception e) {
- LOGGER.error (MessageEnum.RA_WSDL_NOT_FOUND, "NetworkAdpaterNotify.wsdl", "", "", MsoLogger.ErrorCode.DataError, "Exception - WSDL not found", e);
+ logger.error("{} {} Exception - WSDL not found ", MessageEnum.RA_WSDL_NOT_FOUND,
+ MsoLogger.ErrorCode.DataError.getValue(), e);
}
if (warWsdlLoc == null) {
- LOGGER.error (MessageEnum.RA_WSDL_NOT_FOUND, "NetworkAdpaterNotify.wsdl", "", "", MsoLogger.ErrorCode.DataError, "WSDL not found");
+ logger
+ .error("{} {} WSDL not found", MessageEnum.RA_WSDL_NOT_FOUND, MsoLogger.ErrorCode.DataError.getValue());
} else {
try {
- LOGGER.debug ("NetworkAdpaterNotify.wsdl location:" + warWsdlLoc.toURI ().toString ());
+ logger.debug("NetworkAdpaterNotify.wsdl location: {}", warWsdlLoc.toURI().toString());
} catch (Exception e) {
- LOGGER.error (MessageEnum.RA_WSDL_URL_CONVENTION_EXC, "NetworkAdpaterNotify.wsdl", "", "", MsoLogger.ErrorCode.SchemaError, "Exception - WSDL URL convention", e);
+ logger.error("{} {} Exception - WSDL URL convention ", MessageEnum.RA_WSDL_URL_CONVENTION_EXC,
+ MsoLogger.ErrorCode.SchemaError.getValue(), e);
}
}
@@ -631,15 +629,16 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
try {
epUrl = new URL (notificationUrl);
} catch (MalformedURLException e1) {
- LOGGER.error (MessageEnum.RA_INIT_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - init notification", e1);
+ logger.error("{} {} Exception - init notification ", MessageEnum.RA_INIT_NOTIF_EXC,
+ MsoLogger.ErrorCode.DataError.getValue(), e1);
}
if(null != epUrl) {
- LOGGER.debug ("Notification Endpoint URL: " + epUrl.toExternalForm ());
+ logger.debug("Notification Endpoint URL: {}", epUrl.toExternalForm());
bp.getRequestContext ().put (BindingProvider.ENDPOINT_ADDRESS_PROPERTY, epUrl.toExternalForm ());
}
else {
- LOGGER.debug ("Notification Endpoint URL is NULL: ");
+ logger.debug("Notification Endpoint URL is NULL: ");
}
// authentication
@@ -653,9 +652,8 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
reqCtx.put (MessageContext.HTTP_REQUEST_HEADERS, headers);
headers.put ("Authorization", Collections.singletonList (basicAuth));
} catch (Exception e) {
- String error1 = "Unable to set authorization in callback request" + e.getMessage ();
- LOGGER.error (MessageEnum.RA_SET_CALLBACK_AUTH_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception - Unable to set authorization in callback request", e);
-
+ logger.error("{} {} Unable to set authorization in callback request {} ",
+ MessageEnum.RA_SET_CALLBACK_AUTH_EXC, MsoLogger.ErrorCode.DataError.getValue(), e.getMessage(), e);
}
return notifyPort;
@@ -665,7 +663,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
try {
return CryptoUtils.decrypt(this.environment.getProperty(key), this.environment.getProperty(encryptionKey));
} catch (GeneralSecurityException e) {
- LOGGER.debug("Exception while decrypting property: " + this.environment.getProperty(key), e);
+ logger.debug("Exception while decrypting property: {} ", this.environment.getProperty(key), e);
}
return defaultValue;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
index d250561f16..79966577f8 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
@@ -6,6 +6,7 @@
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,17 +22,17 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.network;
+package org.onap.so.adapters.network;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
-
import javax.jws.WebService;
import javax.xml.ws.Holder;
-
import org.onap.so.adapters.network.beans.ContrailPolicyRef;
import org.onap.so.adapters.network.beans.ContrailPolicyRefSeq;
import org.onap.so.adapters.network.beans.ContrailSubnet;
@@ -39,17 +40,16 @@ import org.onap.so.adapters.network.exceptions.NetworkException;
import org.onap.so.adapters.network.mappers.ContrailSubnetMapper;
import org.onap.so.cloud.CloudConfig;
import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
import org.onap.so.db.catalog.beans.HeatTemplate;
import org.onap.so.db.catalog.beans.NetworkResource;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
-import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
import org.onap.so.db.catalog.data.repository.CollectionNetworkResourceCustomizationRepository;
import org.onap.so.db.catalog.data.repository.NetworkResourceCustomizationRepository;
import org.onap.so.db.catalog.data.repository.NetworkResourceRepository;
import org.onap.so.db.catalog.utils.MavenLikeVersioning;
import org.onap.so.entity.MsoRequest;
import org.onap.so.logger.MessageEnum;
-
import org.onap.so.logger.MsoLogger;
import org.onap.so.openstack.beans.HeatStatus;
import org.onap.so.openstack.beans.NetworkInfo;
@@ -67,14 +67,13 @@ import org.onap.so.openstack.utils.MsoHeatUtils;
import org.onap.so.openstack.utils.MsoHeatUtilsWithUpdate;
import org.onap.so.openstack.utils.MsoNeutronUtils;
import org.onap.so.openstack.utils.MsoNeutronUtils.NetworkType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
@Component
@Transactional
@WebService(serviceName = "NetworkAdapter", endpointInterface = "org.onap.so.adapters.network.MsoNetworkAdapter", targetNamespace = "http://org.onap.so/network")
@@ -91,7 +90,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
private static final String MSO_CONFIGURATION_ERROR = "MsoConfigurationError";
private static final String NEUTRON_MODE = "NEUTRON";
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,MsoNetworkAdapterImpl.class);
+ private static final Logger logger = LoggerFactory.getLogger(MsoNetworkAdapterImpl.class);
@Autowired
private CloudConfig cloudConfig;
@@ -119,7 +118,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
*/
@Override
public void healthCheck () {
- LOGGER.debug ("Health check call in Network Adapter");
+ logger.debug ("Health check call in Network Adapter");
}
/**
@@ -270,13 +269,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
MsoLogger.setLogContext (msoRequest);
MsoLogger.setServiceName (CREATE_NETWORK_CONTEXT);
- LOGGER.debug ("*** CREATE Network: " + networkName
- + " of type "
- + networkType
- + " in "
- + cloudSiteId
- + "/"
- + tenantId);
+ logger.debug("*** CREATE Network: {} of type {} in {}/{}", networkName, networkType, cloudSiteId, tenantId);
// Will capture execution time for metrics
long startTime = System.currentTimeMillis ();
@@ -295,16 +288,12 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
Optional<CloudSite> cloudSiteOpt = cloudConfig.getCloudSite(cloudSiteId);
if (!cloudSiteOpt.isPresent())
{
- String error = "Configuration Error. Stack " + networkName + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + " CloudSite does not exist in MSO Configuration";
- LOGGER.error (MessageEnum.RA_CONFIG_EXC, error, "", "", MsoLogger.ErrorCode.DataError, "Configuration Error");
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, error);
- // Set the detailed error as the Exception 'message'
- throw new NetworkException (error, MsoExceptionCategory.USERDATA);
+ String error = String
+ .format("Configuration Error. Stack %s in %s/%s: CloudSite does not exist in MSO Configuration",
+ networkName, cloudSiteId, tenantId);
+ logger.error("{} {} {}", MessageEnum.RA_CONFIG_EXC, MsoLogger.ErrorCode.DataError.getValue(), error);
+ // Set the detailed error as the Exception 'message'
+ throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -329,12 +318,12 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
long queryNetworkStarttime = System.currentTimeMillis ();
try {
netInfo = neutron.queryNetwork (networkName, tenantId, cloudSiteId);
- 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);
- LOGGER.error (MessageEnum.RA_QUERY_NETWORK_EXC, networkName, cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception while querying network from OpenStack", me);
+ logger.error(
+ "{} {} Exception while querying network {} for CloudSite {} from Tenant {} from OpenStack ",
+ MessageEnum.RA_QUERY_NETWORK_EXC, MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ networkName, cloudSiteId, tenantId, me);
me.addContext (CREATE_NETWORK_CONTEXT);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while querying network from OpenStack");
throw new NetworkException (me);
}
@@ -342,23 +331,20 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// Exists. If that's OK, return success with the network ID.
// Otherwise, return an exception.
if (failIfExists != null && failIfExists) {
- String error = "Create Nework: Network " + networkName
- + " already exists in "
- + cloudSiteId
- + "/"
- + tenantId
- + " with ID " + netInfo.getId();
- LOGGER.error (MessageEnum.RA_NETWORK_ALREADY_EXIST, networkName, cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Network already exists");
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
+ String error = String
+ .format("Create Nework: Network %s already exists in %s/%s with ID %s", networkName,
+ cloudSiteId, tenantId, netInfo.getId());
+ logger.error("{} {} {}", MessageEnum.RA_NETWORK_ALREADY_EXIST,
+ MsoLogger.ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
} else {
// Populate the outputs from the existing network.
networkId.value = netInfo.getId ();
neutronNetworkId.value = netInfo.getId ();
rollback.value = networkRollback; // Default rollback - no updates performed
- String msg = "Found Existing network, status=" + netInfo.getStatus () + " for Neutron mode";
- LOGGER.warn (MessageEnum.RA_NETWORK_ALREADY_EXIST, networkName, cloudSiteId, tenantId, "", MsoLogger.ErrorCode.DataError, "Found Existing network, status=" + netInfo.getStatus ());
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, msg);
+ logger.warn("{} {} Found Existing network, status={} for Neutron mode ",
+ MessageEnum.RA_NETWORK_ALREADY_EXIST, MsoLogger.ErrorCode.DataError.getValue(),
+ netInfo.getStatus());
}
return;
}
@@ -371,19 +357,10 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
networkName,
physicalNetworkName,
vlans);
- LOGGER.recordMetricEvent (createNetworkStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Response successfully received from OpenStack", "OpenStack", "CreateNetwork", null);
} catch (MsoException me) {
- me.addContext (CREATE_NETWORK_CONTEXT);
- LOGGER.recordMetricEvent (createNetworkStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with OpenStack", "OpenStack", "CreateNetwork", null);
- String error = "Create Network: type " + neutronNetworkType
- + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + me;
- LOGGER.error (MessageEnum.RA_CREATE_NETWORK_EXC, networkName, cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception while communicate with OpenStack", me);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ me.addContext(CREATE_NETWORK_CONTEXT);
+ logger.error("{} {} Create Network: type {} in {}/{}: ", MessageEnum.RA_CREATE_NETWORK_EXC,
+ MsoLogger.ErrorCode.DataError.getValue(), neutronNetworkType, cloudSiteId, tenantId, me);
throw new NetworkException (me);
}
@@ -401,18 +378,19 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
networkRollback.setNeutronNetworkId (netInfo.getId ());
networkRollback.setNetworkType (networkType);
- LOGGER.debug ("Network " + networkName + " created, id = " + netInfo.getId ());
+ logger.debug("Network {} created, id = {}", networkName, netInfo.getId());
} else if ("HEAT".equals (mode)) {
HeatTemplate heatTemplate = networkResource.getHeatTemplate();
if (heatTemplate == null) {
- String error = "Network error - undefined Heat Template. Network Type = " + networkType;
- LOGGER.error (MessageEnum.RA_PARAM_NOT_FOUND, "Heat Template", "Network Type", networkType, "Openstack", "", MsoLogger.ErrorCode.DataError, "Network error - undefined Heat Template. Network Type = " + networkType);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
+ String error = String
+ .format("Network error - undefined Heat Template. Network Type = %s", networkType);
+ logger.error("{} {} {}", MessageEnum.RA_PARAM_NOT_FOUND, MsoLogger.ErrorCode.DataError.getValue(),
+ error);
throw new NetworkException (error, MsoExceptionCategory.INTERNAL);
}
-
- LOGGER.debug ("Got HEAT Template from DB: " + heatTemplate.toString());
+
+ logger.debug("Got HEAT Template from DB: {}", heatTemplate.toString());
// "Fix" the template if it has CR/LF (getting this from Oracle)
String template = heatTemplate.getHeatTemplate ();
@@ -432,33 +410,22 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
long queryNetworkStarttime = System.currentTimeMillis ();
try {
heatStack = heat.queryStack (cloudSiteId, tenantId, networkName);
- LOGGER.recordMetricEvent (queryNetworkStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Response successfully received from OpenStack", "OpenStack", "QueryNetwork", null);
} catch (MsoException me) {
me.addContext (CREATE_NETWORK_CONTEXT);
- LOGGER.recordMetricEvent (queryNetworkStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while querying stack from OpenStack", "OpenStack", "QueryNetwork", null);
- String error = "Create Network (heat): query network " + networkName
- + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + me;
- LOGGER.error (MessageEnum.RA_QUERY_NETWORK_EXC, networkName, cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception while querying stack from OpenStack", me);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ logger.error("{} {} Create Network (heat): query network {} in {}/{}: ",
+ MessageEnum.RA_QUERY_NETWORK_EXC, MsoLogger.ErrorCode.DataError.getValue(), networkName,
+ cloudSiteId, tenantId, me);
throw new NetworkException (me);
}
if (heatStack != null && (heatStack.getStatus () != HeatStatus.NOTFOUND)) {
// Stack exists. Return success or error depending on input directive
if (failIfExists != null && failIfExists) {
- String error = "CreateNetwork: Stack " + networkName
- + " already exists in "
- + cloudSiteId
- + "/"
- + tenantId
- + " as " + heatStack.getCanonicalName();
- LOGGER.error (MessageEnum.RA_NETWORK_ALREADY_EXIST, networkName, cloudSiteId, tenantId, "", "", MsoLogger.ErrorCode.DataError, "Network already exists");
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
+ String error = String
+ .format("CreateNetwork: Stack %s already exists in %s/%s as %s", networkName, cloudSiteId,
+ tenantId, heatStack.getCanonicalName());
+ logger.error("{} {} {}", MessageEnum.RA_NETWORK_ALREADY_EXIST,
+ MsoLogger.ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
} else {
// Populate the outputs from the existing stack.
@@ -489,8 +456,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
}
subnetIdMap.value = sMap;
- 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");
+ logger.warn("{} {} Found Existing network stack, status={} networkName={} for {}/{}",
+ MessageEnum.RA_NETWORK_ALREADY_EXIST, MsoLogger.ErrorCode.DataError.getValue(),
+ heatStack.getStatus(), networkName, cloudSiteId, tenantId);
}
return;
}
@@ -513,8 +481,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
stackParams = heat.validateStackParams (stackParams, heatTemplate);
} catch (IllegalArgumentException e) {
String error = "Create Network: Configuration Error: " + e.getMessage ();
- LOGGER.error (MessageEnum.RA_CONFIG_EXC, e.getMessage(), "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception - Create Network, Configuration Error", e);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, error);
+ logger.error("{} {} {} ", MessageEnum.RA_CONFIG_EXC,
+ MsoLogger.ErrorCode.DataError.getValue(), error,e);
// Input parameters were not valid
throw new NetworkException (error, MsoExceptionCategory.INTERNAL);
}
@@ -531,15 +499,10 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
} catch (MsoException me) {
me.addContext (CREATE_NETWORK_CONTEXT);
- String error = "Create Network (heat): type " + neutronNetworkType
- + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + me;
- LOGGER.error (MessageEnum.RA_CREATE_NETWORK_EXC, neutronNetworkType.toString(), cloudSiteId, tenantId, "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception Create Network, merging subnets", me);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, error);
+ logger
+ .error("{} {} Exception Create Network, merging subnets for network (heat) type {} in {}/{} ",
+ MessageEnum.RA_CREATE_NETWORK_EXC, MsoLogger.ErrorCode.DataError.getValue(),
+ neutronNetworkType.toString(), cloudSiteId, tenantId, me);
throw new NetworkException (me);
}
}
@@ -549,15 +512,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
mergePolicyRefs (policyFqdns, stackParams);
} catch (MsoException me) {
me.addContext (CREATE_NETWORK_CONTEXT);
- String error = "Create Network (heat) mergePolicyRefs type " + neutronNetworkType
- + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + me;
- LOGGER.error (MessageEnum.RA_CREATE_NETWORK_EXC, neutronNetworkType.toString(), cloudSiteId, tenantId, "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception Create Network, merging policyRefs", me);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, error);
+ logger.error("{} {} Exception Create Network, merging policyRefs type {} in {}/{} ",
+ MessageEnum.RA_CREATE_NETWORK_EXC, MsoLogger.ErrorCode.DataError.getValue(),
+ neutronNetworkType.toString(), cloudSiteId, tenantId, me);
throw new NetworkException (me);
}
}
@@ -567,15 +524,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
mergeRouteTableRefs (routeTableFqdns, stackParams);
} catch (MsoException me) {
me.addContext (CREATE_NETWORK_CONTEXT);
- String error = "Create Network (heat) mergeRouteTableRefs type " + neutronNetworkType
- + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + me;
- LOGGER.error (MessageEnum.RA_CREATE_NETWORK_EXC, neutronNetworkType.toString(), cloudSiteId, tenantId, "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception Create Network, merging routeTableRefs", me);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, error);
+ logger.error("{} {} Exception Create Network, merging routeTableRefs type {} in {}/{} ",
+ MessageEnum.RA_CREATE_NETWORK_EXC, MsoLogger.ErrorCode.DataError.getValue(),
+ neutronNetworkType.toString(), cloudSiteId, tenantId, me);
throw new NetworkException (me);
}
}
@@ -598,15 +549,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
backout.booleanValue());
} catch (MsoException me) {
me.addContext (CREATE_NETWORK_CONTEXT);
- String error = "Create Network (heat): type " + neutronNetworkType
- + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + me;
- LOGGER.error (MessageEnum.RA_CREATE_NETWORK_EXC, networkName, cloudSiteId, tenantId, "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception creating network", me);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ logger
+ .error("{} {} Exception creating network type {} in {}/{} ", MessageEnum.RA_CREATE_NETWORK_EXC,
+ MsoLogger.ErrorCode.DataError.getValue(), networkName, cloudSiteId, tenantId, me);
throw new NetworkException (me);
}
@@ -648,10 +593,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
networkRollback.setNetworkCreated (true);
networkRollback.setNetworkType (networkType);
- LOGGER.debug ("Network " + networkName + " successfully created via HEAT");
+ logger.debug("Network {} successfully created via HEAT", networkName);
}
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Suc, "Successfully created network");
return;
}
@@ -772,14 +716,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
Holder <NetworkRollback> rollback) throws NetworkException {
MsoLogger.setLogContext (msoRequest);
MsoLogger.setServiceName (UPDATE_NETWORK_CONTEXT);
- LOGGER.debug ("***UPDATE Network adapter with Network: " + networkName
- + " of type "
- + networkType
- + " in "
- + cloudSiteId
- + "/"
- + tenantId);
-
+ logger.debug("***UPDATE Network adapter with Network: {} of type {} in {}/{}", networkName, networkType,
+ cloudSiteId, tenantId);
// Will capture execution time for metrics
long startTime = System.currentTimeMillis ();
@@ -792,16 +730,12 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
Optional<CloudSite> cloudSiteOpt = cloudConfig.getCloudSite (cloudSiteId);
if (!cloudSiteOpt.isPresent()) {
- String error = "UpdateNetwork: Configuration Error. Stack " + networkName + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + " CloudSite does not exist in MSO Configuration";
- LOGGER.error (MessageEnum.RA_CONFIG_EXC, error, "Openstack", "", MsoLogger.ErrorCode.DataError, "CloudSite does not exist in MSO Configuration");
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, error);
- // Set the detailed error as the Exception 'message'
- throw new NetworkException (error, MsoExceptionCategory.USERDATA);
+ String error = String.format(
+ "UpdateNetwork: Configuration Error. Stack %s in %s/%s: CloudSite does not exist in MSO Configuration",
+ networkName, cloudSiteId, tenantId);
+ logger.error("{} {} {}", MessageEnum.RA_CONFIG_EXC, MsoLogger.ErrorCode.DataError.getValue(), error);
+ // Set the detailed error as the Exception 'message'
+ throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -830,30 +764,18 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
long queryNetworkStarttime = System.currentTimeMillis();
try {
netInfo = neutron.queryNetwork(networkId, tenantId, cloudSiteId);
- LOGGER.recordMetricEvent(queryNetworkStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "QueryNetwork", null);
} catch (MsoException me) {
me.addContext(UPDATE_NETWORK_CONTEXT);
- String error = "Update Network (neutron): query " + networkId
- + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + me;
- LOGGER.recordMetricEvent(queryNetworkStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryNetwork", null);
- LOGGER.error(MessageEnum.RA_QUERY_NETWORK_EXC, networkId, cloudSiteId, tenantId, "OpenStack", "QueryNetwork", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - queryNetwork", me);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ logger.error("{} {} Exception - queryNetwork query {} in {}/{} ", MessageEnum.RA_QUERY_NETWORK_EXC,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), networkId, cloudSiteId, tenantId, me);
throw new NetworkException(me);
}
if (netInfo == null) {
- String error = "Update Nework: Network " + networkId
- + " does not exist in "
- + cloudSiteId
- + "/"
- + tenantId;
- LOGGER.error(MessageEnum.RA_NETWORK_NOT_FOUND, networkId, cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.BusinessProcesssError, "Network not found");
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, error);
+ String error = String
+ .format("Update Nework: Network %s does not exist in %s/%s", networkId, cloudSiteId, tenantId);
+ logger.error("{} {} {}", MessageEnum.RA_NETWORK_NOT_FOUND,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), error);
// Does not exist. Throw an exception (can't update a non-existent network)
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -865,19 +787,10 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
neutronNetworkType,
physicalNetworkName,
vlans);
- LOGGER.recordMetricEvent(updateNetworkStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "UpdateNetwork", null);
} catch (MsoException me) {
me.addContext(UPDATE_NETWORK_CONTEXT);
- String error = "Update Network (neutron): " + networkId
- + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + me;
- LOGGER.error(MessageEnum.RA_UPDATE_NETWORK_ERR, networkId, cloudSiteId, tenantId, "Openstack", "updateNetwork", MsoLogger.ErrorCode.DataError, "Exception - updateNetwork", me);
- LOGGER.recordMetricEvent(updateNetworkStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "UpdateNetwork", null);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ logger.error("{} {} Exception - updateNetwork {} in {}/{} ", MessageEnum.RA_UPDATE_NETWORK_ERR,
+ MsoLogger.ErrorCode.DataError.getValue(), networkId, cloudSiteId, tenantId, me);
throw new NetworkException(me);
}
@@ -890,7 +803,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
networkRollback.setPhysicalNetwork(netInfo.getProvider());
networkRollback.setVlans(netInfo.getVlans());
- LOGGER.debug("Network " + networkId + " updated, id = " + netInfo.getId());
+ logger.debug("Network {} updated, id = {}", networkId, netInfo.getId());
} else if ("HEAT".equals(mode)) {
// First, look up to see that the Network already exists.
@@ -899,30 +812,18 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
long queryStackStarttime = System.currentTimeMillis();
try {
heatStack = heat.queryStack(cloudSiteId, tenantId, networkName);
- LOGGER.recordMetricEvent(queryStackStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "QueryStack", null);
} catch (MsoException me) {
me.addContext(UPDATE_NETWORK_CONTEXT);
- String error = "UpdateNetwork (heat): query " + networkName
- + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + me;
- LOGGER.recordMetricEvent(queryStackStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryStack", null);
- LOGGER.error(MessageEnum.RA_QUERY_NETWORK_EXC, networkId, cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError, "Exception - QueryStack", me);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ logger.error("{} {} Exception - QueryStack query {} in {}/{} ", MessageEnum.RA_QUERY_NETWORK_EXC,
+ MsoLogger.ErrorCode.DataError.getValue(), networkId, cloudSiteId, tenantId, me);
throw new NetworkException(me);
}
if (heatStack == null || (heatStack.getStatus() == HeatStatus.NOTFOUND)) {
- String error = "UpdateNetwork: Stack " + networkName
- + " does not exist in "
- + cloudSiteId
- + "/"
- + tenantId;
- LOGGER.error(MessageEnum.RA_NETWORK_NOT_FOUND, networkId, cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError, "Network not found");
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, error);
+ String error = String
+ .format("UpdateNetwork: Stack %s does not exist in %s/%s", networkName, cloudSiteId, tenantId);
+ logger.error("{} {} {}", MessageEnum.RA_NETWORK_NOT_FOUND, MsoLogger.ErrorCode.DataError.getValue(),
+ error);
// Network stack does not exist. Return an error
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -940,11 +841,12 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
try {
previousVlans.add(Integer.parseInt(vlan));
} catch (NumberFormatException e) {
- LOGGER.warn(MessageEnum.RA_VLAN_PARSE, networkId, vlansParam, "", MsoLogger.ErrorCode.DataError, "Exception - VLAN parse", e);
+ logger.warn("{} {} Exception - VLAN parse for params {} ", MessageEnum.RA_VLAN_PARSE,
+ MsoLogger.ErrorCode.DataError.getValue(), vlansParam, e);
}
}
}
- LOGGER.debug("Update Stack: Previous VLANS: " + previousVlans);
+ logger.debug("Update Stack: Previous VLANS: {}", previousVlans);
// Ready to deploy the updated Network via Heat
@@ -952,13 +854,12 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
HeatTemplate heatTemplate = networkResource.getHeatTemplate();
if (heatTemplate == null) {
String error = "Network error - undefined Heat Template. Network Type=" + networkType;
- LOGGER.error(MessageEnum.RA_PARAM_NOT_FOUND, "Heat Template", "Network Type", networkType, "OpenStack", "getHeatTemplate", MsoLogger.ErrorCode.DataError, "Network error - undefined Heat Template. Network Type=" + networkType);
-
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, error);
+ logger.error("{} {} {}", MessageEnum.RA_PARAM_NOT_FOUND, MsoLogger.ErrorCode.DataError.getValue(),
+ error);
throw new NetworkException(error, MsoExceptionCategory.INTERNAL);
}
- LOGGER.debug("Got HEAT Template from DB: " + heatTemplate.toString());
+ logger.debug("Got HEAT Template from DB: {}", heatTemplate.toString());
// "Fix" the template if it has CR/LF (getting this from Oracle)
String template = heatTemplate.getHeatTemplate();
@@ -988,9 +889,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
stackParams = heat.validateStackParams(stackParams, heatTemplate);
} catch (IllegalArgumentException e) {
String error = "UpdateNetwork: Configuration Error: Network Type=" + networkType;
- LOGGER.error(MessageEnum.RA_CONFIG_EXC, "Network Type=" + networkType, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception - UpdateNetwork: Configuration Error");
-
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, error);
+ logger.error("{} {} {} ", MessageEnum.RA_CONFIG_EXC, MsoLogger.ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.INTERNAL, e);
}
@@ -1003,15 +902,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
} catch (MsoException me) {
me.addContext(UPDATE_NETWORK_CONTEXT);
- String error = "Update Network (heat): type " + neutronNetworkType
- + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + me;
- LOGGER.error(MessageEnum.RA_UPDATE_NETWORK_ERR, neutronNetworkType.toString(), cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception - UpdateNetwork mergeSubnets ", me);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, error);
+ logger.error("{} {} Exception - UpdateNetwork mergeSubnets for network type {} in {}/{} ",
+ MessageEnum.RA_UPDATE_NETWORK_ERR, MsoLogger.ErrorCode.DataError.getValue(),
+ neutronNetworkType.toString(), cloudSiteId, tenantId, me);
throw new NetworkException(me);
}
}
@@ -1021,15 +914,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
mergePolicyRefs(policyFqdns, stackParams);
} catch (MsoException me) {
me.addContext(UPDATE_NETWORK_CONTEXT);
- String error = "UpdateNetwork (heat) mergePolicyRefs type " + neutronNetworkType
- + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + me;
- LOGGER.error(MessageEnum.RA_UPDATE_NETWORK_ERR, neutronNetworkType.toString(), cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception - UpdateNetwork mergePolicyRefs", me);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, error);
+ logger.error("{} {} Exception - UpdateNetwork mergePolicyRefs type {} in {}/{} ",
+ MessageEnum.RA_UPDATE_NETWORK_ERR, MsoLogger.ErrorCode.DataError.getValue(),
+ neutronNetworkType.toString(), cloudSiteId, tenantId, me);
throw new NetworkException(me);
}
}
@@ -1039,15 +926,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
mergeRouteTableRefs(routeTableFqdns, stackParams);
} catch (MsoException me) {
me.addContext(UPDATE_NETWORK_CONTEXT);
- String error = "UpdateNetwork (heat) mergeRouteTableRefs type " + neutronNetworkType
- + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + me;
- LOGGER.error(MessageEnum.RA_UPDATE_NETWORK_ERR, neutronNetworkType.toString(), cloudSiteId, tenantId, "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception - UpdateNetwork mergeRouteTableRefs", me);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, error);
+ logger.error("{} {} Exception - UpdateNetwork mergeRouteTableRefs type {} in {}/{} ",
+ MessageEnum.RA_UPDATE_NETWORK_ERR, MsoLogger.ErrorCode.DataError.getValue(),
+ neutronNetworkType.toString(), cloudSiteId, tenantId, me);
throw new NetworkException(me);
}
}
@@ -1063,13 +944,10 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
stackParams,
true,
heatTemplate.getTimeoutMinutes());
- LOGGER.recordMetricEvent(updateStackStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "UpdateStack", null);
} catch (MsoException me) {
me.addContext(UPDATE_NETWORK_CONTEXT);
- String error = "Update Network: " + networkId + " in " + cloudSiteId + "/" + tenantId + ": " + me;
- LOGGER.recordMetricEvent(updateStackStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "UpdateStack", null);
- LOGGER.error(MessageEnum.RA_UPDATE_NETWORK_ERR, networkId, cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception - update network", me);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ logger.error("{} {} Exception - update network {} in {}/{} ", MessageEnum.RA_UPDATE_NETWORK_ERR,
+ MsoLogger.ErrorCode.DataError.getValue(), networkId, cloudSiteId, tenantId, me);
throw new NetworkException(me);
}
@@ -1100,7 +978,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
networkRollback.setNeutronNetworkId((String) outputs.get(NETWORK_ID));
}
else {
- LOGGER.debug("outputs is NULL");
+ logger.debug("outputs is NULL");
}
networkRollback.setNetworkType(networkType);
// Save previous parameters
@@ -1110,10 +988,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
rollback.value = networkRollback;
- LOGGER.debug("Network " + networkId + " successfully updated via HEAT");
+ logger.debug("Network {} successfully updated via HEAT", networkId);
}
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully updated network");
return;
}
@@ -1141,30 +1018,23 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
}
if(networkCust != null){
- LOGGER.debug("Got Network Customization definition from Catalog: "
- + networkCust.toString());
+ logger.debug("Got Network Customization definition from Catalog: {}", networkCust.toString());
networkResource = networkCust.getNetworkResource();
} else if (collectionNetworkCust != null) {
- LOGGER.debug("Retrieved Collection Network Resource Customization from Catalog: "
- + collectionNetworkCust.toString());
+ logger.debug("Retrieved Collection Network Resource Customization from Catalog: {}",
+ collectionNetworkCust.toString());
networkResource = collectionNetworkCust.getNetworkResource();
}
if (networkResource == null) {
- String error = "Create/UpdateNetwork: Unable to get network resource with NetworkType:"
- + networkType
- + " or ModelCustomizationUUID:"
- + modelCustomizationUuid;
- LOGGER.error(MessageEnum.RA_UNKOWN_PARAM,
- "NetworkType/ModelCustomizationUUID", networkType + "/"
- + modelCustomizationUuid, "OpenStack", "",
- MsoLogger.ErrorCode.DataError,
- "Create/UpdateNetwork: Unknown NetworkType/ModelCustomizationUUID");
+ String error = String.format(
+ "Create/UpdateNetwork: Unable to get network resource with NetworkType: %s or ModelCustomizationUUID:%s",
+ networkType, modelCustomizationUuid);
+ logger.error("{} {} {} ", MessageEnum.RA_UNKOWN_PARAM, MsoLogger.ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
- }
- LOGGER.debug("Got Network definition from Catalog: "
- + networkResource.toString());
+ }
+ logger.debug("Got Network definition from Catalog: {}", networkResource.toString());
String mode = networkResource.getOrchestrationMode();
NetworkType neutronNetworkType = NetworkType
@@ -1172,12 +1042,10 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// All Networks are orchestrated via HEAT or Neutron
if (!("HEAT".equals(mode) || NEUTRON_MODE.equals(mode))) {
- String error = "CreateNetwork: Configuration Error: Network Type = "
- + networkType;
- LOGGER.error(MessageEnum.RA_NETWORK_ORCHE_MODE_NOT_SUPPORT,
- mode, "OpenStack", "", MsoLogger.ErrorCode.DataError,
- "CreateNetwork: Configuration Error");
- throw new NetworkException(error, MsoExceptionCategory.INTERNAL);
+ String error = "CreateNetwork: Configuration Error: Network Type = " + networkType;
+ logger.error("{} {} {}", MessageEnum.RA_NETWORK_ORCHE_MODE_NOT_SUPPORT,
+ MsoLogger.ErrorCode.DataError.getValue(), error);
+ throw new NetworkException(error, MsoExceptionCategory.INTERNAL);
}
MavenLikeVersioning aicV = new MavenLikeVersioning();
@@ -1191,22 +1059,15 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
.isMoreRecentThan(networkResource
.getAicVersionMax())))) // aic <= max
{
- LOGGER.debug("Network Type:" + networkType + " VersionMin:"
- + networkResource.getAicVersionMin() + " VersionMax:"
- + networkResource.getAicVersionMax()
- + " supported on Cloud:" + cloudSiteId
- + " with AIC_Version:" + cloudSite.getCloudVersion());
+ logger.debug("Network Type:{} VersionMin:{} VersionMax:{} supported on Cloud:{} with AIC_Version:{}",
+ networkType, networkResource.getAicVersionMin(), networkResource.getAicVersionMax(), cloudSiteId,
+ cloudSite.getCloudVersion());
} else {
- String error = "Network Type:" + networkType + " Version_Min:"
- + networkResource.getAicVersionMin() + " Version_Max:"
- + networkResource.getAicVersionMax()
- + " not supported on Cloud:" + cloudSiteId
- + " with AIC_Version:" + cloudSite.getCloudVersion();
- LOGGER.error(MessageEnum.RA_CONFIG_EXC, error, "OpenStack", "",
- MsoLogger.ErrorCode.DataError,
- "Network Type not supported on Cloud");
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
- MsoLogger.ResponseCode.DataError, error);
+ String error = String
+ .format("Network Type:%s Version_Min:%s Version_Max:%s not supported on Cloud:%s with AIC_Version:%s",
+ networkType, networkType, networkResource.getAicVersionMin(),
+ networkResource.getAicVersionMax(), cloudSiteId, cloudSite.getCloudVersion());
+ logger.error("{} {} {} ", MessageEnum.RA_CONFIG_EXC, MsoLogger.ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -1215,9 +1076,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
networkName, physicalNetworkName, vlans, routeTargets);
if (!missing.isEmpty()) {
String error = "Create Network: Missing parameters: " + missing;
- LOGGER.error(MessageEnum.RA_MISSING_PARAM, missing,
- "OpenStack", "", MsoLogger.ErrorCode.DataError,
- "Create Network: Missing parameters");
+ logger.error("{} {} {}", MessageEnum.RA_MISSING_PARAM, MsoLogger.ErrorCode.DataError.getValue(), error);
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
@@ -1293,11 +1152,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
Holder <Map <String, String>> subnetIdMap) throws NetworkException {
MsoLogger.setLogContext (msoRequest);
MsoLogger.setServiceName ("QueryNetwork");
- LOGGER.debug ("*** QUERY Network with Network: " + networkNameOrId
- + " in "
- + cloudSiteId
- + "/"
- + tenantId);
+ logger.debug("*** QUERY Network with Network: {} in {}/{}", networkNameOrId, cloudSiteId, tenantId);
// Will capture execution time for metrics
long startTime = System.currentTimeMillis ();
@@ -1307,22 +1162,17 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
|| commonUtils.isNullOrEmpty(networkNameOrId)) {
String error = "Missing mandatory parameter cloudSiteId, tenantId or networkId";
- LOGGER.error (MessageEnum.RA_MISSING_PARAM, "cloudSiteId or tenantId or networkNameOrId", "OpenStack", "", MsoLogger.ErrorCode.DataError, "Missing mandatory parameter cloudSiteId, tenantId or networkId");
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, error);
+ logger.error("{} {} {}", MessageEnum.RA_MISSING_PARAM, MsoLogger.ErrorCode.DataError.getValue(), error);
throw new NetworkException (error, MsoExceptionCategory.USERDATA);
}
Optional<CloudSite> cloudSiteOpt = cloudConfig.getCloudSite(cloudSiteId);
if (!cloudSiteOpt.isPresent())
{
- String error = "Configuration Error. Stack " + networkNameOrId + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + " CloudSite does not exist in MSO Configuration";
- LOGGER.error (MessageEnum.RA_CONFIG_EXC, error, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Configuration Error");
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, error);
+ String error = String
+ .format("Configuration Error. Stack %s in %s/%s: CloudSite does not exist in MSO Configuration",
+ networkNameOrId, cloudSiteId, tenantId);
+ logger.error("{} {} {}", MessageEnum.RA_CONFIG_EXC, MsoLogger.ErrorCode.DataError.getValue(), error);
// Set the detailed error as the Exception 'message'
throw new NetworkException (error, MsoExceptionCategory.USERDATA);
}
@@ -1336,19 +1186,10 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
long queryStackStarttime = System.currentTimeMillis ();
try {
heatStack = heat.queryStack (cloudSiteId, tenantId, networkNameOrId);
- LOGGER.recordMetricEvent (queryStackStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "QueryStack", null);
} catch (MsoException me) {
me.addContext ("QueryNetwork");
- String error = "Query Network (heat): " + networkNameOrId
- + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + me;
- LOGGER.recordMetricEvent (queryStackStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "BPMN", "QueryStack", null);
- LOGGER.error (MessageEnum.RA_QUERY_NETWORK_EXC, networkNameOrId, cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError, "Exception - Query Network (heat)", me);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ logger.error("{} {} Exception - Query Network (heat): {} in {}/{} ", MessageEnum.RA_QUERY_NETWORK_EXC,
+ MsoLogger.ErrorCode.DataError.getValue(), networkNameOrId, cloudSiteId, tenantId, me);
throw new NetworkException (me);
}
@@ -1388,7 +1229,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
long queryNetworkStarttime = System.currentTimeMillis ();
try {
NetworkInfo netInfo = neutron.queryNetwork (neutronId, tenantId, cloudSiteId);
- LOGGER.recordMetricEvent (queryNetworkStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "QueryNetwork", null);
if (netInfo != null) {
// Found. Populate the output elements
networkExists.value = Boolean.TRUE;
@@ -1402,12 +1242,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
if (vlans != null)
vlans.value = netInfo.getVlans ();
- LOGGER.debug ("Network " + networkNameOrId
- + " found ("
- + mode
- + "), ID = "
- + networkId.value
- + ("HEAT".equals (mode) ? ",NeutronId = " + neutronNetworkId.value : ""));
+ logger.debug("Network {} found({}), ID = {}{}", networkNameOrId, mode, networkId.value,
+ ("HEAT".equals(mode) ? ",NeutronId = " + neutronNetworkId.value : ""));
} else {
// Not found. Populate the status fields, leave the rest null
networkExists.value = Boolean.FALSE;
@@ -1416,23 +1252,14 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
if (vlans != null)
vlans.value = new ArrayList<>();
- LOGGER.debug ("Network " + networkNameOrId + " not found");
+ logger.debug("Network {} not found", networkNameOrId);
}
} catch (MsoException me) {
me.addContext ("QueryNetwork");
- String error = "Query Network (neutron): " + networkNameOrId
- + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + me;
- LOGGER.recordMetricEvent (queryNetworkStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryNetwork", null);
- LOGGER.error (MessageEnum.RA_QUERY_NETWORK_EXC, networkNameOrId, cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception - Query Network (neutron)", me);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ logger.error("{} {} Exception - Query Network (neutron): {} in {}/{} ", MessageEnum.RA_QUERY_NETWORK_EXC,
+ MsoLogger.ErrorCode.DataError.getValue(), networkNameOrId, cloudSiteId, tenantId, me);
throw new NetworkException (me);
}
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully queried network");
return;
}
@@ -1464,11 +1291,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
Holder <Boolean> networkDeleted) throws NetworkException {
MsoLogger.setLogContext (msoRequest);
MsoLogger.setServiceName ("DeleteNetwork");
- LOGGER.debug ("*** DELETE Network adapter with Network: " + networkId
- + " in "
- + cloudSiteId
- + "/"
- + tenantId);
+ logger.debug("*** DELETE Network adapter with Network: {} in {}/{}", networkId, cloudSiteId, tenantId);
// Will capture execution time for metrics
long startTime = System.currentTimeMillis ();
@@ -1478,8 +1301,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
|| commonUtils.isNullOrEmpty(tenantId)
|| commonUtils.isNullOrEmpty(networkId)) {
String error = "Missing mandatory parameter cloudSiteId, tenantId or networkId";
- LOGGER.error (MessageEnum.RA_MISSING_PARAM, "cloudSiteId or tenantId or networkId", "Openstack", "", MsoLogger.ErrorCode.DataError, "Missing mandatory parameter cloudSiteId, tenantId or networkId");
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, error);
+ logger.error("{} {} {} ", MessageEnum.RA_MISSING_PARAM, MsoLogger.ErrorCode.DataError.getValue(), error);
throw new NetworkException (error, MsoExceptionCategory.USERDATA);
}
@@ -1499,7 +1321,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
String mode = "";
if (networkResource != null) {
- LOGGER.debug ("Got Network definition from Catalog: " + networkResource.toString ());
+ logger.debug("Got Network definition from Catalog: {}", networkResource.toString());
mode = networkResource.getOrchestrationMode ();
}
@@ -1512,20 +1334,11 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// The deleteNetwork function in MsoNeutronUtils returns success if the network
// was not found. So don't bother to query first.
boolean deleted = neutron.deleteNetwork (networkId, tenantId, cloudSiteId);
- LOGGER.recordMetricEvent (deleteNetworkStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "DeleteNetwork", null);
networkDeleted.value = deleted;
} catch (MsoException me) {
me.addContext ("DeleteNetwork");
- String error = "Delete Network (neutron): " + networkId
- + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + me;
- LOGGER.recordMetricEvent (deleteNetworkStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "DeleteNetwork", null);
- LOGGER.error (MessageEnum.RA_DELETE_NETWORK_EXC, networkId, cloudSiteId, tenantId, "Openstack", "", MsoLogger.ErrorCode.DataError, "Delete Network (neutron)", me);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ logger.error("{} {} Delete Network (neutron): {} in {}/{} ", MessageEnum.RA_DELETE_NETWORK_EXC,
+ MsoLogger.ErrorCode.DataError.getValue(), networkId, cloudSiteId, tenantId, me);
throw new NetworkException (me);
}
} else { // DEFAULT to ("HEAT".equals (mode))
@@ -1539,7 +1352,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
if (heatStack != null && heatStack.getStatus() != HeatStatus.NOTFOUND)
{
heat.deleteStack (tenantId, cloudSiteId, networkId, true);
- LOGGER.recordMetricEvent (deleteStackStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "DeleteStack", null);
networkDeleted.value = true;
}
else
@@ -1548,23 +1360,14 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
} catch (MsoException me) {
me.addContext ("DeleteNetwork");
- String error = "Delete Network (heat): " + networkId
- + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + me;
- LOGGER.recordMetricEvent (deleteStackStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "DeleteStack", null);
- LOGGER.error (MessageEnum.RA_DELETE_NETWORK_EXC, networkId, cloudSiteId, tenantId, "Openstack", "", MsoLogger.ErrorCode.DataError, "Delete Network (heat)", me);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ logger.error("{} {} Delete Network (heat): {} in {}/{} ", MessageEnum.RA_DELETE_NETWORK_EXC,
+ MsoLogger.ErrorCode.DataError.getValue(), networkId, cloudSiteId, tenantId, me);
throw new NetworkException (me);
}
}
// On success, nothing is returned.
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully deleted network");
return;
}
@@ -1584,8 +1387,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
long startTime = System.currentTimeMillis ();
if (rollback == null) {
- LOGGER.error (MessageEnum.RA_ROLLBACK_NULL, "Openstack", "", MsoLogger.ErrorCode.DataError, "rollback is null");
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, "No action to perform");
+ logger
+ .error("{} {} rollback is null", MessageEnum.RA_ROLLBACK_NULL, MsoLogger.ErrorCode.DataError.getValue());
return;
}
@@ -1598,9 +1401,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
String networkType = rollback.getNetworkType ();
String modelCustomizationUuid = rollback.getModelCustomizationUuid();
- LOGGER.debug ("*** ROLLBACK Network " + networkId + " in " + cloudSiteId + "/" + tenantId);
+ logger.debug("*** ROLLBACK Network {} in {}/{}", networkId, cloudSiteId, tenantId);
-
// Retrieve the Network Resource definition
NetworkResource networkResource = null;
@@ -1612,7 +1414,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
String mode = "";
if (networkResource != null) {
- LOGGER.debug ("Got Network definition from Catalog: " + networkResource.toString ());
+ logger.debug("Got Network definition from Catalog: {}", networkResource.toString());
mode = networkResource.getOrchestrationMode ();
}
@@ -1626,19 +1428,11 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// The deleteNetwork function in MsoNeutronUtils returns success if the network
// was not found. So don't bother to query first.
neutron.deleteNetwork (networkId, tenantId, cloudSiteId);
- LOGGER.recordMetricEvent (deleteNetworkStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "DeleteNetwork", null);
} catch (MsoException me) {
me.addContext ("RollbackNetwork");
- String error = "Rollback Network (neutron): " + networkId
- + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + me;
- LOGGER.recordMetricEvent (deleteNetworkStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "DeleteNetwork", null);
- LOGGER.error (MessageEnum.RA_DELETE_NETWORK_EXC, networkId, cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - Rollback Network (neutron)", me);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ logger.error("{} {} Exception - Rollback Network (neutron): {} in {}/{} ",
+ MessageEnum.RA_DELETE_NETWORK_EXC, MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ networkId, cloudSiteId, tenantId, me);
throw new NetworkException (me);
}
} else { // DEFAULT to if ("HEAT".equals (mode))
@@ -1647,25 +1441,16 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// The deleteStack function in MsoHeatUtils returns success if the stack
// was not found. So don't bother to query first.
heat.deleteStack (tenantId, cloudSiteId, networkId, true);
- LOGGER.recordMetricEvent (deleteStackStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "DeleteStack", null);
} catch (MsoException me) {
me.addContext ("RollbackNetwork");
- String error = "Rollback Network (heat): " + networkId
- + " in "
- + cloudSiteId
- + "/"
- + tenantId
- + ": "
- + me;
- LOGGER.recordMetricEvent (deleteStackStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "DeleteStack", null);
- LOGGER.error (MessageEnum.RA_DELETE_NETWORK_EXC, networkId, cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - Rollback Network (heat)", me);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ logger.error("{} {} Exception - Rollback Network (heat): {} in {}/{} ",
+ MessageEnum.RA_DELETE_NETWORK_EXC, MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ networkId, cloudSiteId, tenantId, me);
throw new NetworkException (me);
}
}
}
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully rolled back network");
return;
}
@@ -1740,7 +1525,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
{
String routeTarget = rt.getRouteTarget();
String routeTargetRole = rt.getRouteTargetRole();
- LOGGER.debug("Checking for an actually null route target: " + rt.toString());
+ logger.debug("Checking for an actually null route target: {}", rt);
if (routeTarget == null || routeTarget.equals("") || routeTarget.equalsIgnoreCase("null"))
rtIsNull = true;
if (routeTargetRole == null || routeTargetRole.equals("") || routeTargetRole.equalsIgnoreCase("null"))
@@ -1749,7 +1534,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
rtIsNull = true;
}
if (!rtIsNull) {
- LOGGER.debug("Input RT:" + rt.toString());
+ logger.debug("Input RT:{}", rt);
String role = rt.getRouteTargetRole();
String rtValue = rt.getRouteTarget();
@@ -1827,7 +1612,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
ContrailPolicyRefSeq refSeq = new ContrailPolicyRefSeq(String.valueOf(index), "0");
pr.setSeq(refSeq);
index++;
- LOGGER.debug("Contrail PolicyRefs Data:" + pr.toString());
+ logger.debug("Contrail PolicyRefs Data:{}", pr);
prlist.add(pr);
}
}
@@ -1838,12 +1623,13 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
ObjectMapper mapper = new ObjectMapper();
node = mapper.convertValue(prlist, JsonNode.class);
String jsonString = mapper.writeValueAsString(prlist);
- LOGGER.debug("Json PolicyRefs Data:" + jsonString);
+ logger.debug("Json PolicyRefs Data:{}", jsonString);
}
catch (Exception e)
{
String error = "Error creating JsonNode for policyRefs Data";
- LOGGER.error (MessageEnum.RA_MARSHING_ERROR, error, "Openstack", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception creating JsonNode for policyRefs Data", e);
+ logger.error("{} {} {} ", MessageEnum.RA_MARSHING_ERROR, MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ error, e);
throw new MsoAdapterException (error);
}
//update parameters
@@ -1863,7 +1649,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
stackParams.put ("policy_refsdata", node);
}
- LOGGER.debug ("StackParams updated with policy refs");
+ logger.debug("StackParams updated with policy refs");
return;
}
@@ -1885,7 +1671,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
stackParams.put ("route_table_refs", csl);
}
- LOGGER.debug ("StackParams updated with route_table refs");
+ logger.debug("StackParams updated with route_table refs");
return;
}
@@ -1948,9 +1734,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
//Resource Property
List<ContrailSubnet> cslist = new ArrayList <> ();
for (Subnet subnet : subnets) {
- LOGGER.debug("Input Subnet:" + subnet.toString());
+ logger.debug("Input Subnet:{}", subnet.toString());
ContrailSubnet cs = new ContrailSubnetMapper(subnet).map();
- LOGGER.debug("Contrail Subnet:" + cs.toString());
+ logger.debug("Contrail Subnet:{}", cs.toString());
cslist.add(cs);
}
@@ -1960,12 +1746,12 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
ObjectMapper mapper = new ObjectMapper();
node = mapper.convertValue(cslist, JsonNode.class);
String jsonString = mapper.writeValueAsString(cslist);
- LOGGER.debug("Json Subnet List:" + jsonString);
+ logger.debug("Json Subnet List:{}", jsonString);
}
catch (Exception e)
{
String error = "Error creating JsonNode from input subnets";
- LOGGER.error (MessageEnum.RA_MARSHING_ERROR, error, "", "", MsoLogger.ErrorCode.DataError, "Exception creating JsonNode from input subnets", e);
+ logger.error("{} {} {} ", MessageEnum.RA_MARSHING_ERROR, MsoLogger.ErrorCode.DataError.getValue(), error, e);
throw new MsoAdapterException (error);
}
//update parameters
@@ -1980,7 +1766,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// append outputs in heatTemplate
int outputsIdx = heatTemplate.indexOf ("outputs:");
heatTemplate = insertStr (heatTemplate, outputTempl, outputsIdx + 8);
- LOGGER.debug ("Template updated with all AIC3.0 subnets:" + heatTemplate);
+ logger.debug("Template updated with all AIC3.0 subnets:{}", heatTemplate);
return heatTemplate;
}
@@ -2018,7 +1804,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
curR = curR.replace ("%subnetId%", subnet.getSubnetId ());
} else {
String error = "Missing Required AAI SubnetId for subnet in HEAT Template";
- LOGGER.error (MessageEnum.RA_MISSING_PARAM, error, "Openstack", "", MsoLogger.ErrorCode.DataError, "Missing Required AAI ID for subnet in HEAT Template");
+ logger.error("{} {} {} ", MessageEnum.RA_MISSING_PARAM, MsoLogger.ErrorCode.DataError.getValue(), error);
throw new MsoAdapterException (error);
}
@@ -2032,7 +1818,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
curR = curR.replace ("%cidr%", subnet.getCidr ());
} else {
String error = "Missing Required cidr for subnet in HEAT Template";
- LOGGER.error (MessageEnum.RA_MISSING_PARAM, error, "Openstack", "", MsoLogger.ErrorCode.DataError, "Missing Required cidr for subnet in HEAT Template");
+ logger.error("{} {} {} ", MessageEnum.RA_MISSING_PARAM, MsoLogger.ErrorCode.DataError.getValue(), error);
throw new MsoAdapterException (error);
}
@@ -2067,13 +1853,13 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
// append resources and outputs in heatTemplate
- LOGGER.debug ("Tempate initial:" + heatTemplate);
+ logger.debug("Tempate initial:{}", heatTemplate);
int outputsIdx = heatTemplate.indexOf ("outputs:");
heatTemplate = insertStr (heatTemplate, outputsBuf.toString (), outputsIdx + 8);
int resourcesIdx = heatTemplate.indexOf ("resources:");
heatTemplate = insertStr (heatTemplate, resourcesBuf.toString (), resourcesIdx + 10);
- LOGGER.debug ("Template updated with all subnets:" + heatTemplate);
+ logger.debug("Template updated with all subnets:{}", heatTemplate);
return heatTemplate;
}
@@ -2085,12 +1871,12 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
Object obj = outputs.get(key);
ObjectMapper mapper = new ObjectMapper();
String jStr = mapper.writeValueAsString(obj);
- LOGGER.debug ("Subnet_Ipam Output JSON String:" + obj.getClass() + " " + jStr);
+ logger.debug("Subnet_Ipam Output JSON String:{} {}", obj.getClass(), jStr);
JsonNode rootNode = mapper.readTree(jStr);
for (JsonNode sNode : rootNode.path("ipam_subnets"))
{
- LOGGER.debug("Output Subnet Node" + sNode.toString());
+ logger.debug("Output Subnet Node {}", sNode.toString());
String name = sNode.path("subnet_name").textValue();
String uuid = sNode.path("subnet_uuid").textValue();
String aaiId = name; // default
@@ -2114,10 +1900,11 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
catch (Exception e)
{
- LOGGER.error (MessageEnum.RA_MARSHING_ERROR, "error getting subnet-uuids", "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception getting subnet-uuids", e);
+ logger.error("{} {} Exception getting subnet-uuids ", MessageEnum.RA_MARSHING_ERROR,
+ MsoLogger.ErrorCode.DataError.getValue(), e);
}
- LOGGER.debug ("Return sMap" + sMap.toString());
+ logger.debug("Return sMap {}", sMap.toString());
return sMap;
}
@@ -2125,14 +1912,14 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
String updatedTemplate;
- LOGGER.debug ("Index:" + index + " Snippet:" + snippet);
+ logger.debug("Index:{} Snippet:{}", index, snippet);
String templateBeg = template.substring (0, index);
String templateEnd = template.substring (index);
updatedTemplate = templateBeg + "\n" + snippet + templateEnd;
- LOGGER.debug ("Template updated with a subnet:" + updatedTemplate);
+ logger.debug("Template updated with a subnet:{}", updatedTemplate);
return updatedTemplate;
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java
index fd658244ee..27b2b6a163 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -22,10 +24,14 @@
package org.onap.so.adapters.network;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
import javax.inject.Provider;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
@@ -40,7 +46,6 @@ import javax.ws.rs.core.GenericEntity;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.xml.ws.Holder;
-
import org.apache.http.HttpStatus;
import org.onap.so.adapters.network.exceptions.NetworkException;
import org.onap.so.adapters.nwrest.ContrailNetwork;
@@ -67,25 +72,21 @@ import org.onap.so.openstack.beans.NetworkRollback;
import org.onap.so.openstack.beans.NetworkStatus;
import org.onap.so.openstack.beans.RouteTarget;
import org.onap.so.openstack.exceptions.MsoExceptionCategory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
-
@Path("/v1/networks")
@Api(value = "/v1/networks", description = "root of network adapters restful web service")
@Component
@Transactional
public class NetworkAdapterRest {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,NetworkAdapterRest.class);
+
+ private static final Logger logger = LoggerFactory.getLogger(NetworkAdapterRest.class);
private static final String TESTING_KEYWORD = "___TESTING___";
- private String APPEND_RESPONSE = ", resp=";
private String EXCEPTION = "Exception:";
@Autowired
@@ -109,7 +110,7 @@ public class NetworkAdapterRest {
public Response createNetwork(
@ApiParam(value = "details of network being created", required = true)
CreateNetworkRequest req) {
- LOGGER.debug("createNetwork enter: " + req.toJsonString());
+ logger.debug("createNetwork enter: {}", req.toJsonString());
CreateNetworkTask task = new CreateNetworkTask(req);
if (req.isSynchronous()) {
// This is a synchronous request
@@ -125,11 +126,12 @@ public class NetworkAdapterRest {
t1.start();
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
- LOGGER.error (MessageEnum.RA_CREATE_NETWORK_EXC, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception while create network", e);
+ logger.error("{} {} Exception while create network ", MessageEnum.RA_CREATE_NETWORK_EXC,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
return Response.serverError().build();
}
// send sync response (ACK) to caller
- LOGGER.debug ("createNetwork exit");
+ logger.debug("createNetwork exit");
return Response.status(HttpStatus.SC_ACCEPTED).build();
}
}
@@ -161,7 +163,7 @@ public class NetworkAdapterRest {
}
@Override
public void run() {
- LOGGER.debug ("CreateNetworkTask start");
+ logger.debug("CreateNetworkTask start");
try {
// Synchronous Web Service Outputs
Holder<String> networkId = new Holder<>();
@@ -269,7 +271,7 @@ public class NetworkAdapterRest {
rollback.value,
req.getMessageId());
} catch (NetworkException e) {
- LOGGER.debug (EXCEPTION, e);
+ logger.debug(EXCEPTION, e);
eresp = new CreateNetworkError(
e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId());
}
@@ -278,7 +280,7 @@ public class NetworkAdapterRest {
BpelRestClient bpelClient = bpelRestClientProvider.get();
bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
}
- LOGGER.debug ("CreateNetworkTask exit: code=" + getStatusCode() + APPEND_RESPONSE+ getResponse());
+ logger.debug("CreateNetworkTask exit: code={}, resp={}", getStatusCode(), getResponse());
}
}
@@ -299,7 +301,7 @@ public class NetworkAdapterRest {
@ApiParam(value = "details of network being deleted", required = true)
DeleteNetworkRequest req)
{
- LOGGER.debug("deleteNetwork enter: " + req.toJsonString());
+ logger.debug("deleteNetwork enter: {}", req.toJsonString());
if (aaiNetworkId == null || !aaiNetworkId.equals(req.getNetworkId())) {
return Response
.status(HttpStatus.SC_BAD_REQUEST)
@@ -322,11 +324,12 @@ public class NetworkAdapterRest {
t1.start();
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
- LOGGER.error (MessageEnum.RA_DELETE_NETWORK_EXC, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception while delete network", e);
+ logger.error("{} {} Exception while delete network ", MessageEnum.RA_DELETE_NETWORK_EXC,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
return Response.serverError().build();
}
// send sync response (ACK) to caller
- LOGGER.debug ("deleteNetwork exit");
+ logger.debug("deleteNetwork exit");
return Response.status(HttpStatus.SC_ACCEPTED).build();
}
}
@@ -358,7 +361,7 @@ public class NetworkAdapterRest {
}
@Override
public void run() {
- LOGGER.debug("DeleteNetworkTask start");
+ logger.debug("DeleteNetworkTask start");
try {
Holder<Boolean> networkDeleted = new Holder<>();
if (req.getCloudSiteId().equals(TESTING_KEYWORD)) {
@@ -375,7 +378,7 @@ public class NetworkAdapterRest {
}
response = new DeleteNetworkResponse(req.getNetworkId(), networkDeleted.value, req.getMessageId());
} catch (NetworkException e) {
- LOGGER.debug (EXCEPTION, e);
+ logger.debug(EXCEPTION, e);
eresp = new DeleteNetworkError(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId());
}
if (!req.isSynchronous()) {
@@ -383,7 +386,7 @@ public class NetworkAdapterRest {
BpelRestClient bpelClient = bpelRestClientProvider.get();
bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
}
- LOGGER.debug("DeleteNetworkTask exit: code=" + getStatusCode() + APPEND_RESPONSE+ getResponse());
+ logger.debug("DeleteNetworkTask exit: code={}, resp={}", getStatusCode(), getResponse());
}
}
@@ -413,7 +416,7 @@ public class NetworkAdapterRest {
@PathParam("aaiNetworkId") String aaiNetworkId)
{
//This request responds synchronously only
- LOGGER.debug ("Query network enter:" + aaiNetworkId);
+ logger.debug("Query network enter:{}" + aaiNetworkId);
MsoRequest msoRequest = new MsoRequest(requestId, serviceInstanceId);
try {
@@ -430,10 +433,10 @@ public class NetworkAdapterRest {
networkExists, networkId, neutronNetworkId, status, routeTargets, subnetIdMap);
if (!networkExists.value) {
- LOGGER.debug ("network not found");
+ logger.debug("network not found");
respStatus = HttpStatus.SC_NOT_FOUND;
} else {
- LOGGER.debug ("network found" + networkId.value + ", status=" + status.value);
+ logger.debug("network found {}, status={}", networkId.value, status.value);
resp.setNetworkExists(networkExists.value);
resp.setNetworkId(networkId.value);
resp.setNeutronNetworkId(neutronNetworkId.value);
@@ -441,13 +444,14 @@ public class NetworkAdapterRest {
resp.setRouteTargets(routeTargets.value);
resp.setSubnetIdMap(subnetIdMap.value);
}
- LOGGER.debug ("Query network exit");
+ logger.debug("Query network exit");
return Response
.status(respStatus)
.entity(new GenericEntity<QueryNetworkResponse>(resp) {})
.build();
} catch (NetworkException e) {
- LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, aaiNetworkId, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception when query VNF", e);
+ logger.error("{} {} Exception when query VNF ", MessageEnum.RA_QUERY_VNF_ERR,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
QueryNetworkError err = new QueryNetworkError();
err.setMessage(e.getMessage());
err.setCategory(MsoExceptionCategory.INTERNAL);
@@ -473,7 +477,7 @@ public class NetworkAdapterRest {
@ApiParam(value = "RollbackNetworkRequest in JSON format", required = true)
RollbackNetworkRequest req)
{
- LOGGER.debug("rollbackNetwork enter: " + req.toJsonString());
+ logger.debug("rollbackNetwork enter: {}", req.toJsonString());
RollbackNetworkTask task = new RollbackNetworkTask(req);
if (req.isSynchronous()) {
// This is a synchronous request
@@ -489,11 +493,12 @@ public class NetworkAdapterRest {
t1.start();
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
- LOGGER.error (MessageEnum.RA_ROLLBACK_NULL, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in rollbackNetwork", e);
+ logger.error("{} {} Exception in rollbackNetwork ", MessageEnum.RA_ROLLBACK_NULL,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
return Response.serverError().build();
}
// send sync response (ACK) to caller
- LOGGER.debug("rollbackNetwork exit");
+ logger.debug("rollbackNetwork exit");
return Response.status(HttpStatus.SC_ACCEPTED).build();
}
}
@@ -525,13 +530,13 @@ public class NetworkAdapterRest {
}
@Override
public void run() {
- LOGGER.debug("RollbackNetworkTask start");
+ logger.debug("RollbackNetworkTask start");
try {
NetworkRollback nwr = req.getNetworkRollback();
adapter.rollbackNetwork(nwr);
response = new RollbackNetworkResponse(true, req.getMessageId());
} catch (NetworkException e) {
- LOGGER.debug (EXCEPTION, e);
+ logger.debug(EXCEPTION, e);
eresp = new RollbackNetworkError(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId());
}
if (!req.isSynchronous()) {
@@ -539,7 +544,7 @@ public class NetworkAdapterRest {
BpelRestClient bpelClient = bpelRestClientProvider.get();
bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
}
- LOGGER.debug("RollbackNetworkTask exit: code=" + getStatusCode() + APPEND_RESPONSE+ getResponse());
+ logger.debug("RollbackNetworkTask exit: code={}, resp={}", getStatusCode(), getResponse());
}
}
@@ -560,7 +565,7 @@ public class NetworkAdapterRest {
@ApiParam(value = "UpdateNetworkRequest in JSON format", required = true)
UpdateNetworkRequest req)
{
- LOGGER.debug("updateNetwork enter: " + req.toJsonString());
+ logger.debug("updateNetwork enter: {}", req.toJsonString());
if (aaiNetworkId == null || !aaiNetworkId.equals(req.getNetworkId())) {
return Response
.status(HttpStatus.SC_BAD_REQUEST)
@@ -583,11 +588,12 @@ public class NetworkAdapterRest {
t1.start();
} catch (Exception e) {
// problem handling create, send generic failure as sync resp to caller
- LOGGER.error (MessageEnum.RA_UPDATE_NETWORK_ERR, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in updateNetwork", e);
+ logger.error("{} {} Exception in updateNetwork ", MessageEnum.RA_UPDATE_NETWORK_ERR,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
return Response.serverError().build();
}
// send sync response (ACK) to caller
- LOGGER.debug ("updateNetwork exit");
+ logger.debug("updateNetwork exit");
return Response.status(HttpStatus.SC_ACCEPTED).build();
}
}
@@ -619,7 +625,7 @@ public class NetworkAdapterRest {
}
@Override
public void run() {
- LOGGER.debug("UpdateNetworkTask start");
+ logger.debug("UpdateNetworkTask start");
try {
Holder<Map<String, String>> subnetIdMap = new Holder<>();
Holder<NetworkRollback> rollback = new Holder<> ();
@@ -709,7 +715,7 @@ public class NetworkAdapterRest {
subnetIdMap.value,
req.getMessageId());
} catch (NetworkException e) {
- LOGGER.debug (EXCEPTION, e);
+ logger.debug(EXCEPTION, e);
eresp = new UpdateNetworkError(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId());
}
if (!req.isSynchronous()) {
@@ -717,7 +723,7 @@ public class NetworkAdapterRest {
BpelRestClient bpelClient = bpelRestClientProvider.get();
bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
}
- LOGGER.debug("UpdateNetworkTask exit: code=" + getStatusCode() + APPEND_RESPONSE+ getResponse());
+ logger.debug("UpdateNetworkTask exit: code={}, resp={}", getStatusCode(), getResponse());
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java
index b86681ebfc..db9226bb19 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java
@@ -5,6 +5,7 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,12 +25,10 @@ package org.onap.so.adapters.tenant;
import java.util.Map;
-
import javax.annotation.Resource;
import javax.jws.WebService;
import javax.xml.ws.Holder;
import javax.xml.ws.WebServiceContext;
-
import org.onap.so.adapters.tenant.exceptions.TenantAlreadyExists;
import org.onap.so.adapters.tenant.exceptions.TenantException;
import org.onap.so.adapters.tenantrest.TenantRollback;
@@ -41,6 +40,8 @@ import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
import org.onap.so.openstack.exceptions.MsoException;
import org.onap.so.openstack.utils.MsoTenantUtils;
import org.onap.so.openstack.utils.MsoTenantUtilsFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -52,14 +53,13 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
public static final String QUERY_TENANT = "QueryTenant";
public static final String DELETE_TENANT = "DeleteTenant";
public static final String ROLLBACK_TENANT = "RollbackTenant";
- private static final String SUCCESS_RESPONSE_OPENSTACK="Successfully received response from Open Stack";
- private static final String OPENSTACK_COMMUNICATE_EXCEPTION_MSG="Exception while communicate with Open Stack";
+ private static final String OPENSTACK_COMMUNICATE_EXCEPTION_MSG = "{} {} Exception while communicate with Open Stack ";
@Resource
private WebServiceContext wsContext;
@Autowired
private MsoTenantUtilsFactory tFactory;
- private static MsoLogger logger = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,MsoTenantAdapterImpl.class);
+ private static Logger logger = LoggerFactory.getLogger(MsoTenantAdapterImpl.class);
/**
* Health Check web method. Does nothing but return to show the adapter is deployed.
*/
@@ -91,12 +91,7 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
MsoLogger.setLogContext (msoRequest);
MsoLogger.setServiceName (CREATE_TENANT);
- logger.debug ("Call to MSO createTenant adapter. Creating Tenant: " + tenantName
- + "in "
- + cloudSiteId);
-
- // Will capture total time for metrics
- long startTime = System.currentTimeMillis ();
+ logger.debug("Call to MSO createTenant adapter. Creating Tenant: {} in {}", tenantName, cloudSiteId);
// Start building up rollback object
TenantRollback tenantRollback = new TenantRollback ();
@@ -107,57 +102,47 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
try {
tUtils = tFactory.getTenantUtils (cloudSiteId);
} catch (MsoCloudSiteNotFound me) {
- logger.error (MessageEnum.RA_CREATE_TENANT_ERR, me.getMessage(), OPENSTACK, CREATE_TENANT, MsoLogger.ErrorCode.DataError, "no implementation found for " + cloudSiteId, me);
+ logger.error("{} {} no implementation found for {}: ", MessageEnum.RA_CREATE_TENANT_ERR,
+ MsoLogger.ErrorCode.DataError.getValue(), cloudSiteId, me);
throw new TenantException (me);
}
MsoTenant newTenant = null;
String newTenantId;
- long queryTenantStartTime = System.currentTimeMillis ();
try {
newTenant = tUtils.queryTenantByName (tenantName, cloudSiteId);
- logger.recordMetricEvent (queryTenantStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, SUCCESS_RESPONSE_OPENSTACK, OPENSTACK, QUERY_TENANT, null);
} catch (MsoException me) {
- logger.recordMetricEvent (queryTenantStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, OPENSTACK_COMMUNICATE_EXCEPTION_MSG, OPENSTACK, QUERY_TENANT, null);
- String error = "Create Tenant " + tenantName + ": " + me;
- logger.error (MessageEnum.RA_CREATE_TENANT_ERR, me.getMessage(), OPENSTACK, CREATE_TENANT, MsoLogger.ErrorCode.DataError, OPENSTACK_COMMUNICATE_EXCEPTION_MSG, me);
- logger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ logger.error(OPENSTACK_COMMUNICATE_EXCEPTION_MSG, MessageEnum.RA_CREATE_TENANT_ERR,
+ MsoLogger.ErrorCode.DataError.getValue(), me);
throw new TenantException (me);
}
if (newTenant == null) {
if (backout == null)
backout = true;
- long createTenantStartTime = System.currentTimeMillis ();
try {
newTenantId = tUtils.createTenant (tenantName, cloudSiteId, metadata, backout.booleanValue ());
- logger.recordMetricEvent (createTenantStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, SUCCESS_RESPONSE_OPENSTACK, OPENSTACK, CREATE_TENANT, null);
} catch (MsoException me) {
- logger.recordMetricEvent (createTenantStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, OPENSTACK_COMMUNICATE_EXCEPTION_MSG, OPENSTACK, CREATE_TENANT, null);
- String error = "Create Tenant " + tenantName + ": " + me;
- logger.error (MessageEnum.RA_CREATE_TENANT_ERR, me.getMessage(), OPENSTACK, CREATE_TENANT, MsoLogger.ErrorCode.DataError, OPENSTACK_COMMUNICATE_EXCEPTION_MSG, me);
- logger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ logger.error (OPENSTACK_COMMUNICATE_EXCEPTION_MSG, MessageEnum.RA_CREATE_TENANT_ERR, MsoLogger.ErrorCode.DataError.getValue(), me);
throw new TenantException (me);
}
tenantRollback.setTenantId (newTenantId);
tenantRollback.setTenantCreated (true);
- logger.debug ("Tenant " + tenantName + " successfully created with ID " + newTenantId);
+ logger.debug ("Tenant {} successfully created with ID {}", tenantName, newTenantId);
} else {
if (failIfExists != null && failIfExists) {
- String error = CREATE_TENANT + ": Tenant " + tenantName + " already exists in " + cloudSiteId;
- logger.error (MessageEnum.RA_TENANT_ALREADY_EXIST, tenantName, cloudSiteId, OPENSTACK, "", MsoLogger.ErrorCode.DataError, CREATE_TENANT + ", Tenant already exists");
- logger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, error);
+ logger.error("{} {} CreateTenant: Tenant {} already exists in {} ", MessageEnum.RA_TENANT_ALREADY_EXIST,
+ MsoLogger.ErrorCode.DataError.getValue(), tenantName, cloudSiteId);
throw new TenantAlreadyExists (tenantName, cloudSiteId, newTenant.getTenantId ());
}
newTenantId = newTenant.getTenantId ();
tenantRollback.setTenantCreated (false);
- logger.debug ("Tenant " + tenantName + " already exists with ID " + newTenantId);
+ logger.debug("Tenant {} already exists with ID {}", tenantName, newTenantId);
}
tenantId.value = newTenantId;
rollback.value = tenantRollback;
- logger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully create tenant");
return;
}
@@ -170,48 +155,41 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
Holder <Map <String, String>> metadata) throws TenantException {
MsoLogger.setLogContext (msoRequest);
MsoLogger.setServiceName (QUERY_TENANT);
- logger.debug ("Querying Tenant " + tenantNameOrId + " in " + cloudSiteId);
-
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis ();
+ logger.debug ("Querying Tenant {} in {}", tenantNameOrId, cloudSiteId);
MsoTenantUtils tUtils;
try {
tUtils = tFactory.getTenantUtils (cloudSiteId);
} catch (MsoCloudSiteNotFound me) {
- logger.error (MessageEnum.RA_CREATE_TENANT_ERR, me.getMessage(), OPENSTACK, CREATE_TENANT, MsoLogger.ErrorCode.DataError, "no implementation found for " + cloudSiteId, me);
+ logger.error("{} {} no implementation found for {}: ", MessageEnum.RA_CREATE_TENANT_ERR,
+ MsoLogger.ErrorCode.DataError.getValue(), cloudSiteId, me);
throw new TenantException (me);
}
MsoTenant qTenant = null;
- long subStartTime = System.currentTimeMillis ();
try {
qTenant = tUtils.queryTenant (tenantNameOrId, cloudSiteId);
- logger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, SUCCESS_RESPONSE_OPENSTACK, OPENSTACK, QUERY_TENANT, null);
if (qTenant == null) {
// Not found by ID, Try by name.
qTenant = tUtils.queryTenantByName (tenantNameOrId, cloudSiteId);
}
if (qTenant == null) {
- logger.debug ("QueryTenant: Tenant " + tenantNameOrId + " not found");
+ logger.debug ("QueryTenant: Tenant {} not found", tenantNameOrId);
tenantId.value = null;
tenantName.value = null;
metadata.value = null;
} else {
- logger.debug ("QueryTenant: Tenant " + tenantNameOrId + " found with ID " + qTenant.getTenantId ());
+ logger.debug("QueryTenant: Tenant {} found with ID {}", tenantNameOrId, qTenant.getTenantId());
tenantId.value = qTenant.getTenantId ();
tenantName.value = qTenant.getTenantName ();
metadata.value = qTenant.getMetadata ();
}
} catch (MsoException me) {
- String error = "Query Tenant " + tenantNameOrId + ": " + me;
- logger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, OPENSTACK, QUERY_TENANT, null);
- logger.error (MessageEnum.RA_GENERAL_EXCEPTION, me.getMessage(), OPENSTACK, "", MsoLogger.ErrorCode.DataError, "Exception in queryTenant", me);
- logger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ logger.error("Exception in queryTenant for {}: ", MessageEnum.RA_GENERAL_EXCEPTION,
+ MsoLogger.ErrorCode.DataError.getValue(), tenantNameOrId, me);
throw new TenantException (me);
}
- logger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully query tenant");
return;
}
@@ -223,29 +201,21 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
MsoLogger.setLogContext (msoRequest);
MsoLogger.setServiceName (DELETE_TENANT);
- logger.debug ("Deleting Tenant " + tenantId + " in " + cloudSiteId);
-
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis ();
+ logger.debug ("Deleting Tenant {} in {}", tenantId, cloudSiteId);
// Delete the Tenant.
- long subStartTime = System.currentTimeMillis ();
try {
MsoTenantUtils tUtils = tFactory.getTenantUtils (cloudSiteId);
boolean deleted = tUtils.deleteTenant (tenantId, cloudSiteId);
tenantDeleted.value = deleted;
- logger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully communicate with Open Stack", OPENSTACK, DELETE_TENANT, null);
} catch (MsoException me) {
- String error = "Delete Tenant " + tenantId + ": " + me;
- logger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, OPENSTACK, DELETE_TENANT, null);
- logger.error (MessageEnum.RA_DELETE_TEMAMT_ERR, me.getMessage(), OPENSTACK, "", MsoLogger.ErrorCode.DataError, "Exception - DeleteTenant", me);
- logger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ logger.error("{} {} Exception - DeleteTenant {}: ", MessageEnum.RA_DELETE_TEMAMT_ERR,
+ MsoLogger.ErrorCode.DataError.getValue(), tenantId, me);
throw new TenantException (me);
}
// On success, nothing is returned.
- logger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully delete tenant");
return;
}
@@ -260,11 +230,11 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
*/
@Override
public void rollbackTenant (TenantRollback rollback) throws TenantException {
- long startTime = System.currentTimeMillis ();
MsoLogger.setServiceName (ROLLBACK_TENANT);
// rollback may be null (e.g. if stack already existed when Create was called)
if (rollback == null) {
- logger.warn (MessageEnum.RA_ROLLBACK_NULL, OPENSTACK, "rollbackTenant", MsoLogger.ErrorCode.DataError, "rollbackTenant, rollback is null");
+ logger.warn("{} {} rollbackTenant, rollback is null", MessageEnum.RA_ROLLBACK_NULL,
+ MsoLogger.ErrorCode.DataError.getValue());
return;
}
@@ -273,26 +243,21 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
String tenantId = rollback.getTenantId ();
MsoLogger.setLogContext (rollback.getMsoRequest ());
- logger.debug ("Rolling Back Tenant " + rollback.getTenantId () + " in " + cloudSiteId);
+ logger.debug("Rolling Back Tenant {} in {}", rollback.getTenantId(), cloudSiteId);
- long subStartTime = System.currentTimeMillis ();
if (rollback.getTenantCreated ()) {
try {
MsoTenantUtils tUtils = tFactory.getTenantUtils (cloudSiteId);
tUtils.deleteTenant (tenantId, cloudSiteId);
- logger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully communicate with Open Stack", OPENSTACK, ROLLBACK_TENANT, null);
} catch (MsoException me) {
me.addContext (ROLLBACK_TENANT);
// Failed to delete the tenant.
- String error = "Rollback Tenant " + tenantId + ": " + me;
- logger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, OPENSTACK, ROLLBACK_TENANT, null);
- logger.error (MessageEnum.RA_ROLLBACK_TENANT_ERR, me.getMessage(), OPENSTACK, "rollbackTenant", MsoLogger.ErrorCode.DataError, "Exception - rollbackTenant", me);
- logger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ logger.error("{} {} Exception - rollbackTenant {}: ", MessageEnum.RA_ROLLBACK_TENANT_ERR,
+ MsoLogger.ErrorCode.DataError.getValue(), tenantId, me);
throw new TenantException (me);
}
}
- logger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully roll back tenant");
return;
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/TenantAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/TenantAdapterRest.java
index 41544c8104..11051df34e 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/TenantAdapterRest.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/TenantAdapterRest.java
@@ -6,6 +6,7 @@
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,8 +25,12 @@
package org.onap.so.adapters.tenant;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
import java.util.Map;
-
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
@@ -38,7 +43,6 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.xml.ws.Holder;
-
import org.onap.so.adapters.tenant.exceptions.TenantAlreadyExists;
import org.onap.so.adapters.tenant.exceptions.TenantException;
import org.onap.so.adapters.tenantrest.CreateTenantError;
@@ -53,18 +57,13 @@ import org.onap.so.adapters.tenantrest.RollbackTenantError;
import org.onap.so.adapters.tenantrest.RollbackTenantRequest;
import org.onap.so.adapters.tenantrest.RollbackTenantResponse;
import org.onap.so.adapters.tenantrest.TenantRollback;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.openstack.beans.MsoTenant;
import org.onap.so.openstack.exceptions.MsoExceptionCategory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
-
/**
* This class services calls to the REST interface for Tenants (http://host:port/vnfs/rest/v1/tenants)
* Both XML and JSON can be produced/consumed. Set Accept: and Content-Type: headers appropriately. XML is the default.
@@ -73,7 +72,8 @@ import io.swagger.annotations.ApiResponses;
@Api(value = "/v1/tenants", description = "root of tenant adapters restful web service")
@Component
public class TenantAdapterRest {
- private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, TenantAdapterRest.class);
+
+ private static Logger logger = LoggerFactory.getLogger(TenantAdapterRest.class);
private static final String EXCEPTION= "Exception :";
//RAA? No logging in wrappers
@Autowired
@@ -122,7 +122,7 @@ public class TenantAdapterRest {
public Response createTenant(
@ApiParam(value = "details of tenant being created", required = true)
CreateTenantRequest req) {
- LOGGER.debug("createTenant enter: " + req.toJsonString());
+ logger.debug("createTenant enter: {}", req.toJsonString());
String newTenantId = null;
TenantRollback tenantRollback = new TenantRollback ();
@@ -145,17 +145,17 @@ public class TenantAdapterRest {
}
catch (TenantAlreadyExists tae) {
- LOGGER.debug(EXCEPTION,tae);
+ logger.debug(EXCEPTION, tae);
CreateTenantError exc = new CreateTenantError(tae.getMessage(), tae.getFaultInfo().getCategory(), Boolean.TRUE);
return Response.status(HttpServletResponse.SC_NOT_IMPLEMENTED).entity(exc).build();
}
catch (TenantException te) {
- LOGGER.debug(EXCEPTION,te);
+ logger.debug(EXCEPTION, te);
CreateTenantError exc = new CreateTenantError(te.getFaultInfo().getMessage(), te.getFaultInfo().getCategory(), Boolean.TRUE);
return Response.status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).entity(exc).build();
}
catch (Exception e) {
- LOGGER.debug(EXCEPTION,e);
+ logger.debug(EXCEPTION, e);
CreateTenantError exc = new CreateTenantError(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE);
return Response.status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).entity(exc).build();
}
@@ -208,12 +208,12 @@ public class TenantAdapterRest {
tenantDeleted = deleted.value;
}
catch (TenantException te) {
- LOGGER.debug(EXCEPTION,te);
+ logger.debug(EXCEPTION, te);
DeleteTenantError exc = new DeleteTenantError(te.getFaultInfo().getMessage(), te.getFaultInfo().getCategory(), Boolean.TRUE);
return Response.status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).entity(exc).build();
}
catch (Exception e) {
- LOGGER.debug(EXCEPTION,e);
+ logger.debug(EXCEPTION, e);
DeleteTenantError exc = new DeleteTenantError(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE);
return Response.status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).entity(exc).build();
}
@@ -272,12 +272,12 @@ public class TenantAdapterRest {
}
catch (TenantException te) {
- LOGGER.debug(EXCEPTION,te);
+ logger.debug(EXCEPTION, te);
QueryTenantError exc = new QueryTenantError(te.getFaultInfo().getMessage(), te.getFaultInfo().getCategory());
return Response.status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).entity(exc).build();
}
catch (Exception e) {
- LOGGER.debug(EXCEPTION,e);
+ logger.debug(EXCEPTION, e);
QueryTenantError exc = new QueryTenantError(e.getMessage(), MsoExceptionCategory.INTERNAL);
return Response.status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).entity(exc).build();
}
@@ -321,12 +321,12 @@ public class TenantAdapterRest {
impl.rollbackTenant(req.getTenantRollback());
}
catch (TenantException te) {
- LOGGER.debug(EXCEPTION,te);
+ logger.debug(EXCEPTION, te);
RollbackTenantError exc = new RollbackTenantError(te.getFaultInfo().getMessage(), te.getFaultInfo().getCategory(), Boolean.TRUE);
return Response.status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).entity(exc).build();
}
catch (Exception e) {
- LOGGER.debug(EXCEPTION,e);
+ logger.debug(EXCEPTION, e);
RollbackTenantError exc = new RollbackTenantError(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE);
return Response.status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).entity(exc).build();
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java
index 4b02b73786..7265a59397 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -24,10 +26,8 @@ package org.onap.so.adapters.vnf;
import java.security.GeneralSecurityException;
import java.util.Set;
import java.util.TreeSet;
-
import javax.annotation.PostConstruct;
import javax.xml.bind.DatatypeConverter;
-
import org.apache.http.HttpEntity;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
@@ -40,6 +40,8 @@ import org.apache.http.util.EntityUtils;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
import org.onap.so.utils.CryptoUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.core.env.Environment;
@@ -69,7 +71,7 @@ public class BpelRestClient {
private static final String RETRY_INTERVAL_PROPERTY = PROPERTY_DOMAIN+".retryinterval";
private static final String RETRY_LIST_PROPERTY = PROPERTY_DOMAIN+".retrylist";
private static final String ENCRYPTION_KEY_PROP = "org.onap.so.adapters.network.encryptionKey";
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, BpelRestClient.class);
+ private static final Logger logger = LoggerFactory.getLogger(BpelRestClient.class);
/** Default socket timeout (in seconds) */
public static final int DEFAULT_SOCKET_TIMEOUT = 5;
@@ -218,7 +220,8 @@ public class BpelRestClient {
}
if (totalretries >= retryCount) {
debug("Retried " + totalretries + " times, giving up.");
- LOGGER.error(MessageEnum.RA_SEND_VNF_NOTIF_ERR, "Could not deliver response to BPEL after "+totalretries+" tries: "+toBpelStr, "Camunda", "", MsoLogger.ErrorCode.BusinessProcesssError, "Could not deliver response to BPEL");
+ logger.error("{} {} Could not deliver response to BPEL after {} tries: {}", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), totalretries, toBpelStr);
return false;
}
totalretries++;
@@ -232,26 +235,26 @@ public class BpelRestClient {
try {
Thread.sleep(sleepinterval * 1000L);
} catch (InterruptedException e) {
- LOGGER.debug("Exception while Thread sleep", e);
+ logger.debug("Exception while Thread sleep", e);
Thread.currentThread().interrupt();
}
}
}
private void debug(String m) {
- LOGGER.debug(m);
+ logger.debug(m);
}
private void sendOne(final String toBpelStr, final String bpelUrl, final boolean isxml) {
- LOGGER.debug("Sending to BPEL server: "+bpelUrl);
- LOGGER.debug("Content is: "+toBpelStr);
+ logger.debug("Sending to BPEL server: {}", bpelUrl);
+ logger.debug("Content is: {}", toBpelStr);
//POST
HttpPost post = new HttpPost(bpelUrl);
if (credentials != null && !credentials.isEmpty())
post.addHeader("Authorization", "Basic " + DatatypeConverter.printBase64Binary(credentials.getBytes()));
- LOGGER.debug("HTTPPost Headers: " + post.getAllHeaders());
-
- //ContentType
+ logger.debug("HTTPPost Headers: {}", post.getAllHeaders());
+
+ //ContentType
ContentType ctype = isxml ? ContentType.APPLICATION_XML : ContentType.APPLICATION_JSON;
post.setEntity(new StringEntity(toBpelStr, ctype));
@@ -274,14 +277,14 @@ public class BpelRestClient {
lastResponse = "";
}
} catch (Exception e) {
- String error = "Error sending Bpel notification:" + toBpelStr;
- LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, error, "Camunda", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - Error sending Bpel notification", e);
+ logger.error("{} {} Exception - Error sending Bpel notification: {} ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), toBpelStr, e);
lastResponseCode = 900;
lastResponse = "";
}
- LOGGER.debug("Response code from BPEL server: "+lastResponseCode);
- LOGGER.debug("Response body is: "+lastResponse);
+ logger.debug("Response code from BPEL server: {}", lastResponseCode);
+ logger.debug("Response body is: {}", lastResponse);
}
private String getEncryptedProperty(String key, String defaultValue, String encryptionKey) {
@@ -289,7 +292,7 @@ public class BpelRestClient {
try {
return CryptoUtils.decrypt(env.getProperty(key), env.getProperty(encryptionKey));
} catch (GeneralSecurityException e) {
- LOGGER.debug("Exception while decrypting property: " + env.getProperty(key), e);
+ logger.debug("Exception while decrypting property: {} ", env.getProperty(key), e);
}
}
return defaultValue;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java
index 21b7ea4142..6340f76388 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -29,14 +31,12 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
import javax.jws.WebService;
import javax.xml.bind.DatatypeConverter;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Holder;
import javax.xml.ws.handler.MessageContext;
-
import org.onap.so.adapters.vnf.async.client.CreateVnfNotification;
import org.onap.so.adapters.vnf.async.client.QueryVnfNotification;
import org.onap.so.adapters.vnf.async.client.UpdateVnfNotification;
@@ -45,11 +45,12 @@ import org.onap.so.adapters.vnf.async.client.VnfAdapterNotify_Service;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.entity.MsoRequest;
import org.onap.so.logger.MessageEnum;
-
import org.onap.so.logger.MsoLogger;
import org.onap.so.openstack.beans.VnfRollback;
import org.onap.so.openstack.beans.VnfStatus;
import org.onap.so.utils.CryptoUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@@ -58,8 +59,7 @@ import org.springframework.stereotype.Component;
@Component
public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
- public static final String MSO_PROP_VNF_ADAPTER="MSO_PROP_VNF_ADAPTER";
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, MsoVnfAdapterAsyncImpl.class);
+ private static final Logger logger = LoggerFactory.getLogger(MsoVnfAdapterAsyncImpl.class);
private static final String BPEL_AUTH_PROP = "org.onap.so.adapters.vnf.bpelauth";
private static final String ENCRYPTION_KEY_PROP = "org.onap.so.adapters.network.encryptionKey";
@@ -75,7 +75,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
*/
@Override
public void healthCheckA () {
- LOGGER.debug ("Health check call in VNF Adapter");
+ logger.debug ("Health check call in VNF Adapter");
}
/**
@@ -136,7 +136,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
String serviceName = "CreateVnfA";
MsoLogger.setLogContext (msoRequest);
MsoLogger.setServiceName (serviceName);
- LOGGER.info (MessageEnum.RA_ASYNC_CREATE_VNF, vnfName, vnfType, cloudSiteId, tenantId, "createVnfA");
+ logger.info("{} createVnfA", MessageEnum.RA_ASYNC_CREATE_VNF);
// Use the synchronous method to perform the actual Create
MsoVnfAdapter vnfAdapter = vnfImpl;
// Synchronous Web Service Outputs
@@ -163,7 +163,8 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
MsoLogger.setServiceName (serviceName);
} catch (VnfException e) {
MsoLogger.setServiceName (serviceName);
- LOGGER.error (MessageEnum.RA_CREATE_VNF_ERR, vnfName, cloudSiteId, tenantId, "", "createVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "VnfException in createVnfA", e);
+ logger.error("{} {} VnfException in createVnfA ", MessageEnum.RA_CREATE_VNF_ERR,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
String eMsg = null;
try {
@@ -172,21 +173,21 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
.getCategory ()
.name ());
} catch (Exception e1) {
- LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "createVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - Fault info", e1);
+ logger.error("{} {} Exception - Fault info ", MessageEnum.RA_FAULT_INFO_EXC,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1);
}
// Build and send Asynchronous error response
try {
VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
notifyPort.createVnfNotification (messageId, false, exCat, eMsg, null, null, null);
} catch (Exception e1) {
- error = "Error sending createVnf notification " + e1.getMessage ();
- LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "createVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending createVnf notification", e1);
-
+ logger.error("{} {} Exception sending createVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1);
}
- LOGGER.info (MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE, "", "createVnfA", "");
+ logger.info("{}", MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE);
return;
}
- LOGGER.debug ("Async Create VNF: " + vnfName + " VnfId:" + vnfId.value);
+ logger.debug("Async Create VNF: {} VnfId:{}", vnfName, vnfId.value);
// Build and send Asynchronous response
try {
VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
@@ -198,11 +199,10 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
copyCreateOutputs (outputs),
copyVrb (vnfRollback));
} catch (Exception e) {
- error = "Error sending createVnf notification " + e.getMessage ();
- LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "createVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending createVnf notification", e);
-
+ logger.error("{} {} Exception sending createVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
}
- LOGGER.info (MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE, "", "","createVnfA");
+ logger.info("{} createVnfA", MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE);
return;
}
@@ -222,7 +222,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
String serviceName = "UpdateVnfA";
MsoLogger.setServiceName (serviceName);
MsoLogger.setLogContext (msoRequest);
- LOGGER.info (MessageEnum.RA_ASYNC_UPDATE_VNF, vnfName, vnfType, cloudSiteId, tenantId, "UpdateVnfA");
+ logger.info("{} UpdateVnfA", MessageEnum.RA_ASYNC_UPDATE_VNF);
// Use the synchronous method to perform the actual Create
MsoVnfAdapter vnfAdapter = vnfImpl;
@@ -237,7 +237,8 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
MsoLogger.setServiceName (serviceName);
} catch (VnfException e) {
MsoLogger.setServiceName (serviceName);
- LOGGER.error (MessageEnum.RA_UPDATE_VNF_ERR, vnfName, cloudSiteId, tenantId, "", "UpdateVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending updateVnf notification", e);
+ logger.error("{} {} Exception sending updateVnf notification ", MessageEnum.RA_UPDATE_VNF_ERR,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
String eMsg = null;
try {
@@ -246,21 +247,21 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
.getCategory ()
.name ());
} catch (Exception e1) {
- LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "UpdateVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - fault info", e1);
+ logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1);
}
// Build and send Asynchronous error response
try {
VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
notifyPort.updateVnfNotification (messageId, false, exCat, eMsg, null, null);
} catch (Exception e1) {
- error = "Error sending updateVnf notification " + e1.getMessage ();
- LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "UpdateVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending updateVnf notification", e1);
-
+ logger.error("{} {} Exception sending updateVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1);
}
- LOGGER.info (MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE,"","","UpdateVnfA");
+ logger.info("{} UpdateVnfA", MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE);
return;
}
- LOGGER.debug ("Async Update VNF: " + vnfName + " VnfId:" + vnfId.value);
+ logger.debug("Async Update VNF: {} VnfId:{}", vnfName, vnfId.value);
// Build and send Asynchronous response
try {
VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
@@ -271,11 +272,10 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
copyUpdateOutputs (outputs),
copyVrb (vnfRollback));
} catch (Exception e) {
- error = "Error sending updateVnf notification " + e.getMessage ();
- LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "UpdateVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending updateVnf notification", e);
-
+ logger.error("{} {} Exception sending updateVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
}
- LOGGER.info (MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE, "", "","UpdateVnfA");
+ logger.info("{} UpdateVnfA", MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE);
return;
}
@@ -303,7 +303,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
String serviceName = "QueryVnfA";
MsoLogger.setServiceName (serviceName);
MsoLogger.setLogContext (msoRequest);
- LOGGER.info (MessageEnum.RA_ASYNC_QUERY_VNF, vnfName, cloudSiteId, tenantId);
+ logger.info("{}", MessageEnum.RA_ASYNC_QUERY_VNF);
// Use the synchronous method to perform the actual query
MsoVnfAdapter vnfAdapter = vnfImpl;
@@ -319,7 +319,8 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
MsoLogger.setServiceName (serviceName);
} catch (VnfException e) {
MsoLogger.setServiceName (serviceName);
- LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vnfName, cloudSiteId, tenantId, "", "queryVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending queryVnfA notification", e);
+ logger.error("{} {} Exception sending queryVnfA notification ", MessageEnum.RA_QUERY_VNF_ERR,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
String eMsg = null;
try {
@@ -328,25 +329,25 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
.getCategory ()
.name ());
} catch (Exception e1) {
- LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "queryVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - fault info", e1);
+ logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1);
}
// Build and send Asynchronous error response
try {
VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
notifyPort.queryVnfNotification (messageId, false, exCat, eMsg, null, null, null, null);
} catch (Exception e1) {
- error = "Error sending queryVnf notification " + e1.getMessage ();
- LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "queryVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending queryVnf notification", e1);
-
+ logger.error("{} {} Exception sending queryVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1);
}
- LOGGER.info (MessageEnum.RA_ASYNC_QUERY_VNF_COMPLETE, "","", "queryVnfA");
+ logger.info("{} queryVnfA", MessageEnum.RA_ASYNC_QUERY_VNF_COMPLETE);
return;
}
if (!vnfExists.value) {
- LOGGER.debug ("Async Query, VNF not found");
+ logger.debug ("Async Query, VNF not found");
} else {
- LOGGER.debug ("Async Query, VNF=" + vnfId.value + ", status=" + status.value);
+ logger.debug("Async Query, VNF={}, status={}", vnfId.value, status.value);
}
// Build and send Asynchronous response
try {
@@ -361,12 +362,11 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
vnfS,
copyQueryOutputs (outputs));
} catch (Exception e) {
- error = "Error sending queryVnf notification " + e.getMessage ();
- LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "queryVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending queryVnf notification", e);
-
+ logger.error("{} {} Exception sending queryVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
}
- LOGGER.info (MessageEnum.RA_ASYNC_QUERY_VNF_COMPLETE, "","", "queryVnfA");
+ logger.info("{} queryVnfA", MessageEnum.RA_ASYNC_QUERY_VNF_COMPLETE);
return;
}
@@ -393,7 +393,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
String serviceName = "DeleteVnfA";
MsoLogger.setServiceName (serviceName);
MsoLogger.setLogContext (msoRequest);
- LOGGER.info (MessageEnum.RA_ASYNC_DELETE_VNF, vnfName, cloudSiteId, tenantId);
+ logger.info("{}", MessageEnum.RA_ASYNC_DELETE_VNF);
// Use the synchronous method to perform the actual delete
MsoVnfAdapter vnfAdapter = vnfImpl;
@@ -403,7 +403,8 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
MsoLogger.setServiceName (serviceName);
} catch (VnfException e) {
MsoLogger.setServiceName (serviceName);
- LOGGER.error (MessageEnum.RA_DELETE_VNF_ERR, vnfName, cloudSiteId, tenantId, "", "deleteVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending deleteVnfA notification", e);
+ logger.error("{} {} Exception sending deleteVnfA notification ", MessageEnum.RA_DELETE_VNF_ERR,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
String eMsg = null;
try {
@@ -412,34 +413,33 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
.getCategory ()
.name ());
} catch (Exception e1) {
- LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "deleteVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - fault info", e1);
+ logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1);
}
// Build and send Asynchronous error response
try {
VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
notifyPort.deleteVnfNotification (messageId, false, exCat, eMsg);
} catch (Exception e1) {
- error = "Error sending deleteVnf notification " + e1.getMessage ();
- LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "deleteVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending deleteVnfA notification", e1);
-
+ logger.error("{} {} Exception sending deleteVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1);
}
- LOGGER.info (MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE, "","", "deleteVnfA");
+ logger.info("{} deleteVnfA", MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE);
return;
}
- LOGGER.debug ("Async Delete VNF: " + vnfName);
+ logger.debug("Async Delete VNF: {}", vnfName);
// Build and send Asynchronous response
try {
VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
notifyPort.deleteVnfNotification (messageId, true, null, null);
} catch (Exception e) {
- error = "Error sending deleteVnf notification " + e.getMessage ();
- LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "deleteVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending deleteVnfA notification", e);
-
+ logger.error("{} {} Exception sending deleteVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
}
- LOGGER.info (MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE, "", "","deleteVnfA");
+ logger.info("{} deleteVnfA", MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE);
return;
}
@@ -456,14 +456,12 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
String error;
// rollback may be null (e.g. if stack already existed when Create was called)
if (rollback == null) {
- error = "Empty Rollback: No action to perform";
- LOGGER.info (MessageEnum.RA_ROLLBACK_NULL, "","", "rollbackVnfA");
-
+ logger.info("{} rollbackVnfA: Empty Rollback: No action to perform", MessageEnum.RA_ROLLBACK_NULL);
return;
}
MsoLogger.setLogContext (rollback.getMsoRequest ());
- LOGGER.info (MessageEnum.RA_ASYNC_ROLLBACK_VNF, "", "","rollbackVnfA");
+ logger.info("{} rollbackVnfA", MessageEnum.RA_ASYNC_ROLLBACK_VNF);
// Use the synchronous method to perform the actual rollback
MsoVnfAdapter vnfAdapter = vnfImpl;
@@ -473,7 +471,8 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
MsoLogger.setServiceName (serviceName);
} catch (VnfException e) {
MsoLogger.setServiceName (serviceName);
- LOGGER.error (MessageEnum.RA_ROLLBACK_VNF_ERR, "", "rollbackVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending rollbackVnfA notification", e);
+ logger.error("{} {} Exception sending rollbackVnfA notification ", MessageEnum.RA_ROLLBACK_VNF_ERR,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
String eMsg = null;
try {
@@ -482,33 +481,32 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
.getCategory ()
.name ());
} catch (Exception e1) {
- LOGGER.error (MessageEnum.RA_FAULT_INFO_EXC, "", "rollbackVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - fault info", e1);
+ logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1);
}
// Build and send Asynchronous error response
try {
VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
notifyPort.rollbackVnfNotification (messageId, false, exCat, eMsg);
} catch (Exception e1) {
- error = "Error sending rollbackVnf notification " + e1.getMessage ();
- LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "rollbackVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending rollbackVnfA notification", e1);
-
+ logger.error("{} {} Exception sending rollbackVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1);
}
- LOGGER.info (MessageEnum.RA_ASYNC_ROLLBACK_VNF_COMPLETE, "","", "rollbackVnfA");
+ logger.info("{} rollbackVnfA", MessageEnum.RA_ASYNC_ROLLBACK_VNF_COMPLETE);
return;
}
- LOGGER.debug ("Async Rollback VNF:" + rollback.getVnfId ());
+ logger.debug ("Async Rollback VNF:" + rollback.getVnfId ());
// Build and send Asynchronous response
try {
VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
notifyPort.rollbackVnfNotification (messageId, true, null, null);
} catch (Exception e) {
- error = "Error sending rollbackVnf notification " + e.getMessage ();
- LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, "", "rollbackVnfA", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending rollbackVnfA notification", e);
-
+ logger.error("{} {} Exception sending rollbackVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
}
- LOGGER.info (MessageEnum.RA_ASYNC_ROLLBACK_VNF_COMPLETE, "", "","rollbackVnfA");
+ logger.info("{} rollbackVnfA", MessageEnum.RA_ASYNC_ROLLBACK_VNF_COMPLETE);
return;
}
@@ -600,15 +598,18 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
try {
warWsdlLoc = Thread.currentThread ().getContextClassLoader ().getResource ("VnfAdapterNotify.wsdl");
} catch (Exception e) {
- LOGGER.error (MessageEnum.RA_WSDL_NOT_FOUND, "VnfAdapterNotify.wsdl", "", "getNotifyEP", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - WSDL not found", e);
+ logger.error("{} {} Exception - WSDL not found ", MessageEnum.RA_WSDL_NOT_FOUND,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
}
if (warWsdlLoc == null) {
- LOGGER.error (MessageEnum.RA_WSDL_NOT_FOUND, "VnfAdapterNotify.wsdl", "", "getNotifyEP", MsoLogger.ErrorCode.BusinessProcesssError, "WSDL not found");
+ logger.error("{} {} WSDL not found", MessageEnum.RA_WSDL_NOT_FOUND,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue());
} else {
try {
- LOGGER.debug ("VnfAdpaterNotify.wsdl location:" + warWsdlLoc.toURI ().toString ());
+ logger.debug("VnfAdpaterNotify.wsdl location:{}", warWsdlLoc.toURI().toString());
} catch (Exception e) {
- LOGGER.error (MessageEnum.RA_WSDL_URL_CONVENTION_EXC, "VnfAdapterNotify.wsdl", "", "getNotifyEP", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - WSDL URL convention", e);
+ logger.error("{} {} Exception - WSDL URL convention ", MessageEnum.RA_WSDL_URL_CONVENTION_EXC,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
}
}
@@ -624,15 +625,16 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
try {
epUrl = new URL (notificationUrl);
} catch (MalformedURLException e1) {
- LOGGER.error (MessageEnum.RA_INIT_NOTIF_EXC, "", "getNotifyEP", MsoLogger.ErrorCode.BusinessProcesssError, "MalformedURLException", e1);
+ logger.error("{} {} MalformedURLException ", MessageEnum.RA_INIT_NOTIF_EXC,
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1);
}
if(null != epUrl) {
- LOGGER.debug ("Notification Endpoint URL: " + epUrl.toExternalForm ());
+ logger.debug("Notification Endpoint URL: {}", epUrl.toExternalForm());
bp.getRequestContext ().put (BindingProvider.ENDPOINT_ADDRESS_PROPERTY, epUrl.toExternalForm ());
}
else {
- LOGGER.debug ("epUrl is NULL:");
+ logger.debug ("epUrl is NULL:");
}
// authentication
@@ -646,8 +648,8 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
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);
-
+ logger.error("{} {} Exception - Unable to set authorization in callback request ",
+ MessageEnum.RA_SET_CALLBACK_AUTH_EXC, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
}
return notifyPort;
@@ -657,7 +659,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
try {
return CryptoUtils.decrypt(this.environment.getProperty(key), this.environment.getProperty(encryptionKey));
} catch (GeneralSecurityException e) {
- LOGGER.debug("Exception while decrypting property: " + this.environment.getProperty(key), e);
+ logger.debug("Exception while decrypting property: {} ", this.environment.getProperty(key), e);
}
return defaultValue;
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java b/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java
index 62971ecd2b..9e75c7c339 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -22,14 +24,14 @@ package org.onap.so.asdc;
import javax.annotation.PreDestroy;
-import org.onap.so.asdc.client.ASDCConfiguration;
import org.onap.so.asdc.client.ASDCController;
import org.onap.so.asdc.client.exceptions.ASDCControllerException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
-import org.onap.so.logger.MsoLogger;
import java.security.SecureRandom;
@@ -40,30 +42,28 @@ public class ASDCControllerSingleton {
@Autowired
private ASDCController asdcController;
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.ASDC, ASDCControllerSingleton.class);
+ private static Logger logger = LoggerFactory.getLogger(ASDCControllerSingleton.class);
@Scheduled (fixedRate = 50000)
public void periodicControllerTask() {
-
- try {
- int randomNumber = new SecureRandom().nextInt(Integer.MAX_VALUE);
- asdcController.setControllerName("mso-controller"+randomNumber);
- asdcController.initASDC();
- } catch (ASDCControllerException e) {
- msoLogger.error(e);
-
- }
+ try {
+ int randomNumber = new SecureRandom().nextInt(Integer.MAX_VALUE);
+ asdcController.setControllerName("mso-controller" + randomNumber);
+ asdcController.initASDC();
+ } catch (ASDCControllerException e) {
+ logger.error("Exception occurred", e);
+ }
}
@PreDestroy
private void terminate () {
- try {
- asdcController.closeASDC ();
- } catch (ASDCControllerException e) {
- msoLogger.error(e);
- }
- }
+ try {
+ asdcController.closeASDC();
+ } catch (ASDCControllerException e) {
+ logger.error("Exception occurred", e);
+ }
+ }
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java
index 5710905660..20e7c873e6 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -27,8 +29,9 @@ import java.util.Collections;
import java.util.List;
import org.onap.sdc.api.consumer.IConfiguration;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.utils.CryptoUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
@@ -40,6 +43,7 @@ public class ASDCConfiguration implements IConfiguration {
// SHell command to obtain the same encryption, 128 bits key, key must be HEX
// echo -n "This is a test string" | openssl aes-128-ecb -e -K 546573746F736973546573746F736973 -nosalt | xxd
+ private static Logger logger = LoggerFactory.getLogger(ASDCConfiguration.class);
private String asdcControllerName;
@@ -72,9 +76,6 @@ public class ASDCConfiguration implements IConfiguration {
public static final String TOSCA_CSAR="TOSCA_CSAR";
public static final String WORKFLOWS="Workflows";
public static final String VF_MODULES_METADATA="VF_MODULES_METADATA";
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.ASDC,ASDCConfiguration.class);
-
-
private static final String[] SUPPORTED_ARTIFACT_TYPES = {HEAT,
HEAT_ARTIFACT,
@@ -176,7 +177,7 @@ public class ASDCConfiguration implements IConfiguration {
try {
decryptedKey = CryptoUtils.decrypt(config, this.configKey);
} catch (GeneralSecurityException e) {
- msoLogger.debug("Exception while decrypting property: " + propertyName, e);
+ logger.debug("Exception while decrypting property: {}", propertyName, e);
return null;
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
index a21deee51a..bb70e3c65c 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
@@ -5,6 +5,8 @@ d * ============LICENSE_START===================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -30,7 +32,6 @@ import java.nio.file.Paths;
import java.util.List;
import java.util.Optional;
-import org.hibernate.StaleObjectStateException;
import org.onap.sdc.api.IDistributionClient;
import org.onap.sdc.api.consumer.IDistributionStatusMessage;
import org.onap.sdc.api.consumer.IFinalDistrStatusMessage;
@@ -58,6 +59,8 @@ import org.onap.so.db.request.beans.WatchdogDistributionStatus;
import org.onap.so.db.request.data.repository.WatchdogDistributionStatusRepository;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.ObjectOptimisticLockingFailureException;
import org.springframework.stereotype.Component;
@@ -71,9 +74,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@Component
public class ASDCController {
- protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC,ASDCController.class);
-
-
+ protected static final Logger logger = LoggerFactory.getLogger(ASDCController.class);
protected boolean isAsdcClientAutoManaged = false;
@@ -189,7 +190,7 @@ public class ASDCController {
public void initASDC () throws ASDCControllerException {
String event = "Initialize the ASDC Controller";
MsoLogger.setServiceName ("InitASDC");
- LOGGER.debug (event);
+ logger.debug(event);
if (this.getControllerStatus () != ASDCControllerStatus.STOPPED) {
String endEvent = "The controller is already initialized, call the closeASDC method first";
throw new ASDCControllerException (endEvent);
@@ -203,36 +204,29 @@ public class ASDCController {
distributionClient = DistributionClientFactory.createDistributionClient ();
}
- long initStartTime = System.currentTimeMillis ();
IDistributionClientResult result = this.distributionClient.init (asdcConfig,
asdcNotificationCallBack, asdcStatusCallBack);
if (!result.getDistributionActionResult ().equals (DistributionActionResultEnum.SUCCESS)) {
String endEvent = "ASDC distribution client init failed with reason:"
+ result.getDistributionMessageResult ();
- LOGGER.recordMetricEvent (initStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.UnknownError, "Initialization of the ASDC Controller failed with reason:" + result.getDistributionMessageResult (), "ASDC", "init", null);
- LOGGER.debug (endEvent);
+ logger.debug (endEvent);
this.changeControllerStatus (ASDCControllerStatus.STOPPED);
throw new ASDCControllerException ("Initialization of the ASDC Controller failed with reason: "
+ result.getDistributionMessageResult ());
}
- LOGGER.recordMetricEvent (initStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully initialize ASDC Controller", "ASDC", "init", null);
- long clientstartStartTime = System.currentTimeMillis ();
result = this.distributionClient.start ();
if (!result.getDistributionActionResult ().equals (DistributionActionResultEnum.SUCCESS)) {
String endEvent = "ASDC distribution client start failed with reason:"
+ result.getDistributionMessageResult ();
- LOGGER.recordMetricEvent (clientstartStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.UnknownError, endEvent, "ASDC", "start", null);
- LOGGER.debug (endEvent);
+ logger.debug (endEvent);
this.changeControllerStatus (ASDCControllerStatus.STOPPED);
throw new ASDCControllerException ("Startup of the ASDC Controller failed with reason: "
+ result.getDistributionMessageResult ());
}
- LOGGER.recordMetricEvent (clientstartStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully start ASDC distribution client", "ASDC", "start", null);
-
this.changeControllerStatus (ASDCControllerStatus.IDLE);
- LOGGER.info (MessageEnum.ASDC_INIT_ASDC_CLIENT_SUC, "ASDC", "changeControllerStatus","");
+ logger.info("{} {} {}", MessageEnum.ASDC_INIT_ASDC_CLIENT_SUC.toString(), "ASDC", "changeControllerStatus");
}
/**
@@ -264,10 +258,10 @@ public class ASDCController {
if (toscaInstaller.isResourceAlreadyDeployed (resource)) {
- LOGGER.info (MessageEnum.ASDC_ARTIFACT_ALREADY_EXIST,
+ logger.info("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_ALREADY_EXIST.toString(),
resource.getResourceInstance().getResourceInstanceName(),
resource.getResourceInstance().getResourceUUID(),
- resource.getResourceInstance().getResourceName(), "", "");
+ resource.getResourceInstance().getResourceName());
this.sendDeployNotificationsForResource(resource,DistributionStatusEnum.ALREADY_DOWNLOADED,null);
this.sendDeployNotificationsForResource(resource,DistributionStatusEnum.ALREADY_DEPLOYED,null);
@@ -283,7 +277,7 @@ public class ASDCController {
protected IDistributionClientDownloadResult downloadTheArtifact (IArtifactInfo artifact,
String distributionId) throws ASDCDownloadException {
- LOGGER.debug ("Trying to download the artifact : " + artifact.getArtifactURL ()
+ logger.debug("Trying to download the artifact : " + artifact.getArtifactURL ()
+ UUID_PARAM
+ artifact.getArtifactUUID ()
+ ")");
@@ -293,11 +287,11 @@ public class ASDCController {
try {
downloadResult = distributionClient.download (artifact);
if (null == downloadResult) {
- LOGGER.info (MessageEnum.ASDC_ARTIFACT_NULL, artifact.getArtifactUUID (), "", "");
+ logger.info ("{} {}", MessageEnum.ASDC_ARTIFACT_NULL.toString(), artifact.getArtifactUUID());
return downloadResult;
}
} catch (RuntimeException e) {
- LOGGER.debug ("Not able to download the artifact due to an exception: " + artifact.getArtifactURL ());
+ logger.debug ("Not able to download the artifact due to an exception: " + artifact.getArtifactURL ());
this.sendASDCNotification (NotificationType.DOWNLOAD,
artifact.getArtifactURL (),
asdcConfig.getConsumerID (),
@@ -310,19 +304,14 @@ public class ASDCController {
}
if (DistributionActionResultEnum.SUCCESS.equals(downloadResult.getDistributionActionResult ())) {
-
- LOGGER.info (MessageEnum.ASDC_ARTIFACT_DOWNLOAD_SUC,
- artifact.getArtifactURL (),
- artifact.getArtifactUUID (),
- String.valueOf (downloadResult.getArtifactPayload ().length), "", "");
+ logger.info("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_DOWNLOAD_SUC.toString(), artifact.getArtifactURL(),
+ artifact.getArtifactUUID(), String.valueOf(downloadResult.getArtifactPayload().length));
} else {
-
- LOGGER.error (MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL,
- artifact.getArtifactName (),
- artifact.getArtifactURL (),
- artifact.getArtifactUUID (),
- downloadResult.getDistributionMessageResult (), "", "", MsoLogger.ErrorCode.DataError, "ASDC artifact download fail");
+ logger.error("{} {} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL.toString(),
+ artifact.getArtifactName(), artifact.getArtifactURL(), artifact.getArtifactUUID(),
+ downloadResult.getDistributionMessageResult(), MsoLogger.ErrorCode.DataError.getValue(),
+ "ASDC artifact download fail");
this.sendASDCNotification (NotificationType.DOWNLOAD,
artifact.getArtifactURL (),
@@ -359,11 +348,10 @@ public class ASDCController {
private void writeArtifactToFile (IArtifactInfo artifact,
IDistributionClientDownloadResult resultArtifact) {
- LOGGER.debug ("Trying to write artifact to file : " + artifact.getArtifactURL ()
- + UUID_PARAM
- + artifact.getArtifactUUID ()
- + ")");
-
+ logger.debug(
+ "Trying to write artifact to file : " + artifact.getArtifactURL() + UUID_PARAM + artifact.getArtifactUUID()
+ + ")");
+
String filePath = Paths.get(System.getProperty("mso.config.path"), "ASDC", artifact.getArtifactVersion(), artifact.getArtifactName()).normalize().toString();
// make parent directory
File file = new File(filePath);
@@ -373,20 +361,20 @@ public class ASDCController {
}
byte[] payloadBytes = resultArtifact.getArtifactPayload();
-
+
try (FileOutputStream outFile = new FileOutputStream(filePath)) {
- LOGGER.info(MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF, "***WRITE FILE ARTIFACT NAME", "ASDC", artifact.getArtifactName());
- outFile.write(payloadBytes, 0, payloadBytes.length);
- outFile.close();
- } catch (Exception e) {
- LOGGER.debug("Exception :",e);
- LOGGER.error(MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL,
- artifact.getArtifactName (),
- artifact.getArtifactURL (),
- artifact.getArtifactUUID (),
- resultArtifact.getDistributionMessageResult (), "", "", MsoLogger.ErrorCode.DataError, "ASDC write to file failed");
- }
-
+ logger.info("{} {} {} {}", MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF.toString(), "***WRITE FILE ARTIFACT NAME",
+ "ASDC", artifact.getArtifactName());
+ outFile.write(payloadBytes, 0, payloadBytes.length);
+ outFile.close();
+ } catch (Exception e) {
+ logger.debug("Exception :", e);
+ logger.error("{} {} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL.toString(),
+ artifact.getArtifactName(), artifact.getArtifactURL(), artifact.getArtifactUUID(),
+ resultArtifact.getDistributionMessageResult(), MsoLogger.ErrorCode.DataError.getValue(),
+ "ASDC write to file failed");
+ }
+
}
@@ -446,7 +434,9 @@ public class ASDCController {
protected void deployResourceStructure (VfResourceStructure resourceStructure, ToscaResourceStructure toscaResourceStructure) throws ArtifactInstallerException {
- LOGGER.info (MessageEnum.ASDC_START_DEPLOY_ARTIFACT, resourceStructure.getResourceInstance().getResourceInstanceName(), resourceStructure.getResourceInstance().getResourceUUID(), "ASDC");
+ logger.info("{} {} {} {}", MessageEnum.ASDC_START_DEPLOY_ARTIFACT.toString(),
+ resourceStructure.getResourceInstance().getResourceInstanceName(),
+ resourceStructure.getResourceInstance().getResourceUUID(), "ASDC");
try {
String resourceType = resourceStructure.getResourceInstance().getResourceType();
String category = resourceStructure.getResourceInstance().getCategory();
@@ -456,20 +446,20 @@ public class ASDCController {
toscaInstaller.installTheResource(toscaResourceStructure, resourceStructure);
} catch (ArtifactInstallerException e) {
- LOGGER.info (MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL,
- resourceStructure.getResourceInstance().getResourceName(),
- resourceStructure.getResourceInstance().getResourceUUID(),
- String.valueOf (resourceStructure.getVfModuleStructure().size()), "ASDC", "deployResourceStructure");
- sendDeployNotificationsForResource(resourceStructure,DistributionStatusEnum.DEPLOY_ERROR,e.getMessage());
- throw e;
+ logger.info("{} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL.toString(),
+ resourceStructure.getResourceInstance().getResourceName(),
+ resourceStructure.getResourceInstance().getResourceUUID(),
+ String.valueOf(resourceStructure.getVfModuleStructure().size()), "ASDC", "deployResourceStructure");
+ sendDeployNotificationsForResource(resourceStructure, DistributionStatusEnum.DEPLOY_ERROR, e.getMessage());
+ throw e;
}
if (resourceStructure.isDeployedSuccessfully() || toscaResourceStructure.isDeployedSuccessfully()) {
- LOGGER.info (MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC,
- resourceStructure.getResourceInstance().getResourceName(),
- resourceStructure.getResourceInstance().getResourceUUID(),
- String.valueOf (resourceStructure.getVfModuleStructure().size()), "ASDC", "deployResourceStructure");
- sendDeployNotificationsForResource(resourceStructure,DistributionStatusEnum.DEPLOY_OK ,null);
+ logger.info("{} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC.toString(),
+ resourceStructure.getResourceInstance().getResourceName(),
+ resourceStructure.getResourceInstance().getResourceUUID(),
+ String.valueOf(resourceStructure.getVfModuleStructure().size()), "ASDC", "deployResourceStructure");
+ sendDeployNotificationsForResource(resourceStructure, DistributionStatusEnum.DEPLOY_OK, null);
}
}
@@ -497,10 +487,10 @@ public class ASDCController {
if (errorReason != null) {
event=event+"("+errorReason+")";
}
- LOGGER.info (MessageEnum.ASDC_SEND_NOTIF_ASDC, notificationType.name (), status.name (), artifactURL, "ASDC", "sendASDCNotification");
- LOGGER.debug (event);
+ logger.info("{} {} {} {} {} {}", MessageEnum.ASDC_SEND_NOTIF_ASDC.toString(), notificationType.name(),
+ status.name(), artifactURL, "ASDC", "sendASDCNotification");
+ logger.debug (event);
- long subStarttime = System.currentTimeMillis ();
String action = "";
try {
IDistributionStatusMessage message = new DistributionStatusMessage (artifactURL,
@@ -529,10 +519,11 @@ public class ASDCController {
default:
break;
}
- } catch (RuntimeException e) {
- LOGGER.warn (MessageEnum.ASDC_SEND_NOTIF_ASDC_EXEC, "ASDC", "sendASDCNotification", MsoLogger.ErrorCode.SchemaError, "RuntimeException - sendASDCNotification", e);
+ } catch (RuntimeException e) {
+ logger.warn("{} {} {} {} {}", MessageEnum.ASDC_SEND_NOTIF_ASDC_EXEC.toString(), "ASDC",
+ "sendASDCNotification", MsoLogger.ErrorCode.SchemaError.getValue(),
+ "RuntimeException - sendASDCNotification", e);
}
- LOGGER.recordMetricEvent (subStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully sent notification to ASDC", "ASDC", action, null);
}
protected void sendFinalDistributionStatus (
@@ -541,7 +532,8 @@ public class ASDCController {
String errorReason) {
- LOGGER.debug ("Enter sendFinalDistributionStatus with DistributionID " + distributionID + " and Status of " + status.name() + " and ErrorReason " + errorReason);
+ logger.debug("Enter sendFinalDistributionStatus with DistributionID " + distributionID + " and Status of " + status
+ .name() + " and ErrorReason " + errorReason);
long subStarttime = System.currentTimeMillis ();
try {
@@ -556,11 +548,11 @@ public class ASDCController {
}
- } catch (RuntimeException e) {
- LOGGER.debug ("Exception caught in sendFinalDistributionStatus " + e.getMessage());
- LOGGER.warn (MessageEnum.ASDC_SEND_NOTIF_ASDC_EXEC, "ASDC", "sendASDCNotification", MsoLogger.ErrorCode.SchemaError, "RuntimeException - sendASDCNotification", e);
- }
- LOGGER.recordMetricEvent (subStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully sent Final notification to ASDC", "ASDC", null, null);
+ } catch (RuntimeException e) {
+ logger.debug("Exception caught in sendFinalDistributionStatus {}", e.getMessage());
+ logger.warn("{} {} {} {} {}", MessageEnum.ASDC_SEND_NOTIF_ASDC_EXEC.toString(), "ASDC", "sendASDCNotification",
+ MsoLogger.ErrorCode.SchemaError.getValue(), "RuntimeException - sendASDCNotification", e);
+ }
}
private Optional<String> getNotificationJson(INotificationData iNotif) {
@@ -574,7 +566,7 @@ public class ASDCController {
try {
returnValue = Optional.of(mapper.writeValueAsString(iNotif));
} catch (JsonProcessingException e) {
- LOGGER.error("Error converting incoming ASDC notification to JSON" , e);
+ logger.error("Error converting incoming ASDC notification to JSON" , e);
}
return returnValue;
}
@@ -587,15 +579,14 @@ public class ASDCController {
for (IResourceInstance resource : iNotif.getResources ()) {
noOfArtifacts += resource.getArtifacts ().size ();
}
- LOGGER.info (MessageEnum.ASDC_RECEIVE_CALLBACK_NOTIF,
- String.valueOf (noOfArtifacts),
- iNotif.getServiceUUID (), "ASDC");
-
+ logger.info("{} {} {} {}", MessageEnum.ASDC_RECEIVE_CALLBACK_NOTIF.toString(), String.valueOf(noOfArtifacts),
+ iNotif.getServiceUUID(), "ASDC");
try {
- LOGGER.debug(ASDCNotificationLogging.dumpASDCNotification(iNotif));
- LOGGER.info(MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF, iNotif.getServiceUUID(), "ASDC", "treatNotification");
-
- this.changeControllerStatus(ASDCControllerStatus.BUSY);
+ logger.debug(ASDCNotificationLogging.dumpASDCNotification(iNotif));
+ logger.info("{} {} {} {}", MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF.toString(), iNotif.getServiceUUID(), "ASDC",
+ "treatNotification");
+
+ this.changeControllerStatus(ASDCControllerStatus.BUSY);
Optional<String> notificationMessage = getNotificationJson(iNotif);
toscaInstaller.processWatchdog(iNotif.getDistributionID(), iNotif.getServiceUUID(), notificationMessage,
asdcConfig.getConsumerID());
@@ -622,7 +613,7 @@ public class ASDCController {
distributionStatus = wd.getOverallDistributionStatus(iNotif.getDistributionID());
Thread.sleep(watchDogTimeout / 10);
}catch(Exception e){
- LOGGER.debug ("Exception in Watchdog Loop " + e.getMessage());
+ logger.debug ("Exception in Watchdog Loop {}", e.getMessage());
Thread.sleep(watchDogTimeout / 10);
}
@@ -639,25 +630,25 @@ public class ASDCController {
}
if(!componentsComplete){
- LOGGER.debug("Timeout of " + watchDogTimeout + " seconds was reached before all components reported status");
+ logger.debug("Timeout of {} seconds was reached before all components reported status", watchDogTimeout);
watchdogError = "Timeout occurred while waiting for all components to report status";
overallStatus = DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.name();
}
if(distributionStatus == null){
overallStatus = DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.name();
- LOGGER.debug("DistributionStatus is null for DistributionId: " + iNotif.getDistributionID());
+ logger.debug("DistributionStatus is null for DistributionId: {}", iNotif.getDistributionID());
}
try {
wd.executePatchAAI(iNotif.getDistributionID(), iNotif.getServiceInvariantUUID(), overallStatus);
- LOGGER.debug ("A&AI Updated succefully with Distribution Status!");
+ logger.debug("A&AI Updated succefully with Distribution Status!");
}
catch(Exception e) {
- LOGGER.debug ("Exception in Watchdog executePatchAAI(): " + e.getMessage());
+ logger.debug("Exception in Watchdog executePatchAAI(): {}", e.getMessage());
watchdogError = "Error calling A&AI " + e.getMessage();
if(e.getCause() != null) {
- LOGGER.debug ("Exception caused by: " + e.getCause().getMessage());
+ logger.debug("Exception caused by: {}", e.getCause().getMessage());
}
}
@@ -676,27 +667,31 @@ public class ASDCController {
} catch(ObjectOptimisticLockingFailureException e) {
-
- LOGGER.debug ("OptimisticLockingFailure for DistributionId: " + iNotif.getDistributionID() + " Another process has already altered this distribution, so not going to process it on this site.");
- LOGGER.error (MessageEnum.ASDC_GENERAL_EXCEPTION_ARG,
- "Database concurrency exception: ", "ASDC", "treatNotification", MsoLogger.ErrorCode.BusinessProcesssError, "RuntimeException in treatNotification",
- e);
-
+
+ logger.debug("OptimisticLockingFailure for DistributionId: {} Another process "
+ + "has already altered this distribution, so not going to process it on this site.",
+ iNotif.getDistributionID());
+ logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
+ "Database concurrency exception: ", "ASDC", "treatNotification",
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "RuntimeException in treatNotification", e);
+
} catch (Exception e) {
- LOGGER.error (MessageEnum.ASDC_GENERAL_EXCEPTION_ARG,
- "Unexpected exception caught during the notification processing", "ASDC", "treatNotification", MsoLogger.ErrorCode.SchemaError, "RuntimeException in treatNotification",
+ logger.error("", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
+ "Unexpected exception caught during the notification processing", "ASDC",
+ "treatNotification", MsoLogger.ErrorCode.SchemaError.getValue(), "RuntimeException in treatNotification",
e);
-
- try {
- wd.executePatchAAI(iNotif.getDistributionID(), iNotif.getServiceInvariantUUID(), DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.name());
- LOGGER.debug ("A&AI Updated succefully with Distribution Status of " + DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.name());
- }
- catch(Exception aaiException) {
- LOGGER.debug ("Exception in executePatchAAI(): " + aaiException);
- if(aaiException.getCause() != null) {
- LOGGER.debug ("Exception caused by: " + aaiException.getCause().getMessage());
- }
- }
+
+ try {
+ wd.executePatchAAI(iNotif.getDistributionID(), iNotif.getServiceInvariantUUID(),
+ DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.name());
+ logger.debug("A&AI Updated succefully with Distribution Status of {}",
+ DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.name());
+ } catch (Exception aaiException) {
+ logger.debug("Exception in executePatchAAI(): {}", aaiException);
+ if (aaiException.getCause() != null) {
+ logger.debug("Exception caused by: {}", aaiException.getCause().getMessage());
+ }
+ }
sendFinalDistributionStatus(iNotif.getDistributionID(), DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR, e.getMessage());
@@ -735,7 +730,8 @@ public class ASDCController {
String resourceType = resourceStructure.getResourceInstance().getResourceType();
String category = resourceStructure.getResourceInstance().getCategory();
- LOGGER.debug("Processing Resource Type: " + resourceType + " and Model UUID: " + resourceStructure.getResourceInstance().getResourceUUID());
+ logger.debug("Processing Resource Type: " + resourceType + " and Model UUID: " + resourceStructure
+ .getResourceInstance().getResourceUUID());
if("VF".equals(resourceType) && !"Allotted Resource".equalsIgnoreCase(category)){
@@ -747,15 +743,16 @@ public class ASDCController {
if (resultArtifact != null) {
if (ASDCConfiguration.VF_MODULES_METADATA.equals(artifact.getArtifactType())) {
- LOGGER.debug("VF_MODULE_ARTIFACT: "+new String(resultArtifact.getArtifactPayload(),"UTF-8"));
- LOGGER.debug(ASDCNotificationLogging.dumpVfModuleMetaDataList(resourceStructure.decodeVfModuleArtifact(resultArtifact.getArtifactPayload())));
+ logger.debug("VF_MODULE_ARTIFACT: "+ new String(resultArtifact.getArtifactPayload(),"UTF-8"));
+ logger.debug(ASDCNotificationLogging.dumpVfModuleMetaDataList(resourceStructure.decodeVfModuleArtifact
+ (resultArtifact.getArtifactPayload())));
}
resourceStructure.addArtifactToStructure(distributionClient,artifact, resultArtifact);
}
}
//Deploy VF resource and artifacts
- LOGGER.debug("Preparing to deploy Service: " + iNotif.getServiceUUID());
+ logger.debug("Preparing to deploy Service: {}", iNotif.getServiceUUID());
try{
this.deployResourceStructure(resourceStructure, toscaResourceStructure);
@@ -763,7 +760,7 @@ public class ASDCController {
} catch(ArtifactInstallerException e){
deploySuccessful = false;
errorMessage = e.getMessage();
- LOGGER.error(e);
+ logger.error("Exception occurred", e);
}
}
@@ -772,7 +769,7 @@ public class ASDCController {
// There are cases where the Service has no VF resources, those are handled here
if (!hasVFResource) {
- LOGGER.debug("No resources found for Service: " + iNotif.getServiceUUID());
+ logger.debug("No resources found for Service: {}", iNotif.getServiceUUID());
try{
resourceStructure = new VfResourceStructure(iNotif,new ResourceInstance());
@@ -782,15 +779,16 @@ public class ASDCController {
} catch(ArtifactInstallerException e){
deploySuccessful = false;
errorMessage = e.getMessage();
- LOGGER.error(e);
+ logger.error("Exception occurred", e);
}
}
this.sendCsarDeployNotification(iNotif, resourceStructure, toscaResourceStructure, deploySuccessful, errorMessage);
} catch (ASDCDownloadException | UnsupportedEncodingException e) {
- LOGGER.error(MessageEnum.ASDC_GENERAL_EXCEPTION_ARG,
- "Exception caught during Installation of artifact", "ASDC", "processResourceNotification", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in processResourceNotification", e);
- }
+ logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception caught during Installation of artifact", "ASDC", "processResourceNotification",
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in processResourceNotification", e);
+ }
}
protected void processCsarServiceArtifacts (INotificationData iNotif, ToscaResourceStructure toscaResourceStructure) {
@@ -812,12 +810,13 @@ public class ASDCController {
toscaResourceStructure.setServiceVersion(iNotif.getServiceVersion());
- LOGGER.debug(ASDCNotificationLogging.dumpCSARNotification(iNotif, toscaResourceStructure));
+ logger.debug(ASDCNotificationLogging.dumpCSARNotification(iNotif, toscaResourceStructure));
} catch(Exception e){
- LOGGER.error(MessageEnum.ASDC_GENERAL_EXCEPTION_ARG,
- "Exception caught during processCsarServiceArtifacts", "ASDC", "processCsarServiceArtifacts", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in processCsarServiceArtifacts", e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception caught during processCsarServiceArtifacts", "ASDC", "processCsarServiceArtifacts",
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in processCsarServiceArtifacts", e);
}
}
else if(artifact.getArtifactType().equals(ASDCConfiguration.WORKFLOWS)){
@@ -830,14 +829,16 @@ public class ASDCController {
toscaResourceStructure.setToscaArtifact(artifact);
- LOGGER.debug(ASDCNotificationLogging.dumpASDCNotification(iNotif));
+ logger.debug(ASDCNotificationLogging.dumpASDCNotification(iNotif));
} catch(Exception e){
- System.out.println("Whats the error " + e.getMessage());
- LOGGER.error(MessageEnum.ASDC_GENERAL_EXCEPTION_ARG,
- "Exception caught during processCsarServiceArtifacts", "ASDC", "processCsarServiceArtifacts", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in processCsarServiceArtifacts", e);
- }
+ logger.info("Whats the error {}", e.getMessage());
+ logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception caught during processCsarServiceArtifacts", "ASDC", "processCsarServiceArtifacts",
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in processCsarServiceArtifacts",
+ e);
+ }
}
@@ -865,5 +866,4 @@ public class ASDCController {
}
return UNKNOWN;
}
-
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCNotificationCallBack.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCNotificationCallBack.java
index ab5b7aa39e..876c5e164f 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCNotificationCallBack.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCNotificationCallBack.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -22,8 +24,8 @@ package org.onap.so.asdc.client;
import org.onap.sdc.api.consumer.INotificationCallback;
import org.onap.sdc.api.notification.INotificationData;
-import org.onap.so.logger.MsoLogger;
-import org.onap.so.utils.UUIDChecker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -38,7 +40,7 @@ public final class ASDCNotificationCallBack implements INotificationCallback {
@Autowired
private ASDCController asdcController;
- protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC,ASDCNotificationCallBack.class);
+ protected static final Logger logger = LoggerFactory.getLogger(ASDCNotificationCallBack.class);
/**
* This method can be called multiple times at the same moment.
@@ -46,13 +48,8 @@ public final class ASDCNotificationCallBack implements INotificationCallback {
*/
@Override
public void activateCallback (INotificationData iNotif) {
- long startTime = System.currentTimeMillis ();
- UUIDChecker.generateUUID (LOGGER);
- MsoLogger.setServiceName ("NotificationHandler");
- MsoLogger.setLogContext (iNotif.getDistributionID (), iNotif.getServiceUUID ());
String event = "Receive a callback notification in ASDC, nb of resources: " + iNotif.getResources ().size ();
- LOGGER.debug(event);
+ logger.debug(event);
asdcController.treatNotification (iNotif);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Completed the treatment of the notification");
}
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java
index d2ac8e7c2d..612599b2ed 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -27,8 +29,8 @@ import org.onap.so.asdc.client.exceptions.ArtifactInstallerException;
import org.onap.so.asdc.installer.heat.ToscaResourceInstaller;
import org.onap.so.db.request.beans.WatchdogDistributionStatus;
import org.onap.so.db.request.data.repository.WatchdogDistributionStatusRepository;
-import org.onap.so.logger.MsoLogger;
-import org.onap.so.utils.UUIDChecker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -38,18 +40,13 @@ public final class ASDCStatusCallBack implements IStatusCallback {
@Autowired
private ToscaResourceInstaller toscaInstaller;
- protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC,ASDCStatusCallBack.class);
+ protected static final Logger logger = LoggerFactory.getLogger(ASDCStatusCallBack.class);
@Autowired
private WatchdogDistributionStatusRepository watchdogDistributionStatusRepository;
@Override
public void activateCallback (IStatusData iStatus) {
-
- long startTime = System.currentTimeMillis ();
- UUIDChecker.generateUUID (LOGGER);
- MsoLogger.setServiceName ("ASDCStatusCallBack");
- MsoLogger.setLogContext (iStatus.getDistributionID (), iStatus.getComponentName());
String event = "Receive a callback componentStatus in ASDC, for componentName: " + iStatus.getComponentName() + " and status of " + iStatus.getStatus() + " distributionID of " + iStatus.getDistributionID();
try{
@@ -63,15 +60,14 @@ public final class ASDCStatusCallBack implements IStatusCallback {
watchdogDistributionStatus.setDistributionId(iStatus.getDistributionID ());
watchdogDistributionStatusRepository.save(watchdogDistributionStatus);
}
- LOGGER.debug(event);
+ logger.debug(event);
toscaInstaller.installTheComponentStatus(iStatus);
}
}
}catch(ArtifactInstallerException e){
- LOGGER.error("Error in ASDCStatusCallback " + e.getMessage(),e);
- LOGGER.debug("Error in ASDCStatusCallback " + e.getMessage());
+ logger.error("Error in ASDCStatusCallback {}", e.getMessage(), e);
+ logger.debug("Error in ASDCStatusCallback {}", e.getMessage());
}
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Completed the treatment of the notification");
- }
-} \ No newline at end of file
+ }
+}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/DistributionClientEmulator.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/DistributionClientEmulator.java
index 596ad16d34..ffb7f7a7f4 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/DistributionClientEmulator.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/DistributionClientEmulator.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -27,7 +29,6 @@ import java.util.LinkedList;
import java.util.List;
import org.onap.so.asdc.installer.IVfModuleData;
-import org.onap.so.logger.MsoLogger;
import org.onap.sdc.api.IDistributionClient;
import org.onap.sdc.api.consumer.IComponentDoneStatusMessage;
import org.onap.sdc.api.consumer.IConfiguration;
@@ -42,6 +43,8 @@ import org.onap.sdc.api.results.IDistributionClientResult;
import org.onap.sdc.impl.DistributionClientDownloadResultImpl;
import org.onap.sdc.impl.DistributionClientResultImpl;
import org.onap.sdc.utils.DistributionActionResultEnum;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class DistributionClientEmulator implements IDistributionClient {
@@ -52,7 +55,7 @@ public class DistributionClientEmulator implements IDistributionClient {
private List<IDistributionStatusMessage> distributionMessageReceived = new LinkedList<>();
- private static final MsoLogger logger = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC,DistributionClientEmulator.class );
+ private static final Logger logger = LoggerFactory.getLogger(DistributionClientEmulator.class );
public DistributionClientEmulator() {
}
@@ -90,9 +93,8 @@ public class DistributionClientEmulator implements IDistributionClient {
byte[] inputStream=null;
try {
inputStream = getData(filename);
- } catch (IOException e) {
-
- logger.error("IOException in DistributionClientEmulator.download() method :",e);
+ } catch (IOException e) {
+ logger.error("IOException in DistributionClientEmulator.download() method", e);
}
return new DistributionClientDownloadResultImpl(DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name(),arg0.getArtifactName(),inputStream);
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java
index e86fac72a6..329c139ec3 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -40,6 +42,8 @@ import org.onap.so.asdc.client.test.emulators.JsonStatusData;
import org.onap.so.asdc.installer.heat.ToscaResourceInstaller;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;
@@ -65,7 +69,7 @@ public class ASDCRestInterface {
private static JsonStatusData statusData;
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC,ASDCRestInterface.class );
+ private static final Logger logger = LoggerFactory.getLogger(ASDCRestInterface.class );
@Autowired
private ASDCController asdcController;
@@ -100,21 +104,18 @@ public class ASDCRestInterface {
statusData = JsonStatusData.instantiateNotifFromJsonFile("resource-examples/");
ASDCController asdcController = new ASDCController("asdc-controller1", distributionClientEmulator);
- //LOGGER.info(MessageEnum.ASDC_INIT_ASDC_CLIENT_EXC, notifDataWithoutModuleInfo.getServiceUUID(), "ASDC", "initASDC()");
asdcController.initASDC();
- //LOGGER.info(MessageEnum.ASDC_INIT_ASDC_CLIENT_EXC, notifDataWithoutModuleInfo.getServiceUUID(), "ASDC", "treatNotification()");
toscaInstaller.installTheComponentStatus(statusData);
- //asdcController.treatNotification(notifDataWithoutModuleInfo);
- //LOGGER.info(MessageEnum.ASDC_INIT_ASDC_CLIENT_EXC, notifDataWithoutModuleInfo.getServiceUUID(), "ASDC", "closeASDC()");
asdcController.closeASDC();
}catch(Exception e){
- System.out.println("Error caught " + e.getMessage());
- LOGGER.error(MessageEnum.ASDC_GENERAL_EXCEPTION,
- "Exception caught during ASDCRestInterface", "ASDC", "invokeASDCService", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in invokeASDCService", e);
+ logger.info("Error caught " + e.getMessage());
+ logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION.toString(),
+ "Exception caught during ASDCRestInterface", "ASDC", "invokeASDCService",
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in invokeASDCService", e);
}
- System.out.println("ASDC Updates are complete");
- LOGGER.info(MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC, statusData.getDistributionID(), "ASDC", "ASDC Updates Are Complete");
-
+ logger.info("ASDC Updates are complete");
+ logger.info("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC.toString(), statusData.getDistributionID(), "ASDC",
+ "ASDC Updates Are Complete");
return null;
}
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java
index 6ddc2a8bdd..700a5b16bb 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -50,6 +52,8 @@ import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class ToscaResourceStructure {
@@ -94,9 +98,7 @@ public class ToscaResourceStructure {
private VfModule vfModule;
private VfModuleCustomization vfModuleCustomization;
-
- //private VnfResource vnfResource;
-
+
private VnfResourceCustomization vnfResourceCustomization;
private AllottedResource allottedResource;
@@ -109,7 +111,7 @@ public class ToscaResourceStructure {
private ToscaCsar toscaCsar;
- protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC, ToscaResourceStructure.class);
+ protected static final Logger logger = LoggerFactory.getLogger(ToscaResourceStructure.class);
public ToscaResourceStructure(){
@@ -122,22 +124,24 @@ public class ToscaResourceStructure {
SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance();//Autoclosable
- LOGGER.debug("MSO config path is: " + System.getProperty("mso.config.path"));
+ logger.debug("MSO config path is: " + System.getProperty("mso.config.path"));
String filePath = Paths.get(System.getProperty("mso.config.path"), "ASDC", artifact.getArtifactVersion(), artifact.getArtifactName()).normalize().toString();
File spoolFile = new File(filePath);
-
- LOGGER.debug("ASDC File path is: " + spoolFile.getAbsolutePath());
- LOGGER.info(MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF, "***PATH", "ASDC", spoolFile.getAbsolutePath());
-
+
+ logger.debug("ASDC File path is: {}", spoolFile.getAbsolutePath());
+ logger.info("{} {} {} {}", MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF.toString(), "***PATH", "ASDC",
+ spoolFile.getAbsolutePath());
sdcCsarHelper = factory.getSdcCsarHelper(spoolFile.getAbsolutePath(),false);
}catch(Exception e){
- System.out.println("System out " + e.getMessage());
- LOGGER.error(MessageEnum.ASDC_GENERAL_EXCEPTION_ARG,
- "Exception caught during parser *****LOOK********* " + artifact.getArtifactName(), "ASDC", "processResourceNotification", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in processResourceNotification", e);
+ logger.info("System out {}", e.getMessage());
+ logger.error("{} {} {} {} {} {}", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception caught during parser *****LOOK********* " + artifact.getArtifactName(), "ASDC",
+ "processResourceNotification", MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+ "Exception in " + "processResourceNotification", e);
throw new ASDCDownloadException ("Exception caught when passing the csar file to the parser ", e);
}
@@ -474,10 +478,6 @@ public class ToscaResourceStructure {
this.toscaCsar = toscaCsar;
}
- public static MsoLogger getLogger() {
- return LOGGER;
- }
-
public boolean isDeployedSuccessfully() {
return isDeployedSuccessfully;
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java
index f5e45115fd..5b24dc56a1 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -33,7 +35,6 @@ import org.onap.so.db.catalog.beans.AllottedResourceCustomization;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VnfResource;
-import org.onap.so.logger.MsoLogger;
import org.onap.sdc.api.IDistributionClient;
import org.onap.sdc.api.notification.IArtifactInfo;
import org.onap.sdc.api.notification.INotificationData;
@@ -44,6 +45,9 @@ import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* This structure exists to avoid having issues if the order of the vfResource/vfmodule artifact is not good (tree structure).
*
@@ -52,7 +56,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
public class VfResourceStructure {
- protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC, VfResourceStructure.class);
+ protected static final Logger logger = LoggerFactory.getLogger(VfResourceStructure.class);
private boolean isDeployedSuccessfully=false;
/**
@@ -134,8 +138,9 @@ public class VfResourceStructure {
//for vender tosca VNF there is no VFModule in VF
if (vfModulesMetadataList == null) {
- LOGGER.info(MessageEnum.ASDC_GENERAL_INFO,"There is no VF mudules in the VF.", "ASDC", "createVfModuleStructures");
- return;
+ logger.info("{} {} {} {}", MessageEnum.ASDC_GENERAL_INFO.toString(), "There is no VF mudules in the VF.", "ASDC",
+ "createVfModuleStructures");
+ return;
}
for (IVfModuleData vfModuleMeta:vfModulesMetadataList) {
vfModulesStructureList.add(new VfModuleStructure(this,vfModuleMeta));
@@ -218,11 +223,11 @@ public class VfResourceStructure {
return listVFModuleMetaData;
} catch (JsonParseException e) {
- LOGGER.debug("JsonParseException : ",e);
+ logger.debug("JsonParseException : ",e);
} catch (JsonMappingException e) {
- LOGGER.debug("JsonMappingException : ",e);
+ logger.debug("JsonMappingException : ",e);
} catch (IOException e) {
- LOGGER.debug("IOException : ",e);
+ logger.debug("IOException : ",e);
}
return null;
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java
index 59030e6c22..7e3f5dfef6 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java
@@ -47,13 +47,15 @@ import org.apache.http.entity.mime.content.StringBody;
import org.apache.http.impl.client.HttpClientBuilder;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@Component
public class BpmnInstaller {
- protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC,BpmnInstaller.class);
+ protected static final Logger logger = LoggerFactory.getLogger(BpmnInstaller.class);
private static final String BPMN_SUFFIX = ".bpmn";
private static final String CAMUNDA_URL = "mso.camundaURL";
private static final String CREATE_DEPLOYMENT_PATH = "/sobpmnengine/deployment/create";
@@ -62,7 +64,7 @@ public class BpmnInstaller {
private Environment env;
public void installBpmn(String csarFilePath) {
- LOGGER.info("Deploying BPMN files from " + csarFilePath);
+ logger.info("Deploying BPMN files from {}", csarFilePath);
try {
ZipInputStream csarFile = new ZipInputStream(new FileInputStream(Paths.get(csarFilePath).normalize().toString()));
ZipEntry entry = csarFile.getNextEntry();
@@ -70,45 +72,39 @@ public class BpmnInstaller {
while (entry != null) {
String name = entry.getName();
if (name.endsWith(BPMN_SUFFIX)) {
- LOGGER.debug("Attempting to deploy BPMN file: " + name);
+ logger.debug("Attempting to deploy BPMN file: {}", name);
try {
Path p = Paths.get(name);
String fileName = p.getFileName().toString();
extractBpmnFileFromCsar(csarFile, fileName);
HttpResponse response = sendDeploymentRequest(fileName);
- LOGGER.debug("Response status line: " + response.getStatusLine());
- LOGGER.debug("Response entity: " + response.getEntity().toString());
+ logger.debug("Response status line: {}", response.getStatusLine());
+ logger.debug("Response entity: {}", response.getEntity().toString());
if (response.getStatusLine().getStatusCode() != 200) {
- LOGGER.debug("Failed deploying BPMN " + name);
- LOGGER.error(MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL,
- name,
- fileName,
- "",
- Integer.toString(response.getStatusLine().getStatusCode()), "", "", MsoLogger.ErrorCode.DataError, "ASDC BPMN deploy failed");
+ logger.debug("Failed deploying BPMN {}", name);
+ logger
+ .error("{} {} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), name, fileName,
+ Integer.toString(response.getStatusLine().getStatusCode()), MsoLogger.ErrorCode.DataError.getValue(),
+ "ASDC BPMN deploy failed");
}
else {
- LOGGER.debug("Successfully deployed to Camunda: " + name);
+ logger.debug("Successfully deployed to Camunda: {}", name);
}
}
catch (Exception e) {
- LOGGER.debug("Exception :",e);
- LOGGER.error(MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL,
- name,
- "",
- "",
- e.getMessage(), "", "", MsoLogger.ErrorCode.DataError, "ASDC BPMN deploy failed");
+ logger.debug("Exception :", e);
+ logger
+ .error("{} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), name, e.getMessage(),
+ MsoLogger.ErrorCode.DataError.getValue(), "ASDC BPMN deploy failed");
}
}
entry = csarFile.getNextEntry();
}
csarFile.close();
} catch (IOException ex) {
- LOGGER.debug("Exception :",ex);
- LOGGER.error(MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL,
- csarFilePath,
- "",
- "",
- ex.getMessage(), "", "", MsoLogger.ErrorCode.DataError, "ASDC reading CSAR with workflows failed");
+ logger.debug("Exception :", ex);
+ logger.error("{} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), csarFilePath,
+ ex.getMessage(), MsoLogger.ErrorCode.DataError.getValue(), "ASDC reading CSAR with workflows failed");
}
return;
}
@@ -125,12 +121,10 @@ public class BpmnInstaller {
}
}
} catch (Exception e) {
- LOGGER.debug("Exception :", e);
- LOGGER.error(MessageEnum.ASDC_ARTIFACT_CHECK_EXC,
- csarFilePath,"","",
- e.getMessage(), "", "",
- MsoLogger.ErrorCode.DataError, "ASDC Unable to check CSAR entries");
- }
+ logger.debug("Exception :", e);
+ logger.error("{} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_CHECK_EXC.toString(), csarFilePath, e.getMessage(),
+ MsoLogger.ErrorCode.DataError.getValue(), "ASDC Unable to check CSAR entries");
+ }
return workflowsInCsar;
}
@@ -194,7 +188,7 @@ public class BpmnInstaller {
}
/* outputStream.close(); */
} catch (IOException e) {
- LOGGER.error("Unable to open file.", e);
+ logger.error("Unable to open file.", e);
}
}
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
index 60d5d7e061..313a67d43a 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -34,7 +36,6 @@ import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
-import org.hibernate.StaleObjectStateException;
import org.hibernate.exception.ConstraintViolationException;
import org.hibernate.exception.LockAcquisitionException;
import org.onap.sdc.api.notification.IArtifactInfo;
@@ -124,6 +125,8 @@ import org.onap.so.db.request.data.repository.WatchdogDistributionStatusReposito
import org.onap.so.db.request.data.repository.WatchdogServiceModVerIdLookupRepository;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.ObjectOptimisticLockingFailureException;
import org.springframework.stereotype.Component;
@@ -222,7 +225,7 @@ public class ToscaResourceInstaller {
@Autowired
protected ExternalServiceToInternalServiceRepository externalServiceToInternalServiceRepository;
- protected static final MsoLogger logger = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC,ToscaResourceInstaller.class);
+ protected static final Logger logger = LoggerFactory.getLogger(ToscaResourceInstaller.class);
public boolean isResourceAlreadyDeployed(VfResourceStructure vfResourceStruct) throws ArtifactInstallerException {
boolean status = false;
@@ -258,15 +261,16 @@ public class ToscaResourceInstaller {
}
return status;
} catch (Exception e) {
- logger.error(MessageEnum.ASDC_ARTIFACT_CHECK_EXC, "", "", MsoLogger.ErrorCode.SchemaError,
+ logger
+ .error("{} {} {}", MessageEnum.ASDC_ARTIFACT_CHECK_EXC.toString(), MsoLogger.ErrorCode.SchemaError.getValue(),
"Exception - isResourceAlreadyDeployed");
throw new ArtifactInstallerException("Exception caught during checking existence of the VNF Resource.", e);
}
}
public void installTheComponentStatus(IStatusData iStatus) throws ArtifactInstallerException {
- logger.debug("Entering installTheComponentStatus for distributionId " + iStatus.getDistributionID()
- + " and ComponentName " + iStatus.getComponentName());
+ logger.debug("Entering installTheComponentStatus for distributionId {} and ComponentName {}",
+ iStatus.getDistributionID(), iStatus.getComponentName());
try {
WatchdogComponentDistributionStatus cdStatus = new WatchdogComponentDistributionStatus(iStatus.getDistributionID(),
@@ -275,7 +279,7 @@ public class ToscaResourceInstaller {
watchdogCDStatusRepository.save(cdStatus);
} catch (Exception e) {
- logger.debug("Exception caught in installTheComponentStatus " + e.getMessage());
+ logger.debug("Exception caught in installTheComponentStatus {}", e.getMessage());
throw new ArtifactInstallerException("Exception caught in installTheComponentStatus " + e.getMessage());
}
}
@@ -338,18 +342,18 @@ public class ToscaResourceInstaller {
if (dbExceptionToCapture instanceof ConstraintViolationException
|| dbExceptionToCapture instanceof LockAcquisitionException) {
- logger.warn(MessageEnum.ASDC_ARTIFACT_ALREADY_DEPLOYED,
- vfResourceStructure.getResourceInstance().getResourceName(),
- vfResourceStructure.getNotification().getServiceVersion(), "", MsoLogger.ErrorCode.DataError, "Exception - ASCDC Artifact already deployed", e);
+ logger.warn("{} {} {} {} {}", MessageEnum.ASDC_ARTIFACT_ALREADY_DEPLOYED.toString(),
+ vfResourceStructure.getResourceInstance().getResourceName(),
+ vfResourceStructure.getNotification().getServiceVersion(), MsoLogger.ErrorCode.DataError.getValue(),
+ "Exception - ASCDC Artifact already deployed", e);
} else {
String elementToLog = (!artifactListForLogging.isEmpty()
? artifactListForLogging.get(artifactListForLogging.size() - 1).toString()
: "No element listed");
- logger.error(MessageEnum.ASDC_ARTIFACT_INSTALL_EXC, elementToLog, "", "", MsoLogger.ErrorCode.DataError,
- "Exception caught during installation of "
- + vfResourceStructure.getResourceInstance().getResourceName()
- + ". Transaction rollback",
- e);
+ logger.error("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_INSTALL_EXC.toString(), elementToLog,
+ MsoLogger.ErrorCode.DataError.getValue(),
+ "Exception caught during installation of " + vfResourceStructure.getResourceInstance().getResourceName()
+ + ". Transaction rollback", e);
throw new ArtifactInstallerException("Exception caught during installation of "
+ vfResourceStructure.getResourceInstance().getResourceName() + ". Transaction rollback.", e);
}
@@ -739,10 +743,9 @@ public class ToscaResourceInstaller {
break;
case ASDCConfiguration.HEAT_NET:
case ASDCConfiguration.OTHER:
- logger.warn(MessageEnum.ASDC_ARTIFACT_TYPE_NOT_SUPPORT,
- vfModuleArtifact.getArtifactInfo().getArtifactType() + "(Artifact Name:"
- + vfModuleArtifact.getArtifactInfo().getArtifactName() + ")",
- "", "", MsoLogger.ErrorCode.DataError, "Artifact type not supported");
+ logger.warn("{} {} {} {}", MessageEnum.ASDC_ARTIFACT_TYPE_NOT_SUPPORT.toString(),
+ vfModuleArtifact.getArtifactInfo().getArtifactType() + "(Artifact Name:" + vfModuleArtifact.getArtifactInfo()
+ .getArtifactName() + ")", MsoLogger.ErrorCode.DataError.getValue(), "Artifact type not supported");
break;
default:
break;
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java b/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java
index 8c9fb62f31..c95d701cb2 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -36,7 +38,8 @@ import org.onap.so.db.request.beans.WatchdogServiceModVerIdLookup;
import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository;
import org.onap.so.db.request.data.repository.WatchdogDistributionStatusRepository;
import org.onap.so.db.request.data.repository.WatchdogServiceModVerIdLookupRepository;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@@ -44,7 +47,7 @@ import org.springframework.stereotype.Component;
@Component
public class WatchdogDistribution {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC,WatchdogDistribution.class);
+ private static final Logger logger = LoggerFactory.getLogger(WatchdogDistribution.class);
private AAIResourcesClient aaiClient;
@@ -64,7 +67,7 @@ public class WatchdogDistribution {
private String[] componentNames;
public String getOverallDistributionStatus(String distributionId) throws Exception {
- LOGGER.debug("Entered getOverallDistributionStatus method for distrubutionId: " + distributionId);
+ logger.debug("Entered getOverallDistributionStatus method for distrubutionId: {}", distributionId);
String status = null;
try {
@@ -78,11 +81,13 @@ public class WatchdogDistribution {
String distributionStatus = watchdogDistributionStatus.getDistributionIdStatus();
if(DistributionStatus.TIMEOUT.name().equalsIgnoreCase(distributionStatus)) {
- LOGGER.debug("Ignoring to update WatchdogDistributionStatus as distributionId: " + distributionId + " status is set to: " + distributionStatus);
+ logger.debug("Ignoring to update WatchdogDistributionStatus as distributionId: {} status is set to: {}",
+ distributionId, distributionStatus);
return DistributionStatus.TIMEOUT.name();
} else {
List<WatchdogComponentDistributionStatus> results = watchdogCDStatusRepository.findByDistributionId(distributionId);
- LOGGER.debug("Executed RequestDB getWatchdogComponentDistributionStatus for distrubutionId: " + distributionId);
+ logger.debug("Executed RequestDB getWatchdogComponentDistributionStatus for distrubutionId: {}",
+ distributionId);
//*************************************************************************************************************************************************
//**** Compare config values verse DB watchdog component names to see if every component has reported status before returning final result back to ASDC
@@ -98,13 +103,13 @@ public class WatchdogDistribution {
for(WatchdogComponentDistributionStatus cdStatus: cdStatuses){
if(name.equals(cdStatus.getComponentName())){
- LOGGER.debug("Found componentName " + name + " in the WatchDog Component DB");
+ logger.debug("Found componentName {} in the WatchDog Component DB", name);
match = true;
break;
}
}
if(!match){
- LOGGER.debug(name + " has not be updated in the the WatchDog Component DB yet, so ending the loop");
+ logger.debug("{} has not be updated in the the WatchDog Component DB yet, so ending the loop", name);
allComponentsComplete = false;
break;
}
@@ -112,11 +117,12 @@ public class WatchdogDistribution {
if(allComponentsComplete) {
- LOGGER.debug("Components Size matched with the WatchdogComponentDistributionStatus results.");
+ logger.debug("Components Size matched with the WatchdogComponentDistributionStatus results.");
for(WatchdogComponentDistributionStatus componentDist : results) {
String componentDistributionStatus = componentDist.getComponentDistributionStatus();
- LOGGER.debug("Component status: " + componentDistributionStatus + " on componentName: " + componentDist.getComponentName());
+ logger.debug("Component status: {} on componentName: ", componentDistributionStatus, componentDist
+ .getComponentName());
if(componentDistributionStatus.equalsIgnoreCase("COMPONENT_DONE_ERROR")) {
status = DistributionStatus.FAILURE.name();
break;
@@ -127,27 +133,28 @@ public class WatchdogDistribution {
}
}
- LOGGER.debug("Updating overall DistributionStatus to: " + status + " for distributionId: " + distributionId);
+ logger.debug("Updating overall DistributionStatus to: {} for distributionId: ", status, distributionId);
watchdogDistributionStatus.setDistributionIdStatus(status);
watchdogDistributionStatusRepository.save(watchdogDistributionStatus);
} else {
- LOGGER.debug("Components Size Didn't match with the WatchdogComponentDistributionStatus results.");
+ logger.debug("Components Size Didn't match with the WatchdogComponentDistributionStatus results.");
status = DistributionStatus.INCOMPLETE.name();
return status;
}
}
}catch (Exception e) {
- LOGGER.debug("Exception occurred on getOverallDistributionStatus : " + e.getMessage());
- LOGGER.error(e);
+ logger.debug("Exception occurred on getOverallDistributionStatus : {}", e.getMessage());
+ logger.error("Exception occurred", e);
throw new Exception(e);
}
- LOGGER.debug("Exiting getOverallDistributionStatus method in WatchdogDistribution");
+ logger.debug("Exiting getOverallDistributionStatus method in WatchdogDistribution");
return status;
}
public void executePatchAAI(String distributionId, String serviceModelInvariantUUID, String distributionStatus) throws Exception {
- LOGGER.debug("Entered executePatchAAI method with distrubutionId: " + distributionId + " and distributionStatus: " + distributionStatus);
+ logger.debug("Entered executePatchAAI method with distrubutionId: {} and distributionStatus: ", distributionId,
+ distributionStatus);
try {
WatchdogServiceModVerIdLookup lookup = watchdogModVerIdLookupRepository.findOneByDistributionId(distributionId);
@@ -156,28 +163,29 @@ public class WatchdogDistribution {
if(lookup != null) {
serviceModelVersionId = lookup.getServiceModelVersionId();
}
-
- LOGGER.debug("Executed RequestDB getWatchdogServiceModVerIdLookup with distributionId: " + distributionId + " and serviceModelVersionId: " + serviceModelVersionId);
- LOGGER.debug("ASDC Notification ServiceModelInvariantUUID : " + serviceModelInvariantUUID);
+
+ logger.debug("Executed RequestDB getWatchdogServiceModVerIdLookup with distributionId: {} "
+ + "and serviceModelVersionId: {}", distributionId, serviceModelVersionId);
+ logger.debug("ASDC Notification ServiceModelInvariantUUID : {}", serviceModelInvariantUUID);
if(serviceModelInvariantUUID == null || "".equals(serviceModelVersionId)) {
String error = "No Service found with serviceModelInvariantUUID: " + serviceModelInvariantUUID;
- LOGGER.debug(error);
+ logger.debug(error);
throw new Exception(error);
}
AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.MODEL_VER, serviceModelInvariantUUID, serviceModelVersionId);
aaiUri.depth(Depth.ZERO); //Do not return relationships if any
- LOGGER.debug("Target A&AI Resource URI: " + aaiUri.build().toString());
+ logger.debug("Target A&AI Resource URI: {}", aaiUri.build().toString());
Map<String, String> payload = new HashMap<>();
payload.put("distribution-status", distributionStatus);
getAaiClient().update(aaiUri, payload);
-
- LOGGER.debug("A&AI UPDATE MODEL Version is success!");
+
+ logger.debug("A&AI UPDATE MODEL Version is success!");
} catch (Exception e) {
- LOGGER.debug("Exception occurred on executePatchAAI : " + e.getMessage());
- LOGGER.error(e);
+ logger.debug("Exception occurred on executePatchAAI : {}", e.getMessage());
+ logger.error("Exception occurred", e);
throw new Exception(e);
}
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/util/NotificationLogging.java b/asdc-controller/src/main/java/org/onap/so/asdc/util/NotificationLogging.java
index 965f8b7d49..fae1da374a 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/util/NotificationLogging.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/util/NotificationLogging.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -34,15 +36,16 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.onap.so.logger.MsoLogger;
import org.onap.sdc.api.notification.INotificationData;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class NotificationLogging implements InvocationHandler {
private static Map<Object, List<Method>> objectMethodsToLog = new HashMap<>();
- protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC, NotificationLogging.class);
+ protected static final Logger logger = LoggerFactory.getLogger(NotificationLogging.class);
private static InvocationHandler handler = (arg0, arg1, arg2) -> {
List<Method> methods = objectMethodsToLog.get(arg0);
@@ -93,7 +96,7 @@ public class NotificationLogging implements InvocationHandler {
buffer.append(testNull(m.invoke(iNotif, (Object[])null)));
} catch (IllegalAccessException | IllegalArgumentException
| InvocationTargetException e) {
- LOGGER.debug("Exception :"+e);
+ logger.debug("Exception", e);
buffer.append("UNREADABLE");
}
buffer.append(System.lineSeparator());
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/xml/XmlTool.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/xml/XmlTool.java
index 49bf95fab0..6c8070f9bd 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/xml/XmlTool.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/xml/XmlTool.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -21,7 +23,6 @@
package org.onap.so.bpmn.core.xml;
-import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -50,9 +51,9 @@ import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.apache.commons.lang3.StringEscapeUtils;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
-import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
@@ -64,7 +65,7 @@ import org.xml.sax.SAXException;
public final class XmlTool {
private static final Map<String, Integer> ENTITIES = new HashMap<>();
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.BPEL, XmlTool.class);
+ private static final Logger logger = LoggerFactory.getLogger(XmlTool.class);
static {
ENTITIES.put("amp", 38);
ENTITIES.put("quot", 34);
@@ -165,7 +166,7 @@ public final class XmlTool {
*/
public static String removeNamespaces(Object xml) {
if (xml == null) {
- LOGGER.debug("removeNamespaces input object is null , returning null");
+ logger.debug("removeNamespaces input object is null , returning null");
return null;
}
@@ -204,7 +205,7 @@ public final class XmlTool {
}
return out.toString();
} catch (Exception e) {
- LOGGER.debug("Exception at readResourceFile stream: " + e);
+ logger.debug("Exception at readResourceFile stream: " + e);
return null;
}
}
@@ -242,7 +243,7 @@ public final class XmlTool {
//System.out.println("Did not find element tag " + elementTag + " in XML");
return Optional.empty();
} else {
- modNode.setTextContent(newValue);
+ modNode.setTextContent(newValue);
}
TransformerFactory transformerFactory = TransformerFactory.newInstance();
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/utils/CamundaDBSetup.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/utils/CamundaDBSetup.java
index f3cc094873..15f6fbe008 100644
--- a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/utils/CamundaDBSetup.java
+++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/utils/CamundaDBSetup.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -21,18 +23,18 @@
package org.onap.so.bpmn.core.utils;
import java.sql.Connection;
-import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Sets up the unit test (H2) database for Camunda.
*/
public class CamundaDBSetup {
private static boolean isDBConfigured = false;
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CamundaDBSetup.class);
+ private static final Logger logger = LoggerFactory.getLogger(CamundaDBSetup.class);
private CamundaDBSetup() {
}
@@ -42,7 +44,7 @@ public class CamundaDBSetup {
return;
}
- LOGGER.debug ("Configuring the Camunda H2 database for MSO");
+ logger.debug ("Configuring the Camunda H2 database for MSO");
Connection connection = null;
PreparedStatement stmt = null;
@@ -57,7 +59,7 @@ public class CamundaDBSetup {
try {
stmt.close();
} catch (Exception e) {
- LOGGER.debug("Exception :",e);
+ logger.debug("Exception :",e);
}
}
@@ -65,9 +67,9 @@ public class CamundaDBSetup {
try {
connection.close();
} catch (Exception e) {
- LOGGER.debug("Exception :",e);
+ logger.debug("Exception :",e);
}
}
}
}
-} \ No newline at end of file
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java
index 13fe61f704..5cc0281407 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java
@@ -23,7 +23,7 @@
package org.onap.so.bpmn.infrastructure.pnf.delegate;
import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
import java.util.HashMap;
@@ -62,7 +62,7 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
@Test
public void shouldWaitForMessageFromDmaapAndUpdateAaiEntryWhenAaiEntryExists() {
// given
- variables.put(CORRELATION_ID, PnfManagementTestImpl.ID_WITH_ENTRY);
+ variables.put(PNF_CORRELATION_ID, PnfManagementTestImpl.ID_WITH_ENTRY);
// when
ProcessInstance instance = runtimeService
.startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
@@ -73,7 +73,7 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
assertThat(instance).isEnded().hasPassedInOrder(
"CreateAndActivatePnf_StartEvent",
"CheckInputs",
- "CheckAiiForCorrelationId",
+ "CheckAiiForPnfCorrelationId",
"DoesAaiContainInfoAboutPnf",
"AaiEntryExists",
"InformDmaapClient",
@@ -88,7 +88,7 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
@Test
public void shouldCreateAaiEntryWaitForMessageFromDmaapAndUpdateAaiEntryWhenNoAaiEntryExists() {
// given
- variables.put(CORRELATION_ID, PnfManagementTestImpl.ID_WITHOUT_ENTRY);
+ variables.put(PNF_CORRELATION_ID, PnfManagementTestImpl.ID_WITHOUT_ENTRY);
// when
ProcessInstance instance = runtimeService
.startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
@@ -99,7 +99,7 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
assertThat(instance).isEnded().hasPassedInOrder(
"CreateAndActivatePnf_StartEvent",
"CheckInputs",
- "CheckAiiForCorrelationId",
+ "CheckAiiForPnfCorrelationId",
"DoesAaiContainInfoAboutPnf",
"CreatePnfEntryInAai",
"AaiEntryExists",
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
index 146e07b820..6a5f9fac74 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
@@ -30,19 +30,19 @@ import org.springframework.stereotype.Component;
@Primary
public class DmaapClientTestImpl implements DmaapClient {
- private String correlationId;
+ private String pnfCorrelationId;
private Runnable informConsumer;
@Override
- public void registerForUpdate(String correlationId, Runnable informConsumer) {
- this.correlationId = correlationId;
+ public void registerForUpdate(String pnfCorrelationId, Runnable informConsumer) {
+ this.pnfCorrelationId = pnfCorrelationId;
this.informConsumer = informConsumer;
}
@Override
- public Runnable unregister(String correlationId) {
- if (Objects.equals(this.correlationId, correlationId)) {
- this.correlationId = null;
+ public Runnable unregister(String pnfCorrelationId) {
+ if (Objects.equals(this.pnfCorrelationId, pnfCorrelationId)) {
+ this.pnfCorrelationId = null;
Runnable informConsumer = this.informConsumer;
this.informConsumer = null;
return informConsumer;
@@ -50,8 +50,8 @@ public class DmaapClientTestImpl implements DmaapClient {
return null;
}
- public String getCorrelationId() {
- return correlationId;
+ public String getPnfCorrelationId() {
+ return pnfCorrelationId;
}
public Runnable getInformConsumer() {
@@ -63,6 +63,6 @@ public class DmaapClientTestImpl implements DmaapClient {
}
public boolean haveRegisteredConsumer() {
- return correlationId != null;
+ return pnfCorrelationId != null;
}
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java
index 84c983619b..f9db93e3f7 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java
@@ -40,8 +40,8 @@ public class PnfManagementTestImpl implements PnfManagement {
private Map<String, String> serviceAndPnfRelationMap = new HashMap<>();
@Override
- public Optional<Pnf> getEntryFor(String correlationId) {
- if (Objects.equals(correlationId, ID_WITH_ENTRY)) {
+ public Optional<Pnf> getEntryFor(String pnfCorrelationId) {
+ if (Objects.equals(pnfCorrelationId, ID_WITH_ENTRY)) {
return Optional.of(new Pnf());
} else {
return Optional.empty();
@@ -49,8 +49,8 @@ public class PnfManagementTestImpl implements PnfManagement {
}
@Override
- public void createEntry(String correlationId, Pnf entry) {
- created.put(correlationId, entry);
+ public void createEntry(String pnfCorrelationId, Pnf entry) {
+ created.put(pnfCorrelationId, entry);
}
@Override
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.java
index 05109abc84..439591a295 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.java
@@ -33,8 +33,8 @@ public class CancelDmaapSubscription implements JavaDelegate {
@Override
public void execute(DelegateExecution execution) {
- String correlationId = (String) execution.getVariable(ExecutionVariableNames.CORRELATION_ID);
- dmaapClient.unregister(correlationId);
+ String pnfCorrelationId = (String) execution.getVariable(ExecutionVariableNames.PNF_CORRELATION_ID);
+ dmaapClient.unregister(pnfCorrelationId);
}
@Autowired
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegate.java
index a8fb21540a..e0fa41b7a1 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegate.java
@@ -21,7 +21,7 @@
package org.onap.so.bpmn.infrastructure.pnf.delegate;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_PNF;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID;
import java.io.IOException;
@@ -35,16 +35,16 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
- * Implementation of "Check AAI for correlation_id" task in CreateAndActivatePnfResource.bpmn
+ * Implementation of "Check AAI for pnf_correlation_id" task in CreateAndActivatePnfResource.bpmn
*
- * Inputs: - correlationId - String
+ * Inputs: - pnfCorrelationId - String
*
* Outputs: - aaiContainsInfoAboutPnf - local Boolean
*/
@Component
-public class CheckAaiForCorrelationIdDelegate implements JavaDelegate {
+public class CheckAaiForPnfCorrelationIdDelegate implements JavaDelegate {
- private static final Logger logger = LoggerFactory.getLogger(CheckAaiForCorrelationIdDelegate.class);
+ private static final Logger logger = LoggerFactory.getLogger(CheckAaiForPnfCorrelationIdDelegate.class);
private PnfManagement pnfManagement;
@@ -55,13 +55,13 @@ public class CheckAaiForCorrelationIdDelegate implements JavaDelegate {
@Override
public void execute(DelegateExecution execution) {
- String correlationId = (String) execution.getVariable(CORRELATION_ID);
- if (correlationId == null) {
- new ExceptionUtil().buildAndThrowWorkflowException(execution, 500, CORRELATION_ID + " is not set");
+ String pnfCorrelationId = (String) execution.getVariable(PNF_CORRELATION_ID);
+ if (pnfCorrelationId == null) {
+ new ExceptionUtil().buildAndThrowWorkflowException(execution, 500, PNF_CORRELATION_ID + " is not set");
}
try {
- boolean isEntry = pnfManagement.getEntryFor(correlationId).isPresent();
- logger.debug("AAI entry is found for pnf correlation id {}: {}", CORRELATION_ID, isEntry);
+ boolean isEntry = pnfManagement.getEntryFor(pnfCorrelationId).isPresent();
+ logger.debug("AAI entry is found for pnf correlation id {}: {}", PNF_CORRELATION_ID, isEntry);
execution.setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, isEntry);
} catch (IOException e) {
new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, e.getMessage());
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java
index c31041fbf7..e56cb83119 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java
@@ -22,7 +22,7 @@
package org.onap.so.bpmn.infrastructure.pnf.delegate;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
import org.camunda.bpm.engine.delegate.DelegateExecution;
@@ -38,7 +38,7 @@ import org.springframework.stereotype.Component;
* Implementation of "Create Pnf entry in AAI" task in CreateAndActivatePnfResource.bpmn
*
* Inputs:
- * - correlationId - String
+ * - pnfCorrelationId - String
* - pnfUuid - String
*/
@Component
@@ -54,12 +54,12 @@ public class CreatePnfEntryInAaiDelegate implements JavaDelegate {
@Override
public void execute(DelegateExecution execution) throws Exception {
- String correlationId = (String) execution.getVariable(CORRELATION_ID);
+ String pnfCorrelationId = (String) execution.getVariable(PNF_CORRELATION_ID);
String pnfUuid = (String) execution.getVariable(PNF_UUID);
Pnf pnf = new Pnf();
pnf.setPnfId(pnfUuid);
- pnf.setPnfName(correlationId);
- pnfManagement.createEntry(correlationId, pnf);
- logger.debug("AAI entry is created for pnf correlation id: {}, pnf uuid: {}", correlationId, pnfUuid);
+ pnf.setPnfName(pnfCorrelationId);
+ pnfManagement.createEntry(pnfCorrelationId, pnf);
+ logger.debug("AAI entry is created for pnf correlation id: {}, pnf uuid: {}", pnfCorrelationId, pnfUuid);
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java
index 7b6706f820..a367bada02 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java
@@ -44,7 +44,7 @@ public class CreateRelation implements JavaDelegate {
@Override
public void execute(DelegateExecution delegateExecution) {
String serviceInstanceId = (String) delegateExecution.getVariable("serviceInstanceId");
- String pnfName = (String) delegateExecution.getVariable("correlationId");
+ String pnfName = (String) delegateExecution.getVariable("pnfCorrelationId");
try {
pnfManagementImpl.createRelation(serviceInstanceId, pnfName);
} catch (Exception e) {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java
index c5caea5f2f..7d449e72a8 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java
@@ -27,7 +27,7 @@ public class ExecutionVariableNames {
private ExecutionVariableNames() {}
- public final static String CORRELATION_ID = "correlationId";
+ public final static String PNF_CORRELATION_ID = "pnfCorrelationId";
public final static String AAI_CONTAINS_INFO_ABOUT_PNF = "aaiContainsInfoAboutPnf";
public final static String AAI_CONTAINS_INFO_ABOUT_IP = "aaiContainsInfoAboutIp";
public final static String DMAAP_MESSAGE = "dmaapMessage";
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java
index 1a75b0998c..96455acb84 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java
@@ -34,9 +34,9 @@ public class InformDmaapClient implements JavaDelegate {
@Override
public void execute(DelegateExecution execution) {
- String correlationId = (String) execution.getVariable(ExecutionVariableNames.CORRELATION_ID);
+ String pnfCorrelationId = (String) execution.getVariable(ExecutionVariableNames.PNF_CORRELATION_ID);
RuntimeService runtimeService = execution.getProcessEngineServices().getRuntimeService();
- dmaapClient.registerForUpdate(correlationId, () ->
+ dmaapClient.registerForUpdate(pnfCorrelationId, () ->
runtimeService
.createMessageCorrelation("WorkflowMessage")
.processInstanceBusinessKey(execution.getProcessBusinessKey())
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java
index 1b185f7c03..1caadea0de 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java
@@ -22,7 +22,7 @@
package org.onap.so.bpmn.infrastructure.pnf.delegate;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_INSTANCE_ID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.TIMEOUT_FOR_NOTIFICATION;
@@ -49,16 +49,16 @@ public class PnfCheckInputs implements JavaDelegate {
@Override
public void execute(DelegateExecution execution) {
- validateCorrelationId(execution);
+ validatePnfCorrelationId(execution);
validatePnfUuid(execution);
validateTimeout(execution);
validateServiceInstanceId(execution);
}
- private void validateCorrelationId(DelegateExecution execution) {
- String correlationId = (String) execution.getVariable(CORRELATION_ID);
- if (Strings.isNullOrEmpty(correlationId)) {
- new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "correlationId variable not defined");
+ private void validatePnfCorrelationId(DelegateExecution execution) {
+ String pnfCorrelationId = (String) execution.getVariable(PNF_CORRELATION_ID);
+ if (Strings.isNullOrEmpty(pnfCorrelationId)) {
+ new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "pnfCorrelationId variable not defined");
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java
index c7e7c7848c..fbf86cc411 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java
@@ -22,7 +22,7 @@ package org.onap.so.bpmn.infrastructure.pnf.dmaap;
public interface DmaapClient {
- void registerForUpdate(String correlationId, Runnable informConsumer);
+ void registerForUpdate(String pnfCorrelationId, Runnable informConsumer);
- Runnable unregister(String correlationId);
+ Runnable unregister(String pnfCorrelationId);
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationId.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java
index 159298b4ad..53f6b78d69 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationId.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java
@@ -31,19 +31,19 @@ import java.util.List;
import java.util.Optional;
import java.util.Spliterator;
-public final class JsonUtilForCorrelationId {
+public final class JsonUtilForPnfCorrelationId {
- private static final String JSON_CORRELATION_ID_FIELD_NAME = "correlationId";
+ private static final String JSON_PNF_CORRELATION_ID_FIELD_NAME = "pnfCorrelationId";
- static List<String> parseJsonToGelAllCorrelationId(String json) {
+ static List<String> parseJsonToGelAllPnfCorrelationId(String json) {
JsonElement je = new JsonParser().parse(json);
JsonArray array = je.getAsJsonArray();
List<String> list = new ArrayList<>();
Spliterator<JsonElement> spliterator = array.spliterator();
spliterator.forEachRemaining(jsonElement -> {
handleEscapedCharacters(jsonElement)
- .ifPresent(jsonObject -> getCorrelationId(jsonObject)
- .ifPresent(correlationId -> list.add(correlationId)));
+ .ifPresent(jsonObject -> getPnfCorrelationId(jsonObject)
+ .ifPresent(pnfCorrelationId -> list.add(pnfCorrelationId)));
});
return list;
}
@@ -55,9 +55,9 @@ public final class JsonUtilForCorrelationId {
return Optional.ofNullable(new JsonParser().parse(jsonElement.getAsString()).getAsJsonObject());
}
- private static Optional<String> getCorrelationId(JsonObject jsonObject) {
- if (jsonObject.has(JSON_CORRELATION_ID_FIELD_NAME)) {
- return Optional.ofNullable(jsonObject.get(JSON_CORRELATION_ID_FIELD_NAME).getAsString());
+ private static Optional<String> getPnfCorrelationId(JsonObject jsonObject) {
+ if (jsonObject.has(JSON_PNF_CORRELATION_ID_FIELD_NAME)) {
+ return Optional.ofNullable(jsonObject.get(JSON_PNF_CORRELATION_ID_FIELD_NAME).getAsString());
}
return Optional.empty();
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
index 52f879b0ad..1b7a69eec8 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
@@ -69,18 +69,18 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
}
@Override
- public synchronized void registerForUpdate(String correlationId, Runnable informConsumer) {
- logger.debug("registering for pnf ready dmaap event for correlation id: {}", correlationId);
- pnfCorrelationIdToThreadMap.put(correlationId, informConsumer);
+ public synchronized void registerForUpdate(String pnfCorrelationId, Runnable informConsumer) {
+ logger.debug("registering for pnf ready dmaap event for pnf correlation id: {}", pnfCorrelationId);
+ pnfCorrelationIdToThreadMap.put(pnfCorrelationId, informConsumer);
if (!dmaapThreadListenerIsRunning) {
startDmaapThreadListener();
}
}
@Override
- public synchronized Runnable unregister(String correlationId) {
- logger.debug("unregistering from pnf ready dmaap event for correlation id: {}", correlationId);
- Runnable runnable = pnfCorrelationIdToThreadMap.remove(correlationId);
+ public synchronized Runnable unregister(String pnfCorrelationId) {
+ logger.debug("unregistering from pnf ready dmaap event for pnf correlation id: {}", pnfCorrelationId);
+ Runnable runnable = pnfCorrelationIdToThreadMap.remove(pnfCorrelationId);
if (pnfCorrelationIdToThreadMap.isEmpty()) {
stopDmaapThreadListener();
}
@@ -113,7 +113,7 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
try {
logger.debug("dmaap listener starts listening pnf ready dmaap topic");
HttpResponse response = httpClient.execute(getRequest);
- getCorrelationIdListFromResponse(response).forEach(this::informAboutPnfReadyIfCorrelationIdFound);
+ getPnfCorrelationIdListFromResponse(response).forEach(this::informAboutPnfReadyIfPnfCorrelationIdFound);
} catch (IOException e) {
logger.error("Exception caught during sending rest request to dmaap for listening event topic", e);
}
@@ -122,20 +122,20 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
}
}
- private List<String> getCorrelationIdListFromResponse(HttpResponse response) throws IOException {
+ private List<String> getPnfCorrelationIdListFromResponse(HttpResponse response) throws IOException {
if (response.getStatusLine().getStatusCode() == 200) {
String responseString = EntityUtils.toString(response.getEntity(), "UTF-8");
if (responseString != null) {
- return JsonUtilForCorrelationId.parseJsonToGelAllCorrelationId(responseString);
+ return JsonUtilForPnfCorrelationId.parseJsonToGelAllPnfCorrelationId(responseString);
}
}
return Collections.emptyList();
}
- private void informAboutPnfReadyIfCorrelationIdFound(String correlationId) {
- Runnable runnable = unregister(correlationId);
+ private void informAboutPnfReadyIfPnfCorrelationIdFound(String pnfCorrelationId) {
+ Runnable runnable = unregister(pnfCorrelationId);
if (runnable != null) {
- logger.debug("dmaap listener gets pnf ready event for correlationId: {}", correlationId);
+ logger.debug("dmaap listener gets pnf ready event for pnfCorrelationId: {}", pnfCorrelationId);
runnable.run();
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagement.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagement.java
index b66bb5f61b..9e720fe0a4 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagement.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagement.java
@@ -26,9 +26,9 @@ import org.onap.aai.domain.yang.Pnf;
public interface PnfManagement {
- Optional<Pnf> getEntryFor(String correlationId) throws IOException;
+ Optional<Pnf> getEntryFor(String pnfCorrelationId) throws IOException;
- void createEntry(String correlationId, Pnf entry) throws IOException;
+ void createEntry(String pnfCorrelationId, Pnf entry) throws IOException;
void createRelation(String serviceInstanceId, String pnfName) throws IOException;
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java
index 3d8da2a106..32ea357817 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java
@@ -33,15 +33,15 @@ import org.springframework.stereotype.Component;
public class PnfManagementImpl implements PnfManagement {
@Override
- public Optional<Pnf> getEntryFor(String correlationId) {
+ public Optional<Pnf> getEntryFor(String pnfCorrelationId) {
AAIRestClientImpl restClient = new AAIRestClientImpl();
- return restClient.getPnfByName(correlationId);
+ return restClient.getPnfByName(pnfCorrelationId);
}
@Override
- public void createEntry(String correlationId, Pnf entry) {
+ public void createEntry(String pnfCorrelationId, Pnf entry) {
AAIRestClientImpl restClient = new AAIRestClientImpl();
- restClient.createPnf(correlationId, entry);
+ restClient.createPnf(pnfCorrelationId, entry);
}
@Override
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java
index 8507d9c092..b0ff82e3aa 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java
@@ -37,9 +37,9 @@ public class CancelDmaapSubscriptionTest {
DmaapClientTestImpl dmaapClientTest = new DmaapClientTestImpl();
delegate.setDmaapClient(dmaapClientTest);
DelegateExecution delegateExecution = mock(DelegateExecution.class);
- when(delegateExecution.getVariable(eq(ExecutionVariableNames.CORRELATION_ID))).thenReturn("testCorrelationId");
+ when(delegateExecution.getVariable(eq(ExecutionVariableNames.PNF_CORRELATION_ID))).thenReturn("testPnfCorrelationId");
when(delegateExecution.getProcessBusinessKey()).thenReturn("testBusinessKey");
- dmaapClientTest.registerForUpdate("testCorrelationId", () -> {
+ dmaapClientTest.registerForUpdate("testPnfCorrelationId", () -> {
});
// when
delegate.execute(delegateExecution);
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegateTest.java
index 4b47ed6407..6a0aaf776e 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegateTest.java
@@ -28,7 +28,7 @@ import static org.mockito.Mockito.when;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.PnfManagementTestImpl.ID_WITHOUT_ENTRY;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.PnfManagementTestImpl.ID_WITH_ENTRY;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_PNF;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
@@ -41,26 +41,26 @@ import org.junit.runner.RunWith;
import org.onap.so.bpmn.core.WorkflowException;
@RunWith(Enclosed.class)
-public class CheckAaiForCorrelationIdDelegateTest {
+public class CheckAaiForPnfCorrelationIdDelegateTest {
public static class ConnectionOkTests {
- private CheckAaiForCorrelationIdDelegate delegate;
+ private CheckAaiForPnfCorrelationIdDelegate delegate;
@Rule
public ExpectedException expectedException = ExpectedException.none();
@Before
public void setUp() {
- delegate = new CheckAaiForCorrelationIdDelegate();
+ delegate = new CheckAaiForPnfCorrelationIdDelegate();
delegate.setPnfManagement(new PnfManagementTestImpl());
}
@Test
- public void shouldThrowExceptionWhenCorrelationIdIsNotSet() throws Exception {
+ public void shouldThrowExceptionWhenPnfCorrelationIdIsNotSet() throws Exception {
// given
DelegateExecution execution = mock(DelegateExecution.class);
- when(execution.getVariable(CORRELATION_ID)).thenReturn(null);
+ when(execution.getVariable(PNF_CORRELATION_ID)).thenReturn(null);
when(execution.getVariable("testProcessKey")).thenReturn("testProcessKeyValue");
// when, then
expectedException.expect(BpmnError.class);
@@ -72,7 +72,7 @@ public class CheckAaiForCorrelationIdDelegateTest {
public void shouldSetCorrectVariablesWhenAaiDoesNotContainInfoAboutPnf() throws Exception {
// given
DelegateExecution execution = mock(DelegateExecution.class);
- when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITHOUT_ENTRY);
+ when(execution.getVariable(PNF_CORRELATION_ID)).thenReturn(ID_WITHOUT_ENTRY);
// when
delegate.execute(execution);
// then
@@ -83,7 +83,7 @@ public class CheckAaiForCorrelationIdDelegateTest {
public void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnfWithoutIp() throws Exception {
// given
DelegateExecution execution = mock(DelegateExecution.class);
- when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITH_ENTRY);
+ when(execution.getVariable(PNF_CORRELATION_ID)).thenReturn(ID_WITH_ENTRY);
// when
delegate.execute(execution);
// then
@@ -93,14 +93,14 @@ public class CheckAaiForCorrelationIdDelegateTest {
public static class NoConnectionTests {
- private CheckAaiForCorrelationIdDelegate delegate;
+ private CheckAaiForPnfCorrelationIdDelegate delegate;
@Rule
public ExpectedException expectedException = ExpectedException.none();
@Before
public void setUp() {
- delegate = new CheckAaiForCorrelationIdDelegate();
+ delegate = new CheckAaiForPnfCorrelationIdDelegate();
delegate.setPnfManagement(new PnfManagementThrowingException());
}
@@ -108,7 +108,7 @@ public class CheckAaiForCorrelationIdDelegateTest {
public void shouldThrowExceptionWhenIoExceptionOnConnectionToAai() throws Exception {
// given
DelegateExecution execution = mock(DelegateExecution.class);
- when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITH_ENTRY);
+ when(execution.getVariable(PNF_CORRELATION_ID)).thenReturn(ID_WITH_ENTRY);
when(execution.getVariable("testProcessKey")).thenReturn("testProcessKey");
// when, then
expectedException.expect(BpmnError.class);
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java
index 9c5f8f3fc4..986edfeecf 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java
@@ -25,7 +25,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.BDDMockito.given;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
import java.util.UUID;
@@ -43,14 +43,14 @@ public class CreatePnfEntryInAaiDelegateTest {
PnfManagementTestImpl pnfManagementTest = new PnfManagementTestImpl();
delegate.setPnfManagement(pnfManagementTest);
DelegateExecution execution = mock(DelegateExecution.class);
- given(execution.getVariable(eq(CORRELATION_ID))).willReturn("testCorrelationId");
+ given(execution.getVariable(eq(PNF_CORRELATION_ID))).willReturn("testPnfCorrelationId");
given(execution.getVariable(eq(PNF_UUID))).willReturn(pnfUuid);
// when
delegate.execute(execution);
// then
- Pnf createdEntry = pnfManagementTest.getCreated().get("testCorrelationId");
+ Pnf createdEntry = pnfManagementTest.getCreated().get("testPnfCorrelationId");
assertThat(createdEntry.getPnfId()).isEqualTo(pnfUuid);
- assertThat(createdEntry.getPnfName()).isEqualTo("testCorrelationId");
+ assertThat(createdEntry.getPnfName()).isEqualTo("testPnfCorrelationId");
assertThat(createdEntry.isInMaint()).isNull();
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java
index 2a78337e34..c743ee7018 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java
@@ -42,7 +42,7 @@ public class CreateRelationTest {
public void setUp() {
executionFake = new DelegateExecutionFake();
executionFake.setVariable("serviceInstanceId", SERVICE_INSTANCE_ID);
- executionFake.setVariable("correlationId", PNF_NAME);
+ executionFake.setVariable("pnfCorrelationId", PNF_NAME);
}
@Test
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
index f2a4205ebd..19ba18f6de 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
@@ -25,19 +25,19 @@ import java.util.Objects;
public class DmaapClientTestImpl implements DmaapClient {
- private String correlationId;
+ private String pnfCorrelationId;
private Runnable informConsumer;
@Override
- public void registerForUpdate(String correlationId, Runnable informConsumer) {
- this.correlationId = correlationId;
+ public void registerForUpdate(String pnfCorrelationId, Runnable informConsumer) {
+ this.pnfCorrelationId = pnfCorrelationId;
this.informConsumer = informConsumer;
}
@Override
- public Runnable unregister(String correlationId) {
- if (Objects.equals(this.correlationId, correlationId)) {
- this.correlationId = null;
+ public Runnable unregister(String pnfCorrelationId) {
+ if (Objects.equals(this.pnfCorrelationId, pnfCorrelationId)) {
+ this.pnfCorrelationId = null;
Runnable informConsumer = this.informConsumer;
this.informConsumer = null;
return informConsumer;
@@ -45,8 +45,8 @@ public class DmaapClientTestImpl implements DmaapClient {
return null;
}
- public String getCorrelationId() {
- return correlationId;
+ public String getPnfCorrelationId() {
+ return pnfCorrelationId;
}
public Runnable getInformConsumer() {
@@ -58,6 +58,6 @@ public class DmaapClientTestImpl implements DmaapClient {
}
public boolean haveRegisteredConsumer() {
- return correlationId != null;
+ return pnfCorrelationId != null;
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java
index 23c82229fe..eb9f657d4f 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java
@@ -55,7 +55,7 @@ public class InformDmaapClientTest {
// when
informDmaapClient.execute(delegateExecution);
// then
- assertThat(dmaapClientTest.getCorrelationId()).isEqualTo("testCorrelationId");
+ assertThat(dmaapClientTest.getPnfCorrelationId()).isEqualTo("testPnfCorrelationId");
assertThat(dmaapClientTest.getInformConsumer()).isNotNull();
verifyZeroInteractions(messageCorrelationBuilder);
}
@@ -66,7 +66,7 @@ public class InformDmaapClientTest {
informDmaapClient.execute(delegateExecution);
dmaapClientTest.getInformConsumer().run();
// then
- assertThat(dmaapClientTest.getCorrelationId()).isEqualTo("testCorrelationId");
+ assertThat(dmaapClientTest.getPnfCorrelationId()).isEqualTo("testPnfCorrelationId");
InOrder inOrder = inOrder(messageCorrelationBuilder);
inOrder.verify(messageCorrelationBuilder).processInstanceBusinessKey("testBusinessKey");
inOrder.verify(messageCorrelationBuilder).correlateWithResult();
@@ -74,7 +74,7 @@ public class InformDmaapClientTest {
private DelegateExecution mockDelegateExecution() {
DelegateExecution delegateExecution = mock(DelegateExecution.class);
- when(delegateExecution.getVariable(eq(ExecutionVariableNames.CORRELATION_ID))).thenReturn("testCorrelationId");
+ when(delegateExecution.getVariable(eq(ExecutionVariableNames.PNF_CORRELATION_ID))).thenReturn("testPnfCorrelationId");
when(delegateExecution.getProcessBusinessKey()).thenReturn("testBusinessKey");
ProcessEngineServices processEngineServices = mock(ProcessEngineServices.class);
when(delegateExecution.getProcessEngineServices()).thenReturn(processEngineServices);
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java
index 80693d7ce6..001815b206 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java
@@ -21,7 +21,7 @@
package org.onap.so.bpmn.infrastructure.pnf.delegate;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_INSTANCE_ID;
@@ -39,7 +39,7 @@ public class PnfCheckInputsTest {
private static final String VALID_UUID = UUID.nameUUIDFromBytes("testUuid".getBytes()).toString();
private static final String RESERVED_UUID = new UUID(0, 0).toString();
private static final String DEFAULT_SERVICE_INSTANCE_ID = "da7d07d9-b71c-4128-809d-2ec01c807169";
- private static final String DEFAULT_CORRELATION_ID = "testCorrelationId";
+ private static final String DEFAULT_PNF_CORRELATION_ID = "testPnfCorrelationId";
private DelegateExecutionBuilder delegateExecutionBuilder;
@@ -49,9 +49,9 @@ public class PnfCheckInputsTest {
}
@Test
- public void shouldThrowException_whenCorrelationIdNotSet() {
+ public void shouldThrowException_whenPnfCorrelationIdNotSet() {
PnfCheckInputs testedObject = new PnfCheckInputs(PNF_ENTRY_NOTIFICATION_TIMEOUT);
- DelegateExecution execution = delegateExecutionBuilder.setCorrelationId(null).setPnfUuid(VALID_UUID).build();
+ DelegateExecution execution = delegateExecutionBuilder.setPnfCorrelationId(null).setPnfUuid(VALID_UUID).build();
assertThatThrownBy(() -> testedObject.execute(execution)).isInstanceOf(BpmnError.class);
}
@@ -98,12 +98,12 @@ public class PnfCheckInputsTest {
}
private static class DelegateExecutionBuilder {
- private String correlationId = DEFAULT_CORRELATION_ID;
+ private String pnfCorrelationId = DEFAULT_PNF_CORRELATION_ID;
private String pnfUuid = VALID_UUID;
private String serviceInstanceId = DEFAULT_SERVICE_INSTANCE_ID;
- public DelegateExecutionBuilder setCorrelationId(String correlationId) {
- this.correlationId = correlationId;
+ public DelegateExecutionBuilder setPnfCorrelationId(String pnfCorrelationId) {
+ this.pnfCorrelationId = pnfCorrelationId;
return this;
}
@@ -120,7 +120,7 @@ public class PnfCheckInputsTest {
public DelegateExecution build() {
DelegateExecution execution = new DelegateExecutionFake();
execution.setVariable("testProcessKey", "testProcessKeyValue");
- execution.setVariable(CORRELATION_ID, this.correlationId);
+ execution.setVariable(PNF_CORRELATION_ID, this.pnfCorrelationId);
execution.setVariable(PNF_UUID, this.pnfUuid);
execution.setVariable(SERVICE_INSTANCE_ID, this.serviceInstanceId);
return execution;
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java
index 1377c8295f..3a9d6d0055 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java
@@ -37,8 +37,8 @@ public class PnfManagementTestImpl implements PnfManagement {
private Map<String, Pnf> created = new HashMap<>();
@Override
- public Optional<Pnf> getEntryFor(String correlationId) {
- if (Objects.equals(correlationId, ID_WITH_ENTRY)) {
+ public Optional<Pnf> getEntryFor(String pnfCorrelationId) {
+ if (Objects.equals(pnfCorrelationId, ID_WITH_ENTRY)) {
return Optional.of(new Pnf());
} else {
return Optional.empty();
@@ -46,8 +46,8 @@ public class PnfManagementTestImpl implements PnfManagement {
}
@Override
- public void createEntry(String correlationId, Pnf entry) throws IOException {
- created.put(correlationId, entry);
+ public void createEntry(String pnfCorrelationId, Pnf entry) throws IOException {
+ created.put(pnfCorrelationId, entry);
}
@Override
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementThrowingException.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementThrowingException.java
index 43315d3803..f9b467c650 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementThrowingException.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementThrowingException.java
@@ -28,12 +28,12 @@ import org.onap.so.bpmn.infrastructure.pnf.management.PnfManagement;
public class PnfManagementThrowingException implements PnfManagement {
@Override
- public Optional<Pnf> getEntryFor(String correlationId) throws IOException {
+ public Optional<Pnf> getEntryFor(String pnfCorrelationId) throws IOException {
throw new IOException();
}
@Override
- public void createEntry(String correlationId, Pnf entry) throws IOException {
+ public void createEntry(String pnfCorrelationId, Pnf entry) throws IOException {
throw new IOException();
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationIdTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java
index fde112b009..02a6f20992 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationIdTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java
@@ -27,40 +27,40 @@ import static org.assertj.core.api.Assertions.assertThat;
import java.util.List;
import org.junit.Test;
-public class JsonUtilForCorrelationIdTest {
+public class JsonUtilForPnfCorrelationIdTest {
- private static final String JSON_EXAMPLE_WITH_CORRELATION_ID = "[{\"correlationId\": \"corrTest1\","
- + "\"key1\":\"value1\"},{\"correlationId\": \"corrTest2\",\"key2\":\"value2\"}]";
+ private static final String JSON_EXAMPLE_WITH_PNF_CORRELATION_ID = "[{\"pnfCorrelationId\": \"corrTest1\","
+ + "\"key1\":\"value1\"},{\"pnfCorrelationId\": \"corrTest2\",\"key2\":\"value2\"}]";
- private static final String JSON_WITH_ONE_CORRELATION_ID = "[{\"correlationId\":\"corrTest3\"}]";
+ private static final String JSON_WITH_ONE_PNF_CORRELATION_ID = "[{\"pnfCorrelationId\":\"corrTest3\"}]";
- private static final String JSON_WITH_TWO_CORRELATION_ID_AND_ESCAPED_CHARACTERS =
- "[\"{\\\"correlationId\\\":\\\"corrTest4\\\"}\", \"{\\\"correlationId\\\":\\\"corrTest5\\\"}\"]";
+ private static final String JSON_WITH_TWO_PNF_CORRELATION_ID_AND_ESCAPED_CHARACTERS =
+ "[\"{\\\"pnfCorrelationId\\\":\\\"corrTest4\\\"}\", \"{\\\"pnfCorrelationId\\\":\\\"corrTest5\\\"}\"]";
- private static final String JSON_WITH_NO_CORRELATION_ID = "[{\"key1\":\"value1\"}]";
+ private static final String JSON_WITH_NO_PNF_CORRELATION_ID = "[{\"key1\":\"value1\"}]";
@Test
public void parseJsonSuccessful() {
- List<String> expectedResult = JsonUtilForCorrelationId
- .parseJsonToGelAllCorrelationId(JSON_EXAMPLE_WITH_CORRELATION_ID);
+ List<String> expectedResult = JsonUtilForPnfCorrelationId
+ .parseJsonToGelAllPnfCorrelationId(JSON_EXAMPLE_WITH_PNF_CORRELATION_ID);
assertThat(expectedResult).containsExactly("corrTest1", "corrTest2");
- List<String> expectedResult2 = JsonUtilForCorrelationId
- .parseJsonToGelAllCorrelationId(JSON_WITH_ONE_CORRELATION_ID);
+ List<String> expectedResult2 = JsonUtilForPnfCorrelationId
+ .parseJsonToGelAllPnfCorrelationId(JSON_WITH_ONE_PNF_CORRELATION_ID);
assertThat(expectedResult2).containsExactly("corrTest3");
}
@Test
public void parseJsonWithEscapeCharacters_Successful() {
- List<String> expectedResult = JsonUtilForCorrelationId
- .parseJsonToGelAllCorrelationId(JSON_WITH_TWO_CORRELATION_ID_AND_ESCAPED_CHARACTERS);
+ List<String> expectedResult = JsonUtilForPnfCorrelationId
+ .parseJsonToGelAllPnfCorrelationId(JSON_WITH_TWO_PNF_CORRELATION_ID_AND_ESCAPED_CHARACTERS);
assertThat(expectedResult).containsExactly("corrTest4", "corrTest5");
}
@Test
public void parseJson_emptyListReturnedWhenNothingFound() {
- List<String> expectedResult = JsonUtilForCorrelationId
- .parseJsonToGelAllCorrelationId(JSON_WITH_NO_CORRELATION_ID);
+ List<String> expectedResult = JsonUtilForPnfCorrelationId
+ .parseJsonToGelAllPnfCorrelationId(JSON_WITH_NO_PNF_CORRELATION_ID);
assertThat(expectedResult).isEmpty();
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
index b30239d9c0..078c2f7784 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
@@ -56,12 +56,12 @@ import org.springframework.core.env.Environment;
@RunWith(MockitoJUnitRunner.class)
public class PnfEventReadyDmaapClientTest {
- private static final String CORRELATION_ID = "corrTestId";
- private static final String CORRELATION_ID_NOT_FOUND_IN_MAP = "otherCorrId";
- private static final String JSON_EXAMPLE_WITH_CORRELATION_ID = "[{\"correlationId\": \"%s\","
- + "\"value\":\"value1\"},{\"correlationId\": \"corr\",\"value\":\"value2\"}]";
+ private static final String PNF_CORRELATION_ID = "corrTestId";
+ private static final String PNF_CORRELATION_ID_NOT_FOUND_IN_MAP = "otherCorrId";
+ private static final String JSON_EXAMPLE_WITH_PNF_CORRELATION_ID = "[{\"pnfCorrelationId\": \"%s\","
+ + "\"value\":\"value1\"},{\"pnfCorrelationId\": \"corr\",\"value\":\"value2\"}]";
- private static final String JSON_EXAMPLE_WITH_NO_CORRELATION_ID = "[{\"key1\":\"value1\"}]";
+ private static final String JSON_EXAMPLE_WITH_NO_PNF_CORRELATION_ID = "[{\"key1\":\"value1\"}]";
private static final String HOST = "hostTest";
private static final int PORT = 1234;
@@ -108,10 +108,10 @@ public class PnfEventReadyDmaapClientTest {
* empty) and shutdown the executor because of empty map
*/
@Test
- public void correlationIdIsFoundInHttpResponse_notifyAboutPnfReady()
+ public void pnfCorrelationIdIsFoundInHttpResponse_notifyAboutPnfReady()
throws IOException {
when(httpClientMock.execute(any(HttpGet.class))).
- thenReturn(createResponse(String.format(JSON_EXAMPLE_WITH_CORRELATION_ID, CORRELATION_ID)));
+ thenReturn(createResponse(String.format(JSON_EXAMPLE_WITH_PNF_CORRELATION_ID, PNF_CORRELATION_ID)));
testedObjectInnerClassThread.run();
ArgumentCaptor<HttpGet> captor1 = ArgumentCaptor.forClass(HttpGet.class);
verify(httpClientMock).execute(captor1.capture());
@@ -128,16 +128,16 @@ public class PnfEventReadyDmaapClientTest {
/**
* Test run method, where the are following conditions:
* <p> - DmaapThreadListener is running, flag is set to true
- * <p> - map is filled with one entry with the correlationId that does not match to correlationId
+ * <p> - map is filled with one entry with the pnfCorrelationId that does not match to pnfCorrelationId
* taken from http response. run method should not do anything with the map not run any thread to notify camunda
* process
*/
@Test
- public void correlationIdIsFoundInHttpResponse_NotFoundInMap()
+ public void pnfCorrelationIdIsFoundInHttpResponse_NotFoundInMap()
throws IOException {
when(httpClientMock.execute(any(HttpGet.class))).
thenReturn(createResponse(
- String.format(JSON_EXAMPLE_WITH_CORRELATION_ID, CORRELATION_ID_NOT_FOUND_IN_MAP)));
+ String.format(JSON_EXAMPLE_WITH_PNF_CORRELATION_ID, PNF_CORRELATION_ID_NOT_FOUND_IN_MAP)));
testedObjectInnerClassThread.run();
verifyZeroInteractions(threadMockToNotifyCamundaFlow, executorMock);
}
@@ -145,13 +145,13 @@ public class PnfEventReadyDmaapClientTest {
/**
* Test run method, where the are following conditions:
* <p> - DmaapThreadListener is running, flag is set to true
- * <p> - map is filled with one entry with the correlationId but no correlation id is taken from HttpResponse
+ * <p> - map is filled with one entry with the pnfCorrelationId but no correlation id is taken from HttpResponse
* run method should not do anything with the map and not run any thread to notify camunda process
*/
@Test
- public void correlationIdIsNotFoundInHttpResponse() throws IOException {
+ public void pnfCorrelationIdIsNotFoundInHttpResponse() throws IOException {
when(httpClientMock.execute(any(HttpGet.class))).
- thenReturn(createResponse(JSON_EXAMPLE_WITH_NO_CORRELATION_ID));
+ thenReturn(createResponse(JSON_EXAMPLE_WITH_NO_PNF_CORRELATION_ID));
testedObjectInnerClassThread.run();
verifyZeroInteractions(threadMockToNotifyCamundaFlow, executorMock);
}
@@ -171,7 +171,7 @@ public class PnfEventReadyDmaapClientTest {
.getDeclaredField("pnfCorrelationIdToThreadMap");
pnfCorrelationToThreadMapField.setAccessible(true);
Map<String, Runnable> pnfCorrelationToThreadMap = new ConcurrentHashMap<>();
- pnfCorrelationToThreadMap.put(CORRELATION_ID, threadMockToNotifyCamundaFlow);
+ pnfCorrelationToThreadMap.put(PNF_CORRELATION_ID, threadMockToNotifyCamundaFlow);
pnfCorrelationToThreadMapField.set(testedObject, pnfCorrelationToThreadMap);
Field threadRunFlag = testedObject.getClass().getDeclaredField("dmaapThreadListenerIsRunning");
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn
index 5defe2121b..8ffa32e10d 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn
@@ -5,8 +5,8 @@
<bpmn:participant id="Participant_0atuyq0" name="AAI" />
<bpmn:participant id="Participant_19w87ws" name="Workflow Message Service&#10;(communication with DMAAP)&#10;" />
<bpmn:messageFlow id="MessageFlow_1h3xu88" sourceRef="CreatePnfEntryInAai" targetRef="Participant_0atuyq0" />
- <bpmn:messageFlow id="MessageFlow_09ibv5a" sourceRef="CheckAiiForCorrelationId" targetRef="Participant_0atuyq0" />
- <bpmn:messageFlow id="MessageFlow_0vjul4t" sourceRef="Participant_0atuyq0" targetRef="CheckAiiForCorrelationId" />
+ <bpmn:messageFlow id="MessageFlow_09ibv5a" sourceRef="CheckAiiForPnfCorrelationId" targetRef="Participant_0atuyq0" />
+ <bpmn:messageFlow id="MessageFlow_0vjul4t" sourceRef="Participant_0atuyq0" targetRef="CheckAiiForPnfCorrelationId" />
<bpmn:messageFlow id="MessageFlow_1vrcp2d" sourceRef="Participant_19w87ws" targetRef="WaitForDmaapPnfReadyNotification" />
<bpmn:messageFlow id="MessageFlow_0tg4hw9" sourceRef="InformDmaapClient" targetRef="Participant_19w87ws" />
<bpmn:messageFlow id="MessageFlow_1py54jr" sourceRef="CancelDmaapClientSubscription" targetRef="Participant_19w87ws" />
@@ -20,13 +20,13 @@
<bpmn:sequenceFlow id="SequenceFlow_0p09qgm" sourceRef="WaitForDmaapPnfReadyNotification" targetRef="CreateRelationId" />
<bpmn:sequenceFlow id="SequenceFlow_17s9025" sourceRef="AaiEntryExists" targetRef="InformDmaapClient" />
<bpmn:sequenceFlow id="SequenceFlow_1qr6cmf" sourceRef="CreatePnfEntryInAai" targetRef="AaiEntryExists" />
- <bpmn:sequenceFlow id="SequenceFlow_1j4r3zt" sourceRef="CheckAiiForCorrelationId" targetRef="DoesAaiContainInfoAboutPnf" />
+ <bpmn:sequenceFlow id="SequenceFlow_1j4r3zt" sourceRef="CheckAiiForPnfCorrelationId" targetRef="DoesAaiContainInfoAboutPnf" />
<bpmn:sequenceFlow id="SequenceFlow_0j5ksz1" sourceRef="CreateAndActivatePnf_StartEvent" targetRef="CheckInputs" />
<bpmn:sequenceFlow id="SequenceFlow_1miyzfe" sourceRef="CancelDmaapClientSubscription" targetRef="ThrowTimeoutException" />
<bpmn:sequenceFlow id="SequenceFlow_1l1t6ak" name="Yes" sourceRef="DoesAaiContainInfoAboutPnf" targetRef="AaiEntryExists">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{aaiContainsInfoAboutPnf}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
- <bpmn:sequenceFlow id="SequenceFlow_0967g8p" sourceRef="CheckInputs" targetRef="CheckAiiForCorrelationId" />
+ <bpmn:sequenceFlow id="SequenceFlow_0967g8p" sourceRef="CheckInputs" targetRef="CheckAiiForPnfCorrelationId" />
<bpmn:serviceTask id="CheckInputs" name="Check inputs" camunda:delegateExpression="${PnfCheckInputs}">
<bpmn:incoming>SequenceFlow_0j5ksz1</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0967g8p</bpmn:outgoing>
@@ -48,7 +48,7 @@
<bpmn:outgoing>SequenceFlow_1l1t6ak</bpmn:outgoing>
<bpmn:outgoing>SequenceFlow_0v5ffpe</bpmn:outgoing>
</bpmn:exclusiveGateway>
- <bpmn:serviceTask id="CheckAiiForCorrelationId" name="Check AAI for correlation_id" camunda:delegateExpression="${CheckAaiForCorrelationIdDelegate}">
+ <bpmn:serviceTask id="CheckAiiForPnfCorrelationId" name="Check AAI for pnf_correlation_id" camunda:delegateExpression="${CheckAaiForPnfCorrelationIdDelegate}">
<bpmn:incoming>SequenceFlow_0967g8p</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1j4r3zt</bpmn:outgoing>
</bpmn:serviceTask>
@@ -86,7 +86,7 @@
<bpmn:textAnnotation id="TextAnnotation_1eyzes8">
<bpmn:text><![CDATA[Inputs:
 - timeoutForPnfEntryNotification - String
- - correlationId - String
+ - pnfCorrelationId - String
- uuid - String]]></bpmn:text>
</bpmn:textAnnotation>
</bpmn:process>
@@ -115,7 +115,7 @@
<dc:Bounds x="-80" y="228" width="90" height="20" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ServiceTask_0a5uk9o_di" bpmnElement="CheckAiiForCorrelationId">
+ <bpmndi:BPMNShape id="ServiceTask_0a5uk9o_di" bpmnElement="CheckAiiForPnfCorrelationId">
<dc:Bounds x="219" y="167" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0iimk5v_di" bpmnElement="CreatePnfEntryInAai">
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn
index 2dbf12717c..22b09966a4 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn
@@ -586,7 +586,7 @@ CreateVcpeResCustService.validateVnfCreate(execution)]]></bpmn2:script>
<bpmn2:callActivity id="Task_14l19kv" name="Create And Activate Pnf Resource" calledElement="CreateAndActivatePnfResource">
<bpmn2:extensionElements>
<camunda:in source="timeoutForPnfEntryNotification" target="timeoutForPnfEntryNotification" />
- <camunda:in source="correlationId" target="correlationId" />
+ <camunda:in source="pnfCorrelationId" target="pnfCorrelationId" />
<camunda:in businessKey="#{execution.processBusinessKey}" />
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_0gj4vud</bpmn2:incoming>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService_simplified.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService_simplified.bpmn
index c8a5cf03cd..9579f770fc 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService_simplified.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService_simplified.bpmn
@@ -359,7 +359,7 @@ CreateVcpeResCustService.processDecomposition(execution)</bpmn2:script>
<bpmn2:callActivity id="Task_14l19kv" name="Create And Activate Pnf Resource" calledElement="CreateAndActivatePnfResource">
<bpmn2:extensionElements>
<camunda:in source="timeoutForPnfEntryNotification" target="timeoutForPnfEntryNotification" />
- <camunda:in source="correlationId" target="correlationId" />
+ <camunda:in source="pnfCorrelationId" target="pnfCorrelationId" />
<camunda:in businessKey="#{execution.processBusinessKey}" />
<camunda:in source="pnfUuid" target="pnfUuid" />
<camunda:in source="serviceInstanceId" target="serviceInstanceId" />
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesRequest.java b/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesRequest.java
index b6bfda159d..ea241aa074 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesRequest.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesRequest.java
@@ -41,8 +41,6 @@ public class ServiceInstancesRequest implements Serializable {
private String vfModuleInstanceId;
@JsonProperty("configurationId")
private String configurationId;
- @JsonProperty("correlationId")
- private String correlationId;
@JsonProperty("instanceGroupId")
private String instanceGroupId;
@@ -102,14 +100,6 @@ public class ServiceInstancesRequest implements Serializable {
this.configurationId = configurationId;
}
- public String getCorrelationId() {
- return correlationId;
- }
-
- public void setCorrelationId(String correlationId) {
- this.correlationId = correlationId;
- }
-
public String getInstanceGroupId() {
return instanceGroupId;
}
@@ -128,7 +118,6 @@ public class ServiceInstancesRequest implements Serializable {
sb.append(", volumeGroupInstanceId='").append(volumeGroupInstanceId).append('\'');
sb.append(", vfModuleInstanceId='").append(vfModuleInstanceId).append('\'');
sb.append(", configurationId='").append(configurationId).append('\'');
- sb.append(", correlationId='").append(correlationId).append('\'');
sb.append('}');
return sb.toString();
}
diff --git a/common/src/test/java/org/onap/so/client/grm/exception/GRMClientCallFailedTest.java b/common/src/test/java/org/onap/so/client/grm/exception/GRMClientCallFailedTest.java
new file mode 100644
index 0000000000..989a753800
--- /dev/null
+++ b/common/src/test/java/org/onap/so/client/grm/exception/GRMClientCallFailedTest.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.client.grm.exception;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.so.client.grm.exceptions.GRMClientCallFailed;
+
+public class GRMClientCallFailedTest {
+
+ @Test
+ public void testGRMClientCallFailedException() {
+ GRMClientCallFailed gRMClientCallFailed = new GRMClientCallFailed("failed", new Throwable("throwable"));
+ assertEquals("failed", gRMClientCallFailed.getMessage());
+ assertEquals("throwable", gRMClientCallFailed.getCause().getMessage());
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java
index 829f8ce30c..7e9eed32b1 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java
@@ -35,7 +35,7 @@ import com.fasterxml.jackson.annotation.JsonRootName;
CommonConstants.REQUEST_ID_HEADER,
CommonConstants.IS_BASE_VF_MODULE_VARIABLE, CommonConstants.RECIPE_TIMEOUT_VARIABLE,
CommonConstants.REQUEST_ACTION_VARIABLE, CommonConstants.SERVICE_INSTANCE_ID_VARIABLE,
- CommonConstants.CORRELATION_ID, CommonConstants.VNF_ID_VARIABLE, CommonConstants.VF_MODULE_ID_VARIABLE,
+ CommonConstants.PNF_CORRELATION_ID, CommonConstants.VNF_ID_VARIABLE, CommonConstants.VF_MODULE_ID_VARIABLE,
CommonConstants.VOLUME_GROUP_ID_VARIABLE, CommonConstants.NETWORK_ID_VARIABLE,
CommonConstants.CONFIGURATION_ID_VARIABLE, CommonConstants.SERVICE_TYPE_VARIABLE,
CommonConstants.VNF_TYPE_VARIABLE, CommonConstants.VF_MODULE_TYPE_VARIABLE,
@@ -68,8 +68,8 @@ public class CamundaVIDRequest {
@JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_VARIABLE)
private CamundaInput serviceInstanceId;
- @JsonProperty(CommonConstants.CORRELATION_ID)
- private CamundaInput correlationId;
+ @JsonProperty(CommonConstants.PNF_CORRELATION_ID)
+ private CamundaInput pnfCorrelationId;
@JsonProperty(CommonConstants.VNF_ID_VARIABLE)
private CamundaInput vnfId;
@@ -192,14 +192,14 @@ public class CamundaVIDRequest {
this.serviceInstanceId = serviceInstanceId;
}
- @JsonProperty(CommonConstants.CORRELATION_ID)
- public CamundaInput getCorrelationId() {
- return correlationId;
+ @JsonProperty(CommonConstants.PNF_CORRELATION_ID)
+ public CamundaInput getPnfCorrelationId() {
+ return pnfCorrelationId;
}
- @JsonProperty(CommonConstants.CORRELATION_ID)
- public void setCorrelationId(CamundaInput correlationId) {
- this.correlationId = correlationId;
+ @JsonProperty(CommonConstants.PNF_CORRELATION_ID)
+ public void setPnfCorrelationId(CamundaInput pnfCorrelationId) {
+ this.pnfCorrelationId = pnfCorrelationId;
}
@JsonProperty(CommonConstants.VNF_ID_VARIABLE)
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java
index 34cfe18508..0ca85f0a06 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java
@@ -128,7 +128,7 @@ public class CamundaClient extends RequestClient{
HttpPost post = new HttpPost(url);
msoLogger.debug(CAMUNDA_URL_MESAGE+ url);
String jsonReq = wrapVIDRequest(parameterObject.getRequestId(), parameterObject.isBaseVfModule(), parameterObject.getRecipeTimeout(), parameterObject.getRequestAction(),
- parameterObject.getServiceInstanceId(), parameterObject.getCorrelationId(), parameterObject.getVnfId(), parameterObject.getVfModuleId(), parameterObject.getVolumeGroupId(), parameterObject.getNetworkId(), parameterObject.getConfigurationId(),
+ parameterObject.getServiceInstanceId(), parameterObject.getPnfCorrelationId(), parameterObject.getVnfId(), parameterObject.getVfModuleId(), parameterObject.getVolumeGroupId(), parameterObject.getNetworkId(), parameterObject.getConfigurationId(),
parameterObject.getServiceType(), parameterObject.getVnfType(), parameterObject.getVfModuleType(), parameterObject.getNetworkType(), parameterObject.getRequestDetails(), parameterObject.getApiVersion(), parameterObject.isaLaCarte(), parameterObject.getRequestUri(), parameterObject.getRecipeParamXsd(),
parameterObject.getInstanceGroupId());
@@ -198,7 +198,7 @@ public class CamundaClient extends RequestClient{
protected String wrapVIDRequest(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction, String serviceInstanceId, String correlationId,
+ int recipeTimeout, String requestAction, String serviceInstanceId, String pnfCorrelationId,
String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
String serviceType, String vnfType, String vfModuleType, String networkType,
String requestDetails, String apiVersion, boolean aLaCarte, String requestUri, String paramXsd,
@@ -214,7 +214,7 @@ public class CamundaClient extends RequestClient{
CamundaIntegerInput recipeTimeoutInput = new CamundaIntegerInput();
CamundaInput requestActionInput = new CamundaInput();
CamundaInput serviceInstanceIdInput = new CamundaInput();
- CamundaInput correlationIdInput = new CamundaInput();
+ CamundaInput pnfCorrelationIdInput = new CamundaInput();
CamundaInput vnfIdInput = new CamundaInput();
CamundaInput vfModuleIdInput = new CamundaInput();
CamundaInput volumeGroupIdInput = new CamundaInput();
@@ -236,7 +236,7 @@ public class CamundaClient extends RequestClient{
recipeTimeoutInput.setValue(recipeTimeout);
requestActionInput.setValue(StringUtils.defaultString(requestAction));
serviceInstanceIdInput.setValue(StringUtils.defaultString(serviceInstanceId));
- correlationIdInput.setValue(StringUtils.defaultString(correlationId));
+ pnfCorrelationIdInput.setValue(StringUtils.defaultString(pnfCorrelationId));
vnfIdInput.setValue(StringUtils.defaultString(vnfId));
vfModuleIdInput.setValue(StringUtils.defaultString(vfModuleId));
volumeGroupIdInput.setValue(StringUtils.defaultString(volumeGroupId));
@@ -261,7 +261,7 @@ public class CamundaClient extends RequestClient{
camundaRequest.setRecipeTimeout(recipeTimeoutInput);
camundaRequest.setRequestAction(requestActionInput);
camundaRequest.setServiceInstanceId(serviceInstanceIdInput);
- camundaRequest.setCorrelationId(correlationIdInput);
+ camundaRequest.setPnfCorrelationId(pnfCorrelationIdInput);
camundaRequest.setVnfId(vnfIdInput);
camundaRequest.setVfModuleId(vfModuleIdInput);
camundaRequest.setVolumeGroupId(volumeGroupIdInput);
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java
index b75ad9e415..24fb0e0d20 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java
@@ -54,7 +54,7 @@ public final class CommonConstants {
public static final String RECIPE_TIMEOUT_VARIABLE = "recipeTimeout";
public static final String REQUEST_ACTION_VARIABLE = "requestAction";
public static final String SERVICE_INSTANCE_ID_VARIABLE = "serviceInstanceId";
- public static final String CORRELATION_ID = "correlationId";
+ public static final String PNF_CORRELATION_ID = "pnfCorrelationId";
public static final String VNF_ID_VARIABLE = "vnfId";
public static final String VF_MODULE_ID_VARIABLE = "vfModuleId";
public static final String VOLUME_GROUP_ID_VARIABLE = "volumeGroupId";
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java
index 1d18e2b02c..209f337a1e 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java
@@ -28,7 +28,7 @@ public class RequestClientParameter {
private int recipeTimeout;
private String requestAction;
private String serviceInstanceId;
- private String correlationId;
+ private String pnfCorrelationId;
private String vnfId;
private String vfModuleId;
private String volumeGroupId;
@@ -51,7 +51,7 @@ public class RequestClientParameter {
recipeTimeout = builder.recipeTimeout;
requestAction = builder.requestAction;
serviceInstanceId = builder.serviceInstanceId;
- correlationId = builder.correlationId;
+ pnfCorrelationId = builder.pnfCorrelationId;
vnfId = builder.vnfId;
vfModuleId = builder.vfModuleId;
volumeGroupId = builder.volumeGroupId;
@@ -90,8 +90,8 @@ public class RequestClientParameter {
return serviceInstanceId;
}
- public String getCorrelationId() {
- return correlationId;
+ public String getPnfCorrelationId() {
+ return pnfCorrelationId;
}
public String getVnfId() {
@@ -160,7 +160,7 @@ public class RequestClientParameter {
private int recipeTimeout;
private String requestAction;
private String serviceInstanceId;
- private String correlationId;
+ private String pnfCorrelationId;
private String vnfId;
private String vfModuleId;
private String volumeGroupId;
@@ -202,8 +202,8 @@ public class RequestClientParameter {
return this;
}
- public Builder setCorrelationId(String correlationId) {
- this.correlationId = correlationId;
+ public Builder setPnfCorrelationId(String pnfCorrelationId) {
+ this.pnfCorrelationId = pnfCorrelationId;
return this;
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java
index 7a03ce0542..0958905720 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java
@@ -148,7 +148,7 @@ public class CamundaClientTest{
int recipeTimeout = 10000;
String requestAction = "createInstance";
String serviceInstanceId = "12345679";
- String correlationId = "12345679";
+ String pnfCorrelationId = "12345679";
String vnfId = "234567891";
String vfModuleId = "345678912";
String volumeGroupId = "456789123";
@@ -164,7 +164,7 @@ public class CamundaClientTest{
String requestUri = "v7/serviceInstances/assign";
String instanceGroupId = "ff305d54-75b4-431b-adb2-eb6b9e5ff000";
- String testResult = testClient.wrapVIDRequest(requestId, isBaseVfModule, recipeTimeout, requestAction, serviceInstanceId, correlationId,
+ String testResult = testClient.wrapVIDRequest(requestId, isBaseVfModule, recipeTimeout, requestAction, serviceInstanceId, pnfCorrelationId,
vnfId, vfModuleId, volumeGroupId, networkId, configurationId, serviceType,
vnfType, vfModuleType, networkType, requestDetails, apiVersion, aLaCarte, requestUri, "", instanceGroupId);
String expected = inputStream("/WrappedVIDRequest.json");
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json b/mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json
index 4c716c2ae3..b9d0a8c3c6 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json
+++ b/mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json
@@ -1 +1 @@
-{"variables":{"bpmnRequest":{"value":"{requestDetails: }","type":"String"},"requestId":{"value":"f7ce78bb-423b-11e7-93f8-0050569a796","type":"String"},"mso-request-id":{"value":"f7ce78bb-423b-11e7-93f8-0050569a796","type":"String"},"isBaseVfModule":{"value":true,"type":"Boolean"},"recipeTimeout":{"value":10000,"type":"Integer"},"requestAction":{"value":"createInstance","type":"String"},"serviceInstanceId":{"value":"12345679","type":"String"},"correlationId":{"value":"12345679","type":"String"},"vnfId":{"value":"234567891","type":"String"},"vfModuleId":{"value":"345678912","type":"String"},"volumeGroupId":{"value":"456789123","type":"String"},"networkId":{"value":"567891234","type":"String"},"configurationId":{"value":"678912345","type":"String"},"serviceType":{"value":"testService","type":"String"},"vnfType":{"value":"testVnf","type":"String"},"vfModuleType":{"value":"vfModuleType","type":"String"},"networkType":{"value":"networkType","type":"String"},"recipeParams":{"value":"","type":"String"},"host":{"value":null,"type":"String"},"apiVersion":{"value":"6","type":"String"},"aLaCarte":{"value":true,"type":"Boolean"},"requestUri":{"value":"v7/serviceInstances/assign","type":"String"},"instanceGroupId":{"value":"ff305d54-75b4-431b-adb2-eb6b9e5ff000","type":"String"}}} \ No newline at end of file
+{"variables":{"bpmnRequest":{"value":"{requestDetails: }","type":"String"},"requestId":{"value":"f7ce78bb-423b-11e7-93f8-0050569a796","type":"String"},"mso-request-id":{"value":"f7ce78bb-423b-11e7-93f8-0050569a796","type":"String"},"isBaseVfModule":{"value":true,"type":"Boolean"},"recipeTimeout":{"value":10000,"type":"Integer"},"requestAction":{"value":"createInstance","type":"String"},"serviceInstanceId":{"value":"12345679","type":"String"},"pnfCorrelationId":{"value":"12345679","type":"String"},"vnfId":{"value":"234567891","type":"String"},"vfModuleId":{"value":"345678912","type":"String"},"volumeGroupId":{"value":"456789123","type":"String"},"networkId":{"value":"567891234","type":"String"},"configurationId":{"value":"678912345","type":"String"},"serviceType":{"value":"testService","type":"String"},"vnfType":{"value":"testVnf","type":"String"},"vfModuleType":{"value":"vfModuleType","type":"String"},"networkType":{"value":"networkType","type":"String"},"recipeParams":{"value":"","type":"String"},"host":{"value":null,"type":"String"},"apiVersion":{"value":"6","type":"String"},"aLaCarte":{"value":true,"type":"Boolean"},"requestUri":{"value":"v7/serviceInstances/assign","type":"String"},"instanceGroupId":{"value":"ff305d54-75b4-431b-adb2-eb6b9e5ff000","type":"String"}}} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
index e3b218b90a..a473b0939e 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
@@ -809,7 +809,7 @@ public class ServiceInstances {
String vfModuleId = "";
String volumeGroupId = "";
String networkId = "";
- String correlationId = "";
+ String pnfCorrelationId = "";
String instanceGroupId = null;
if(sir.getServiceInstanceId () != null){
serviceInstanceId = sir.getServiceInstanceId ();
@@ -834,7 +834,7 @@ public class ServiceInstances {
instanceGroupId = sir.getInstanceGroupId();
}
- correlationId = getCorrelationId(sir);
+ pnfCorrelationId = getPnfCorrelationId(sir);
try{
infraActiveRequestsClient.save(currentActiveReq);
@@ -858,7 +858,7 @@ public class ServiceInstances {
.setRecipeTimeout(recipeLookupResult.getRecipeTimeout())
.setRequestAction(action.toString())
.setServiceInstanceId(serviceInstanceId)
- .setCorrelationId(correlationId)
+ .setPnfCorrelationId(pnfCorrelationId)
.setVnfId(vnfId)
.setVfModuleId(vfModuleId)
.setVolumeGroupId(volumeGroupId)
@@ -944,7 +944,7 @@ public class ServiceInstances {
return postBPELRequest(currentActiveReq, requestClientParameter, recipeLookupResult.getOrchestrationURI(), requestScope);
}
- private String getCorrelationId(ServiceInstancesRequest sir) {
+ private String getPnfCorrelationId(ServiceInstancesRequest sir) {
return Optional.of(sir)
.map(ServiceInstancesRequest::getRequestDetails)
.map(RequestDetails::getRequestParameters)
@@ -1860,7 +1860,7 @@ public class ServiceInstances {
serviceInstanceId = "";
String configurationId = "";
- String correlationId = "";
+ String pnfCorrelationId = "";
if(sir.getServiceInstanceId () != null){
serviceInstanceId = sir.getServiceInstanceId ();
@@ -1870,7 +1870,7 @@ public class ServiceInstances {
configurationId = sir.getConfigurationId();
}
- correlationId = getCorrelationId(sir);
+ pnfCorrelationId = getPnfCorrelationId(sir);
try{
infraActiveRequestsClient.save(currentActiveReq);
@@ -1893,7 +1893,7 @@ public class ServiceInstances {
.setRecipeTimeout(Integer.parseInt(timeOut))
.setRequestAction(action.toString())
.setServiceInstanceId(serviceInstanceId)
- .setCorrelationId(correlationId)
+ .setPnfCorrelationId(pnfCorrelationId)
.setConfigurationId(configurationId)
.setRequestDetails(mapJSONtoMSOStyle(requestJSON, sir, aLaCarte, action))
.setApiVersion(apiVersion)
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/exceptions/AAIClientCallFailedTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/exceptions/AAIClientCallFailedTest.java
new file mode 100644
index 0000000000..2cb02e9666
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/exceptions/AAIClientCallFailedTest.java
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.apihandlerinfra.tenantisolation.exceptions;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.so.apihandlerinfra.BaseTest;
+
+public class AAIClientCallFailedTest extends BaseTest {
+
+ @Test
+ public void testAAIClientCallFailedException() {
+ AAIClientCallFailed aAIClientCallFailed = new AAIClientCallFailed("failed", new Throwable("throwable"));
+ assertEquals("failed", aAIClientCallFailed.getMessage());
+ assertEquals("throwable", aAIClientCallFailed.getCause().getMessage());
+ }
+}
diff --git a/so-monitoring/so-monitoring-service/src/test/resources/camundaResponses/processInstanceVariables.json b/so-monitoring/so-monitoring-service/src/test/resources/camundaResponses/processInstanceVariables.json
index 15c87ea1e9..7762da7c2d 100644
--- a/so-monitoring/so-monitoring-service/src/test/resources/camundaResponses/processInstanceVariables.json
+++ b/so-monitoring/so-monitoring-service/src/test/resources/camundaResponses/processInstanceVariables.json
@@ -287,7 +287,7 @@
},
{
"type": "String",
- "value": "{\"requestDetails\":{\"modelInfo\":{\"modelInvariantUuid\":\"8e2be9fa-fffb-4e23-89a5-65497709f507\",\"modelType\":\"service\",\"modelName\":\"PNFSERVICE\",\"modelVersion\":\"1.0\",\"modelUuid\":\"4f7afc34-e475-41ca-be73-40f9a0f7ffa4\"},\"requestInfo\":{\"productFamilyId\":\"c8d92bf2-2c2e-4802-94e0-3f9e0825cc08\",\"source\":\"UUI\",\"instanceName\":\"AFRPOSTMAN51\",\"suppressRollback\":false,\"requestorId\":\"demo\"},\"subscriberInfo\":{\"globalSubscriberId\":\"Demonstration\"},\"cloudConfiguration\":{\"tenantId\":\"3e001881bcb342418ab5f2788a73255d\",\"lcpCloudRegionId\":\"regionOne_aaa_bbb\"},\"requestParameters\":{\"alaCarte\":false,\"subscriptionServiceType\":\"vCPE\",\"userParams\":[{\"name\":\"Homing_Solution\",\"value\":\"dummy\"}],\"aLaCarte\":false},\"project\":{\"projectName\":\"Project-Demonstration\"},\"owningEntity\":{\"owningEntityId\":\"c77274d4-4881-493a-ad46-368ea0996eb3\",\"owningEntityName\":\"OE-Demonstration\"}},\"correlationId\":\"afr\"}",
+ "value": "{\"requestDetails\":{\"modelInfo\":{\"modelInvariantUuid\":\"8e2be9fa-fffb-4e23-89a5-65497709f507\",\"modelType\":\"service\",\"modelName\":\"PNFSERVICE\",\"modelVersion\":\"1.0\",\"modelUuid\":\"4f7afc34-e475-41ca-be73-40f9a0f7ffa4\"},\"requestInfo\":{\"productFamilyId\":\"c8d92bf2-2c2e-4802-94e0-3f9e0825cc08\",\"source\":\"UUI\",\"instanceName\":\"AFRPOSTMAN51\",\"suppressRollback\":false,\"requestorId\":\"demo\"},\"subscriberInfo\":{\"globalSubscriberId\":\"Demonstration\"},\"cloudConfiguration\":{\"tenantId\":\"3e001881bcb342418ab5f2788a73255d\",\"lcpCloudRegionId\":\"regionOne_aaa_bbb\"},\"requestParameters\":{\"alaCarte\":false,\"subscriptionServiceType\":\"vCPE\",\"userParams\":[{\"name\":\"Homing_Solution\",\"value\":\"dummy\"}],\"aLaCarte\":false},\"project\":{\"projectName\":\"Project-Demonstration\"},\"owningEntity\":{\"owningEntityId\":\"c77274d4-4881-493a-ad46-368ea0996eb3\",\"owningEntityName\":\"OE-Demonstration\"}},\"pnfCorrelationId\":\"afr\"}",
"valueInfo": {
},
@@ -314,7 +314,7 @@
},
"id": "595745ec-9736-11e8-8caf-022ac9304eeb",
- "name": "correlationId",
+ "name": "pnfCorrelationId",
"processDefinitionKey": "AFRFLOW",
"processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb",
"processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb",
@@ -4203,7 +4203,7 @@
},
{
"type": "String",
- "value": "{\"requestDetails\":{\"modelInfo\":{\"modelInvariantUuid\":\"8e2be9fa-fffb-4e23-89a5-65497709f507\",\"modelType\":\"service\",\"modelName\":\"PNFSERVICE\",\"modelVersion\":\"1.0\",\"modelUuid\":\"4f7afc34-e475-41ca-be73-40f9a0f7ffa4\"},\"requestInfo\":{\"productFamilyId\":\"c8d92bf2-2c2e-4802-94e0-3f9e0825cc08\",\"source\":\"UUI\",\"instanceName\":\"AFRPOSTMAN51\",\"suppressRollback\":false,\"requestorId\":\"demo\"},\"subscriberInfo\":{\"globalSubscriberId\":\"Demonstration\"},\"cloudConfiguration\":{\"tenantId\":\"3e001881bcb342418ab5f2788a73255d\",\"lcpCloudRegionId\":\"regionOne_aaa_bbb\"},\"requestParameters\":{\"alaCarte\":false,\"subscriptionServiceType\":\"vCPE\",\"userParams\":[{\"name\":\"Homing_Solution\",\"value\":\"dummy\"}],\"aLaCarte\":false},\"project\":{\"projectName\":\"Project-Demonstration\"},\"owningEntity\":{\"owningEntityId\":\"c77274d4-4881-493a-ad46-368ea0996eb3\",\"owningEntityName\":\"OE-Demonstration\"}},\"correlationId\":\"afr\"}",
+ "value": "{\"requestDetails\":{\"modelInfo\":{\"modelInvariantUuid\":\"8e2be9fa-fffb-4e23-89a5-65497709f507\",\"modelType\":\"service\",\"modelName\":\"PNFSERVICE\",\"modelVersion\":\"1.0\",\"modelUuid\":\"4f7afc34-e475-41ca-be73-40f9a0f7ffa4\"},\"requestInfo\":{\"productFamilyId\":\"c8d92bf2-2c2e-4802-94e0-3f9e0825cc08\",\"source\":\"UUI\",\"instanceName\":\"AFRPOSTMAN51\",\"suppressRollback\":false,\"requestorId\":\"demo\"},\"subscriberInfo\":{\"globalSubscriberId\":\"Demonstration\"},\"cloudConfiguration\":{\"tenantId\":\"3e001881bcb342418ab5f2788a73255d\",\"lcpCloudRegionId\":\"regionOne_aaa_bbb\"},\"requestParameters\":{\"alaCarte\":false,\"subscriptionServiceType\":\"vCPE\",\"userParams\":[{\"name\":\"Homing_Solution\",\"value\":\"dummy\"}],\"aLaCarte\":false},\"project\":{\"projectName\":\"Project-Demonstration\"},\"owningEntity\":{\"owningEntityId\":\"c77274d4-4881-493a-ad46-368ea0996eb3\",\"owningEntityName\":\"OE-Demonstration\"}},\"pnfCorrelationId\":\"afr\"}",
"valueInfo": {
},