diff options
Diffstat (limited to 'adapters/mso-openstack-adapters/src/main/java/org/onap')
8 files changed, 265 insertions, 232 deletions
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, |