use of org.onap.so.asdc.installer.VfModuleArtifact in project so by onap.
the class ToscaResourceInstaller method getHeatEnvArtifactFromGeneratedArtifact.
protected VfModuleArtifact getHeatEnvArtifactFromGeneratedArtifact(VfResourceStructure vfResourceStructure, VfModuleArtifact vfModuleArtifact) {
String artifactName = vfModuleArtifact.getArtifactInfo().getArtifactName();
artifactName = artifactName.substring(0, artifactName.indexOf('.'));
for (VfModuleArtifact moduleArtifact : vfResourceStructure.getArtifactsMapByUUID().values()) {
if (moduleArtifact.getArtifactInfo().getArtifactName().contains(artifactName) && moduleArtifact.getArtifactInfo().getArtifactType().equals(ASDCConfiguration.HEAT_ENV)) {
return moduleArtifact;
}
}
return null;
}
use of org.onap.so.asdc.installer.VfModuleArtifact in project so by onap.
the class ToscaResourceInstaller method extractHeatInformation.
protected void extractHeatInformation(ToscaResourceStructure toscaResourceStruct, VfResourceStructure vfResourceStructure) {
for (VfModuleArtifact vfModuleArtifact : vfResourceStructure.getArtifactsMapByUUID().values()) {
switch(vfModuleArtifact.getArtifactInfo().getArtifactType()) {
case ASDCConfiguration.HEAT:
case ASDCConfiguration.HEAT_NESTED:
createHeatTemplateFromArtifact(vfResourceStructure, toscaResourceStruct, vfModuleArtifact);
break;
case ASDCConfiguration.HEAT_VOL:
createHeatTemplateFromArtifact(vfResourceStructure, toscaResourceStruct, vfModuleArtifact);
VfModuleArtifact envModuleArtifact = getHeatEnvArtifactFromGeneratedArtifact(vfResourceStructure, vfModuleArtifact);
createHeatEnvFromArtifact(vfResourceStructure, envModuleArtifact);
break;
case ASDCConfiguration.HEAT_ENV:
createHeatEnvFromArtifact(vfResourceStructure, vfModuleArtifact);
break;
case ASDCConfiguration.HEAT_ARTIFACT:
createHeatFileFromArtifact(vfResourceStructure, vfModuleArtifact, toscaResourceStruct);
break;
case ASDCConfiguration.HEAT_NET:
case ASDCConfiguration.OTHER:
case ASDCConfiguration.CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT:
logger.warn(LoggingAnchor.FOUR, MessageEnum.ASDC_ARTIFACT_TYPE_NOT_SUPPORT.toString(), vfModuleArtifact.getArtifactInfo().getArtifactType() + "(Artifact Name:" + vfModuleArtifact.getArtifactInfo().getArtifactName() + ")", ErrorCode.DataError.getValue(), "Artifact type not supported");
break;
default:
break;
}
}
}
use of org.onap.so.asdc.installer.VfModuleArtifact in project so by onap.
the class ToscaResourceInstaller method setHeatInformationForVfModule.
protected void setHeatInformationForVfModule(ToscaResourceStructure toscaResourceStructure, VfResourceStructure vfResourceStructure, VfModule vfModule, VfModuleCustomization vfModuleCustomization, Metadata vfMetadata) {
Optional<VfModuleStructure> matchingObject = vfResourceStructure.getVfModuleStructure().stream().filter(vfModuleStruct -> vfModuleStruct.getVfModuleMetadata().getVfModuleModelUUID().equalsIgnoreCase(vfMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID))).findFirst();
if (matchingObject.isPresent()) {
List<HeatFiles> heatFilesList = new ArrayList<>();
List<HeatTemplate> volumeHeatChildTemplates = new ArrayList<>();
List<HeatTemplate> heatChildTemplates = new ArrayList<>();
HeatTemplate parentHeatTemplate = new HeatTemplate();
String parentArtifactType = null;
Set<String> artifacts = new HashSet<>(matchingObject.get().getVfModuleMetadata().getArtifacts());
for (VfModuleArtifact vfModuleArtifact : vfResourceStructure.getArtifactsMapByUUID().values()) {
List<HeatTemplate> childNestedHeatTemplates = new ArrayList<>();
if (artifacts.contains(vfModuleArtifact.getArtifactInfo().getArtifactUUID())) {
checkVfModuleArtifactType(vfModule, vfModuleCustomization, heatFilesList, vfModuleArtifact, childNestedHeatTemplates, parentHeatTemplate, vfResourceStructure);
}
if (vfModuleArtifact.getArtifactInfo().getArtifactType().equals(ASDCConfiguration.HEAT_NESTED)) {
parentArtifactType = identifyParentOfNestedTemplate(matchingObject.get(), vfModuleArtifact);
if (!childNestedHeatTemplates.isEmpty()) {
if (parentArtifactType != null && parentArtifactType.equalsIgnoreCase(ASDCConfiguration.HEAT_VOL)) {
volumeHeatChildTemplates.add(childNestedHeatTemplates.get(0));
} else {
heatChildTemplates.add(childNestedHeatTemplates.get(0));
}
}
}
}
if (!heatFilesList.isEmpty()) {
vfModule.setHeatFiles(heatFilesList);
}
// Set all Child Templates related to HEAT_VOLUME
if (!volumeHeatChildTemplates.isEmpty()) {
if (vfModule.getVolumeHeatTemplate() != null) {
vfModule.getVolumeHeatTemplate().setChildTemplates(volumeHeatChildTemplates);
} else {
logger.debug("VolumeHeatTemplate not set in setHeatInformationForVfModule()");
}
}
// Set all Child Templates related to HEAT
if (!heatChildTemplates.isEmpty()) {
if (vfModule.getModuleHeatTemplate() != null) {
vfModule.getModuleHeatTemplate().setChildTemplates(heatChildTemplates);
} else {
logger.debug("ModuleHeatTemplate not set in setHeatInformationForVfModule()");
}
}
}
}
Aggregations