diff options
Diffstat (limited to 'bpmn')
120 files changed, 610 insertions, 2323 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy index c700fa70e1..dba6a1a2bb 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy @@ -236,7 +236,6 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess serviceInstanceId = (String) execution.getVariable("mso-service-instance-id") } - utils.logContext(requestId, serviceInstanceId) logDebug('Incoming message: ' + System.lineSeparator() + request, isDebugLogEnabled) logDebug('Exited ' + method, isDebugLogEnabled) return request @@ -264,13 +263,6 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess String processKey = getProcessKey(execution); def prefix = execution.getVariable("prefix") - def requestId =getVariable(execution, "mso-request-id") - def serviceInstanceId = getVariable(execution, "mso-service-instance-id") - if(requestId!=null && serviceInstanceId!=null){ - utils.logContext(requestId, serviceInstanceId) - } - - def request = getVariable(execution, prefix + 'Request') if (request == null) { diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy index 0d9b3c5b94..d5b0b31a39 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy @@ -51,13 +51,13 @@ class CatalogDbUtils { private static final Logger logger = LoggerFactory.getLogger( CatalogDbUtils.class); private HttpClientFactory httpClientFactory - private MsoUtils msoUtils - private JsonUtils jsonUtils + private MsoUtils utils + private JsonUtils jsonUtils static private String defaultDbAdapterVersion = "v2" - CatalogDbUtils(HttpClientFactory httpClientFactory, MsoUtils msoUtils, JsonUtils jsonUtils) { + CatalogDbUtils(HttpClientFactory httpClientFactory, JsonUtils jsonUtils) { this.httpClientFactory = httpClientFactory - this.msoUtils = msoUtils + this.utils = new MsoUtils() this.jsonUtils = jsonUtils } @@ -105,7 +105,7 @@ class CatalogDbUtils { } } catch (Exception e) { - msoUtils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) + logger.error("Exception in Querying Catalog DB: " + e.message) throw e } @@ -488,7 +488,7 @@ class CatalogDbUtils { } } catch (Exception e) { - msoUtils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) + logger.error("Exception in Querying Catalog DB: " + e.message) throw e } @@ -500,13 +500,13 @@ class CatalogDbUtils { String encodedString = null try { String basicAuthValueDB = UrnPropertiesReader.getVariable("mso.adapters.db.auth", execution) - msoUtils.log("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB) + logger.debug("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB) - encodedString = msoUtils.getBasicAuth(basicAuthValueDB, UrnPropertiesReader.getVariable("mso.msoKey", execution)) + encodedString = utils.getBasicAuth(basicAuthValueDB, UrnPropertiesReader.getVariable("mso.msoKey", execution)) execution.setVariable("BasicAuthHeaderValueDB",encodedString) } catch (IOException ex) { String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage() - msoUtils.log("ERROR", dataErrorMessage) + logger.error(dataErrorMessage) } return encodedString } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsFactory.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsFactory.groovy index faa0037169..bf7d07cbb3 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsFactory.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsFactory.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018 NOKIA. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -26,6 +28,6 @@ import org.onap.so.client.HttpClientFactory public class CatalogDbUtilsFactory { CatalogDbUtils create() { - return new CatalogDbUtils(new HttpClientFactory(), new MsoUtils(), new JsonUtils()) + return new CatalogDbUtils(new HttpClientFactory(), new JsonUtils()) } } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy index 324cc63649..c2e4ee4454 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy @@ -28,7 +28,6 @@ import java.text.SimpleDateFormat import org.apache.commons.codec.binary.Base64 import org.apache.commons.lang3.StringEscapeUtils -import org.onap.so.bpmn.core.BPMNLogger import org.onap.so.bpmn.core.xml.XmlTool import org.onap.so.logger.MessageEnum import org.slf4j.Logger @@ -89,7 +88,7 @@ class MsoUtils { } return nodes } - + def getNodeXml(xmlInput,element){ return getNodeXml(xmlInput, element, true) } @@ -106,7 +105,7 @@ class MsoUtils { return unescapeNodeContents(nodeToSerialize, nodeAsText) } - + def unescapeNodeContents(NodeChild node, String text) { if (!node.childNodes().hasNext()) { return StringEscapeUtils.unescapeXml(text) @@ -125,7 +124,7 @@ class MsoUtils { } } - + /***** Utilities when using XmlParser *****/ /** @@ -139,12 +138,12 @@ class MsoUtils { nodeAsString = removeXmlPreamble(nodeAsString) return formatXml(nodeAsString) } - + /** * Get the specified child Node of the specified parent. If there are * multiple children of the same name, only the first one is returned. * If there are no children with the specified name, 'null' is returned. - * + * * @param parent Parent Node in which to find a child. * @param childNodeName Name of the child Node to get. * @return the (first) child Node with the specified name or 'null' @@ -158,11 +157,11 @@ class MsoUtils { return nodeList.get(0) } } - + /** * Get the textual value of the specified child Node of the specified parent. * If there are no children with the specified name, 'null' is returned. - * + * * @param parent Parent Node in which to find a child. * @param childNodeName Name of the child Node whose value to get. * @return the textual value of child Node with the specified name or 'null' @@ -176,11 +175,11 @@ class MsoUtils { return childNode.text() } } - + /** * Get all of the child nodes from the specified parent that have the * specified name. The returned NodeList could be empty. - * + * * @param parent Parent Node in which to find children. * @param childNodeName Name of the children to get. * @return a NodeList of all the children from the parent with the specified @@ -192,14 +191,14 @@ class MsoUtils { /***** End of Utilities when using XmlParser *****/ - + /** these are covered under the common function above**/ def getSubscriberName(xmlInput,element){ def rtn=null if(xmlInput!=null){ def xml= new XmlSlurper().parseText(xmlInput) rtn= xml.'**'.find{node->node.name()==element}.text() - } + } return rtn } def getTenantInformation(xmlInput,element){ @@ -227,7 +226,7 @@ class MsoUtils { } return ret } - + def searchMetaDataNode(fxml, searchName, searchValue){ def ret = fxml.'**'.find {it.metaname.text() == searchName && it.metaval.text() == searchValue} if(ret != null){ @@ -235,7 +234,7 @@ class MsoUtils { } return ret } - + // for Trinity L3 add/delete bonding def getPBGFList(isDebugLogEnabled, xmlInput){ log("DEBUG", "getPBGFList: xmlInput " + xmlInput,isDebugLogEnabled) @@ -271,20 +270,18 @@ class MsoUtils { } myNodes.add(XmlUtil.serialize(nodeToAdd)) } - } } - return myNodes }else{ return null } } - + def getPBGFList(xmlInput){ getPBGFList("false", xmlInput) } - + def getMetaVal(node, name){ try{ return node.'**'.find {it.metaname.text() == name}.metaval.text() @@ -295,35 +292,18 @@ class MsoUtils { def log(logmode,logtxt,isDebugLogEnabled="false"){ if ("INFO"==logmode) { - logger.info(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, logtxt, "BPMN"); + logger.info(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), logtxt, "BPMN"); } else if ("WARN"==logmode) { logger.warn ("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(), logtxt, "BPMN", ErrorCode.UnknownError.getValue(), logtxt); } else if ("ERROR"==logmode) { logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), logtxt, "BPMN", ErrorCode.UnknownError.getValue(), logtxt); - } else { - BPMNLogger.debug(isDebugLogEnabled, logtxt); + logger.debug(logtxt); } } - def logContext(requestId, serviceInstanceId){ -// msoLogger.setLogContext(requestId, serviceInstanceId); - } - - def logMetrics(elapsedTime, logtxt){ - -// msoLogger.recordMetricEvent (elapsedTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, -// logtxt, "BPMN", MsoLogger.getServiceName(), null); - } - - def logAudit(logtxt){ - long startTime = System.currentTimeMillis(); - -// msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logtxt); - } - // headers: header - name-value def getHeaderNameValue(xmlInput, nameAttribute){ def rtn=null @@ -333,7 +313,7 @@ class MsoUtils { } return rtn } - + /** * Gets the children of the specified element. */ @@ -352,10 +332,10 @@ class MsoUtils { } return out.toString(); } - + /** * Encodes a value so it can be used inside an XML text element. - * + * * <b>Will double encode</b> * @param s the string to encode * @return the encoded string @@ -363,7 +343,7 @@ class MsoUtils { public static String xmlEscape(Object value) { return XmlTool.encode(value) } - + /** * Removes the preamble, if present, from an XML document. * Also, for historical reasons, this also trims leading and trailing @@ -411,29 +391,29 @@ class MsoUtils { public String formatXml(def xml) { return XmlTool.normalize(xml); } - + // build single elements def buildElements(xmlInput, elementList, parentName) { String var = "" def xmlBuild = "" if (parentName != "") { xmlBuild += "<tns2:"+parentName+">" - } + } if (xmlInput != null) { for (element in elementList) { def xml= new XmlSlurper().parseText(xmlInput) var = xml.'**'.find {it.name() == element} if (var != null) { xmlBuild += "<tns2:"+element+">"+var.toString()+"</tns2:"+element+">" - } + } } } if (parentName != "") { xmlBuild += "</tns2:"+parentName+">" - } + } return xmlBuild } - + // build the Unbounded elements def buildElementsUnbounded(xmlInput, elementList, parentName) { def varParents = "" @@ -461,7 +441,7 @@ class MsoUtils { } return xmlBuildUnbounded } - + // Build l2-homing-information def buildL2HomingInformation(xmlInput) { def elementsL2HomingList = ["evc-name", "topology", "preferred-aic-clli","aic-version"] @@ -471,7 +451,7 @@ class MsoUtils { } return rebuildL2Home } - + // Build internet-evc-access-information def buildInternetEvcAccessInformation(xmlInput) { def elementsInternetEvcAccessInformationList = ["internet-evc-speed-value", "internet-evc-speed-units", "ip-version"] @@ -481,7 +461,7 @@ class MsoUtils { } return rebuildInternetEvcAccess } - + // Build ucpe-vms-service-information def buildUcpeVmsServiceInformation(xmlInput) { def rebuildUcpeVmsServiceInformation = '' @@ -513,7 +493,7 @@ class MsoUtils { log("DEBUG", " rebuildUcpeVmsServiceInformation - " + rebuildUcpeVmsServiceInformation) return rebuildUcpeVmsServiceInformation } - + // Build internet-service-change-details def buildInternetServiceChangeDetails(xmlInput) { def rebuildInternetServiceChangeDetails = "" @@ -543,33 +523,33 @@ class MsoUtils { } } return rebuildInternetServiceChangeDetails - } - - // Build vr-lan + } + + // Build vr-lan def buildVrLan(xmlInput) { - + def rebuildVrLan = '' if (xmlInput != null) { - + rebuildVrLan = "<tns2:vr-lan>" def vrLan = getNodeXml(xmlInput, "vr-lan").drop(38).trim() rebuildVrLan += buildElements(vrLan, ["routing-protocol"], "") - + // vr-lan-interface def rebuildVrLanInterface = "<tns2:vr-lan-interface>" def vrLanInterface = getNodeXml(vrLan, "vr-lan-interface").drop(38).trim() rebuildVrLanInterface += buildVrLanInterfacePartial(vrLanInterface) - + // dhcp def dhcp = getNodeXml(vrLan, "dhcp").drop(38).trim() def rebuildDhcp = buildDhcp(dhcp) rebuildVrLanInterface += rebuildDhcp - + // pat def pat = getNodeXml(vrLan, "pat").drop(38).trim() def rebuildPat = buildPat(pat) rebuildVrLanInterface += rebuildPat - + // nat def rebuildNat = "" try { // optional @@ -579,31 +559,31 @@ class MsoUtils { log("ERROR", " Optional - Exception 'nat' ") } rebuildVrLanInterface += rebuildNat - + // firewall-lite def firewallLite = getNodeXml(vrLan, "firewall-lite").drop(38).trim() def rebuildFirewallLite = buildFirewallLite(firewallLite) rebuildVrLanInterface += rebuildFirewallLite - + // static-routes def rebuildStaticRoutes = "" - try { // optional + try { // optional def staticRoutes = getNodeXml(vrLan, "static-routes").drop(38).trim() rebuildStaticRoutes = buildStaticRoutes(staticRoutes) } catch (Exception e) { log("ERROR", " Optional - Exception 'static-routes' ") } rebuildVrLanInterface += rebuildStaticRoutes - + rebuildVrLan += rebuildVrLanInterface rebuildVrLan += "</tns2:vr-lan-interface>" rebuildVrLan += "</tns2:vr-lan>" - + } log("DEBUG", " rebuildVrLan - " + rebuildVrLan) - return rebuildVrLan + return rebuildVrLan } - + // Build vr-lan-interface def buildVrLanInterfacePartial(xmlInput) { def rebuildingVrLanInterface = '' @@ -632,7 +612,7 @@ class MsoUtils { log("DEBUG", " rebuildingVrLanInterface - " + rebuildingVrLanInterface) return rebuildingVrLanInterface } - + // Build dhcp def buildDhcp(xmlInput) { def rebuildingDhcp = '' @@ -702,10 +682,10 @@ class MsoUtils { log("ERROR", " Optional - Exception DHCP 'v6-dhcp-pools' ") } rebuildingDhcp += "</tns2:dhcp>" - } + } log("DEBUG", " rebuildingDhcp - " + rebuildingDhcp) return rebuildingDhcp - } + } // Build pat def buildPat(xmlInput) { @@ -726,7 +706,7 @@ class MsoUtils { log("DEBUG", " rebuildingPat - " + rebuildingPat) return rebuildingPat } - + // Build nat def buildNat(xmlInput) { def rebuildingNat = '' @@ -744,19 +724,19 @@ class MsoUtils { } log("DEBUG", " rebuildingNat - " + rebuildingNat) return rebuildingNat - } - + } + // Build firewall-lite def buildFirewallLite(xmlInput) { def rebuildingFirewallLite = '' - + if (xmlInput != null) { - + def firewallLiteData = new XmlSlurper().parseText(xmlInput) rebuildingFirewallLite = "<tns2:firewall-lite>" def firewallLiteList = ["stateful-firewall-lite-v4-enabled", "stateful-firewall-lite-v6-enabled"] rebuildingFirewallLite += buildElements(xmlInput, firewallLiteList, "") - + try { // optional def v4FirewallPacketFilters = firewallLiteData.'**'.findAll {it.name() == "v4-firewall-packet-filters"} def v4FirewallPacketFiltersSize = v4FirewallPacketFilters.size() @@ -784,7 +764,7 @@ class MsoUtils { } catch (Exception e) { log("ERROR", " Optional - Exception FIREWALL-LITE 'v4-firewall-packet-filters' ") } - + try { // optional def v6FirewallPacketFilters = firewallLiteData.'**'.findAll {it.name() == "v6-firewall-packet-filters"} def v6FirewallPacketFiltersSize = v6FirewallPacketFilters.size() @@ -817,7 +797,7 @@ class MsoUtils { log("DEBUG", " rebuildingFirewallLite - " + rebuildingFirewallLite) return rebuildingFirewallLite } - + def buildStaticRoutes(xmlInput) { def rebuildingStaticRoutes = '' if (xmlInput != null) { @@ -831,21 +811,21 @@ class MsoUtils { log("DEBUG", " rebuildingStaticRoutes - " + rebuildingStaticRoutes) return rebuildingStaticRoutes } - + public String generateCurrentTimeInUtc(){ final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); sdf.setTimeZone(TimeZone.getTimeZone("UTC")); final String utcTime = sdf.format(new Date()); return utcTime; } - + public String generateCurrentTimeInGMT(){ final SimpleDateFormat sdf = new SimpleDateFormat("E, d MMM yyyy h:m:s z"); sdf.setTimeZone(TimeZone.getTimeZone("GMT")); final String utcTime = sdf.format(new Date()); return utcTime; } - + /** * @param encryptedAuth: encrypted credentials from urn properties @@ -866,7 +846,7 @@ class MsoUtils { throw ex } } - + def encrypt(toEncrypt, msokey){ try { String result = CryptoUtils.encrypt(toEncrypt, msokey); @@ -876,7 +856,7 @@ class MsoUtils { log("ERROR", "Failed to encrypt credentials") } } - + def decrypt(toDecrypt, msokey){ try { String result = CryptoUtils.decrypt(toDecrypt, msokey); @@ -887,7 +867,7 @@ class MsoUtils { throw e } } - + /** * Return URL with qualified host name (if any) or urn mapping * @param String url from urn mapping @@ -906,9 +886,9 @@ class MsoUtils { log("DEBUG", "unable to grab qualified host name, using what's in urn properties for callbackurl. Exception was: " + e.printStackTrace()) } return callbackUrlToUse - + } - + /** * Retrieves text context of the element if the element exists, returns empty string otherwise * @param com.sun.org.apache.xerces.internal.dom.DeferredElementNSImpl element to parse @@ -923,7 +903,7 @@ class MsoUtils { } return text } - + /** * * Find the lowest unused module-index value in a given xml @@ -931,14 +911,14 @@ class MsoUtils { public String getLowestUnusedIndex(String xml) { if (xml == null || xml.isEmpty()) { return "0" - } - def moduleIndexList = getMultNodes(xml, "module-index") - if (moduleIndexList == null || moduleIndexList.size() == 0) { + } + def moduleIndexList = getMultNodes(xml, "module-index") + if (moduleIndexList == null || moduleIndexList.size() == 0) { return "0" } - + def sortedModuleIndexList = moduleIndexList.sort{ a, b -> a as Integer <=> b as Integer} - + for (i in 0..sortedModuleIndexList.size()-1) { if (Integer.parseInt(sortedModuleIndexList[i]) != i) { return i.toString() diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy index cac7a35282..49acf37078 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy @@ -195,7 +195,6 @@ class OofHoming extends AbstractServiceTaskProcessor { try { String response = execution.getVariable("asyncCallbackResponse") logger.debug( "OOF Async Callback Response is: " + response) - utils.logAudit("OOF Async Callback Response is: " + response) oofUtils.validateCallbackResponse(execution, response) String placements = jsonUtil.getJsonValue(response, "solutions.placementSolutions") @@ -378,7 +377,6 @@ class OofHoming extends AbstractServiceTaskProcessor { } execution.setVariable("DHVCS_requestId", requestId) logger.debug( "***** STARTED Homing Subflow for request: " + requestId + " *****") - utils.logAudit("***** STARTED Homing Subflow for request: " + requestId + " *****") } /** diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy index 8b04803050..9d7ce8234b 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy @@ -274,9 +274,6 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { String prefix = execution.getVariable('prefix') String callback = execution.getVariable('SDNCAResponse_MESSAGE') - String requestId = execution.getVariable("mso-request-id"); - String serviceInstanceId = execution.getVariable("mso-service-instance-id") - utils.logContext(requestId, serviceInstanceId) logger.debug("Incoming SDNC Rest Callback is: " + callback) try { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java index 36a6bf37d9..88ed5d37d9 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java @@ -146,7 +146,7 @@ public class BBInputSetupUtils { } public VnfVfmoduleCvnfcConfigurationCustomization getVnfVfmoduleCvnfcConfigurationCustomizationByActionAndIsALaCarteAndRequestScopeAndCloudOwner(String vnfCustomizationUuid, - String vfModuleCustomizationUuid, String cvnfcCustomizationUuid) { + String vfModuleCustomizationUuid, String cvnfcCustomizationUuid){ return catalogDbClient.getVnfVfmoduleCvnfcConfigurationCustomizationByVnfCustomizationUuidAndVfModuleCustomizationUuidAndCvnfcCustomizationUuid(vnfCustomizationUuid, vfModuleCustomizationUuid, cvnfcCustomizationUuid); } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java index d2d321f8f4..260a9420c8 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java @@ -46,7 +46,10 @@ public class ExtractPojosForBB { private static final Logger logger = LoggerFactory.getLogger(ExtractPojosForBB.class); - public <T> T extractByKey(BuildingBlockExecution execution, ResourceKey key, String value) + public <T> T extractByKey(BuildingBlockExecution execution, ResourceKey key) throws BBObjectNotFoundException { + return extractByKey(execution, key, execution.getLookupMap().get(key)); + } + protected <T> T extractByKey(BuildingBlockExecution execution, ResourceKey key, String value) throws BBObjectNotFoundException { Optional<T> result = Optional.empty(); @@ -59,39 +62,39 @@ public class ExtractPojosForBB { result = lookupObjectInList(gBBInput.getCustomer().getServiceSubscription().getServiceInstances(), value); break; case GENERIC_VNF_ID: - serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); result = lookupObjectInList(serviceInstance.getVnfs(), value); break; case NETWORK_ID: - serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); result = lookupObjectInList(serviceInstance.getNetworks(), value); break; case VOLUME_GROUP_ID: - vnf = extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + vnf = extractByKey(execution, ResourceKey.GENERIC_VNF_ID); result = lookupObjectInList(vnf.getVolumeGroups(), value); break; case VF_MODULE_ID: - vnf = extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + vnf = extractByKey(execution, ResourceKey.GENERIC_VNF_ID); result = lookupObjectInList(vnf.getVfModules(), value); break; case ALLOTTED_RESOURCE_ID: - serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); result = lookupObjectInList(serviceInstance.getAllottedResources(), value); break; case CONFIGURATION_ID: - serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); result = lookupObjectInList(serviceInstance.getConfigurations(), value); break; case VPN_ID: - serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); result = lookupObjectInList(gBBInput.getCustomer().getVpnBindings(), value); break; case VPN_BONDING_LINK_ID: - serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); result = lookupObjectInList(serviceInstance.getVpnBondingLinks(),value); break; case INSTANCE_GROUP_ID: - serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); result = lookupObjectInList(serviceInstance.getInstanceGroups(), value); break; default: diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy index d6a7cf0634..d7438f80f9 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018 Nokia. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -51,7 +53,6 @@ class CatalogDbUtilsTest { private static final String RESPONSE_FROM_CATALOG_DB = "{\"serviceVnfs\": [{\"name\": \"service1\"," + "\"vfModules\": [{\"name\": \"module1\", \"isBase\":true, \"initialCount\":1}]}]}" private HttpClientFactory httpClientFactoryMock - private MsoUtils msoUtilsMock private JsonUtils jsonUtilsMock private HttpClient httpClientMock private DelegateExecutionFake executionFake @@ -61,11 +62,10 @@ class CatalogDbUtilsTest { @Before void setUp() { httpClientFactoryMock = mock(HttpClientFactory.class) - msoUtilsMock = mock(MsoUtils.class) jsonUtilsMock = mock(JsonUtils.class) httpClientMock = mock(HttpClient.class) executionFake = new DelegateExecutionFake() - testedObject = new CatalogDbUtils(httpClientFactoryMock, msoUtilsMock, jsonUtilsMock) + testedObject = new CatalogDbUtils(httpClientFactoryMock, jsonUtilsMock) } @Test diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy index 21441b9b73..60385a7990 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy @@ -34,7 +34,6 @@ import org.mockito.ArgumentCaptor import org.mockito.Captor import org.mockito.MockitoAnnotations import org.mockito.runners.MockitoJUnitRunner -import org.onap.so.bpmn.mock.StubResponseAAI import static org.mockito.Mockito.* diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy index 2bd5181c31..6a4d53654b 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy @@ -37,7 +37,6 @@ import org.mockito.MockitoAnnotations import org.mockito.runners.MockitoJUnitRunner import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.mock.FileUtil -import org.onap.so.bpmn.mock.StubResponseAAI import static com.github.tomakehurst.wiremock.client.WireMock.* import static org.mockito.ArgumentMatchers.any diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy index afc180e8a4..75ddca5e98 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy @@ -85,6 +85,7 @@ public class VnfAdapterRestV1Test { <volumeGroupId>8a07b246-155e-4b08-b56e-76e98a3c2d66</volumeGroupId> <volumeGroupStackId>phmaz401me6-vpevre-VOLUMEGROUP/dbd560b6-b03f-4a17-92e7-8942459a60c1</volumeGroupStackId> <cloudSiteId>mtrnj1b</cloudSiteId> + <cloudOwnerId>CloudOwner</cloudOwnerId> <tenantId>cfb5e0a790374c9a98a1c0d2044206a7</tenantId> <volumeGroupCreated>true</volumeGroupCreated> <msoRequest> diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java index d5b5cde99b..bf98648dbc 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java @@ -352,7 +352,7 @@ public class BuildingBlockTestDataSetup{ ServiceInstance serviceInstance = null; try { - serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); } catch(BBObjectNotFoundException e) { serviceInstance = setServiceInstance(); } @@ -370,7 +370,7 @@ public class BuildingBlockTestDataSetup{ Collection collection = null; try { - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); collection = serviceInstance.getCollection(); if (collection == null) { @@ -445,7 +445,7 @@ public class BuildingBlockTestDataSetup{ ServiceInstance serviceInstance = null; try { - serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); } catch(BBObjectNotFoundException e) { serviceInstance = setServiceInstance(); } @@ -490,7 +490,7 @@ public class BuildingBlockTestDataSetup{ ServiceInstance serviceInstance = null; try { - serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); } catch(BBObjectNotFoundException e) { serviceInstance = setServiceInstance(); } @@ -525,7 +525,7 @@ public class BuildingBlockTestDataSetup{ GenericVnf genericVnf = null; try { - genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); } catch(BBObjectNotFoundException e) { genericVnf = setGenericVnf(); } @@ -553,7 +553,7 @@ public class BuildingBlockTestDataSetup{ GenericVnf genericVnf = null; try { - genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); } catch(BBObjectNotFoundException e) { genericVnf = setGenericVnf(); } @@ -617,7 +617,7 @@ public class BuildingBlockTestDataSetup{ ServiceInstance serviceInstance = null; try { - serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); } catch(BBObjectNotFoundException e) { serviceInstance = setServiceInstance(); } @@ -684,7 +684,7 @@ public class BuildingBlockTestDataSetup{ configurations.add(config); ServiceInstance serviceInstance = new ServiceInstance(); try { - serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); } catch(BBObjectNotFoundException e) { serviceInstance = setServiceInstance(); } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResource.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResource.java deleted file mode 100644 index b9a413fc96..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResource.java +++ /dev/null @@ -1,207 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.mock; - -import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; - -import java.util.HashMap; -import java.util.Map; - -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Response; - -import com.github.tomakehurst.wiremock.WireMockServer; -import com.github.tomakehurst.wiremock.client.WireMock; - -/** - * - * Mock Resource which is used to start, stop the WireMock Server - * Also up to 50 mock properties can be added at run-time to change the properties used in transformers such as sdnc_delay in SDNCAdapterMockTransformer - * You can also selectively setup a stub (use reset before setting up), reset all stubs - */ -@Path("/server") -public class MockResource { - - private boolean started = false; - private final Integer defaultPort = 28090; - private WireMockServer wireMockServer = null; - private static Map<String,String> mockProperties = new HashMap<>(); - - public static String getMockProperties(String key) { - return mockProperties.get(key); - } - - private synchronized void initMockServer(int portNumber) { - String path = "src/test/resources/" + "__files/sdncSimResponse.xml"; - path = path.substring(0,path.indexOf("__files/")); - - wireMockServer = new WireMockServer(wireMockConfig().port(portNumber).extensions("org.onap.so.bpmn.mock.SDNCAdapterMockTransformer") - .extensions("org.onap.so.bpmn.mock.SDNCAdapterNetworkTopologyMockTransformer") - .extensions("org.onap.so.bpmn.mock.VnfAdapterCreateMockTransformer") - .extensions("org.onap.so.bpmn.mock.VnfAdapterDeleteMockTransformer") - .extensions("org.onap.so.bpmn.mock.VnfAdapterUpdateMockTransformer") - .extensions("org.onap.so.bpmn.mock.VnfAdapterRollbackMockTransformer") - .extensions("org.onap.so.bpmn.mock.VnfAdapterQueryMockTransformer")); - //.withRootDirectory(path)); - //Mocks were failing - commenting out for now, both mock and transformers seem to work fine - WireMock.configureFor("localhost", portNumber); - wireMockServer.start(); -// StubResponse.setupAllMocks(); - started= true; - } - - public static void main(String [] args) { - MockResource mockresource = new MockResource(); - mockresource.start(28090); - mockresource.reset(); -// mockresource.setupStub("MockCreateTenant"); - } - - /** - * Starts the wiremock server in default port - * @return - */ - @GET - @Path("/start") - @Produces("application/json") - public Response start() { - return startMockServer(defaultPort); - } - - private Response startMockServer(int port) { - if (!started) { - initMockServer(defaultPort); - System.out.println("Started Mock Server in port " + port); - return Response.status(200).entity("Started Mock Server in port " + port).build(); - } else { - return Response.status(200).entity("Mock Server is already running").build(); - } - } - - /** - * Starts the wiremock server in a different port - * @param portNumber - * @return - */ - @GET - @Path("/start/{portNumber}") - @Produces("application/json") - public Response start(@PathParam("portNumber") Integer portNumber) { - if (portNumber == null) portNumber = defaultPort; - return startMockServer(portNumber); - } - - - /** - * Stop the wiremock server - * @return - */ - @GET - @Path("/stop") - @Produces("application/json") - public synchronized Response stop() { - if (wireMockServer.isRunning()) { - wireMockServer.stop(); - started = false; - return Response.status(200).entity("Stopped Mock Server in port ").build(); - } - return Response.status(200).entity("Mock Server is not running").build(); - } - - - /** - * Return list of mock properties - * @return - */ - @GET - @Path("/properties") - @Produces("application/json") - public Response getProperties() { - return Response.status(200).entity(mockProperties).build(); - } - - /** - * Update a particular mock property at run-time - * @param name - * @param value - * @return - */ - @POST - @Path("/properties/{name}/{value}") - public Response updateProperties(@PathParam("name") String name, @PathParam("value") String value) { - if (mockProperties.size() > 50) return Response.serverError().build(); - mockProperties.put(name, value); - return Response.status(200).build(); - } - - /** - * Reset all stubs - * @return - */ - @GET - @Path("/reset") - @Produces("application/json") - public Response reset() { - WireMock.reset(); - return Response.status(200).entity("Wiremock stubs are reset").build(); - } - - - /** - * Setup a stub selectively - * Prior to use, make sure that stub method is available in StubResponse class - * @param methodName - * @return - */ - - // commenting for now until we figure out a way to use new StubResponse classes to setupStubs -// @GET -// @Path("/stub/{methodName}") -// @Produces("application/json") -// public Response setupStub(@PathParam("methodName") String methodName) { -// -// @SuppressWarnings("rawtypes") -// Class params[] = {}; -// Object paramsObj[] = {}; -// -// try { -// Method thisMethod = StubResponse.class.getDeclaredMethod(methodName, params); -// try { -// thisMethod.invoke(StubResponse.class, paramsObj); -// } catch (IllegalAccessException | IllegalArgumentException -// | InvocationTargetException e) { -// return Response.status(200).entity("Error invoking " + methodName ).build(); -// } -// } catch (NoSuchMethodException | SecurityException e) { -// return Response.status(200).entity("Stub " + methodName + " not found...").build(); -// } -// return Response.status(200).entity("Successfully invoked " + methodName).build(); -// } - - - public static Map<String,String> getMockProperties(){ - return mockProperties; - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResourceApplication.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResourceApplication.java deleted file mode 100644 index 6c62920781..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResourceApplication.java +++ /dev/null @@ -1,55 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.mock; - -import java.util.HashSet; -import java.util.Set; - -import javax.ws.rs.ApplicationPath; -import javax.ws.rs.core.Application; - -import org.junit.Ignore; - -/** - * - * JAX RS Application wiring for Mock Resource - */ -@ApplicationPath("/console") -@Ignore -public class MockResourceApplication extends Application { - - private Set<Object> singletons = new HashSet<>(); - private Set<Class<?>> classes = new HashSet<>(); - - public MockResourceApplication() { - singletons.add(new MockResource()); - } - - @Override - public Set<Class<?>> getClasses() { - return classes; - } - - @Override - public Set<Object> getSingletons() { - return singletons; - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterAsyncTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterAsyncTransformer.java deleted file mode 100644 index 8515307394..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterAsyncTransformer.java +++ /dev/null @@ -1,156 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.mock; - -import javax.ws.rs.core.UriBuilder; - -import org.onap.so.client.HttpClient; -import org.onap.so.client.HttpClientFactory; -import org.onap.so.utils.TargetEntity; - -import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; -import com.github.tomakehurst.wiremock.common.BinaryFile; -import com.github.tomakehurst.wiremock.common.FileSource; -import com.github.tomakehurst.wiremock.extension.Parameters; -import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; -import com.github.tomakehurst.wiremock.http.Request; -import com.github.tomakehurst.wiremock.http.ResponseDefinition; - -/** - * - * Simulates SDNC Adapter Callback response - * - */ -public class SDNCAdapterAsyncTransformer extends ResponseDefinitionTransformer { - - private String syncResponse; - private String callbackResponseWrapper; - - public SDNCAdapterAsyncTransformer() { - syncResponse = FileUtil.readResourceFile("__files/StandardSDNCSynchResponse.xml"); - callbackResponseWrapper = FileUtil.readResourceFile("__files/sdncCallbackSoapWrapper.xml"); - } - - @Override - public String getName() { - return "sdnc-adapter-vf-module-assign"; - } - - /** - * Grab the incoming request xml,extract the request id and replace the stub response with the incoming request id - * so that callback response can be correlated - * - * Mock Resource can be used to add dynamic properties. If sdnc_delay is not in the list by default waits for 300ms before - * the callback response is sent - */ - @Override - public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, - FileSource fileSource, Parameters parameters) { - - String requestBody = request.getBodyAsString(); - - String callbackUrl = requestBody.substring(requestBody.indexOf("<sdncadapter:CallbackUrl>")+25, requestBody.indexOf("</sdncadapter:CallbackUrl>")); - String requestId = requestBody.substring(requestBody.indexOf("<sdncadapter:RequestId>")+23, requestBody.indexOf("</sdncadapter:RequestId>")); - - System.out.println("responseDefinition: " + responseDefinition); - - // For this mock, the mapped response body is the Async callback (since the sync response is generic for all requests) - String sdncResponse = responseDefinition.getBody(); - System.out.println("sdncResponse:" + sdncResponse); - - if (sdncResponse == null) { - // Body wasn't specified. Check for a body file - String bodyFileName = responseDefinition.getBodyFileName(); - System.out.println("bodyFileName" + bodyFileName); - if (bodyFileName != null) { - System.out.println("fileSource Class: " + fileSource.getClass().getName()); - BinaryFile bodyFile = fileSource.getBinaryFileNamed(bodyFileName); - byte[] responseFile = bodyFile.readContents(); - sdncResponse = new String(responseFile); - System.out.println("sdncResponse(2):" + sdncResponse); - } - } - - // Next substitute the SDNC response into the callbackResponse (SOAP wrapper). - // Also, replace the request ID wherever it appears - String callbackResponse = callbackResponseWrapper.replace("SDNC_RESPONSE_DATA", sdncResponse).replaceAll("SDNC_REQUEST_ID", requestId); - - Object sdncDelay = MockResource.getMockProperties().get("sdnc_delay"); - int delay = 2000; - if (sdncDelay != null) { - delay = Integer.parseInt(sdncDelay.toString()); - } - - //Kick off callback thread - System.out.println("callback Url:" + callbackUrl + ":delay:" + delay); - CallbackResponseThread calbackResponseThread = new CallbackResponseThread(callbackUrl,callbackResponse, delay); - calbackResponseThread.start(); - - //return 200 OK with empty body - return ResponseDefinitionBuilder - .like(responseDefinition).but() - .withStatus(200).withBody(syncResponse).withHeader("Content-Type", "text/xml") - .build(); - } - - @Override - public boolean applyGlobally() { - return false; - } - - /** - * - * Callback response thread which sends the callback response asynchronously - * - */ - private class CallbackResponseThread extends Thread { - - private String callbackUrl; - private String payLoad; - private int delay; - - public CallbackResponseThread(String callbackUrl, String payLoad, int delay) { - this.callbackUrl = callbackUrl; - this.payLoad = payLoad; - this.delay = delay; - } - - public void run () { - try { - //Delay sending callback response - sleep(delay); - } catch (InterruptedException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - try { - HttpClient client = new HttpClientFactory().newTextXmlClient( - UriBuilder.fromUri(callbackUrl).build().toURL(), - TargetEntity.SDNC_ADAPTER); - client.post(payLoad); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java deleted file mode 100644 index 11788be76e..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java +++ /dev/null @@ -1,148 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Modifications Copyright (c) 2019 Samsung - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.mock; - -import javax.ws.rs.core.UriBuilder; - -import org.onap.so.client.HttpClient; -import org.onap.so.client.HttpClientFactory; -import org.onap.so.utils.TargetEntity; - -import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; -import com.github.tomakehurst.wiremock.common.FileSource; -import com.github.tomakehurst.wiremock.extension.Parameters; -import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; -import com.github.tomakehurst.wiremock.http.Request; -import com.github.tomakehurst.wiremock.http.ResponseDefinition; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - * Simulates SDNC Adapter Callback response - * - */ -public class SDNCAdapterMockTransformer extends ResponseDefinitionTransformer { - - private static final Logger logger = LoggerFactory.getLogger(SDNCAdapterMockTransformer.class); - private String callbackResponse; - private String requestId; - - public SDNCAdapterMockTransformer() { - callbackResponse = FileUtil.readResourceFile("__files/sdncSimResponse.xml"); - } - - public SDNCAdapterMockTransformer(String requestId) { - this.requestId = requestId; - } - - @Override - public String getName() { - return "sdnc-adapter-transformer"; - } - - /** - * Grab the incoming request xml,extract the request id and replace the stub response with the incoming request id - * so that callback response can be correlated - * - * Mock Resource can be used to add dynamic properties. If sdnc_delay is not in the list by default waits for 300ms before - * the callback response is sent - */ - @Override - public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, - FileSource fileSource, Parameters parameters) { - String requestBody = request.getBodyAsString(); - - String callbackUrl = requestBody.substring(requestBody.indexOf("<sdncadapter:CallbackUrl>")+25, requestBody.indexOf("</sdncadapter:CallbackUrl>")); - String requestId = requestBody.substring(requestBody.indexOf("<sdncadapter:RequestId>")+23, requestBody.indexOf("</sdncadapter:RequestId>")); - - callbackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); - logger.info("callbackResponse:" + callbackResponse); - - if (this.requestId != null) { - callbackResponse = callbackResponse.replace(this.requestId, requestId); - } else { - callbackResponse = callbackResponse.replace("testRequestId", requestId); - } - - - Object sdncDelay = MockResource.getMockProperties().get("sdnc_delay"); - int delay = 300; - if (sdncDelay != null) { - delay = Integer.parseInt(sdncDelay.toString()); - } - - //Kick off callback thread - logger.info("callback Url:" + callbackUrl + ":delay:" + delay); - CallbackResponseThread calbackResponseThread = new CallbackResponseThread(callbackUrl,callbackResponse, delay); - calbackResponseThread.start(); - - //return 200 OK with empty body - return ResponseDefinitionBuilder - .like(responseDefinition).but() - .withStatus(200).withBody("").withHeader("Content-Type", "text/xml") - .build(); - } - - @Override - public boolean applyGlobally() { - return false; - } - - /** - * - * Callback response thread which sends the callback response asynchronously - * - */ - private class CallbackResponseThread extends Thread { - - private String callbackUrl; - private String payLoad; - private int delay; - - public CallbackResponseThread(String callbackUrl, String payLoad, int delay) { - this.callbackUrl = callbackUrl; - this.payLoad = payLoad; - this.delay = delay; - } - - public void run () { - try { - //Delay sending callback response - sleep(delay); - } catch (InterruptedException e1) { - logger.debug("Exception :", e1); - } - logger.debug("Sending callback response:" + callbackUrl); - try { - HttpClient client = new HttpClientFactory().newTextXmlClient( - UriBuilder.fromUri(callbackUrl).build().toURL(), - TargetEntity.SDNC_ADAPTER); - client.post(payLoad); - } catch (Exception e) { - logger.debug("Exception :", e); - } - } - - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java deleted file mode 100644 index 344c3b521d..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java +++ /dev/null @@ -1,141 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Modifications Copyright (c) 2019 Samsung - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.mock; - -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriBuilder; - -import org.onap.so.client.HttpClient; -import org.onap.so.client.HttpClientFactory; -import org.onap.so.utils.TargetEntity; - -import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; -import com.github.tomakehurst.wiremock.common.FileSource; -import com.github.tomakehurst.wiremock.extension.Parameters; -import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; -import com.github.tomakehurst.wiremock.http.Request; -import com.github.tomakehurst.wiremock.http.ResponseDefinition; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class SDNCAdapterNetworkTopologyMockTransformer extends ResponseDefinitionTransformer { - - private static final Logger logger = LoggerFactory.getLogger(SDNCAdapterNetworkTopologyMockTransformer.class); - - private String callbackResponse; - private String requestId; - - public SDNCAdapterNetworkTopologyMockTransformer() { - callbackResponse = ""; // FileUtil.readResourceFile("__files/sdncDeleteNetworkTopologySimResponse.xml"); - } - - public SDNCAdapterNetworkTopologyMockTransformer(String requestId) { - this.requestId = requestId; - } - - @Override - public String getName() { - return "network-topology-operation-transformer"; - } - - @Override - public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, FileSource fileSource, Parameters parameters) { - String requestBody = request.getBodyAsString(); - - String callbackUrl = requestBody.substring(requestBody.indexOf("<sdncadapter:CallbackUrl>")+25, requestBody.indexOf("</sdncadapter:CallbackUrl>")); - String requestId = requestBody.substring(requestBody.indexOf("<sdncadapter:RequestId>")+23, requestBody.indexOf("</sdncadapter:RequestId>")); - logger.info("request callbackUrl : " + callbackUrl); - logger.info("request requestId : " + requestId); - - logger.info("file path/name : " + responseDefinition.getBodyFileName()); - callbackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); - // extract Response responseRequestId - String responseRequestId = callbackResponse.substring(callbackResponse.indexOf("<RequestId>")+11, callbackResponse.indexOf("</RequestId>")); - logger.info("response requestId: " + responseRequestId); - logger.info("callbackResponse (before): " + callbackResponse); - callbackResponse = callbackResponse.replace(responseRequestId, requestId); - if (this.requestId != null) { - callbackResponse = callbackResponse.replace(this.requestId, requestId); - } else { - callbackResponse = callbackResponse.replace(responseRequestId, requestId); - } - logger.info("callbackResponse (after):" + callbackResponse); - - Object sdncDelay = MockResource.getMockProperties().get("sdnc_delay"); - int delay = 300; - if (sdncDelay != null) { - delay = Integer.parseInt(sdncDelay.toString()); - } - - //Kick off callback thread - logger.info("(NetworkTopologyMockTransformer) callback Url:" + callbackUrl + ":delay:" + delay); - CallbackResponseThread calbackResponseThread = new CallbackResponseThread(callbackUrl,callbackResponse, delay); - calbackResponseThread.start(); - - //return 200 OK with body - return ResponseDefinitionBuilder - .like(responseDefinition).but() - .withStatus(200).withBody(callbackResponse).withHeader("Content-Type", "text/xml") - .build(); - } - - @Override - public boolean applyGlobally() { - return false; - } - - private class CallbackResponseThread extends Thread { - - private String callbackUrl; - private String payLoad; - private int delay; - - public CallbackResponseThread(String callbackUrl, String payLoad, int delay) { - this.callbackUrl = callbackUrl; - this.payLoad = payLoad; - this.delay = delay; - } - - public void run () { - try { - //Delay sending callback response - sleep(delay); - } catch (InterruptedException e1) { - // TODO Auto-generated catch block - logger.debug("Exception :", e1); - } - logger.debug("Sending callback response to url: {}", callbackUrl); - try { - HttpClient client = new HttpClientFactory() - .newTextXmlClient(UriBuilder.fromUri(callbackUrl).build().toURL(), TargetEntity.SDNC_ADAPTER); - Response response = client.post(payLoad); - logger.debug("Successfully posted callback? Status: {}", response.getStatus()); - } catch (Exception e) { - // TODO Auto-generated catch block - logger.debug("catch error in - request.post() "); - logger.debug("Exception :", e); - } - } - - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSDNCAdapter.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSDNCAdapter.java index e0c51b794c..66dc1f9910 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSDNCAdapter.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSDNCAdapter.java @@ -80,29 +80,6 @@ public class StubResponseSDNCAdapter { .withBodyFile(responseFile))); } - public static void mockSDNCAdapterSimulator(String responseFile) { - MockResource mockResource = new MockResource(); - mockResource.updateProperties("sdnc_delay", "300"); - stubFor(post(urlEqualTo("/SDNCAdapter")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "application/soap+xml") - .withTransformers("sdnc-adapter-transformer") - .withBodyFile(responseFile))); - } - - public static void mockSDNCAdapterSimulator(String responseFile, String requestContaining) { - MockResource mockResource = new MockResource(); - mockResource.updateProperties("sdnc_delay", "300"); - stubFor(post(urlEqualTo("/SDNCAdapter")) - .withRequestBody(containing(requestContaining)) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "application/soap+xml") - .withTransformers("sdnc-adapter-transformer") - .withBodyFile(responseFile))); - } - public static void mockSDNCAdapterRest() { stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services")) .willReturn(aResponse() @@ -133,17 +110,4 @@ public class StubResponseSDNCAdapter { .withHeader("Content-Type", "application/json"))); } - public static void mockSDNCAdapterTopology(String responseFile, String requestContaining) { - MockResource mockResource = new MockResource(); - mockResource.updateProperties("sdnc_delay", "300"); - stubFor(post(urlEqualTo("/SDNCAdapter")) - .withRequestBody(containing(requestContaining)) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withTransformers("network-topology-operation-transformer") - .withBodyFile(responseFile))); - } - - } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseVNFAdapter.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseVNFAdapter.java index 91ecbd23b4..75283515af 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseVNFAdapter.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseVNFAdapter.java @@ -53,29 +53,6 @@ public class StubResponseVNFAdapter { .willReturn(aResponse() .withStatus(500))); } - - public static void mockVNFAdapterTransformer(String transformer, String responseFile) { - MockResource mockResource = new MockResource(); - mockResource.updateProperties("vnf_delay", "300"); - stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "application/soap+xml") - .withTransformers(transformer) - .withBodyFile(responseFile))); - } - - public static void mockVNFAdapterTransformer(String transformer, String responseFile, String requestContaining) { - MockResource mockResource = new MockResource(); - mockResource.updateProperties("vnf_delay", "300"); - stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync")) - .withRequestBody(containing(requestContaining)) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "application/soap+xml") - .withTransformers(transformer) - .withBodyFile(responseFile))); - } public static void mockVNFPost(String vfModuleId, int statusCode, String vnfId) { stubFor(post(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules" + vfModuleId)) diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterAsyncTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterAsyncTransformer.java deleted file mode 100644 index e190535e7e..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterAsyncTransformer.java +++ /dev/null @@ -1,167 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.mock; - -import javax.ws.rs.core.UriBuilder; - -import org.onap.so.client.HttpClient; -import org.onap.so.client.HttpClientFactory; -import org.onap.so.utils.TargetEntity; - -import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; -import com.github.tomakehurst.wiremock.common.BinaryFile; -import com.github.tomakehurst.wiremock.common.FileSource; -import com.github.tomakehurst.wiremock.extension.Parameters; -import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; -import com.github.tomakehurst.wiremock.http.Request; -import com.github.tomakehurst.wiremock.http.ResponseDefinition; - -/** - * - * Simulates VNF Adapter Asynch Callback response. - * This should work for any of the operations. - * - * This transformer uses the mapped message as the asynchronous response. - * By definition, the async API sends a 202 (with no body) in the sync response. - * - */ -public class VnfAdapterAsyncTransformer extends ResponseDefinitionTransformer { - - public VnfAdapterAsyncTransformer() { - } - - @Override - public String getName() { - return "vnf-adapter-async"; - } - - /** - * Grab the incoming request, extract properties to be copied to the response - * (request id, vnf id, vf module ID, message ID). Then fetch the actual response - * body from its FileSource, make the replacements. - * - * The sync response is an empty 202 response. - * The transformed mapped response file is sent asynchronously after a delay. - * - * Mock Resource can be used to add dynamic properties. If vnf_delay is not in the list by - * default waits for 5s before the callback response is sent - */ - @Override - public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, - FileSource fileSource, Parameters parameters) { - - String requestBody = request.getBodyAsString(); - - // Note: Should recognize both XML and JSON. But current BPMN uses XML. - String notificationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>")); - - String vnfId = requestBody.substring(requestBody.indexOf("<vnfId>")+7, requestBody.indexOf("</vnfId>")); - String vfModuleId = requestBody.substring(requestBody.indexOf("<vfModuleId>")+12, requestBody.indexOf("</vfModuleId>")); - String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>")); - String requestId = requestBody.substring(requestBody.indexOf("<requestId>")+11, requestBody.indexOf("</requestId>")); - - System.out.println("responseDefinition: " + responseDefinition); - - // For this mock, the mapped response body is the Async callback (since the sync response is generic for all requests) - String vnfResponse = responseDefinition.getBody(); - System.out.println("VNF Response:" + vnfResponse); - - if (vnfResponse == null) { - // Body wasn't specified. Check for a body file - String bodyFileName = responseDefinition.getBodyFileName(); - System.out.println("bodyFileName" + bodyFileName); - if (bodyFileName != null) { - System.out.println("fileSource Class: " + fileSource.getClass().getName()); - BinaryFile bodyFile = fileSource.getBinaryFileNamed(bodyFileName); - byte[] responseFile = bodyFile.readContents(); - vnfResponse = new String(responseFile); - System.out.println("vnfResponse(2):" + vnfResponse); - } - } - - // Transform the SDNC response to escape < and > - vnfResponse = vnfResponse.replaceAll ("VNF_ID", vnfId); - vnfResponse = vnfResponse.replaceAll ("VF_MODULE_ID", vfModuleId); - vnfResponse = vnfResponse.replaceAll ("REQUEST_ID", requestId); - vnfResponse = vnfResponse.replaceAll ("MESSAGE_ID", messageId); - - Object vnfDelay = MockResource.getMockProperties().get("vnf_delay"); - int delay = 5000; - if (vnfDelay != null) { - delay = Integer.parseInt(vnfDelay.toString()); - } - - //Kick off callback thread - System.out.println("notification Url:" + notificationUrl + ":delay:" + delay); - CallbackResponseThread calbackResponseThread = new CallbackResponseThread(notificationUrl,vnfResponse, delay); - calbackResponseThread.start(); - - //return 200 OK with empty body - return ResponseDefinitionBuilder - .like(responseDefinition).but() - .withStatus(202).withBody("").withHeader("Content-Type", "text/xml") - .build(); - } - - @Override - public boolean applyGlobally() { - return false; - } - - /** - * - * Callback response thread which sends the callback response asynchronously - * - */ - private class CallbackResponseThread extends Thread { - - private String callbackUrl; - private String payLoad; - private int delay; - - public CallbackResponseThread(String callbackUrl, String payLoad, int delay) { - this.callbackUrl = callbackUrl; - this.payLoad = payLoad; - this.delay = delay; - } - - public void run () { - try { - //Delay sending callback response - sleep(delay); - } catch (InterruptedException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - - try { - HttpClient client = new HttpClientFactory().newTextXmlClient( - UriBuilder.fromUri(callbackUrl).build().toURL(), - TargetEntity.VNF_ADAPTER); - client.post(payLoad); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java deleted file mode 100644 index 362d9508d3..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java +++ /dev/null @@ -1,153 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Modifications Copyright (c) 2019 Samsung - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.mock; - -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriBuilder; - -import org.onap.so.client.HttpClient; -import org.onap.so.client.HttpClientFactory; -import org.onap.so.utils.TargetEntity; - -import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; -import com.github.tomakehurst.wiremock.common.FileSource; -import com.github.tomakehurst.wiremock.extension.Parameters; -import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; -import com.github.tomakehurst.wiremock.http.Request; -import com.github.tomakehurst.wiremock.http.ResponseDefinition; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Please describe the VnfAdapterCreateMockTransformer.java class - * - */ -public class VnfAdapterCreateMockTransformer extends ResponseDefinitionTransformer { - - private static final Logger logger = LoggerFactory.getLogger(VnfAdapterCreateMockTransformer.class); - - private String notifyCallbackResponse; - private String ackResponse; - - public VnfAdapterCreateMockTransformer() { - notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfCreateSimResponse.xml"); // default response - } - - @Override - public String getName() { - return "vnf-adapter-create-transformer"; - } - - @Override - public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, - FileSource fileSource, Parameters parameters) { - - String requestBody = request.getBodyAsString(); - - String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>")); - String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>")); - String responseMessageId = ""; - String updatedResponse = ""; - - try { - // try supplied response file (if any) - System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName()); - ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); - notifyCallbackResponse = ackResponse; - responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>")); - updatedResponse = ackResponse.replace(responseMessageId, messageId); - } catch (Exception ex) { - logger.debug("Exception :",ex); - System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfCreateSimResponse.xml'"); - responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>")); - updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId); - } - - logger.info("response (mock) messageId : {}", responseMessageId); - logger.info("request (replacement) messageId: {}", messageId); - - logger.info("vnf Response (before): {}", notifyCallbackResponse); - logger.info("vnf Response (after): {}", updatedResponse); - - Object vnfDelay = MockResource.getMockProperties().get("vnf_delay"); - int delay = 300; - if (vnfDelay != null) { - delay = Integer.parseInt(vnfDelay.toString()); - } - - //Kick off callback thread - logger.info("VnfAdapterCreateMockTransformer notficationUrl: {} :delay: {}", notficationUrl, delay); - CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay); - callbackResponseThread.start(); - - return ResponseDefinitionBuilder - .like(responseDefinition).but() - .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml") - .build(); - - } - - @Override - public boolean applyGlobally() { - return false; - } - - private class CallbackResponseThread extends Thread { - - private String callbackUrl; - private String payLoad; - private int delay; - - public CallbackResponseThread(String callbackUrl, String payLoad, int delay) { - this.callbackUrl = callbackUrl; - this.payLoad = payLoad; - this.delay = delay; - } - - @SuppressWarnings("deprecation") - public void run () { - try { - //Delay sending callback response - sleep(delay); - } catch (InterruptedException e1) { - // TODO Auto-generated catch block - logger.debug("Exception :",e1); - } - logger.debug("Sending callback response to url: {}", callbackUrl); - try { - HttpClient client = new HttpClientFactory().newTextXmlClient( - UriBuilder.fromUri(callbackUrl).build().toURL(), - TargetEntity.VNF_ADAPTER); - Response response = client.post(payLoad); - logger.debug("Successfully posted callback? Status: {}", response.getStatus()); - } catch (Exception e) { - // TODO Auto-generated catch block - logger.debug("catch error in - request.post() "); - logger.debug("Exception :", e); - } - } - - } - - -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java deleted file mode 100644 index b67f3dcedd..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java +++ /dev/null @@ -1,149 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Modifications Copyright (c) 2019 Samsung - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.mock; - -import javax.ws.rs.core.UriBuilder; - -import org.onap.so.client.HttpClient; -import org.onap.so.client.HttpClientFactory; -import org.onap.so.utils.TargetEntity; - -import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; -import com.github.tomakehurst.wiremock.common.FileSource; -import com.github.tomakehurst.wiremock.extension.Parameters; -import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; -import com.github.tomakehurst.wiremock.http.Request; -import com.github.tomakehurst.wiremock.http.ResponseDefinition; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Please describe the VnfAdapterCreateMockTransformer.java class - * - */ -public class VnfAdapterDeleteMockTransformer extends ResponseDefinitionTransformer { - - private static final Logger logger = LoggerFactory.getLogger(VnfAdapterDeleteMockTransformer.class); - - private String notifyCallbackResponse; - private String ackResponse; - - public VnfAdapterDeleteMockTransformer() { - notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfDeleteSimResponse.xml"); - } - - @Override - public String getName() { - return "vnf-adapter-delete-transformer"; - } - - @Override - public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, - FileSource fileSource, Parameters parameters) { - - String requestBody = request.getBodyAsString(); - - String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>")); - String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>")); - String responseMessageId = ""; - String updatedResponse = ""; - - try { - // try supplied response file (if any) - logger.info(" Supplied fileName: {}", responseDefinition.getBodyFileName()); - ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); - notifyCallbackResponse = ackResponse; - responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>")); - updatedResponse = ackResponse.replace(responseMessageId, messageId); - } catch (Exception ex) { - logger.debug("Exception :",ex); - logger.info(" ******* Use default response file in '__files/vnfAdapterMocks/vnfDeleteSimResponse.xml'"); - responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>")); - updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId); - } - - logger.info("response (mock) messageId : {}", responseMessageId); - logger.info("request (replacement) messageId: {}", messageId); - - logger.info("vnf Response (before):{}", notifyCallbackResponse); - logger.info("vnf Response (after):{}", updatedResponse); - - Object vnfDelay = MockResource.getMockProperties().get("vnf_delay"); - int delay = 300; - if (vnfDelay != null) { - delay = Integer.parseInt(vnfDelay.toString()); - } - - //Kick off callback thread - logger.info("VnfAdapterDeleteMockTransformer notficationUrl: {} :delay: {}", notficationUrl, delay); - CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay); - callbackResponseThread.start(); - - return ResponseDefinitionBuilder - .like(responseDefinition).but() - .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml") - .build(); - - } - - @Override - public boolean applyGlobally() { - return false; - } - - private class CallbackResponseThread extends Thread { - - private String callbackUrl; - private String payLoad; - private int delay; - - public CallbackResponseThread(String callbackUrl, String payLoad, int delay) { - this.callbackUrl = callbackUrl; - this.payLoad = payLoad; - this.delay = delay; - } - - @SuppressWarnings("deprecation") - public void run () { - try { - //Delay sending callback response - sleep(delay); - } catch (InterruptedException e1) { - // TODO Auto-generated catch block - logger.debug("Exception :",e1); - } - - try { - HttpClient client = new HttpClientFactory().newTextXmlClient( - UriBuilder.fromUri(callbackUrl).build().toURL(), - TargetEntity.VNF_ADAPTER); - client.post(payLoad); - } catch (Exception e) { - // TODO Auto-generated catch block - logger.info("catch error in - request.post() "); - logger.debug("Exception :",e); - } - } - - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java deleted file mode 100644 index 48ced35810..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java +++ /dev/null @@ -1,158 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Modifications Copyright (c) 2019 Samsung - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.mock; - - -import javax.ws.rs.core.UriBuilder; - -import org.onap.so.client.HttpClient; -import org.onap.so.client.HttpClientFactory; -import org.onap.so.utils.TargetEntity; - -import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; -import com.github.tomakehurst.wiremock.common.FileSource; -import com.github.tomakehurst.wiremock.extension.Parameters; -import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; -import com.github.tomakehurst.wiremock.http.Request; -import com.github.tomakehurst.wiremock.http.ResponseDefinition; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Please describe the VnfAdapterQueryMockTransformer.java class - * - */ - - -public class VnfAdapterQueryMockTransformer extends ResponseDefinitionTransformer{ - - private static final Logger logger = LoggerFactory.getLogger(VnfAdapterQueryMockTransformer - .class); - - private String notifyCallbackResponse; - private String ackResponse; - private String messageId; - - public VnfAdapterQueryMockTransformer() { - notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfQuerySimResponse.xml"); - } - - public VnfAdapterQueryMockTransformer(String messageId) { - this.messageId = messageId; - } - - @Override - public String getName() { - return "vnf-adapter-query-transformer"; - } - - @Override - public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, - FileSource fileSource, Parameters parameters) { - - String requestBody = request.getBodyAsString(); - - String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>")); - String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>")); - - String responseMessageId = ""; - String updatedResponse = ""; - - try { - // try supplied response file (if any) - logger.info(" Supplied fileName: {}", responseDefinition.getBodyFileName()); - ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); - notifyCallbackResponse = ackResponse; - responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>")); - updatedResponse = ackResponse.replace(responseMessageId, messageId); - } catch (Exception ex) { - logger.debug("Exception :",ex); - logger.info(" ******* Use default response file in '__files/vnfAdapterMocks/vnfQuerySimResponse.xml'"); - responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>")); - updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId); - } - - logger.info("response (mock) messageId : {}", responseMessageId); - logger.info("request (replacement) messageId: {}", messageId); - - logger.info("vnf Response (before):{}", notifyCallbackResponse); - logger.info("vnf Response (after):{}", updatedResponse); - - - Object vnfDelay = MockResource.getMockProperties().get("vnf_delay"); - int delay = 300; - if (vnfDelay != null) { - delay = Integer.parseInt(vnfDelay.toString()); - } - - //Kick off callback thread - logger.info("VnfAdapterQueryMockTransformer notficationUrl: {}:delay: {}", notficationUrl, delay); - CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay); - logger.info("Inside Callback" ); - callbackResponseThread.start(); - - return ResponseDefinitionBuilder - .like(responseDefinition).but() - .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml") - .build(); - } - - @Override - public boolean applyGlobally() { - return false; - } - - private class CallbackResponseThread extends Thread { - - private String callbackUrl; - private String payLoad; - private int delay; - - public CallbackResponseThread(String callbackUrl, String payLoad, int delay) { - this.callbackUrl = callbackUrl; - this.payLoad = payLoad; - this.delay = delay; - } - - public void run () { - try { - //Delay sending callback response - sleep(delay); - } catch (InterruptedException e1) { - logger.debug("Exception :",e1); - } - - try { - HttpClient client = new HttpClientFactory().newTextXmlClient( - UriBuilder.fromUri(callbackUrl).build().toURL(), - TargetEntity.VNF_ADAPTER); - client.post(payLoad); - } catch (Exception e) { - logger.debug("Exception :",e); - } - } - - } - - -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java deleted file mode 100644 index edf05422d1..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java +++ /dev/null @@ -1,151 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Modifications Copyright (c) 2019 Samsung - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.mock; - -import javax.ws.rs.core.UriBuilder; - -import org.onap.so.client.HttpClient; -import org.onap.so.client.HttpClientFactory; -import org.onap.so.utils.TargetEntity; - -import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; -import com.github.tomakehurst.wiremock.common.FileSource; -import com.github.tomakehurst.wiremock.extension.Parameters; -import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; -import com.github.tomakehurst.wiremock.http.Request; -import com.github.tomakehurst.wiremock.http.ResponseDefinition; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Please describe the VnfAdapterCreateMockTransformer.java class - * - */ -public class VnfAdapterRollbackMockTransformer extends ResponseDefinitionTransformer { - - private static final Logger logger = LoggerFactory.getLogger(VnfAdapterRollbackMockTransformer.class); - - private String notifyCallbackResponse; - private String ackResponse; - private String messageId; - - public VnfAdapterRollbackMockTransformer() { - notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfRollbackSimResponse.xml"); - } - - public VnfAdapterRollbackMockTransformer(String messageId) { - this.messageId = messageId; - } - - @Override - public String getName() { - return "vnf-adapter-rollback-transformer"; - } - - @Override - public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, - FileSource fileSource, Parameters parameters) { - - String requestBody = request.getBodyAsString(); - - String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>")); - String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>")); - String responseMessageId = ""; - String updatedResponse = ""; - - try { - // try supplied response file (if any) - logger.info(" Supplied fileName: {}", responseDefinition.getBodyFileName()); - ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); - notifyCallbackResponse = ackResponse; - responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>")); - updatedResponse = ackResponse.replace(responseMessageId, messageId); - } catch (Exception ex) { - logger.debug("Exception :",ex); - logger.info(" ******* Use default response file in '__files/vnfAdapterMocks/vnfRollbackSimResponse.xml'"); - responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>")); - updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId); - } - - logger.info("response (mock) messageId : {}", responseMessageId); - logger.info("request (replacement) messageId: {}", messageId); - - logger.info("vnf Response (before):{}", notifyCallbackResponse); - logger.info("vnf Response (after):{}", updatedResponse); - - Object vnfDelay = MockResource.getMockProperties().get("vnf_delay"); - int delay = 300; - if (vnfDelay != null) { - delay = Integer.parseInt(vnfDelay.toString()); - } - - //Kick off callback thread - logger.info("VnfAdapterRollbackMockTransformer notficationUrl: {} :delay: {}", notficationUrl, delay); - CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay); - callbackResponseThread.start(); - - return ResponseDefinitionBuilder - .like(responseDefinition).but() - .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml") - .build(); - - } - - @Override - public boolean applyGlobally() { - return false; - } - - private class CallbackResponseThread extends Thread { - - private String callbackUrl; - private String payLoad; - private int delay; - - public CallbackResponseThread(String callbackUrl, String payLoad, int delay) { - this.callbackUrl = callbackUrl; - this.payLoad = payLoad; - this.delay = delay; - } - - public void run () { - try { - //Delay sending callback response - sleep(delay); - } catch (InterruptedException e1) { - logger.debug("Exception :",e1); - } - - try { - HttpClient client = new HttpClientFactory().newTextXmlClient( - UriBuilder.fromUri(callbackUrl).build().toURL(), - TargetEntity.VNF_ADAPTER); - client.post(payLoad); - } catch (Exception e) { - logger.info("catch error in - request.post() "); - logger.debug("Exception :", e); - } - } - - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java deleted file mode 100644 index 5693877574..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java +++ /dev/null @@ -1,152 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Modifications Copyright (c) 2019 Samsung - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.mock; - -import javax.ws.rs.core.UriBuilder; - -import org.onap.so.client.HttpClient; -import org.onap.so.client.HttpClientFactory; -import org.onap.so.utils.TargetEntity; - -import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; -import com.github.tomakehurst.wiremock.common.FileSource; -import com.github.tomakehurst.wiremock.extension.Parameters; -import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer; -import com.github.tomakehurst.wiremock.http.Request; -import com.github.tomakehurst.wiremock.http.ResponseDefinition; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Please describe the VnfAdapterUpdateMockTransformer.java class - * - */ -public class VnfAdapterUpdateMockTransformer extends ResponseDefinitionTransformer { - - private static final Logger logger = LoggerFactory.getLogger(VnfAdapterUpdateMockTransformer.class); - - private String notifyCallbackResponse; - private String requestId; - private String ackResponse; - - public VnfAdapterUpdateMockTransformer() { - notifyCallbackResponse = FileUtil.readResourceFile("vnfAdapter/vnfUpdateSimResponse.xml"); - } - - public VnfAdapterUpdateMockTransformer(String requestId) { - this.requestId = requestId; - } - - @Override - public String getName() { - return "vnf-adapter-update-transformer"; - } - - @Override - public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, - FileSource fileSource, Parameters parameters) { - - String requestBody = request.getBodyAsString(); - - String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>")); - String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>")); - String responseMessageId = ""; - String updatedResponse = ""; - - try { - // try supplied response file (if any) - logger.info(" Supplied fileName: {}", responseDefinition.getBodyFileName()); - ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); - notifyCallbackResponse = ackResponse; - responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>")); - updatedResponse = ackResponse.replace(responseMessageId, messageId); - } catch (Exception ex) { - logger.debug("Exception :",ex); - logger.info(" ******* Use default response file in 'vnfAdapter/vnfUpdateSimResponse.xml'"); - responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>")); - updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId); - } - - logger.info("response (mock) messageId : {}", responseMessageId); - logger.info("request (replacement) messageId: {}", messageId); - - logger.info("vnf Response (before):{}", notifyCallbackResponse); - logger.info("vnf Response (after):{}", updatedResponse); - - Object vnfDelay = MockResource.getMockProperties().get("vnf_delay"); - int delay = 300; - if (vnfDelay != null) { - delay = Integer.parseInt(vnfDelay.toString()); - } - - //Kick off callback thread - logger.info("VnfAdapterUpdateMockTransformer notficationUrl: {} :delay: {}", notficationUrl, delay); - CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay); - callbackResponseThread.start(); - - return ResponseDefinitionBuilder - .like(responseDefinition).but() - .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml") - .build(); - - } - - @Override - public boolean applyGlobally() { - return false; - } - - private class CallbackResponseThread extends Thread { - - private String callbackUrl; - private String payLoad; - private int delay; - - public CallbackResponseThread(String callbackUrl, String payLoad, int delay) { - this.callbackUrl = callbackUrl; - this.payLoad = payLoad; - this.delay = delay; - } - - public void run () { - try { - //Delay sending callback response - sleep(delay); - } catch (InterruptedException e1) { - logger.debug("Exception :", e1); - } - - try { - HttpClient client = new HttpClientFactory().newTextXmlClient( - UriBuilder.fromUri(callbackUrl).build().toURL(), - TargetEntity.VNF_ADAPTER); - client.post(payLoad); - } catch (Exception e) { - logger.info("catch error in - request.post() "); - logger.debug("Exception :", e); - } - } - - } -} - diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java index bc41b168ef..5de0903d65 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java @@ -120,30 +120,29 @@ public class ExtractPojosForBBTest extends BaseTest{ customer.getServiceSubscription().getServiceInstances().add(serviceInstancePend); gBBInput.setCustomer(customer); - ServiceInstance extractServPend = extractPojos.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, "abc"); + ServiceInstance extractServPend = extractPojos.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); assertEquals(extractServPend.getServiceInstanceId(), serviceInstancePend.getServiceInstanceId()); - GenericVnf extractVnfPend = extractPojos.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, "abc"); + GenericVnf extractVnfPend = extractPojos.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); assertEquals(extractVnfPend.getVnfId(), vnfPend.getVnfId()); - L3Network extractNetworkPend = extractPojos.extractByKey(execution, ResourceKey.NETWORK_ID, "abc"); + L3Network extractNetworkPend = extractPojos.extractByKey(execution, ResourceKey.NETWORK_ID); assertEquals(extractNetworkPend.getNetworkId(), networkPend.getNetworkId()); - VolumeGroup extractVolumeGroupPend = extractPojos.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, "abc"); + VolumeGroup extractVolumeGroupPend = extractPojos.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID); assertEquals(extractVolumeGroupPend.getVolumeGroupId(), volumeGroupPend.getVolumeGroupId()); AllottedResource extractallotedResourcePend = extractPojos.extractByKey(execution, - ResourceKey.ALLOTTED_RESOURCE_ID, "abc"); + ResourceKey.ALLOTTED_RESOURCE_ID); assertEquals(extractallotedResourcePend.getId(), allotedResourcePend.getId()); - Configuration extractConfigurationPend = extractPojos.extractByKey(execution, ResourceKey.CONFIGURATION_ID, - "abc"); + Configuration extractConfigurationPend = extractPojos.extractByKey(execution, ResourceKey.CONFIGURATION_ID); assertEquals(extractConfigurationPend.getConfigurationId(), configurationPend.getConfigurationId()); - VpnBinding extractVpnBinding = extractPojos.extractByKey(execution, ResourceKey.VPN_ID, "abc"); + VpnBinding extractVpnBinding = extractPojos.extractByKey(execution, ResourceKey.VPN_ID); assertEquals(extractVpnBinding.getVpnId(), vpnBinding.getVpnId()); - VfModule extractVfModulePend = extractPojos.extractByKey(execution, ResourceKey.VF_MODULE_ID, "abc"); + VfModule extractVfModulePend = extractPojos.extractByKey(execution, ResourceKey.VF_MODULE_ID); assertEquals(extractVfModulePend.getVfModuleId(), vfModulePend.getVfModuleId()); - VpnBondingLink extractVpnBondingLinkPend = extractPojos.extractByKey(execution, ResourceKey.VPN_BONDING_LINK_ID, "testVpnBondingLink"); + VpnBondingLink extractVpnBondingLinkPend = extractPojos.extractByKey(execution, ResourceKey.VPN_BONDING_LINK_ID); assertEquals(extractVpnBondingLinkPend.getVpnBondingLinkId(), vpnBondingLinkPend.getVpnBondingLinkId()); - InstanceGroup extractInstanceGroupPend = extractPojos.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID, "test-instance-group-1"); + InstanceGroup extractInstanceGroupPend = extractPojos.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID); assertEquals(instanceGroupPend.getId(), extractInstanceGroupPend.getId()); } @@ -157,7 +156,7 @@ public class ExtractPojosForBBTest extends BaseTest{ customer.getServiceSubscription().getServiceInstances().add(serviceInstance); gBBInput.setCustomer(customer); - extractPojos.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, "abc"); + extractPojos.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); } @Test @@ -169,7 +168,7 @@ public class ExtractPojosForBBTest extends BaseTest{ ServiceInstance serviceInstance = new ServiceInstance(); customer.getServiceSubscription().getServiceInstances().add(serviceInstance); gBBInput.setCustomer(customer); - extractPojos.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, "bbb"); + extractPojos.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); } @Test @@ -181,7 +180,7 @@ public class ExtractPojosForBBTest extends BaseTest{ ServiceInstance serviceInstance = new ServiceInstance(); customer.getServiceSubscription().getServiceInstances().add(serviceInstance); gBBInput.setCustomer(customer); - extractPojos.extractByKey(execution, ResourceKey.VF_MODULE_ID, "bbb"); + extractPojos.extractByKey(execution, ResourceKey.VF_MODULE_ID); } @Test @@ -193,7 +192,7 @@ public class ExtractPojosForBBTest extends BaseTest{ ServiceInstance serviceInstance = new ServiceInstance(); customer.getServiceSubscription().getServiceInstances().add(serviceInstance); gBBInput.setCustomer(customer); - extractPojos.extractByKey(execution, ResourceKey.CONFIGURATION_ID, "bbb"); + extractPojos.extractByKey(execution, ResourceKey.CONFIGURATION_ID); } @Test public void allotedError() throws BBObjectNotFoundException { @@ -204,7 +203,7 @@ public class ExtractPojosForBBTest extends BaseTest{ ServiceInstance serviceInstance = new ServiceInstance(); customer.getServiceSubscription().getServiceInstances().add(serviceInstance); gBBInput.setCustomer(customer); - extractPojos.extractByKey(execution, ResourceKey.ALLOTTED_RESOURCE_ID, "bbb"); + extractPojos.extractByKey(execution, ResourceKey.ALLOTTED_RESOURCE_ID); } @Test public void vpnBindingError() throws BBObjectNotFoundException { @@ -214,7 +213,7 @@ public class ExtractPojosForBBTest extends BaseTest{ ServiceInstance serviceInstance = new ServiceInstance(); customer.getServiceSubscription().getServiceInstances().add(serviceInstance); gBBInput.setCustomer(customer); - extractPojos.extractByKey(execution, ResourceKey.VPN_ID, "bbb"); + extractPojos.extractByKey(execution, ResourceKey.VPN_ID); } @Test @@ -225,6 +224,6 @@ public class ExtractPojosForBBTest extends BaseTest{ ServiceInstance serviceInstance = new ServiceInstance(); customer.getServiceSubscription().getServiceInstances().add(serviceInstance); gBBInput.setCustomer(customer); - extractPojos.extractByKey(execution, ResourceKey.VPN_BONDING_LINK_ID, "bbb"); + extractPojos.extractByKey(execution, ResourceKey.VPN_BONDING_LINK_ID); } } diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BPMNLogger.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BPMNLogger.java deleted file mode 100644 index ede515650e..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BPMNLogger.java +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Modifications Copyright (c) 2019 Samsung - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.core; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class BPMNLogger { - private static Logger logger = LoggerFactory.getLogger(BPMNLogger.class); - - public static void debug (String isDebugLogEnabled, String LogText) { - logger.debug(LogText); - } - - -} - diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/ResponseBuilder.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/ResponseBuilder.java index 6166071437..fb794e251d 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/ResponseBuilder.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/ResponseBuilder.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -21,6 +23,8 @@ package org.onap.so.bpmn.core; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Used in the output variable mapping configuration of subflow call activity @@ -36,6 +40,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; */ public class ResponseBuilder implements java.io.Serializable { private static final long serialVersionUID = 1L; + private static final Logger logger = LoggerFactory.getLogger(ResponseBuilder.class); /** * Creates a WorkflowException using data from the execution variables. @@ -48,28 +53,28 @@ public class ResponseBuilder implements java.io.Serializable { String method = getClass().getSimpleName() + ".buildWorkflowException(" + "execution=" + execution.getId() + ")"; - String isDebugLogEnabled = (String) execution.getVariable("isDebugLogEnabled"); - logDebug("Entered " + method, isDebugLogEnabled); - + + logger.debug("Entered " + method); + String prefix = (String) execution.getVariable("prefix"); String processKey = getProcessKey(execution); - logDebug("processKey=" + processKey, isDebugLogEnabled); + logger.debug("processKey=" + processKey); // See if there"s already a WorkflowException object in the execution. WorkflowException theException = (WorkflowException) execution.getVariable("WorkflowException"); if (theException != null) { - logDebug("Exited " + method + " - propagated " + theException, isDebugLogEnabled); + logger.debug("Exited " + method + " - propagated " + theException); return theException; } - + // Look in the legacy variables: ErrorResponse and ResponseCode String errorResponse = trimString(execution.getVariable(prefix + "ErrorResponse"), null); String responseCode = trimString(execution.getVariable(prefix + "ResponseCode"), null); - logDebug("errorResponse=" + errorResponse, isDebugLogEnabled); - logDebug("responseCode=" + responseCode, isDebugLogEnabled); + logger.debug("errorResponse=" + errorResponse); + logger.debug("responseCode=" + responseCode); if (errorResponse != null || !isOneOf(responseCode, null, "0", "200", "201", "202", "204")) { // This is an error condition. We need to return a WorkflowExcpetion @@ -93,8 +98,8 @@ public class ResponseBuilder implements java.io.Serializable { String xmlErrorCode = trimString(getXMLTextElement(maybeXML, "ErrorCode"), null); if (xmlErrorMessage != null || xmlErrorCode != null) { - logDebug("xmlErrorMessage=" + xmlErrorMessage, isDebugLogEnabled); - logDebug("xmlErrorCode=" + xmlErrorCode, isDebugLogEnabled); + logger.debug("xmlErrorMessage=" + xmlErrorMessage); + logger.debug("xmlErrorCode=" + xmlErrorCode); if (xmlErrorMessage == null) { errorResponse = "Received error code " + xmlErrorCode + " from " + processKey; @@ -135,27 +140,26 @@ public class ResponseBuilder implements java.io.Serializable { theException = new WorkflowException(processKey, intResponseCode, errorResponse); execution.setVariable("WorkflowException", theException); - logDebug("Exited " + method + " - created " + theException, isDebugLogEnabled); + logger.debug("Exited " + method + " - created " + theException); return theException; } - logDebug("Exited " + method + " - no WorkflowException", isDebugLogEnabled); + logger.debug("Exited " + method + " - no WorkflowException"); return null; } - + /** * Returns the "Response" variable, unless the execution variables * indicate there was an error. In that case, null is returned. * @param execution the execution */ public Object buildWorkflowResponse(DelegateExecution execution) { - + String method = getClass().getSimpleName() + ".buildWorkflowResponse(" + "execution=" + execution.getId() + ")"; - String isDebugLogEnabled = (String) execution.getVariable("isDebugLogEnabled"); - logDebug("Entered " + method, isDebugLogEnabled); - + logger.debug("Entered " + method); + String prefix = (String) execution.getVariable("prefix"); String processKey = getProcessKey(execution); @@ -169,16 +173,16 @@ public class ResponseBuilder implements java.io.Serializable { isOneOf(responseCode, null, "0", "200", "201", "202", "204")) { theResponse = execution.getVariable("WorkflowResponse"); - + if (theResponse == null) { theResponse = execution.getVariable(processKey + "Response"); } } - logDebug("Exited " + method, isDebugLogEnabled); + logger.debug("Exited " + method); return theResponse; } - + /** * Checks if the specified item is one of the specified values. * @param item the item @@ -201,10 +205,10 @@ public class ResponseBuilder implements java.io.Serializable { } } } - + return false; } - + /** * Creates a string value of the specified object, trimming whitespace in * the process. If the result is null or empty, the specified empty string @@ -221,7 +225,7 @@ public class ResponseBuilder implements java.io.Serializable { String s = String.valueOf(object).trim(); return s.equals("") ? emptyStringValue : s; } - + /** * Returns the process definition key (i.e. the process name) from the * execution. @@ -237,16 +241,7 @@ public class ResponseBuilder implements java.io.Serializable { return execution.getProcessEngineServices().getRepositoryService() .getProcessDefinition(execution.getProcessDefinitionId()).getKey(); } - - /** - * Logs a message at the DEBUG level. - * @param message the message - * @param isDebugLogEnabled a flag indicating if DEBUG level is enabled - */ - private void logDebug(String message, String isDebugLogEnabled) { - BPMNLogger.debug(isDebugLogEnabled, message); - } - + /** * Removes namespace definitions and prefixes from XML, if any. */ diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfRollback.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfRollback.java index 194ce58fe9..9fd3bc596f 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfRollback.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfRollback.java @@ -36,6 +36,7 @@ import javax.xml.bind.annotation.XmlType; * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> * <element name="cloudSiteId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * <element name="cloudOwner" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * <element name="msoRequest" type="{http://org.onap.so/vnfNotify}msoRequest" minOccurs="0"/> * <element name="tenantCreated" type="{http://www.w3.org/2001/XMLSchema}boolean"/> * <element name="tenantId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> @@ -52,6 +53,7 @@ import javax.xml.bind.annotation.XmlType; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "vnfRollback", propOrder = { "cloudSiteId", + "cloudOwner", "msoRequest", "tenantCreated", "tenantId", @@ -61,6 +63,7 @@ import javax.xml.bind.annotation.XmlType; public class VnfRollback { protected String cloudSiteId; + protected String cloudOwner; protected MsoRequest msoRequest; protected boolean tenantCreated; protected String tenantId; @@ -92,6 +95,30 @@ public class VnfRollback { } /** + * Gets the value of the cloudOwner property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCloudOwner() { + return cloudOwner; + } + + /** + * Sets the value of the cloudOwner property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCloudOwner(String value) { + this.cloudOwner = value; + } + + /** * Gets the value of the msoRequest property. * * @return @@ -201,6 +228,7 @@ public class VnfRollback { return "<cloudSiteId>"+cloudSiteId+"</cloudSiteId>" + '\n' + + "<cloudOwner>"+cloudOwner+"</cloudOwner>" + '\n' + msoRequestElement + "<tenantCreated>"+tenantCreated+"</tenantCreated>" + '\n' + "<tenantId>"+tenantId+"</tenantId>" + '\n' + diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java index f795bcc40e..3eed14bc30 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java @@ -53,7 +53,6 @@ import org.camunda.bpm.model.bpmn.impl.instance.FlowNodeImpl; import org.camunda.bpm.model.bpmn.instance.EndEvent; import org.camunda.bpm.model.bpmn.instance.FlowNode; import org.camunda.bpm.model.bpmn.instance.StartEvent; -import org.onap.so.bpmn.core.BPMNLogger; import org.slf4j.Logger; @@ -71,11 +70,11 @@ import org.springframework.stereotype.Component; * Plugin for MSO logging and URN mapping. */ @Component -public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { - +public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { + @Autowired private LoggingParseListener loggingParseListener; - + @Override public void preInit( ProcessEngineConfigurationImpl processEngineConfiguration) { @@ -87,14 +86,14 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { } preParseListeners.add(loggingParseListener); } - + /** * Called when a process flow is parsed so we can inject listeners. */ @Component - public class LoggingParseListener extends AbstractBpmnParseListener { - - + public class LoggingParseListener extends AbstractBpmnParseListener { + + private void injectLogExecutionListener(ActivityImpl activity) { activity.addListener( ExecutionListener.EVENTNAME_END, @@ -115,7 +114,7 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { @Override public void parseStartEvent(Element startEventElement, ScopeImpl scope, ActivityImpl startEventActivity) { - // Inject these listeners only on the main start event for the flow, not on any embedded subflow start events + // Inject these listeners only on the main start event for the flow, not on any embedded subflow start events injectLogExecutionListener(startEventActivity); } @@ -275,15 +274,15 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { injectLogExecutionListener(messageActivity); } } - + /** * Logs details about the current activity. - */ + */ public class LoggingExecutionListener implements ExecutionListener { private final Logger logger = LoggerFactory.getLogger(LoggingExecutionListener.class); private String event; - + public LoggingExecutionListener() { this.event = ""; } @@ -291,31 +290,31 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { public LoggingExecutionListener(String event) { this.event = event; } - + public String getEvent() { return event; } @Override - public void notify(DelegateExecution execution) throws Exception { + public void notify(DelegateExecution execution) throws Exception { //required for legacy groovy processing in camunda execution.setVariable("isDebugLogEnabled", "true"); if (!isBlank(execution.getCurrentActivityName())) { try { - + String id = execution.getId(); - if (id != null ) { + if (id != null ) { RepositoryService repositoryService = execution.getProcessEngineServices().getRepositoryService(); String processName = repositoryService.createProcessDefinitionQuery() .processDefinitionId(execution.getProcessDefinitionId()) .singleResult() - .getName(); + .getName(); + - String requestId = (String) execution.getVariable("mso-request-id"); String svcid = (String) execution.getVariable("mso-service-instance-id"); } - } catch(Exception e) { + } catch(Exception e) { logger.error("Exception occurred", e); } } diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java index 9b8f6cd5cc..8bc0055343 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -40,9 +42,10 @@ import org.camunda.bpm.engine.impl.pvm.process.ActivityImpl; import org.camunda.bpm.engine.impl.pvm.process.TransitionImpl; import org.camunda.bpm.engine.impl.util.xml.Element; -import org.onap.so.bpmn.core.BPMNLogger; import org.onap.so.bpmn.core.WorkflowException; import org.springframework.stereotype.Component; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * This plugin does the following: @@ -60,7 +63,8 @@ import org.springframework.stereotype.Component; */ @Component public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin { - + private static final Logger logger = LoggerFactory.getLogger(WorkflowExceptionPlugin.class); + @Override public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) { List<BpmnParseListener> preParseListeners = @@ -73,7 +77,7 @@ public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin { preParseListeners.add(new WorkflowExceptionParseListener()); } - + public static class WorkflowExceptionParseListener extends AbstractBpmnParseListener { @Override public void parseProcess(Element processElement, ProcessDefinitionEntity processDefinition) { @@ -131,7 +135,7 @@ public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin { } } } - + /** * If there is a WorkflowException object in the execution, this method * removes it (saving a copy of it in a different variable). @@ -147,8 +151,7 @@ public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin { saveName = "SavedWorkflowException" + (++index); } - BPMNLogger.debug((String)execution.getVariable("isDebugLogEnabled"), - "WorkflowExceptionResetTask is moving WorkflowException to " + saveName); + logger.debug("WorkflowExceptionResetTask is moving WorkflowException to " + saveName); execution.setVariable(saveName, workflowException); execution.setVariable("WorkflowException", null); @@ -163,8 +166,7 @@ public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin { public static class WorkflowExceptionTriggerTask implements JavaDelegate { public void execute(DelegateExecution execution) throws Exception { if (execution.getVariable("WorkflowException") instanceof WorkflowException) { - BPMNLogger.debug((String)execution.getVariable("isDebugLogEnabled"), - "WorkflowExceptionTriggerTask is generating a MSOWorkflowException event"); + logger.debug("WorkflowExceptionTriggerTask is generating a MSOWorkflowException event"); throw new BpmnError("MSOWorkflowException"); } } diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java index ad08f8b2bb..1ef864b543 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java @@ -59,6 +59,7 @@ public class VnfAdapterRestV1IT extends BaseIntegrationTest { private final String CREATE_VF_MODULE_REQUEST = "<createVfModuleRequest>" + EOL + " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL + + " <cloudOwner>cloudOwner</cloudOwner>" + EOL + " <tenantId>tenantId</tenantId>" + EOL + " <vnfId>vnfId</vnfId>" + EOL + " <vfModuleName>vfModuleName</vfModuleName>" + EOL + @@ -94,6 +95,7 @@ public class VnfAdapterRestV1IT extends BaseIntegrationTest { private final String UPDATE_VF_MODULE_REQUEST = "<updateVfModuleRequest>" + EOL + " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL + + " <cloudOwner>cloudOwner</cloudOwner>" + EOL + " <tenantId>tenantId</tenantId>" + EOL + " <vnfId>vnfId</vnfId>" + EOL + " <vfModuleName>vfModuleName</vfModuleName>" + EOL + @@ -130,6 +132,7 @@ public class VnfAdapterRestV1IT extends BaseIntegrationTest { private final String DELETE_VF_MODULE_REQUEST = "<deleteVfModuleRequest>" + EOL + " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL + + " <cloudOwner>cloudOwner</cloudOwner>" + EOL + " <tenantId>tenantId</tenantId>" + EOL + " <vnfId>vnfId</vnfId>" + EOL + " <vfModuleId>vfModuleId</vfModuleId>" + EOL + @@ -150,6 +153,7 @@ public class VnfAdapterRestV1IT extends BaseIntegrationTest { " <skipAAI>true</skipAAI>" + EOL + " <vfModuleRollback>" + EOL + " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL + + " <cloudOwner>cloudOwner</cloudOwner>" + EOL + " <tenantId>tenantId</tenantId>" + EOL + " <vnfId>vnfId</vnfId>" + EOL + " <vfModuleId>vfModuleId</vfModuleId>" + EOL + @@ -186,6 +190,7 @@ public class VnfAdapterRestV1IT extends BaseIntegrationTest { " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL + " <vfModuleCreated>true</vfModuleCreated>" + EOL + " <tenantId>tenantId</tenantId>" + EOL + + " <cloudOwner>cloudOwner</cloudOwner>" + EOL + " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL + " <msoRequest>" + EOL + " <requestId>requestId</requestId>" + EOL + diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java index 117d3b213a..eed2978bc7 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java @@ -1100,6 +1100,10 @@ public abstract class WorkflowTest { "/tns:createVnfNotification/tns:rollback/tns:cloudSiteId/text()"); rollback.setCloudSiteId(cloudSiteId); + String cloudOwner = xpathTool.evaluate( + "/tns:createVnfNotification/tns:rollback/tns:cloudOwner/text()"); + rollback.setCloudOwner(cloudOwner); + String requestId = xpathTool.evaluate( "/tns:createVnfNotification/tns:rollback/tns:msoRequest/tns:requestId/text()"); String serviceInstanceId = xpathTool.evaluate( @@ -1276,6 +1280,10 @@ public abstract class WorkflowTest { "/tns:updateVnfNotification/tns:rollback/tns:cloudSiteId/text()"); rollback.setCloudSiteId(cloudSiteId); + String cloudOwner = xpathTool.evaluate( + "/tns:updateVnfNotification/tns:rollback/tns:cloudOwner/text()"); + rollback.setCloudOwner(cloudOwner); + String requestId = xpathTool.evaluate( "/tns:updateVnfNotification/tns:rollback/tns:msoRequest/tns:requestId/text()"); String serviceInstanceId = xpathTool.evaluate( diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn index 2437476b59..76ca2a89cc 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.2"> <bpmn:process id="WorkflowActionBB" name="WorkflowActionBB" isExecutable="true"> <bpmn:startEvent id="Start_WorkflowActionBB" name="start"> <bpmn:outgoing>SequenceFlow_15s0okp</bpmn:outgoing> @@ -88,7 +88,7 @@ </bpmn:serviceTask> </bpmn:subProcess> <bpmn:sequenceFlow id="SequenceFlow_0v588sm" name="Rollback = true" sourceRef="ExclusiveGateway_Finished" targetRef="Task_RollbackExecutionPath"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("handlingCode")=="Rollback"||execution.getVariable("handlingCode")=="RollbackToAssigned"}]]></bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("handlingCode")=="Rollback"||execution.getVariable("handlingCode")=="RollbackToAssigned"||execution.getVariable("handlingCode")=="RollbackToCreated"}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_1atzsgn" sourceRef="Task_RollbackExecutionPath" targetRef="Task_SelectBB"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isRollbackNeeded")==true}]]></bpmn:conditionExpression> diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java index cd2b46bf70..6aa5cf3412 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java @@ -349,7 +349,7 @@ public class BuildingBlockTestDataSetup{ ServiceInstance serviceInstance = null; try { - serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); } catch(BBObjectNotFoundException e) { serviceInstance = setServiceInstance(); } @@ -367,7 +367,7 @@ public class BuildingBlockTestDataSetup{ Collection collection = null; try { - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); collection = serviceInstance.getCollection(); if (collection == null) { @@ -442,7 +442,7 @@ public class BuildingBlockTestDataSetup{ ServiceInstance serviceInstance = null; try { - serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); } catch(BBObjectNotFoundException e) { serviceInstance = setServiceInstance(); } @@ -487,7 +487,7 @@ public class BuildingBlockTestDataSetup{ ServiceInstance serviceInstance = null; try { - serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); } catch(BBObjectNotFoundException e) { serviceInstance = setServiceInstance(); } @@ -522,7 +522,7 @@ public class BuildingBlockTestDataSetup{ GenericVnf genericVnf = null; try { - genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); } catch(BBObjectNotFoundException e) { genericVnf = setGenericVnf(); } @@ -550,7 +550,7 @@ public class BuildingBlockTestDataSetup{ GenericVnf genericVnf = null; try { - genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); } catch(BBObjectNotFoundException e) { genericVnf = setGenericVnf(); } @@ -614,7 +614,7 @@ public class BuildingBlockTestDataSetup{ ServiceInstance serviceInstance = null; try { - serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); } catch(BBObjectNotFoundException e) { serviceInstance = setServiceInstance(); } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy index bb2116acb9..65fa0511ac 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy @@ -441,7 +441,6 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { } String sndcTopologyCreateRequesAsString = utils.formatXml(sdncTopologyCreateRequest) - utils.logAudit(sndcTopologyCreateRequesAsString) execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyCreateRequesAsString) logger.debug("sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyCreateRequesAsString) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy index ccdb5d77cd..4233147f83 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy @@ -328,7 +328,6 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor } String sdncTopologyDeleteRequesAsString = utils.formatXml(sdncTopologyDeleteRequest) - utils.logAudit(sdncTopologyDeleteRequesAsString) execution.setVariable("sdncAdapterWorkflowRequest", sdncTopologyDeleteRequesAsString) logger.info("sdncAdapterWorkflowRequest - " + "\n" + sdncTopologyDeleteRequesAsString) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy index 0dc86632e2..20134a77a9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy @@ -354,7 +354,6 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { } String sdncTopologyDeleteRequesAsString = utils.formatXml(sdncTopologyDeleteRequest) - utils.logAudit(sdncTopologyDeleteRequesAsString) execution.setVariable("sdncAdapterWorkflowRequest", sdncTopologyDeleteRequesAsString) logger.info("sdncAdapterWorkflowRequest - " + "\n" + sdncTopologyDeleteRequesAsString) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy index ccd9f9bd02..cf53aff878 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy @@ -68,6 +68,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { execution.setVariable('DELVfModVol_vnfType', null) execution.setVariable('DELVfModVol_serviceId', null) execution.setVariable('DELVfModVol_cloudRegion', null) + execution.setVariable('DELVfModVol_cloudOwner', null) execution.setVariable('DELVfModVol_tenantId', null) execution.setVariable('DELVfModVol_volumeParams', null) execution.setVariable('DELVfModVol_volumeGroupHeatStackId', null) @@ -141,6 +142,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { execution.setVariable('DELVfModVol_volumeOutputs', utils.getNodeXml(request, 'volume-outputs', false)) execution.setVariable('DELVfModVol_volumeParams', utils.getNodeXml(request, 'volume-params')) execution.setVariable('DELVfModVol_cloudRegion', utils.getNodeText(request, 'aic-cloud-region')) + execution.setVariable('DELVfModVol_cloudOwner', utils.getNodeText(request, 'cloud-owner')) setBasicDBAuthHeader(execution, isDebugLogEnabled) @@ -308,6 +310,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { public void prepareVnfAdapterDeleteRequest(DelegateExecution execution, isDebugLogEnabled) { def cloudRegion = execution.getVariable('DELVfModVol_cloudRegion') + def cloudOwner = execution.getVariable('DELVfModVol_cloudOwner') def tenantId = execution.getVariable('DELVfModVol_tenantId') def volumeGroupId = execution.getVariable('DELVfModVol_volumeGroupId') def volumeGroupHeatStackId = execution.getVariable('DELVfModVol_volumeGroupHeatStackId') @@ -324,6 +327,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { String vnfAdapterRestRequest = """ <deleteVolumeGroupRequest> <cloudSiteId>${MsoUtils.xmlEscape(cloudRegion)}</cloudSiteId> + <cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner> <tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId> <volumeGroupId>${MsoUtils.xmlEscape(volumeGroupId)}</volumeGroupId> <volumeGroupStackId>${MsoUtils.xmlEscape(volumeGroupHeatStackId)}</volumeGroupStackId> diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy index c03f9f9c95..7a606d515c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy @@ -982,6 +982,8 @@ public class DoCreateVfModule extends VfModuleBase { //Get variables //cloudSiteId def cloudSiteId = execution.getVariable("DCVFM_cloudSiteId") + //cloudOwner + def cloudOwner = execution.getVariable("DCVFM_cloudOwner") //tenantId def tenantId = execution.getVariable("DCVFM_tenantId") //vnfType @@ -1070,6 +1072,7 @@ public class DoCreateVfModule extends VfModuleBase { String createVnfARequest = """ <createVfModuleRequest> <cloudSiteId>${MsoUtils.xmlEscape(cloudSiteId)}</cloudSiteId> + <cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner> <tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId> <vnfId>${MsoUtils.xmlEscape(vnfId)}</vnfId> <vnfName>${MsoUtils.xmlEscape(vnfName)}</vnfName> @@ -1233,6 +1236,7 @@ public class DoCreateVfModule extends VfModuleBase { def vfModuleModelName = execution.getVariable("DCVFM_vfModuleModelName") def vnfId = execution.getVariable("DCVFM_vnfId") def cloudSiteId = execution.getVariable("DCVFM_cloudSiteId") + def cloudOwner = execution.getVariable("DCVFM_cloudOwner") def sdncVersion = execution.getVariable("DCVFM_sdncVersion") def serviceModelInfo = execution.getVariable("serviceModelInfo") def vnfModelInfo = execution.getVariable("vnfModelInfo") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy index a6040ac290..07ffa38498 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy @@ -92,6 +92,8 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ execution.setVariable("DCVFMR_vfModuleModelName", vfModuleModelName) String cloudSiteId = rollbackData.get("VFMODULE", "aiccloudregion") execution.setVariable("DCVFMR_cloudSiteId", cloudSiteId) + String cloudOwner = rollbackData.get("VFMODULE", "cloudowner") + execution.setVariable("DCVFMR_cloudOwner", cloudOwner) String heatStackId = rollbackData.get("VFMODULE", "heatstackid") execution.setVariable("DCVFMR_heatStackId", heatStackId) String requestId = rollbackData.get("VFMODULE", "msorequestid") @@ -358,6 +360,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ String origRequestId = execution.getVariable("DCVFMR_requestId") String srvInstId = execution.getVariable("DCVFMR_serviceInstanceId") String aicCloudRegion = execution.getVariable("DCVFMR_cloudSiteId") + String cloudOwner = execution.getVariable("DCVFMR_cloudOwner") String vnfId = execution.getVariable("DCVFMR_vnfId") String vfModuleId = execution.getVariable("DCVFMR_vfModuleId") String vfModuleStackId = execution.getVariable("DCVFMR_heatStackId") @@ -373,6 +376,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ String request = """ <deleteVfModuleRequest> <cloudSiteId>${MsoUtils.xmlEscape(aicCloudRegion)}</cloudSiteId> + <cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner> <tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId> <vnfId>${MsoUtils.xmlEscape(vnfId)}</vnfId> <vfModuleId>${MsoUtils.xmlEscape(vfModuleId)}</vfModuleId> diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy index bedf5e0948..05ccfa02ba 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy @@ -111,6 +111,8 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ execution.setVariable("tenantId", tenantId) String cloudSiteId = jsonUtil.getJsonValue(cloudConfiguration, "lcpCloudRegionId") execution.setVariable("cloudSiteId", cloudSiteId) + String cloudOwner = jsonUtil.getJsonValue(cloudConfiguration, "cloudOwner") + execution.setVariable("cloudOwner", cloudOwner) // Source is HARDCODED String source = "VID" execution.setVariable("source", source) @@ -176,6 +178,8 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ execution.setVariable("vfModuleModelName", vfModuleModelName) String cloudSiteId = utils.getNodeText(xml, "aic-cloud-region") execution.setVariable("cloudSiteId", cloudSiteId) + String cloudOwner = utils.getNodeText(xml, "cloud-owner") + execution.setVariable("cloudOwner", cloudOwner) } // formulate the request for PrepareUpdateAAIVfModule @@ -281,6 +285,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ def origRequestId = execution.getVariable('requestId') def srvInstId = execution.getVariable("serviceInstanceId") def aicCloudRegion = execution.getVariable("cloudSiteId") + def cloudOwner = execution.getVariable("cloudOwner") def vnfId = execution.getVariable("vnfId") def vfModuleId = execution.getVariable("vfModuleId") def vfModuleStackId = execution.getVariable('DoDVfMod_heatStackId') @@ -296,6 +301,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ String request = """ <deleteVfModuleRequest> <cloudSiteId>${MsoUtils.xmlEscape(aicCloudRegion)}</cloudSiteId> + <cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner> <tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId> <vnfId>${MsoUtils.xmlEscape(vnfId)}</vnfId> <vfModuleId>${MsoUtils.xmlEscape(vfModuleId)}</vfModuleId> diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy index 3be52f50f7..47aec46277 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy @@ -79,6 +79,9 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { String cloudSiteId = execution.getVariable("lcpCloudRegionId") execution.setVariable("cloudSiteId", cloudSiteId) logger.debug("cloudSiteId: " + cloudSiteId) + String cloudOwner = execution.getVariable("cloudOwner") + execution.setVariable("cloudOwner", cloudOwner) + logger.debug("cloudOwner: " + cloudOwner) // Source is HARDCODED String source = "VID" execution.setVariable("source", source) @@ -363,6 +366,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { def origRequestId = execution.getVariable('requestId') def srvInstId = execution.getVariable("serviceInstanceId") def aicCloudRegion = execution.getVariable("cloudSiteId") + def cloudOwner = execution.getVariable("cloudOwner") def vnfId = execution.getVariable("vnfId") def vfModuleId = execution.getVariable("vfModuleId") def vfModuleStackId = execution.getVariable('DDVMFV_heatStackId') @@ -378,6 +382,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { String request = """ <deleteVfModuleRequest> <cloudSiteId>${MsoUtils.xmlEscape(aicCloudRegion)}</cloudSiteId> + <cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner> <tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId> <vnfId>${MsoUtils.xmlEscape(vnfId)}</vnfId> <vfModuleId>${MsoUtils.xmlEscape(vfModuleId)}</vfModuleId> diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy index 787b582808..6acf2223b0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy @@ -217,6 +217,7 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{ */ public void prepareVnfAdapterDeleteRequest(DelegateExecution execution, isDebugLogEnabled) { def cloudRegion = execution.getVariable(prefix+'aicCloudRegion') + def cloudOwner = execution.getVariable(prefix+'cloudOwner') def tenantId = execution.getVariable('tenantId') // input parameter (optional) - see preProcessRequest def volumeGroupId = execution.getVariable('volumeGroupId') // input parameter (required) def volumeGroupHeatStackId = execution.getVariable(prefix+'volumeGroupHeatStackId') // from AAI query volume group @@ -233,6 +234,7 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{ String vnfAdapterRestRequest = """ <deleteVolumeGroupRequest> <cloudSiteId>${MsoUtils.xmlEscape(cloudRegion)}</cloudSiteId> + <cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner> <tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId> <volumeGroupId>${MsoUtils.xmlEscape(volumeGroupId)}</volumeGroupId> <volumeGroupStackId>${MsoUtils.xmlEscape(volumeGroupHeatStackId)}</volumeGroupStackId> diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy index 4fe30803c4..508131279a 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy @@ -195,7 +195,6 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { payload = utils.formatXml(payload) execution.setVariable("CVFMI_initResOperStatusRequest", payload) logger.info( "Outgoing initResourceOperationStatus: \n" + payload) - utils.logAudit("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload) }catch(Exception e){ logger.info( "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy index a17dc9d7fe..013f66b008 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy @@ -143,6 +143,12 @@ public class DoUpdateVfModule extends VfModuleBase { execution.setVariable("DOUPVfMod_aicCloudRegion", cloudSiteId) logger.debug("cloudSiteId: " + cloudSiteId) + + //cloudOwner + def cloudOwner = execution.getVariable("cloudOwner") + execution.setVariable("DOUPVfMod_cloudOwner", cloudOwner) + logger.debug("cloudOwner: " + cloudOwner) + //vnfType def vnfType = execution.getVariable("vnfType") execution.setVariable("DOUPVfMod_vnfType", vnfType) @@ -304,6 +310,7 @@ public class DoUpdateVfModule extends VfModuleBase { execution.setVariable('DOUPVfMod_modelCustomizationUuid', getNodeTextForce(vnfInputs, 'model-customization-id')) execution.setVariable('DOUPVfMod_serviceId', getRequiredNodeText(execution, vnfInputs, 'service-id')) execution.setVariable('DOUPVfMod_aicCloudRegion', getRequiredNodeText(execution, vnfInputs, 'aic-cloud-region')) + execution.setVariable('DOUPVfMod_cloudOwner', getRequiredNodeText(execution, vnfInputs, 'cloud-owner')) execution.setVariable('DOUPVfMod_tenantId', getRequiredNodeText(execution, vnfInputs, 'tenant-id')) //isBaseVfModule def isBaseVfModule = "false" @@ -640,6 +647,7 @@ public class DoUpdateVfModule extends VfModuleBase { heatStackId = vfModule.getHeatStackId() } def cloudId = execution.getVariable('DOUPVfMod_aicCloudRegion') + def cloudOwner = execution.getVariable('DOUPVfMod_cloudOwner') def vnfType = execution.getVariable('DOUPVfMod_vnfType') def vnfName = execution.getVariable('DOUPVfMod_vnfName') def vfModuleModelName = execution.getVariable('DOUPVfMod_vfModuleModelName') @@ -672,6 +680,7 @@ public class DoUpdateVfModule extends VfModuleBase { String vnfAdapterRestRequest = """ <updateVfModuleRequest> <cloudSiteId>${MsoUtils.xmlEscape(cloudId)}</cloudSiteId> + <cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner> <tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId> <vnfId>${MsoUtils.xmlEscape(vnfId)}</vnfId> <vfModuleId>${MsoUtils.xmlEscape(vfModuleId)}</vfModuleId> diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy index 4e3517e5b5..1168b20220 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy @@ -72,7 +72,6 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor try { String siRequest = execution.getVariable("bpmnRequest") - utils.logAudit(siRequest) String requestId = execution.getVariable("mso-request-id") execution.setVariable("msoRequestId", requestId) @@ -277,7 +276,6 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor payload = utils.formatXml(payload) execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) logger.error( "Outgoing updateServiceOperStatusRequest: \n" + payload) - utils.logAudit("CreateVfModuleInfra Outgoing updateServiceOperStatusRequest Request: " + payload) }catch(Exception e){ logger.debug( "Exception Occured Processing prepareInitServiceOperationStatus. Exception is:\n" + e) @@ -398,7 +396,6 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor <aetgt:ErrorCode>${MsoUtils.xmlEscape(errorCode)}</aetgt:ErrorCode> </aetgt:WorkflowException>""" - utils.logAudit(buildworkflowException) sendWorkflowResponse(execution, 500, buildworkflowException) } catch (Exception ex) { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy index 0c3294778a..3e9b934a2e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy @@ -100,6 +100,7 @@ class UpdateVfModuleVolume extends VfModuleBase { execution.setVariable('UPDVfModVol_vnfType', getRequiredNodeText(execution, volumeInputs, 'vnf-type')) execution.setVariable('UPDVfModVol_serviceId', getRequiredNodeText(execution, volumeInputs, 'service-id')) execution.setVariable('UPDVfModVol_aicCloudRegion', getRequiredNodeText(execution, volumeInputs, 'aic-cloud-region')) + execution.setVariable('UPDVfModVol_cloudOwner', getRequiredNodeText(execution, volumeInputs, 'cloud-owner')) execution.setVariable('UPDVfModVol_tenantId', getRequiredNodeText(execution, volumeInputs, 'tenant-id')) def volumeParams = utils.getNodeXml(request, 'volume-params') @@ -255,6 +256,7 @@ class UpdateVfModuleVolume extends VfModuleBase { String vnfAdapterRestRequest = """ <updateVolumeGroupRequest> <cloudSiteId>${MsoUtils.xmlEscape(aicCloudRegion)}</cloudSiteId> + <cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner> <tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId> <volumeGroupId>${MsoUtils.xmlEscape(volumeGroupId)}</volumeGroupId> <volumeGroupStackId>${MsoUtils.xmlEscape(volumeGroupHeatStackId)}</volumeGroupStackId> diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy index 361d6a2173..ab7b659b51 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy @@ -135,6 +135,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { execution.setVariable('UPDVfModVol_vnfVersion', getRequiredNodeText(execution, volumeInputs, 'asdc-service-model-version')) execution.setVariable('UPDVfModVol_serviceId', utils.getNodeText(volumeInputs, 'service-id')) execution.setVariable('UPDVfModVol_aicCloudRegion', getRequiredNodeText(execution, volumeInputs, 'aic-cloud-region')) + execution.setVariable('UPDVfModVol_cloudRegion', getRequiredNodeText(execution, volumeInputs, 'cloud-owner')) execution.setVariable('UPDVfModVol_tenantId', getRequiredNodeText(execution, volumeInputs, 'tenant-id')) //execution.setVariable('UPDVfModVol_modelCustomizationId', getRequiredNodeText(execution, volumeInputs, 'model-customization-id')) @@ -328,6 +329,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { String vnfAdapterRestRequest = """ <updateVolumeGroupRequest> <cloudSiteId>${MsoUtils.xmlEscape(aicCloudRegion)}</cloudSiteId> + <cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner> <tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId> <vnfId>${MsoUtils.xmlEscape(vnfId)}</vnfId> <vnfName>${MsoUtils.xmlEscape(vnfName)}</vnfName> diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy index e7ebe23e75..fc5960b92f 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy @@ -165,6 +165,7 @@ class DoCreateVfModuleRollbackTest extends MsoGroovyTest{ when(mockExecution.getVariable("prefix")).thenReturn(prefix) when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable("DCVFM_cloudSiteId")).thenReturn("12345") + when(mockExecution.getVariable("DCVFM_cloudOwner")).thenReturn("CloudOwner") when(mockExecution.getVariable("rollbackData")).thenReturn(new RollbackData()) List fqdnList = new ArrayList() fqdnList.add("test") @@ -194,6 +195,7 @@ class DoCreateVfModuleRollbackTest extends MsoGroovyTest{ when(mockExecution.getVariable("prefix")).thenReturn(prefix) when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable("DCVFM_cloudSiteId")).thenReturn("12345") + when(mockExecution.getVariable("DCVFM_cloudOwner")).thenReturn("CloudOwner") when(mockExecution.getVariable("rollbackData")).thenReturn(new RollbackData()) List fqdnList = new ArrayList() fqdnList.add("test") @@ -223,6 +225,7 @@ class DoCreateVfModuleRollbackTest extends MsoGroovyTest{ when(mockExecution.getVariable("prefix")).thenReturn(prefix) when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable("DCVFM_cloudSiteId")).thenReturn("12345") + when(mockExecution.getVariable("DCVFM_cloudOwner")).thenReturn("CloudOwner") when(mockExecution.getVariable("rollbackData")).thenReturn(new RollbackData()) List fqdnList = new ArrayList() fqdnList.add("test") diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy index d635b2311a..59a2b0eda3 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy @@ -182,6 +182,7 @@ class DoUpdateVfModuleTest extends MsoGroovyTest{ ExecutionEntity mockExecution = setupMock() when(mockExecution.getVariable("prefix")).thenReturn(prefix) when(mockExecution.getVariable(prefix + "aicCloudRegion")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable(prefix + "cloudRegion")).thenReturn("CloudOwner") when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("cb510af0-5b21-4bc7-86d9-323cb396ce32") when(mockExecution.getVariable(prefix + "volumeGroupStackId")).thenReturn("12345") when(mockExecution.getVariable(prefix + "vfModuleName")).thenReturn("PCRF::module-0-2") diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy index 06ae576307..8af15de75b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy @@ -143,6 +143,7 @@ class UpdateVfModuleVolumeInfraV1Test extends MsoGroovyTest{ when(mockExecution.getVariable("prefix")).thenReturn(prefix) when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable(prefix + "aicCloudRegion")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable(prefix + "cloudOwner")).thenReturn("CloudOwner") when(mockExecution.getVariable(prefix + "tenantId")).thenReturn("") VolumeGroup volumeGroup = new VolumeGroup(); volumeGroup.setHeatStackId("heatStackId") diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICommonTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICommonTasks.java index 6571971347..bdb46e8d2b 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICommonTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICommonTasks.java @@ -41,7 +41,7 @@ public class AAICommonTasks { public Optional<String> getServiceType(BuildingBlockExecution execution) { try { - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); ModelInfoServiceInstance model = serviceInstance.getModelInfoServiceInstance(); if (model != null) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java index 760f623812..dad84e53a9 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java @@ -104,7 +104,7 @@ public class AAICreateTasks { public void createServiceInstance(BuildingBlockExecution execution) { try { - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); Customer customer = execution.getGeneralBuildingBlock().getCustomer(); aaiSIResources.createServiceInstance(serviceInstance, customer); } catch (Exception ex) { @@ -115,7 +115,7 @@ public class AAICreateTasks { public void createServiceSubscription(BuildingBlockExecution execution){ try{ ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, - ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + ResourceKey.SERVICE_INSTANCE_ID); Customer customer = execution.getGeneralBuildingBlock().getCustomer(); if (null == customer) { String errorMessage = "Exception in creating ServiceSubscription. Customer not present for ServiceInstanceID: " @@ -135,7 +135,7 @@ public class AAICreateTasks { public void createProject(BuildingBlockExecution execution) { try { - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); Project project = serviceInstance.getProject(); if(project != null) { if (project.getProjectName() == null || "".equals(project.getProjectName())) { @@ -151,7 +151,7 @@ public class AAICreateTasks { public void createOwningEntity(BuildingBlockExecution execution) { try { - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); OwningEntity owningEntity = serviceInstance.getOwningEntity(); String owningEntityId = owningEntity.getOwningEntityId(); String owningEntityName = owningEntity.getOwningEntityName(); @@ -187,8 +187,8 @@ public class AAICreateTasks { public void createVnf(BuildingBlockExecution execution) { try { - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); execution.setVariable("callHoming", Boolean.TRUE.equals(vnf.isCallHoming())); aaiVnfResources.createVnfandConnectServiceInstance(vnf, serviceInstance); } catch (Exception ex) { @@ -198,7 +198,7 @@ public class AAICreateTasks { public void createPlatform(BuildingBlockExecution execution) { try { - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); Platform platform = vnf.getPlatform(); if(platform != null) { if (platform.getPlatformName() == null || "".equals(platform.getPlatformName())) { @@ -215,7 +215,7 @@ public class AAICreateTasks { public void createLineOfBusiness(BuildingBlockExecution execution) { try { - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); LineOfBusiness lineOfBusiness = vnf.getLineOfBusiness(); if(lineOfBusiness != null) { if (lineOfBusiness.getLineOfBusinessName() == null || "".equals(lineOfBusiness.getLineOfBusinessName())) { @@ -233,8 +233,8 @@ public class AAICreateTasks { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); - GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); - VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID)); + GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); + VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID); CloudRegion cloudRegion = gBBInput.getCloudRegion(); aaiVolumeGroupResources.createVolumeGroup(volumeGroup, cloudRegion); aaiVolumeGroupResources.connectVolumeGroupToVnf(genericVnf, volumeGroup, cloudRegion); @@ -246,8 +246,8 @@ public class AAICreateTasks { public void createVfModule(BuildingBlockExecution execution) { try { - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); - VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); int moduleIndex = 0; if (vfModule.getModelInfoVfModule() != null && !Boolean.TRUE.equals(vfModule.getModelInfoVfModule().getIsBaseBoolean())) { moduleIndex = this.getLowestUnusedVfModuleIndexFromAAIVnfResponse(vnf, vfModule); @@ -266,11 +266,11 @@ public class AAICreateTasks { */ public void connectVfModuleToVolumeGroup(BuildingBlockExecution execution) { try { - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); - VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); VolumeGroup volumeGroup = null; try{ - volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID)); + volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID); } catch (BBObjectNotFoundException e){ logger.info("VolumeGroup not found. Skipping Connect between VfModule and VolumeGroup"); } @@ -289,8 +289,8 @@ public class AAICreateTasks { */ public void createNetwork(BuildingBlockExecution execution) { try { - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); - L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); //set default to false. ToBe updated by SDNC l3network.setIsBoundToVpn(false); //define is bound to vpn flag as true if NEUTRON_NETWORK_TYPE is PROVIDER @@ -319,7 +319,7 @@ public class AAICreateTasks { */ public void createNetworkCollection(BuildingBlockExecution execution) { try { - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); Collection networkCollection = serviceInstance.getCollection(); //pass name generated for NetworkCollection/NetworkCollectionInstanceGroup in previous step of the BB flow //put shell in AAI @@ -337,7 +337,7 @@ public class AAICreateTasks { */ public void createNetworkCollectionInstanceGroup(BuildingBlockExecution execution) { try { - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); InstanceGroup instanceGroup = serviceInstance.getCollection().getInstanceGroup(); //set name generated for NetworkCollection/NetworkCollectionInstanceGroup in previous step of the BB flow instanceGroup.setInstanceGroupName(execution.getVariable(NETWORK_COLLECTION_NAME)); @@ -356,7 +356,7 @@ public class AAICreateTasks { */ public void connectNetworkToTenant(BuildingBlockExecution execution) { try { - L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); aaiNetworkResources.connectNetworkToTenant(l3network, execution.getGeneralBuildingBlock().getCloudRegion()); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); @@ -370,7 +370,7 @@ public class AAICreateTasks { */ public void connectNetworkToCloudRegion(BuildingBlockExecution execution) { try { - L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); aaiNetworkResources.connectNetworkToCloudRegion(l3network, execution.getGeneralBuildingBlock().getCloudRegion()); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); @@ -390,7 +390,7 @@ public class AAICreateTasks { cloudRegionsToSkip = Arrays.stream(cloudRegions).anyMatch(execution.getGeneralBuildingBlock().getCloudRegion().getLcpCloudRegionId()::equals); } if(!cloudRegionsToSkip) { - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); aaiVnfResources.connectVnfToCloudRegion(vnf, execution.getGeneralBuildingBlock().getCloudRegion()); } } catch (Exception ex) { @@ -405,7 +405,7 @@ public class AAICreateTasks { */ public void connectVnfToTenant(BuildingBlockExecution execution) { try { - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); aaiVnfResources.connectVnfToTenant(vnf, execution.getGeneralBuildingBlock().getCloudRegion()); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); @@ -419,8 +419,8 @@ public class AAICreateTasks { */ public void connectNetworkToNetworkCollectionServiceInstance(BuildingBlockExecution execution) { try { - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); - L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); aaiNetworkResources.connectNetworkToNetworkCollectionServiceInstance(l3network, serviceInstance); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); @@ -434,8 +434,8 @@ public class AAICreateTasks { */ public void connectNetworkToNetworkCollectionInstanceGroup(BuildingBlockExecution execution) { try { - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); - L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); //connect network only if Instance Group / Collection objects exist if (serviceInstance.getCollection() != null && serviceInstance.getCollection().getInstanceGroup() != null) aaiNetworkResources.connectNetworkToNetworkCollectionInstanceGroup(l3network, serviceInstance.getCollection().getInstanceGroup()); @@ -446,7 +446,7 @@ public class AAICreateTasks { public void createConfiguration(BuildingBlockExecution execution){ try{ - Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID, execution.getLookupMap().get(ResourceKey.CONFIGURATION_ID)); + Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID); aaiConfigurationResources.createConfiguration(configuration); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); @@ -455,8 +455,8 @@ public class AAICreateTasks { public void createInstanceGroupVnf(BuildingBlockExecution execution){ try{ - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); - InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID, execution.getLookupMap().get(ResourceKey.INSTANCE_GROUP_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); + InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID); aaiInstanceGroupResources.createInstanceGroupandConnectServiceInstance(instanceGroup, serviceInstance); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java index 6e4a5f3d15..095fd7f86d 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java @@ -82,8 +82,8 @@ public class AAIDeleteTasks { private AAIInstanceGroupResources aaiInstanceGroupResources; public void deleteVfModule(BuildingBlockExecution execution) throws Exception { - GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); - VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); execution.setVariable("aaiVfModuleRollback", false); try { @@ -95,7 +95,7 @@ public class AAIDeleteTasks { } public void deleteVnf(BuildingBlockExecution execution) throws Exception { - GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); execution.setVariable("aaiVnfRollback", false); try { @@ -108,7 +108,7 @@ public class AAIDeleteTasks { public void deleteServiceInstance(BuildingBlockExecution execution) throws Exception { try { - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); aaiSIResources.deleteServiceInstance(serviceInstance); } catch(Exception ex) { @@ -119,7 +119,7 @@ public class AAIDeleteTasks { public void deleteNetwork(BuildingBlockExecution execution) throws Exception { try { - L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); aaiNetworkResources.deleteNetwork(l3network); execution.setVariable("isRollbackNeeded", true); } @@ -130,7 +130,7 @@ public class AAIDeleteTasks { public void deleteCollection(BuildingBlockExecution execution) throws Exception { try { - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); aaiNetworkResources.deleteCollection(serviceInstance.getCollection()); } catch(Exception ex) { @@ -140,7 +140,7 @@ public class AAIDeleteTasks { public void deleteInstanceGroup(BuildingBlockExecution execution) throws Exception { try { - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); aaiNetworkResources.deleteNetworkInstanceGroup(serviceInstance.getCollection().getInstanceGroup()); } catch(Exception ex) { @@ -150,7 +150,7 @@ public class AAIDeleteTasks { public void deleteVolumeGroup(BuildingBlockExecution execution) { try { - VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID)); + VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID); CloudRegion cloudRegion = execution.getGeneralBuildingBlock().getCloudRegion(); aaiVolumeGroupResources.deleteVolumeGroup(volumeGroup, cloudRegion); } catch (Exception ex) { @@ -159,7 +159,7 @@ public class AAIDeleteTasks { } public void deleteConfiguration(BuildingBlockExecution execution) { try { - Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID, execution.getLookupMap().get(ResourceKey.CONFIGURATION_ID)); + Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID); aaiConfigurationResources.deleteConfiguration(configuration); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); @@ -168,7 +168,7 @@ public class AAIDeleteTasks { public void deleteInstanceGroupVnf(BuildingBlockExecution execution) { try { - InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID, execution.getLookupMap().get(ResourceKey.INSTANCE_GROUP_ID)); + InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID); aaiInstanceGroupResources.deleteInstanceGroup(instanceGroup); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java index ccc9fb0e43..177e09d5a1 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java @@ -47,7 +47,7 @@ public class AAIFlagTasks { public void checkVnfInMaintFlag(BuildingBlockExecution execution) { boolean inMaint = false; try { - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); String vnfId = vnf.getVnfId(); inMaint = aaiVnfResources.checkInMaintFlag(vnfId); } catch (Exception ex) { @@ -60,7 +60,7 @@ public class AAIFlagTasks { public void modifyVnfInMaintFlag(BuildingBlockExecution execution, boolean inMaint) { try { - GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); GenericVnf copiedGenericVnf = genericVnf.shallowCopyId(); @@ -76,7 +76,7 @@ public class AAIFlagTasks { public void checkVnfClosedLoopDisabledFlag(BuildingBlockExecution execution) { boolean isClosedLoopDisabled = false; try { - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); String vnfId = vnf.getVnfId(); isClosedLoopDisabled = aaiVnfResources.checkVnfClosedLoopDisabledFlag(vnfId); } catch (Exception ex) { @@ -89,7 +89,7 @@ public class AAIFlagTasks { public void modifyVnfClosedLoopDisabledFlag(BuildingBlockExecution execution, boolean closedLoopDisabled) { try { - GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); GenericVnf copiedGenericVnf = genericVnf.shallowCopyId(); copiedGenericVnf.setClosedLoopDisabled(closedLoopDisabled); @@ -104,7 +104,7 @@ public class AAIFlagTasks { public void checkVnfPserversLockedFlag(BuildingBlockExecution execution) { boolean inPserversLocked = false; try { - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); String vnfId = vnf.getVnfId(); inPserversLocked = aaiVnfResources.checkVnfPserversLockedFlag(vnfId); } catch (Exception ex) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java index e89dffc6d9..e0e139e290 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java @@ -71,8 +71,7 @@ public class AAIQueryTasks { public void queryNetworkVpnBinding(BuildingBlockExecution execution) { try { - L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, - execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network); Optional<Relationships> networkRelationships = aaiResultWrapper.getRelationships(); if (!networkRelationships.isPresent()) { @@ -106,8 +105,7 @@ public class AAIQueryTasks { public void getNetworkVpnBinding(BuildingBlockExecution execution) { try { - L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, - execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network); CreateNetworkRequest createNetworkRequest = execution.getVariable("createNetworkRequest"); @@ -162,8 +160,7 @@ public class AAIQueryTasks { */ public void queryNetworkPolicy(BuildingBlockExecution execution) { try { - L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, - execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network); Optional<Relationships> networkRelationships = aaiResultWrapper.getRelationships(); if (!networkRelationships.isPresent()) { @@ -193,8 +190,7 @@ public class AAIQueryTasks { */ public void queryNetworkTableRef(BuildingBlockExecution execution) { try { - L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, - execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network); Optional<Relationships> networkRelationships = aaiResultWrapper.getRelationships(); if (!networkRelationships.isPresent()) { @@ -229,8 +225,7 @@ public class AAIQueryTasks { public void querySubnet(BuildingBlockExecution execution) { try { - L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, - execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network); Optional<Relationships> networkRelationships = aaiResultWrapper.getRelationships(); if (!networkRelationships.isPresent()) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java index c2cbdd1ceb..4237a50061 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java @@ -82,7 +82,7 @@ public class AAIUpdateTasks { public void updateOrchestrationStatusAssignedService(BuildingBlockExecution execution) { try { - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); aaiServiceInstanceResources.updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ASSIGNED); execution.setVariable("aaiServiceInstanceRollback", true); } catch (Exception ex) { @@ -92,7 +92,7 @@ public class AAIUpdateTasks { public void updateOrchestrationStatusActiveService(BuildingBlockExecution execution) { try { - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); aaiServiceInstanceResources.updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ACTIVE); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); @@ -101,7 +101,7 @@ public class AAIUpdateTasks { public void updateOrchestrationStatusAssignedVnf(BuildingBlockExecution execution) { try { - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); aaiVnfResources.updateOrchestrationStatusVnf(vnf,OrchestrationStatus.ASSIGNED); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); @@ -110,7 +110,7 @@ public class AAIUpdateTasks { public void updateOrchestrationStatusActiveVnf(BuildingBlockExecution execution) { try { - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); aaiVnfResources.updateOrchestrationStatusVnf(vnf,OrchestrationStatus.ACTIVE); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); @@ -121,7 +121,7 @@ public class AAIUpdateTasks { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); - VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID)); + VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID); CloudRegion cloudRegion = gBBInput.getCloudRegion(); volumeGroup.setHeatStackId(""); aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ASSIGNED); @@ -134,7 +134,7 @@ public class AAIUpdateTasks { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); - VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID)); + VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID); CloudRegion cloudRegion = gBBInput.getCloudRegion(); aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ACTIVE); @@ -147,7 +147,7 @@ public class AAIUpdateTasks { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); - VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID)); + VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID); CloudRegion cloudRegion = gBBInput.getCloudRegion(); aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.CREATED); @@ -163,7 +163,7 @@ public class AAIUpdateTasks { if (heatStackId == null) { heatStackId = ""; } - VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID)); + VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID); CloudRegion cloudRegion = gBBInput.getCloudRegion(); volumeGroup.setHeatStackId(heatStackId); @@ -175,9 +175,9 @@ public class AAIUpdateTasks { public void updateOrchestrationStatusAssignedVfModule(BuildingBlockExecution execution) { try { - VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); vfModule.setHeatStackId(""); - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.ASSIGNED); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); @@ -186,8 +186,8 @@ public class AAIUpdateTasks { public void updateOrchestrationStatusPendingActivationVfModule(BuildingBlockExecution execution) { try { - VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.PENDING_ACTIVATION); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); @@ -196,9 +196,9 @@ public class AAIUpdateTasks { public void updateOrchestrationStatusAssignedOrPendingActivationVfModule(BuildingBlockExecution execution) { try { - VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); vfModule.setHeatStackId(""); - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); String multiStageDesign = MULTI_STAGE_DESIGN_OFF; if (vnf.getModelInfoGenericVnf() != null) { multiStageDesign = vnf.getModelInfoGenericVnf().getMultiStageDesign(); @@ -217,8 +217,8 @@ public class AAIUpdateTasks { public void updateOrchestrationStatusCreatedVfModule(BuildingBlockExecution execution) { try { - VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.CREATED); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); @@ -228,8 +228,8 @@ public class AAIUpdateTasks { public void updateOrchestrationStatusDeactivateVfModule(BuildingBlockExecution execution) { execution.setVariable("aaiDeactivateVfModuleRollback", false); try { - VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.CREATED); execution.setVariable("aaiDeactivateVfModuleRollback", true); } catch (Exception ex) { @@ -266,7 +266,7 @@ public class AAIUpdateTasks { protected void updateNetwork(BuildingBlockExecution execution, OrchestrationStatus status) { try { - L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); updateNetworkAAI(l3Network, status); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); @@ -298,7 +298,7 @@ public class AAIUpdateTasks { public void updateOrchestrationStatusActiveNetworkCollection(BuildingBlockExecution execution) { execution.setVariable("aaiNetworkCollectionActivateRollback", false); try { - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); Collection networkCollection = serviceInstance.getCollection(); Collection copiedNetworkCollection = networkCollection.shallowCopyId(); @@ -314,8 +314,8 @@ public class AAIUpdateTasks { public void updateOrchestrationStatusActivateVfModule(BuildingBlockExecution execution) { execution.setVariable("aaiActivateVfModuleRollback", false); try { - VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ACTIVE); execution.setVariable("aaiActivateVfModuleRollback", true); } catch (Exception ex) { @@ -329,8 +329,8 @@ public class AAIUpdateTasks { if (heatStackId == null) { heatStackId = ""; } - VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); vfModule.setHeatStackId(heatStackId); aaiVfModuleResources.updateHeatStackIdVfModule(vfModule, vnf); } catch (Exception ex) { @@ -345,7 +345,7 @@ public class AAIUpdateTasks { */ public void updateNetworkCreated(BuildingBlockExecution execution) throws Exception { execution.setVariable("aaiNetworkActivateRollback", false); - L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); L3Network copiedl3network = l3network.shallowCopyId(); CreateNetworkResponse response = execution.getVariable("createNetworkResponse"); try { @@ -386,7 +386,7 @@ public class AAIUpdateTasks { * @throws Exception */ public void updateNetworkUpdated(BuildingBlockExecution execution) throws Exception { - L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); L3Network copiedl3network = l3network.shallowCopyId(); UpdateNetworkResponse response = execution.getVariable("updateNetworkResponse"); try { @@ -410,7 +410,7 @@ public class AAIUpdateTasks { public void updateObjectNetwork(BuildingBlockExecution execution) { try { - L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); aaiNetworkResources.updateNetwork(l3network); } catch(Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); @@ -423,7 +423,7 @@ public class AAIUpdateTasks { */ public void updateServiceInstance(BuildingBlockExecution execution) { try { - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); aaiServiceInstanceResources.updateServiceInstance(serviceInstance); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); @@ -432,7 +432,7 @@ public class AAIUpdateTasks { public void updateObjectVnf(BuildingBlockExecution execution) { try { - GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); aaiVnfResources.updateObjectVnf(genericVnf); } catch(Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); @@ -442,9 +442,9 @@ public class AAIUpdateTasks { public void updateOrchestrationStatusDeleteVfModule(BuildingBlockExecution execution) { execution.setVariable("aaiDeleteVfModuleRollback", false); try { - VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); vfModule.setHeatStackId(""); - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); VfModule copiedVfModule = vfModule.shallowCopyId(); copiedVfModule.setHeatStackId(""); @@ -457,8 +457,8 @@ public class AAIUpdateTasks { public void updateModelVfModule(BuildingBlockExecution execution) { try { - VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); aaiVfModuleResources.changeAssignVfModule(vfModule, vnf); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); @@ -466,7 +466,7 @@ public class AAIUpdateTasks { } public void updateOrchestrationStatusActivateFabricConfiguration(BuildingBlockExecution execution) { try { - Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID, execution.getLookupMap().get(ResourceKey.CONFIGURATION_ID)); + Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID); aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ACTIVE); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); @@ -475,7 +475,7 @@ public class AAIUpdateTasks { public void updateOrchestrationStatusDeactivateFabricConfiguration(BuildingBlockExecution execution) { try { - Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID, execution.getLookupMap().get(ResourceKey.CONFIGURATION_ID)); + Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID); aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ASSIGNED); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); @@ -486,7 +486,7 @@ public class AAIUpdateTasks { try { String ipv4OamAddress = execution.getVariable("oamManagementV4Address"); if (ipv4OamAddress != null) { - GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); GenericVnf copiedGenericVnf = genericVnf.shallowCopyId(); genericVnf.setIpv4OamAddress(ipv4OamAddress); @@ -503,7 +503,7 @@ public class AAIUpdateTasks { try { String managementV6Address = execution.getVariable("oamManagementV6Address"); if (managementV6Address != null) { - GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); GenericVnf copiedGenericVnf = genericVnf.shallowCopyId(); genericVnf.setManagementV6Address(managementV6Address); @@ -520,8 +520,8 @@ public class AAIUpdateTasks { try { String contrailServiceInstanceFqdn = execution.getVariable("contrailServiceInstanceFqdn"); if (contrailServiceInstanceFqdn != null) { - VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); vfModule.setContrailServiceInstanceFqdn(contrailServiceInstanceFqdn); aaiVfModuleResources.updateContrailServiceInstanceFqdnVfModule(vfModule, vnf); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasks.java index 4c531d46f9..67d2864204 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasks.java @@ -53,8 +53,8 @@ public class NetworkAdapterCreateTasks { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); - L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); + L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); Map<String, String> userInput = gBBInput.getUserInput(); String cloudRegionPo = execution.getVariable("cloudRegionPo"); @@ -69,7 +69,7 @@ public class NetworkAdapterCreateTasks { public void processResponseFromOpenstack(BuildingBlockExecution execution) { try { - L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); CreateNetworkResponse createNetworkResponse = execution.getVariable("createNetworkResponse"); if(createNetworkResponse != null) { @@ -90,8 +90,8 @@ public class NetworkAdapterCreateTasks { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); - L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); + L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); CreateNetworkResponse createNetworkResponse = execution.getVariable("createNetworkResponse"); Map<String, String> userInput = gBBInput.getUserInput(); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasks.java index 5eab6110f9..7e0c5f6da4 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasks.java @@ -46,8 +46,8 @@ public class NetworkAdapterDeleteTasks { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); - L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); DeleteNetworkRequest deleteNetworkRequest = networkAdapterObjectMapper.deleteNetworkRequestMapper(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), serviceInstance, l3Network); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java index 61687081d9..9eeba0445b 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasks.java @@ -52,8 +52,8 @@ public class NetworkAdapterUpdateTasks { public void updateNetwork(BuildingBlockExecution execution) { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); - L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); + L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); UpdateNetworkRequest updateNetworkRequest = networkAdapterObjectMapper.createNetworkUpdateRequestMapper(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), gBBInput.getOrchContext(), serviceInstance, l3Network, gBBInput.getUserInput(), gBBInput.getCustomer()); execution.setVariable("networkAdapterRequest", updateNetworkRequest); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java index 1815fcd827..ae9e6e7488 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java @@ -65,12 +65,12 @@ public class VnfAdapterCreateTasks { ServiceInstance serviceInstance = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0); - GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); - VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID)); + GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); + VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID); VfModule vfModule; String sdncVfModuleQueryResponse = null; try { - vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); if(vfModule.getSelflink() != null && !vfModule.getSelflink().isEmpty()) { sdncVfModuleQueryResponse = execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId()); } @@ -94,11 +94,11 @@ public class VnfAdapterCreateTasks { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); ServiceInstance serviceInstance = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0); - VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); - GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); + GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); VolumeGroup volumeGroup = null; try { - volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID)); + volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID); } catch(BBObjectNotFoundException bbException) { } CloudRegion cloudRegion = gBBInput.getCloudRegion(); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java index 759ec61878..a96e2702cd 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java @@ -58,8 +58,8 @@ public class VnfAdapterDeleteTasks { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); - VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); + VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID); DeleteVolumeGroupRequest deleteVolumeGroupRequest = vnfAdapterVolumeGroupResources.deleteVolumeGroupRequest(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), serviceInstance, volumeGroup); execution.setVariable(VNFREST_REQUEST, deleteVolumeGroupRequest.toXmlString()); @@ -73,9 +73,9 @@ public class VnfAdapterDeleteTasks { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); - VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); - GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); + GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); DeleteVfModuleRequest deleteVfModuleRequest = vnfAdapterVfModuleResources.deleteVfModuleRequest( gBBInput.getRequestContext(), gBBInput.getCloudRegion(), serviceInstance, genericVnf, vfModule); execution.setVariable(VNFREST_REQUEST, deleteVfModuleRequest.toXmlString()); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java index 05ddb2e417..e854efd414 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java @@ -74,7 +74,7 @@ public class VnfAdapterImpl { public void preProcessVnfAdapter(BuildingBlockExecution execution) { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); execution.setVariable("mso-request-id", gBBInput.getRequestContext().getMsoRequestId()); execution.setVariable("mso-service-instance-id", serviceInstance.getServiceInstanceId()); execution.setVariable("heatStackId", null); @@ -93,7 +93,7 @@ public class VnfAdapterImpl { if (!StringUtils.isEmpty( vnfAdapterResponse)) { Object vnfRestResponse = unMarshal(vnfAdapterResponse); if(vnfRestResponse instanceof CreateVfModuleResponse) { - VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); String heatStackId = ((CreateVfModuleResponse) vnfRestResponse).getVfModuleStackId(); if(!StringUtils.isEmpty(heatStackId)) { vfModule.setHeatStackId(heatStackId); @@ -104,8 +104,8 @@ public class VnfAdapterImpl { processVfModuleOutputs(execution, vfModuleOutputs); } } else if(vnfRestResponse instanceof DeleteVfModuleResponse) { - VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); - GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); + GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); Boolean vfModuleDelete = ((DeleteVfModuleResponse) vnfRestResponse).getVfModuleDeleted(); if(null!= vfModuleDelete && vfModuleDelete) { vfModule.setHeatStackId(null); @@ -128,7 +128,7 @@ public class VnfAdapterImpl { } } } else if(vnfRestResponse instanceof CreateVolumeGroupResponse) { - VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID)); + VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID); String heatStackId = ((CreateVolumeGroupResponse) vnfRestResponse).getVolumeGroupStackId(); if(!StringUtils.isEmpty(heatStackId)) { volumeGroup.setHeatStackId(heatStackId); @@ -137,7 +137,7 @@ public class VnfAdapterImpl { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "HeatStackId is missing from create VolumeGroup Vnf Adapter response."); } } else if(vnfRestResponse instanceof DeleteVolumeGroupResponse) { - VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID)); + VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID); Boolean volumeGroupDelete = ((DeleteVolumeGroupResponse) vnfRestResponse).getVolumeGroupDeleted(); if(null!= volumeGroupDelete && volumeGroupDelete) { volumeGroup.setHeatStackId(null); @@ -178,8 +178,8 @@ public class VnfAdapterImpl { return; } try { - VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); - GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); + GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); List<String> contrailNetworkPolicyFqdnList = new ArrayList<String>(); Iterator<String> keys = vfModuleOutputs.keySet().iterator(); while (keys.hasNext()) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java index 876a555b10..f9e4177315 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java @@ -82,7 +82,7 @@ public class AppcRunTasks { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); GenericVnf vnf = null; try { - vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); } catch (BBObjectNotFoundException e) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "No valid VNF exists"); } @@ -110,7 +110,7 @@ public class AppcRunTasks { String vfModuleId = null; VfModule vfModule = null; try { - vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); } catch (BBObjectNotFoundException e) { } if (vfModule != null) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java index 8cb7cbbe91..f6e07c8303 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java @@ -71,7 +71,7 @@ public class AuditTasks { AuditInventory auditInventory = new AuditInventory(); GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); - VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); CloudRegion cloudRegion = gBBInput.getCloudRegion(); auditInventory.setCloudOwner(cloudRegion.getCloudOwner()); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java index 753a29f208..c3106d6e49 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java @@ -47,8 +47,7 @@ public class AssignNetwork { public boolean networkFoundByName(BuildingBlockExecution execution) { boolean networkFound = false; try { - L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, - execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); if (!OrchestrationStatus.PRECREATED.equals(l3network.getOrchestrationStatus())){ networkFound = true; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java index ee80ba4c55..0aa3142996 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnf.java @@ -50,7 +50,7 @@ public class AssignVnf { public void createInstanceGroups(BuildingBlockExecution execution) { try { - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); List<InstanceGroup> instanceGroups = vnf.getInstanceGroups(); for(InstanceGroup instanceGroup : instanceGroups) { if(ModelInfoInstanceGroup.TYPE_VNFC.equalsIgnoreCase(instanceGroup.getModelInfoInstanceGroup().getType())) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java index 717d0deff6..4cd0321578 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java @@ -81,7 +81,7 @@ public class ConfigurationScaleOut { String configScaleOutPayloadString = null; ControllerSelectionReference controllerSelectionReference; ConfigScaleOutPayload configPayload = new ConfigScaleOutPayload(); - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); String vnfId = vnf.getVnfId(); String vnfName = vnf.getVnfName(); String vnfType = vnf.getVnfType(); @@ -89,7 +89,7 @@ public class ConfigurationScaleOut { controllerSelectionReference = catalogDbClient.getControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, actionCategory); String controllerName = controllerSelectionReference.getControllerName(); - VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); String sdncVfModuleQueryResponse = execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId()); Map<String, String> paramsMap = new HashMap<>(); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java index 962d4fa8c4..8cad8f93ec 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetwork.java @@ -55,8 +55,8 @@ public class CreateNetwork { public void buildCreateNetworkRequest(BuildingBlockExecution execution) throws Exception { try{ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); - L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); + L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); Map<String, String> userInput = gBBInput.getUserInput(); String cloudRegionPo = execution.getVariable("cloudRegionPo"); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java index 060775e1d7..5665302b2a 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java @@ -54,7 +54,7 @@ public class CreateNetworkCollection { */ public void buildNetworkCollectionName(BuildingBlockExecution execution) throws Exception { try{ - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); InstanceGroup instanceGroup = serviceInstance.getCollection().getInstanceGroup(); if(instanceGroup.getModelInfoInstanceGroup() != null) { //Build collection name assembling SI name and IG function @@ -84,7 +84,7 @@ public class CreateNetworkCollection { public void connectCollectionToInstanceGroup(BuildingBlockExecution execution) throws Exception { execution.setVariable("connectCollectionToInstanceGroupRollback", false); try{ - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); Collection networkCollection = serviceInstance.getCollection(); aaiNetworkResources.connectNetworkCollectionInstanceGroupToNetworkCollection(networkCollection.getInstanceGroup(), networkCollection); execution.setVariable("connectCollectionToInstanceGroupRollback", true); @@ -101,7 +101,7 @@ public class CreateNetworkCollection { public void connectInstanceGroupToCloudRegion(BuildingBlockExecution execution) throws Exception { execution.setVariable("connectInstanceGroupToCloudRegionRollback", false); try{ - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); Collection networkCollection = serviceInstance.getCollection(); aaiNetworkResources.connectInstanceGroupToCloudRegion(networkCollection.getInstanceGroup(), execution.getGeneralBuildingBlock().getCloudRegion()); execution.setVariable("connectInstanceGroupToCloudRegionRollback", true); @@ -118,7 +118,7 @@ public class CreateNetworkCollection { public void connectCollectionToServiceInstance(BuildingBlockExecution execution) throws Exception { execution.setVariable("connectCollectionToServiceInstanceRollback", false); try{ - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); Collection networkCollection = serviceInstance.getCollection(); aaiNetworkResources.connectNetworkCollectionToServiceInstance(networkCollection, serviceInstance); execution.setVariable("connectCollectionToServiceInstanceRollback", true); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java index ce14bde0b3..f0db5eda2e 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java @@ -60,7 +60,7 @@ public class GenericVnfHealthCheck { try { ControllerSelectionReference controllerSelectionReference; - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); String vnfId = vnf.getVnfId(); String vnfName = vnf.getVnfName(); String vnfType = vnf.getVnfType(); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java index c7fd41c77a..9a7d695c01 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java @@ -67,8 +67,7 @@ public class UnassignNetworkBB { public void checkRelationshipRelatedTo(BuildingBlockExecution execution, String relatedToValue) throws Exception { try { - L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, - execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network); Optional<org.onap.aai.domain.yang.L3Network> network = aaiResultWrapper.asBean(org.onap.aai.domain.yang.L3Network.class); if (networkBBUtils.isRelationshipRelatedToExists(network, relatedToValue)) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java index b9360b3d81..afa9b439db 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java @@ -48,7 +48,7 @@ public class UnassignVnf { public void deleteInstanceGroups(BuildingBlockExecution execution) { try { - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); List<InstanceGroup> instanceGroups = vnf.getInstanceGroups(); for(InstanceGroup instanceGroup : instanceGroups) { if(ModelInfoInstanceGroup.TYPE_VNFC.equalsIgnoreCase(instanceGroup.getModelInfoInstanceGroup().getType())) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java index cb4ac5c9d9..119716a58d 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java @@ -42,7 +42,7 @@ public class NamingServiceCreateTasks { private NamingServiceResources namingServiceResources; public void createInstanceGroupName(BuildingBlockExecution execution) throws Exception { - InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID, execution.getLookupMap().get(ResourceKey.INSTANCE_GROUP_ID)); + InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID); String policyInstanceName = execution.getVariable("policyInstanceName"); String nfNamingCode = execution.getVariable("nfNamingCode"); String generatedInstanceGroupName = ""; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java index ddea2724bc..c998e4aa75 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java @@ -42,7 +42,7 @@ public class NamingServiceDeleteTasks { private NamingServiceResources namingServiceResources; public void deleteInstanceGroupName(BuildingBlockExecution execution) throws Exception { - InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID, execution.getLookupMap().get(ResourceKey.INSTANCE_GROUP_ID)); + InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID); try { namingServiceResources.deleteInstanceGroupName(instanceGroup); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java index 3793adc5d0..31f4b33e0c 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java @@ -67,8 +67,8 @@ public class SDNCActivateTasks { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); RequestContext requestContext = gBBInput.getRequestContext(); - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); CloudRegion cloudRegion = gBBInput.getCloudRegion(); Customer customer = gBBInput.getCustomer(); GenericResourceApiVnfOperationInformation req = sdncVnfResources.activateVnf(vnf, serviceInstance, customer, cloudRegion, requestContext); @@ -89,8 +89,8 @@ public class SDNCActivateTasks { public void activateNetwork(BuildingBlockExecution execution) throws BBObjectNotFoundException { try{ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); - L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); Customer customer = gBBInput.getCustomer(); RequestContext requestContext = gBBInput.getRequestContext(); CloudRegion cloudRegion = gBBInput.getCloudRegion(); @@ -111,12 +111,9 @@ public class SDNCActivateTasks { GenericVnf vnf = null; VfModule vfModule = null; try { - serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, - execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); - vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, - execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); - vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, - execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); + vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); + vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); Customer customer = gBBInput.getCustomer(); CloudRegion cloudRegion = gBBInput.getCloudRegion(); GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.activateVfModule(vfModule, vnf, serviceInstance, customer, diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java index 715322bef3..cbb1f34ae5 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java @@ -71,7 +71,7 @@ public class SDNCAssignTasks { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); RequestContext requestContext = gBBInput.getRequestContext(); - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); Customer customer = gBBInput.getCustomer(); GenericResourceApiServiceOperationInformation req = sdncSIResources.assignServiceInstance(serviceInstance, customer, requestContext); SDNCRequest sdncRequest = new SDNCRequest(); @@ -87,8 +87,8 @@ public class SDNCAssignTasks { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); RequestContext requestContext = gBBInput.getRequestContext(); - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); Customer customer = gBBInput.getCustomer(); CloudRegion cloudRegion = gBBInput.getCloudRegion(); GenericResourceApiVnfOperationInformation req = sdncVnfResources.assignVnf(vnf, serviceInstance, customer, cloudRegion, requestContext, Boolean.TRUE.equals(vnf.isCallHoming())); @@ -105,12 +105,12 @@ public class SDNCAssignTasks { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); RequestContext requestContext = gBBInput.getRequestContext(); - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); - VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); VolumeGroup volumeGroup = null; try{ - volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID)); + volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID); } catch (BBObjectNotFoundException e){ logger.info("No volume group was found."); } @@ -134,8 +134,8 @@ public class SDNCAssignTasks { public void assignNetwork(BuildingBlockExecution execution) { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); - L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); Customer customer = gBBInput.getCustomer(); RequestContext requestContext = gBBInput.getRequestContext(); CloudRegion cloudRegion = gBBInput.getCloudRegion(); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java index 592b831d62..59e46e1667 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasks.java @@ -63,7 +63,7 @@ public class SDNCChangeAssignTasks { public void changeModelServiceInstance(BuildingBlockExecution execution) { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); GenericResourceApiServiceOperationInformation req = sdncServiceInstanceResources.changeModelServiceInstance(serviceInstance, gBBInput.getCustomer(), gBBInput.getRequestContext()); SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); @@ -77,8 +77,8 @@ public class SDNCChangeAssignTasks { public void changeModelVnf(BuildingBlockExecution execution) { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); - GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); GenericResourceApiVnfOperationInformation req = sdncVnfResources.changeModelVnf(genericVnf, serviceInstance, gBBInput.getCustomer(), gBBInput.getCloudRegion(), gBBInput.getRequestContext()); SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); @@ -92,8 +92,8 @@ public class SDNCChangeAssignTasks { public void changeAssignNetwork(BuildingBlockExecution execution) { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); - L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.changeAssignNetwork(network, serviceInstance, gBBInput.getCustomer(), gBBInput.getRequestContext(), gBBInput.getCloudRegion()); SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); @@ -109,9 +109,9 @@ public class SDNCChangeAssignTasks { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); RequestContext requestContext = gBBInput.getRequestContext(); CloudRegion cloudRegion = gBBInput.getCloudRegion(); - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); - VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); Customer customer = gBBInput.getCustomer(); GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.changeAssignVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext); SDNCRequest sdncRequest = new SDNCRequest(); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java index d7313ad9a4..8202a14fa3 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java @@ -69,9 +69,9 @@ public class SDNCDeactivateTasks { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); RequestContext requestContext = gBBInput.getRequestContext(); - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); - VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); Customer customer = gBBInput.getCustomer(); CloudRegion cloudRegion = gBBInput.getCloudRegion(); GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.deactivateVfModule(vfModule, vnf, serviceInstance, customer, @@ -95,8 +95,8 @@ public class SDNCDeactivateTasks { RequestContext requestContext = gBBInput.getRequestContext(); ServiceInstance serviceInstance = null; GenericVnf vnf = null; - serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); - vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); + vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); CloudRegion cloudRegion = gBBInput.getCloudRegion(); Customer customer = gBBInput.getCustomer(); GenericResourceApiVnfOperationInformation req = sdncVnfResources.deactivateVnf(vnf, serviceInstance, customer, cloudRegion, requestContext); @@ -118,8 +118,7 @@ public class SDNCDeactivateTasks { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); RequestContext requestContext = gBBInput.getRequestContext(); - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, - execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); Customer customer = gBBInput.getCustomer(); GenericResourceApiServiceOperationInformation req = sdncSIResources.deactivateServiceInstance(serviceInstance, customer, requestContext); SDNCRequest sdncRequest = new SDNCRequest(); @@ -139,8 +138,8 @@ public class SDNCDeactivateTasks { public void deactivateNetwork(BuildingBlockExecution execution) { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); - L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); Customer customer = gBBInput.getCustomer(); RequestContext requestContext = gBBInput.getRequestContext(); CloudRegion cloudRegion = gBBInput.getCloudRegion(); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java index b636fe1292..941eb7a004 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java @@ -50,8 +50,8 @@ public class SDNCQueryTasks { private ExtractPojosForBB extractPojosForBB; public void queryVnf(BuildingBlockExecution execution) throws Exception { - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); - GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); + GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); String selfLink = "restconf/config/GENERIC-RESOURCE-API:services/service/" + serviceInstance.getServiceInstanceId() + "/service-data/vnfs/vnf/" @@ -69,9 +69,9 @@ public class SDNCQueryTasks { public void queryVfModule(BuildingBlockExecution execution) throws Exception { - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); - GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); - VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); + GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); String selfLink = "restconf/config/GENERIC-RESOURCE-API:services/service/" + serviceInstance.getServiceInstanceId() + "/service-data/vnfs/vnf/" + genericVnf.getVnfId() + "/vnf-data/vf-modules/vf-module/" @@ -94,7 +94,7 @@ public class SDNCQueryTasks { public void queryVfModuleForVolumeGroup(BuildingBlockExecution execution) { try { - VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); if(vfModule.getSelflink() != null && !vfModule.getSelflink().isEmpty()) { String response = sdncVfModuleResources.queryVfModule(vfModule); execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), response); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java index 292f29c349..340872593f 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java @@ -68,7 +68,7 @@ public class SDNCUnassignTasks { public void unassignServiceInstance(BuildingBlockExecution execution) { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); RequestContext requestContext = gBBInput.getRequestContext(); Customer customer = gBBInput.getCustomer(); GenericResourceApiServiceOperationInformation req = sdncSIResources.unassignServiceInstance(serviceInstance, customer, requestContext); @@ -83,9 +83,9 @@ public class SDNCUnassignTasks { public void unassignVfModule(BuildingBlockExecution execution) { try { - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); - VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance); SDNCRequest sdncRequest = new SDNCRequest(); sdncRequest.setSDNCPayload(req); @@ -98,8 +98,8 @@ public class SDNCUnassignTasks { public void unassignVnf(BuildingBlockExecution execution) { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); RequestContext requestContext = gBBInput.getRequestContext(); Customer customer = gBBInput.getCustomer(); CloudRegion cloudRegion = gBBInput.getCloudRegion(); @@ -116,8 +116,8 @@ public class SDNCUnassignTasks { public void unassignNetwork(BuildingBlockExecution execution) throws Exception { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); - L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); Customer customer = gBBInput.getCustomer(); RequestContext requestContext = gBBInput.getRequestContext(); CloudRegion cloudRegion = gBBInput.getCloudRegion(); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java index a622520a71..bbfc01921c 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java @@ -80,36 +80,36 @@ public class OrchestrationStatusValidator { switch(buildingBlockDetail.getResourceType()) { case SERVICE: - org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); orchestrationStatus = serviceInstance.getOrchestrationStatus(); break; case VNF: - org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); orchestrationStatus = genericVnf.getOrchestrationStatus(); break; case VF_MODULE: - org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); orchestrationStatus = vfModule.getOrchestrationStatus(); break; case VOLUME_GROUP: - org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID)); + org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID); orchestrationStatus = volumeGroup.getOrchestrationStatus(); break; case NETWORK: - org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); orchestrationStatus = network.getOrchestrationStatus(); break; case NETWORK_COLLECTION: - org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInst = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInst = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); org.onap.so.bpmn.servicedecomposition.bbobjects.Collection networkCollection = serviceInst.getCollection(); orchestrationStatus = networkCollection.getOrchestrationStatus(); break; case CONFIGURATION: - org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID, execution.getLookupMap().get(ResourceKey.CONFIGURATION_ID)); + org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID); orchestrationStatus = configuration.getOrchestrationStatus(); break; case INSTANCE_GROUP: - org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID, execution.getLookupMap().get(ResourceKey.INSTANCE_GROUP_ID)); + org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID); orchestrationStatus = instanceGroup.getOrchestrationStatus(); break; case NO_VALIDATE: @@ -128,7 +128,7 @@ public class OrchestrationStatusValidator { if(aLaCarte && ResourceType.VF_MODULE.equals(buildingBlockDetail.getResourceType()) && OrchestrationAction.CREATE.equals(buildingBlockDetail.getTargetAction()) && OrchestrationStatus.PENDING_ACTIVATION.equals(orchestrationStatus)) { - org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); orchestrationStatusStateTransitionDirective = processPossibleSecondStageofVfModuleCreate(execution, previousOrchestrationStatusValidationResult, genericVnf, orchestrationStatusStateTransitionDirective); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java index 482957e006..242f125bde 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java @@ -375,38 +375,23 @@ public class WorkflowActionBBTasks { List<Vnfc> vnfcs = workflowAction.getRelatedResourcesInVfModule(vnfId, vfModuleId, Vnfc.class, AAIObjectType.VNFC); for(Vnfc vnfc : vnfcs) { String modelCustomizationId = vnfc.getModelCustomizationId(); - List<CvnfcCustomization> cvnfcCustomizations = catalogDbClient.getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID(vnfCustomizationUUID, vfModuleCustomizationUUID); - CvnfcCustomization cvnfcCustomization = null; - for(CvnfcCustomization cvnfc : cvnfcCustomizations) { - if(cvnfc.getModelCustomizationUUID().equalsIgnoreCase(modelCustomizationId)) { - cvnfcCustomization = cvnfc; - } - } - if(cvnfcCustomization != null) { - VnfVfmoduleCvnfcConfigurationCustomization fabricConfig = null; - for(VnfVfmoduleCvnfcConfigurationCustomization customization : cvnfcCustomization.getVnfVfmoduleCvnfcConfigurationCustomization()){ - if(customization.getConfigurationResource().getToscaNodeType().contains(FABRIC_CONFIGURATION)){ - if(fabricConfig == null) { - fabricConfig = customization; - } else { - throw new Exception("Multiple Fabric configs found for this vnfc"); - } - } - } - if(fabricConfig != null) { - String configurationId = UUID.randomUUID().toString(); - ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys(); - configurationResourceKeys.setCvnfcCustomizationUUID(modelCustomizationId); - configurationResourceKeys.setVfModuleCustomizationUUID(vfModuleCustomizationUUID); - configurationResourceKeys.setVnfResourceCustomizationUUID(vnfCustomizationUUID); - configurationResourceKeys.setVnfcName(vnfc.getVnfcName()); - ExecuteBuildingBlock assignConfigBB = getExecuteBBForConfig(ASSIGN_FABRIC_CONFIGURATION_BB, ebb, configurationId, configurationResourceKeys); - ExecuteBuildingBlock activateConfigBB = getExecuteBBForConfig(ACTIVATE_FABRIC_CONFIGURATION_BB, ebb, configurationId, configurationResourceKeys); - flowsToExecute.add(assignConfigBB); - flowsToExecute.add(activateConfigBB); - execution.setVariable("flowsToExecute", flowsToExecute); - execution.setVariable("completed", false); - } + VnfVfmoduleCvnfcConfigurationCustomization fabricConfig = + catalogDbClient.getVnfVfmoduleCvnfcConfigurationCustomizationByVnfCustomizationUuidAndVfModuleCustomizationUuidAndCvnfcCustomizationUuid(vnfCustomizationUUID, vfModuleCustomizationUUID, modelCustomizationId); + if(fabricConfig != null && fabricConfig.getConfigurationResource() != null + && fabricConfig.getConfigurationResource().getToscaNodeType() != null + && fabricConfig.getConfigurationResource().getToscaNodeType().contains(FABRIC_CONFIGURATION)) { + String configurationId = UUID.randomUUID().toString(); + ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys(); + configurationResourceKeys.setCvnfcCustomizationUUID(modelCustomizationId); + configurationResourceKeys.setVfModuleCustomizationUUID(vfModuleCustomizationUUID); + configurationResourceKeys.setVnfResourceCustomizationUUID(vnfCustomizationUUID); + configurationResourceKeys.setVnfcName(vnfc.getVnfcName()); + ExecuteBuildingBlock assignConfigBB = getExecuteBBForConfig(ASSIGN_FABRIC_CONFIGURATION_BB, ebb, configurationId, configurationResourceKeys); + ExecuteBuildingBlock activateConfigBB = getExecuteBBForConfig(ACTIVATE_FABRIC_CONFIGURATION_BB, ebb, configurationId, configurationResourceKeys); + flowsToExecute.add(assignConfigBB); + flowsToExecute.add(activateConfigBB); + execution.setVariable("flowsToExecute", flowsToExecute); + execution.setVariable("completed", false); } else { logger.debug("No cvnfcCustomization found for customizationId: " + modelCustomizationId); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasks.java index 36162af740..c0f7b21a9e 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasks.java @@ -57,7 +57,7 @@ public class SDNOHealthCheckTasks { Map<ResourceKey, String> lookupMap = execution.getLookupMap(); for (Map.Entry<ResourceKey, String> entry : lookupMap.entrySet()) { if (entry.getKey().equals(ResourceKey.GENERIC_VNF_ID)) { - vnf = extractPojosForBB.extractByKey(execution, entry.getKey(), entry.getValue()); + vnf = extractPojosForBB.extractByKey(execution, entry.getKey()); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java index 98174d59b6..258bea9a01 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java @@ -121,6 +121,7 @@ public class VnfAdapterVfModuleObjectMapper { CreateVfModuleRequest createVfModuleRequest = new CreateVfModuleRequest(); createVfModuleRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId()); + createVfModuleRequest.setCloudOwner(cloudRegion.getCloudOwner()); createVfModuleRequest.setTenantId(cloudRegion.getTenantId()); createVfModuleRequest.setVfModuleId(vfModule.getVfModuleId()); createVfModuleRequest.setVfModuleName(vfModule.getVfModuleName()); @@ -776,6 +777,7 @@ public class VnfAdapterVfModuleObjectMapper { VfModule vfModule) throws IOException { DeleteVfModuleRequest deleteVfModuleRequest = new DeleteVfModuleRequest(); deleteVfModuleRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId()); + deleteVfModuleRequest.setCloudOwner(cloudRegion.getCloudOwner()); deleteVfModuleRequest.setTenantId(cloudRegion.getTenantId()); deleteVfModuleRequest.setVnfId(genericVnf.getVnfId()); deleteVfModuleRequest.setVfModuleId(vfModule.getVfModuleId()); @@ -823,4 +825,4 @@ public class VnfAdapterVfModuleObjectMapper { } return baseVfModule; } -}
\ No newline at end of file +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java index 138a20b609..f412720af7 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java @@ -50,7 +50,7 @@ public class AAIConfigurationResources { */ public void createConfiguration(Configuration configuration) { AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId()); - configuration.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); + configuration.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration); injectionHelper.getAaiClient().create(configurationURI, aaiConfiguration); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java index 99d5fca31f..cae4a19f20 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java @@ -42,7 +42,6 @@ import org.springframework.stereotype.Component; public class SDNCClient { private static final Logger logger = LoggerFactory.getLogger(SDNCClient.class); - private BaseClient<String, LinkedHashMap<String, Object>> STOClient = new BaseClient<>(); @Autowired private SDNCProperties properties; @@ -61,6 +60,8 @@ public class SDNCClient { public String post(Object request, SDNCTopology topology) throws MapperException, BadResponseException { String jsonRequest = sdnCommonTasks.buildJsonRequest(request); String targetUrl = properties.getHost() + properties.getPath() + ":" + topology.toString() + "/"; + BaseClient<String, LinkedHashMap<String, Object>> STOClient = new BaseClient<>(); + STOClient.setTargetUrl(targetUrl); HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth()); STOClient.setHttpHeader(httpHeader); @@ -70,7 +71,8 @@ public class SDNCClient { public String post(Object request, String url) throws MapperException, BadResponseException { - String jsonRequest = sdnCommonTasks.buildJsonRequest(request); + String jsonRequest = sdnCommonTasks.buildJsonRequest(request); + BaseClient<String, LinkedHashMap<String, Object>> STOClient = new BaseClient<>(); STOClient.setTargetUrl(url); HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth()); STOClient.setHttpHeader(httpHeader); @@ -91,7 +93,8 @@ public class SDNCClient { public String get(String queryLink) throws MapperException, BadResponseException { String request = ""; String jsonRequest = sdnCommonTasks.buildJsonRequest(request); - String targetUrl = UriBuilder.fromUri(properties.getHost()).path(queryLink).build().toString(); + String targetUrl = UriBuilder.fromUri(properties.getHost()).path(queryLink).build().toString(); + BaseClient<String, LinkedHashMap<String, Object>> STOClient = new BaseClient<>(); STOClient.setTargetUrl(targetUrl); HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth()); STOClient.setHttpHeader(httpHeader); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java index cad97cad6e..a91ef66a29 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java @@ -65,7 +65,7 @@ public class AAIFlagTasksTest extends BaseTaskTest { public void before() throws BBObjectNotFoundException { genericVnf = setGenericVnf(); doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); - when(extractPojosForBB.extractByKey(any(),any(), any())).thenReturn(genericVnf); + when(extractPojosForBB.extractByKey(any(),any())).thenReturn(genericVnf); } @Test diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java index 166319d32b..d0901eb689 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java @@ -353,7 +353,7 @@ public class TestDataSetup{ ServiceInstance serviceInstance = null; try { - serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); } catch(BBObjectNotFoundException e) { serviceInstance = setServiceInstance(); } @@ -371,7 +371,7 @@ public class TestDataSetup{ Collection collection = null; try { - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); collection = serviceInstance.getCollection(); if (collection == null) { @@ -393,7 +393,7 @@ public class TestDataSetup{ ServiceInstance serviceInstance = null; try { - serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); } catch(BBObjectNotFoundException e) { serviceInstance = setServiceInstance(); } @@ -464,7 +464,7 @@ public class TestDataSetup{ ServiceInstance serviceInstance = null; try { - serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); } catch(BBObjectNotFoundException e) { serviceInstance = setServiceInstance(); } @@ -517,7 +517,7 @@ public class TestDataSetup{ ServiceInstance serviceInstance = null; try { - serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); } catch(BBObjectNotFoundException e) { serviceInstance = setServiceInstance(); } @@ -556,7 +556,7 @@ public class TestDataSetup{ GenericVnf genericVnf = null; try { - genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); } catch(BBObjectNotFoundException e) { genericVnf = setGenericVnf(); } @@ -586,7 +586,7 @@ public class TestDataSetup{ GenericVnf genericVnf = null; try { - genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); } catch(BBObjectNotFoundException e) { genericVnf = setGenericVnf(); } @@ -650,7 +650,7 @@ public class TestDataSetup{ ServiceInstance serviceInstance = null; try { - serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); } catch(BBObjectNotFoundException e) { serviceInstance = setServiceInstance(); } @@ -710,7 +710,7 @@ public class TestDataSetup{ configurations.add(config); ServiceInstance serviceInstance = new ServiceInstance(); try { - serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); } catch(BBObjectNotFoundException e) { serviceInstance = setServiceInstance(); } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java index 4e147a022c..fcb95ca07e 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java @@ -96,13 +96,13 @@ public class AAICreateTasksTest extends BaseTaskTest{ configuration = setConfiguration(); instanceGroup = setInstanceGroupVnf(); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID), any())).thenReturn(network); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID), any())).thenReturn(volumeGroup); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.CONFIGURATION_ID), any())).thenReturn(configuration); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID), any())).thenReturn(instanceGroup); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID))).thenReturn(volumeGroup); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.CONFIGURATION_ID))).thenReturn(configuration); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID))).thenReturn(instanceGroup); doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class)); @@ -277,7 +277,7 @@ public class AAICreateTasksTest extends BaseTaskTest{ public void createVnfExceptionTest() throws Exception { expectedException.expect(BpmnError.class); lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "notfound"); - doThrow(BBObjectNotFoundException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID),eq("notfound")); + doThrow(BBObjectNotFoundException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)); doNothing().when(aaiVnfResources).createVnfandConnectServiceInstance(genericVnf, serviceInstance); aaiCreateTasks.createVnf(execution); verify(aaiVnfResources, times(1)).createVnfandConnectServiceInstance(genericVnf, serviceInstance); @@ -291,7 +291,7 @@ public class AAICreateTasksTest extends BaseTaskTest{ newVfModule.setModuleIndex(null); newVfModule.getModelInfoVfModule().setModelInvariantUUID("testModelInvariantUUID1"); doNothing().when(aaiVfModuleResources).createVfModule(newVfModule, genericVnf); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(newVfModule); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(newVfModule); assertEquals(null, newVfModule.getModuleIndex()); aaiCreateTasks.createVfModule(execution); @@ -412,8 +412,8 @@ public class AAICreateTasksTest extends BaseTaskTest{ gBBInput.setServiceInstance(serviceInstance); lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstance.getServiceInstanceId()); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), eq("testServiceInstanceId"))).thenReturn(serviceInstance); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID),eq("testNetworkId"))).thenReturn(serviceInstance); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(serviceInstance); //verify connection call was not executednetwork exception.expect(BpmnError.class); aaiCreateTasks.connectNetworkToNetworkCollectionInstanceGroup(execution); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java index 94d886cdb5..826f888818 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java @@ -88,13 +88,13 @@ public class AAIDeleteTasksTest extends BaseTaskTest { configuration = setConfiguration(); instanceGroup = setInstanceGroupVnf(); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID), any())).thenReturn(network); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID), any())).thenReturn(volumeGroup); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.CONFIGURATION_ID), any())).thenReturn(configuration); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID), any())).thenReturn(instanceGroup); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID))).thenReturn(volumeGroup); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.CONFIGURATION_ID))).thenReturn(configuration); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID))).thenReturn(instanceGroup); doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class)); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java index a8a249f386..78d08aa1f1 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java @@ -84,12 +84,12 @@ public class AAIUpdateTasksTest extends BaseTaskTest{ configuration = setConfiguration(); subnet = buildSubnet(); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID), any())).thenReturn(network); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID), any())).thenReturn(volumeGroup); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.CONFIGURATION_ID), any())).thenReturn(configuration); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID))).thenReturn(volumeGroup); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.CONFIGURATION_ID))).thenReturn(configuration); doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class)); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasksTest.java index 3034f0bd67..72f6a08ee7 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasksTest.java @@ -72,8 +72,8 @@ public class NetworkAdapterCreateTasksTest extends BaseTaskTest{ orchestrationContext.setIsRollbackEnabled(true); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID), any())).thenReturn(l3Network); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(l3Network); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance); } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasksTest.java index 5b534e00e7..ceb4796443 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasksTest.java @@ -66,8 +66,8 @@ public class NetworkAdapterDeleteTasksTest extends BaseTaskTest{ requestContext = setRequestContext(); cloudRegion = setCloudRegion(); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID), any())).thenReturn(l3Network); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(l3Network); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance); doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class)); } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java index 478c512b0a..0406ce09a3 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java @@ -79,8 +79,8 @@ public class NetworkAdapterUpdateTasksTest extends BaseTaskTest{ userInput = setUserInput(); userInput.put("userInputKey1", "userInputValue1"); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID), any())).thenReturn(network); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance); } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java index eaab75d4b9..32b3201d11 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java @@ -76,9 +76,9 @@ public class VnfAdapterCreateTasksTest extends BaseTaskTest{ CreateVolumeGroupRequest request = new CreateVolumeGroupRequest(); request.setVolumeGroupId("volumeGroupStackId"); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID), any())).thenReturn(volumeGroup); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID))).thenReturn(volumeGroup); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule); doReturn(request).when(vnfAdapterVolumeGroupResources).createVolumeGroupRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVnfQueryResponse); vnfAdapterCreateTasks.createVolumeGroupRequest(execution); @@ -107,9 +107,9 @@ public class VnfAdapterCreateTasksTest extends BaseTaskTest{ CreateVolumeGroupRequest request = new CreateVolumeGroupRequest(); request.setVolumeGroupId("volumeGroupStackId"); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID), any())).thenReturn(volumeGroup); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID))).thenReturn(volumeGroup); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule); doReturn(request).when(vnfAdapterVolumeGroupResources).createVolumeGroupRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, null); vnfAdapterCreateTasks.createVolumeGroupRequest(execution); @@ -122,7 +122,7 @@ public class VnfAdapterCreateTasksTest extends BaseTaskTest{ @Test public void test_createVolumeGroupRequest_exception() throws Exception { - doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any()); + doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)); doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class)); expectedException.expect(BpmnError.class); @@ -156,8 +156,8 @@ public class VnfAdapterCreateTasksTest extends BaseTaskTest{ String sdncVnfQueryResponse = "{someJson}"; execution.setVariable("SDNCQueryResponse_" + genericVnf.getVnfId(), sdncVnfQueryResponse); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule); doReturn(createVfModuleRequest).when(vnfAdapterVfModuleResources).createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse); @@ -199,9 +199,9 @@ public class VnfAdapterCreateTasksTest extends BaseTaskTest{ String sdncVnfQueryResponse = "{someJson}"; execution.setVariable("SDNCQueryResponse_" + genericVnf.getVnfId(), sdncVnfQueryResponse); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID), any())).thenReturn(volumeGroup); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID))).thenReturn(volumeGroup); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule); doReturn(createVfModuleRequest).when(vnfAdapterVfModuleResources).createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule, volumeGroup, sdncVnfQueryResponse, sdncVfModuleQueryResponse); @@ -216,7 +216,7 @@ public class VnfAdapterCreateTasksTest extends BaseTaskTest{ @Test public void createVfModuleExceptionTest() throws Exception { // run with no data setup, and it will throw a BBObjectNotFoundException - doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any()); + doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)); doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class)); expectedException.expect(BpmnError.class); vnfAdapterCreateTasks.createVolumeGroupRequest(execution); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java index b8be26b12a..efd2e7d849 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java @@ -76,10 +76,10 @@ public class VnfAdapterDeleteTasksTest extends BaseTaskTest{ orchestrationContext = setOrchestrationContext(); orchestrationContext.setIsRollbackEnabled(true); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID), any())).thenReturn(volumeGroup); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID))).thenReturn(volumeGroup); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance); doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class)); doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class)); } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java index 33d0dbe130..b515835f19 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java @@ -78,10 +78,10 @@ public class VnfAdapterImplTest extends BaseTaskTest { volumeGroup.setHeatStackId(null); doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class)); doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class)); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID), any())).thenReturn(volumeGroup); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID))).thenReturn(volumeGroup); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule); } @Test @@ -209,7 +209,7 @@ public class VnfAdapterImplTest extends BaseTaskTest { @Test public void preProcessVnfAdapterExceptionTest() throws BBObjectNotFoundException { expectedException.expect(BpmnError.class); - doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any()); + doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)); vnfAdapterImpl.preProcessVnfAdapter(execution); } @@ -263,7 +263,7 @@ public class VnfAdapterImplTest extends BaseTaskTest { @Test public void postProcessVnfAdapterExceptionTest() throws BBObjectNotFoundException { - doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any()); + doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID)); execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_CREATE_RESPONSE); expectedException.expect(BpmnError.class); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java index 7495cc1e8d..a8518d9016 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java @@ -73,7 +73,7 @@ public class AppcRunTasksTest extends BaseTaskTest { public void runAppcCommandVnfNull() throws BBObjectNotFoundException { execution.getLookupMap().put(ResourceKey.GENERIC_VNF_ID, "NULL-TEST"); fillRequiredAppcExecutionFields(); - when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.GENERIC_VNF_ID), eq("NULL-TEST"))) + when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.GENERIC_VNF_ID))) .thenReturn(null); when(catalogDbClient.getControllerSelectionReferenceByVnfTypeAndActionCategory( isNull(), eq(Action.Lock.toString()))). @@ -92,7 +92,7 @@ public class AppcRunTasksTest extends BaseTaskTest { public void runAppcCommandBBObjectNotFoundException() throws BBObjectNotFoundException { execution.getLookupMap().put(ResourceKey.GENERIC_VNF_ID, "EXCEPTION-TEST"); fillRequiredAppcExecutionFields(); - when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.GENERIC_VNF_ID), eq("EXCEPTION-TEST"))) + when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.GENERIC_VNF_ID))) .thenThrow(new BBObjectNotFoundException()); appcRunTasks.runAppcCommand(execution, Action.Lock); @@ -107,11 +107,11 @@ public class AppcRunTasksTest extends BaseTaskTest { execution.getLookupMap().put(ResourceKey.GENERIC_VNF_ID, "SUCCESS-TEST"); fillRequiredAppcExecutionFields(); GenericVnf genericVnf = getTestGenericVnf(); - when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.GENERIC_VNF_ID), eq("SUCCESS-TEST"))) + when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.GENERIC_VNF_ID))) .thenReturn(genericVnf); mockReferenceResponse(); execution.getLookupMap().put(ResourceKey.VF_MODULE_ID, "VF-MODULE-ID-TEST"); - when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.VF_MODULE_ID), eq("VF-MODULE-ID-TEST"))) + when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.VF_MODULE_ID))) .thenReturn(null); when(appCClient.getErrorCode()).thenReturn("0"); @@ -125,13 +125,13 @@ public class AppcRunTasksTest extends BaseTaskTest { execution.getLookupMap().put(ResourceKey.GENERIC_VNF_ID, "SUCCESS-TEST"); fillRequiredAppcExecutionFields(); GenericVnf genericVnf = getTestGenericVnf(); - when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.GENERIC_VNF_ID), eq("SUCCESS-TEST"))) + when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.GENERIC_VNF_ID))) .thenReturn(genericVnf); mockReferenceResponse(); execution.getLookupMap().put(ResourceKey.VF_MODULE_ID, "VF-MODULE-ID-TEST"); VfModule vfModule = new VfModule(); vfModule.setVfModuleId("VF-MODULE-ID"); - when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.VF_MODULE_ID), eq("VF-MODULE-ID-TEST"))) + when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.VF_MODULE_ID))) .thenReturn(vfModule); when(appCClient.getErrorCode()).thenReturn("0"); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/audit/AuditTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/audit/AuditTasksTest.java index 7a9e2bb6cf..3542d7fdb3 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/audit/AuditTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/audit/AuditTasksTest.java @@ -56,9 +56,9 @@ public class AuditTasksTest extends BaseTaskTest{ genericVnf = setGenericVnf(); vfModule = setVfModule(); setCloudRegion(); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance); } @Test diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkTest.java index befeea411d..19981bc45a 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkTest.java @@ -48,14 +48,14 @@ public class AssignNetworkTest extends BaseTaskTest { public void before() throws BBObjectNotFoundException { network = setL3Network(); doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class)); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID), any())).thenReturn(network); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network); } @Test public void networkNotFoundTest() throws Exception { //network status to PRECREATED - when it was NOT found by name try { - network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID,execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); } catch(BBObjectNotFoundException e) { } @@ -67,7 +67,7 @@ public class AssignNetworkTest extends BaseTaskTest { @Test public void networkFoundTest() throws Exception { try { - network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID,execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); } catch(BBObjectNotFoundException e) { } boolean networkFound = assignNetwork.networkFoundByName(execution); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnfTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnfTest.java index 4ad6fba910..834990db5a 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnfTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnfTest.java @@ -92,7 +92,7 @@ public class AssignVnfTest extends BaseTaskTest { doNothing().when(aaiInstanceGroupResources).createInstanceGroup(isA(InstanceGroup.class)); doNothing().when(aaiInstanceGroupResources).connectInstanceGroupToVnf(isA(InstanceGroup.class), isA(GenericVnf.class)); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf); doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class)); doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class)); } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOutTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOutTest.java index ad848a4d49..6390268a0c 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOutTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOutTest.java @@ -81,8 +81,8 @@ public class ConfigurationScaleOutTest extends BaseTaskTest { gBBInput.setRequestContext(requestContext); doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class)); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule); } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollectionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollectionTest.java index 7202bd5298..423029c59b 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollectionTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollectionTest.java @@ -70,8 +70,8 @@ public class CreateNetworkCollectionTest extends BaseTaskTest{ orchestrationContext.setIsRollbackEnabled(true); doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class)); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID), any())).thenReturn(network); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance); } @Test diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkTest.java index ddfd636a64..de1aa63f55 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkTest.java @@ -70,8 +70,8 @@ public class CreateNetworkTest extends BaseTaskTest{ userInput = setUserInput(); customer.getServiceSubscription().getServiceInstances().add(serviceInstance); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID), any())).thenReturn(network); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance); } @Test diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java index 7fdf2535bf..2386da743b 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java @@ -66,7 +66,7 @@ public class GenericVnfHealthCheckTest extends BaseTaskTest { gBBInput.setRequestContext(requestContext); doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class)); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf); } @Test diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java index ccfcabaf09..ecdf11bd05 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java @@ -72,7 +72,7 @@ public class UnassignNetworkBBTest extends BaseTaskTest { AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(aaiResponse); Optional<org.onap.aai.domain.yang.L3Network> l3network = aaiResultWrapper.asBean(org.onap.aai.domain.yang.L3Network.class); - doReturn(network).when(extractPojosForBB).extractByKey(execution, ResourceKey.NETWORK_ID, "testNetworkId1"); + doReturn(network).when(extractPojosForBB).extractByKey(execution, ResourceKey.NETWORK_ID); doReturn(aaiResultWrapper).when(aaiNetworkResources).queryNetworkWrapperById(network); doReturn(true).when(networkBBUtils).isRelationshipRelatedToExists(any(Optional.class), eq("vf-module")); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnfTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnfTest.java index 688f95c3c0..394ffcf0ac 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnfTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnfTest.java @@ -68,7 +68,7 @@ public class UnassignVnfTest extends BaseTaskTest{ instanceGroup2.setId("test-002"); instanceGroup2.setModelInfoInstanceGroup(modelVnfc); genericVnf.getInstanceGroups().add(instanceGroup2); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf); unassignVnf.deleteInstanceGroups(execution); verify(aaiInstanceGroupResources, times(1)).deleteInstanceGroup(eq(instanceGroup1)); verify(aaiInstanceGroupResources, times(1)).deleteInstanceGroup(eq(instanceGroup2)); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasksTest.java index 41739f37e6..67c48d1e91 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasksTest.java @@ -22,7 +22,6 @@ package org.onap.so.bpmn.infrastructure.namingservice.tasks; import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.times; @@ -47,7 +46,7 @@ public class NamingServiceCreateTasksTest extends BaseTaskTest { @Before public void before() throws BBObjectNotFoundException { instanceGroup = setInstanceGroup(); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID), any())).thenReturn(instanceGroup); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID))).thenReturn(instanceGroup); } @Test @@ -68,7 +67,7 @@ public class NamingServiceCreateTasksTest extends BaseTaskTest { public void createInstanceGroupExceptionTest() throws Exception { expectedException.expect(BBObjectNotFoundException.class); lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, "notfound"); - doThrow(BBObjectNotFoundException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID),eq("notfound")); + doThrow(BBObjectNotFoundException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID)); String policyInstanceName = "policyInstanceName"; String nfNamingCode = "nfNamingCode"; execution.setVariable(policyInstanceName, policyInstanceName); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasksTest.java index 97dcc617ac..56226dfa96 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasksTest.java @@ -21,7 +21,6 @@ package org.onap.so.bpmn.infrastructure.namingservice.tasks; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.times; @@ -46,7 +45,7 @@ public class NamingServiceDeleteTasksTest extends BaseTaskTest { @Before public void before() throws BBObjectNotFoundException { instanceGroup = setInstanceGroup(); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID), any())).thenReturn(instanceGroup); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID))).thenReturn(instanceGroup); } @Test @@ -62,7 +61,7 @@ public class NamingServiceDeleteTasksTest extends BaseTaskTest { public void deleteInstanceGroupExceptionTest() throws Exception { expectedException.expect(BBObjectNotFoundException.class); lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, "notfound"); - doThrow(BBObjectNotFoundException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID),eq("notfound")); + doThrow(BBObjectNotFoundException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID)); doReturn("").when(namingServiceResources).deleteInstanceGroupName(instanceGroup); namingServiceDeleteTasks.deleteInstanceGroupName(execution); verify(namingServiceResources, times(1)).deleteInstanceGroupName(instanceGroup); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java index 65e7d249c5..cbd7605aa4 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java @@ -78,10 +78,10 @@ public class SDNCActivateTaskTest extends BaseTaskTest{ customer.getServiceSubscription().getServiceInstances().add(serviceInstance); doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class)); doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class)); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID), any())).thenReturn(network); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance); } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java index d021df56e0..b5509b1e12 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java @@ -80,11 +80,11 @@ public class SDNCAssignTasksTest extends BaseTaskTest{ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class)); doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class)); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID), any())).thenReturn(network); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID), any())).thenReturn(volumeGroup); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID))).thenReturn(volumeGroup); } @Test diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java index f01596c86f..be792115c9 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java @@ -69,9 +69,9 @@ public class SDNCChangeAssignTasksTest extends BaseTaskTest{ requestContext = setRequestContext(); doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class)); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance); } @Test diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java index 3d25addb9c..18048da50d 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java @@ -75,10 +75,10 @@ public class SDNCDeactivateTaskTest extends BaseTaskTest { network = setL3Network(); doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class)); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID), any())).thenReturn(network); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance); } @@ -142,7 +142,7 @@ public class SDNCDeactivateTaskTest extends BaseTaskTest { @Test public void test_deactivateNetwork_exception() throws Exception { expectedException.expect(BpmnError.class); - doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID), any()); + doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID)); sdncDeactivateTasks.deactivateNetwork(execution); verify(sdncNetworkResources, times(0)).deactivateNetwork(network, serviceInstance, customer, requestContext, cloudRegion); } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java index 4c5c50ebbf..28551baa7a 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java @@ -63,11 +63,11 @@ public class SDNCQueryTasksTest extends BaseTaskTest{ vfModule = setVfModule(); doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class)); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule); } @@ -124,7 +124,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest{ @Test public void queryVfModuleForVolumeGroupVfObjectExceptionTest() throws Exception { expectedException.expect(BpmnError.class); - doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any()); + doThrow(RuntimeException.class).when(extractPojosForBB).extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID)); sdncQueryTasks.queryVfModuleForVolumeGroup(execution); verify(sdncVfModuleResources, times(0)).queryVfModule(any(VfModule.class)); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java index 1301787dff..527fe0d916 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java @@ -76,10 +76,10 @@ public class SDNCUnassignTasksTest extends BaseTaskTest{ cloudRegion = setCloudRegion(); network = setL3Network(); doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class)); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID), any())).thenReturn(network); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule); - when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule); + when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance); } @Test diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasksTest.java index 6eb22a6dcc..329f2cf8c1 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasksTest.java @@ -69,7 +69,7 @@ public class SDNOHealthCheckTasksTest extends TestDataSetup { public void before() throws BBObjectNotFoundException { genericVnf = setGenericVnf(); requestContext = setRequestContext(); - when(extractPojosForBB.extractByKey(any(),any(), any())).thenReturn(genericVnf); + when(extractPojosForBB.extractByKey(any(),any())).thenReturn(genericVnf); } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java index 4aeed71177..4bf445949a 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java @@ -98,7 +98,7 @@ public class AAIConfigurationResourcesTest extends TestDataSetup{ aaiConfigurationResources.createConfiguration(configuration); - assertEquals(OrchestrationStatus.INVENTORIED, configuration.getOrchestrationStatus()); + assertEquals(OrchestrationStatus.ASSIGNED, configuration.getOrchestrationStatus()); verify(MOCK_aaiResourcesClient, times(1)).create(any(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Configuration.class)); } |