aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap
diff options
context:
space:
mode:
authorDeterme, Sebastien (sd378r) <sd378r@intl.att.com>2018-04-26 14:45:49 +0200
committerDeterme, Sebastien (sd378r) <sd378r@intl.att.com>2018-04-26 14:45:49 +0200
commit7b815eca4fb6a92d3b36418029d3191e768431f1 (patch)
tree07caba67f3a55845a6b15795e4c8284830372e54 /src/main/java/org/onap
parent90fcd198e69fca04ed57f05ef88f83662d9349bf (diff)
Fix sdc controller
Support multiple closed loop deployment in the same service and add test for mutliple closed loops Issue-ID: CLAMP-151 Change-Id: Ied352ecb10fee4b807fa4bbfebc5934fd62cba3e Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
Diffstat (limited to 'src/main/java/org/onap')
-rw-r--r--src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImpl.java18
1 files changed, 13 insertions, 5 deletions
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 e28e8ab70..17312442b 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
@@ -99,12 +99,19 @@ public class CsarInstallerImpl implements CsarInstaller {
@Override
public boolean isCsarAlreadyDeployed(CsarHandler csar) throws SdcArtifactInstallerException {
- return (CldsModel.retrieve(cldsDao, buildModelName(csar), true).getId() != null) ? true : false;
+ boolean alreadyInstalled = true;
+ for (Entry<String, BlueprintArtifact> blueprint : csar.getMapOfBlueprints().entrySet()) {
+ alreadyInstalled = alreadyInstalled
+ && (CldsModel.retrieve(cldsDao, buildModelName(csar, blueprint.getKey()), true).getId() != null)
+ ? true
+ : false;
+ }
+ return alreadyInstalled;
}
- public static String buildModelName(CsarHandler csar) {
+ public static String buildModelName(CsarHandler csar, String resourceInstanceName) {
return MODEL_NAME_PREFIX + csar.getSdcCsarHelper().getServiceMetadata().getValue("name") + "_v"
- + csar.getSdcNotification().getServiceVersion().replace('.', '_');
+ + csar.getSdcNotification().getServiceVersion().replace('.', '_') + "_" + resourceInstanceName;
}
@Override
@@ -196,7 +203,8 @@ public class CsarInstallerImpl implements CsarInstaller {
"{\"global\":[{\"name\":\"service\",\"value\":[\"" + blueprintArtifact.getDcaeBlueprint() + "\"]}]}");
template.setImageText(
IOUtils.toString(appContext.getResource(configFiles.getSvgXmlFilePath()).getInputStream()));
- template.setName(TEMPLATE_NAME_PREFIX + buildModelName(csar));
+ template.setName(TEMPLATE_NAME_PREFIX
+ + buildModelName(csar, blueprintArtifact.getResourceAttached().getResourceInstanceName()));
template.save(cldsDao, null);
logger.info("Fake Clds Template created for blueprint " + blueprintArtifact.getBlueprintArtifactName()
+ " with name " + template.getName());
@@ -207,7 +215,7 @@ public class CsarInstallerImpl implements CsarInstaller {
CldsTemplate cldsTemplate, String serviceTypeId) throws SdcArtifactInstallerException {
try {
CldsModel cldsModel = new CldsModel();
- cldsModel.setName(buildModelName(csar));
+ cldsModel.setName(buildModelName(csar, blueprintArtifact.getResourceAttached().getResourceInstanceName()));
cldsModel.setBlueprintText(blueprintArtifact.getDcaeBlueprint());
cldsModel.setTemplateName(cldsTemplate.getName());
cldsModel.setTemplateId(cldsTemplate.getId());