diff options
16 files changed, 562 insertions, 293 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java index 476bff3692..d44857ce72 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java @@ -92,9 +92,9 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ private static final String DELETE_STACK = "DeleteStack"; - private static final String HEAT_ERROR = "HeatError"; + protected static final String HEAT_ERROR = "HeatError"; - private static final String CREATE_STACK = "CreateStack"; + protected static final String CREATE_STACK = "CreateStack"; // Cache Heat Clients statically. Since there is just one MSO user, there is no // benefit to re-authentication on every request (or across different flows). The @@ -1703,7 +1703,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ return vduStatus; } - private void sleep(long time) { + protected void sleep(long time) { try { Thread.sleep(time); } catch (InterruptedException e) { diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java index 306de05eea..051d8134f1 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java @@ -21,7 +21,6 @@ package org.onap.so.openstack.utils; import java.net.MalformedURLException; -import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; @@ -30,10 +29,8 @@ import java.util.Scanner; import javax.ws.rs.core.UriBuilder; import javax.ws.rs.core.UriBuilderException; -import javax.ws.rs.core.Response.StatusType; import javax.ws.rs.core.Response; -import org.apache.http.HttpStatus; import org.onap.so.db.catalog.beans.CloudIdentity; import org.onap.so.utils.CryptoUtils; import org.slf4j.Logger; @@ -53,11 +50,15 @@ import org.onap.so.openstack.beans.StackInfo; import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; import org.onap.so.openstack.exceptions.MsoException; import org.onap.so.openstack.exceptions.MsoOpenstackException; -import org.onap.so.openstack.mappers.StackInfoMapper; import org.onap.so.client.HttpClient; import org.onap.so.client.RestClient; import org.onap.so.db.catalog.beans.CloudSite; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoAlarmLogger; +import org.onap.so.logger.MsoLogger; import org.onap.so.utils.TargetEntity; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; @@ -65,7 +66,6 @@ import org.springframework.stereotype.Component; import com.fasterxml.jackson.databind.ObjectMapper; import com.woorea.openstack.heat.model.CreateStackParam; -import com.woorea.openstack.heat.model.Stack; @Component public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ @@ -78,16 +78,14 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ public static final List<String> MULTICLOUD_INPUTS = Arrays.asList(OOF_DIRECTIVES, SDNC_DIRECTIVES, GENERIC_VNF_ID, VF_MODULE_ID, TEMPLATE_TYPE); - private static final String ONAP_IP = "ONAP_IP"; - - private static final String DEFAULT_MSB_IP = "127.0.0.1"; - - private static final Integer DEFAULT_MSB_PORT = 80; - private static final Logger logger = LoggerFactory.getLogger(MsoMulticloudUtils.class); private static final ObjectMapper JSON_MAPPER = new ObjectMapper(); + @Autowired + private Environment environment; + + /****************************************************************************** * * Methods (and associated utilities) to implement the VduPlugin interface @@ -129,7 +127,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ * @param files a Map<String, Object> that lists the child template IDs (file is the string, object is an int of * Template id) * @param heatFiles a Map<String, Object> that lists the get_file entries (fileName, fileBody) - * @param backout Donot delete stack on create Failure - defaulted to True + * @param backout Do not delete stack on create Failure - defaulted to True * @return A StackInfo object * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception. */ @@ -215,20 +213,22 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ Response response = multicloudClient.post(request); - StackInfo responseStackInfo = new StackInfo(); - responseStackInfo.setName(stackName); - responseStackInfo.setStatus(mapResponseToHeatStatus(response)); + StackInfo createInfo = new StackInfo(); + createInfo.setName(stackName); MulticloudCreateResponse multicloudResponseBody = null; if (response.getStatus() == Response.Status.CREATED.getStatusCode() && response.hasEntity()) { multicloudResponseBody = getCreateBody((java.io.InputStream)response.getEntity()); - responseStackInfo.setCanonicalName(multicloudResponseBody.getWorkloadId()); + createInfo.setCanonicalName(stackName + "/" + multicloudResponseBody.getWorkloadId()); if (logger.isDebugEnabled()) { logger.debug("Multicloud Create Response Body: " + multicloudResponseBody); } + return getStackStatus(cloudSiteId, tenantId, multicloudResponseBody.getWorkloadId(), pollForCompletion, timeoutMinutes, backout); + } else { + createInfo.setStatus(HeatStatus.FAILED); + createInfo.setStatusMessage(response.getStatusInfo().getReasonPhrase()); + return createInfo; } - - return responseStackInfo; } @Override @@ -243,26 +243,36 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ } /** - * Query for a single stack (by Name) in a tenant. This call will always return a + * Query for a single stack (by ID) in a tenant. This call will always return a * StackInfo object. If the stack does not exist, an "empty" StackInfo will be * returned - containing only the stack name and a status of NOTFOUND. * * @param tenantId The Openstack ID of the tenant in which to query * @param cloudSiteId The cloud identifier (may be a region) in which to query - * @param stackName The name of the stack to query (may be simple or canonical) + * @param stackId The ID of the stack to query * @return A StackInfo object * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception. */ @Override - public StackInfo queryStack (String cloudSiteId, String tenantId, String stackName) throws MsoException { + public StackInfo queryStack (String cloudSiteId, String tenantId, String instanceId) throws MsoException { if (logger.isDebugEnabled()) { - logger.debug (String.format("Query multicloud HEAT stack: %s in tenant %s", stackName, tenantId)); + logger.debug (String.format("Query multicloud HEAT stack: %s in tenant %s", instanceId, tenantId)); + } + String stackName = null; + String stackId = null; + int offset = instanceId.indexOf('/'); + if (offset > 0 && offset < (instanceId.length() - 1)) { + stackName = instanceId.substring(0, offset); + stackId = instanceId.substring(offset + 1); + } else { + stackName = instanceId; + stackId = instanceId; } StackInfo returnInfo = new StackInfo(); returnInfo.setName(stackName); - String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, stackName); + String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, stackId); RestClient multicloudClient = getMulticloudClient(multicloudEndpoint); if (multicloudClient != null) { @@ -271,31 +281,47 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ logger.debug (String.format("Mulicloud GET Response: %s", response.toString())); } - returnInfo.setStatus(mapResponseToHeatStatus(response)); - MulticloudQueryResponse multicloudQueryBody = null; - if (response.getStatus() == Response.Status.OK.getStatusCode() && response.hasEntity()) { + if (response.getStatus() == Response.Status.NOT_FOUND.getStatusCode()) { + returnInfo.setStatus(HeatStatus.NOTFOUND); + returnInfo.setStatusMessage(response.getStatusInfo().getReasonPhrase()); + } else if (response.getStatus() == Response.Status.OK.getStatusCode() && response.hasEntity()) { multicloudQueryBody = getQueryBody((java.io.InputStream)response.getEntity()); - returnInfo.setCanonicalName(multicloudQueryBody.getWorkloadId()); + returnInfo.setCanonicalName(stackName + "/" + multicloudQueryBody.getWorkloadId()); + returnInfo.setStatus(getHeatStatus(multicloudQueryBody.getWorkloadStatus())); + returnInfo.setStatusMessage(multicloudQueryBody.getWorkloadStatus()); if (logger.isDebugEnabled()) { logger.debug("Multicloud Create Response Body: " + multicloudQueryBody.toString()); } + } else { + returnInfo.setStatus(HeatStatus.FAILED); + returnInfo.setStatusMessage(response.getStatusInfo().getReasonPhrase()); } } return returnInfo; - } - public StackInfo deleteStack (String cloudSiteId, String tenantId, String stackName) throws MsoException { + public StackInfo deleteStack (String cloudSiteId, String tenantId, String instanceId) throws MsoException { if (logger.isDebugEnabled()) { - logger.debug (String.format("Delete multicloud HEAT stack: %s in tenant %s", stackName, tenantId)); + logger.debug (String.format("Delete multicloud HEAT stack: %s in tenant %s", instanceId, tenantId)); + } + String stackName = null; + String stackId = null; + int offset = instanceId.indexOf('/'); + if (offset > 0 && offset < (instanceId.length() - 1)) { + stackName = instanceId.substring(0, offset); + stackId = instanceId.substring(offset + 1); + } else { + stackName = instanceId; + stackId = instanceId; } + StackInfo returnInfo = new StackInfo(); returnInfo.setName(stackName); Response response = null; - String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, stackName); + String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, stackId); RestClient multicloudClient = getMulticloudClient(multicloudEndpoint); if (multicloudClient != null) { @@ -303,6 +329,17 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ if (logger.isDebugEnabled()) { logger.debug(String.format("Multicloud Delete response is: %s", response.getEntity().toString())); } + + if (response.getStatus() == Response.Status.NOT_FOUND.getStatusCode()) { + returnInfo.setStatus(HeatStatus.NOTFOUND); + returnInfo.setStatusMessage(response.getStatusInfo().getReasonPhrase()); + } else if (response.getStatus() == Response.Status.NO_CONTENT.getStatusCode()) { + return getStackStatus(cloudSiteId, tenantId, instanceId); + } else { + returnInfo.setStatus(HeatStatus.FAILED); + returnInfo.setStatusMessage(response.getStatusInfo().getReasonPhrase()); + } + } returnInfo.setStatus(mapResponseToHeatStatus(response)); return returnInfo; @@ -310,6 +347,193 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{ // --------------------------------------------------------------- // PRIVATE FUNCTIONS FOR USE WITHIN THIS CLASS + + private HeatStatus getHeatStatus(String workloadStatus) { + if (workloadStatus.length() == 0) return HeatStatus.INIT; + if ("CREATE_IN_PROGRESS".equals(workloadStatus)) return HeatStatus.BUILDING; + if ("CREATE_COMPLETE".equals(workloadStatus)) return HeatStatus.CREATED; + if ("CREATE_FAILED".equals(workloadStatus)) return HeatStatus.FAILED; + if ("DELETE_IN_PROGRESS".equals(workloadStatus)) return HeatStatus.DELETING; + if ("DELETE_COMPLETE".equals(workloadStatus)) return HeatStatus.NOTFOUND; + if ("DELETE_FAILED".equals(workloadStatus)) return HeatStatus.FAILED; + if ("UPDATE_IN_PROGRESS".equals(workloadStatus)) return HeatStatus.UPDATING; + if ("UPDATE_FAILED".equals(workloadStatus)) return HeatStatus.FAILED; + if ("UPDATE_COMPLETE".equals(workloadStatus)) return HeatStatus.UPDATED; + return HeatStatus.UNKNOWN; + } + + private StackInfo getStackStatus(String cloudSiteId, String tenantId, String instanceId) throws MsoException { + return getStackStatus(cloudSiteId, tenantId, instanceId, false, 0, false); + } + + private StackInfo getStackStatus(String cloudSiteId, String tenantId, String instanceId, boolean pollForCompletion, int timeoutMinutes, boolean backout) throws MsoException { + StackInfo stackInfo = new StackInfo(); + + // If client has requested a final response, poll for stack completion + if (pollForCompletion) { + // Set a time limit on overall polling. + // Use the resource (template) timeout for Openstack (expressed in minutes) + // and add one poll interval to give Openstack a chance to fail on its own.s + + int createPollInterval = Integer.parseInt(this.environment.getProperty(createPollIntervalProp, createPollIntervalDefault)); + int pollTimeout = (timeoutMinutes * 60) + createPollInterval; + // New 1610 - poll on delete if we rollback - use same values for now + int deletePollInterval = createPollInterval; + int deletePollTimeout = pollTimeout; + boolean createTimedOut = false; + StringBuilder stackErrorStatusReason = new StringBuilder(""); + logger.debug("createPollInterval=" + createPollInterval + ", pollTimeout=" + pollTimeout); + + while (true) { + try { + stackInfo = queryStack(cloudSiteId, tenantId, instanceId); + logger.debug (stackInfo.getStatus() + " (" + instanceId + ")"); + + if (HeatStatus.BUILDING.equals(stackInfo.getStatus())) { + // Stack creation is still running. + // Sleep and try again unless timeout has been reached + if (pollTimeout <= 0) { + // Note that this should not occur, since there is a timeout specified + // in the Openstack (multicloud?) call. + logger.error(String.format("%d %s %s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_TIMEOUT, cloudSiteId, tenantId, instanceId, stackInfo.getStatus(), "", "", MsoLogger.ErrorCode.AvailabilityError, "Create stack timeout")); + createTimedOut = true; + break; + } + + sleep(createPollInterval * 1000L); + + pollTimeout -= createPollInterval; + logger.debug("pollTimeout remaining: " + pollTimeout); + } else { + //save off the status & reason msg before we attempt delete + stackErrorStatusReason.append("Stack error (" + stackInfo.getStatus() + "): " + stackInfo.getStatusMessage()); + break; + } + } catch (MsoException me) { + // Cannot query the stack status. Something is wrong. + // Try to roll back the stack + if (!backout) { + logger.warn(String.format("%d %s %s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR, "Create Stack errored, stack deletion suppressed", "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in Create Stack, stack deletion suppressed")); + } else { + try { + logger.debug("Create Stack error - unable to query for stack status - attempting to delete stack: " + instanceId + " - This will likely fail and/or we won't be able to query to see if delete worked"); + StackInfo deleteInfo = deleteStack(cloudSiteId, tenantId, instanceId); + // this may be a waste of time - if we just got an exception trying to query the stack - we'll just + // get another one, n'est-ce pas? + boolean deleted = false; + while (!deleted) { + try { + StackInfo queryInfo = queryStack(cloudSiteId, tenantId, instanceId); + logger.debug("Deleting " + instanceId + ", status: " + queryInfo.getStatus()); + if (HeatStatus.DELETING.equals(queryInfo.getStatus())) { + if (deletePollTimeout <= 0) { + logger.error(String.format("%d %s %s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_TIMEOUT, cloudSiteId, tenantId, instanceId, + queryInfo.getStatus(), "", "", MsoLogger.ErrorCode.AvailabilityError, + "Rollback: DELETE stack timeout")); + break; + } else { + sleep(deletePollInterval * 1000L); + deletePollTimeout -= deletePollInterval; + } + } else if (HeatStatus.NOTFOUND.equals(queryInfo.getStatus())){ + logger.debug("DELETE_COMPLETE for " + instanceId); + deleted = true; + continue; + } else { + //got a status other than DELETE_IN_PROGRESS or DELETE_COMPLETE - so break and evaluate + break; + } + } catch (Exception e3) { + // Just log this one. We will report the original exception. + logger.error(String.format("%d %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR, "Create Stack: Nested exception rolling back stack: " + e3, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Create Stack: Nested exception rolling back stack on error on query")); + } + } + } catch (Exception e2) { + // Just log this one. We will report the original exception. + logger.error(String.format("%d %s %s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR, "Create Stack: Nested exception rolling back stack: " + e2, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Create Stack: Nested exception rolling back stack")); + } + } + + // Propagate the original exception from Stack Query. + me.addContext (CREATE_STACK); + throw me; + } + } + + if (!HeatStatus.CREATED.equals(stackInfo.getStatus())) { + logger.error(String.format("%d %s %s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR, "Create Stack error: Polling complete with non-success status: " + + stackInfo.getStatus () + ", " + stackInfo.getStatusMessage(), "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Create Stack error")); + + // Rollback the stack creation, since it is in an indeterminate state. + if (!backout) { + logger.warn(String.format("%d %s %s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR, "Create Stack errored, stack deletion suppressed", "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Create Stack error, stack deletion suppressed")); + } + else + { + try { + logger.debug("Create Stack errored - attempting to DELETE stack: " + instanceId); + logger.debug("deletePollInterval=" + deletePollInterval + ", deletePollTimeout=" + deletePollTimeout); + StackInfo deleteInfo = deleteStack(cloudSiteId, tenantId, instanceId); + boolean deleted = false; + while (!deleted) { + try { + StackInfo queryInfo = queryStack(cloudSiteId, tenantId, instanceId); + logger.debug("Deleting " + instanceId + ", status: " + queryInfo.getStatus()); + if (HeatStatus.DELETING.equals(queryInfo.getStatus())) { + if (deletePollTimeout <= 0) { + logger.error(String.format("%d %s %s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_TIMEOUT, cloudSiteId, tenantId, instanceId, + queryInfo.getStatus(), "", "", MsoLogger.ErrorCode.AvailabilityError, + "Rollback: DELETE stack timeout")); + break; + } else { + sleep(deletePollInterval * 1000L); + deletePollTimeout -= deletePollInterval; + } + } else if (HeatStatus.NOTFOUND.equals(queryInfo.getStatus())){ + logger.debug("DELETE_COMPLETE for " + instanceId); + deleted = true; + continue; + } else { + //got a status other than DELETE_IN_PROGRESS or DELETE_COMPLETE - so break and evaluate + logger.warn(String.format("%d %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR, "Create Stack errored, stack deletion FAILED", "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Create Stack error, stack deletion FAILED")); + logger.debug("Stack deletion FAILED on a rollback of a create - " + instanceId + ", status=" + queryInfo.getStatus() + ", reason=" + queryInfo.getStatusMessage()); + break; + } + } catch (MsoException me2) { + // Just log this one. We will report the original exception. + logger.debug("Exception thrown trying to delete " + instanceId + " on a create->rollback: " + me2.getContextMessage(), me2); + logger.warn(String.format("%d %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR, "Create Stack errored, then stack deletion FAILED - exception thrown", "", "", MsoLogger.ErrorCode.BusinessProcesssError, me2.getContextMessage())); + } + } + StringBuilder errorContextMessage; + if (createTimedOut) { + errorContextMessage = new StringBuilder("Stack Creation Timeout"); + } else { + errorContextMessage = stackErrorStatusReason; + } + if (deleted) { + errorContextMessage.append(" - stack successfully deleted"); + } else { + errorContextMessage.append(" - encountered an error trying to delete the stack"); + } + } catch (MsoException e2) { + // shouldn't happen - but handle + logger.error(String.format("%d %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_ERR, "Create Stack: Nested exception rolling back stack: " + e2, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in Create Stack: rolling back stack")); + } + } + MsoOpenstackException me = new MsoOpenstackException(0, "", stackErrorStatusReason.toString()); + me.addContext(CREATE_STACK); + alarmLogger.sendAlarm(HEAT_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); + throw me; + } + } else { + // Get initial status, since it will have been null after the create. + stackInfo = queryStack(cloudSiteId, tenantId, instanceId); + logger.debug("Multicloud stack query status is: " + stackInfo.getStatus()); + } + return stackInfo; + } + private HeatStatus mapResponseToHeatStatus(Response response) { if (response.getStatusInfo().getStatusCode() == Response.Status.OK.getStatusCode()) { return HeatStatus.CREATED; diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.12__UpdateAutoScaleOutRefData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.12__UpdateAutoScaleOutRefData.sql new file mode 100644 index 0000000000..5e60f23965 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.12__UpdateAutoScaleOutRefData.sql @@ -0,0 +1,7 @@ +USE catalogdb; + +update building_block_detail set resource_type='CUSTOM', target_action='CUSTOM' where BUILDING_BLOCK_NAME = 'ConfigurationScaleOutBB'; + +update building_block_detail set resource_type='CUSTOM', target_action='CUSTOM' where BUILDING_BLOCK_NAME = 'GenericVnfHealthCheckBB'; + +update northbound_request_ref_lookup set ACTION='scaleOut' where MACRO_ACTION='VFModule-ScaleOut'; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapter.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapter.java index 5efcc2c90d..7c49c9f948 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapter.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapter.java @@ -7,9 +7,9 @@ * 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. @@ -47,8 +47,8 @@ public interface MsoVnfAdapter @WebParam(name="tenantId") @XmlElement(required=true) String tenantId, @WebParam(name="vnfType") @XmlElement(required=true) String vnfType, @WebParam(name="vnfVersion") @XmlElement(required=false) String vnfVersion, - @WebParam(name="vnfName") @XmlElement(required=true) String vnfName, - @WebParam(name="requestType") @XmlElement(required=false) String requestType, + @WebParam(name="vnfName") @XmlElement(required=true) String vnfName, + @WebParam(name="requestType") @XmlElement(required=false) String requestType, @WebParam(name="volumeGroupHeatStackId") @XmlElement(required=false) String volumeGroupHeatStackId, @WebParam(name="inputs") Map<String,String> inputs, @WebParam(name="failIfExists") Boolean failIfExists, @@ -102,8 +102,10 @@ public interface MsoVnfAdapter @WebParam(name="tenantId") @XmlElement(required=true) String tenantId, @WebParam(name="vnfType") @XmlElement(required=true) String vnfType, @WebParam(name="vnfVersion") @XmlElement(required=false) String vnfVersion, - @WebParam(name="vnfName") @XmlElement(required=true) String vnfName, - @WebParam(name="requestType") @XmlElement(required=false) String requestType, + @WebParam(name="genericVnfId") @XmlElement(required=true) String genericVnfId, + @WebParam(name="vnfName") @XmlElement(required=true) String vnfName, + @WebParam(name="vfModuleId") @XmlElement(required=true) String vfModuleId, + @WebParam(name="requestType") @XmlElement(required=false) String requestType, @WebParam(name="volumeGroupHeatStackId") @XmlElement(required=false) String volumeGroupHeatStackId, @WebParam(name="baseVfHeatStackId") @XmlElement(required=false) String baseVfHeatStackId, @WebParam(name = "modelCustomizationUuid") @XmlElement(required = false) String modelCustomizationUuid, diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java index 0d7a739d36..19a41ad7a8 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java @@ -8,9 +8,9 @@ * 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. @@ -89,10 +89,10 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { @Autowired private CloudConfig cloudConfig; - + @Autowired private Environment environment; - + private static final String MSO_CONFIGURATION_ERROR = "MsoConfigurationError"; private static final String VNF_ADAPTER_SERVICE_NAME = "MSO-BPMN:MSO-VnfAdapter."; private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,MsoVnfAdapterImpl.class); @@ -103,21 +103,21 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { private static final String VALET_ENABLED = "org.onap.so.adapters.vnf.valet_enabled"; private static final String FAIL_REQUESTS_ON_VALET_FAILURE = "org.onap.so.adapters.vnf.fail_requests_on_valet_failure"; private static final String SUCCESS_MSG = "Successfully received response from Open Stack"; - + @Autowired private VFModuleCustomizationRepository vfModuleCustomRepo; - - + + @Autowired private VnfResourceRepository vnfResourceRepo; - + @Autowired private MsoHeatUtilsWithUpdate heatU; @Autowired private MsoHeatUtils heat; @Autowired private ValetClient vci; - + /** * DO NOT use that constructor to instantiate this class, the msoPropertiesfactory will be NULL. * @see MsoVnfAdapterImpl#MsoVnfAdapterImpl(MsoPropertiesFactory, CloudConfigFactory) @@ -126,7 +126,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // Do nothing //DO NOT use that constructor to instantiate this class, the msoPropertiesfactory will be NULL. } - + /** * Health Check web method. Does nothing but return to show the adapter is deployed. */ @@ -188,6 +188,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { Holder <String> vnfId, Holder <Map <String, String>> outputs, Holder <VnfRollback> rollback) throws VnfException { + // parameters used for multicloud adapter + String genericVnfId = ""; + String vfModuleId = ""; // Create a hook here to catch shortcut createVf requests: if (requestType != null && requestType.startsWith("VFMOD")) { LOGGER.debug("Calling createVfModule from createVnf -- requestType=" + requestType); @@ -207,7 +210,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { tenantId, vnfType, vnfVersion, + genericVnfId, vnfName, + vfModuleId, newRequestType, vfVolGroupHeatStackId, vfBaseHeatStackId, @@ -229,22 +234,24 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (requestType != null) { newRequestTypeSb.append(requestType); } - this.createVfModule(cloudSiteId, + this.createVfModule(cloudSiteId, tenantId, - vnfType, - vnfVersion, + vnfType, + vnfVersion, + genericVnfId, vnfName, - newRequestTypeSb.toString(), - vfVolGroupHeatStackId, - vfBaseHeatStackId, + vfModuleId, + newRequestTypeSb.toString(), + vfVolGroupHeatStackId, + vfBaseHeatStackId, null, - inputs, - failIfExists, + inputs, + failIfExists, backout, enableBridge, - msoRequest, - vnfId, - outputs, + msoRequest, + vnfId, + outputs, rollback); return; // End createVf shortcut @@ -497,7 +504,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { LOGGER.debug(" HeatBridgeMain.py failed for unknown reasons! " + e); return false; } - } + } private String convertNode(final JsonNode node) { try { @@ -565,7 +572,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String tenantId, String vnfType, String vnfVersion, + String genericVnfName, String vnfName, + String vfModuleId, String requestType, String volumeGroupHeatStackId, String baseVfHeatStackId, @@ -730,8 +739,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { LOGGER.debug(error); throw new VnfException (error, MsoExceptionCategory.USERDATA); } else { - LOGGER.debug("Found nested volume heat stack - copying values to inputs *later*"); - nestedVolumeOutputs = nestedHeatStack.getOutputs(); + LOGGER.debug("Found nested volume heat stack - copying values to inputs *later*"); + nestedVolumeOutputs = nestedHeatStack.getOutputs(); } } @@ -762,14 +771,14 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { LOGGER.debug(error); throw new VnfException (error, MsoExceptionCategory.USERDATA); } else { - LOGGER.debug("Found nested base heat stack - these values will be copied to inputs *later*"); - baseStackOutputs = nestedBaseHeatStack.getOutputs(); + LOGGER.debug("Found nested base heat stack - these values will be copied to inputs *later*"); + baseStackOutputs = nestedBaseHeatStack.getOutputs(); } } // Ready to deploy the new VNF - + try { // Retrieve the VF @@ -784,7 +793,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { vf=vfmc.getVfModule(); else vf=null; - + // 1702 - this will be the new way going forward. We find the vf by mcu - otherwise, code is the same. if (vf == null) { LOGGER.debug("Unable to find vfModuleCust with modelCustomizationUuid=" + mcu); @@ -806,12 +815,12 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } } } - + else { // This is to support gamma only - get info from vnf_resource table if (vfVersion != null && !vfVersion.isEmpty()) { vnfResource = vnfResourceRepo.findByModelNameAndModelVersion(vnfType, vnfVersion); } else { - vnfResource = vnfResourceRepo.findByModelName(vnfType); + vnfResource = vnfResourceRepo.findByModelName(vnfType); } if (vnfResource == null) { String error = "Create VNF: Unknown VNF Type: " + vnfType; @@ -828,7 +837,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { //1607 - Add version check // First - see if it's in the VnfResource record // if we have a vf Module - then we have to query to get the VnfResource record. - if (!oldWay && vf.getVnfResources() != null) { + if (!oldWay && vf.getVnfResources() != null) { vnfResource = vf.getVnfResources(); if (vnfResource == null) { LOGGER.debug("Unable to find vnfResource will not error for now..."); @@ -874,7 +883,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } catch (Exception e) { LOGGER.debug("An exception occured while trying to test AIC Version " + e.getMessage() + " - will default to not check",e); doNotTest = true; - } + } if (!doNotTest) { if ((moreThanMin || equalToMin) // aic >= min && (equalToMax || !(moreThanMax))) { //aic <= max @@ -898,9 +907,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } // End Version check 1607 - - - + + + // By the time we get here - heatTemplateId and heatEnvtId should be populated (or null) HeatTemplate heatTemplate = null; HeatEnvironment heatEnvironment = null; @@ -919,7 +928,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } } } - + if (heatTemplate == null) { String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", reqType=" + requestTypeString; LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Template ID", vfModuleType, "OpenStack", "", MsoLogger.ErrorCode.DataError, error); @@ -930,18 +939,18 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } else { LOGGER.debug ("Got HEAT Template from DB: " + heatTemplate.getHeatTemplate()); } - + if (oldWay) { //This will handle old Gamma BrocadeVCE VNF LOGGER.debug ("No environment parameter found for this Type " + vfModuleType); - } else { + } else { if (heatEnvironment == null) { 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()); @@ -950,8 +959,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { LOGGER.debug ("In MsoVnfAdapterImpl, about to call db.getNestedTemplates avec templateId=" + heatTemplate.getArtifactUuid ()); - - + + List<HeatTemplate> nestedTemplates = heatTemplate.getChildTemplates(); Map <String, Object> nestedTemplatesChecked = new HashMap <> (); if (nestedTemplates != null && !nestedTemplates.isEmpty()) { @@ -965,11 +974,11 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { LOGGER.debug ("No nested templates found - nothing to do here"); nestedTemplatesChecked = null; } - + // 1510 - Also add the files: for any get_files associated with this vnf_resource_id // *if* there are any List<HeatFiles> heatFiles = null; - + Map<String, Object> heatFilesObjects = new HashMap<>(); // Add ability to turn on adding get_files with volume requests (by property). @@ -986,7 +995,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (!isVolumeRequest || addGetFilesOnVolumeReq) { if (oldWay) { - LOGGER.debug("In MsoVnfAdapterImpl createVfModule, this should not happen - old way is gamma only - no heat files!"); + LOGGER.debug("In MsoVnfAdapterImpl createVfModule, this should not happen - old way is gamma only - no heat files!"); } else { // 1607 - now use VF_MODULE_TO_HEAT_FILES table LOGGER.debug("In MsoVnfAdapterImpl createVfModule, about to call db.getHeatFilesForVfModule avec vfModuleId=" @@ -999,7 +1008,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // Map<String, HeatFiles> // this will match the nested templates format LOGGER.debug("Contents of heatFiles - to be added to files: on stack"); - + for(HeatFiles heatfile : heatFiles){ LOGGER.debug(heatfile.getFileName() + " -> " + heatfile.getFileBody()); @@ -1038,10 +1047,10 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // Note this also removes any comments MsoHeatEnvironmentEntry mhee = null; if (heatEnvironment != null && heatEnvironment.getEnvironment() != null && heatEnvironment.getEnvironment().contains ("parameters:")) { - + LOGGER.debug("Enhanced environment checking enabled - 1604"); StringBuilder sb = new StringBuilder(heatEnvironment.getEnvironment()); - + mhee = new MsoHeatEnvironmentEntry(sb); StringBuilder sb2 = new StringBuilder("\nHeat Template Parameters:\n"); for (HeatTemplateParam parm : heatTemplate.getParameters()) { @@ -1059,13 +1068,13 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } // New with 1707 - all variables converted to their native object types Map<String, Object> goldenInputs = null; - + LOGGER.debug("Now handle the inputs....first convert"); ArrayList<String> parameterNames = new ArrayList<>(); HashMap<String, String> aliasToParam = new HashMap<>(); StringBuilder sb = new StringBuilder("\nTemplate Parameters:\n"); int cntr = 0; - try { + try { for (HeatTemplateParam htp : heatTemplate.getParameters()) { sb.append("param[" + cntr++ + "]=" + htp.getParamName()); parameterNames.add(htp.getParamName()); @@ -1079,7 +1088,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } catch (Exception e) { LOGGER.debug("??An exception occurred trying to go through Parameter Names " + e.getMessage(),e); } - // Step 1 - convert what we got as inputs (Map<String, String>) to a + // Step 1 - convert what we got as inputs (Map<String, String>) to a // Map<String, Object> - where the object matches the param type identified in the template // This will also not copy over params that aren't identified in the template goldenInputs = heat.convertInputMap(inputs, heatTemplate); @@ -1088,8 +1097,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { heat.copyBaseOutputsToInputs(goldenInputs, baseStackOutputs, parameterNames, aliasToParam); // Step 3 - add the volume inputs if any LOGGER.debug("Now add in the volume stack outputs if applicable"); - heat.copyBaseOutputsToInputs(goldenInputs, nestedVolumeOutputs, parameterNames, aliasToParam); - + heat.copyBaseOutputsToInputs(goldenInputs, nestedVolumeOutputs, parameterNames, aliasToParam); + for (HeatTemplateParam parm : heatTemplate.getParameters ()) { LOGGER.debug ("Parameter:'" + parm.getParamName () + "', isRequired=" @@ -1127,17 +1136,17 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } else { LOGGER.debug ("No missing parameters found - ok to proceed"); } - // We can now remove the recreating of the ENV with only legit params - that check is done for us, + // We can now remove the recreating of the ENV with only legit params - that check is done for us, // and it causes problems with json that has arrays String newEnvironmentString = null; if (mhee != null) { newEnvironmentString = mhee.getRawEntry().toString(); } - + // "Fix" the template if it has CR/LF (getting this from Oracle) String template = heatTemplate.getHeatTemplate (); template = template.replaceAll ("\r\n", "\n"); - + // Valet - 1806 boolean isValetEnabled = this.checkBooleanProperty(MsoVnfAdapterImpl.VALET_ENABLED, false); boolean failRequestOnValetFailure = this.checkBooleanProperty(MsoVnfAdapterImpl.FAIL_REQUESTS_ON_VALET_FAILURE, false); @@ -1169,7 +1178,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } if (heat != null) { LOGGER.debug("heat is not null!!"); - + heatStack = heat.createStack (cloudSiteId, tenantId, vfModuleName, @@ -1242,7 +1251,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } catch (Exception e) { LOGGER.debug("unhandled exception in create VF",e); throw new VnfException("Exception during create VF " + e.getMessage()); - } + } } @Override @@ -1274,7 +1283,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } // call method which handles the conversion from Map<String,Object> to Map<String,String> for our expected Object types outputs.value = this.convertMapStringObjectToStringString(stackOutputs); - + boolean isValetEnabled = this.checkBooleanProperty(MsoVnfAdapterImpl.VALET_ENABLED, false); boolean failRequestOnValetFailure = this.checkBooleanProperty(MsoVnfAdapterImpl.FAIL_REQUESTS_ON_VALET_FAILURE, false); LOGGER.debug("isValetEnabled=" + isValetEnabled + ", failRequestsOnValetFailure=" + failRequestOnValetFailure); @@ -1349,7 +1358,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { MsoLogger.setLogContext (msoRequest.getRequestId (), msoRequest.getServiceInstanceId ()); String serviceName = VNF_ADAPTER_SERVICE_NAME + methodName; MsoLogger.setServiceName (serviceName); - + StringBuilder sbInit = new StringBuilder(); sbInit.append("updateVfModule: \n"); sbInit.append("cloudSiteId=" + cloudSiteId + "\n"); @@ -1381,7 +1390,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (requestType != null && !"".equals(requestType)) { requestTypeString = requestType; } - + String nestedStackId = null; if (volumeGroupHeatStackId != null && !"".equals(volumeGroupHeatStackId) && !"null".equalsIgnoreCase(volumeGroupHeatStackId)) { nestedStackId = volumeGroupHeatStackId; @@ -1395,8 +1404,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // Create an empty set of inputs inputs = new HashMap<>(); LOGGER.debug("inputs == null - setting to empty"); - } - + } + boolean isBaseRequest = false; boolean isVolumeRequest = false; if (requestTypeString.startsWith("VOLUME")) { @@ -1423,7 +1432,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { vfRollback.setIsBase(isBaseRequest); vfRollback.setVfModuleStackId(vfModuleStackId); vfRollback.setModelCustomizationUuid(mcu); - + StackInfo heatStack = null; long queryStackStarttime = System.currentTimeMillis (); LOGGER.debug("UpdateVfModule - querying for " + vfModuleName); @@ -1484,8 +1493,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { throw new VnfException (error, MsoExceptionCategory.USERDATA); } else { LOGGER.debug("Found nested heat stack - copying values to inputs *later*"); - nestedVolumeOutputs = nestedHeatStack.getOutputs(); - heat.copyStringOutputsToInputs(inputs, nestedHeatStack.getOutputs(), false); + nestedVolumeOutputs = nestedHeatStack.getOutputs(); + heat.copyStringOutputsToInputs(inputs, nestedHeatStack.getOutputs(), false); } } // handle a nestedBaseStackId if sent - this is the stack ID of the base. @@ -1524,8 +1533,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // Ready to deploy the new VNF - - + + // Retrieve the VF definition VnfResource vnfResource = null; VfModule vf = null; @@ -1555,19 +1564,19 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { LOGGER.debug("DANGER WILL ROBINSON! This is unexpected - no nestedBaseStackId with this non-base request"); } } - + //1607 - Add version check // First - see if it's in the VnfResource record // if we have a vf Module - then we have to query to get the VnfResource record. - if (vf.getModelUUID() != null) { + if (vf.getModelUUID() != null) { String vnfResourceModelUuid = vf.getModelUUID(); - + vnfResource = vf.getVnfResources(); if (vnfResource == null) { LOGGER.debug("Unable to find vnfResource at " + vnfResourceModelUuid + " will not error for now..."); } } - + String minVersionVnf = null; String maxVersionVnf = null; if (vnfResource != null) { @@ -1588,7 +1597,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } if (minVersionVnf != null && maxVersionVnf != null) { MavenLikeVersioning aicV = new MavenLikeVersioning(); - + // double check if (this.cloudConfig != null) { Optional<CloudSite> cloudSiteOpt = this.cloudConfig.getCloudSite(cloudSiteId); @@ -1647,7 +1656,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { heatTemplate = vf.getModuleHeatTemplate(); heatEnvironment = vfmc.getHeatEnvironment(); } - + if (heatTemplate == null) { String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", reqType=" + requestTypeString; LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Template ID", vfModuleType, "OpenStack", "", MsoLogger.ErrorCode.DataError, error); @@ -1658,7 +1667,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } else { LOGGER.debug ("Got HEAT Template from DB: " + heatTemplate.getHeatTemplate()); } - + if (heatEnvironment == null) { String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType; LOGGER.error (MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Environment ID", "OpenStack", "", MsoLogger.ErrorCode.DataError, error); @@ -1670,18 +1679,18 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } else { LOGGER.debug ("Got Heat Environment from DB: " + heatEnvironment.getEnvironment()); } - + LOGGER.debug ("In MsoVnfAdapterImpl, about to call db.getNestedTemplates avec templateId=" + heatTemplate.getArtifactUuid ()); - - + + List<HeatTemplate> nestedTemplates = heatTemplate.getChildTemplates(); Map <String, Object> nestedTemplatesChecked = new HashMap <> (); if (nestedTemplates != null && !nestedTemplates.isEmpty()) { // for debugging print them out LOGGER.debug ("Contents of nestedTemplates - to be added to files: on stack:"); for (HeatTemplate entry : nestedTemplates) { - + nestedTemplatesChecked.put (entry.getTemplateName(), entry.getTemplateBody()); LOGGER.debug (entry.getTemplateName() + " -> " + entry.getTemplateBody()); } @@ -1875,8 +1884,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } paramList.add (parm.getParamName ()); } - - + + if (missingParams != null) { // Problem - missing one or more required parameters if (checkRequiredParameters) { @@ -1927,7 +1936,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // "Fix" the template if it has CR/LF (getting this from Oracle) String template = heatTemplate.getHeatTemplate (); template = template.replaceAll ("\r\n", "\n"); - + boolean isValetEnabled = this.checkBooleanProperty(MsoVnfAdapterImpl.VALET_ENABLED, false); boolean failRequestOnValetFailure = this.checkBooleanProperty(MsoVnfAdapterImpl.FAIL_REQUESTS_ON_VALET_FAILURE, false); LOGGER.debug("isValetEnabled=" + isValetEnabled + ", failRequestsOnValetFailure=" + failRequestOnValetFailure); @@ -1949,7 +1958,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (sendResponseToValet) { goldenInputs = valetModifiedParamsHolder.value; } - } + } // Have the tenant. Now deploy the stack itself // Ignore MsoTenantNotFound and MsoStackAlreadyExists exceptions @@ -1957,16 +1966,16 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { long updateStackStarttime = System.currentTimeMillis (); try { heatStack = heatU.updateStack( - cloudSiteId, - tenantId, - vfModuleName, + cloudSiteId, + tenantId, + vfModuleName, template, - goldenInputs, + goldenInputs, true, - heatTemplate.getTimeoutMinutes(), + heatTemplate.getTimeoutMinutes(), newEnvironmentString, //heatEnvironmentString, - nestedTemplatesChecked, + nestedTemplatesChecked, heatFilesObjects ); LOGGER.recordMetricEvent (updateStackStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully receive response from Open Stack", "OpenStack", "UpdateStack", null); @@ -1988,7 +1997,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } throw new VnfException (me); } - + // Reach this point if updateStack is successful. // Populate remaining rollback info and response parameters. @@ -2048,7 +2057,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } return property; } - + /* * Helper method to combine getFiles and nestedTemplates in to a single Map */ @@ -2080,12 +2089,12 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } return files; } - + /* * Valet Create request */ - private boolean valetCreateRequest(String cloudSiteId, String tenantId, Map<String, Object> heatFilesObjects, Map<String, Object> nestedTemplatesChecked, - String vfModuleName, boolean backout, HeatTemplate heatTemplate, String newEnvironmentString, Map<String, Object> goldenInputs, + private boolean valetCreateRequest(String cloudSiteId, String tenantId, Map<String, Object> heatFilesObjects, Map<String, Object> nestedTemplatesChecked, + String vfModuleName, boolean backout, HeatTemplate heatTemplate, String newEnvironmentString, Map<String, Object> goldenInputs, MsoRequest msoRequest, Map<String, String> inputs, boolean failRequestOnValetFailure, Holder<Map<String, Object>> valetModifiedParamsHolder) throws VnfException { boolean valetSucceeded = false; String valetErrorMessage = "more detail not available"; @@ -2133,16 +2142,16 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } if (failRequestOnValetFailure && !valetSucceeded) { // The valet request failed - and property says to fail the request - //TODO Create a new exception class for valet? + //TODO Create a new exception class for valet? throw new VnfException("A failure occurred with Valet: " + valetErrorMessage); } return valetSucceeded; } - + /* * Valet update request */ - + private boolean valetUpdateRequest(String cloudSiteId, String tenantId, Map<String, Object> heatFilesObjects, Map<String, Object> nestedTemplatesChecked, String vfModuleName, boolean backout, HeatTemplate heatTemplate, String newEnvironmentString, @@ -2201,7 +2210,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } return valetSucceeded; } - + /* * Valet delete request */ diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java index 459ff2aeba..41da3c2988 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java @@ -86,21 +86,21 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { private static final String ADD_GET_FILES_ON_VOLUME_REQ = "org.onap.so.adapters.vnf.addGetFilesOnVolumeReq"; private static final String CLOUDIFY_RESPONSE_SUCCESS="Successfully received response from Cloudify"; private static final String CLOUDIFY="Cloudify"; - + private static final ObjectMapper JSON_MAPPER = new ObjectMapper(); - + @Autowired protected CloudConfig cloudConfig; - + @Autowired private VFModuleCustomizationRepository vfModuleCustomRepo; - + @Autowired private Environment environment; @Autowired protected MsoKeystoneUtils keystoneUtils; - + @Autowired protected MsoCloudifyUtils cloudifyUtils; /** @@ -173,9 +173,9 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { /** * This is the "Query VNF" web service implementation. - * + * * This really should be QueryVfModule, but nobody ever changed it. - * + * * For Cloudify, this will look up a deployment by its deployment ID, which is really the same * as deployment name, since it assigned by the client when a deployment is created. * Also, the input cloudSiteId is used only to identify which Cloudify instance to query, @@ -212,7 +212,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { long subStartTime = System.currentTimeMillis (); DeploymentInfo deployment = null; - + try { deployment = cloudifyUtils.queryDeployment(cloudSiteId, tenantId, vnfName); LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, CLOUDIFY_RESPONSE_SUCCESS, CLOUDIFY, "QueryDeployment", vnfName); @@ -232,7 +232,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); throw new VnfException (me); } - + if (deployment != null && deployment.getStatus() != DeploymentStatus.NOTFOUND) { vnfExists.value = Boolean.TRUE; status.value = deploymentStatusToVnfStatus(deployment); @@ -253,7 +253,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { return; } - + /** * This is the "Delete VNF" web service implementation. * This function is now unsupported and will return an error. @@ -266,7 +266,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { MsoRequest msoRequest) throws VnfException { MsoLogger.setLogContext (msoRequest); MsoLogger.setServiceName ("DeleteVnf"); - + // This operation is no longer supported at the VNF level. The adapter is only called to deploy modules. LOGGER.debug ("DeleteVNF command attempted but not supported"); throw new VnfException ("DeleteVNF: Unsupported command", MsoExceptionCategory.USERDATA); @@ -277,7 +277,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { * A rollback object is returned to the client in a successful creation * response. The client can pass that object as-is back to the rollbackVnf * operation to undo the creation. - * + * * TODO: This should be rollbackVfModule and/or rollbackVolumeGroup, * but APIs were apparently never updated. */ @@ -297,7 +297,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Rollback VF Module - nothing to roll back"); return; } - + // Get the elements of the VnfRollback object for easier access String cloudSiteId = rollback.getCloudSiteId (); String tenantId = rollback.getTenantId (); @@ -319,7 +319,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { // Go directly to Keystone until APIs could be updated to supply the name. MsoTenant msoTenant = keystoneUtils.queryTenant(tenantId, cloudSiteId); String tenantName = (msoTenant != null? msoTenant.getTenantName() : tenantId); - + // TODO: Get a reasonable timeout. Use a global property, or store the creation timeout in rollback object and use that. deployment = cloudifyUtils.uninstallAndDeleteDeployment(cloudSiteId, tenantName, vfModuleId, 5); LOGGER.debug("Rolled back deployment: " + deployment.getId()); @@ -344,7 +344,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { // DeploymentInfo object should be enhanced to report a better status internally. DeploymentStatus status = deployment.getStatus(); String lastAction = deployment.getLastAction(); - + if (status == null || lastAction == null) { return VnfStatus.UNKNOWN; } @@ -365,7 +365,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { return VnfStatus.UNKNOWN; } - + private Map <String, String> copyStringOutputs (Map <String, Object> stackOutputs) { Map <String, String> stringOutputs = new HashMap <String, String> (); for (String key : stackOutputs.keySet ()) { @@ -425,9 +425,9 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { } } LOGGER.debug(sb.toString()); - return; + return; } - + private void sendMapToDebug(Map<String, String> inputs) { int i = 0; StringBuilder sb = new StringBuilder("inputs:"); @@ -537,7 +537,9 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { * 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 genericVnfId Generic VNF ID * @param vfModuleName Name to be assigned to the new VF Module + * @param vfModuleId Id of 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 @@ -558,7 +560,9 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { String tenantId, String vfModuleType, String vnfVersion, + String genericVnfId, String vfModuleName, + String vfModuleId, String requestType, String volumeGroupId, String baseVfModuleId, @@ -575,7 +579,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { { // Will capture execution time for metrics long startTime = System.currentTimeMillis (); - + MsoLogger.setLogContext (msoRequest); MsoLogger.setServiceName ("CreateVfModule"); @@ -588,14 +592,14 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } - + // Clean up some inputs to make comparisons easier if (requestType == null) requestType = ""; - + if ("".equals(volumeGroupId) || "null".equals(volumeGroupId)) - volumeGroupId = null; - + volumeGroupId = null; + if ("".equals(baseVfModuleId) || "null".equals(baseVfModuleId)) baseVfModuleId = null; @@ -606,7 +610,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { } else { this.sendMapToDebug(inputs); } - + // Check if this is for a "Volume" module boolean isVolumeRequest = false; if (requestType.startsWith("VOLUME")) { @@ -626,7 +630,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { vfRollback.setBaseGroupHeatStackId(baseVfModuleId); vfRollback.setModelCustomizationUuid(modelCustomizationUuid); vfRollback.setMode("CFY"); - + rollback.value = vfRollback; // Default rollback - no updates performed // Get the VNF/VF Module definition from the Catalog DB first. @@ -638,7 +642,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { try { vfmc = vfModuleCustomRepo.findByModelCustomizationUUID(modelCustomizationUuid); - + if (vfmc == null) { String error = "Create vfModule error: Unable to find vfModuleCust with modelCustomizationUuid=" + modelCustomizationUuid; LOGGER.debug(error); @@ -655,7 +659,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { vnfResource = vfmc.getVfModule().getVnfResources(); } catch (Exception e) { - + LOGGER.debug("unhandled exception in create VF - [Query]" + e.getMessage()); throw new VnfException("Exception during create VF " + e.getMessage()); } @@ -669,10 +673,10 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { CloudSite cloudSite = cloudSiteOp.get(); MavenLikeVersioning aicV = new MavenLikeVersioning(); aicV.setVersion(cloudSite.getCloudVersion()); - + String vnfMin = vnfResource.getAicVersionMin(); String vnfMax = vnfResource.getAicVersionMax(); - + if ( (vnfMin != null && !(aicV.isMoreRecentThan(vnfMin) || aicV.isTheSameVersion(vnfMin))) || (vnfMax != null && aicV.isMoreRecentThan(vnfMax))) { @@ -683,10 +687,10 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { throw new VnfException(error, MsoExceptionCategory.USERDATA); } // End Version check - - + + DeploymentInfo cloudifyDeployment = null; - + // First, look up to see if the VF already exists. long subStartTime1 = System.currentTimeMillis (); @@ -705,13 +709,13 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { me.addContext ("CreateVFModule"); throw new VnfException (me); } - + // More precise handling/messaging if the Module already exists if (cloudifyDeployment != null && !(cloudifyDeployment.getStatus () == DeploymentStatus.NOTFOUND)) { // CREATED, INSTALLED, INSTALLING, FAILED, UNINSTALLING, UNKNOWN DeploymentStatus status = cloudifyDeployment.getStatus(); LOGGER.debug ("Found Existing Deployment, status=" + status); - + if (status == DeploymentStatus.INSTALLED) { // fail - it exists if (failIfExists != null && failIfExists) { @@ -759,8 +763,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, cloudifyDeployment.getId()); } } - - + + // Collect outputs from Base Modules and Volume Modules Map<String, Object> baseModuleOutputs = null; Map<String, Object> volumeGroupOutputs = null; @@ -784,7 +788,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { me.addContext ("CreateVFModule(QueryVolume)"); throw new VnfException (me); } - + if (volumeDeployment == null || volumeDeployment.getStatus() == DeploymentStatus.NOTFOUND) { String error = "Create VFModule: Attached Volume Group DOES NOT EXIST " + volumeGroupId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR" ; LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, volumeGroupId, cloudSiteId, tenantId, error, CLOUDIFY, "queryDeployment(volume)", MsoLogger.ErrorCode.BusinessProcesssError, "Create VFModule: Attached Volume Group DOES NOT EXIST"); @@ -797,7 +801,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { this.sendMapToDebug(volumeGroupOutputs, "volumeGroupOutputs"); } } - + // If this is an Add-On Module, query the Base Module outputs // Note: This will be performed whether or not the current request is for an // Add-On Volume Group or Add-On VF Module @@ -807,7 +811,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { vfRollback.setIsBase(true); } else { LOGGER.debug("This is an Add-On Module request"); - + // Add-On Modules should always have a Base, but just treat as a warning if not provided. // Add-on Volume requests may or may not specify a base. if (!isVolumeRequest && baseVfModuleId == null) { @@ -827,12 +831,12 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, baseVfModuleId, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment(Base)", MsoLogger.ErrorCode.DataError, "Exception - queryDeployment(Base)", me); LOGGER.recordMetricEvent (subStartTime2, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, CLOUDIFY, "QueryDeployment(Base)", baseVfModuleId); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); - + // Convert to a generic VnfException me.addContext ("CreateVFModule(QueryBase)"); throw new VnfException (me); } - + if (baseDeployment == null || baseDeployment.getStatus() == DeploymentStatus.NOTFOUND) { String error = "Create VFModule: Base Module DOES NOT EXIST " + baseVfModuleId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR" ; LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, baseVfModuleId, cloudSiteId, tenantId, error, CLOUDIFY, "queryDeployment(Base)", MsoLogger.ErrorCode.BusinessProcesssError, "Create VFModule: Base Module DOES NOT EXIST"); @@ -846,15 +850,15 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { } } } - + // Ready to deploy the new VNF - + // NOTE: For this section, heatTemplate is used for both HEAT templates and Cloudify blueprints. // In final implementation (post-POC), the template object would either be generic or there would // be a separate DB Table/Object for Blueprints. - + // NOTE: The template is fixed for the VF Module. The environment is part of the customization. HeatTemplate heatTemplate = null; HeatEnvironment heatEnvironment = null; @@ -865,7 +869,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { heatTemplate = vf.getModuleHeatTemplate(); heatEnvironment = vfmc.getHeatEnvironment(); } - + 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, "OpenStack", "", MsoLogger.ErrorCode.DataError, error); @@ -876,7 +880,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { } else { LOGGER.debug ("Got HEAT Template from DB: " + heatTemplate.getHeatTemplate()); } - + if (heatEnvironment == null) { String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType; LOGGER.error (MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Environment ID", "OpenStack", "", MsoLogger.ErrorCode.DataError, error); @@ -889,7 +893,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { LOGGER.debug ("Got Heat Environment from DB: " + heatEnvironment.getEnvironment()); } - + try { // All variables converted to their native object types HashMap<String, Object> goldenInputs = new HashMap<String,Object>(); @@ -898,7 +902,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { // NOTE: SKIP THIS FOR CLOUDIFY for now. Just use what was passed in. // This whole section needs to be rewritten. Boolean skipInputChecks = false; - + if (skipInputChecks) { goldenInputs = new HashMap<String,Object>(); for (String key : inputs.keySet()) { @@ -908,10 +912,10 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { else { // Build maps for the parameters (including aliases) to simplify checks HashMap<String, HeatTemplateParam> params = new HashMap<String, HeatTemplateParam>(); - + Set<HeatTemplateParam> paramSet = heatTemplate.getParameters(); LOGGER.debug("paramSet has " + paramSet.size() + " entries"); - + for (HeatTemplateParam htp : paramSet) { params.put(htp.getParamName(), htp); @@ -921,7 +925,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { params.put(alias, htp); } } - + // First, convert all inputs to their "template" type for (String key : inputs.keySet()) { if (params.containsKey(key)) { @@ -936,11 +940,11 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { extraInputs.add(key); } } - + if (!extraInputs.isEmpty()) { LOGGER.debug("Ignoring extra inputs: " + extraInputs); } - + // Next add in Volume Group Outputs if there are any. Copy directly without conversions. if (volumeGroupOutputs != null && !volumeGroupOutputs.isEmpty()) { for (String key : volumeGroupOutputs.keySet()) { @@ -949,7 +953,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { } } } - + // Next add in Base Module Outputs if there are any. Copy directly without conversions. if (baseModuleOutputs != null && !baseModuleOutputs.isEmpty()) { for (String key : baseModuleOutputs.keySet()) { @@ -958,15 +962,15 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { } } } - + // Last, add in values from the "environment" file. // These are added to the inputs, since Cloudify doesn't pass an environment file like Heat. - + // TODO: This may take a different form for Cloudify, but for now process it // with Heat environment file syntax StringBuilder sb = new StringBuilder(heatEnvironment.getEnvironment()); MsoHeatEnvironmentEntry mhee = new MsoHeatEnvironmentEntry (sb); - + if (mhee.getParameters() != null) { for (MsoHeatEnvironmentParameter envParam : mhee.getParameters()) { // If this is a template input, copy to golden inputs @@ -985,7 +989,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { this.sendMapToDebug(goldenInputs, "Final inputs sent to Cloudify"); - + // Check that required parameters have been supplied from any of the sources String missingParams = null; boolean checkRequiredParameters = true; @@ -1000,8 +1004,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { // No problem - default is true LOGGER.debug ("An exception occured trying to get property " + MsoVnfCloudifyAdapterImpl.CHECK_REQD_PARAMS, e); } - - + + for (HeatTemplateParam parm : heatTemplate.getParameters ()) { if (parm.isRequired () && (!goldenInputs.containsKey (parm.getParamName ()))) { LOGGER.debug ("adding to missing parameters list: " + parm.getParamName ()); @@ -1012,7 +1016,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { } } } - + if (missingParams != null) { if (checkRequiredParameters) { // Problem - missing one or more required parameters @@ -1026,7 +1030,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { } else { LOGGER.debug ("No missing parameters found - ok to proceed"); } - + } // NOTE: END PARAMETER CHECKING // Ready to deploy the VF Module. @@ -1034,7 +1038,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { String blueprintName = heatTemplate.getTemplateName(); String blueprint = heatTemplate.getTemplateBody(); String blueprintId = blueprintName; - + // Use the main blueprint name as the blueprint ID (strip yaml extensions). if (blueprintId.endsWith(".yaml")) blueprintId = blueprintId.substring(0,blueprintId.lastIndexOf(".yaml")); @@ -1046,7 +1050,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { Map<String,byte[]> blueprintFiles = new HashMap<String,byte[]>(); blueprintFiles.put(blueprintName, blueprint.getBytes()); - + // TODO: Implement nested blueprint logic based on Cloudify structures. // For now, just use the Heat structures. // The query returns a map of String->Object, where the map keys provide one layer of @@ -1059,7 +1063,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { } } - // TODO: Implement file artifact logic based on Cloudify structures. + // TODO: Implement file artifact logic based on Cloudify structures. // For now, just use the Heat structures. List<HeatFiles> heatFiles = vf.getHeatFiles(); if (heatFiles != null) { @@ -1067,22 +1071,22 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { blueprintFiles.put(heatFile.getFileName(), heatFile.getFileBody().getBytes()); } } - + // Upload the blueprint package cloudifyUtils.uploadBlueprint(cloudSiteId, blueprintId, blueprintName, blueprintFiles, false); } } - + catch (MsoException me) { me.addContext ("CreateVFModule"); String error = "Create VF Module: Upload blueprint failed. Blueprint=" + blueprintName + ": " + me; LOGGER.error (MessageEnum.RA_CREATE_VNF_ERR, vfModuleType, cloudSiteId, tenantId, CLOUDIFY, "", MsoLogger.ErrorCode.DataError, "MsoException - uploadBlueprint", me); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); throw new VnfException (me); - + } - + // Ignore MsoTenantNotFound and MsoStackAlreadyExists exceptions // because we already checked for those. long createDeploymentStarttime = System.currentTimeMillis (); @@ -1091,11 +1095,11 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { // Go directly to Keystone until APIs could be updated to supply the name. MsoTenant msoTenant = keystoneUtils.queryTenant(tenantId, cloudSiteId); String tenantName = (msoTenant != null? msoTenant.getTenantName() : tenantId); - + if (backout == null) { backout = true; } - + cloudifyDeployment = cloudifyUtils.createAndInstallDeployment (cloudSiteId, tenantName, vfModuleName, @@ -1104,7 +1108,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { true, heatTemplate.getTimeoutMinutes (), backout.booleanValue()); - + LOGGER.recordMetricEvent (createDeploymentStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, CLOUDIFY_RESPONSE_SUCCESS, CLOUDIFY, "CreateDeployment", vfModuleName); } catch (MsoException me) { me.addContext ("CreateVFModule"); @@ -1126,7 +1130,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { LOGGER.debug("unhandled exception at cloudify.createAndInstallDeployment"); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while creating deployment with Cloudify"); throw new VnfException("Exception during cloudify.createAndInstallDeployment! " + e.getMessage()); - } + } } catch (Exception e) { LOGGER.debug("unhandled exception in create VF"); throw new VnfException("Exception during create VF " + e.getMessage()); @@ -1138,7 +1142,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { vfRollback.setVnfCreated (true); vfRollback.setVnfId (cloudifyDeployment.getId()); vnfId.value = cloudifyDeployment.getId(); - outputs.value = copyStringOutputs (cloudifyDeployment.getOutputs ()); + outputs.value = copyStringOutputs (cloudifyDeployment.getOutputs ()); rollback.value = vfRollback; @@ -1157,7 +1161,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { LOGGER.debug ("Deleting VF " + vnfName + " in " + cloudSiteId + "/" + tenantId); // Will capture execution time for metrics long startTime = System.currentTimeMillis (); - + // 1702 capture the output parameters on a delete // so we'll need to query first DeploymentInfo deployment = null; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java index 9a64e62e57..269acb9d6f 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java @@ -578,7 +578,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { * 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 @@ -599,7 +601,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { String tenantId, String vfModuleType, String vnfVersion, + String genericVnfId, String vfModuleName, + String vfModuleId, String requestType, String volumeGroupId, String baseVfModuleId, @@ -984,15 +988,21 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { if (!extraInputs.isEmpty()) { // 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; } } } + if (multicloudInputs) { + goldenInputs.put(MsoMulticloudUtils.GENERIC_VNF_ID, genericVnfId); + goldenInputs.put(MsoMulticloudUtils.VF_MODULE_ID, vfModuleId); + } LOGGER.debug("Ignoring extra inputs: " + extraInputs); } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java index a941c7f083..b4adc1ade9 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java @@ -10,9 +10,9 @@ * 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. @@ -85,7 +85,7 @@ public class VnfAdapterRest { private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, VnfAdapterRest.class); private static final String TESTING_KEYWORD = "___TESTING___"; private static final String RESP=", resp="; - + @Autowired private MsoVnfAdapterImpl vnfAdapter; //TODO Logging, SkipAAI, CREATED flags, Integrate with BPEL, Auth, @@ -93,7 +93,7 @@ public class VnfAdapterRest { @Autowired @Qualifier("VnfBpel") private Provider<BpelRestClient> bpelRestClientProvider; - + /* * URL:http://localhost:8080/vnfs/rest/v1/vnfs/<aaivnfid>/vf-modules/<aaimodid> @@ -117,13 +117,13 @@ public class VnfAdapterRest { @Path("{aaiVnfId}/vf-modules/{aaiVfModuleId}") @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @ApiOperation(value = "DeleteVfModule", + @ApiOperation(value = "DeleteVfModule", response = Response.class, notes = "Delete an existing vnfModule, DeleteVfModuleRequest JSON is required") @ApiResponses({ @ApiResponse(code = 200, message = "vnfModule has been successfully deleted"), @ApiResponse(code = 202, message = "delete vnfModule request has been accepted (async only)"), - @ApiResponse(code = 500, message = "delete vnfModule failed, examine entity object for details") }) + @ApiResponse(code = 500, message = "delete vnfModule failed, examine entity object for details") }) public Response deleteVfModule ( @ApiParam(value = "aaiVnfId", required = true) @PathParam("aaiVnfId") String aaiVnfId, @@ -238,12 +238,12 @@ public class VnfAdapterRest { @GET @Path("{aaiVnfId}/vf-modules/{aaiVfModuleId}") @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @ApiOperation(value = "QueryVfModule", + @ApiOperation(value = "QueryVfModule", response = Response.class, notes = "Query an existing vnfModule") @ApiResponses({ @ApiResponse(code = 200, message = "vnfModule has been successfully queried"), - @ApiResponse(code = 500, message = "query vnfModule failed, examine entity object for details") }) + @ApiResponse(code = 500, message = "query vnfModule failed, examine entity object for details") }) public Response queryVfModule( @ApiParam(value = "aaiVnfId", required = true) @PathParam("aaiVnfId") String aaiVnfId, @@ -329,13 +329,13 @@ public class VnfAdapterRest { @Path("{aaiVnfId}/vf-modules") @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @ApiOperation(value = "CreateVfModule", + @ApiOperation(value = "CreateVfModule", response = Response.class, notes = "Create a vnfModule") @ApiResponses({ @ApiResponse(code = 200, message = "vnfModule has been successfully created"), @ApiResponse(code = 202, message = "create vnfModule request has been successfully accepted (async only)"), - @ApiResponse(code = 500, message = "create vnfModule failed, examine entity object for details") }) + @ApiResponse(code = 500, message = "create vnfModule failed, examine entity object for details") }) public Response createVfModule( @ApiParam(value = "aaiVnfId", required = true) @PathParam("aaiVnfId") String aaiVnfId, @@ -442,7 +442,9 @@ public class VnfAdapterRest { //req.getVnfType(), completeVnfVfModuleType, req.getVnfVersion(), + req.getVnfId(), req.getVfModuleName(), + req.getVfModuleId(), req.getRequestType(), req.getVolumeGroupStackId(), req.getBaseVfModuleStackId(), @@ -481,7 +483,7 @@ public class VnfAdapterRest { @ApiResponses({ @ApiResponse(code = 200, message = "vnfModule has been successfully updated"), @ApiResponse(code = 202, message = "update vnfModule request has been successfully accepted (async only)"), - @ApiResponse(code = 500, message = "update vnfModule failed, examine entity object for details") }) + @ApiResponse(code = 500, message = "update vnfModule failed, examine entity object for details") }) public Response updateVfModule( @ApiParam(value = "aaiVnfId", required = true) @PathParam("aaiVnfId") String aaiVnfId, @@ -604,13 +606,13 @@ public class VnfAdapterRest { @Path("{aaiVnfId}/vf-modules/{aaiVfModuleId}/rollback") @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @ApiOperation(value = "RollbackVfModule", + @ApiOperation(value = "RollbackVfModule", response = Response.class, notes = "Rollback an existing vnfModule") @ApiResponses({ @ApiResponse(code = 200, message = "vnfModule has been successfully rolled back"), @ApiResponse(code = 202, message = "rollback vnfModule request has been successfully accepted (async only)"), - @ApiResponse(code = 500, message = "rollback vnfModule failed, examine entity object for details") }) + @ApiResponse(code = 500, message = "rollback vnfModule failed, examine entity object for details") }) public Response rollbackVfModule ( @ApiParam(value = "aaiVnfId", required = true) @PathParam("aaiVnfId") String aaiVnfId, diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java index 7f3bad5b8e..2c189fa8e8 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java @@ -9,9 +9,9 @@ * 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. @@ -74,7 +74,7 @@ import io.swagger.annotations.ApiResponses; * Both XML and JSON can be produced/consumed. Set Accept: and Content-Type: headers appropriately. XML is the default. * For testing, call with cloudSiteId = ___TESTING___ * To test exceptions, also set tenantId = ___TESTING___ - * + * * V2 incorporates run-time selection of sub-orchestrator implementation (Heat or Cloudify) * based on the target cloud. */ @@ -88,7 +88,7 @@ public class VnfAdapterRestV2 { @Autowired private VnfAdapterRestUtils vnfAdapterRestUtils; - + @Autowired @Qualifier("VnfBpel") private Provider<BpelRestClient> bpelRestClientProvider; @@ -115,13 +115,13 @@ public class VnfAdapterRestV2 { @Path("{aaiVnfId}/vf-modules/{aaiVfModuleId}") @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @ApiOperation(value = "DeleteVfModule", + @ApiOperation(value = "DeleteVfModule", response = Response.class, notes = "Delete an existing vnfModule, DeleteVfModuleRequest JSON is required") @ApiResponses({ @ApiResponse(code = 200, message = "vnfModule has been successfully deleted"), @ApiResponse(code = 202, message = "delete vnfModule request has been accepted (async only)"), - @ApiResponse(code = 500, message = "delete vnfModule failed, examine entity object for details") }) + @ApiResponse(code = 500, message = "delete vnfModule failed, examine entity object for details") }) public Response deleteVfModule ( @ApiParam(value = "aaiVnfId", required = true) @PathParam("aaiVnfId") String aaiVnfId, @@ -149,7 +149,7 @@ public class VnfAdapterRestV2 { .entity("vfModuleId in URL does not match content") .build(); } - + DeleteVfModuleTask task = new DeleteVfModuleTask(req, mode); if (req.isSynchronous()) { // This is a synchronous request @@ -243,12 +243,12 @@ public class VnfAdapterRestV2 { @GET @Path("{aaiVnfId}/vf-modules/{aaiVfModuleId}") @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @ApiOperation(value = "QueryVfModule", + @ApiOperation(value = "QueryVfModule", response = Response.class, notes = "Query an existing vnfModule") @ApiResponses({ @ApiResponse(code = 200, message = "vnfModule has been successfully queried"), - @ApiResponse(code = 500, message = "query vnfModule failed, examine entity object for details") }) + @ApiResponse(code = 500, message = "query vnfModule failed, examine entity object for details") }) public Response queryVfModule( @ApiParam(value = "aaiVnfId", required = true) @PathParam("aaiVnfId") String aaiVnfId, @@ -280,7 +280,7 @@ public class VnfAdapterRestV2 { Holder<String> vfModuleId = new Holder<String>(); Holder<VnfStatus> status = new Holder<VnfStatus>(); Holder<Map<String, String>> outputs = new Holder <Map <String, String>> (); - + // Support different Adapter Implementations MsoVnfAdapter adapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudSiteId); adapter.queryVnf (cloudSiteId, tenantId, vfModuleName, msoRequest, vnfExists, vfModuleId, status, outputs); @@ -340,13 +340,13 @@ public class VnfAdapterRestV2 { @Path("{aaiVnfId}/vf-modules") @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @ApiOperation(value = "CreateVfModule", + @ApiOperation(value = "CreateVfModule", response = Response.class, notes = "Create a vnfModule") @ApiResponses({ @ApiResponse(code = 200, message = "vnfModule has been successfully created"), @ApiResponse(code = 202, message = "create vnfModule request has been successfully accepted (async only)"), - @ApiResponse(code = 500, message = "create vnfModule failed, examine entity object for details") }) + @ApiResponse(code = 500, message = "create vnfModule failed, examine entity object for details") }) public Response createVfModule( @ApiParam(value = "aaiVnfId", required = true) @PathParam("aaiVnfId") String aaiVnfId, @@ -364,7 +364,7 @@ public class VnfAdapterRestV2 { .entity("vnfid in URL does not match content") .build(); } - + CreateVfModuleTask task = new CreateVfModuleTask(req, mode); if (req.isSynchronous()) { // This is a synchronous request @@ -427,7 +427,7 @@ public class VnfAdapterRestV2 { Holder <VnfRollback> vnfRollback = new Holder <VnfRollback> (); String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType(); LOGGER.debug("completeVnfVfModuleType=" + completeVnfVfModuleType); - + String cloudsiteId = req.getCloudSiteId(); if (cloudsiteId != null && cloudsiteId.equals(TESTING_KEYWORD)) { String tenant = req.getTenantId(); @@ -446,7 +446,9 @@ public class VnfAdapterRestV2 { req.getTenantId(), completeVnfVfModuleType, req.getVnfVersion(), + req.getVnfId(), req.getVfModuleName(), + req.getVfModuleId(), req.getRequestType(), req.getVolumeGroupStackId(), req.getBaseVfModuleStackId(), @@ -484,7 +486,7 @@ public class VnfAdapterRestV2 { @ApiResponses({ @ApiResponse(code = 200, message = "vnfModule has been successfully updated"), @ApiResponse(code = 202, message = "update vnfModule request has been successfully accepted (async only)"), - @ApiResponse(code = 500, message = "update vnfModule failed, examine entity object for details") }) + @ApiResponse(code = 500, message = "update vnfModule failed, examine entity object for details") }) public Response updateVfModule( @ApiParam(value = "aaiVnfId", required = true) @PathParam("aaiVnfId") String aaiVnfId, @@ -613,13 +615,13 @@ public class VnfAdapterRestV2 { @Path("{aaiVnfId}/vf-modules/{aaiVfModuleId}/rollback") @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @ApiOperation(value = "RollbackVfModule", + @ApiOperation(value = "RollbackVfModule", response = Response.class, notes = "Rollback an existing vnfModule") @ApiResponses({ @ApiResponse(code = 200, message = "vnfModule has been successfully rolled back"), @ApiResponse(code = 202, message = "rollback vnfModule request has been successfully accepted (async only)"), - @ApiResponse(code = 500, message = "rollback vnfModule failed, examine entity object for details") }) + @ApiResponse(code = 500, message = "rollback vnfModule failed, examine entity object for details") }) public Response rollbackVfModule ( @ApiParam(value = "aaiVnfId", required = true) @PathParam("aaiVnfId") String aaiVnfId, @@ -686,11 +688,11 @@ public class VnfAdapterRestV2 { VnfRollback vrb = new VnfRollback( vmr.getVfModuleStackId(), vmr.getTenantId(), vmr.getCloudSiteId(), true, vmr.isVfModuleCreated(), vmr.getMsoRequest(), null, null, null, null); - + // Support multiple adapter implementations MsoVnfAdapter adapter = vnfAdapterRestUtils.getVnfAdapterImpl (vmr.getMode(), vmr.getCloudSiteId()); adapter.rollbackVnf (vrb); - + response = new RollbackVfModuleResponse(Boolean.TRUE, req.getMessageId()); } catch (VnfException e) { LOGGER.error (MessageEnum.RA_ROLLBACK_VNF_ERR, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - rollbackVfModule", e); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java index e7bf3f79ce..cbdd29d83c 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java @@ -10,9 +10,9 @@ * 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. @@ -92,7 +92,7 @@ public class VolumeAdapterRest { @Autowired @Qualifier("VnfBpel") private Provider<BpelRestClient> bpelRestClientProvider; - + @POST @Path("") @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @@ -103,7 +103,7 @@ public class VolumeAdapterRest { @ApiResponses({ @ApiResponse(code = 200, message = "vnfVolume has been successfully created"), @ApiResponse(code = 202, message = "create vnfVolume request has been successfully accepted (async only)"), - @ApiResponse(code = 500, message = "create vnfVolume failed, examine entity object for details") }) + @ApiResponse(code = 500, message = "create vnfVolume failed, examine entity object for details") }) public Response createVNFVolumes( @ApiParam(value = "CreateVolumeGroupRequest", required = true) final CreateVolumeGroupRequest req @@ -199,7 +199,9 @@ public class VolumeAdapterRest { //req.getVnfType(), //vnfType, completeVnfVfModuleType, req.getVnfVersion(), //vnfVersion, + "", // genericVnfId req.getVolumeGroupName(), //vnfName, + "", // vfModuleid "VOLUME", //requestType, null, //volumeGroupHeatStackId, null, //baseVfHeatStackId, @@ -246,13 +248,13 @@ public class VolumeAdapterRest { @Path("{aaiVolumeGroupId}") @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @ApiOperation(value = "DeleteVNFVolumes", + @ApiOperation(value = "DeleteVNFVolumes", response = Response.class, notes = "Delete an existing vnfVolume") @ApiResponses({ @ApiResponse(code = 200, message = "vnfVolume has been successfully deleted"), @ApiResponse(code = 202, message = "delete vnfVolume request has been successfully accepted (async only)"), - @ApiResponse(code = 500, message = "delete vnfVolume failed, examine entity object for details") }) + @ApiResponse(code = 500, message = "delete vnfVolume failed, examine entity object for details") }) public Response deleteVNFVolumes( @ApiParam(value = "aaiVolumeGroupId", required = true) @PathParam("aaiVolumeGroupId") String aaiVolumeGroupId, @@ -348,7 +350,7 @@ public class VolumeAdapterRest { @ApiResponses({ @ApiResponse(code = 200, message = "vnfVolume has been successfully rolled back"), @ApiResponse(code = 202, message = "rollback vnfVolume request has been successfully accepted (async only)"), - @ApiResponse(code = 500, message = "rollback vnfVolume failed, examine entity object for details") }) + @ApiResponse(code = 500, message = "rollback vnfVolume failed, examine entity object for details") }) public Response rollbackVNFVolumes( @ApiParam(value = "aaiVolumeGroupId", required = true) @PathParam("aaiVolumeGroupId") String aaiVolumeGroupId, @@ -447,7 +449,7 @@ public class VolumeAdapterRest { @ApiResponses({ @ApiResponse(code = 200, message = "vnfVolume has been successfully updated"), @ApiResponse(code = 202, message = "update vnfVolume request has been successfully accepted (async only)"), - @ApiResponse(code = 500, message = "update vnfVolume failed, examine entity object for details") }) + @ApiResponse(code = 500, message = "update vnfVolume failed, examine entity object for details") }) public Response updateVNFVolumes( @ApiParam(value = "aaiVolumeGroupId", required = true) @PathParam("aaiVolumeGroupId") String aaiVolumeGroupId, @@ -576,7 +578,7 @@ public class VolumeAdapterRest { notes = "Query an existing vnfVolume") @ApiResponses({ @ApiResponse(code = 200, message = "vnfVolume has been successfully queried"), - @ApiResponse(code = 500, message = "query vnfVolume failed, examine entity object for details") }) + @ApiResponse(code = 500, message = "query vnfVolume failed, examine entity object for details") }) public Response queryVNFVolumes( @ApiParam(value = "aaiVolumeGroupId", required = true) @PathParam("aaiVolumeGroupId") String aaiVolumeGroupId, diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java index a1ff139707..445f0071a7 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java @@ -9,9 +9,9 @@ * 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. @@ -75,7 +75,7 @@ import io.swagger.annotations.ApiResponses; * Both XML and JSON can be produced/consumed. Set Accept: and Content-Type: headers appropriately. XML is the default. * For testing, call with cloudSiteId = ___TESTING___ * To test exceptions, also set tenantId = ___TESTING___ - * + * * V2 incorporates run-time selection of sub-orchestrator implementation (Heat or Cloudify) * based on the target cloud. */ @@ -88,14 +88,14 @@ public class VolumeAdapterRestV2 { private static final String RESP=", resp="; private static final String EXCEPTION="Exception :"; private static final String VOLUME_GROUPID_MISSING="VolumeGroupId in URL does not match content"; - + @Autowired private VnfAdapterRestUtils vnfAdapterRestUtils; @Autowired @Qualifier("VnfBpel") private Provider<BpelRestClient> bpelRestClientProvider; - + @POST @Path("") @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @@ -106,7 +106,7 @@ public class VolumeAdapterRestV2 { @ApiResponses({ @ApiResponse(code = 200, message = "vnfVolume has been successfully created"), @ApiResponse(code = 202, message = "create vnfVolume request has been successfully accepted (async only)"), - @ApiResponse(code = 500, message = "create vnfVolume failed, examine entity object for details") }) + @ApiResponse(code = 500, message = "create vnfVolume failed, examine entity object for details") }) public Response createVNFVolumes( @ApiParam(value = "mode", required = true) @QueryParam("mode") String mode, @@ -192,7 +192,9 @@ public class VolumeAdapterRestV2 { req.getTenantId(), //tenantId, completeVnfVfModuleType, //vnfType, req.getVnfVersion(), //vnfVersion, + "", // genericVnfId req.getVolumeGroupName(), //vnfName, + "", // vfModuleId "VOLUME", //requestType, null, //volumeGroupHeatStackId, null, //baseVfHeatStackId, @@ -206,7 +208,7 @@ public class VolumeAdapterRestV2 { outputs, vnfRollback); } - + VolumeGroupRollback rb = new VolumeGroupRollback( req.getVolumeGroupId(), stackId.value, @@ -215,7 +217,7 @@ public class VolumeAdapterRestV2 { req.getCloudSiteId(), req.getMsoRequest(), req.getMessageId()); - + response = new CreateVolumeGroupResponse( req.getVolumeGroupId(), stackId.value, @@ -241,13 +243,13 @@ public class VolumeAdapterRestV2 { @Path("{aaiVolumeGroupId}") @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - @ApiOperation(value = "DeleteVNFVolumes", + @ApiOperation(value = "DeleteVNFVolumes", response = Response.class, notes = "Delete an existing vnfVolume") @ApiResponses({ @ApiResponse(code = 200, message = "vnfVolume has been successfully deleted"), @ApiResponse(code = 202, message = "delete vnfVolume request has been successfully accepted (async only)"), - @ApiResponse(code = 500, message = "delete vnfVolume failed, examine entity object for details") }) + @ApiResponse(code = 500, message = "delete vnfVolume failed, examine entity object for details") }) public Response deleteVNFVolumes( @ApiParam(value = "aaiVolumeGroupId", required = true) @PathParam("aaiVolumeGroupId") String aaiVolumeGroupId, @@ -350,7 +352,7 @@ public class VolumeAdapterRestV2 { @ApiResponses({ @ApiResponse(code = 200, message = "vnfVolume has been successfully rolled back"), @ApiResponse(code = 202, message = "rollback vnfVolume request has been successfully accepted (async only)"), - @ApiResponse(code = 500, message = "rollback vnfVolume failed, examine entity object for details") }) + @ApiResponse(code = 500, message = "rollback vnfVolume failed, examine entity object for details") }) public Response rollbackVNFVolumes( @ApiParam(value = "aaiVolumeGroupId", required = true) @PathParam("aaiVolumeGroupId") String aaiVolumeGroupId, @@ -452,7 +454,7 @@ public class VolumeAdapterRestV2 { @ApiResponses({ @ApiResponse(code = 200, message = "vnfVolume has been successfully updated"), @ApiResponse(code = 202, message = "update vnfVolume request has been successfully accepted (async only)"), - @ApiResponse(code = 500, message = "update vnfVolume failed, examine entity object for details") }) + @ApiResponse(code = 500, message = "update vnfVolume failed, examine entity object for details") }) public Response updateVNFVolumes( @ApiParam(value = "aaiVolumeGroupId", required = true) @PathParam("aaiVolumeGroupId") String aaiVolumeGroupId, @@ -575,7 +577,7 @@ public class VolumeAdapterRestV2 { notes = "Query an existing vnfVolume") @ApiResponses({ @ApiResponse(code = 200, message = "vnfVolume has been successfully queried"), - @ApiResponse(code = 500, message = "query vnfVolume failed, examine entity object for details") }) + @ApiResponse(code = 500, message = "query vnfVolume failed, examine entity object for details") }) public Response queryVNFVolumes( @ApiParam(value = "aaiVolumeGroupId", required = true) @PathParam("aaiVolumeGroupId") String aaiVolumeGroupId, diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java index 005586e3ad..849c0811b0 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java @@ -106,7 +106,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { Map<String, String> map = new HashMap<>(); map.put("key1", "value1"); - instance.createVfModule("MTN13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + instance.createVfModule("MTN13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -126,7 +126,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { Map<String, String> map = new HashMap<>(); map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -146,7 +146,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { Map<String, String> map = new HashMap<>(); map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -166,7 +166,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { Map<String, String> map = new HashMap<>(); map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -183,7 +183,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { Map<String, String> map = new HashMap<>(); map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -197,7 +197,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { Map<String, String> map = new HashMap<>(); map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -213,7 +213,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { Map<String, String> map = new HashMap<>(); map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -232,7 +232,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { Map<String, String> map = new HashMap<>(); map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -252,7 +252,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { Map<String, String> map = new HashMap<>(); map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -270,7 +270,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { Map<String, String> map = new HashMap<>(); map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -302,7 +302,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { Map<String, String> map = new HashMap<>(); map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -339,7 +339,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { Map<String, String> map = new HashMap<>(); map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "XVFMOD", + instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "XVFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", null, map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -357,7 +357,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { Map<String, String> map = new HashMap<>(); map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java index 6674c7171f..addc12a5d3 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java @@ -184,7 +184,7 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils { msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); - instance.createVfModule("123", "123", "vf", "v1", "module-005", "create", "3245", "234", "123", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>()); + instance.createVfModule("123", "123", "vf", "v1", "", "module-005", "", "create", "3245", "234", "123", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>()); } @Test @@ -194,7 +194,7 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils { msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); - instance.createVfModule("123", "123", "vf", "v1", "module-005", "create", "3245", "234", null, new + instance.createVfModule("123", "123", "vf", "v1", "", "module-005", "", "create", "3245", "234", null, new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>()); } @@ -205,7 +205,7 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils { msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); - instance.createVfModule("123", "123", "vf", "v1", "module-005", "create", "3245", "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>()); + instance.createVfModule("123", "123", "vf", "v1", "", "module-005", "", "create", "3245", "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>()); } @Test @@ -215,7 +215,7 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils { msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); - instance.createVfModule("mtn13", "123", "vf", "v1", "module-005", "create", "3245", "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>()); + instance.createVfModule("mtn13", "123", "vf", "v1", "", "module-005", "", "create", "3245", "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>()); } @Test @@ -241,7 +241,7 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils { .withBodyFile("OpenstackResponse_Access.json") .withStatus(HttpStatus.SC_OK))); - instance.createVfModule("mtn13", "123", "vf", "v1", "vfname", "create", "3245", "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>()); + instance.createVfModule("mtn13", "123", "vf", "v1", "", "vfname", "", "create", "3245", "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>()); } @Test diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java index 07fa47df42..b6f1ad1dcd 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java @@ -80,6 +80,11 @@ public class MsoVnfMulticloudAdapterImplTest extends BaseRestTestUtils{ //.withHeader() .withStatus(HttpStatus.SC_NOT_FOUND))); + stubFor(get(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload/workload-id")).willReturn(aResponse() + //.withHeader() + .withBodyFile("MulticloudResponse_Stack.json") + .withStatus(HttpStatus.SC_OK))); + stubFor(get(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload/vfname/outputs")).willReturn(aResponse() .withStatus(HttpStatus.SC_NOT_FOUND))); @@ -87,7 +92,7 @@ public class MsoVnfMulticloudAdapterImplTest extends BaseRestTestUtils{ .withBodyFile("MulticloudResponse_Stack_Create.json") .withStatus(HttpStatus.SC_CREATED))); - instance.createVfModule("MTN13", "123", "vf", "v1", "vfname", "create", null, "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", stackInputs, true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>()); + instance.createVfModule("MTN13", "123", "vf", "v1", "genericVnfId", "vfname", "vfModuleId", "create", null, "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", stackInputs, true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>()); } @Test diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java index 936bce5b5c..a422680d00 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java @@ -58,7 +58,7 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils { MsoRequest msoRequest = getMsoRequest(); Map<String, String> map = new HashMap<>(); map.put("key1", "value1"); - msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", null, map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -70,7 +70,7 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils { MsoRequest msoRequest = getMsoRequest(); Map<String, String> map = new HashMap<>(); map.put("key1", "value1"); - msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -82,7 +82,7 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils { MsoRequest msoRequest = getMsoRequest(); Map<String, String> map = new HashMap<>(); map.put("key1", "value1"); - msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -96,7 +96,7 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils { MsoRequest msoRequest = getMsoRequest(); Map<String, String> map = new HashMap<>(); map.put("key1", "value1"); - msoVnfPluginAdapter.createVfModule("MTN13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + msoVnfPluginAdapter.createVfModule("MTN13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", null, "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -109,7 +109,7 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils { MsoRequest msoRequest = getMsoRequest(); Map<String, String> map = new HashMap<>(); map.put("key1", "value1"); - msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -127,7 +127,7 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils { MsoRequest msoRequest = getMsoRequest(); Map<String, String> map = new HashMap<>(); map.put("key1", "value1"); - msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/MulticloudResponse_Stack.json b/adapters/mso-openstack-adapters/src/test/resources/__files/MulticloudResponse_Stack.json index 068cb83a33..cabf6ac6ba 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/__files/MulticloudResponse_Stack.json +++ b/adapters/mso-openstack-adapters/src/test/resources/__files/MulticloudResponse_Stack.json @@ -1,5 +1,5 @@ { "template_type":"heat", "workload_id": "vfname", - "workload_status":"STATUS" - }
\ No newline at end of file + "workload_status":"CREATE_COMPLETE" + } |