Add some logs 69/42469/2
authorDeterme, Sebastien (sd378r) <sd378r@intl.att.com>
Thu, 12 Apr 2018 09:43:45 +0000 (11:43 +0200)
committerEddy Hautot <eh552t@intl.att.com>
Thu, 12 Apr 2018 11:04:22 +0000 (11:04 +0000)
Add some logs for sdc-controller code so that it's easier to follow the
csar deployment

Issue-ID: CLAMP-151
Change-Id: I73f8ecea4140da57bda6daeaf721ab99dacadc40
Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java
src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandler.java
src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImpl.java

index a44f867..a629604 100644 (file)
@@ -84,8 +84,7 @@ public class SdcSingleController {
         @Override\r
         public void activateCallback(INotificationData iNotif) {\r
             Date startTime = new Date();\r
-            String event = "Receive a callback notification in SDC, nb of resources: " + iNotif.getResources().size();\r
-            logger.debug(event);\r
+            logger.info("Receive a callback notification in SDC, nb of resources: " + iNotif.getResources().size());\r
             sdcController.treatNotification(iNotif);\r
             LoggingUtils.setTimeContext(startTime, new Date());\r
             LoggingUtils.setResponseContext("0", "SDC Notification received and processed successfully",\r
@@ -144,7 +143,7 @@ public class SdcSingleController {
      *             If there is an issue with the parameters provided\r
      */\r
     public void initSdc() throws SdcControllerException {\r
-        logger.debug("Attempt to initialize the SDC Controller");\r
+        logger.info("Attempt to initialize the SDC Controller");\r
         if (this.getControllerStatus() != SdcSingleControllerStatus.STOPPED) {\r
             throw new SdcControllerException("The controller is already initialized, call the closeSDC method first");\r
         }\r
@@ -160,7 +159,7 @@ public class SdcSingleController {
         }\r
         result = this.distributionClient.start();\r
         if (!result.getDistributionActionResult().equals(DistributionActionResultEnum.SUCCESS)) {\r
-            logger.debug("SDC distribution client start failed with reason:" + result.getDistributionMessageResult());\r
+            logger.error("SDC distribution client start failed with reason:" + result.getDistributionMessageResult());\r
             this.changeControllerStatus(SdcSingleControllerStatus.STOPPED);\r
             throw new SdcControllerException(\r
                     "Startup of the SDC Controller failed with reason: " + result.getDistributionMessageResult());\r
@@ -260,7 +259,7 @@ public class SdcSingleController {
     }\r
 \r
     private IDistributionClientDownloadResult downloadTheArtifact(IArtifactInfo artifact) throws SdcDownloadException {\r
-        logger.debug("Trying to download the artifact : " + artifact.getArtifactURL() + " UUID: "\r
+        logger.info("Trying to download the artifact : " + artifact.getArtifactURL() + " UUID: "\r
                 + artifact.getArtifactUUID());\r
         IDistributionClientDownloadResult downloadResult;\r
         try {\r
index 8933973..aacef0a 100644 (file)
@@ -93,8 +93,7 @@ public class CsarHandler {
     public synchronized void save(IDistributionClientDownloadResult resultArtifact)
             throws SdcArtifactInstallerException, SdcToscaParserException {
         try {
-            logger.info("Writing CSAR file : " + artifactElement.getArtifactURL() + " UUID "
-                    + artifactElement.getArtifactUUID() + ")");
+            logger.info("Writing CSAR file to: " + csarFilePath + " UUID " + artifactElement.getArtifactUUID() + ")");
             Path path = Paths.get(csarFilePath);
             Files.createDirectories(path.getParent());
             // Create or replace the file
@@ -142,9 +141,12 @@ public class CsarHandler {
                             entry.getName().indexOf(RESOURCE_INSTANCE_NAME_SUFFIX)));
                     blueprintArtifact.setBlueprintInvariantResourceUuid(resource.getResourceInvariantUUID());
                     blueprintArtifact.setBlueprintResourceInstanceName(resource.getResourceInstanceName());
+                    logger.info("Found a blueprint entry in the CSAR " + blueprintArtifact.getBlueprintArtifactName()
+                            + " for resource instance Name " + resource.getResourceInstanceName());
                     this.mapOfBlueprints.put(blueprintArtifact.getBlueprintResourceInstanceName(), blueprintArtifact);
                 }
             }
+            logger.info(this.mapOfBlueprints.size() + " blueprint(s) will be converted to closed loop");
         }
     }
 
index d282588..6a9828d 100644 (file)
@@ -24,6 +24,8 @@
 package org.onap.clamp.clds.sdc.controller.installer;
 
 import com.att.aft.dme2.internal.apache.commons.io.IOUtils;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
 
 import java.io.IOException;
 import java.util.ArrayList;
@@ -57,6 +59,7 @@ import org.yaml.snakeyaml.Yaml;
  */
 public class CsarInstallerImpl implements CsarInstaller {
 
+    private static final EELFLogger logger = EELFManager.getInstance().getLogger(CsarInstallerImpl.class);
     private Map<String, BlueprintParserFilesConfiguration> bpmnMapping = new HashMap<>();
     public static final String TEMPLATE_NAME_PREFIX = "DCAE-Designer-ClosedLoopTemplate-";
     public static final String MODEL_NAME_PREFIX = "ClosedLoop-";
@@ -98,11 +101,14 @@ public class CsarInstallerImpl implements CsarInstaller {
     @Transactional
     public void installTheCsar(CsarHandler csar) throws SdcArtifactInstallerException {
         try {
+            logger.info("Installing the CSAR " + csar.getFilePath());
             for (Entry<String, BlueprintArtifact> blueprint : csar.getMapOfBlueprints().entrySet()) {
+                logger.info("Processing blueprint " + blueprint.getValue().getBlueprintArtifactName());
                 String serviceTypeId = queryDcaeToGetServiceTypeId(blueprint.getValue());
                 createFakeCldsModel(csar, blueprint.getValue(), createFakeCldsTemplate(csar, blueprint.getValue(),
                         this.searchForRightMapping(blueprint.getValue())), serviceTypeId);
             }
+            logger.info("Successfully installed the CSAR " + csar.getFilePath());
         } catch (IOException e) {
             throw new SdcArtifactInstallerException("Exception caught during the Csar installation in database", e);
         } catch (ParseException | InterruptedException e) {
@@ -127,6 +133,8 @@ public class CsarInstallerImpl implements CsarInstaller {
         } else if (listConfig.isEmpty()) {
             throw new SdcArtifactInstallerException("There is no recognized MicroService found in the blueprint");
         }
+        logger.info("Mapping found for blueprint " + blueprintArtifact.getBlueprintArtifactName() + " is "
+                + listConfig.get(0).getBpmnXmlFilePath());
         return listConfig.get(0);
     }
 
@@ -156,6 +164,8 @@ public class CsarInstallerImpl implements CsarInstaller {
             throw new SdcArtifactInstallerException(
                     "There is no recognized Policy MicroService found in the blueprint");
         }
+        logger.info("policyName found in blueprint " + blueprintArtifact.getBlueprintArtifactName() + " is "
+                + policyNameList.get(0));
         return policyNameList.get(0);
     }
 
@@ -177,6 +187,8 @@ public class CsarInstallerImpl implements CsarInstaller {
                 IOUtils.toString(appContext.getResource(configFiles.getSvgXmlFilePath()).getInputStream()));
         template.setName(TEMPLATE_NAME_PREFIX + buildModelName(csar));
         template.save(cldsDao, null);
+        logger.info("Fake Clds Template created for blueprint " + blueprintArtifact.getBlueprintArtifactName()
+                + " with name " + template.getName());
         return template;
     }
 
@@ -202,6 +214,8 @@ public class CsarInstallerImpl implements CsarInstaller {
         cldsModel.setBpmnText(cldsTemplate.getBpmnText());
         cldsModel.setTypeId(serviceTypeId);
         cldsModel.save(cldsDao, null);
+        logger.info("Fake Clds Model created for blueprint " + blueprintArtifact.getBlueprintArtifactName()
+                + " with name " + cldsModel.getName());
         return cldsModel;
     }
 }