import org.onap.so.db.catalog.utils.MavenLikeVersioning;
import org.onap.so.entity.MsoRequest;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoAlarmLogger;
+
import org.onap.so.logger.MsoLogger;
import org.onap.so.openstack.beans.VnfRollback;
import org.onap.so.openstack.beans.VnfStatus;
private static final String MSO_CONFIGURATION_ERROR = "MsoConfigurationError";
private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, MsoVnfPluginAdapterImpl.class);
- private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
+
private static final String CHECK_REQD_PARAMS = "org.onap.so.adapters.vnf.checkRequiredParameters";
private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
* Deprecated - should use modelCustomizationUuid
* @param vnfVersion VNF version key, should match a VNF definition in catalog DB
* Deprecated - VF Module versions also captured by modelCustomizationUuid
+ * @param vnfId - VNF ID
* @param vfModuleName Name to be assigned to the new VF Module
+ * @param vfModuleId Id fo the new VF Module
* @param requestType Indicates if this is a Volume Group or Module request
* @param volumeGroupId Identifier (i.e. deployment ID) for a Volume Group
* to attach to a VF Module
String tenantId,
String vfModuleType,
String vnfVersion,
+ String genericVnfId,
String vfModuleName,
+ String vfModuleId,
String requestType,
String volumeGroupId,
String baseVfModuleId,
CloudSite cloudSite = cloudSiteOp.get();
MavenLikeVersioning aicV = new MavenLikeVersioning();
aicV.setVersion(cloudSite.getCloudVersion());
+ Boolean usingMulticloud = getUsingMulticloud(cloudSite);
String vnfMin = vnfResource.getAicVersionMin();
String vnfMax = vnfResource.getAicVersionMax();
// Use the VduPlugin.
VduPlugin vduPlugin = getVduPlugin(cloudSiteId);
- // First, look up to see if the VF already exists.
+ // First, look up to see if the VF already exists, unless using multicloud adapter
long subStartTime1 = System.currentTimeMillis ();
- try {
- vduInstance = vduPlugin.queryVdu (cloudInfo, vfModuleName);
- LOGGER.recordMetricEvent (subStartTime1, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from VduPlugin", "VDU", "QueryVDU", vfModuleName);
- }
- catch (VduException me) {
- // Failed to query the VDU due to a plugin exception.
- String error = "Create VF Module: Query " + vfModuleName + " in " + cloudSiteId + "/" + tenantId + ": " + me ;
- LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vfModuleName, cloudSiteId, tenantId, "VDU", "queryVdu", MsoLogger.ErrorCode.DataError, "Exception - queryVdu", me);
- LOGGER.recordMetricEvent (subStartTime1, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "VDU", "QueryVdu", vfModuleName);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ if (!usingMulticloud) {
+ try {
+ vduInstance = vduPlugin.queryVdu (cloudInfo, vfModuleName);
+ LOGGER.recordMetricEvent (subStartTime1, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from VduPlugin", "VDU", "QueryVDU", vfModuleName);
+ }
+ catch (VduException me) {
+ // Failed to query the VDU due to a plugin exception.
+ String error = "Create VF Module: Query " + vfModuleName + " in " + cloudSiteId + "/" + tenantId + ": " + me ;
+ LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vfModuleName, cloudSiteId, tenantId, "VDU", "queryVdu", MsoLogger.ErrorCode.DataError, "Exception - queryVdu", me);
+ LOGGER.recordMetricEvent (subStartTime1, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "VDU", "QueryVdu", vfModuleName);
+ LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
- // Convert to a generic VnfException
- me.addContext ("CreateVFModule");
- throw new VnfException (me);
+ // Convert to a generic VnfException
+ me.addContext ("CreateVFModule");
+ throw new VnfException (me);
+ }
}
// More precise handling/messaging if the Module already exists
Map<String, Object> volumeGroupOutputs = null;
// If a Volume Group was provided, query its outputs for inclusion in Module input parameters
- if (volumeGroupId != null) {
+ if (!usingMulticloud && volumeGroupId != null) {
long subStartTime2 = System.currentTimeMillis ();
VduInstance volumeVdu = null;
try {
LOGGER.debug ("WARNING: Add-on Module request - no Base Module ID provided");
}
- if (baseVfModuleId != null) {
+ // Need to verify if multicloud needs to have the vaseVfModuleId passed to it. Ignoring this for now.
+ if (!usingMulticloud && baseVfModuleId != null) {
long subStartTime2 = System.currentTimeMillis ();
VduInstance baseVdu = null;
try {
if (heatTemplate == null) {
String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", reqType=" + requestType;
LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Template ID", vfModuleType, "VNF", "", MsoLogger.ErrorCode.DataError, error);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
- alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR,
- MsoAlarmLogger.CRITICAL, error);
+ LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
} else {
LOGGER.debug ("Got HEAT Template from DB: " + heatTemplate.getHeatTemplate());
String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType;
LOGGER.error (MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Environment ID", "OpenStack", "", MsoLogger.ErrorCode.DataError, error);
LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
- // Alarm on this error, configuration must be fixed
- alarmLogger.sendAlarm (MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error);
-
throw new VnfException (error, MsoExceptionCategory.INTERNAL);
} else {
LOGGER.debug ("Got Heat Environment from DB: " + heatEnvironment.getEnvironment());
}
if (!extraInputs.isEmpty()) {
- // Add directive inputs
- String[] directives = { "oof_directives", "sdnc_directives" };
- for (String key : directives) {
+ // Add multicloud inputs
+ boolean multicloudInputs = false;
+ for (String key : MsoMulticloudUtils.MULTICLOUD_INPUTS) {
if (extraInputs.contains(key)) {
goldenInputs.put(key, inputs.get(key));
extraInputs.remove(key);
+ multicloudInputs = true;
if (extraInputs.isEmpty()) {
break;
}
// Default - return HEAT plugin, though will fail later
return heatUtils;
}
+
+ private Boolean getUsingMulticloud (CloudSite cloudSite) {
+ if (cloudSite.getOrchestrator().equalsIgnoreCase("MULTICLOUD")) {
+ return true;
+ } else {
+ return false;
+ }
+ }
}