diff options
author | Determe, Sebastien (sd378r) <sd378r@intl.att.com> | 2018-04-12 11:43:45 +0200 |
---|---|---|
committer | Eddy Hautot <eh552t@intl.att.com> | 2018-04-12 11:04:22 +0000 |
commit | 59d824e1b4af08ceb77bc8986b1c2b1e379f662a (patch) | |
tree | a955e3df41d99dc4c10e59201871b65bf84b6cb5 | |
parent | b63acb4254bfaa58ec50cc78c5ead40ab04034cd (diff) |
Add some logs
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>
3 files changed, 22 insertions, 7 deletions
diff --git a/src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java b/src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java index a44f86771..a62960440 100644 --- a/src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java +++ b/src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java @@ -84,8 +84,7 @@ public class SdcSingleController { @Override
public void activateCallback(INotificationData iNotif) {
Date startTime = new Date();
- String event = "Receive a callback notification in SDC, nb of resources: " + iNotif.getResources().size();
- logger.debug(event);
+ logger.info("Receive a callback notification in SDC, nb of resources: " + iNotif.getResources().size());
sdcController.treatNotification(iNotif);
LoggingUtils.setTimeContext(startTime, new Date());
LoggingUtils.setResponseContext("0", "SDC Notification received and processed successfully",
@@ -144,7 +143,7 @@ public class SdcSingleController { * If there is an issue with the parameters provided
*/
public void initSdc() throws SdcControllerException {
- logger.debug("Attempt to initialize the SDC Controller");
+ logger.info("Attempt to initialize the SDC Controller");
if (this.getControllerStatus() != SdcSingleControllerStatus.STOPPED) {
throw new SdcControllerException("The controller is already initialized, call the closeSDC method first");
}
@@ -160,7 +159,7 @@ public class SdcSingleController { }
result = this.distributionClient.start();
if (!result.getDistributionActionResult().equals(DistributionActionResultEnum.SUCCESS)) {
- logger.debug("SDC distribution client start failed with reason:" + result.getDistributionMessageResult());
+ logger.error("SDC distribution client start failed with reason:" + result.getDistributionMessageResult());
this.changeControllerStatus(SdcSingleControllerStatus.STOPPED);
throw new SdcControllerException(
"Startup of the SDC Controller failed with reason: " + result.getDistributionMessageResult());
@@ -260,7 +259,7 @@ public class SdcSingleController { }
private IDistributionClientDownloadResult downloadTheArtifact(IArtifactInfo artifact) throws SdcDownloadException {
- logger.debug("Trying to download the artifact : " + artifact.getArtifactURL() + " UUID: "
+ logger.info("Trying to download the artifact : " + artifact.getArtifactURL() + " UUID: "
+ artifact.getArtifactUUID());
IDistributionClientDownloadResult downloadResult;
try {
diff --git a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandler.java b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandler.java index 89339733d..aacef0a4f 100644 --- a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandler.java +++ b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandler.java @@ -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"); } } diff --git a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImpl.java b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImpl.java index d282588bb..6a9828df0 100644 --- a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImpl.java +++ b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImpl.java @@ -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; } } |