summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
13 files changed, 297 insertions, 287 deletions
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());