summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap/clamp
diff options
context:
space:
mode:
authorSébastien Determe <sd378r@intl.att.com>2018-03-23 14:00:47 +0000
committerGerrit Code Review <gerrit@onap.org>2018-03-23 14:00:47 +0000
commit87751f9e022fd044e40119a804a167bc0a338806 (patch)
tree62cf88b181a8a91e1d8795fe19fc99d707f4d25f /src/main/java/org/onap/clamp
parent9fe5a8b3358252a81fcd378b2415fdfb0a119263 (diff)
parent378d05bded462b721cd04e7eb5ab06a944da452e (diff)
Merge changes from topic 'bugfix/sdc-controller'
* changes: Rework the SDC test Naming convention Sonar fixes
Diffstat (limited to 'src/main/java/org/onap/clamp')
-rw-r--r--src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java59
-rw-r--r--src/main/java/org/onap/clamp/clds/model/dcae/DcaeInventoryResponse.java53
-rw-r--r--src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java116
-rw-r--r--src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandler.java5
-rw-r--r--src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImpl.java10
5 files changed, 147 insertions, 96 deletions
diff --git a/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java b/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java
index c4abebdcd..d5015040c 100644
--- a/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java
+++ b/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java
@@ -30,13 +30,11 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import java.io.IOException;
-import java.security.GeneralSecurityException;
import java.util.Date;
import java.util.List;
import javax.ws.rs.BadRequestException;
-import org.apache.commons.codec.DecoderException;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
@@ -46,6 +44,7 @@ import org.onap.clamp.clds.dao.CldsDao;
import org.onap.clamp.clds.model.CldsEvent;
import org.onap.clamp.clds.model.CldsModel;
import org.onap.clamp.clds.model.DcaeEvent;
+import org.onap.clamp.clds.model.dcae.DcaeInventoryResponse;
import org.onap.clamp.clds.model.properties.Global;
import org.onap.clamp.clds.model.properties.ModelProperties;
import org.onap.clamp.clds.util.LoggingUtils;
@@ -61,7 +60,9 @@ public class DcaeInventoryServices {
protected static final EELFLogger logger = EELFManager.getInstance().getLogger(DcaeInventoryServices.class);
protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
- private static final String DCAE_INVENTORY_URL = "dcae.inventory.url";
+ public static final String DCAE_INVENTORY_URL = "dcae.inventory.url";
+ public static final String DCAE_TYPE_NAME = "typeName";
+ public static final String DCAE_TYPE_ID = "typeId";
@Autowired
private ClampProperties refProp;
@Autowired
@@ -74,18 +75,13 @@ public class DcaeInventoryServices {
* The CldsModel
* @param userId
* The user ID
- * @throws GeneralSecurityException
- * In case of issue when decryting the DCAE password
* @throws ParseException
* In case of DCAE Json parse exception
- * @throws DecoderException
- * In case of issues with HexString decoding
*/
- public void setEventInventory(CldsModel cldsModel, String userId)
- throws GeneralSecurityException, ParseException, DecoderException {
+ public void setEventInventory(CldsModel cldsModel, String userId) throws ParseException {
String artifactName = cldsModel.getControlName();
DcaeEvent dcaeEvent = new DcaeEvent();
- String isDcaeInfoAvailable = null;
+ DcaeInventoryResponse dcaeResponse = null;
Date startTime = new Date();
LoggingUtils.setTargetContext("DCAE", "setEventInventory");
if (artifactName != null) {
@@ -103,7 +99,7 @@ public class DcaeInventoryServices {
resourceUuid = resourceUuidList.get(0);
}
/* Inventory service url is called in this method */
- isDcaeInfoAvailable = getDcaeInformation(artifactName, invariantServiceUuid, resourceUuid);
+ dcaeResponse = getDcaeInformation(artifactName, invariantServiceUuid, resourceUuid);
/* set dcae events */
dcaeEvent.setArtifactName(artifactName);
dcaeEvent.setEvent(DcaeEvent.EVENT_DISTRIBUTION);
@@ -120,22 +116,21 @@ public class DcaeInventoryServices {
LoggingUtils.setTimeContext(startTime, new Date());
metricsLogger.info("setEventInventory complete");
}
- /* Null whether the DCAE has items lenght or not */
- if (isDcaeInfoAvailable != null) {
- /* Inserting Event in to DB */
- logger.info(isDcaeInfoAvailable);
- JSONParser parser = new JSONParser();
- Object obj0 = parser.parse(isDcaeInfoAvailable);
- JSONObject jsonObj = (JSONObject) obj0;
+ this.analyzeAndSaveDcaeResponse(dcaeResponse, cldsModel, dcaeEvent, userId);
+ }
+
+ private void analyzeAndSaveDcaeResponse(DcaeInventoryResponse dcaeResponse, CldsModel cldsModel,
+ DcaeEvent dcaeEvent, String userId) throws ParseException {
+ if (dcaeResponse != null) {
+ logger.info("Dcae Response for query on inventory: " + dcaeResponse);
String oldTypeId = cldsModel.getTypeId();
String newTypeId = "";
- if (jsonObj.get("typeId") != null) {
- newTypeId = jsonObj.get("typeId").toString();
- cldsModel.setTypeId(jsonObj.get("typeId").toString());
+ if (dcaeResponse.getTypeId() != null) {
+ newTypeId = dcaeResponse.getTypeId();
+ cldsModel.setTypeId(dcaeResponse.getTypeId());
}
- // cldsModel.setTypeName(cldsModel.getControlName().toString()+".yml");
- if (jsonObj.get("typeName") != null) {
- cldsModel.setTypeName(jsonObj.get("typeName").toString());
+ if (dcaeResponse.getTypeName() != null) {
+ cldsModel.setTypeName(dcaeResponse.getTypeName());
}
if (oldTypeId == null || !oldTypeId.equalsIgnoreCase(newTypeId)
|| cldsModel.getEvent().getActionCd().equalsIgnoreCase(CldsEvent.ACTION_SUBMITDCAE)) {
@@ -157,13 +152,13 @@ public class DcaeInventoryServices {
* The service UUID
* @param resourceUuid
* The resource UUID
- * @return The DCAE inventory for the artifact
+ * @return The DCAE inventory for the artifact in DcaeInventoryResponse
* @throws IOException
* In case of issues with the stream
* @throws ParseException
* In case of issues with the Json parsing
*/
- public String getDcaeInformation(String artifactName, String serviceUuid, String resourceUuid)
+ public DcaeInventoryResponse getDcaeInformation(String artifactName, String serviceUuid, String resourceUuid)
throws IOException, ParseException {
Date startTime = new Date();
LoggingUtils.setTargetContext("DCAE", "getDcaeInformation");
@@ -171,25 +166,23 @@ public class DcaeInventoryServices {
+ artifactName;
String fullUrl = refProp.getStringValue(DCAE_INVENTORY_URL) + "/dcae-service-types" + queryString;
logger.info("Dcae Inventory Service full url - " + fullUrl);
- String daceInventoryResponse = null;
+ String dcaeInventoryResponse = null;
String responseStr = DcaeHttpConnectionManager.doDcaeHttpQuery(fullUrl, "GET", null, null);
JSONParser parser = new JSONParser();
Object obj0 = parser.parse(responseStr);
JSONObject jsonObj = (JSONObject) obj0;
Long totalCount = (Long) jsonObj.get("totalCount");
int numServices = totalCount.intValue();
- if (numServices == 0) {
- daceInventoryResponse = null;
- } else if (numServices > 0) {
+ if (numServices > 0) {
JSONArray itemsArray = (JSONArray) jsonObj.get("items");
JSONObject dcaeServiceType0 = (JSONObject) itemsArray.get(0);
- daceInventoryResponse = dcaeServiceType0.toString();
- logger.info(daceInventoryResponse);
+ dcaeInventoryResponse = dcaeServiceType0.toString();
+ logger.info("getDcaeInformation, answer from DCAE inventory:" + dcaeInventoryResponse);
}
LoggingUtils.setResponseContext("0", "Get Dcae Information success", this.getClass().getName());
LoggingUtils.setTimeContext(startTime, new Date());
metricsLogger.info("getDcaeInformation complete: number services returned=" + numServices);
- return daceInventoryResponse;
+ return new ObjectMapper().readValue(dcaeInventoryResponse, DcaeInventoryResponse.class);
}
/**
diff --git a/src/main/java/org/onap/clamp/clds/model/dcae/DcaeInventoryResponse.java b/src/main/java/org/onap/clamp/clds/model/dcae/DcaeInventoryResponse.java
new file mode 100644
index 000000000..b0a784c83
--- /dev/null
+++ b/src/main/java/org/onap/clamp/clds/model/dcae/DcaeInventoryResponse.java
@@ -0,0 +1,53 @@
+
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * 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============================================
+ * ===================================================================
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+
+package org.onap.clamp.clds.model.dcae;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+/**
+ * This class maps the DCAE inventory answer to a nice pojo.
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class DcaeInventoryResponse {
+
+ private String typeName;
+ private String typeId;
+
+ public String getTypeName() {
+ return typeName;
+ }
+
+ public void setTypeName(String typeName) {
+ this.typeName = typeName;
+ }
+
+ public String getTypeId() {
+ return typeId;
+ }
+
+ public void setTypeId(String typeId) {
+ this.typeId = typeId;
+ }
+}
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 f8fef3943..c02edbbf9 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
@@ -56,20 +56,24 @@ import org.openecomp.sdc.utils.DistributionStatusEnum;
public class SdcSingleController {
private static final EELFLogger logger = EELFManager.getInstance().getLogger(SdcSingleController.class);
- protected boolean isAsdcClientAutoManaged = false;
- protected CsarInstaller csarInstaller;
- protected ClampProperties refProp;
+ private boolean isSdcClientAutoManaged = false;
+ private CsarInstaller csarInstaller;
+ private ClampProperties refProp;
public static final String CONFIG_SDC_FOLDER = "sdc.csarFolder";
+ private int nbOfNotificationsOngoing = 0;
+ private SdcSingleControllerStatus controllerStatus = SdcSingleControllerStatus.STOPPED;
+ private SdcSingleControllerConfiguration sdcConfig;
+ private IDistributionClient distributionClient;
/**
* Inner class for Notification callback
*/
- private final class ASDCNotificationCallBack implements INotificationCallback {
+ private final class SdcNotificationCallBack implements INotificationCallback {
- private SdcSingleController asdcController;
+ private SdcSingleController sdcController;
- ASDCNotificationCallBack(SdcSingleController controller) {
- asdcController = controller;
+ SdcNotificationCallBack(SdcSingleController controller) {
+ sdcController = controller;
}
/**
@@ -79,23 +83,27 @@ public class SdcSingleController {
@Override
public void activateCallback(INotificationData iNotif) {
Date startTime = new Date();
- String event = "Receive a callback notification in ASDC, nb of resources: " + iNotif.getResources().size();
+ String event = "Receive a callback notification in SDC, nb of resources: " + iNotif.getResources().size();
logger.debug(event);
- asdcController.treatNotification(iNotif);
+ sdcController.treatNotification(iNotif);
LoggingUtils.setTimeContext(startTime, new Date());
LoggingUtils.setResponseContext("0", "SDC Notification received and processed successfully",
this.getClass().getName());
}
}
- // ***** Controller STATUS code
- protected int nbOfNotificationsOngoing = 0;
-
public int getNbOfNotificationsOngoing() {
return nbOfNotificationsOngoing;
}
- private SdcSingleControllerStatus controllerStatus = SdcSingleControllerStatus.STOPPED;
+ private void changeControllerStatusIdle() {
+ if (this.nbOfNotificationsOngoing > 1) {
+ --this.nbOfNotificationsOngoing;
+ } else {
+ this.nbOfNotificationsOngoing = 0;
+ this.controllerStatus = SdcSingleControllerStatus.IDLE;
+ }
+ }
protected final synchronized void changeControllerStatus(SdcSingleControllerStatus newControllerStatus) {
switch (newControllerStatus) {
@@ -104,12 +112,7 @@ public class SdcSingleController {
this.controllerStatus = newControllerStatus;
break;
case IDLE:
- if (this.nbOfNotificationsOngoing > 1) {
- --this.nbOfNotificationsOngoing;
- } else {
- this.nbOfNotificationsOngoing = 0;
- this.controllerStatus = newControllerStatus;
- }
+ this.changeControllerStatusIdle();
break;
default:
this.controllerStatus = newControllerStatus;
@@ -121,13 +124,9 @@ public class SdcSingleController {
return this.controllerStatus;
}
- // ***** END of Controller STATUS code
- protected SdcSingleControllerConfiguration sdcConfig;
- private IDistributionClient distributionClient;
-
public SdcSingleController(ClampProperties clampProp, CsarInstaller csarInstaller,
SdcSingleControllerConfiguration sdcSingleConfig, boolean isClientAutoManaged) {
- this.isAsdcClientAutoManaged = isClientAutoManaged;
+ this.isSdcClientAutoManaged = isClientAutoManaged;
this.sdcConfig = sdcSingleConfig;
this.refProp = clampProp;
this.csarInstaller = csarInstaller;
@@ -151,9 +150,9 @@ public class SdcSingleController {
if (this.distributionClient == null) {
distributionClient = DistributionClientFactory.createDistributionClient();
}
- IDistributionClientResult result = this.distributionClient.init(sdcConfig, new ASDCNotificationCallBack(this));
+ IDistributionClientResult result = this.distributionClient.init(sdcConfig, new SdcNotificationCallBack(this));
if (!result.getDistributionActionResult().equals(DistributionActionResultEnum.SUCCESS)) {
- logger.error("ASDC distribution client init failed with reason:" + result.getDistributionMessageResult());
+ logger.error("SDC distribution client init failed with reason:" + result.getDistributionMessageResult());
this.changeControllerStatus(SdcSingleControllerStatus.STOPPED);
throw new SdcControllerException("Initialization of the SDC Controller failed with reason: "
+ result.getDistributionMessageResult());
@@ -177,15 +176,15 @@ public class SdcSingleController {
*/
public void closeSdc() throws SdcControllerException {
if (this.getControllerStatus() == SdcSingleControllerStatus.BUSY) {
- throw new SdcControllerException("Cannot close the ASDC controller as it's currently in BUSY state");
+ throw new SdcControllerException("Cannot close the SDC controller as it's currently in BUSY state");
}
if (this.distributionClient != null) {
this.distributionClient.stop();
// If auto managed we can set it to Null, SdcController controls it.
// In the other case the client of this class has specified it, so
// we can't reset it
- if (isAsdcClientAutoManaged) {
- // Next init will initialize it with a new Sdc Client
+ if (isSdcClientAutoManaged) {
+ // Next init will initialize it with a new SDC Client
this.distributionClient = null;
}
}
@@ -207,38 +206,39 @@ public class SdcSingleController {
refProp.getStringValue(CONFIG_SDC_FOLDER));
if (csarInstaller.isCsarAlreadyDeployed(csar)) {
csar.save(downloadTheArtifact(csar.getArtifactElement()));
- this.sendASDCNotification(NotificationType.DOWNLOAD, csar.getArtifactElement().getArtifactURL(),
+ this.sendSdcNotification(NotificationType.DOWNLOAD, csar.getArtifactElement().getArtifactURL(),
sdcConfig.getConsumerID(), iNotif.getDistributionID(), DistributionStatusEnum.DOWNLOAD_OK, null,
System.currentTimeMillis());
csarInstaller.installTheCsar(csar);
- this.sendASDCNotification(NotificationType.DEPLOY, csar.getArtifactElement().getArtifactURL(),
+ this.sendSdcNotification(NotificationType.DEPLOY, csar.getArtifactElement().getArtifactURL(),
sdcConfig.getConsumerID(), iNotif.getDistributionID(), DistributionStatusEnum.DEPLOY_OK, null,
System.currentTimeMillis());
} else {
- this.sendASDCNotification(NotificationType.DOWNLOAD, csar.getArtifactElement().getArtifactURL(),
+ this.sendSdcNotification(NotificationType.DOWNLOAD, csar.getArtifactElement().getArtifactURL(),
sdcConfig.getConsumerID(), iNotif.getDistributionID(),
DistributionStatusEnum.ALREADY_DOWNLOADED, null, System.currentTimeMillis());
- this.sendASDCNotification(NotificationType.DOWNLOAD, csar.getArtifactElement().getArtifactURL(),
+ this.sendSdcNotification(NotificationType.DOWNLOAD, csar.getArtifactElement().getArtifactURL(),
sdcConfig.getConsumerID(), iNotif.getDistributionID(), DistributionStatusEnum.ALREADY_DEPLOYED,
null, System.currentTimeMillis());
}
} catch (SdcArtifactInstallerException e) {
logger.error("SdcArtifactInstallerException exception caught during the notification processing", e);
- this.sendASDCNotification(NotificationType.DEPLOY, csar.getArtifactElement().getArtifactURL(),
+ this.sendSdcNotification(NotificationType.DEPLOY, csar.getArtifactElement().getArtifactURL(),
sdcConfig.getConsumerID(), iNotif.getDistributionID(), DistributionStatusEnum.DEPLOY_ERROR,
e.getMessage(), System.currentTimeMillis());
} catch (SdcDownloadException e) {
logger.error("SdcDownloadException exception caught during the notification processing", e);
- this.sendASDCNotification(NotificationType.DOWNLOAD, csar.getArtifactElement().getArtifactURL(),
+ this.sendSdcNotification(NotificationType.DOWNLOAD, csar.getArtifactElement().getArtifactURL(),
sdcConfig.getConsumerID(), iNotif.getDistributionID(), DistributionStatusEnum.DOWNLOAD_ERROR,
e.getMessage(), System.currentTimeMillis());
} catch (CsarHandlerException e) {
logger.error("CsarHandlerException exception caught during the notification processing", e);
- this.sendASDCNotification(NotificationType.DOWNLOAD, csar.getArtifactElement().getArtifactURL(),
- sdcConfig.getConsumerID(), iNotif.getDistributionID(), DistributionStatusEnum.DOWNLOAD_ERROR,
- e.getMessage(), System.currentTimeMillis());
+ this.sendSdcNotification(NotificationType.DOWNLOAD, null, sdcConfig.getConsumerID(),
+ iNotif.getDistributionID(), DistributionStatusEnum.DOWNLOAD_ERROR, e.getMessage(),
+ System.currentTimeMillis());
} catch (SdcToscaParserException e) {
- this.sendASDCNotification(NotificationType.DEPLOY, csar.getArtifactElement().getArtifactURL(),
+ logger.error("SdcToscaParserException exception caught during the notification processing", e);
+ this.sendSdcNotification(NotificationType.DEPLOY, csar.getArtifactElement().getArtifactURL(),
sdcConfig.getConsumerID(), iNotif.getDistributionID(), DistributionStatusEnum.DEPLOY_ERROR,
e.getMessage(), System.currentTimeMillis());
} catch (RuntimeException e) {
@@ -270,17 +270,17 @@ public class SdcSingleController {
+ artifact.getArtifactUUID() + "Size of payload " + downloadResult.getArtifactPayload().length);
} else {
throw new SdcDownloadException("Artifact " + artifact.getArtifactName()
- + " could not be downloaded from ASDC URL " + artifact.getArtifactURL() + " UUID "
+ + " could not be downloaded from SDC URL " + artifact.getArtifactURL() + " UUID "
+ artifact.getArtifactUUID() + ")" + System.lineSeparator() + "Error message is "
+ downloadResult.getDistributionMessageResult() + System.lineSeparator());
}
return downloadResult;
}
- private void sendASDCNotification(NotificationType notificationType, String artifactURL, String consumerID,
+ private void sendSdcNotification(NotificationType notificationType, String artifactURL, String consumerID,
String distributionID, DistributionStatusEnum status, String errorReason, long timestamp) {
String event = "Sending " + notificationType.name() + "(" + status.name() + ")"
- + " notification to ASDC for artifact:" + artifactURL;
+ + " notification to SDC for artifact:" + artifactURL;
if (errorReason != null) {
event = event + "(" + errorReason + ")";
}
@@ -291,27 +291,35 @@ public class SdcSingleController {
status, timestamp);
switch (notificationType) {
case DOWNLOAD:
- if (errorReason != null) {
- this.distributionClient.sendDownloadStatus(message, errorReason);
- } else {
- this.distributionClient.sendDownloadStatus(message);
- }
+ this.sendDownloadStatus(message, errorReason);
action = "sendDownloadStatus";
break;
case DEPLOY:
- if (errorReason != null) {
- this.distributionClient.sendDeploymentStatus(message, errorReason);
- } else {
- this.distributionClient.sendDeploymentStatus(message);
- }
+ this.sendDeploymentStatus(message, errorReason);
action = "sendDeploymentdStatus";
break;
default:
break;
}
} catch (RuntimeException e) {
- logger.warn("Unable to send the Sdc Notification (" + action + ") due to an exception", e);
+ logger.warn("Unable to send the SDC Notification (" + action + ") due to an exception", e);
+ }
+ logger.info("SDC Notification sent successfully(" + action + ")");
+ }
+
+ private void sendDownloadStatus(IDistributionStatusMessage message, String errorReason) {
+ if (errorReason != null) {
+ this.distributionClient.sendDownloadStatus(message, errorReason);
+ } else {
+ this.distributionClient.sendDownloadStatus(message);
+ }
+ }
+
+ private void sendDeploymentStatus(IDistributionStatusMessage message, String errorReason) {
+ if (errorReason != null) {
+ this.distributionClient.sendDeploymentStatus(message, errorReason);
+ } else {
+ this.distributionClient.sendDeploymentStatus(message);
}
- logger.info("Sdc Notification sent successfully(" + action + ")");
}
}
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 b11385239..97ab05868 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
@@ -66,6 +66,7 @@ public class CsarHandler {
private String blueprintInvariantResourceUuid;
private String blueprintInvariantServiceUuid;
public static final String CSAR_TYPE = "TOSCA_CSAR";
+ public static final String BLUEPRINT_TYPE = "DCAE_INVENTORY_BLUEPRINT";
private INotificationData sdcNotification;
public CsarHandler(INotificationData iNotif, String controller, String clampCsarPath) throws CsarHandlerException {
@@ -114,7 +115,7 @@ public class CsarHandler {
for (IResourceInstance resource : this.getSdcNotification().getResources()) {
if ("VF".equals(resource.getResourceType())) {
for (IArtifactInfo artifact : resource.getArtifacts()) {
- if ("DCAE_INVENTORY_BLUEPRINT".equals(artifact.getArtifactType())) {
+ if (BLUEPRINT_TYPE.equals(artifact.getArtifactType())) {
blueprintArtifactName = artifact.getArtifactName();
blueprintInvariantResourceUuid = resource.getResourceInvariantUUID();
}
@@ -129,7 +130,7 @@ public class CsarHandler {
Enumeration<? extends ZipEntry> entries = zipFile.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();
- if (entry.getName().contains("DCAE_INVENTORY_BLUEPRINT")) {
+ if (entry.getName().contains(BLUEPRINT_TYPE)) {
listEntries.add(entry);
}
}
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 cb100725b..4c6ed7fc7 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,8 +24,6 @@
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,7 +55,6 @@ 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-";
@@ -153,11 +150,11 @@ public class CsarInstallerImpl implements CsarInstaller {
private String queryDcaeToGetServiceTypeId(CsarHandler csar) throws IOException, ParseException {
return dcaeInventoryService.getDcaeInformation(csar.getBlueprintArtifactName(),
- csar.getBlueprintInvariantServiceUuid(), csar.getBlueprintInvariantResourceUuid());
+ csar.getBlueprintInvariantServiceUuid(), csar.getBlueprintInvariantResourceUuid()).getTypeId();
}
private CldsTemplate createFakeCldsTemplate(CsarHandler csar, BlueprintParserFilesConfiguration configFiles)
- throws IOException, SdcArtifactInstallerException {
+ throws IOException {
CldsTemplate template = new CldsTemplate();
template.setBpmnId("Sdc-Generated");
template.setBpmnText(
@@ -184,9 +181,8 @@ public class CsarInstallerImpl implements CsarInstaller {
cldsModel.setBlueprintText(csar.getDcaeBlueprint());
cldsModel.setTemplateName(cldsTemplate.getName());
cldsModel.setTemplateId(cldsTemplate.getId());
- // cldsModel.setDocText(cldsTemplate.getPropText());
cldsModel.setPropText("{\"global\":[{\"name\":\"service\",\"value\":[\""
- + csar.getSdcNotification().getServiceInvariantUUID() + "\"]},{\"name\":\"vf\",\"value\":[\""
+ + csar.getBlueprintInvariantServiceUuid() + "\"]},{\"name\":\"vf\",\"value\":[\""
+ csar.getBlueprintInvariantResourceUuid()
+ "\"]},{\"name\":\"actionSet\",\"value\":[\"vnfRecipe\"]},{\"name\":\"location\",\"value\":[\"DC1\"]}]}");
cldsModel.setBpmnText(cldsTemplate.getBpmnText());