diff options
Diffstat (limited to 'adapters/mso-openstack-adapters')
24 files changed, 238 insertions, 115 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java index 5641186eca..97c715b44e 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java @@ -231,7 +231,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } catch (MsoException me) { logger.error( "{} {} Exception while querying network {} for CloudSite {} from Tenant {} from OpenStack ", - MessageEnum.RA_QUERY_NETWORK_EXC, ErrorCode.BusinessProcesssError.getValue(), networkName, + MessageEnum.RA_QUERY_NETWORK_EXC, ErrorCode.BusinessProcessError.getValue(), networkName, cloudSiteId, tenantId, me); me.addContext(CREATE_NETWORK_CONTEXT); throw new NetworkException(me); @@ -568,7 +568,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } catch (MsoException me) { me.addContext(UPDATE_NETWORK_CONTEXT); logger.error("{} {} Exception - queryNetwork query {} in {}/{} ", MessageEnum.RA_QUERY_NETWORK_EXC, - ErrorCode.BusinessProcesssError.getValue(), networkId, cloudSiteId, tenantId, me); + ErrorCode.BusinessProcessError.getValue(), networkId, cloudSiteId, tenantId, me); throw new NetworkException(me); } @@ -576,7 +576,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { String error = String.format("Update Nework: Network %s does not exist in %s/%s", networkId, cloudSiteId, tenantId); logger.error(LoggingAnchor.THREE, MessageEnum.RA_NETWORK_NOT_FOUND, - ErrorCode.BusinessProcesssError.getValue(), error); + ErrorCode.BusinessProcessError.getValue(), error); // Does not exist. Throw an exception (can't update a non-existent network) throw new NetworkException(error, MsoExceptionCategory.USERDATA); } @@ -1105,7 +1105,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } catch (MsoException me) { me.addContext("RollbackNetwork"); logger.error("{} {} Exception - Rollback Network (neutron): {} in {}/{} ", - MessageEnum.RA_DELETE_NETWORK_EXC, ErrorCode.BusinessProcesssError.getValue(), networkId, + MessageEnum.RA_DELETE_NETWORK_EXC, ErrorCode.BusinessProcessError.getValue(), networkId, cloudSiteId, tenantId, me); throw new NetworkException(me); } @@ -1115,7 +1115,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } catch (MsoException me) { me.addContext("RollbackNetwork"); logger.error("{} {} Exception - Rollback Network (heat): {} in {}/{} ", - MessageEnum.RA_DELETE_NETWORK_EXC, ErrorCode.BusinessProcesssError.getValue(), networkId, + MessageEnum.RA_DELETE_NETWORK_EXC, ErrorCode.BusinessProcessError.getValue(), networkId, cloudSiteId, tenantId, me); throw new NetworkException(me); } @@ -1263,7 +1263,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } } else { String error = "Null pFqdns at start of mergePolicyRefs"; - logger.error(LoggingAnchor.THREE, MessageEnum.RA_MARSHING_ERROR, ErrorCode.BusinessProcesssError.getValue(), + logger.error(LoggingAnchor.THREE, MessageEnum.RA_MARSHING_ERROR, ErrorCode.BusinessProcessError.getValue(), error); throw new MsoAdapterException(error); } @@ -1276,7 +1276,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { logger.debug("Json PolicyRefs Data:{}", jsonString); } catch (Exception e) { String error = "Error creating JsonNode for policyRefs Data"; - logger.error(LoggingAnchor.THREE, MessageEnum.RA_MARSHING_ERROR, ErrorCode.BusinessProcesssError.getValue(), + logger.error(LoggingAnchor.THREE, MessageEnum.RA_MARSHING_ERROR, ErrorCode.BusinessProcessError.getValue(), error, e); throw new MsoAdapterException(error); } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java index 4eb5d5637f..0c37837880 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java @@ -124,7 +124,7 @@ public class NetworkAdapterRest { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error("{} {} Exception while create network ", MessageEnum.RA_CREATE_NETWORK_EXC, - ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcessError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -286,7 +286,7 @@ public class NetworkAdapterRest { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error("{} {} Exception while delete network ", MessageEnum.RA_DELETE_NETWORK_EXC, - ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcessError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -403,7 +403,7 @@ public class NetworkAdapterRest { return Response.status(respStatus).entity(new GenericEntity<QueryNetworkResponse>(resp) {}).build(); } catch (NetworkException e) { logger.error("{} {} Exception when query VNF ", MessageEnum.RA_QUERY_VNF_ERR, - ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcessError.getValue(), e); QueryNetworkError err = new QueryNetworkError(); err.setMessage(e.getMessage()); err.setCategory(MsoExceptionCategory.INTERNAL); @@ -436,7 +436,7 @@ public class NetworkAdapterRest { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error("{} {} Exception in rollbackNetwork ", MessageEnum.RA_ROLLBACK_NULL, - ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcessError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -529,7 +529,7 @@ public class NetworkAdapterRest { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error("{} {} Exception in updateNetwork ", MessageEnum.RA_UPDATE_NETWORK_ERR, - ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcessError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java index 62e9d562a6..662ce33022 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java @@ -216,7 +216,7 @@ public class BpelRestClient { if (totalretries >= retryCount) { debug("Retried " + totalretries + " times, giving up."); logger.error("{} {} Could not deliver response to BPEL after {} tries: {}", - MessageEnum.RA_SEND_VNF_NOTIF_ERR, ErrorCode.BusinessProcesssError.getValue(), totalretries, + MessageEnum.RA_SEND_VNF_NOTIF_ERR, ErrorCode.BusinessProcessError.getValue(), totalretries, toBpelStr); return false; } @@ -273,7 +273,7 @@ public class BpelRestClient { } } catch (Exception e) { logger.error("{} {} Exception - Error sending Bpel notification: {} ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, - ErrorCode.BusinessProcesssError.getValue(), toBpelStr, e); + ErrorCode.BusinessProcessError.getValue(), toBpelStr, e); lastResponseCode = 900; lastResponse = ""; } 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 f6ea2261d7..39a380d2cf 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 @@ -121,6 +121,8 @@ public interface MsoVnfAdapter { @WebParam(name = "cloudOwner") @XmlElement(required = false) String cloudOwner, @WebParam(name = "tenantId") @XmlElement(required = true) String tenantId, @WebParam(name = "vfName") @XmlElement(required = true) String vfName, + @WebParam(name = "vnfId") @XmlElement(required = true) String vnfId, + @WebParam(name = "vfModuleId") @XmlElement(required = true) String vfModuleId, @WebParam(name = "request") MsoRequest msoRequest, @WebParam(name = "vfModuleOutputs", mode = Mode.OUT) Holder<Map<String, String>> vfModuleOutputs) throws VnfException; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java index 6713c2d069..e925e6037c 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java @@ -135,7 +135,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { vnfRollback); } catch (VnfException e) { logger.error("{} {} VnfException in createVnfA ", MessageEnum.RA_CREATE_VNF_ERR, - ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcessError.getValue(), e); org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null; String eMsg = null; try { @@ -144,7 +144,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { .fromValue(e.getFaultInfo().getCategory().name()); } catch (Exception e1) { logger.error("{} {} Exception - Fault info ", MessageEnum.RA_FAULT_INFO_EXC, - ErrorCode.BusinessProcesssError.getValue(), e1); + ErrorCode.BusinessProcessError.getValue(), e1); } // Build and send Asynchronous error response try { @@ -152,7 +152,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { notifyPort.createVnfNotification(messageId, false, exCat, eMsg, null, null, null); } catch (Exception e1) { logger.error("{} {} Exception sending createVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, - ErrorCode.BusinessProcesssError.getValue(), e1); + ErrorCode.BusinessProcessError.getValue(), e1); } logger.info(LoggingAnchor.ONE, MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE); return; @@ -165,7 +165,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { copyVrb(vnfRollback)); } catch (Exception e) { logger.error("{} {} Exception sending createVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, - ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcessError.getValue(), e); } logger.info("{} createVnfA", MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE); return; @@ -191,7 +191,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { volumeGroupHeatStackId, inputs, msoRequest, outputs, vnfRollback); } catch (VnfException e) { logger.error(EXCEPTION_UPDATEVNF_NOTIFICATION, MessageEnum.RA_UPDATE_VNF_ERR, - ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcessError.getValue(), e); org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null; String eMsg = null; try { @@ -200,7 +200,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { .fromValue(e.getFaultInfo().getCategory().name()); } catch (Exception e1) { logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC, - ErrorCode.BusinessProcesssError.getValue(), e1); + ErrorCode.BusinessProcessError.getValue(), e1); } // Build and send Asynchronous error response try { @@ -208,7 +208,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { notifyPort.updateVnfNotification(messageId, false, exCat, eMsg, null, null); } catch (Exception e1) { logger.error(EXCEPTION_UPDATEVNF_NOTIFICATION, MessageEnum.RA_SEND_VNF_NOTIF_ERR, - ErrorCode.BusinessProcesssError.getValue(), e1); + ErrorCode.BusinessProcessError.getValue(), e1); } logger.info(UPDATE_VNFA, MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE); return; @@ -221,7 +221,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { copyVrb(vnfRollback)); } catch (Exception e) { logger.error(EXCEPTION_UPDATEVNF_NOTIFICATION, MessageEnum.RA_SEND_VNF_NOTIF_ERR, - ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcessError.getValue(), e); } logger.info(UPDATE_VNFA, MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE); return; @@ -261,7 +261,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { outputs); } catch (VnfException e) { logger.error("{} {} Exception sending queryVnfA notification ", MessageEnum.RA_QUERY_VNF_ERR, - ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcessError.getValue(), e); org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null; String eMsg = null; try { @@ -270,7 +270,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { .fromValue(e.getFaultInfo().getCategory().name()); } catch (Exception e1) { logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC, - ErrorCode.BusinessProcesssError.getValue(), e1); + ErrorCode.BusinessProcessError.getValue(), e1); } // Build and send Asynchronous error response try { @@ -278,7 +278,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { notifyPort.queryVnfNotification(messageId, false, exCat, eMsg, null, null, null, null); } catch (Exception e1) { logger.error("{} {} Exception sending queryVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, - ErrorCode.BusinessProcesssError.getValue(), e1); + ErrorCode.BusinessProcessError.getValue(), e1); } logger.info("{} queryVnfA", MessageEnum.RA_ASYNC_QUERY_VNF_COMPLETE); return; @@ -298,7 +298,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { copyQueryOutputs(outputs)); } catch (Exception e) { logger.error("{} {} Exception sending queryVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, - ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcessError.getValue(), e); } logger.info("{} queryVnfA", MessageEnum.RA_ASYNC_QUERY_VNF_COMPLETE); @@ -331,7 +331,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { vnfAdapter.deleteVnf(cloudSiteId, cloudOwner, tenantId, vnfName, msoRequest); } catch (VnfException e) { logger.error("{} {} Exception sending deleteVnfA notification ", MessageEnum.RA_DELETE_VNF_ERR, - ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcessError.getValue(), e); org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null; String eMsg = null; try { @@ -340,7 +340,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { .fromValue(e.getFaultInfo().getCategory().name()); } catch (Exception e1) { logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC, - ErrorCode.BusinessProcesssError.getValue(), e1); + ErrorCode.BusinessProcessError.getValue(), e1); } // Build and send Asynchronous error response try { @@ -348,7 +348,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { notifyPort.deleteVnfNotification(messageId, false, exCat, eMsg); } catch (Exception e1) { logger.error("{} {} Exception sending deleteVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, - ErrorCode.BusinessProcesssError.getValue(), e1); + ErrorCode.BusinessProcessError.getValue(), e1); } logger.info("{} deleteVnfA", MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE); return; @@ -362,7 +362,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { } catch (Exception e) { logger.error("{} {} Exception sending deleteVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, - ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcessError.getValue(), e); } logger.info("{} deleteVnfA", MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE); @@ -391,7 +391,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { vnfAdapter.rollbackVnf(rollback); } catch (VnfException e) { logger.error("{} {} Exception sending rollbackVnfA notification ", MessageEnum.RA_ROLLBACK_VNF_ERR, - ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcessError.getValue(), e); org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null; String eMsg = null; try { @@ -400,7 +400,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { .fromValue(e.getFaultInfo().getCategory().name()); } catch (Exception e1) { logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC, - ErrorCode.BusinessProcesssError.getValue(), e1); + ErrorCode.BusinessProcessError.getValue(), e1); } // Build and send Asynchronous error response try { @@ -408,7 +408,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { notifyPort.rollbackVnfNotification(messageId, false, exCat, eMsg); } catch (Exception e1) { logger.error("{} {} Exception sending rollbackVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, - ErrorCode.BusinessProcesssError.getValue(), e1); + ErrorCode.BusinessProcessError.getValue(), e1); } logger.info("{} rollbackVnfA", MessageEnum.RA_ASYNC_ROLLBACK_VNF_COMPLETE); return; @@ -421,7 +421,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { notifyPort.rollbackVnfNotification(messageId, true, null, null); } catch (Exception e) { logger.error("{} {} Exception sending rollbackVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR, - ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcessError.getValue(), e); } logger.info("{} rollbackVnfA", MessageEnum.RA_ASYNC_ROLLBACK_VNF_COMPLETE); @@ -519,17 +519,17 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { warWsdlLoc = Thread.currentThread().getContextClassLoader().getResource("VnfAdapterNotify.wsdl"); } catch (Exception e) { logger.error("{} {} Exception - WSDL not found ", MessageEnum.RA_WSDL_NOT_FOUND, - ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcessError.getValue(), e); } if (warWsdlLoc == null) { logger.error("{} {} WSDL not found", MessageEnum.RA_WSDL_NOT_FOUND, - ErrorCode.BusinessProcesssError.getValue()); + ErrorCode.BusinessProcessError.getValue()); } else { try { logger.debug("VnfAdpaterNotify.wsdl location:{}", warWsdlLoc.toURI().toString()); } catch (Exception e) { logger.error("{} {} Exception - WSDL URL convention ", MessageEnum.RA_WSDL_URL_CONVENTION_EXC, - ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcessError.getValue(), e); } } @@ -545,7 +545,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { epUrl = new URL(notificationUrl); } catch (MalformedURLException e1) { logger.error("{} {} MalformedURLException ", MessageEnum.RA_INIT_NOTIF_EXC, - ErrorCode.BusinessProcesssError.getValue(), e1); + ErrorCode.BusinessProcessError.getValue(), e1); } if (null != epUrl) { @@ -567,7 +567,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { headers.put("Authorization", Collections.singletonList(basicAuth)); } catch (Exception e) { logger.error("{} {} Exception - Unable to set authorization in callback request ", - MessageEnum.RA_SET_CALLBACK_AUTH_EXC, ErrorCode.BusinessProcesssError.getValue(), e); + MessageEnum.RA_SET_CALLBACK_AUTH_EXC, ErrorCode.BusinessProcessError.getValue(), e); } return notifyPort; 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 0d1d690024..fcb2d7c2bb 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 @@ -25,15 +25,11 @@ package org.onap.so.adapters.vnf; -import java.io.File; -import java.io.IOException; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; -import java.util.concurrent.TimeUnit; import javax.jws.WebService; import javax.xml.ws.Holder; import org.apache.commons.collections.CollectionUtils; @@ -63,6 +59,7 @@ import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository; import org.onap.so.db.catalog.data.repository.VnfResourceRepository; import org.onap.so.db.catalog.utils.MavenLikeVersioning; import org.onap.so.entity.MsoRequest; +import org.onap.so.heatbridge.HeatBridgeException; import org.onap.so.heatbridge.HeatBridgeApi; import org.onap.so.heatbridge.HeatBridgeImpl; import org.onap.so.logger.ErrorCode; @@ -424,8 +421,10 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { List<String> oobMgtNetNames = new ArrayList<>(); - HeatBridgeApi heatBridgeClient = - new HeatBridgeImpl(new AAIResourcesClient(), cloudIdentity, cloudOwner, cloudSiteId, tenantId); + HeatBridgeApi heatBridgeClient = new HeatBridgeImpl(new AAIResourcesClient(), cloudIdentity, cloudOwner, + cloudSiteId, cloudSite.getRegionId(), tenantId); + + heatBridgeClient.authenticate(); List<Resource> stackResources = heatBridgeClient.queryNestedHeatStackResources(heatStackId); @@ -620,7 +619,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Create VFModule: Attached heatStack ID Query " + nestedStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner, - cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.BusinessProcesssError.getValue(), + cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.BusinessProcessError.getValue(), "MsoException trying to query nested stack", me); logger.debug("ERROR trying to query nested stack= {}", error); throw new VnfException(me); @@ -629,8 +628,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Create VFModule: Attached heatStack ID DOES NOT EXIST " + nestedStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " " + USER_ERROR; logger.error(LoggingAnchor.TEN, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner, - cloudSiteId, tenantId, error, OPENSTACK, QUERY_STACK, - ErrorCode.BusinessProcesssError.getValue(), + cloudSiteId, tenantId, error, OPENSTACK, QUERY_STACK, ErrorCode.BusinessProcessError.getValue(), "Create VFModule: Attached heatStack ID " + "DOES NOT EXIST"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); @@ -654,7 +652,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Create VFModule: Attached baseHeatStack ID Query " + nestedBaseStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner, - cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.BusinessProcesssError.getValue(), + cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.BusinessProcessError.getValue(), "MsoException trying to query nested base stack", me); logger.debug("ERROR trying to query nested base stack= {}", error); throw new VnfException(me); @@ -663,8 +661,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Create VFModule: Attached base heatStack ID DOES NOT EXIST " + nestedBaseStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " " + USER_ERROR; logger.error(LoggingAnchor.TEN, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner, - cloudSiteId, tenantId, error, OPENSTACK, QUERY_STACK, - ErrorCode.BusinessProcesssError.getValue(), + cloudSiteId, tenantId, error, OPENSTACK, QUERY_STACK, ErrorCode.BusinessProcessError.getValue(), "Create VFModule: Attached base heatStack ID DOES NOT EXIST"); logger.debug("Exception occurred", error); throw new VnfException(error, MsoExceptionCategory.USERDATA); @@ -796,7 +793,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { + VERSION_MAX + " :" + maxVersionVnf + " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + cloudSiteOpt.get().getCloudVersion(); logger.error(LoggingAnchor.FIVE, MessageEnum.RA_CONFIG_EXC.toString(), error, OPENSTACK, - ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion"); + ErrorCode.BusinessProcessError.getValue(), "Exception - setVersion"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } @@ -1139,8 +1136,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } @Override - public void deleteVfModule(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, - MsoRequest msoRequest, Holder<Map<String, String>> outputs) throws VnfException { + public void deleteVfModule(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, String vnfId, + String vfModuleId, MsoRequest msoRequest, Holder<Map<String, String>> outputs) throws VnfException { Map<String, Object> stackOutputs; try { stackOutputs = msoHeatUtils.queryStackForOutputs(cloudSiteId, cloudOwner, tenantId, vnfName); @@ -1205,6 +1202,12 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { logger.error("Exception encountered while sending Confirm to Valet ", e); } } + // call heatbridge delete + try { + new HeatBridgeImpl().deleteVfModuleData(vnfId, vfModuleId); + } catch (HeatBridgeException e) { + logger.error("Heatbridge failed to delete AAI data for vf-module: " + vfModuleId, e); + } } @Override @@ -1489,7 +1492,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { + minVersionVnf + " " + VERSION_MAX + " :" + maxVersionVnf + " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + aicV; logger.error(LoggingAnchor.FIVE, MessageEnum.RA_CONFIG_EXC.toString(), error, OPENSTACK, - ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion"); + ErrorCode.BusinessProcessError.getValue(), "Exception - setVersion"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } 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 f09fa34cb9..d35c34a937 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 @@ -601,7 +601,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { + vnfResource.getModelUUID() + " VersionMin=" + vnfMin + " VersionMax:" + vnfMax + " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + cloudSite.getCloudVersion(); logger.error(LoggingAnchor.FIVE, MessageEnum.RA_CONFIG_EXC.toString(), error, OPENSTACK, - ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion"); + ErrorCode.BusinessProcessError.getValue(), "Exception - setVersion"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } @@ -725,7 +725,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { String error = "Create VFModule: Attached Volume Group DOES NOT EXIST " + volumeGroupId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR"; logger.error(BRACKETS, MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, cloudSiteId, tenantId, - error, CLOUDIFY, "queryDeployment(volume)", ErrorCode.BusinessProcesssError.getValue(), + error, CLOUDIFY, "queryDeployment(volume)", ErrorCode.BusinessProcessError.getValue(), "Create VFModule: Attached Volume Group DOES NOT EXIST"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); @@ -774,7 +774,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { + cloudSiteId + "/" + tenantId + " USER ERROR"; logger.error(BRACKETS, MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId, cloudSiteId, tenantId, error, CLOUDIFY, "queryDeployment(Base)", - ErrorCode.BusinessProcesssError.getValue(), + ErrorCode.BusinessProcessError.getValue(), "Create VFModule: Base " + "Module DOES NOT EXIST"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); @@ -1081,8 +1081,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { } - public void deleteVfModule(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, - MsoRequest msoRequest, Holder<Map<String, String>> outputs) throws VnfException { + public void deleteVfModule(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, String vnfId, + String vfModuleId, MsoRequest msoRequest, Holder<Map<String, String>> outputs) throws VnfException { logger.debug("Deleting VF " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId); // 1702 capture the output parameters on a delete 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 41bcc8c481..561b21250f 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 @@ -643,7 +643,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { + " VersionMin=" + vnfMin + " VersionMax:" + vnfMax + " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + cloudSite.getCloudVersion(); logger.error(LoggingAnchor.FIVE, MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack", - ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion"); + ErrorCode.BusinessProcessError.getValue(), "Exception - setVersion"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } @@ -773,7 +773,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR"; logger.error(LoggingAnchor.TEN, MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, cloudOwner, cloudSiteId, tenantId, error, "VDU", "queryVdu(volume)", - ErrorCode.BusinessProcesssError.getValue(), + ErrorCode.BusinessProcessError.getValue(), "Create VFModule: Attached Volume Group " + "DOES NOT EXIST"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); @@ -822,7 +822,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { + "/" + cloudSiteId + "/" + tenantId + " USER ERROR"; logger.error(LoggingAnchor.TEN, MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId, cloudOwner, cloudSiteId, tenantId, error, "VDU", "queryVdu(Base)", - ErrorCode.BusinessProcesssError.getValue(), "Create VFModule: Base Module DOES NOT EXIST"); + ErrorCode.BusinessProcessError.getValue(), "Create VFModule: Base Module DOES NOT EXIST"); logger.debug(error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } else { @@ -1072,8 +1072,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { } - public void deleteVfModule(String cloudSiteId, String cloudOwner, String tenantId, String vfModuleId, - MsoRequest msoRequest, Holder<Map<String, String>> outputs) throws VnfException { + public void deleteVfModule(String cloudSiteId, String cloudOwner, String tenantId, String vfModuleId, String vnfId, + String aaiVfModuleId, MsoRequest msoRequest, Holder<Map<String, String>> outputs) throws VnfException { logger.debug("Deleting VF Module " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId); 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 8c871c742e..58899b7f48 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 @@ -130,7 +130,7 @@ public class VnfAdapterRest { } catch (Exception e) { // problem handling delete, send generic failure as sync resp to caller logger.error("", MessageEnum.RA_DELETE_VNF_ERR.toString(), "deleteVfModule", - ErrorCode.BusinessProcesssError.getValue(), "Exception in deleteVfModule", e); + ErrorCode.BusinessProcessError.getValue(), "Exception in deleteVfModule", e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -179,13 +179,14 @@ public class VnfAdapterRest { Holder<Map<String, String>> outputs = new Holder<>(); if (cloudsite != null && !cloudsite.equals(TESTING_KEYWORD)) { vnfAdapter.deleteVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(), - req.getVfModuleStackId(), req.getMsoRequest(), outputs); + req.getVfModuleStackId(), req.getVnfId(), req.getVfModuleId(), req.getMsoRequest(), + outputs); } response = new DeleteVfModuleResponse(req.getVnfId(), req.getVfModuleId(), Boolean.TRUE, req.getMessageId(), outputs.value); } catch (VnfException e) { logger.error(LoggingAnchor.THREE, MessageEnum.RA_DELETE_VNF_ERR.toString(), - ErrorCode.BusinessProcesssError.getValue(), "VnfException - Delete VNF Module", e); + ErrorCode.BusinessProcessError.getValue(), "VnfException - Delete VNF Module", e); eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE, req.getMessageId()); } @@ -243,7 +244,7 @@ public class VnfAdapterRest { return Response.status(respStatus).entity(new GenericEntity<QueryVfModuleResponse>(qryResp) {}).build(); } catch (VnfException e) { logger.error(LoggingAnchor.FIVE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, "queryVfModule", - ErrorCode.BusinessProcesssError.getValue(), "VnfException - queryVfModule", e); + ErrorCode.BusinessProcessError.getValue(), "VnfException - queryVfModule", e); VfModuleExceptionResponse excResp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.FALSE, null); return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR) @@ -290,7 +291,7 @@ public class VnfAdapterRest { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error(LoggingAnchor.FOUR, MessageEnum.RA_CREATE_VNF_ERR, "createVfModule", - ErrorCode.BusinessProcesssError, "Exception - createVfModule", e); + ErrorCode.BusinessProcessError, "Exception - createVfModule", e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -405,7 +406,7 @@ public class VnfAdapterRest { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error(LoggingAnchor.FOUR, MessageEnum.RA_UPDATE_VNF_ERR.toString(), "updateVfModule", - ErrorCode.BusinessProcesssError.getValue(), "Exception - updateVfModule", e); + ErrorCode.BusinessProcessError.getValue(), "Exception - updateVfModule", e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -509,7 +510,7 @@ public class VnfAdapterRest { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error(LoggingAnchor.FOUR, MessageEnum.RA_ROLLBACK_VNF_ERR.toString(), "rollbackVfModule", - ErrorCode.BusinessProcesssError.getValue(), "Exception - rollbackVfModule", e); + ErrorCode.BusinessProcessError.getValue(), "Exception - rollbackVfModule", e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -560,7 +561,7 @@ public class VnfAdapterRest { vnfAdapter.rollbackVnf(vrb); response = new RollbackVfModuleResponse(Boolean.TRUE, req.getMessageId()); } catch (VnfException e) { - logger.error(LoggingAnchor.THREE, MessageEnum.RA_ROLLBACK_VNF_ERR, ErrorCode.BusinessProcesssError, + logger.error(LoggingAnchor.THREE, MessageEnum.RA_ROLLBACK_VNF_ERR, ErrorCode.BusinessProcessError, "Exception" + " - " + "rollbackVfModule", e); eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, false, req.getMessageId()); 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 9a7354c40c..0e70c6be53 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 @@ -140,7 +140,7 @@ public class VnfAdapterRestV2 { } catch (Exception e) { // problem handling delete, send generic failure as sync resp to caller logger.error(BRACKETS, MessageEnum.RA_DELETE_VNF_ERR.toString(), "deleteVfModule", - ErrorCode.BusinessProcesssError.getValue(), "Exception in deleteVfModule", e); + ErrorCode.BusinessProcessError.getValue(), "Exception in deleteVfModule", e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -195,13 +195,14 @@ public class VnfAdapterRestV2 { // Support different Adapter Implementations MsoVnfAdapter adapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudsite); adapter.deleteVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(), - req.getVfModuleStackId(), req.getMsoRequest(), outputs); + req.getVfModuleStackId(), req.getVnfId(), req.getVfModuleId(), req.getMsoRequest(), + outputs); } response = new DeleteVfModuleResponse(req.getVnfId(), req.getVfModuleId(), Boolean.TRUE, req.getMessageId(), outputs.value); } catch (VnfException e) { logger.error(LoggingAnchor.THREE, MessageEnum.RA_DELETE_VNF_ERR.toString(), - ErrorCode.BusinessProcesssError.getValue(), "VnfException - " + "Delete VNF Module", e); + ErrorCode.BusinessProcessError.getValue(), "VnfException - " + "Delete VNF Module", e); eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE, req.getMessageId()); } @@ -271,7 +272,7 @@ public class VnfAdapterRestV2 { return Response.status(respStatus).entity(new GenericEntity<QueryVfModuleResponse>(qryResp) {}).build(); } catch (VnfException e) { logger.error(LoggingAnchor.FIVE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, "queryVfModule", - ErrorCode.BusinessProcesssError.getValue(), "VnfException - queryVfModule", e); + ErrorCode.BusinessProcessError.getValue(), "VnfException - queryVfModule", e); VfModuleExceptionResponse excResp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.FALSE, null); return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR) @@ -320,7 +321,7 @@ public class VnfAdapterRestV2 { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error(BRACKETS, MessageEnum.RA_CREATE_VNF_ERR.toString(), "createVfModule", - ErrorCode.BusinessProcesssError.getValue(), "Exception - createVfModule", e); + ErrorCode.BusinessProcessError.getValue(), "Exception - createVfModule", e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -440,7 +441,7 @@ public class VnfAdapterRestV2 { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error(BRACKETS, MessageEnum.RA_UPDATE_VNF_ERR.toString(), "updateVfModule", - ErrorCode.BusinessProcesssError.getValue(), "Exception - updateVfModule", e); + ErrorCode.BusinessProcessError.getValue(), "Exception - updateVfModule", e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -555,7 +556,7 @@ public class VnfAdapterRestV2 { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error(BRACKETS, MessageEnum.RA_ROLLBACK_VNF_ERR.toString(), "rollbackVfModule", - ErrorCode.BusinessProcesssError.getValue(), "Exception - rollbackVfModule", e); + ErrorCode.BusinessProcessError.getValue(), "Exception - rollbackVfModule", e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -612,7 +613,7 @@ public class VnfAdapterRestV2 { response = new RollbackVfModuleResponse(Boolean.TRUE, req.getMessageId()); } catch (VnfException e) { logger.error(LoggingAnchor.THREE, MessageEnum.RA_ROLLBACK_VNF_ERR.toString(), - ErrorCode.BusinessProcesssError.getValue(), "Exception - rollbackVfModule", e); + ErrorCode.BusinessProcessError.getValue(), "Exception - rollbackVfModule", e); eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, false, req.getMessageId()); } 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 87df7fdc37..c9e046ca43 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 @@ -118,7 +118,7 @@ public class VolumeAdapterRest { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error("{} {} Exception - createVNFVolumes: ", MessageEnum.RA_CREATE_VNF_ERR, - ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcessError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -270,7 +270,7 @@ public class VolumeAdapterRest { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error("{} {} Exception - deleteVNFVolumes: ", MessageEnum.RA_DELETE_VNF_ERR, - ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcessError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -367,7 +367,7 @@ public class VolumeAdapterRest { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error("{} {} Exception - rollbackVNFVolumes: ", MessageEnum.RA_ROLLBACK_VNF_ERR, - ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcessError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -463,7 +463,7 @@ public class VolumeAdapterRest { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error("{} {} Exception - updateVNFVolumes: ", MessageEnum.RA_UPDATE_VNF_ERR, - ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcessError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -607,7 +607,7 @@ public class VolumeAdapterRest { return Response.status(respStatus).entity(new GenericEntity<QueryVolumeGroupResponse>(qryResp) {}).build(); } catch (VnfException e) { logger.error("{} {} AaiVolumeGroupId: {} VnfException - queryVNFVolumes", MessageEnum.RA_QUERY_VNF_ERR, - ErrorCode.BusinessProcesssError.getValue(), aaiVolumeGroupId, e); + ErrorCode.BusinessProcessError.getValue(), aaiVolumeGroupId, e); VolumeGroupExceptionResponse excResp = new VolumeGroupExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.FALSE, null); logger.debug("Query queryVNFVolumes exit"); 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 89eb6a161d..2b7234aca6 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 @@ -118,7 +118,7 @@ public class VolumeAdapterRestV2 { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error("{} {} Exception - createVNFVolumes: ", MessageEnum.RA_CREATE_VNF_ERR, - ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcessError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -253,7 +253,7 @@ public class VolumeAdapterRestV2 { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error("{} {} Exception - deleteVNFVolumes: ", MessageEnum.RA_DELETE_VNF_ERR, - ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcessError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -355,7 +355,7 @@ public class VolumeAdapterRestV2 { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error("{} {} Exception - rollbackVNFVolumes: ", MessageEnum.RA_ROLLBACK_VNF_ERR, - ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcessError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -455,7 +455,7 @@ public class VolumeAdapterRestV2 { } catch (Exception e) { // problem handling create, send generic failure as sync resp to caller logger.error("{} {} Exception - updateVNFVolumes: ", MessageEnum.RA_UPDATE_VNF_ERR, - ErrorCode.BusinessProcesssError.getValue(), e); + ErrorCode.BusinessProcessError.getValue(), e); return Response.serverError().build(); } // send sync response (ACK) to caller @@ -594,7 +594,7 @@ public class VolumeAdapterRestV2 { return Response.status(respStatus).entity(new GenericEntity<QueryVolumeGroupResponse>(qryResp) {}).build(); } catch (VnfException e) { logger.error("{} {} AaiVolumeGroupId: {} VnfException - queryVNFVolumes: ", MessageEnum.RA_QUERY_VNF_ERR, - ErrorCode.BusinessProcesssError.getValue(), aaiVolumeGroupId, e); + ErrorCode.BusinessProcessError.getValue(), aaiVolumeGroupId, e); VolumeGroupExceptionResponse excResp = new VolumeGroupExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.FALSE, null); logger.debug("Query queryVNFVolumes exit"); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java index d568bc2807..7eff09b692 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java @@ -150,4 +150,11 @@ public interface HeatBridgeApi { * @throws HeatBridgeException when failing to add openstack resource PoJos to AAI */ void submitToAai() throws HeatBridgeException; + + /** + * Delete heatbridge data for a given vf-module + * + * @throws HeatBridgeException when failing to remove heatbridge data from AAI for a given vf-module + */ + void deleteVfModuleData(String vnfId, String vfModuleId) throws HeatBridgeException; } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java index a1b33056da..e2022c9a6e 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java @@ -58,9 +58,12 @@ import org.onap.aai.domain.yang.SriovVfs; import org.onap.aai.domain.yang.Vlan; import org.onap.aai.domain.yang.Vlans; import org.onap.aai.domain.yang.Vserver; +import org.onap.aai.domain.yang.VfModule; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.AAIResourcesClient; import org.onap.so.client.aai.AAISingleTransactionClient; +import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.so.client.aai.entities.Relationships; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.graphinventory.entities.uri.Depth; @@ -102,33 +105,39 @@ public class HeatBridgeImpl implements HeatBridgeApi { private AAISingleTransactionClient transaction; private String cloudOwner; private String cloudRegionId; + private String regionId; private String tenantId; private AaiHelper aaiHelper = new AaiHelper(); private CloudIdentity cloudIdentity; - public HeatBridgeImpl(AAIResourcesClient resourcesClient, final CloudIdentity cloudIdentity, - @Nonnull final String cloudOwner, @Nonnull final String cloudRegionId, @Nonnull final String tenantId) { + @Nonnull final String cloudOwner, @Nonnull final String cloudRegionId, @Nonnull final String regionId, + @Nonnull final String tenantId) { Objects.requireNonNull(cloudOwner, "Null cloud-owner value!"); Objects.requireNonNull(cloudRegionId, "Null cloud-region identifier!"); Objects.requireNonNull(tenantId, "Null tenant identifier!"); - Objects.requireNonNull(tenantId, "Null AAI actions list!"); + Objects.requireNonNull(regionId, "Null regionId identifier!"); this.cloudIdentity = cloudIdentity; this.cloudOwner = cloudOwner; this.cloudRegionId = cloudRegionId; + this.regionId = regionId; this.tenantId = tenantId; this.resourcesClient = resourcesClient; this.transaction = resourcesClient.beginSingleTransaction(); } + public HeatBridgeImpl() { + this.resourcesClient = new AAIResourcesClient(); + this.transaction = resourcesClient.beginSingleTransaction(); + } + @Override public OpenstackClient authenticate() throws HeatBridgeException { this.osClient = new MsoCloudClientFactoryImpl(new OpenstackClientFactoryImpl()).getOpenstackClient( - cloudIdentity.getIdentityUrl(), cloudIdentity.getMsoId(), cloudIdentity.getMsoPass(), cloudRegionId, + cloudIdentity.getIdentityUrl(), cloudIdentity.getMsoId(), cloudIdentity.getMsoPass(), regionId, tenantId); - logger.debug("Successfully authenticated with keystone for tenant: " + tenantId + " and cloud " + "region: " - + cloudRegionId); + logger.debug("Successfully authenticated with keystone for tenant: " + tenantId + " and region: " + regionId); return osClient; } @@ -418,6 +427,78 @@ public class HeatBridgeImpl implements HeatBridgeApi { } } + @Override + public void deleteVfModuleData(@Nonnull final String vnfId, @Nonnull final String vfModuleId) + throws HeatBridgeException { + Objects.requireNonNull(vnfId, "Null vnf-id!"); + Objects.requireNonNull(vfModuleId, "Null vf-module-id!"); + try { + Optional<VfModule> vfModule = resourcesClient.get(VfModule.class, + AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId).depth(Depth.ONE)); + if (vfModule.isPresent()) { + + AAIResultWrapper resultWrapper = new AAIResultWrapper(vfModule); + Optional<Relationships> relationships = resultWrapper.getRelationships(); + if (relationships.isPresent()) { + List<AAIResourceUri> vserverUris = relationships.get().getRelatedUris(AAIObjectType.VSERVER); + createTransactionToDeleteSriovPfFromPserver(vserverUris); + if (!vserverUris.isEmpty()) { + for (AAIResourceUri vserverUri : vserverUris) { + resourcesClient.delete(vserverUri); + } + } + } + } + } catch (Exception e) { + String msg = "Failed to commit delete heatbridge data transaction"; + logger.debug(msg + " with error: " + e); + throw new HeatBridgeException(msg, e); + } + } + + private void createTransactionToDeleteSriovPfFromPserver(List<AAIResourceUri> vserverUris) { + Map<String, List<String>> pserverToPciIdMap = getPserverToPciIdMap(vserverUris); + for (Map.Entry<String, List<String>> entry : pserverToPciIdMap.entrySet()) { + String pserverName = entry.getKey(); + List<String> pciIds = entry.getValue(); + Optional<Pserver> pserver = resourcesClient.get(Pserver.class, + AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, pserverName).depth(Depth.TWO)); + if (pserver.isPresent()) { + // For each pserver/p-interface match sriov-vfs by pic-id and delete them. + pserver.get().getPInterfaces().getPInterface().stream().filter( + pIf -> pIf.getSriovPfs() != null && CollectionUtils.isNotEmpty(pIf.getSriovPfs().getSriovPf())) + .forEach(pIf -> pIf.getSriovPfs().getSriovPf().forEach(sriovPf -> { + if (pciIds.contains(sriovPf.getPfPciId())) { + logger.debug("creating transaction to delete SR-IOV PF: " + pIf.getInterfaceName() + + " from PServer: " + pserverName); + resourcesClient.delete(AAIUriFactory.createResourceUri(AAIObjectType.SRIOV_PF, + pserverName, pIf.getInterfaceName(), sriovPf.getPfPciId())); + } + })); + } + } + } + + private Map<String, List<String>> getPserverToPciIdMap(List<AAIResourceUri> vserverUris) { + Map<String, List<String>> pserverToPciIdMap = new HashMap<>(); + for (AAIResourceUri vserverUri : vserverUris) { + AAIResultWrapper vserverWrapper = resourcesClient.get(vserverUri.depth(Depth.TWO)); + Optional<Relationships> vserverRelationships = vserverWrapper.getRelationships(); + if (vserverRelationships.isPresent() + && CollectionUtils.isNotEmpty(vserverRelationships.get().getRelatedLinks(AAIObjectType.PSERVER))) { + Vserver vserver = vserverWrapper.asBean(Vserver.class).get(); + List<String> pciIds = HeatBridgeUtils.extractPciIdsFromVServer(vserver); + if (CollectionUtils.isNotEmpty(pciIds)) { + List<String> matchingPservers = vserverRelationships.get().getRelatedLinks(AAIObjectType.PSERVER); + if (matchingPservers != null && matchingPservers.size() == 1) { + pserverToPciIdMap.put(matchingPservers.get(0), pciIds); + } + } + } + } + return pserverToPciIdMap; + } + private <T> Predicate<T> distinctByProperty(Function<? super T, Object> keyExtractor) { Map<Object, Boolean> map = new ConcurrentHashMap<>(); return t -> map.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java index 018a4eac8d..e1f363ca05 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java @@ -47,13 +47,13 @@ public interface MsoCloudClientFactory { * @param url openstack url * @param msoId openstack user for mso * @param msoPass openstack password for mso user - * @param cloudRegionId cloud-region identifier + * @param regionId region identifier * @param tenantId tenant identifier * @return Openstack Client for the keystone version requested * @throws HeatBridgeException if any errors when reading cloud configuration or getting openstack client */ - OpenstackClient getOpenstackClient(String url, String msoId, String msoPass, String cloudRegionId, String tenantId) + OpenstackClient getOpenstackClient(String url, String msoId, String msoPass, String regionId, String tenantId) throws HeatBridgeException; } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java index f0c5a0b434..04245899aa 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java @@ -61,17 +61,17 @@ public class MsoCloudClientFactoryImpl implements MsoCloudClientFactory { @Override public OpenstackClient getOpenstackClient(@Nonnull String url, @Nonnull String msoId, @Nonnull String msoPass, - @Nonnull String cloudRegionId, @Nonnull String tenantId) throws HeatBridgeException { + @Nonnull String regionId, @Nonnull String tenantId) throws HeatBridgeException { Objects.requireNonNull(url, "Null openstack url!"); Objects.requireNonNull(msoId, "Null openstack user id!"); Objects.requireNonNull(msoPass, "Null openstack password!"); - Objects.requireNonNull(cloudRegionId, "Null cloud-region ID!"); + Objects.requireNonNull(regionId, "Null regionId ID!"); Objects.requireNonNull(tenantId, "Null tenant ID!"); try { final OpenstackAccess osAccess = new OpenstackAccessBuilder().setBaseUrl(url) // keystone URL .setUser(msoId) // keystone username .setPassword(CryptoUtils.decryptCloudConfigPassword(msoPass)) // keystone decrypted password - .setRegion(cloudRegionId) // openstack region + .setRegion(regionId) // openstack region .setDomainName(HeatBridgeConstants.OS_DEFAULT_DOMAIN_NAME) // hardcode to "default" .setTenantId(tenantId) // tenantId .build(); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java index be086677db..1667f980e1 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java @@ -35,10 +35,15 @@ package org.onap.so.heatbridge.utils; import com.google.common.base.Preconditions; import com.google.common.base.Strings; +import java.util.List; import java.util.Optional; +import java.util.stream.Collectors; import javax.annotation.Nonnull; +import org.apache.commons.collections.CollectionUtils; +import org.onap.aai.domain.yang.SriovVf; +import org.onap.aai.domain.yang.Vserver; -public class HeatBridgeUtils { +public final class HeatBridgeUtils { /** * IaaS naming convention for compute/p-interface to openstack/physical-network name mapping @@ -64,4 +69,13 @@ public class HeatBridgeUtils { } return Optional.empty(); } + + public static List<String> extractPciIdsFromVServer(Vserver vserver) { + return vserver.getLInterfaces().getLInterface().stream() + .filter(lInterface -> lInterface.getSriovVfs() != null + && CollectionUtils.isNotEmpty(lInterface.getSriovVfs().getSriovVf())) + .flatMap(lInterface -> lInterface.getSriovVfs().getSriovVf().stream()).map(SriovVf::getPciId) + .collect(Collectors.toList()); + } + } 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 f3cad76c9d..01726acd54 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 @@ -484,7 +484,8 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { MsoVnfAdapterImpl instance = new MsoVnfAdapterImpl(); MsoRequest msoRequest = getMsoRequest(); try { - instance.deleteVfModule("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest, + instance.deleteVfModule("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", + "5aae1e49-805c-4f9f-bd78-055bf7451157", "11420693-3f69-4c61-b3ee-9787c744e760", msoRequest, new Holder<Map<String, String>>()); } catch (Exception e) { 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 16cc2c34de..e7ef9d9348 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 @@ -101,7 +101,8 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils { msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); - instance.deleteVfModule("mtn13", "CloudOwner", "1234", "vfname", msoRequest, new Holder<>()); + instance.deleteVfModule("mtn13", "CloudOwner", "1234", "vfname", "5aae1e49-805c-4f9f-bd78-055bf7451157", + "11420693-3f69-4c61-b3ee-9787c744e760", msoRequest, new Holder<>()); } @Test @@ -124,7 +125,8 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils { wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/tokens")) .willReturn(aResponse().withBodyFile("OpenstackResponse_Access.json").withStatus(HttpStatus.SC_OK))); - instance.deleteVfModule("mtn13", "CloudOwner", "1234", "vfname", msoRequest, new Holder<>()); + instance.deleteVfModule("mtn13", "CloudOwner", "1234", "vfname", "5aae1e49-805c-4f9f-bd78-055bf7451157", + "11420693-3f69-4c61-b3ee-9787c744e760", msoRequest, 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 48ca0fd79c..0ac30cb75c 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 @@ -210,7 +210,8 @@ public class MsoVnfMulticloudAdapterImplTest extends BaseRestTestUtils { wireMockServer.stubFor(delete(urlPathEqualTo("/api/multicloud/v1/CloudOwner/MTN13/infra_workload/workload-id")) .willReturn(aResponse().withStatus(HttpStatus.SC_NO_CONTENT))); - instance.deleteVfModule("MTN13", "CloudOwner", "123", "workload-id", msoRequest, new Holder<>()); + instance.deleteVfModule("MTN13", "CloudOwner", "123", "workload-id", "5aae1e49-805c-4f9f-bd78-055bf7451157", + "11420693-3f69-4c61-b3ee-9787c744e760", msoRequest, 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 7ec8e51892..ede25c5dbe 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 @@ -134,7 +134,8 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils { expectedException.expect(VnfException.class); MsoRequest msoRequest = getMsoRequest(); msoVnfPluginAdapter.deleteVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", - msoRequest, new Holder<Map<String, String>>()); + "5aae1e49-805c-4f9f-bd78-055bf7451157", "11420693-3f69-4c61-b3ee-9787c744e760", msoRequest, + new Holder<Map<String, String>>()); } @Test @@ -151,7 +152,8 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils { .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); MsoRequest msoRequest = getMsoRequest(); msoVnfPluginAdapter.deleteVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", - msoRequest, new Holder<Map<String, String>>()); + "5aae1e49-805c-4f9f-bd78-055bf7451157", "11420693-3f69-4c61-b3ee-9787c744e760", msoRequest, + new Holder<Map<String, String>>()); } private MsoRequest getMsoRequest() { diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java index d611322c02..e2f5531280 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java @@ -112,7 +112,7 @@ public class HeatBridgeImplTest { public void setUp() throws HeatBridgeException, OpenstackClientException, BulkProcessFailed { when(resourcesClient.beginSingleTransaction()).thenReturn(transaction); - heatbridge = new HeatBridgeImpl(resourcesClient, cloudIdentity, CLOUD_OWNER, REGION_ID, TENANT_ID); + heatbridge = new HeatBridgeImpl(resourcesClient, cloudIdentity, CLOUD_OWNER, REGION_ID, REGION_ID, TENANT_ID); } @Ignore diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImplTest.java index 701ed65d19..4eeb1c03a3 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImplTest.java @@ -38,7 +38,7 @@ public class MsoCloudClientFactoryImplTest { private static final String MSO_ID = "testMsoId"; private static final String ENCRYPTED_PASSWORD = CryptoUtils.encryptCloudConfigPassword("testPassword"); - private static final String CLOUD_REGION_ID = "testCloudRegionId"; + private static final String REGION_ID = "testCloudRegionId"; private static final String TENANT_ID = "testTenantId"; private MsoCloudClientFactoryImpl testedObject; @@ -52,20 +52,19 @@ public class MsoCloudClientFactoryImplTest { @Test public void getOpenstackClientWithVersion2() throws Exception { - testedObject.getOpenstackClient(URL_V2, MSO_ID, ENCRYPTED_PASSWORD, CLOUD_REGION_ID, TENANT_ID); + testedObject.getOpenstackClient(URL_V2, MSO_ID, ENCRYPTED_PASSWORD, REGION_ID, TENANT_ID); verify(openstackClientFactoryMock).createOpenstackV2Client(any(OpenstackAccess.class)); } @Test public void getOpenstackClientWithVersion3() throws Exception { - testedObject.getOpenstackClient(URL_V3, MSO_ID, ENCRYPTED_PASSWORD, CLOUD_REGION_ID, TENANT_ID); + testedObject.getOpenstackClient(URL_V3, MSO_ID, ENCRYPTED_PASSWORD, REGION_ID, TENANT_ID); verify(openstackClientFactoryMock).createOpenstackV3Client(any(OpenstackAccess.class)); } @Test(expected = HeatBridgeException.class) public void getOpenstackClient_unsupportedVersion() throws Exception { - testedObject.getOpenstackClient(URL_WITH_UNSUPPORTED_VERSION, MSO_ID, ENCRYPTED_PASSWORD, CLOUD_REGION_ID, - TENANT_ID); + testedObject.getOpenstackClient(URL_WITH_UNSUPPORTED_VERSION, MSO_ID, ENCRYPTED_PASSWORD, REGION_ID, TENANT_ID); } } diff --git a/adapters/mso-openstack-adapters/src/test/resources/schema.sql b/adapters/mso-openstack-adapters/src/test/resources/schema.sql index 9406bc445d..6b791e789c 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/schema.sql +++ b/adapters/mso-openstack-adapters/src/test/resources/schema.sql @@ -735,6 +735,8 @@ CREATE TABLE `orchestration_flow_reference` ( `SEQ_NO` int(11) NOT NULL, `FLOW_NAME` varchar(200) NOT NULL, `FLOW_VERSION` double NOT NULL, + `SCOPE` varchar(200) DEFAULT NULL, + `ACTION` varchar(200) DEFAULT NULL, `NB_REQ_REF_LOOKUP_ID` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `UK_orchestration_flow_reference` (`COMPOSITE_ACTION`,`FLOW_NAME`,`SEQ_NO`,`NB_REQ_REF_LOOKUP_ID`), @@ -806,6 +808,10 @@ CREATE TABLE `service` ( `OVERALL_DISTRIBUTION_STATUS` varchar(45), `ONAP_GENERATED_NAMING` TINYINT(1) DEFAULT NULL, `NAMING_POLICY` varchar(200) DEFAULT NULL, + `CDS_BLUEPRINT_NAME` varchar(200) DEFAULT NULL, + `CDS_BLUEPRINT_VERSION` varchar(20) DEFAULT NULL, + `CONTROLLER_ACTOR` varchar(200) DEFAULT NULL, + `SKIP_POST_INSTANTIATION_CONFIGURATION` boolean default true, PRIMARY KEY (`MODEL_UUID`), KEY `fk_service__tosca_csar1_idx` (`TOSCA_CSAR_ARTIFACT_UUID`), CONSTRAINT `fk_service__tosca_csar1` FOREIGN KEY (`TOSCA_CSAR_ARTIFACT_UUID`) REFERENCES `tosca_csar` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE @@ -960,6 +966,7 @@ CREATE TABLE `vf_module_customization` ( `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `VF_MODULE_MODEL_UUID` varchar(200) NOT NULL, `VNF_RESOURCE_CUSTOMIZATION_ID` int(13) DEFAULT NULL, + `SKIP_POST_INSTANTIATION_CONFIGURATION` boolean default true, PRIMARY KEY (`ID`), KEY `fk_vf_module_customization__vf_module1_idx` (`VF_MODULE_MODEL_UUID`), KEY `fk_vf_module_customization__heat_env__heat_environment1_idx` (`HEAT_ENVIRONMENT_ARTIFACT_UUID`), @@ -1111,6 +1118,7 @@ CREATE TABLE `vnf_resource_customization` ( `SERVICE_MODEL_UUID` varchar(200) NOT NULL, `NF_DATA_VALID` tinyint(1) DEFAULT '0', `VNFCINSTANCEGROUP_ORDER` varchar(200) default NULL, + `CONTROLLER_ACTOR` varchar(200) DEFAULT NULL, PRIMARY KEY (`ID`), UNIQUE KEY `UK_vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`,`SERVICE_MODEL_UUID`), KEY `fk_vnf_resource_customization__vnf_resource1_idx` (`VNF_RESOURCE_MODEL_UUID`), @@ -1192,6 +1200,7 @@ CREATE TABLE IF NOT EXISTS `pnf_resource_customization` ( `CDS_BLUEPRINT_NAME` varchar(200) DEFAULT NULL, `CDS_BLUEPRINT_VERSION` varchar(20) DEFAULT NULL, `SKIP_POST_INSTANTIATION_CONFIGURATION` boolean default true, + `CONTROLLER_ACTOR` varchar(200) DEFAULT NULL, PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`), KEY `fk_pnf_resource_customization__pnf_resource1_idx` (`PNF_RESOURCE_MODEL_UUID`), CONSTRAINT `fk_pnf_resource_customization__pnf_resource1` FOREIGN KEY (`PNF_RESOURCE_MODEL_UUID`) REFERENCES `pnf_resource` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE |