diff options
author | Rob Daugherty <rd472p@att.com> | 2018-10-12 15:11:07 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-10-12 15:11:07 +0000 |
commit | d6c21ac6f38474841d3b9ced0524fe7671ae8682 (patch) | |
tree | ac5a12fd0acdc5e0f07fe5089637b7da279e37bc /bpmn/MSOCommonBPMN | |
parent | ea7f1ce7584deb1e4896ffcddb8c45e64422a9d0 (diff) | |
parent | 6ba0a22bc952232d14d2d24c5f73a42aae2791a9 (diff) |
Merge "Dynamic Cloud Owner Support"
Diffstat (limited to 'bpmn/MSOCommonBPMN')
68 files changed, 570 insertions, 3612 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy index 3e451a5a4a..2f4e70c893 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy @@ -19,15 +19,24 @@ */ package org.onap.so.bpmn.common.scripts +import java.util.regex.Matcher +import java.util.regex.Pattern + +import javax.ws.rs.core.UriBuilder + import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.client.aai.AAIVersion +import org.onap.so.client.aai.entities.uri.AAIUri +import org.onap.so.logger.MessageEnum +import org.onap.so.logger.MsoLogger +import org.onap.so.openpojo.rules.HasToStringRule import org.onap.so.rest.APIResponse; import org.onap.so.rest.RESTClient import org.onap.so.rest.RESTConfig -import org.springframework.web.util.UriUtils -import org.onap.so.logger.MsoLogger +@Deprecated class AaiUtil { private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AaiUtil.class); @@ -43,124 +52,13 @@ class AaiUtil { public AaiUtil(AbstractServiceTaskProcessor taskProcessor) { this.taskProcessor = taskProcessor } - public AaiUtil() { - } - - public String getNetworkGenericVnfEndpoint(DelegateExecution execution) { - String endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) - def uri = getNetworkGenericVnfUri(execution) - msoLogger.debug('AaiUtil.getNetworkGenericVnfEndpoint() - AAI endpoint: ' + endpoint + uri) - return endpoint + uri - } - public String getNetworkGenericVnfUri(DelegateExecution execution) { - def uri = getUri(execution, 'generic-vnf') - msoLogger.debug('AaiUtil.getNetworkGenericVnfUri() - AAI URI: ' + uri) - return uri - } - - public String getNetworkVpnBindingUri(DelegateExecution execution) { - def uri = getUri(execution, 'vpn-binding') - msoLogger.debug('AaiUtil.getNetworkVpnBindingUri() - AAI URI: ' + uri) - return uri - } - - public String getNetworkPolicyUri(DelegateExecution execution) { - def uri = getUri(execution, 'network-policy') - msoLogger.debug('AaiUtil.getNetworkPolicyUri() - AAI URI: ' + uri) - return uri - } - - public String getNetworkTableReferencesUri(DelegateExecution execution) { - def uri = getUri(execution, 'route-table-reference') - msoLogger.debug('AaiUtil.getNetworkTableReferencesUri() - AAI URI: ' + uri) - return uri - } - - public String getNetworkVceUri(DelegateExecution execution) { - def uri = getUri(execution, 'vce') - msoLogger.debug('AaiUtil.getNetworkVceUri() - AAI URI: ' + uri) - return uri - } - - public String getNetworkL3NetworkUri(DelegateExecution execution) { - def uri = getUri(execution, 'l3-network') - msoLogger.debug('AaiUtil.getNetworkL3NetworkUri() - AAI URI: ' + uri) - return uri - } - - public String getNetworkDeviceUri(DelegateExecution execution) { - def uri = getUri(execution, 'device') - msoLogger.debug('AaiUtil.getNetworkDeviceUri() - AAI URI: ' + uri) - return uri - } - - public String getBusinessCustomerUri(DelegateExecution execution) { - def uri = getUri(execution, 'customer') - msoLogger.debug('AaiUtil.getBusinessCustomerUri() - AAI URI: ' + uri) - return uri - } - public String getBusinessSPPartnerUri(DelegateExecution execution) { def uri = getUri(execution, 'sp-partner') msoLogger.debug('AaiUtil.getBusinessSPPartnerUri() - AAI URI: ' + uri) return uri } - public String getAAIServiceInstanceUri(DelegateExecution execution) { - String uri = getBusinessCustomerUri(execution) - - uri = uri +"/" + execution.getVariable("globalSubscriberId") + "/service-subscriptions/service-subscription/" + UriUtils.encode(execution.getVariable("serviceType"),"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(execution.getVariable("serviceInstanceId"),"UTF-8") - - msoLogger.debug('AaiUtil.getAAIRequestInputUri() - AAI URI: ' + uri) - return uri - } - - //public String getBusinessCustomerUriv7(DelegateExecution execution) { - // //def uri = getUri(execution, BUSINESS_CUSTOMERV7) - // def uri = getUri(execution, 'Customer') - // msoLogger.debug('AaiUtil.getBusinessCustomerUriv7() - AAI URI: ' + uri) - // return uri - //} - - public String getCloudInfrastructureCloudRegionEndpoint(DelegateExecution execution) { - String endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) - def uri = getCloudInfrastructureCloudRegionUri(execution) - msoLogger.debug('AaiUtil.getCloudInfrastructureCloudRegionEndpoint() - AAI endpoint: ' + endpoint + uri) - return endpoint + uri - } - - public String getCloudInfrastructureCloudRegionUri(DelegateExecution execution) { - def uri = getUri(execution, 'cloud-region') - msoLogger.debug('AaiUtil.getCloudInfrastructureCloudRegionUri() - AAI URI: ' + uri) - return uri - } - - public String getCloudInfrastructureTenantUri(DelegateExecution execution) { - def uri = getUri(execution, 'tenant') - msoLogger.debug('AaiUtil.getCloudInfrastructureTenantUri() - AAI URI: ' + uri) - return uri - } - - public String getSearchNodesQueryUri(DelegateExecution execution) { - def uri = getUri(execution, 'nodes-query') - msoLogger.debug('AaiUtil.getSearchNodesQueryUri() - AAI URI: ' + uri) - return uri - } - - public String getSearchNodesQueryEndpoint(DelegateExecution execution) { - String endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) - def uri = getSearchNodesQueryUri(execution) - msoLogger.debug('AaiUtil.getSearchNodesQueryEndpoint() - AAI endpoint: ' + endpoint + uri) - return endpoint + uri - } - - public String getSearchGenericQueryUri(DelegateExecution execution) { - def uri = getUri(execution, 'generic-query') - msoLogger.debug('AaiUtil.getSearchGenericQueryUri() - AAI URI: ' + uri) - return uri - } - public String getVersion(DelegateExecution execution, resourceName, processKey) { def versionWithResourceKey = "mso.workflow.default.aai.${resourceName}.version" def versionWithProcessKey = "mso.workflow.custom.${processKey}.aai.version" @@ -186,53 +84,13 @@ class AaiUtil { (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, "Internal Error: One of the following should be defined in MSO URN properties file: ${versionWithResourceKey}, ${versionWithProcessKey}, ${DEFAULT_VERSION_KEY}") } - public String getMainProcessKey(DelegateExecution execution) { - DelegateExecution exec = execution - - while (true) { - DelegateExecution parent = exec.getSuperExecution() - - if (parent == null) { - parent = exec.getParent() - - if (parent == null) { - break - } - } - - exec = parent - } - - return execution.getProcessEngineServices().getRepositoryService() - .getProcessDefinition(exec.getProcessDefinitionId()).getKey() + public String createAaiUri(AAIUri uri) { + return createAaiUri(AAIVersion.valueOf('V' + UrnPropertiesReader.getVariable(DEFAULT_VERSION_KEY)), uri) } - - public String getUri(DelegateExecution execution, resourceName) { - - def processKey = getMainProcessKey(execution) - - //set namespace - setNamespace(execution) - - // Check for flow+resource specific first - def key = "mso.workflow.${processKey}.aai.${resourceName}.uri" - def uri = UrnPropertiesReader.getVariable(key, execution) - if(uri) { - msoLogger.debug("AaiUtil.getUri() - using flow+resource specific key: ${key}=${uri}") - return uri - } - - // Check for versioned key - def version = getVersion(execution, resourceName, processKey) - key = "mso.workflow.default.aai.v${version}.${resourceName}.uri" - uri = UrnPropertiesReader.getVariable(key, execution) - - if(uri) { - msoLogger.debug("AaiUtil.getUri() - using versioned URI key: ${key}=${uri}") - return uri - } - - (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, 'Internal Error: AAI URI entry for ' + key + ' not defined in the MSO URN properties file') + public String createAaiUri(AAIVersion version, AAIUri uri) { + String endpoint = UrnPropertiesReader.getVariable("aai.endpoint") + String result = UriBuilder.fromUri(endpoint).path('aai').path(version.toString()).build().toString() + return UriBuilder.fromUri(result + uri.build().toString()).build().toString() } public String setNamespace(DelegateExecution execution) { @@ -243,6 +101,18 @@ class AaiUtil { } } + public String getNamespace() { + return getNamespace(AAIVersion.valueOf('V' + UrnPropertiesReader.getVariable(DEFAULT_VERSION_KEY))) + } + + public String getNamespace(AAIVersion version) { + String namespace = UrnPropertiesReader.getVariable(AAI_NAMESPACE_STRING_KEY) + if (namespace == null) { + throw new Exception('Internal Error: AAI Namespace has not been set yet. A getUri() method needs to be invoked first.') + } + + return namespace + version + } /** * This method can be used for getting the building namespace out of uri. * NOTE: A getUri() method needs to be invoked first. @@ -253,12 +123,11 @@ class AaiUtil { * * @return namespace */ - public String getNamespaceFromUri(String uri) { - if (aaiNamespace == null) { + String namespace = UrnPropertiesReader.getVariable(AAI_NAMESPACE_STRING_KEY) + if (namespace == null) { throw new Exception('Internal Error: AAI Namespace has not been set yet. A getUri() method needs to be invoked first.') } - String namespace = aaiNamespace if(uri!=null){ String version = getVersionFromUri(uri) return namespace + "v"+version @@ -296,16 +165,13 @@ class AaiUtil { * @return version */ private String getVersionFromUri(String uri) { - def version = "" - def savedVersion = "" - for (int x=2; x<6; x++) { - version = uri.substring(uri.indexOf("v")+1, uri.indexOf("v")+x) - if (!Character.isDigit(version.charAt(version.size()-1))) { - break - } - savedVersion = version + + Matcher versionRegEx = Pattern.compile("/v(\\d+)").matcher(uri) + if (versionRegEx.find()) { + return versionRegEx.group(1); } - return savedVersion + + return ""; } @@ -336,7 +202,7 @@ class AaiUtil { if (basicAuthCred != null && !"".equals(basicAuthCred)) { client.addAuthorizationHeader(basicAuthCred) } - apiResponse = client.get() + apiResponse = client.httpGet() msoLogger.trace("COMPLETED Execute AAI Get Process ") }catch(Exception e){ @@ -682,129 +548,5 @@ class AaiUtil { return 0 } } +} - private def getPInterface(DelegateExecution execution, String aai_uri) { - - String namespace = getNamespaceFromUri(execution, aai_uri) - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - String serviceAaiPath = aai_endpoint + aai_uri - - APIResponse response = executeAAIGetCall(execution, serviceAaiPath) - return new XmlParser().parseText(response.getResponseBodyAsString()) - } - - // This method checks if interface is remote - private def isPInterfaceRemote(DelegateExecution execution, String uri) { - if(uri.contains("ext-aai-network")) { - return true - } else { - return false - } - } - - // This method returns Local and remote TPs information from AAI - public Map getTPsfromAAI(DelegateExecution execution) { - Map tpInfo = [:] - - String aai_uri = '/aai/v14/network/logical-links' - - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - String serviceAaiPath = aai_endpoint + aai_uri - - APIResponse response = executeAAIGetCall(execution, serviceAaiPath) - - def logicalLinks = new XmlParser().parseText(response.getResponseBodyAsString()) - - logicalLinks."logical-link".each { link -> - def isRemoteLink = false - def pInterfaces = [] - def relationship = link."relationship-list"."relationship" - relationship.each { rel -> - if ("ext-aai-network".compareToIgnoreCase("${rel."related-to"[0]?.text()}") == 0) { - isRemoteLink = true - } - if ("p-interface".compareToIgnoreCase("${rel."related-to"[0]?.text()}") == 0) { - pInterfaces.add(rel) - } - } - - // if remote link then process - if (isRemoteLink) { - - // find remote p interface - def localTP = null - def remoteTP = null - - def pInterface0 = pInterfaces[0] - def pIntfUrl = "${pInterface0."related-link"[0].text()}" - - if (isRemotePInterface(execution, pIntfUrl)) { - remoteTP = pInterfaces[0] - localTP = pInterfaces[1] - } else { - localTP = pInterfaces[0] - remoteTP = pInterfaces[1] - } - - if (localTP != null && remoteTP != null) { - - // give local tp - def tpUrl = "${localTP."related-link"[0]?.text()}" - def intfLocal = getPInterface(execution, "${localTP?."related-link"[0]?.text()}") - tpInfo.put("local-access-node-id", tpUrl.split("/")[6]) - - def networkRef = "${intfLocal."network-ref"[0]?.text()}".split("/") - if (networkRef.size() == 6) { - tpInfo.put("local-access-provider-id", networkRef[1]) - tpInfo.put("local-access-client-id", networkRef[3]) - tpInfo.put("local-access-topology-id", networkRef[5]) - } - def ltpIdStr = tpUrl?.substring(tpUrl?.lastIndexOf("/") + 1) - if (ltpIdStr?.contains("-")) { - tpInfo.put("local-access-ltp-id", ltpIdStr?.substring(ltpIdStr?.lastIndexOf("-") + 1)) - } - - // give remote tp - tpUrl = "${remoteTP."related-link"[0]?.text()}" - def intfRemote = getPInterface(execution, "${remoteTP."related-link"[0].text()}") - tpInfo.put("remote-access-node-id", tpUrl.split("/")[6]) - - def networkRefRemote = "${intfRemote."network-ref"[0]?.text()}".split("/") - - if (networkRefRemote.size() == 6) { - tpInfo.put("remote-access-provider-id", networkRefRemote[1]) - tpInfo.put("remote-access-client-id", networkRefRemote[3]) - tpInfo.put("remote-access-topology-id", networkRefRemote[5]) - } - def ltpIdStrR = tpUrl?.substring(tpUrl?.lastIndexOf("/") + 1) - if (ltpIdStrR?.contains("-")) { - tpInfo.put("remote-access-ltp-id", ltpIdStrR?.substring(ltpIdStr?.lastIndexOf("-") + 1)) - } - return tpInfo - } - } - - } - return tpInfo - } - - // this method check if pInterface is remote - private def isRemotePInterface(DelegateExecution execution, String uri) { - def aai_uri = uri.substring(0, uri.indexOf("/p-interfaces")) - - String namespace = getNamespaceFromUri(execution, aai_uri) - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - String serviceAaiPath = aai_endpoint + aai_uri - - APIResponse response = executeAAIGetCall(execution, serviceAaiPath) - def pnf = new XmlParser().parseText(response.getResponseBodyAsString()) - - def relationship = pnf."relationship-list"."relationship" - relationship.each { - if ("ext-aai-network".compareToIgnoreCase("${it."related-to"[0]?.text()}") == 0) { - return true - } - } - return false - } -}
\ No newline at end of file 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 0692e5022a..9e71313e09 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 @@ -32,6 +32,7 @@ import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.client.aai.AAIResourcesClient import org.springframework.web.util.UriUtils public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcessor { @@ -763,4 +764,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } } + public AAIResourcesClient getAAIClient(){ + return new AAIResourcesClient(); + } }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy index b054c0f934..e4bc5f8fa2 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,11 +22,17 @@ package org.onap.so.bpmn.common.scripts import static org.apache.commons.lang3.StringUtils.*; +import javax.ws.rs.NotFoundException + import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution; import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger import org.onap.so.rest.APIResponse; @@ -102,7 +108,7 @@ class AllottedResourceUtils { // setsVariable aaiARGetResponse public String getARbyId (DelegateExecution execution, String allottedResourceId) { msoLogger.trace("getARbyId ") - String arLink = getARLinkbyId(execution, allottedResourceId) + AAIResourceUri arLink = getARLinkbyId(execution, allottedResourceId) String ar = null if (!isBlank(arLink)) { @@ -111,7 +117,7 @@ class AllottedResourceUtils { msoLogger.trace(" Exit GetARbyId - AR:" + ar) return ar; } - + public String getPSIFmARLink(DelegateExecution execution, String arLink) { // Path: /aai/{version}/business/customers/customer/{cust}/service-subscriptions/service-subscription/{subs}/service-instances/service-instance/{psiid}/allotted-resources/allotted-resource/{arid} @@ -129,39 +135,17 @@ class AllottedResourceUtils { msoLogger.trace("getARLinkbyId ") String arLink = null try { - AaiUtil aaiUriUtil = new AaiUtil(taskProcessor) - String aaiNQUri = aaiUriUtil.getSearchNodesQueryEndpoint(execution) - String aaiEndpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) - String aaiUrl = "${aaiNQUri}?search-node-type=allotted-resource&filter=id:EQUALS:${allottedResourceId}" - - msoLogger.debug("getARLinkbyId url: \n" + aaiUrl) - - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, aaiUrl) - int responseCode = response.getStatusCode() - msoLogger.debug(" GET AR response code is: " + responseCode) - - String aaiResponse = response.getResponseBodyAsString() - msoLogger.debug("GET AR:" + aaiResponse) - if(responseCode == 200 || responseCode == 202){ - msoLogger.debug("GET AR Received a Good Response Code") - if(utils.nodeExists(aaiResponse, "result-data")){ - msoLogger.debug("Query for AllottedResource Url Response Does Contain Data" ) - arLink = utils.getNodeText(aaiResponse, "resource-link") - }else{ - msoLogger.debug("GET AR Response Does NOT Contain Data" ) - } - }else if(responseCode == 404){ - msoLogger.debug("GET AR received a Not Found (404) Response") - } - else{ - msoLogger.debug(" GET AR received a Bad Response: \n" + aaiResponse) - buildAAIErrorResponse(execution, aaiResponse, "Error retrieving AR from AAI") - } - }catch(Exception e){ + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE, allottedResourceId) + AaiUtil aaiUtil = new AaiUtil() + arLink = aaiUtil.createAaiUri(uri) + } catch (NotFoundException e) { + msoLogger.debug("GET AR received a Not Found (404) Response") + } catch(Exception e){ msoLogger.debug(" Error encountered within GetAaiAR" + e.getMessage()) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error in GetARbyId" + e.getMessage()) } - msoLogger.trace(" Exit GetARLinkbyId - Link:" + arLink) + msoLogger.debug(" ***** Exit GetARLinkbyId ***** Link:" + arLink) return arLink } @@ -185,7 +169,7 @@ class AllottedResourceUtils { } arUrl = "${aai_endpoint}" + arEndpoint - + msoLogger.debug("GET AR Aai Path is: \n" + arUrl) APIResponse response = aaiUriUtil.executeAAIGetCall(execution, arUrl) @@ -229,13 +213,13 @@ class AllottedResourceUtils { { execution.setVariable("aaiARGetResponse", ar) execution.setVariable("aaiARPath", arUrl) - + String resourceVersion = null if (utils.nodeExists(ar, "resource-version")) { resourceVersion = utils.getNodeText(ar, "resource-version") execution.setVariable("aaiARResourceVersion", resourceVersion) } - + String orchStatus = null if (utils.nodeExists(ar, "orchestration-status")) { orchStatus= utils.getNodeText(ar, "orchestration-status") @@ -285,7 +269,7 @@ class AllottedResourceUtils { } msoLogger.trace("Exit updateAROrchStatus ") } - + //Sets Variable "wasDeleted" public void deleteAR(DelegateExecution execution, String aaiARPath){ msoLogger.trace(" deleteAR - aaiARPath:" + aaiARPath) @@ -294,14 +278,14 @@ class AllottedResourceUtils { APIResponse response = aaiUriUtil.executeAAIDeleteCall(execution, aaiARPath) int responseCode = response.getStatusCode() execution.setVariable("deleteARResponseCode", responseCode) - + msoLogger.debug(" Delete AR response code:" + responseCode) String aaiResponse = response.getResponseBodyAsString() execution.setVariable("aaiARDeleteResponse", aaiResponse) msoLogger.debug("Delete AR Response:" + aaiResponse) - + //Process Response if(responseCode == 204){ msoLogger.debug(" Delete AR Received a Good Response") diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy index bcd740eae9..c309c3bb68 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,15 +19,20 @@ */ package org.onap.so.bpmn.common.scripts +import javax.ws.rs.core.UriBuilder + import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.so.bpmn.core.UrnPropertiesReader -import org.onap.so.rest.APIResponse +import org.onap.aai.domain.yang.VolumeGroup +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.constants.Defaults import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ConfirmVolumeGroupName.class); - + def Prefix="CVGN_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -37,7 +42,7 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{ execution.setVariable("CVGN_volumeGroupName",null) execution.setVariable("CVGN_aicCloudRegion", null) execution.setVariable("CVGN_volumeGroupGetEndpoint",null) - + // ConfirmVolumeGroupName workflow response variable placeholders execution.setVariable("CVGN_volumeGroupNameMatches", false) execution.setVariable("CVGN_queryVolumeGroupResponseCode",null) @@ -51,43 +56,31 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{ def volumeGroupId = execution.getVariable("ConfirmVolumeGroupName_volumeGroupId") def volumeGroupName= execution.getVariable("ConfirmVolumeGroupName_volumeGroupName") def aicCloudRegion = execution.getVariable("ConfirmVolumeGroupName_aicCloudRegion") - + initProcessVariables(execution) execution.setVariable("CVGN_volumeGroupId", volumeGroupId) execution.setVariable("CVGN_volumeGroupName", volumeGroupName) execution.setVariable("CVGN_aicCloudRegion", aicCloudRegion) - - AaiUtil aaiUriUtil = new AaiUtil(this) - def aai_uri = aaiUriUtil.getCloudInfrastructureCloudRegionUri(execution) - msoLogger.debug('AAI URI is: ' + aai_uri) - msoLogger.debug("AAI URI: " + aai_uri) - execution.setVariable("CVGN_volumeGroupGetEndpoint","${aai_uri}/${aicCloudRegion}/volume-groups/volume-group/" + - volumeGroupId) + + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), aicCloudRegion, volumeGroupId) + execution.setVariable("CVGN_volumeGroupGetEndpoint", uri) } - + // send a GET request to AA&I to retrieve the Volume information based on volume-group-id // expect a 200 response with the information in the response body or a 404 if the volume group id does not exist public void queryAAIForVolumeGroupId(DelegateExecution execution) { - def endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + execution.getVariable("CVGN_volumeGroupGetEndpoint") - + AAIResourceUri resourceUri = execution.getVariable("CVGN_volumeGroupGetEndpoint") + try { - msoLogger.debug("invoking GET call to AAI endpoint :"+System.lineSeparator()+endPoint) - msoLogger.debug("queryAAIForVolumeGroupId() endpoint-" + endPoint) - msoLogger.debug("ConfirmVolumeGroup sending GET call to AAI Endpoint: " + endPoint) - - AaiUtil aaiUtil = new AaiUtil(this) - APIResponse response = aaiUtil.executeAAIGetCall(execution, endPoint) - def responseData = response.getResponseBodyAsString() - def responseStatusCode = response.getStatusCode() - execution.setVariable("CVGN_queryVolumeGroupResponseCode", responseStatusCode) - execution.setVariable("CVGN_queryVolumeGroupResponse", responseData) - - msoLogger.debug("Response code:" + responseStatusCode) - msoLogger.debug("Response:" + responseData) - msoLogger.debug("Response code:" + responseStatusCode) - msoLogger.debug("Response:" + System.lineSeparator()+responseData) + Optional<VolumeGroup> volumeGroupOp = getAAIClient().get(VolumeGroup.class, resourceUri) + if(volumeGroupOp.isPresent()){ + execution.setVariable("CVGN_queryVolumeGroupResponseCode", 200) + execution.setVariable("CVGN_queryVolumeGroupResponse", volumeGroupOp.get()) + }else{ + execution.setVariable("CVGN_queryVolumeGroupResponseCode", 404) + execution.setVariable("CVGN_queryVolumeGroupResponse", "Volume Group not Found!") + } } catch (Exception ex) { - // ex.printStackTrace() msoLogger.debug("Exception occurred while executing AAI GET:" + ex.getMessage()) execution.setVariable("CVGN_queryVolumeGroupResponseCode", 500) execution.setVariable("CVGN_queryVolumeGroupResponse", "AAI GET Failed:" + ex.getMessage()) @@ -100,17 +93,17 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{ public void checkAAIQueryResult(DelegateExecution execution) { def result = execution.getVariable("CVGN_queryVolumeGroupResponse") - if (execution.getVariable("CVGN_queryVolumeGroupResponseCode") == 404) { + def actualVolumeGroupName = "" + if (execution.getVariable("CVGN_queryVolumeGroupResponseCode") == 404) { msoLogger.debug('volumeGroupId does not exist in AAI') } else if (execution.getVariable("CVGN_queryVolumeGroupResponseCode") == 200) { + VolumeGroup volumeGroup = execution.getVariable("CVGN_queryVolumeGroupResponse") + if(volumeGroup.getVolumeGroupName()!=null){ + actualVolumeGroupName = volumeGroup.getVolumeGroupName() + } msoLogger.debug("volumeGroupId exists in AAI") } - def xml = execution.getVariable("CVGN_queryVolumeGroupResponse") - def actualVolumeGroupName = "" - if (utils.nodeExists(xml, "volume-group-name")) { - actualVolumeGroupName = utils.getNodeText(xml, "volume-group-name") - } execution.setVariable("CVGN_volumeGroupNameMatches", false) def volumeGroupName = execution.getVariable("CVGN_volumeGroupName") @@ -134,4 +127,10 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, errorNotAssociated) } -}
\ No newline at end of file + // sends a successful WorkflowResponse + public void reportSuccess(DelegateExecution execution) { + msoLogger.debug("Sending 200 back to the caller") + def responseXML = "" + execution.setVariable("WorkflowResponse", responseXML) + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy index c0ed81c553..13904c372d 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -37,6 +37,10 @@ import org.w3c.dom.NodeList import org.xml.sax.InputSource import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.constants.Defaults /** * Vnf Module Subflow for confirming the volume group belongs @@ -63,13 +67,10 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{ String incomingGroupName = execution.getVariable("volumeGroupName") String incomingTenantId = execution.getVariable("tenantId") def aicCloudRegion = execution.getVariable("aicCloudRegion") - String aai = UrnPropertiesReader.getVariable("aai.endpoint", execution) AaiUtil aaiUriUtil = new AaiUtil(this) - def aai_uri = aaiUriUtil.getCloudInfrastructureCloudRegionUri(execution) - msoLogger.debug('AAI URI is: ' + aai_uri) - - String path = aai + "${aai_uri}/${aicCloudRegion}/volume-groups/volume-group/" + volumeGroupId + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), aicCloudRegion, volumeGroupId) + String path = aaiUriUtil.createAaiUri(uri) APIResponse queryAAIForVolumeGroupResponse = aaiUriUtil.executeAAIGetCall(execution, path) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy index 84dd70682d..3bbc4bd110 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy @@ -22,6 +22,10 @@ package org.onap.so.bpmn.common.scripts import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.core.RollbackData import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.client.graphinventory.entities.uri.Depth import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger import org.onap.so.rest.APIResponse @@ -67,8 +71,6 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ execution.setVariable("CAAIVfMod_deleteGenericVnfResponse","") execution.setVariable("CAAIVfMod_deleteVfModuleResponseCode",null) execution.setVariable("CAAIVfMod_deleteVfModuleResponse","") -// execution.setVariable("CAAIVfMod_ResponseCode",null) -// execution.setVariable("CAAIVfMod_ErrorResponse","") execution.setVariable("CreateAAIVfModuleResponse","") execution.setVariable("RollbackData", null) @@ -158,38 +160,38 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ execution.setVariable("CAAIVfMod_moduleModelName",execution.getVariable("vfModuleModelName")) AaiUtil aaiUriUtil = new AaiUtil(this) - def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) - msoLogger.debug('AAI URI is: ' + aai_uri) - String aaiNamespace = aaiUriUtil.getNamespaceFromUri(execution, aai_uri) + String aaiNamespace = aaiUriUtil.getNamespace() msoLogger.debug('AAI namespace is: ' + aaiNamespace) - - execution.setVariable("CAAIVfMod_aaiNamespace","${aaiNamespace}") - if (vnfId == null || vnfId.isEmpty()) { - // TBD - assert that the vnfName is not empty - execution.setVariable("CAAIVfMod_genericVnfGetEndpoint", - "${aai_uri}/?vnf-name=" + - UriUtils.encode(vnfName,"UTF-8") + "&depth=1") - } else { - execution.setVariable("CAAIVfMod_genericVnfGetEndpoint", - "${aai_uri}/" + UriUtils.encode(vnfId,"UTF-8") + "?depth=1") - } + execution.setVariable("CAAIVfMod_aaiNamespace","${aaiNamespace}") - msoLogger.debug("CreateAAIVfModule VNF PUT Endpoint: ${aai_uri}/") - execution.setVariable("CAAIVfMod_genericVnfPutEndpoint","${aai_uri}/") } // send a GET request to AA&I to retrieve the Generic VNF/VF Module information based on a Vnf Name // expect a 200 response with the information in the response body or a 404 if the Generic VNF does not exist public void queryAAIForGenericVnf(DelegateExecution execution) { - def endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + execution.getVariable("CAAIVfMod_genericVnfGetEndpoint") + + AaiUtil aaiUtil = new AaiUtil(this) + AAIResourceUri uri + + def vnfId = execution.getVariable("CAAIVfMod_vnfId") + def vnfName = execution.getVariable("CAAIVfMod_vnfName") + + if (vnfId == null || vnfId.isEmpty()) { + uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "") + uri.queryParam("vnf-name", vnfName) + } else { + uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + } + + uri.depth(Depth.ONE) + String endPoint = aaiUtil.createAaiUri(uri) try { msoLogger.debug("queryAAIForGenericVnf() endpoint-" + endPoint) msoLogger.debug("invoking GET call to AAI endpoint :"+System.lineSeparator()+endPoint) msoLogger.debug("CreateAAIVfModule sending GET call to AAI Endpoint: " + endPoint) - AaiUtil aaiUtil = new AaiUtil(this) APIResponse response = aaiUtil.executeAAIGetCall(execution, endPoint) def responseData = response.getResponseBodyAsString() def statusCode = response.getStatusCode() @@ -238,18 +240,8 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ public void createGenericVnf(DelegateExecution execution) { // TBD - is this how we want to generate the Id for the new Generic VNF? def newVnfId = UUID.randomUUID().toString() - def endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + - execution.getVariable("CAAIVfMod_genericVnfPutEndpoint") + newVnfId - // update the flow execution with the new Vnf Id execution.setVariable("CAAIVfMod_vnfId",newVnfId) - - // AaiUriUtil aaiUriUtil = new AaiUriUtil(this) - // def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) - // msoLogger.debug('AAI URI is: ' + aai_uri) - // String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri) - // msoLogger.debug('AAI namespace is: ' + namespace) - - + String payload = """<generic-vnf xmlns="${execution.getVariable("CAAIVfMod_aaiNamespace")}"> <vnf-id>${MsoUtils.xmlEscape(newVnfId)}</vnf-id> <vnf-name>${MsoUtils.xmlEscape(execution.getVariable("CAAIVfMod_vnfName"))}</vnf-name> @@ -262,11 +254,14 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ execution.setVariable("CAAIVfMod_createGenericVnfPayload", payload) try { + AaiUtil aaiUtil = new AaiUtil(this) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, newVnfId) + String endPoint = aaiUtil.createAaiUri(uri) + msoLogger.debug("createGenericVnf() endpoint-" + endPoint) msoLogger.debug("invoking PUT call to AAI with payload:"+System.lineSeparator()+payload) msoLogger.debug("Sending PUT call to AAI with Endpoint /n" + endPoint + " with payload /n" + payload) - AaiUtil aaiUtil = new AaiUtil(this); APIResponse response = aaiUtil.executeAAIPutCall(execution, endPoint, payload); def responseData = response.getResponseBodyAsString() def responseStatusCode = response.getStatusCode() @@ -293,10 +288,9 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ if (newModuleId == null || newModuleId.isEmpty()) { newModuleId = UUID.randomUUID().toString() } - def endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + execution.getVariable("CAAIVfMod_genericVnfPutEndpoint") - // need to append the existing Vnf Id or the one generated in createGenericVnf() to the url - endPoint = endPoint + UriUtils.encode(execution.getVariable("CAAIVfMod_vnfId"), "UTF-8") + - "/vf-modules/vf-module/" + newModuleId; + + String vnfId = execution.getVariable("CAAIVfMod_vnfId") + int moduleIndex = 0 if (!isBaseModule) { def aaiVnfResponse = execution.getVariable("CAAIVfMod_queryGenericVnfResponse") @@ -342,11 +336,15 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ execution.setVariable("CAAIVfMod_createVfModulePayload", payload) try { + + AaiUtil aaiUtil = new AaiUtil(this) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, newModuleId) + String endPoint = aaiUtil.createAaiUri(uri) + msoLogger.debug("createVfModule() endpoint-" + endPoint) msoLogger.debug("invoking PUT call to AAI with payload:"+System.lineSeparator()+payload) msoLogger.debug("CreateAAIVfModule sending PUT call to AAI with endpoint /n" + endPoint + " with payload /n " + payload) - AaiUtil aaiUtil = new AaiUtil(this) APIResponse response = aaiUtil.executeAAIPutCall(execution, endPoint, payload) def responseData = response.getResponseBodyAsString() def statusCode = response.getStatusCode() @@ -554,9 +552,6 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ msoLogger.debug("RollbackData:" + rollbackData) AaiUtil aaiUriUtil = new AaiUtil(this) - def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) - msoLogger.debug('AAI URI is: ' + aai_uri) - msoLogger.debug("CreateAAIVfModule rollback AAI URI: " + aai_uri) if (rollbackData != null) { if (rollbackData.hasType("VFMODULE")) { @@ -566,9 +561,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ def isBaseModule = rollbackData.get("VFMODULE", "isBaseModule") execution.setVariable("DAAIVfMod_vnfId", vnfId) execution.setVariable("DAAIVfMod_vfModuleId", vfModuleId) - execution.setVariable("DAAIVfMod_genericVnfEndpoint", "${aai_uri}/" + vnfId) - execution.setVariable("DAAIVfMod_vfModuleEndpoint", "${aai_uri}/" + vnfId + - "/vf-modules/vf-module/" + vfModuleId) + DeleteAAIVfModule dvm = new DeleteAAIVfModule() // query A&AI to get the needed information for the delete(s) dvm.queryAAIForGenericVnf(execution) @@ -581,13 +574,14 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ if (isOneOf(responseCode, 200, 204)) { msoLogger.debug("Received " + responseCode + " to VF Module rollback request") -// execution.setVariable("RollbackResult", "SUCCESS") } else { msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Received " + responseCode + " to VF Module rollback request", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, rollbackData + System.lineSeparator() + "Response: " + response); } // a new Generic VNF was created that needs to be rolled back if (isBaseModule.equals("true")) { + dvm.queryAAIForGenericVnf(execution) + dvm.parseForResourceVersion(execution) dvm.deleteGenericVnf(execution) responseCode = execution.getVariable("DAAIVfMod_deleteGenericVnfResponseCode") response = execution.getVariable("DAAIVfMod_deleteGenericVnfResponse") diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy index ec691f299e..cc1be47029 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy @@ -23,6 +23,9 @@ package org.onap.so.bpmn.common.scripts import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.rest.APIResponse import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger @@ -76,6 +79,9 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor { def aicCloudRegion = getRequiredNodeText(execution, xml,'aic-cloud-region') execution.setVariable('CAAIVfModVG_aicCloudRegion', aicCloudRegion) + def cloudOwner = getRequiredNodeText(execution, xml,'cloud-owner') + execution.setVariable('CAAIVfModVG_cloudOwner', cloudOwner) + def volumeGroupId = getRequiredNodeText(execution, xml,'volume-group-id') execution.setVariable('CAAIVfModVG_volumeGroupId', volumeGroupId) @@ -105,12 +111,10 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor { def vnfId = execution.getVariable('CAAIVfModVG_vnfId') def vfModuleId = execution.getVariable('CAAIVfModVG_vfModuleId') - // Construct endpoint AaiUtil aaiUtil = new AaiUtil(this) - def aai_uri = aaiUtil.getNetworkGenericVnfUri(execution) - msoLogger.debug('AAI URI is: ' + aai_uri) - String endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + aai_uri + '/' + URLEncoder.encode(vnfId, "UTF-8") + '/vf-modules/vf-module/' + URLEncoder.encode(vfModuleId, "UTF-8") - + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId) + String endPoint = aaiUtil.createAaiUri(uri) + try { msoLogger.debug('sending GET to AAI endpoint \'' + endPoint + '\'') msoLogger.debug("aaiResponse GET TO AAI Endpoint: " + endPoint) @@ -166,17 +170,16 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor { // Construct payload by creating a Volume Group relationhip and inserting it into the VF Module def aicCloudRegion = execution.getVariable('CAAIVfModVG_aicCloudRegion') + def cloudOwner = execution.getVariable('CAAIVfModVG_cloudOwner') def volumeGroupId = execution.getVariable('CAAIVfModVG_volumeGroupId') - def Node vgRelationshipNode = createVolumeGroupRelationshipNode(aicCloudRegion, volumeGroupId) + def Node vgRelationshipNode = createVolumeGroupRelationshipNode(cloudOwner, aicCloudRegion, volumeGroupId) insertVolumeGroupRelationshipNode(vfModuleNode, vgRelationshipNode) def payload = utils.nodeToString(vfModuleNode) - // Construct endpoint AaiUtil aaiUtil = new AaiUtil(this) - def aai_uri = aaiUtil.getNetworkGenericVnfUri(execution) - msoLogger.debug('AAI URI is: ' + aai_uri) - String endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + aai_uri + '/' + URLEncoder.encode(vnfId, "UTF-8") + '/vf-modules/vf-module/' + URLEncoder.encode(vfModuleId, "UTF-8") - + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId) + String endPoint = aaiUtil.createAaiUri(uri) + try { msoLogger.debug("CreateAAIVfModuleVolume Sendind PUT to AAI Endpoint \n " + endPoint + " with payload \n " + payload) msoLogger.debug('sending PUT to AAI endpoint \'' + endPoint + '\'' + 'with payload \n' + payload) @@ -212,12 +215,12 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor { * @param volumeGroupId Volume Group ID to use in the Volume Group relationship * @return a Node representing the new Volume Group relationship */ - private Node createVolumeGroupRelationshipNode(String aicCloudRegion, String volumeGroupId) { + private Node createVolumeGroupRelationshipNode(String cloudOwner, String aicCloudRegion, String volumeGroupId) { def Node relatedTo = new Node(null, 'related-to', 'volume-group') def Node relationshipKeyCO = new Node(null, 'relationship-key', 'cloud-region.cloud-owner') - def Node relationshipValueCO = new Node(null, 'relationship-value', 'att-aic') + def Node relationshipValueCO = new Node(null, 'relationship-value', cloudOwner) def Node relationshipDataCO = new Node(null, 'relationship-data') relationshipDataCO.append(relationshipKeyCO) relationshipDataCO.append(relationshipValueCO) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CustomE2EPutService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CustomE2EPutService.groovy deleted file mode 100644 index 43d540cc74..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CustomE2EPutService.groovy +++ /dev/null @@ -1,283 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.common.scripts - -import static org.apache.commons.lang3.StringUtils.*; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.apache.commons.codec.binary.Base64 -import org.apache.commons.lang3.* - -import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.rest.APIResponse; -import org.onap.so.rest.RESTClient -import org.onap.so.rest.RESTConfig - -import java.net.URLEncoder; -import org.springframework.web.util.UriUtils -import org.onap.so.bpmn.core.UrnPropertiesReader -import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger - -/** - * This class supports the GenericPutService Sub Flow. - * This Generic sub flow can be used by any flow for the - * goal of creating a Service Instance or Service-Subscription in AAI. Upon successful completion of - * this sub flow the GENPS_SuccessIndicator will be true. - * The calling flow must set the GENPS_type variable as "service-instance" - * or "service-subscription". - * A MSOWorkflowException will be thrown Upon unsuccessful - * completion or if an error occurs within this flow. - * Please map variables to the corresponding variable names - * below. - * - * - * Incoming Required Variables: - * @param - GENPS_requestId - * @param - GENPS_type - Required field. This will be required field populated as service-instance or service-subscription - * @param - GENPS_globalSubscriberId - Required field - * @param - GENPS_serviceType - Required Field - * @param - GENPS_payload - Required Field This will be the payload that needs to be sent. - * - * @param - GENPS_serviceInstanceId - Conditional Field. Required for service-instance. - * @param - GENPS_allottedResourceId - Conditional Field. Required for allotted-resource. - * @param - GENPS_tunnelXconnectId - Conditional Field. Required for tunnel-xconnect. - * - * @param - GENPS_serviceResourceVersion - Conditional Field. Needs to be provided only in case of update for both service-instance and service subscription. The calling flows - * should check if a service-instance or servic-subscription exists by calling the subflow GenericGetService. if it exists then resourceversion should be - * obtained from aai and sent as an input parameter. - * - * Outgoing Variables: - * @param - GENPS_SuccessIndicator - * @param - WorkflowException - * - * - */ - - -class CustomE2EPutService extends AbstractServiceTaskProcessor{ - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CustomE2EPutService.class); - - String Prefix = "GENPS_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - - - public void preProcessRequest(DelegateExecution execution) { - execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED GenericPutService PreProcessRequest Process") - - execution.setVariable("GENPS_SuccessIndicator", false) - - try{ - // Get Variables - String requestId = execution.getVariable("GENPS_requestId") - msoLogger.debug("Incoming GENPS_requestId is: " + requestId) - - String globalSubscriberId = execution.getVariable("GENPS_globalSubscriberId") - String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") - String serviceType = execution.getVariable("GENPS_serviceType") - String allottedResourceId = execution.getVariable("GENPS_allottedResourceId") - String tunnelXconnectId = execution.getVariable("GENPS_tunnelXconnectId") - String type = execution.getVariable("GENPS_type") - - if(type != null){ - msoLogger.debug("Incoming GENPS_type is: " + type) - if(type.equalsIgnoreCase("service-instance")){ - if(isBlank(globalSubscriberId) || isBlank(serviceType) || isBlank(serviceInstanceId)){ - msoLogger.debug("Incoming Required Variable is missing or null!") - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") - }else{ - msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) - msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) - msoLogger.debug("Incoming Service Type is: " + serviceType) - } - }else if(type.equalsIgnoreCase("service-subscription")){ - if(isBlank(serviceType) || isBlank(globalSubscriberId)){ - msoLogger.debug("Incoming ServiceType or GlobalSubscriberId is null. These variables are required to create a service-subscription.") - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.") - }else{ - msoLogger.debug("Incoming Service Type is: " + serviceType) - msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) - } - }else if(type.equalsIgnoreCase("allotted-resource")){ - if(isBlank(globalSubscriberId) || isBlank(serviceType) || isBlank(serviceInstanceId) || isBlank(allottedResourceId)){ - msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) - msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) - msoLogger.debug("Incoming Service Type is: " + serviceType) - msoLogger.debug("Incoming Allotted Resource Id is: " + allottedResourceId) - msoLogger.debug("Incoming Required Variable is missing or null!") - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") - }else{ - msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) - msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) - msoLogger.debug("Incoming Service Type is: " + serviceType) - msoLogger.debug("Incoming Allotted Resource Id is: " + allottedResourceId) - } - }else if(type.equalsIgnoreCase("tunnel-xconnect")){ - if(isBlank(globalSubscriberId) || isBlank(serviceType) || isBlank(serviceInstanceId) || isBlank(allottedResourceId) || isBlank(tunnelXconnectId)){ - msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) - msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) - msoLogger.debug("Incoming Service Type is: " + serviceType) - msoLogger.debug("Incoming Allotted Resource Id is: " + allottedResourceId) - msoLogger.debug("Incoming Tunnel Xconnect Id is: " + tunnelXconnectId) - msoLogger.debug("Incoming Required Variable is missing or null!") - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") - }else{ - msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) - msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) - msoLogger.debug("Incoming Service Type is: " + serviceType) - msoLogger.debug("Incoming Allotted Resource Id is: " + allottedResourceId) - msoLogger.debug("Incoming Tunnel Xconnect Id is: " + tunnelXconnectId) - } - }else{ - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Type is Invalid. Please Specify Type as service-instance or service-subscription") - } - }else{ - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Incoming GENPS_type is null. Variable is Required.") - } - - }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") - throw b - }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error encountered within GenericPutService PreProcessRequest method!" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericPutService PreProcessRequest") - - } - msoLogger.trace("COMPLETED GenericPutService PreProcessRequest Process ") - - } - - - - /** - * This method executes a Put call to AAI for the provided - * service instance. - * - * @param - execution - * - */ - public void putServiceInstance(DelegateExecution execution){ - execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED GenericPutService PutServiceInstance method") - try { - String type = execution.getVariable("GENPS_type") - - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) - msoLogger.debug('AAI URI is: ' + aai_uri) - String namespace = aaiUriUtil.getNamespaceFromUri(execution, aai_uri) - msoLogger.debug('AAI namespace is: ' + namespace) - - String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) - String serviceAaiPath = "" - String payload = execution.getVariable("GENPS_payload") - execution.setVariable("GENPS_payload", payload) - msoLogger.debug("Incoming GENPS_payload is: " + payload) - msoLogger.debug(payload) - - String serviceType = execution.getVariable("GENPS_serviceType") - msoLogger.debug(" Incoming GENPS_serviceType is: " + serviceType) - String globalSubscriberId = execution.getVariable("GENPS_globalSubscriberId") - msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) - - // This IF clause is if we need to create a new Service Instance - if(type.equalsIgnoreCase("service-instance")){ - - String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") - msoLogger.debug(" Incoming GENPS_serviceInstanceId is: " + serviceInstanceId) - - // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + URLEncoder.encode(serviceInstanceId,"UTF-8") - serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") - - }else if(type.equalsIgnoreCase("service-subscription")){ - - // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") - serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") - }else if(type.equalsIgnoreCase("allotted-resource")){ - - String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") - msoLogger.debug(" Incoming GENPS_serviceInstanceId is: " + serviceInstanceId) - String allottedResourceId = execution.getVariable("GENPS_allottedResourceId") - msoLogger.debug(" Incoming GENPS_allottedResourceId is: " + allottedResourceId) - - // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") - serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") - }else if(type.equalsIgnoreCase("tunnel-xconnect")){ - - String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") - msoLogger.debug(" Incoming GENPS_serviceInstanceId is: " + serviceInstanceId) - String allottedResourceId = execution.getVariable("GENPS_allottedResourceId") - msoLogger.debug(" Incoming GENPS_allottedResourceId is: " + allottedResourceId) - String tunnelXconnectId = execution.getVariable("GENPS_tunnelXconnectId") - msoLogger.debug(" Incoming GENPS_tunnelXconnectId is: " + tunnelXconnectId) - - // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") - serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") + "/tunnel-xconnects/tunnel-xconnect/" + UriUtils.encode(tunnelXconnectId,"UTF-8") - } - - String resourceVersion = execution.getVariable("GENPS_serviceResourceVersion") - msoLogger.debug("Incoming Resource Version is: " + resourceVersion) - if(resourceVersion !=null){ - serviceAaiPath = serviceAaiPath +'?resource-version=' + UriUtils.encode(resourceVersion,"UTF-8") - } - - execution.setVariable("GENPS_putServiceInstanceAaiPath", serviceAaiPath) - msoLogger.debug("PUT Service Instance AAI Path is: " + "\n" + serviceAaiPath) - - APIResponse response = aaiUriUtil.executeAAIPutCall(execution, serviceAaiPath, payload) - int responseCode = response.getStatusCode() - execution.setVariable("GENPS_putServiceInstanceResponseCode", responseCode) - msoLogger.debug(" Put Service Instance response code is: " + responseCode) - - String aaiResponse = response.getResponseBodyAsString() - execution.setVariable("GENPS_putServiceInstanceResponse", aaiResponse) - - - //Process Response - if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) - //200 OK 201 CREATED 202 ACCEPTED - { - msoLogger.debug("PUT Service Instance Received a Good Response") - execution.setVariable("GENPS_SuccessIndicator", true) - } - - else{ - msoLogger.debug("Put Generic Service Instance Received a Bad Response Code. Response Code is: " + responseCode) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") - } - }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") - throw b - }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error encountered within GenericPutService PutServiceInstance method!" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During Put Service Instance") - } - msoLogger.trace("COMPLETED GenericPutService PutServiceInstance Process") - } - - - -} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy index bb9846c112..178b4d1695 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy @@ -22,6 +22,10 @@ package org.onap.so.bpmn.common.scripts import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.client.graphinventory.entities.uri.Depth import org.onap.so.rest.APIResponse import org.onap.so.rest.RESTClient; import org.onap.so.rest.RESTConfig; @@ -41,8 +45,6 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ execution.setVariable("DAAIVfMod_genVnfRsrcVer",null) execution.setVariable("DAAIVfMod_vfModuleId",null) execution.setVariable("DAAIVfMod_vfModRsrcVer",null) - execution.setVariable("DAAIVfMod_genericVnfEndpoint",null) - execution.setVariable("DAAIVfMod_vfModuleEndpoint",null) execution.setVariable("DAAIVfMod_moduleExists",false) execution.setVariable("DAAIVfMod_isBaseModule", false) execution.setVariable("DAAIVfMod_isLastModule", false) @@ -69,79 +71,55 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ def vfModuleId = utils.getNodeText(xml,"vf-module-id") execution.setVariable("DAAIVfMod_vnfId", vnfId) execution.setVariable("DAAIVfMod_vfModuleId", vfModuleId) - - AaiUtil aaiUriUtil = new AaiUtil(this) - def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) - msoLogger.debug('AAI URI is: ' + aai_uri) - - execution.setVariable("DAAIVfMod_genericVnfEndpoint", "${aai_uri}/" + vnfId) - execution.setVariable("DAAIVfMod_vfModuleEndpoint", "${aai_uri}/" + vnfId + - "/vf-modules/vf-module/" + vfModuleId) } // send a GET request to AA&I to retrieve the Generic Vnf/Vf Module information based on a Vnf Id // expect a 200 response with the information in the response body or a 404 if the Generic Vnf does not exist public void queryAAIForGenericVnf(DelegateExecution execution) { - def delModuleId = execution.getVariable("DAAIVfMod_vfModuleId") - def endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + execution.getVariable("DAAIVfMod_genericVnfEndpoint") + "?depth=1" - msoLogger.debug("DeleteAAIVfModule endPoint: " + endPoint) - def aaiRequestId = utils.getRequestID() + + def vnfId = execution.getVariable("DAAIVfMod_vnfId") - RESTConfig config = new RESTConfig(endPoint); - msoLogger.debug("queryAAIForGenericVnf() endpoint-" + endPoint) - def responseData = "" try { - RESTClient client = new RESTClient(config).addHeader("X-TransactionId", aaiRequestId).addHeader("X-FromAppId", "MSO"). - addHeader("Accept","application/xml"); - String basicAuthCred = utils.getBasicAuth(UrnPropertiesReader.getVariable("aai.auth", execution),UrnPropertiesReader.getVariable("mso.msoKey", execution)) - - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - msoLogger.debug("invoking GET call to AAI endpoint :"+System.lineSeparator()+endPoint) - APIResponse response = client.httpGet() - msoLogger.debug("DeleteAAIVfModule - invoking httpGet to AAI") + AaiUtil aaiUriUtil = new AaiUtil(this) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + uri.depth(Depth.ONE) + String endPoint = aaiUriUtil.createAaiUri(uri) + + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, endPoint) + + msoLogger.debug('Response code:' + response.getStatusCode()) + msoLogger.debug('Response:' + response.getResponseBodyAsString()) - responseData = response.getResponseBodyAsString() execution.setVariable("DAAIVfMod_queryGenericVnfResponseCode", response.getStatusCode()) - execution.setVariable("DAAIVfMod_queryGenericVnfResponse", responseData) - msoLogger.debug("AAI Response: " + responseData) - msoLogger.debug("Response code:" + response.getStatusCode()) - msoLogger.debug("Response:" + System.lineSeparator()+responseData) + execution.setVariable("DAAIVfMod_queryGenericVnfResponse", response.getResponseBodyAsString()) + } catch (Exception ex) { msoLogger.debug("Exception occurred while executing AAI GET:" + ex.getMessage()) execution.setVariable("DAAIVfMod_queryGenericVnfResponse", "AAI GET Failed:" + ex.getMessage()) exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured during queryAAIForGenericVnf") - } } // construct and send a DELETE request to A&AI to delete a Generic Vnf // note: to get here, all the modules associated with the Generic Vnf must already be deleted public void deleteGenericVnf(DelegateExecution execution) { - def aaiRequestId = utils.getRequestID() - def endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + execution.getVariable("DAAIVfMod_genericVnfEndpoint") + - "/?resource-version=" + execution.getVariable("DAAIVfMod_genVnfRsrcVer") - msoLogger.debug("AAI endPoint: " + endPoint) - RESTConfig config = new RESTConfig(endPoint); - msoLogger.debug("deleteGenericVnf() endpoint-" + endPoint) - def responseData = "" + try { - RESTClient client = new RESTClient(config).addHeader("X-TransactionId", aaiRequestId).addHeader("X-FromAppId", "MSO"). - addHeader("Accept","application/xml"); + String vnfId = execution.getVariable("DAAIVfMod_vnfId") + String resourceVersion = execution.getVariable("DAAIVfMod_genVnfRsrcVer") - String basicAuthCred = utils.getBasicAuth(UrnPropertiesReader.getVariable("aai.auth", execution),UrnPropertiesReader.getVariable("mso.msoKey", execution)) - - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - APIResponse response = client.httpDelete() + AaiUtil aaiUriUtil = new AaiUtil(this) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + uri.resourceVersion(resourceVersion) + String endPoint = aaiUriUtil.createAaiUri(uri) + + APIResponse response = aaiUriUtil.executeAAIDeleteCall(execution, endPoint) - responseData = response.getResponseBodyAsString() + def responseData = response.getResponseBodyAsString() execution.setVariable("DAAIVfMod_deleteGenericVnfResponseCode", response.getStatusCode()) execution.setVariable("DAAIVfMod_deleteGenericVnfResponse", responseData) msoLogger.debug("Response code:" + response.getStatusCode()) - msoLogger.debug("Response:" + System.lineSeparator()+responseData) + msoLogger.debug("Response:" + System.lineSeparator() + responseData) } catch (Exception ex) { ex.printStackTrace() msoLogger.debug("Exception occurred while executing AAI DELETE:" + ex.getMessage()) @@ -151,32 +129,25 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ // construct and send a DELETE request to A&AI to delete the Base or Add-on Vf Module public void deleteVfModule(DelegateExecution execution) { - def endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + execution.getVariable("DAAIVfMod_vfModuleEndpoint") + - "/?resource-version=" + execution.getVariable("DAAIVfMod_vfModRsrcVer") - def aaiRequestId = utils.getRequestID() - - RESTConfig config = new RESTConfig(endPoint); - msoLogger.debug("deleteVfModule() endpoint-" + endPoint) def responseData = "" try { - RESTClient client = new RESTClient(config).addHeader("X-TransactionId", aaiRequestId).addHeader("X-FromAppId", "MSO"). - addHeader("Accept","application/xml"); + String vnfId = execution.getVariable("DAAIVfMod_vnfId") + String vfModuleId = execution.setVariable("DAAIVfMod_vfModuleId") + String resourceVersion = execution.getVariable("DAAIVfMod_vfModRsrcVer") - String basicAuthCred = utils.getBasicAuth(UrnPropertiesReader.getVariable("aai.auth", execution),UrnPropertiesReader.getVariable("mso.msoKey", execution)) - - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - APIResponse response = client.httpDelete() + AaiUtil aaiUriUtil = new AaiUtil(this) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId) + uri.resourceVersion(resourceVersion) + String endPoint = aaiUriUtil.createAaiUri(uri) - msoLogger.debug("DeleteAAIVfModule - invoking httpDelete to AAI") + APIResponse response = aaiUriUtil.executeAAIDeleteCall(execution, endPoint) responseData = response.getResponseBodyAsString() execution.setVariable("DAAIVfMod_deleteVfModuleResponseCode", response.getStatusCode()) execution.setVariable("DAAIVfMod_deleteVfModuleResponse", responseData) msoLogger.debug("DeleteAAIVfModule - AAI Response" + responseData) msoLogger.debug("Response code:" + response.getStatusCode()) - msoLogger.debug("Response:" + System.lineSeparator()+responseData) + msoLogger.debug("Response:" + System.lineSeparator() + responseData) } catch (Exception ex) { ex.printStackTrace() diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy index 7d4adaea58..3096bedda6 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (C) 2018 Huawei Technologies Co., Ltd. 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. @@ -31,11 +31,11 @@ import java.util.regex.Matcher import java.util.regex.Pattern class ExternalAPIUtil { - + String Prefix="EXTAPI_" public MsoUtils utils = new MsoUtils() - + ExceptionUtil exceptionUtil = new ExceptionUtil() private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ExternalAPIUtil.class) @@ -71,16 +71,16 @@ class ExternalAPIUtil { "\t\t\t\"serviceCharacteristic\": [ \n" + "<_requestInputs_> \n" + "\t\t\t] \n" + - "\t\t}\n" + + "\t\t}\n" + "\t}]\n" + "}" - + public static final String RequestInputsTemplate = "{ \n" + "\t\"name\": <inputName>, \n" + "\t\"value\": { \n" + "\t\t\"serviceCharacteristicValue\": <inputValue> \n" + - "\t} \n" + + "\t} \n" + "}" public ExternalAPIUtil() { @@ -93,11 +93,11 @@ class ExternalAPIUtil { // msoLogger.debug("ExternalAPIUtil.getUri: " + uri) // return uri // } -// +// // exceptionUtil.buildAndThrowWorkflowException(execution, 9999, 'ExternalAPI URI not find') // } - - public String setTemplate(String template, Map<String, String> valueMap) { + + public String setTemplate(String template, Map<String, String> valueMap) { msoLogger.debug("ExternalAPIUtil setTemplate", true); StringBuffer result = new StringBuffer(); @@ -143,7 +143,7 @@ class ExternalAPIUtil { if (basicAuthCred != null && !"".equals(basicAuthCred)) { client.addAuthorizationHeader(basicAuthCred) } - apiResponse = client.get() + apiResponse = client.httpGet() msoLogger.debug( "======== COMPLETED Execute ExternalAPI Get Process ======== ") }catch(Exception e){ diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy index 5cdcd0d5bf..78d147e819 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy @@ -30,6 +30,10 @@ import org.springframework.web.util.UriUtils import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.client.graphinventory.entities.uri.Depth import org.onap.so.rest.APIResponse; import org.onap.so.rest.RESTClient import org.onap.so.rest.RESTConfig @@ -73,11 +77,11 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{ def vnfId = execution.getVariable('vnfId') def personaModelId = execution.getVariable('personaModelId') - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) - msoLogger.debug('AAI URI is: ' + aai_uri) + AaiUtil aaiUtil = new AaiUtil(this) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + uri.depth(Depth.ONE) + String endPoint = aaiUtil.createAaiUri(uri) - String endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1" msoLogger.debug("AAI endPoint: " + endPoint) try { diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericGetVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericGetVnf.groovy deleted file mode 100644 index 01d8e9b8d5..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericGetVnf.groovy +++ /dev/null @@ -1,275 +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.common.scripts - -import org.onap.so.bpmn.core.UrnPropertiesReader -import static org.onap.so.bpmn.common.scripts.GenericUtils.*; - -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.so.rest.APIResponse -import org.springframework.web.util.UriUtils -import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger - - - - -/** - * TODO: Support getting vnf type = vpe - * - * This class supports the GenericGetVnf Sub Flow. - * This Generic sub flow can be used by any flow for accomplishing - * the goal of getting a Vnf Object (from AAI). The flow currently - * supports the querying of 2 types of Vnfs, generic-vnf and vce. The - * type must be provided by the calling flow and the type should - * be mapped to the variable GENGV_type. The type should either be - * "generic-vnf" or "vce". If the Vnf Id is not provided by the calling - * flow then this sub flow will execute the query to get the - * Vnf using the Vnf Name. Therefore, the calling flow must provide - * either the Vnf Id or Vnf Name. - * - * Upon successful completion of this sub flow the - * GENGV_SuccessIndicator will be true and the query response payload - * will be set to GENGV_vnf. An MSOWorkflowException will - * be thrown upon unsuccessful completion or if an error occurs - * at any time during this sub flow. Please map variables - * to the corresponding variable names below. - * - * Note - if this sub flow receives a Not Found (404) response - * from AAI at any time this will be considered an acceptable - * successful response however the GENGV_FoundIndicator - * set to false. This will allow the calling flow to distinguish - * between the two success scenarios, "Success where Vnf is found" - * and "Success where Vnf is NOT found". - * - * - * Variable Mapping Below - * - * In Mapping Variables: - * @param - GENGV_vnfId or @param - GENGV_vnfName - * @param - GENGV_type - * - * Out Mapping Variables: - * @param - GENGV_vnf - * @param - GENGV_SuccessIndicator - * @param - GENGV_FoundIndicator - * @param - WorkflowException - * - * - */ -class GenericGetVnf extends AbstractServiceTaskProcessor{ - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, GenericGetVnf.class); - - - String Prefix = "GENGV_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - - /** - * This method validates the incoming variables and - * determines the subsequent event based on which - * variables the calling flow provided. - * - * @param - execution - */ - public void preProcessRequest(DelegateExecution execution) { - execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED GenericGetVnf PreProcessRequest Process") - - execution.setVariable("GENGV_getVnfByName", false) - execution.setVariable("GENGV_SuccessIndicator", false) - execution.setVariable("GENGV_FoundIndicator", false) - - try{ - // Get Variables - String vnfId = execution.getVariable("GENGV_vnfId") - msoLogger.debug("Incoming Vnf Id is: " + vnfId) - String vnfName = execution.getVariable("GENGV_vnfName") - msoLogger.debug("Incoming Vnf Name is: " + vnfName) - - if(isBlank(vnfId) && isBlank(vnfName)){ - msoLogger.debug("Incoming Vnf Name and Vnf Id are null. At least one is required!") - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Vnf Name and Vnf Id are null. At least one is required.") - }else{ - if(isBlank(vnfId)){ - execution.setVariable("GENGV_getVnfByName", true) - } - } - - }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") - throw b - }catch(Exception e){ - msoLogger.debug(" Error encountered within GenericGetVnf PreProcessRequest method!" + e) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericGetVnf PreProcessRequest") - - } - msoLogger.trace("COMPLETED GenericGetVnf PreProcessRequest Process ") - } - - /** - * This method executes a GET call to AAI to obtain the - * Vnf using the Vnf Name - * - * @param - execution - */ - public void getVnfByName(DelegateExecution execution){ - execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED GenericGetVnf GetVnfByName Process") - try { - String vnfName = execution.getVariable("GENGV_vnfName") - msoLogger.debug("Getting Vnf by Vnf Name: " + vnfName) - String type = execution.getVariable("GENGV_type") - msoLogger.debug("Type of Vnf Getting is: " + type) - - String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) - AaiUtil aaiUriUtil = new AaiUtil(this) - - //Determine Type of Vnf Querying For. - def aai_uri = "" - if(type.equals("generic-vnf")){ - aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) - }else if(type.equals("vce")){ - aai_uri = aaiUriUtil.getNetworkVceUri(execution) - }else{ - msoLogger.debug("Invalid Incoming GENGV_type") - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Invalid Incoming GENGV_type") - } - - String getVnfPath = "${aai_endpoint}${aai_uri}?vnf-name=" + UriUtils.encode(vnfName, "UTF-8") + "&depth=1" - - execution.setVariable("GENGV_getVnfPath", getVnfPath) - msoLogger.debug("Get Vnf Url is: " + getVnfPath) - - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, getVnfPath) - int responseCode = response.getStatusCode() - execution.setVariable("GENGV_getVnfResponseCode", responseCode) - msoLogger.debug(" GET Vnf response code is: " + responseCode) - - String aaiResponse = response.getResponseBodyAsString() - execution.setVariable("GENGV_getVnfResponse", aaiResponse) - - //Process Response - if(responseCode == 200){ - msoLogger.debug("GET Vnf Received a Good Response") - if(utils.nodeExists(aaiResponse, type)){ - msoLogger.debug("GET Vnf Response Contains a Vnf") - execution.setVariable("GENGV_FoundIndicator", true) - execution.setVariable("GENGV_vnf", aaiResponse) - execution.setVariable("WorkflowResponse", aaiResponse) - }else{ - msoLogger.debug("GET Vnf Response Does NOT Contain a Vnf") - } - - }else if(responseCode == 404){ - msoLogger.debug("GET Vnf Received a Not Found (404) Response") - }else{ - msoLogger.debug("GET Vnf Received a Bad Response: \n" + aaiResponse) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") - } - }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") - throw b - }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error encountered within GenericGetVnf GetVnfByName method!" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GetVnfByName") - } - msoLogger.trace("COMPLETED GenericGetVnf GetVnfByName Process") - } - - /** - * This method executes a GET call to AAI to obtain the - * Vnf using the Vnf Id - * - * @param - execution - */ - public void getVnfById(DelegateExecution execution){ - execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED GenericGetVnf GetVnfById Process") - try { - String vnfId = execution.getVariable("GENGV_vnfId") - msoLogger.debug("Getting Vnf by Vnf Id: " + vnfId) - String type = execution.getVariable("GENGV_type") - msoLogger.debug("Type of Vnf Getting is: " + type) - - String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) - AaiUtil aaiUriUtil = new AaiUtil(this) - - //Determine Type of Vnf Querying For. - def aai_uri = "" - if(type.equals("generic-vnf")){ - aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) - }else if(type.equals("vce")){ - aai_uri = aaiUriUtil.getNetworkVceUri(execution) - }else if(type.equals("vpe")){ - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "GenericGetVnf does not yet support getting type of vnf = vpe") - }else{ - msoLogger.debug("Invalid Incoming GENGV_type") - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Invalid Incoming GENGV_type") - } - msoLogger.debug("Using AAI Uri: " + aai_uri) - - String getVnfPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1" - msoLogger.debug("GET Vnf Endpoint is: " + getVnfPath) - - execution.setVariable("GENGV_getVnfPath", getVnfPath) - msoLogger.debug("Get Vnf Url is: " + getVnfPath) - - APIResponse response = aaiUriUtil.executeAAIGetCall(execution, getVnfPath) - int responseCode = response.getStatusCode() - execution.setVariable("GENGV_getVnfResponseCode", responseCode) - msoLogger.debug(" GET Vnf response code is: " + responseCode) - - String aaiResponse = response.getResponseBodyAsString() - execution.setVariable("GENGV_getVnfResponse", aaiResponse) - - //Process Response - if(responseCode == 200){ - msoLogger.debug("GET Vnf Received a Good Response") - if(utils.nodeExists(aaiResponse, type)){ - msoLogger.debug("GET Vnf Response Contains a Vnf") - execution.setVariable("GENGV_FoundIndicator", true) - execution.setVariable("GENGV_vnf", aaiResponse) - execution.setVariable("WorkflowResponse", aaiResponse) - }else{ - msoLogger.debug("GET Vnf Response Does NOT Contain a Vnf") - } - - }else if(responseCode == 404){ - msoLogger.debug("GET Vnf Received a Not Found (404) Response") - }else{ - msoLogger.debug("GET Vnf Received a BAD REST Response: \n" + aaiResponse) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") - } - }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") - throw b - }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error encountered within GenericGetVnf GetVnfById method!" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GetVnfById") - } - msoLogger.trace("COMPLETED GenericGetVnf GetVnfById Process") - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericPutService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericPutService.groovy deleted file mode 100644 index 8cc756d412..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericPutService.groovy +++ /dev/null @@ -1,282 +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.common.scripts - -import org.onap.so.bpmn.core.UrnPropertiesReader - -import static org.apache.commons.lang3.StringUtils.*; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.apache.commons.codec.binary.Base64 -import org.apache.commons.lang3.* - -import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.rest.APIResponse; -import org.onap.so.rest.RESTClient -import org.onap.so.rest.RESTConfig - -import java.net.URLEncoder; -import org.springframework.web.util.UriUtils -import org.onap.so.logger.MessageEnum -import org.onap.so.logger.MsoLogger - - - -/** - * This class supports the GenericPutService Sub Flow. - * This Generic sub flow can be used by any flow for the - * goal of creating a Service Instance or Service-Subscription in AAI. Upon successful completion of - * this sub flow the GENPS_SuccessIndicator will be true. - * The calling flow must set the GENPS_type variable as "service-instance" - * or "service-subscription". - * A MSOWorkflowException will be thrown Upon unsuccessful - * completion or if an error occurs within this flow. - * Please map variables to the corresponding variable names - * below. - * - * - * Incoming Required Variables: - * @param - GENPS_requestId - * @param - GENPS_type - Required field. This will be required field populated as service-instance or service-subscription - * @param - GENPS_globalSubscriberId - Required field - * @param - GENPS_serviceType - Required Field - * @param - GENPS_payload - Required Field This will be the payload that needs to be sent. - * - * @param - GENPS_serviceInstanceId - Conditional Field. Required for service-instance. - * @param - GENPS_allottedResourceId - Conditional Field. Required for allotted-resource. - * @param - GENPS_tunnelXconnectId - Conditional Field. Required for tunnel-xconnect. - * - * @param - GENPS_serviceResourceVersion - Conditional Field. Needs to be provided only in case of update for both service-instance and service subscription. The calling flows - * should check if a service-instance or servic-subscription exists by calling the subflow. if it exists then resourceversion should be - * obtained from aai and sent as an input parameter. - * - * Outgoing Variables: - * @param - GENPS_SuccessIndicator - * @param - WorkflowException - * - * - */ - - -class GenericPutService extends AbstractServiceTaskProcessor{ - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, GenericPutService.class); - - - String Prefix = "GENPS_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - - - public void preProcessRequest(DelegateExecution execution) { - execution.setVariable("isDebugLogEnabled","true") - execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED GenericPutService PreProcessRequest Process") - - execution.setVariable("GENPS_SuccessIndicator", false) - - try{ - // Get Variables - String requestId = execution.getVariable("GENPS_requestId") - msoLogger.debug("Incoming GENPS_requestId is: " + requestId) - - String globalSubscriberId = execution.getVariable("GENPS_globalSubscriberId") - String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") - String serviceType = execution.getVariable("GENPS_serviceType") - String allottedResourceId = execution.getVariable("GENPS_allottedResourceId") - String tunnelXconnectId = execution.getVariable("GENPS_tunnelXconnectId") - String type = execution.getVariable("GENPS_type") - - if(type != null){ - msoLogger.debug("Incoming GENPS_type is: " + type) - if(type.equalsIgnoreCase("service-instance")){ - if(isBlank(globalSubscriberId) || isBlank(serviceType) || isBlank(serviceInstanceId)){ - msoLogger.debug("Incoming Required Variable is missing or null!") - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") - }else{ - msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) - msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) - msoLogger.debug("Incoming Service Type is: " + serviceType) - } - }else if(type.equalsIgnoreCase("service-subscription")){ - if(isBlank(serviceType) || isBlank(globalSubscriberId)){ - msoLogger.debug("Incoming ServiceType or GlobalSubscriberId is null. These variables are required to create a service-subscription.") - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.") - }else{ - msoLogger.debug("Incoming Service Type is: " + serviceType) - msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) - } - }else if(type.equalsIgnoreCase("allotted-resource")){ - if(isBlank(globalSubscriberId) || isBlank(serviceType) || isBlank(serviceInstanceId) || isBlank(allottedResourceId)){ - msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) - msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) - msoLogger.debug("Incoming Service Type is: " + serviceType) - msoLogger.debug("Incoming Allotted Resource Id is: " + allottedResourceId) - msoLogger.debug("Incoming Required Variable is missing or null!") - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") - }else{ - msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) - msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) - msoLogger.debug("Incoming Service Type is: " + serviceType) - msoLogger.debug("Incoming Allotted Resource Id is: " + allottedResourceId) - } - }else if(type.equalsIgnoreCase("tunnel-xconnect")){ - if(isBlank(globalSubscriberId) || isBlank(serviceType) || isBlank(serviceInstanceId) || isBlank(allottedResourceId) || isBlank(tunnelXconnectId)){ - msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) - msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) - msoLogger.debug("Incoming Service Type is: " + serviceType) - msoLogger.debug("Incoming Allotted Resource Id is: " + allottedResourceId) - msoLogger.debug("Incoming Tunnel Xconnect Id is: " + tunnelXconnectId) - msoLogger.debug("Incoming Required Variable is missing or null!") - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") - }else{ - msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) - msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId) - msoLogger.debug("Incoming Service Type is: " + serviceType) - msoLogger.debug("Incoming Allotted Resource Id is: " + allottedResourceId) - msoLogger.debug("Incoming Tunnel Xconnect Id is: " + tunnelXconnectId) - } - }else{ - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Type is Invalid. Please Specify Type as service-instance or service-subscription") - } - }else{ - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Incoming GENPS_type is null. Variable is Required.") - } - - }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") - throw b - }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error encountered within GenericPutService PreProcessRequest method!" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericPutService PreProcessRequest") - - } - msoLogger.trace("COMPLETED GenericPutService PreProcessRequest Process ") - - } - - /** - * This method executes a Put call to AAI for the provided - * service instance. - * - * @param - execution - * - */ - public void putServiceInstance(DelegateExecution execution){ - execution.setVariable("prefix",Prefix) - msoLogger.trace("STARTED GenericPutService PutServiceInstance method") - try { - String type = execution.getVariable("GENPS_type") - - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) - msoLogger.debug('AAI URI is: ' + aai_uri) - String namespace = aaiUriUtil.getNamespaceFromUri(execution, aai_uri) - msoLogger.debug('AAI namespace is: ' + namespace) - - String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) - String serviceAaiPath = "" - String payload = execution.getVariable("GENPS_payload") - execution.setVariable("GENPS_payload", payload) - msoLogger.debug("Incoming GENPS_payload is: " + payload) - msoLogger.debug(payload) - - String serviceType = execution.getVariable("GENPS_serviceType") - msoLogger.debug(" Incoming GENPS_serviceType is: " + serviceType) - - String globalSubscriberId = execution.getVariable("GENPS_globalSubscriberId") - msoLogger.debug("Incoming Global Subscriber Id is: " + globalSubscriberId) - - // This IF clause is if we need to create a new Service Instance - if(type.equalsIgnoreCase("service-instance")){ - - String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") - msoLogger.debug(" Incoming GENPS_serviceInstanceId is: " + serviceInstanceId) - - // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + URLEncoder.encode(serviceInstanceId,"UTF-8") - serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") - - }else if(type.equalsIgnoreCase("service-subscription")){ - - // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") - serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") - }else if(type.equalsIgnoreCase("allotted-resource")){ - - String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") - msoLogger.debug(" Incoming GENPS_serviceInstanceId is: " + serviceInstanceId) - String allottedResourceId = execution.getVariable("GENPS_allottedResourceId") - msoLogger.debug(" Incoming GENPS_allottedResourceId is: " + allottedResourceId) - - // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") - serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") - }else if(type.equalsIgnoreCase("tunnel-xconnect")){ - - String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") - msoLogger.debug(" Incoming GENPS_serviceInstanceId is: " + serviceInstanceId) - String allottedResourceId = execution.getVariable("GENPS_allottedResourceId") - msoLogger.debug(" Incoming GENPS_allottedResourceId is: " + allottedResourceId) - String tunnelXconnectId = execution.getVariable("GENPS_tunnelXconnectId") - msoLogger.debug(" Incoming GENPS_tunnelXconnectId is: " + tunnelXconnectId) - - // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") - serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") + "/tunnel-xconnects/tunnel-xconnect/" + UriUtils.encode(tunnelXconnectId,"UTF-8") - } - - String resourceVersion = execution.getVariable("GENPS_serviceResourceVersion") - msoLogger.debug("Incoming Resource Version is: " + resourceVersion) - if(resourceVersion !=null){ - serviceAaiPath = serviceAaiPath +'?resource-version=' + UriUtils.encode(resourceVersion,"UTF-8") - } - - execution.setVariable("GENPS_putServiceInstanceAaiPath", serviceAaiPath) - msoLogger.debug("PUT Service Instance AAI Path is: " + "\n" + serviceAaiPath) - APIResponse response = aaiUriUtil.executeAAIPutCall(execution, serviceAaiPath, payload) - int responseCode = response.getStatusCode() - execution.setVariable("GENPS_putServiceInstanceResponseCode", responseCode) - msoLogger.debug(" Put Service Instance response code is: " + responseCode) - - String aaiResponse = response.getResponseBodyAsString() - execution.setVariable("GENPS_putServiceInstanceResponse", aaiResponse) - - //Process Response - if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) - //200 OK 201 CREATED 202 ACCEPTED - { - msoLogger.debug("PUT Service Instance Received a Good Response") - execution.setVariable("GENPS_SuccessIndicator", true) - } - - else{ - msoLogger.debug("Put Generic Service Instance Received a Bad Response Code. Response Code is: " + responseCode) - exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) - throw new BpmnError("MSOWorkflowException") - } - }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") - throw b - }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Error encountered within GenericPutService PutServiceInstance method!" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During Put Service Instance") - } - msoLogger.trace("COMPLETED GenericPutService PutServiceInstance Process") - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/NetworkUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/NetworkUtils.groovy index 2e5499c158..1e8569c3e7 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/NetworkUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/NetworkUtils.groovy @@ -20,43 +20,29 @@ package org.onap.so.bpmn.common.scripts; -import org.apache.commons.lang3.* - -import groovy.xml.XmlUtil -import org.onap.so.bpmn.core.UrnPropertiesReader - +import javax.ws.rs.core.UriBuilder import javax.xml.parsers.DocumentBuilder import javax.xml.parsers.DocumentBuilderFactory import javax.xml.transform.Transformer import javax.xml.transform.TransformerFactory -import javax.xml.transform.TransformerException import javax.xml.transform.dom.DOMSource import javax.xml.transform.stream.StreamResult -import org.camunda.bpm.engine.delegate.BpmnError +import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.DelegateExecution -import org.w3c.dom.Document -import org.w3c.dom.Element - -import org.w3c.dom.NamedNodeMap -import org.w3c.dom.Node -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.MsoLogger - -import org.onap.so.logger.MessageEnum - - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor; import org.w3c.dom.Document import org.w3c.dom.Element -import org.w3c.dom.NamedNodeMap import org.w3c.dom.Node import org.w3c.dom.NodeList; import org.xml.sax.InputSource +import groovy.xml.XmlUtil + /** * This groovy class supports the any Network processes that need the methods defined here. @@ -332,41 +318,9 @@ class NetworkUtils { return requestPayload } - - def String createCloudRegionVolumeRequest(groupId, volumeName, vnfType, tenantId, cloudRegion, namespace, modelCustomizationId) { - - String requestPayload = - """<volume-group xmlns="${namespace}"> - <volume-group-id>${MsoUtils.xmlEscape(groupId)}</volume-group-id> - <volume-group-name>${MsoUtils.xmlEscape(volumeName)}</volume-group-name> - <heat-stack-id></heat-stack-id> - <vnf-type>${MsoUtils.xmlEscape(vnfType)}</vnf-type> - <orchestration-status>Pending</orchestration-status> - <vf-module-model-customization-id>${MsoUtils.xmlEscape(modelCustomizationId)}</vf-module-model-customization-id> - <relationship-list> - <relationship> - <related-to>tenant</related-to> - <relationship-data> - <relationship-key>tenant.tenant-id</relationship-key> - <relationship-value>${MsoUtils.xmlEscape(tenantId)}</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>cloud-region.cloud-region-id</relationship-key> - <relationship-value>${MsoUtils.xmlEscape(cloudRegion)}</relationship-value> - </relationship-data> - </relationship> - </relationship-list> - </volume-group>""" - - return requestPayload - } - - def String createCloudRegionVolumeRequest(groupId, volumeName, vnfType, vnfId, tenantId, cloudRegion, namespace, modelCustomizationId) { - + + def String createCloudRegionVolumeRequest(groupId, volumeName, vnfType, vnfId, tenantId, cloudOwner, cloudRegion, namespace, modelCustomizationId) { + String requestPayload = """<volume-group xmlns="${namespace}"> <volume-group-id>${MsoUtils.xmlEscape(groupId)}</volume-group-id> @@ -391,7 +345,7 @@ class NetworkUtils { </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> + <relationship-value>${cloudOwner}</relationship-value> </relationship-data> <relationship-data> <relationship-key>cloud-region.cloud-region-id</relationship-key> @@ -858,10 +812,8 @@ class NetworkUtils { if (utils.getNodeText(relationshipXml, 'related-to') == "cloud-region") { def relatedLink = utils.getNodeText(relationshipXml, 'related-link') if (relatedLink != null || relatedLink != "") { - lcpCloudRegion = relatedLink.substring(relatedLink.indexOf("/att-aic/")+9, relatedLink.length()) - if (lcpCloudRegion.contains('/')) { - lcpCloudRegion = relatedLink.substring(relatedLink.indexOf("/att-aic/")+9, relatedLink.length()-1) - } + AAIResourceUri aaiUri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.CLOUD_REGION, UriBuilder.fromUri(relatedLink).build()) + lcpCloudRegion = aaiUri.getURIKeys().getOrDefault("cloud-region", "") } } } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy index a6f8ff469d..e182ae3300 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,8 +22,17 @@ package org.onap.so.bpmn.common.scripts import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution +import org.camunda.bpm.model.dmn.instance.OrganizationUnit +import org.hibernate.engine.jdbc.Size.LobMultiplier import org.onap.so.bpmn.core.WorkflowException +import org.onap.aai.domain.yang.GenericVnf import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.client.graphinventory.entities.uri.Depth import org.onap.so.rest.APIResponse import org.onap.so.rest.RESTClient import org.onap.so.rest.RESTConfig @@ -36,12 +45,12 @@ import org.onap.so.logger.MsoLogger public class PrepareUpdateAAIVfModule extends VfModuleBase { private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, PrepareUpdateAAIVfModule.class); - + ExceptionUtil exceptionUtil = new ExceptionUtil() private MsoUtils utils = new MsoUtils() /** * Initialize the flow's variables. - * + * * @param execution The flow's execution instance. */ public void initProcessVariables(DelegateExecution execution) { @@ -58,11 +67,11 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase { execution.setVariable('PUAAIVfMod_updateVfModuleResponseCode', null) execution.setVariable('PUAAIVfMod_updateVfModuleResponse', '') execution.setVariable('PUAAIVfMod_outVfModule', null) - } - + } + /** * Check for missing elements in the received request. - * + * * @param execution The flow's execution instance. */ public void preProcessRequest(DelegateExecution execution) { @@ -75,15 +84,15 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase { def xml = execution.getVariable('PrepareUpdateAAIVfModuleRequest') msoLogger.debug('Received request xml:\n' + xml) msoLogger.debug("PrepareUpdateAAIVfModule Request : " + xml) - + initProcessVariables(execution) - + def vnfId = getRequiredNodeText(execution, xml,'vnf-id') execution.setVariable('PUAAIVfMod_vnfId', vnfId) def vfModuleId = getRequiredNodeText(execution, xml,'vf-module-id') execution.setVariable('PUAAIVfMod_vfModuleId', vfModuleId) - + def orchestrationStatus = getRequiredNodeText(execution, xml,'orchestration-status') execution.setVariable('PUAAIVfMod_orchestrationStatus', orchestrationStatus) @@ -95,11 +104,11 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase { exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage()) } } - + /** * Using the received vnfId, query AAI to get the corresponding Generic VNF. * A 200 response is expected with the Generic VNF in the response body. - * + * * @param execution The flow's execution instance. */ public void getGenericVnf(DelegateExecution execution) { @@ -110,40 +119,16 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase { try { def vnfId = execution.getVariable('PUAAIVfMod_vnfId') - - AaiUtil aaiUriUtil = new AaiUtil(this) - def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) - msoLogger.debug('AAI URI is: ' + aai_uri) - - String endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1" - - msoLogger.debug("PrepareUpdateAAIVfModule: AAI endPoint : " + endPoint) - String basicAuthCred = utils.getBasicAuth(UrnPropertiesReader.getVariable("aai.auth", execution),UrnPropertiesReader.getVariable("mso.msoKey", execution)) + + try { - RESTConfig config = new RESTConfig(endPoint); - def responseData = '' - String aaiRequestId = utils.getRequestID() - RESTClient client = new RESTClient(config). - addHeader('X-TransactionId', aaiRequestId). - addHeader('X-FromAppId', 'MSO'). - addHeader('Content-Type', 'application/xml'). - addHeader('Accept','application/xml'); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - msoLogger.debug('sending GET to AAI endpoint \'' + endPoint + '\'') - APIResponse response = client.httpGet() - msoLogger.debug("PrepareUpdateAAIVfModule: - invoking httpGet to AAI") - - responseData = response.getResponseBodyAsString() - execution.setVariable('PUAAIVfMod_getVnfResponseCode', response.getStatusCode()) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResultWrapper wrapper = resourceClient.get(uri.depth(Depth.ONE)) + GenericVnf responseData = wrapper.asBean(GenericVnf.class).get() + execution.setVariable('PUAAIVfMod_getVnfResponse', responseData) - - msoLogger.debug("PrepareUpdateAAIVfModule: AAI Response : " + responseData) - msoLogger.debug("PrepareUpdateAAIVfModule: AAI ResponseCode : " + response.getStatusCode()) - - msoLogger.debug('Response code:' + response.getStatusCode()) - msoLogger.debug('Response:' + System.lineSeparator() + responseData) + } catch (Exception ex) { msoLogger.error(ex); msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage()) @@ -158,13 +143,13 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase { exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getGenericVnf(): ' + e.getMessage()) } } - + /** * Validate the VF Module. That is, confirm that a VF Module with the input VF Module ID * exists in the retrieved Generic VNF. Then, check to make sure that if that VF Module * is the base VF Module and it's not the only VF Module for this Generic VNF, that we're not * attempting to delete it. - * + * * @param execution The flow's execution instance. */ public void validateVfModule(DelegateExecution execution) { @@ -172,22 +157,30 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase { 'execution=' + execution.getId() + ')' msoLogger.trace('Entered ' + method) - + try { - def genericVnf = execution.getVariable('PUAAIVfMod_getVnfResponse') + GenericVnf genericVnf = execution.getVariable('PUAAIVfMod_getVnfResponse') def vnfId = execution.getVariable('PUAAIVfMod_vnfId') def vfModuleId = execution.getVariable('PUAAIVfMod_vfModuleId') - def vnfName = getNodeTextForce(genericVnf, 'vnf-name') + def vnfName = genericVnf.getVnfName() execution.setVariable('PUAAIVfMod_vnfName', vnfName) - def VfModule vfModule = findVfModule(genericVnf, vfModuleId) - if (vfModule == null) { + + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId) + AAIResourcesClient resourceClient = new AAIResourcesClient() + + + + // def VfModule vfModule = findVfModule(genericVnf, vfModuleId) + if (!resourceClient.exists(uri)) { def String msg = 'VF Module \'' + vfModuleId + '\' does not exist in Generic VNF \'' + vnfId + '\'' execution.setVariable('PUAAIVfMod_vfModuleValidationError', msg) execution.setVariable('PUAAIVfMod_vfModuleOK', false) } else { + AAIResultWrapper wrapper = resourceClient.get(uri) + org.onap.aai.domain.yang.VfModule vfModule = wrapper.asBean(org.onap.aai.domain.yang.VfModule.class) + def orchestrationStatus = execution.getVariable('PUAAIVfMod_orchestrationStatus') - msoLogger.debug('VF Module \'' + vfModuleId + '\': isBaseVfModule=' + vfModule.isBaseVfModule() +', isOnlyVfModule=' + vfModule.isOnlyVfModule() + ', new orchestration-status=' + orchestrationStatus) - if (vfModule.isBaseVfModule() && !vfModule.isOnlyVfModule() && orchestrationStatus.equals('pending-delete')) { + if (vfModule.isBaseVfModule && genericVnf.getVfModules().getVfModule().size() > 1 && vfModule.getOrchestrationStatus().equals('pending-delete')) { def String msg = 'Orchestration status for VF Module \'' + vfModuleId + '\' cannot be set to \'pending-delete\' since it is the base VF Module and it\'s not the only VF Module in Generic VNF \'' + vnfId + '\'' execution.setVariable('PUAAIVfMod_vfModuleValidationError', msg) @@ -197,7 +190,7 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase { execution.setVariable('PUAAIVfMod_vfModuleOK', true) } } - + msoLogger.trace('Exited ' + method) } catch (BpmnError e) { throw e; @@ -206,10 +199,10 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase { exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in validateVfModule(): ' + e.getMessage()) } } - + /** * Construct and send a PATCH request to AAI to update the VF Module. - * + * * @param execution The flow's execution instance. */ public void updateVfModule(DelegateExecution execution) { @@ -217,39 +210,33 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase { 'execution=' + execution.getId() + ')' msoLogger.trace('Entered ' + method) - + try { // Construct payload - def VfModule vfModule = (VfModule) execution.getVariable('PUAAIVfMod_vfModule') - def Node newVfModuleNode = vfModule.getNode().clone() + org.onap.aai.domain.yang.VfModule vfModule = execution.getVariable('PUAAIVfMod_vfModule') + def orchestrationStatus = execution.getVariable('PUAAIVfMod_orchestrationStatus') - def Node orchestrationStatusNode = utils.getChildNode(newVfModuleNode, 'orchestration-status') - if (orchestrationStatusNode == null) { - // Node doesn't exist, this should never happen, right? - new Node(newVfModuleNode, 'orchestration-status', orchestrationStatus) - } else { - // Node already exists, just give it a new value - orchestrationStatusNode.setValue(orchestrationStatus) - } - def VfModule newVfModule = new VfModule(newVfModuleNode, vfModule.isOnlyVfModule()) + + vfModule.setOrchestrationStatus(orchestrationStatus) + //def payload = utils.nodeToString(newVfModuleNode) - + // Construct endpoint def vnfId = execution.getVariable('PUAAIVfMod_vnfId') def vfModuleId = execution.getVariable('PUAAIVfMod_vfModuleId') - + def payload = """{ "vf-module-id": "${vfModuleId}", "orchestration-status": "${orchestrationStatus}" }""" - + msoLogger.debug("VfModule payload : " + payload) - AaiUtil aaiUriUtil = new AaiUtil(this) - def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) - msoLogger.debug('AAI URI is: ' + aai_uri) - - String endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "/vf-modules/vf-module/" + UriUtils.encode(vfModuleId, "UTF-8") + AaiUtil aaiUtil = new AaiUtil(this) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId) + uri.depth(Depth.ONE) + String endPoint = aaiUtil.createAaiUri(uri) + msoLogger.debug("PrepareUpdateAAIVfModule: AAI endPoint : " + endPoint) String basicAuthCred = utils.getBasicAuth(UrnPropertiesReader.getVariable("aai.auth", execution),UrnPropertiesReader.getVariable("mso.msoKey", execution)) try { @@ -275,16 +262,16 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase { msoLogger.debug('Response:' + System.lineSeparator() + responseData) msoLogger.debug("PrepareUpdateAAIVfModule: AAI Response : " + responseData) msoLogger.debug("PrepareUpdateAAIVfModule: AAI ResponseCode : " + response.getStatusCode()) - + // Set the output for this flow. The updated VfModule is an output, the generic VNF name, and for // backward compatibilty, the heat-stack-id is an output - execution.setVariable('PUAAIVfMod_outVfModule', newVfModule) + execution.setVariable('PUAAIVfMod_outVfModule', vfModule) def vnfName = execution.getVariable('PUAAIVfMod_vnfName') msoLogger.debug('Output PUAAIVfMod_vnfName set to ' + vnfName) // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead - execution.setVariable('WorkflowResponse', newVfModule) - msoLogger.debug('Output PUAAIVfMod_outVfModule set for VF Module Id \'' + newVfModule.getElementText('vf-module-id') + '\'') - def heatStackId = newVfModule.getElementText('heat-stack-id') + execution.setVariable('WorkflowResponse', vfModule) + + def heatStackId = vfModule.getHeatStackId() execution.setVariable('PUAAIVfMod_heatStackId', heatStackId) msoLogger.debug('Output PUAAIVfMod_heatStackId set to \'' + heatStackId + '\'') } catch (Exception ex) { @@ -299,12 +286,12 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase { } catch (Exception e) { msoLogger.error(e) exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in updateVfModule(): ' + e.getMessage()) - } + } } - + /** * Generates a WorkflowException if the AAI query returns a response code other than 200. - * + * * @param execution The flow's execution instance. */ public void handleVnfNotFound(DelegateExecution execution) { @@ -318,13 +305,13 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase { WorkflowException exception = new WorkflowException(processKey, 5000, execution.getVariable('PUAAIVfMod_getVnfResponse')) execution.setVariable('WorkflowException', exception) - + msoLogger.trace('Exited ' + method) } - + /** * Generates a WorkflowException if the VF Module does not pass validation. - * + * * @param execution The flow's execution instance. */ public void handleVfModuleValidationError(DelegateExecution execution) { @@ -332,21 +319,21 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase { 'execution=' + execution.getId() + ')' msoLogger.trace('Entered ' + method) - + def String errorMsg = 'VF Module validation error: ' + execution.getVariable('PUAAIVfMod_vfModuleValidationError') msoLogger.error(errorMsg); msoLogger.debug("PrepareUpdateAAIVfModule: Error Message : " + errorMsg) - + String processKey = getProcessKey(execution); WorkflowException exception = new WorkflowException(processKey, 5000, errorMsg) execution.setVariable('WorkflowException', exception) msoLogger.trace('Exited ' + method) } - + /** * Generates a WorkflowException if updating a VF Module in AAI returns a response code other than 200. - * + * * @param execution The flow's execution instance. */ public void handleUpdateVfModuleFailure(DelegateExecution execution) { @@ -360,7 +347,7 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase { WorkflowException exception = new WorkflowException(processKey, 5000, execution.getVariable('PUAAIVfMod_updateVfModuleResponse')) execution.setVariable('WorkflowException', exception) - + msoLogger.trace('Exited ' + method) } } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy index 7d7b9e103f..3e7c4f2d49 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy @@ -24,6 +24,10 @@ import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.client.graphinventory.entities.uri.Depth import org.onap.so.rest.APIResponse import org.springframework.web.util.UriUtils import org.onap.so.logger.MessageEnum @@ -129,10 +133,10 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor { // Construct endpoint AaiUtil aaiUriUtil = new AaiUtil(this) - def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) - msoLogger.debug('AAI URI is: ' + aai_uri) - String endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + aai_uri + '/' + UriUtils.encode(vnfId, "UTF-8") + "?depth=1" - + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + uri.depth(Depth.ONE) + String endPoint = aaiUriUtil.createAaiUri(uri) + try { msoLogger.debug('sending GET to AAI endpoint \'' + endPoint + '\'') msoLogger.debug("Sending GET to AAI endpoint: " + endPoint) @@ -246,9 +250,8 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor { // Construct endpoint AaiUtil aaiUriUtil = new AaiUtil(this) - def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) - msoLogger.debug('AAI URI is: ' + aai_uri) - String endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + aai_uri + '/' + UriUtils.encode(vnfId, "UTF-8") + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + String endPoint = aaiUriUtil.createAaiUri(uri) try { msoLogger.debug('sending PATCH to AAI endpoint \'' + endPoint + '\'' + 'with payload \n' + payload) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy index 68b2df213a..c455ae90ce 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy @@ -24,6 +24,9 @@ import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.rest.APIResponse import org.springframework.web.util.UriUtils import org.onap.so.logger.MessageEnum @@ -104,12 +107,10 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor { def vnfId = execution.getVariable('UAAIVfMod_vnfId') def vfModuleId = execution.getVariable('UAAIVfMod_vfModuleId') - // Construct endpoint AaiUtil aaiUriUtil = new AaiUtil(this) - def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) - msoLogger.debug('AAI URI is: ' + aai_uri) - String endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + aai_uri + '/' + UriUtils.encode(vnfId, "UTF-8") + '/vf-modules/vf-module/' + UriUtils.encode(vfModuleId, "UTF-8") - + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId) + String endPoint = aaiUriUtil.createAaiUri(uri) + try { msoLogger.debug('sending GET to AAI endpoint \'' + endPoint + '\'') msoLogger.debug("UpdateAAIVfModule sending GET to AAI endpoint: " + endPoint) @@ -202,12 +203,9 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor { } """ - - // Construct endpoint AaiUtil aaiUriUtil = new AaiUtil(this) - def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) - msoLogger.debug('AAI URI is: ' + aai_uri) - String endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) + aai_uri + '/' + UriUtils.encode(vnfId, "UTF-8") + '/vf-modules/vf-module/' + UriUtils.encode(vfModuleId, "UTF-8") + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId) + String endPoint = aaiUriUtil.createAaiUri(uri) try { msoLogger.debug('sending PATCH to AAI endpoint \'' + endPoint + '\'' + 'with payload \n' + payload) diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/Candidate.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/Candidate.java index 01846681db..91cd2ad791 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/Candidate.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/Candidate.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -35,6 +35,8 @@ public class Candidate implements Serializable { private CandidateType candidateType; @JsonProperty("candidates") private List<String> candidates; + @JsonProperty("cloudOwner") + private String cloudOwner; /** * list of candidates @@ -68,4 +70,20 @@ public class Candidate implements Serializable { this.candidateType = candidateType; } + /** + * The name of the cloud owner. Required if candidateType is cloudRegionId + */ + public String getCloudOwner(){ + return cloudOwner; + } + + /** + * The name of the cloud owner. Required if candidateType is cloudRegionId + */ + public void setCloudOwner(String cloudOwner){ + this.cloudOwner = cloudOwner; + } + + + } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.java index 9540b9148e..40c76a3c92 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/CandidateType.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -37,7 +37,6 @@ public enum CandidateType { return name; } - //TODO added to get PojoTest to work public String getName(){ return name; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java index eb4f4ca0d5..769d3e4e89 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java @@ -101,7 +101,6 @@ public class BBInputSetup implements JavaDelegate { private static final String LOOKUP_KEY_MAP_VAR_NAME = "lookupKeyMap"; private static final String GBB_INPUT_VAR_NAME = "gBBInput"; private static final String EXECUTE_BB_VAR_NAME = "buildingBlock"; - private static final String CLOUD_OWNER = "att-aic"; private static final String VOLUME_GROUP = "VolumeGroup"; private static final String VF_MODULE = "VfModule"; private static final String NETWORK = "Network"; @@ -384,7 +383,7 @@ public class BBInputSetup implements JavaDelegate { if (lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID) == null) { for(VolumeGroup volumeGroup : tempVnf.getVolumeGroups()) { String volumeGroupCustId = - this.bbInputSetupUtils.getAAIVolumeGroup(CLOUD_OWNER, + this.bbInputSetupUtils.getAAIVolumeGroup(cloudConfiguration.getCloudOwner(), cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()).getModelCustomizationId(); if(modelInfo.getModelCustomizationId().equalsIgnoreCase(volumeGroupCustId)) { lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId()); @@ -801,9 +800,8 @@ public class BBInputSetup implements JavaDelegate { requestContext.setAction(requestAction); requestContext.setMsoRequestId(executeBB.getRequestId()); org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils - .getCloudRegion(requestDetails.getCloudConfiguration(), CLOUD_OWNER); - CloudRegion cloudRegion = mapperLayer.mapCloudRegion(requestDetails.getCloudConfiguration(), aaiCloudRegion, - CLOUD_OWNER); + .getCloudRegion(requestDetails.getCloudConfiguration()); + CloudRegion cloudRegion = mapperLayer.mapCloudRegion(requestDetails.getCloudConfiguration(), aaiCloudRegion); outputBB.setOrchContext(orchContext); outputBB.setRequestContext(requestContext); outputBB.setCloudRegion(cloudRegion); @@ -981,9 +979,8 @@ public class BBInputSetup implements JavaDelegate { String requestAction, CloudConfiguration cloudConfiguration) throws Exception { ServiceInstance serviceInstance = gBB.getServiceInstance(); if (cloudConfiguration != null && requestAction.equalsIgnoreCase("deleteInstance")) { - org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfiguration, - CLOUD_OWNER); - CloudRegion cloudRegion = mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion, CLOUD_OWNER); + org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfiguration); + CloudRegion cloudRegion = mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion); gBB.setCloudRegion(cloudRegion); } if (bbName.contains(VNF)) { @@ -1030,7 +1027,7 @@ public class BBInputSetup implements JavaDelegate { this.mapCatalogVnf(vnf, vnfModelInfo, service); lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnf.getVnfId()); if (cloudConfiguration != null) { - String volumeGroupCustomizationUUID = this.bbInputSetupUtils.getAAIVolumeGroup(CLOUD_OWNER, + String volumeGroupCustomizationUUID = this.bbInputSetupUtils.getAAIVolumeGroup(cloudConfiguration.getCloudOwner(), cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()) .getModelCustomizationId(); ModelInfo volumeGroupModelInfo = new ModelInfo(); @@ -1116,6 +1113,7 @@ public class BBInputSetup implements JavaDelegate { String vfModuleId = lookupKeyMap.get(ResourceKey.VF_MODULE_ID); CloudConfiguration cloudConfig = new CloudConfiguration(); cloudConfig.setLcpCloudRegionId(cloudRegion.getLcpCloudRegionId()); + cloudConfig.setCloudOwner(cloudRegion.getCloudOwner()); this.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, vfModuleId, null, vfModules.getInstanceName(), vfModules.getInstanceParams(), cloudConfig); } @@ -1193,9 +1191,8 @@ public class BBInputSetup implements JavaDelegate { } } if(cloudConfiguration != null) { - org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfiguration, - CLOUD_OWNER); - return mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion, CLOUD_OWNER); + org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfiguration); + return mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion); } else { msoLogger.debug("Could not find any cloud configuration for this request."); return null; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java index 0c7eb0973f..6c399ddbbb 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java @@ -351,14 +351,12 @@ public class BBInputSetupMapperLayer { return context; } - protected CloudRegion mapCloudRegion(CloudConfiguration cloudConfiguration, org.onap.aai.domain.yang.CloudRegion aaiCloudRegion, String cloudOwner) { + protected CloudRegion mapCloudRegion(CloudConfiguration cloudConfiguration, org.onap.aai.domain.yang.CloudRegion aaiCloudRegion) { CloudRegion cloudRegion = new CloudRegion(); if(cloudConfiguration != null) cloudRegion = modelMapper.map(cloudConfiguration, CloudRegion.class); if(aaiCloudRegion != null) modelMapper.map(aaiCloudRegion, cloudRegion); - if(cloudOwner != null) - cloudRegion.setCloudOwner(cloudOwner); return cloudRegion; } 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 84ecfc7576..4617fc4710 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 @@ -163,13 +163,14 @@ public class BBInputSetupUtils { } } - protected CloudRegion getCloudRegion(CloudConfiguration cloudConfiguration, String cloudOwner) { + protected CloudRegion getCloudRegion(CloudConfiguration cloudConfiguration) { if (cloudConfiguration != null) { String cloudRegionId = cloudConfiguration.getLcpCloudRegionId(); - if (cloudRegionId != null && !cloudRegionId.isEmpty()) { + String cloudOwner = cloudConfiguration.getCloudOwner(); + if (cloudRegionId != null && cloudOwner != null && !cloudRegionId.isEmpty() && !cloudOwner.isEmpty()) { return injectionHelper.getAaiClient().get(CloudRegion.class, AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudOwner, - cloudConfiguration.getLcpCloudRegionId())).orElse(null); + cloudRegionId)).orElse(null); } else { return null; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClient.java index f87ec91440..89eff5f65a 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClient.java @@ -182,7 +182,7 @@ public class ApplicationControllerClient { commonHeader.setApiVer(API_VER); commonHeader.setOriginatorId(ORIGINATOR_ID); commonHeader.setRequestId(requestId == null ? UUID.randomUUID().toString() : requestId); - commonHeader.setSubRequestId(requestId); + commonHeader.setSubRequestId(UUID.randomUUID().toString()); Flags flags = new Flags(); String flagsMode = "NORMAL"; Mode mode = Mode.valueOf(flagsMode); diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EPutService.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EPutService.bpmn deleted file mode 100644 index f519bc9dbe..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EPutService.bpmn +++ /dev/null @@ -1,201 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_FatVcHn0EeaH6vX1RRdc_w" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> - <bpmn2:process id="CustomE2EPutService" name="CustomE2EPutService" isExecutable="true"> - <bpmn2:startEvent id="StartEvent_1"> - <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> - </bpmn2:startEvent> - <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="Initialization" /> - <bpmn2:endEvent id="EndEvent_1"> - <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming> - <bpmn2:terminateEventDefinition id="TerminateEventDefinition_1" /> - </bpmn2:endEvent> - <bpmn2:scriptTask id="toggleSuccess" name="Toggle Success Indicator" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* - -def serviceInstance= new CustomE2EPutService() -serviceInstance.setSuccessIndicator(execution, true) - -execution.setVariable("WorkflowResponse", " ") //for junits]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="toggleSuccess" targetRef="EndEvent_1" /> - <bpmn2:scriptTask id="putServiceInstance" name="Put Service Instance" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* - -def serviceInstance= new CustomE2EPutService() -serviceInstance.putServiceInstance(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="putServiceInstance" targetRef="toggleSuccess" /> - <bpmn2:scriptTask id="Initialization" name="Initialization" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* - -def serviceInstance= new CustomE2EPutService() -serviceInstance.preProcessRequest(execution) -]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="Initialization" targetRef="putServiceInstance" /> - <bpmn2:subProcess id="bpmnExceptionHandlingSubProcess" name="Error Handling Sub Process" triggeredByEvent="true"> - <bpmn2:startEvent id="StartEvent_2"> - <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing> - <bpmn2:errorEventDefinition id="ErrorEventDefinition_1" /> - </bpmn2:startEvent> - <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="StartEvent_2" targetRef="processError" /> - <bpmn2:endEvent id="EndEvent_2"> - <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming> - </bpmn2:endEvent> - <bpmn2:scriptTask id="processError" name="Process Error" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* - -ExceptionUtil ex = new ExceptionUtil() -ex.processSubflowsBPMNException(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="processError" targetRef="EndEvent_2" /> - </bpmn2:subProcess> - <bpmn2:subProcess id="javaExceptionSubProcess" name="Java Exception Handling Sub Process" triggeredByEvent="true"> - <bpmn2:startEvent id="catchJavaExcep"> - <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing> - <bpmn2:errorEventDefinition id="ErrorEventDefinition_2" errorRef="Error_2" /> - </bpmn2:startEvent> - <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="catchJavaExcep" targetRef="processJavaError" /> - <bpmn2:scriptTask id="processJavaError" name="Process Java Error" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* - -ExceptionUtil ex = new ExceptionUtil() -ex.processJavaException(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:endEvent id="EndEvent_3"> - <bpmn2:incoming>SequenceFlow_10</bpmn2:incoming> - <bpmn2:terminateEventDefinition id="TerminateEventDefinition_2" /> - </bpmn2:endEvent> - <bpmn2:sequenceFlow id="SequenceFlow_10" name="" sourceRef="processJavaError" targetRef="EndEvent_3" /> - </bpmn2:subProcess> - </bpmn2:process> - <bpmn2:error id="Error_1" name="MSO Workflow Exception" errorCode="MSOWorkflowException" /> - <bpmn2:error id="Error_2" name="Java Lang Exception" errorCode="java.lang.Exception" /> - <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CustomE2EPutService"> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_71" bpmnElement="StartEvent_1"> - <dc:Bounds x="182" y="180" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="200" y="221" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_302" bpmnElement="Initialization"> - <dc:Bounds x="324" y="158" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_71" targetElement="_BPMNShape_ScriptTask_302"> - <di:waypoint xsi:type="dc:Point" x="218" y="198" /> - <di:waypoint xsi:type="dc:Point" x="324" y="198" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="250" y="198" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_304" bpmnElement="putServiceInstance"> - <dc:Bounds x="528" y="158" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_302" targetElement="_BPMNShape_ScriptTask_304"> - <di:waypoint xsi:type="dc:Point" x="424" y="198" /> - <di:waypoint xsi:type="dc:Point" x="528" y="198" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="446" y="198" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_305" bpmnElement="toggleSuccess"> - <dc:Bounds x="732" y="158" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_ScriptTask_304" targetElement="_BPMNShape_ScriptTask_305"> - <di:waypoint xsi:type="dc:Point" x="628" y="198" /> - <di:waypoint xsi:type="dc:Point" x="732" y="198" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="650" y="198" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_EndEvent_230" bpmnElement="EndEvent_1"> - <dc:Bounds x="908" y="180" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="926" y="221" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ScriptTask_305" targetElement="_BPMNShape_EndEvent_230"> - <di:waypoint xsi:type="dc:Point" x="832" y="198" /> - <di:waypoint xsi:type="dc:Point" x="908" y="198" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="854" y="198" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_SubProcess_27" bpmnElement="bpmnExceptionHandlingSubProcess" isExpanded="true"> - <dc:Bounds x="324" y="312" width="418" height="150" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_72" bpmnElement="StartEvent_2"> - <dc:Bounds x="357" y="370" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="375" y="411" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_306" bpmnElement="processError"> - <dc:Bounds x="466" y="348" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_StartEvent_72" targetElement="_BPMNShape_ScriptTask_306"> - <di:waypoint xsi:type="dc:Point" x="393" y="388" /> - <di:waypoint xsi:type="dc:Point" x="466" y="388" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="415" y="388" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_EndEvent_231" bpmnElement="EndEvent_2"> - <dc:Bounds x="615" y="370" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="633" y="411" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_ScriptTask_306" targetElement="_BPMNShape_EndEvent_231"> - <di:waypoint xsi:type="dc:Point" x="566" y="388" /> - <di:waypoint xsi:type="dc:Point" x="615" y="388" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="588" y="388" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_SubProcess_28" bpmnElement="javaExceptionSubProcess" isExpanded="true"> - <dc:Bounds x="323" y="486" width="419" height="150" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_73" bpmnElement="catchJavaExcep"> - <dc:Bounds x="357" y="538" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="375" y="579" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_308" bpmnElement="processJavaError"> - <dc:Bounds x="465" y="516" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_StartEvent_73" targetElement="_BPMNShape_ScriptTask_308"> - <di:waypoint xsi:type="dc:Point" x="393" y="556" /> - <di:waypoint xsi:type="dc:Point" x="465" y="556" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="415" y="556" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_EndEvent_232" bpmnElement="EndEvent_3"> - <dc:Bounds x="615" y="538" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="633" y="579" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_10" sourceElement="_BPMNShape_ScriptTask_308" targetElement="_BPMNShape_EndEvent_232"> - <di:waypoint xsi:type="dc:Point" x="565" y="556" /> - <di:waypoint xsi:type="dc:Point" x="615" y="556" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="587" y="556" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - </bpmndi:BPMNPlane> - </bpmndi:BPMNDiagram> -</bpmn2:definitions> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetVnf.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetVnf.bpmn deleted file mode 100644 index 5784c10d3e..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetVnf.bpmn +++ /dev/null @@ -1,212 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_eb5eEHR6EeaJwpcpVN5gXw" exporter="camunda modeler" exporterVersion="2.7.0" targetNamespace="http://camunda.org/schema/1.0/bpmn"> - <bpmn2:process id="GenericGetVnf" name="GenericGetVnf" isExecutable="true"> - <bpmn2:startEvent id="StartEvent_1"> - <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> - </bpmn2:startEvent> - <bpmn2:scriptTask id="intialization" name="Intialization" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -GenericGetVnf genericGetVnf = new GenericGetVnf () -genericGetVnf.preProcessRequest(execution) -]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="intialization"/> - <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="intialization" targetRef="vnfIdProvided"/> - <bpmn2:exclusiveGateway id="vnfIdProvided" name="Vnf Id Provided?" default="noVnfId"> - <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> - <bpmn2:outgoing>noVnfId</bpmn2:outgoing> - <bpmn2:outgoing>haveVnfId</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="noVnfId" name="No" sourceRef="vnfIdProvided" targetRef="getVnfByName"/> - <bpmn2:sequenceFlow id="haveVnfId" name="Yes" sourceRef="vnfIdProvided" targetRef="getGenericVnf"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENGV_getVnfByName") == false}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:scriptTask id="getVnfByName" name="GET Vnf By Name" scriptFormat="groovy"> - <bpmn2:incoming>noVnfId</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -GenericGetVnf genericGetVnf = new GenericGetVnf() -genericGetVnf.getVnfByName(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="getVnfByName" targetRef="ExclusiveGateway_2"/> - <bpmn2:exclusiveGateway id="ExclusiveGateway_2"> - <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming> - <bpmn2:incoming>SequenceFlow_10</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="ExclusiveGateway_2" targetRef="toggleSuccess"/> - <bpmn2:scriptTask id="getGenericVnf" name="GET Vnf By
Id" scriptFormat="groovy"> - <bpmn2:incoming>haveVnfId</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -GenericGetVnf genericGetVnf = new GenericGetVnf() -genericGetVnf.getVnfById(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_10" name="" sourceRef="getGenericVnf" targetRef="ExclusiveGateway_2"/> - <bpmn2:subProcess id="bpmnExceptionHandlingSubProcess" name="Error Handling Sub Process" triggeredByEvent="true"> - <bpmn2:endEvent id="EndEvent_3"> - <bpmn2:incoming>SequenceFlow_12</bpmn2:incoming> - <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_31"/> - </bpmn2:endEvent> - <bpmn2:scriptTask id="proccessBPMNError" name="Process Error" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_11</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_12</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* - -ExceptionUtil ex = new ExceptionUtil() -ex.processSubflowsBPMNException(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_12" name="" sourceRef="proccessBPMNError" targetRef="EndEvent_3"/> - <bpmn2:startEvent id="catchMSOWorkflowException"> - <bpmn2:outgoing>SequenceFlow_11</bpmn2:outgoing> - <bpmn2:errorEventDefinition id="ErrorEventDefinition_1"/> - </bpmn2:startEvent> - <bpmn2:sequenceFlow id="SequenceFlow_11" name="" sourceRef="catchMSOWorkflowException" targetRef="proccessBPMNError"/> - </bpmn2:subProcess> - <bpmn2:scriptTask id="toggleSuccess" name="Toggle Success Indicator" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -GenericGetVnf genericGetVnf = new GenericGetVnf() -genericGetVnf.setSuccessIndicator(execution, true) -]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_8" name="" sourceRef="toggleSuccess" targetRef="EndEvent_1"/> - <bpmn2:endEvent id="EndEvent_1"> - <bpmn2:incoming>SequenceFlow_8</bpmn2:incoming> - <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_28"/> - </bpmn2:endEvent> - </bpmn2:process> - <bpmn2:error id="Error_1" errorCode="MSOWorkflowException" name="MSO Workflow Exception"/> - <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GenericGetVnf"> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_71" bpmnElement="StartEvent_1"> - <dc:Bounds height="36.0" width="36.0" x="110.0" y="271.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="0.0" width="0.0" x="128.0" y="312.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_295" bpmnElement="intialization"> - <dc:Bounds height="80.0" width="100.0" x="228.0" y="249.0"/> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_230" bpmnElement="vnfIdProvided" isMarkerVisible="true"> - <dc:Bounds height="50.0" width="50.0" x="372.0" y="263.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="22.0" width="99.0" x="419.0" y="292.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_71" targetElement="_BPMNShape_ScriptTask_295"> - <di:waypoint xsi:type="dc:Point" x="146.0" y="289.0"/> - <di:waypoint xsi:type="dc:Point" x="228.0" y="289.0"/> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_295" targetElement="_BPMNShape_ExclusiveGateway_230"> - <di:waypoint xsi:type="dc:Point" x="328.0" y="289.0"/> - <di:waypoint xsi:type="dc:Point" x="372.0" y="288.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="6.0" width="6.0" x="347.0" y="288.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_296" bpmnElement="getVnfByName"> - <dc:Bounds height="80.0" width="100.0" x="456.0" y="156.0"/> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_231" bpmnElement="ExclusiveGateway_2" isMarkerVisible="true"> - <dc:Bounds height="50.0" width="50.0" x="600.0" y="263.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="0.0" width="0.0" x="625.0" y="318.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="noVnfId" sourceElement="_BPMNShape_ExclusiveGateway_230" targetElement="_BPMNShape_ScriptTask_296"> - <di:waypoint xsi:type="dc:Point" x="397.0" y="263.0"/> - <di:waypoint xsi:type="dc:Point" x="397.0" y="196.0"/> - <di:waypoint xsi:type="dc:Point" x="456.0" y="196.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="22.0" width="22.0" x="399.0" y="219.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="haveVnfId" sourceElement="_BPMNShape_ExclusiveGateway_230" targetElement="_BPMNShape_ScriptTask_297"> - <di:waypoint xsi:type="dc:Point" x="397.0" y="313.0"/> - <di:waypoint xsi:type="dc:Point" x="397.0" y="368.0"/> - <di:waypoint xsi:type="dc:Point" x="456.0" y="368.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="22.0" width="29.0" x="396.0" y="328.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_297" bpmnElement="getGenericVnf"> - <dc:Bounds height="80.0" width="100.0" x="456.0" y="328.0"/> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_298" bpmnElement="toggleSuccess"> - <dc:Bounds height="80.0" width="100.0" x="696.0" y="249.0"/> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_EndEvent_226" bpmnElement="EndEvent_1"> - <dc:Bounds height="36.0" width="36.0" x="888.0" y="271.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="0.0" width="0.0" x="906.0" y="312.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_ExclusiveGateway_231" targetElement="_BPMNShape_ScriptTask_298"> - <di:waypoint xsi:type="dc:Point" x="650.0" y="288.0"/> - <di:waypoint xsi:type="dc:Point" x="696.0" y="289.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="6.0" width="6.0" x="673.0" y="289.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ScriptTask_298" targetElement="_BPMNShape_EndEvent_226"> - <di:waypoint xsi:type="dc:Point" x="796.0" y="289.0"/> - <di:waypoint xsi:type="dc:Point" x="888.0" y="289.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="6.0" width="6.0" x="829.0" y="289.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_11" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_ScriptTask_296" targetElement="_BPMNShape_ExclusiveGateway_231"> - <di:waypoint xsi:type="dc:Point" x="556.0" y="196.0"/> - <di:waypoint xsi:type="dc:Point" x="625.0" y="196.0"/> - <di:waypoint xsi:type="dc:Point" x="625.0" y="263.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="6.0" width="6.0" x="622.0" y="205.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_12" bpmnElement="SequenceFlow_10" sourceElement="_BPMNShape_ScriptTask_297" targetElement="_BPMNShape_ExclusiveGateway_231"> - <di:waypoint xsi:type="dc:Point" x="556.0" y="368.0"/> - <di:waypoint xsi:type="dc:Point" x="625.0" y="368.0"/> - <di:waypoint xsi:type="dc:Point" x="625.0" y="313.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="6.0" width="6.0" x="621.0" y="368.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_SubProcess_30" bpmnElement="bpmnExceptionHandlingSubProcess" isExpanded="true"> - <dc:Bounds height="169.0" width="313.0" x="168.0" y="468.0"/> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_74" bpmnElement="catchMSOWorkflowException"> - <dc:Bounds height="36.0" width="36.0" x="180.0" y="535.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="0.0" width="0.0" x="198.0" y="576.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_302" bpmnElement="proccessBPMNError"> - <dc:Bounds height="80.0" width="100.0" x="275.0" y="513.0"/> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_EndEvent_231" bpmnElement="EndEvent_3"> - <dc:Bounds height="36.0" width="36.0" x="432.0" y="535.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="0.0" width="0.0" x="450.0" y="576.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_13" bpmnElement="SequenceFlow_11" sourceElement="_BPMNShape_StartEvent_74" targetElement="_BPMNShape_ScriptTask_302"> - <di:waypoint xsi:type="dc:Point" x="216.0" y="553.0"/> - <di:waypoint xsi:type="dc:Point" x="275.0" y="553.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="6.0" width="6.0" x="238.0" y="553.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_14" bpmnElement="SequenceFlow_12" sourceElement="_BPMNShape_ScriptTask_302" targetElement="_BPMNShape_EndEvent_231"> - <di:waypoint xsi:type="dc:Point" x="375.0" y="553.0"/> - <di:waypoint xsi:type="dc:Point" x="432.0" y="553.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="6.0" width="6.0" x="402.0" y="553.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - </bpmndi:BPMNPlane> - </bpmndi:BPMNDiagram> -</bpmn2:definitions>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericPutService.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericPutService.bpmn deleted file mode 100644 index 2d18f38c16..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericPutService.bpmn +++ /dev/null @@ -1,201 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_FatVcHn0EeaH6vX1RRdc_w" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> - <bpmn2:process id="GenericPutService" name="GenericPutService" isExecutable="true"> - <bpmn2:startEvent id="StartEvent_1"> - <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> - </bpmn2:startEvent> - <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="Initialization" /> - <bpmn2:endEvent id="EndEvent_1"> - <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming> - <bpmn2:terminateEventDefinition id="TerminateEventDefinition_1" /> - </bpmn2:endEvent> - <bpmn2:scriptTask id="toggleSuccess" name="Toggle Success Indicator" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* - -def serviceInstance= new GenericPutService() -serviceInstance.setSuccessIndicator(execution, true) - -execution.setVariable("WorkflowResponse", " ") //for junits]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="toggleSuccess" targetRef="EndEvent_1" /> - <bpmn2:scriptTask id="putServiceInstance" name="Put Service Instance" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* - -def serviceInstance= new GenericPutService() -serviceInstance.putServiceInstance(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="putServiceInstance" targetRef="toggleSuccess" /> - <bpmn2:scriptTask id="Initialization" name="Initialization" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* - -def serviceInstance= new GenericPutService() -serviceInstance.preProcessRequest(execution) -]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="Initialization" targetRef="putServiceInstance" /> - <bpmn2:subProcess id="bpmnExceptionHandlingSubProcess" name="Error Handling Sub Process" triggeredByEvent="true"> - <bpmn2:startEvent id="StartEvent_2"> - <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing> - <bpmn2:errorEventDefinition id="ErrorEventDefinition_1" /> - </bpmn2:startEvent> - <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="StartEvent_2" targetRef="processError" /> - <bpmn2:endEvent id="EndEvent_2"> - <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming> - </bpmn2:endEvent> - <bpmn2:scriptTask id="processError" name="Process Error" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* - -ExceptionUtil ex = new ExceptionUtil() -ex.processSubflowsBPMNException(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="processError" targetRef="EndEvent_2" /> - </bpmn2:subProcess> - <bpmn2:subProcess id="javaExceptionSubProcess" name="Java Exception Handling Sub Process" triggeredByEvent="true"> - <bpmn2:startEvent id="catchJavaExcep"> - <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing> - <bpmn2:errorEventDefinition id="ErrorEventDefinition_2" errorRef="Error_2" /> - </bpmn2:startEvent> - <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="catchJavaExcep" targetRef="processJavaError" /> - <bpmn2:scriptTask id="processJavaError" name="Process Java Error" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* - -ExceptionUtil ex = new ExceptionUtil() -ex.processJavaException(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:endEvent id="EndEvent_3"> - <bpmn2:incoming>SequenceFlow_10</bpmn2:incoming> - <bpmn2:terminateEventDefinition id="TerminateEventDefinition_2" /> - </bpmn2:endEvent> - <bpmn2:sequenceFlow id="SequenceFlow_10" name="" sourceRef="processJavaError" targetRef="EndEvent_3" /> - </bpmn2:subProcess> - </bpmn2:process> - <bpmn2:error id="Error_1" name="MSO Workflow Exception" errorCode="MSOWorkflowException" /> - <bpmn2:error id="Error_2" name="Java Lang Exception" errorCode="java.lang.Exception" /> - <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GenericPutService"> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_71" bpmnElement="StartEvent_1"> - <dc:Bounds x="182" y="180" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="200" y="221" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_302" bpmnElement="Initialization"> - <dc:Bounds x="324" y="158" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_71" targetElement="_BPMNShape_ScriptTask_302"> - <di:waypoint xsi:type="dc:Point" x="218" y="198" /> - <di:waypoint xsi:type="dc:Point" x="324" y="198" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="250" y="198" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_304" bpmnElement="putServiceInstance"> - <dc:Bounds x="528" y="158" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_302" targetElement="_BPMNShape_ScriptTask_304"> - <di:waypoint xsi:type="dc:Point" x="424" y="198" /> - <di:waypoint xsi:type="dc:Point" x="528" y="198" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="446" y="198" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_305" bpmnElement="toggleSuccess"> - <dc:Bounds x="732" y="158" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_ScriptTask_304" targetElement="_BPMNShape_ScriptTask_305"> - <di:waypoint xsi:type="dc:Point" x="628" y="198" /> - <di:waypoint xsi:type="dc:Point" x="732" y="198" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="650" y="198" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_EndEvent_230" bpmnElement="EndEvent_1"> - <dc:Bounds x="908" y="180" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="926" y="221" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ScriptTask_305" targetElement="_BPMNShape_EndEvent_230"> - <di:waypoint xsi:type="dc:Point" x="832" y="198" /> - <di:waypoint xsi:type="dc:Point" x="908" y="198" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="854" y="198" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_SubProcess_27" bpmnElement="bpmnExceptionHandlingSubProcess" isExpanded="true"> - <dc:Bounds x="324" y="312" width="418" height="150" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_72" bpmnElement="StartEvent_2"> - <dc:Bounds x="357" y="370" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="375" y="411" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_306" bpmnElement="processError"> - <dc:Bounds x="466" y="348" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_StartEvent_72" targetElement="_BPMNShape_ScriptTask_306"> - <di:waypoint xsi:type="dc:Point" x="393" y="388" /> - <di:waypoint xsi:type="dc:Point" x="466" y="388" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="415" y="388" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_EndEvent_231" bpmnElement="EndEvent_2"> - <dc:Bounds x="615" y="370" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="633" y="411" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_ScriptTask_306" targetElement="_BPMNShape_EndEvent_231"> - <di:waypoint xsi:type="dc:Point" x="566" y="388" /> - <di:waypoint xsi:type="dc:Point" x="615" y="388" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="588" y="388" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_SubProcess_28" bpmnElement="javaExceptionSubProcess" isExpanded="true"> - <dc:Bounds x="323" y="486" width="419" height="150" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_73" bpmnElement="catchJavaExcep"> - <dc:Bounds x="357" y="538" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="375" y="579" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_308" bpmnElement="processJavaError"> - <dc:Bounds x="465" y="516" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_StartEvent_73" targetElement="_BPMNShape_ScriptTask_308"> - <di:waypoint xsi:type="dc:Point" x="393" y="556" /> - <di:waypoint xsi:type="dc:Point" x="465" y="556" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="415" y="556" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_EndEvent_232" bpmnElement="EndEvent_3"> - <dc:Bounds x="615" y="538" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="633" y="579" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_10" sourceElement="_BPMNShape_ScriptTask_308" targetElement="_BPMNShape_EndEvent_232"> - <di:waypoint xsi:type="dc:Point" x="565" y="556" /> - <di:waypoint xsi:type="dc:Point" x="615" y="556" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="587" y="556" width="6" height="6" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - </bpmndi:BPMNPlane> - </bpmndi:BPMNDiagram> -</bpmn2:definitions> diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AaiUtilTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AaiUtilTest.groovy index 79caf5b9ac..05b1c5e6ed 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AaiUtilTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AaiUtilTest.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -47,11 +47,11 @@ import org.camunda.bpm.engine.repository.ProcessDefinition @RunWith(MockitoJUnitRunner.class) @Ignore class AaiUtilTest extends MsoGroovyTest { - + @Rule public WireMockRule wireMockRule = new WireMockRule(8090); - + @Rule public ExpectedException thrown = ExpectedException.none @@ -128,275 +128,6 @@ class AaiUtilTest extends MsoGroovyTest { } @Test - public void testGetUriDefaultVersion() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("mso.workflow.default.aai.v8.l3-network.uri")).thenReturn('/aai/v8/network/l3-networks/l3-network') - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getUri(mockExecution, 'l3-network') - assertEquals('/aai/v8/network/l3-networks/l3-network', uri) - } - - @Test - public void testGetUriFlowAndResourceSpecific() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("mso.workflow.CreateAAIVfModule.aai.l3-network.uri")).thenReturn('/aai/v6/network/l3-networks/l3-network') - - when(mockExecution.getVariable("mso.workflow.default.aai.v8.l3-network.uri")).thenReturn('/aai/v8/network/l3-networks/l3-network') - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getUri(mockExecution, 'l3-network') - assertEquals('/aai/v6/network/l3-networks/l3-network', uri) - } - - @Test - public void testGetNetworkGenericVnfEndpoint() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') - - when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn('/aai/v8/network/generic-vnfs/generic-vnf') - - when(mockExecution.getVariable('aai.endpoint')).thenReturn('http://localhost:28090') - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - when(mockExecution.getVariable("mso.workflow.default.aai.generic-vnf.version")).thenReturn('8') - - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def endpoint = aaiUtil.getNetworkGenericVnfEndpoint(mockExecution) - assertEquals('http://localhost:28090/aai/v8/network/generic-vnfs/generic-vnf', endpoint) - } - - @Test - public void testGetNetworkGenericVnfUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') - - when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn('/aai/v8/network/generic-vnfs/generic-vnf') - - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - when(mockExecution.getVariable("mso.workflow.default.aai.generic-vnf.version")).thenReturn('8') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getNetworkGenericVnfUri(mockExecution) - assertEquals('/aai/v8/network/generic-vnfs/generic-vnf', uri) - } - - @Test - public void testGetNetworkVpnBindingUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') - when(mockExecution.getVariable("mso.workflow.default.aai.v8.vpn-binding.uri")).thenReturn('/aai/v8/network/vpn-bindings/vpn-binding') - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getNetworkVpnBindingUri(mockExecution) - assertEquals('/aai/v8/network/vpn-bindings/vpn-binding', uri) - } - - @Test - public void testGetNetworkPolicyUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') - when(mockExecution.getVariable("mso.workflow.default.aai.v8.network-policy.uri")).thenReturn('/aai/v8/network/network-policies/network-policy') - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getNetworkPolicyUri(mockExecution) - assertEquals('/aai/v8/network/network-policies/network-policy', uri) - } - - @Test - public void testGetNetworkTableReferencesUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') - when(mockExecution.getVariable("mso.workflow.default.aai.v8.route-table-reference.uri")).thenReturn('/aai/v8/network/route-table-references/route-table-reference') - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getNetworkTableReferencesUri(mockExecution) - assertEquals('/aai/v8/network/route-table-references/route-table-reference', uri) - } - - @Test - public void testGetNetworkVceUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') - when(mockExecution.getVariable("mso.workflow.default.aai.v8.vce.uri")).thenReturn('/aai/v8/network/vces/vce') - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getNetworkVceUri(mockExecution) - assertEquals('/aai/v8/network/vces/vce', uri) - } - - @Test - public void testGetNetworkL3NetworkUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') - when(mockExecution.getVariable("mso.workflow.default.aai.v8.l3-network.uri")).thenReturn('/aai/v8/network/l3-networks/l3-network') - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getNetworkL3NetworkUri(mockExecution) - assertEquals('/aai/v8/network/l3-networks/l3-network', uri) - } - - @Test - public void testGetBusinessCustomerUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') - when(mockExecution.getVariable("mso.workflow.default.aai.v8.customer.uri")).thenReturn('/aai/v8/business/customers/customer') - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getBusinessCustomerUri(mockExecution) - assertEquals('/aai/v8/business/customers/customer', uri) - } - - @Test - public void testGetCloudInfrastructureCloudRegionEndpoint() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') - - when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn('/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic') - - when(mockExecution.getVariable('aai.endpoint')).thenReturn('http://localhost:28090') - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(mockExecution) - assertEquals('http://localhost:28090/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic', uri) - } - - @Test - public void testGetCloudInfrastructureCloudRegionUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') - - when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn('/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic') - - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getCloudInfrastructureCloudRegionUri(mockExecution) - assertEquals('/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic', uri) - } - - @Test - public void testGetCloudInfrastructureTenantUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') - when(mockExecution.getVariable("mso.workflow.default.aai.v8.tenant.uri")).thenReturn('/aai/v8/cloud-infrastructure/tenants/tenant') - - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getCloudInfrastructureTenantUri(mockExecution) - assertEquals('/aai/v8/cloud-infrastructure/tenants/tenant', uri) - } - - @Test - public void testGetSearchNodesQueryUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') - - when(mockExecution.getVariable("mso.workflow.default.aai.v8.nodes-query.uri")).thenReturn('/aai/v8/search/nodes-query') - - when(mockExecution.getVariable('aai.endpoint')).thenReturn('http://localhost:28090') - - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getSearchNodesQueryUri(mockExecution) - assertEquals('/aai/v8/search/nodes-query', uri) - } - - @Test - public void testGetSearchNodesQueryEndpoint() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') - - when(mockExecution.getVariable("mso.workflow.default.aai.v8.nodes-query.uri")).thenReturn('/aai/v8/search/nodes-query') - - when(mockExecution.getVariable('aai.endpoint')).thenReturn('http://localhost:28090') - - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getSearchNodesQueryEndpoint(mockExecution) - assertEquals('http://localhost:28090/aai/v8/search/nodes-query', uri) - } - - @Test - public void testGetSearchGenericQueryUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') - - when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-query.uri")).thenReturn('/aai/v8/search/generic-query') - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - - - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getSearchGenericQueryUri(mockExecution) - assertEquals('/aai/v8/search/generic-query', uri) - } - - @Test - public void testGetNamespaceFromUri() { - ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('6') - when(mockExecution.getVariable("mso.workflow.default.aai.v6.l3-network.uri")).thenReturn('/aai/v6/network/l3-networks/l3-network') - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getNetworkL3NetworkUri(mockExecution) // Required to populate the namespace in the class - def ns = aaiUtil.getNamespaceFromUri('/aai/v6/search/generic-query') - assertEquals('http://org.openecomp.aai.inventory/v6', ns) - } - - @Test public void testExecuteAAIGetCall() { ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') @@ -420,40 +151,6 @@ class AaiUtilTest extends MsoGroovyTest { } @Test - public void testGetNamespaceFromUri2() { - ExecutionEntity mockExecution = setupMock('DeleteVfModuleVolumeInfraV1') - // - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('10') - when(mockExecution.getVariable("mso.workflow.default.aai.v10.l3-network.uri")).thenReturn('/aai/v10/network/l3-networks/l3-network') - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - // - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getNetworkL3NetworkUri(mockExecution) // Required to populate the namespace in the class - def ns = aaiUtil.getNamespaceFromUri('/aai/v10/search/generic-query') - assertEquals('http://org.openecomp.aai.inventory/v10', ns) - } - - @Test - public void testGetNamespaceFromUri3() { - ExecutionEntity mockExecution = setupMock('DeleteVfModuleVolumeInfraV1') - // - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('100') - when(mockExecution.getVariable("mso.workflow.default.aai.v100.l3-network.uri")).thenReturn('/aai/v100/network/l3-networks/l3-network') - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - // - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - CreateAAIVfModule myproc = new CreateAAIVfModule() - AaiUtil aaiUtil = new AaiUtil(myproc) - def uri = aaiUtil.getNetworkL3NetworkUri(mockExecution) // Required to populate the namespace in the class - def ns = aaiUtil.getNamespaceFromUri('/aai/v100/search/generic-query') - assertEquals('http://org.openecomp.aai.inventory/v100', ns) - } - - @Test public void testGetNamespaceFromUri_twoArguments() { // (execution, uri) ExecutionEntity mockExecution = setupMock('DeleteVfModuleVolumeInfraV1') // diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy index e065ccd14f..a96127aa2d 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupNameTest.groovy @@ -20,151 +20,64 @@ package org.onap.so.bpmn.common.scripts -import com.github.tomakehurst.wiremock.junit.WireMockRule - import static org.mockito.Mockito.* -import org.camunda.bpm.engine.ProcessEngineServices -import org.camunda.bpm.engine.RepositoryService + +import javax.ws.rs.core.UriBuilder + +import org.camunda.bpm.engine.delegate.DelegateExecution import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.camunda.bpm.engine.repository.ProcessDefinition +import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake import org.junit.Assert -import org.junit.Rule +import org.junit.Before import org.junit.Test -import org.junit.runner.RunWith import org.mockito.ArgumentCaptor import org.mockito.Captor import org.mockito.Mockito -import org.mockito.runners.MockitoJUnitRunner -import org.onap.so.bpmn.core.WorkflowException - -import static com.github.tomakehurst.wiremock.client.WireMock.* +import org.mockito.MockitoAnnotations +import org.mockito.Spy +import org.onap.aai.domain.yang.VolumeGroup +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory -@RunWith(MockitoJUnitRunner.class) class ConfirmVolumeGroupNameTest extends MsoGroovyTest { + + @Spy + private ConfirmVolumeGroupName confirmVolumeGroupName; - private static final def AAA_URI = "uri_test" - private static final def AIC_CLOUD_REGION = "AicClReg_test" - private static final def VOLUME_GROUP_NAME = "volumeTestGName" - private static final def VOLUME_GROUP_ID = "vol_gr_id_test" - - @Captor - ArgumentCaptor<ExecutionEntity> captor= ArgumentCaptor.forClass(ExecutionEntity.class); - - @Rule - public WireMockRule wireMockRule = new WireMockRule(8090); - - @Test - void preProcessRequestSuccessful() { - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("ConfirmVolumeGroupName_volumeGroupId")).thenReturn(VOLUME_GROUP_ID) - when(mockExecution.getVariable("ConfirmVolumeGroupName_volumeGroupName")).thenReturn(VOLUME_GROUP_NAME) - when(mockExecution.getVariable("ConfirmVolumeGroupName_aicCloudRegion")).thenReturn(AIC_CLOUD_REGION) + @Before + public void init() throws IOException { + super.init("ConfirmVolumeGroupName") + MockitoAnnotations.initMocks(this); + when(confirmVolumeGroupName.getAAIClient()).thenReturn(client) - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('namespace_test') - when(mockExecution.getVariable("mso.workflow.ConfirmVolumeGroupName.aai.cloud-region.uri")).thenReturn(AAA_URI) - new ConfirmVolumeGroupName().preProcessRequest(mockExecution) - - verifyInitProcessVariables(mockExecution) - verify(mockExecution).setVariable("CVGN_volumeGroupId", VOLUME_GROUP_ID) - verify(mockExecution).setVariable("CVGN_volumeGroupName", "volumeTestGName") - verify(mockExecution).setVariable("CVGN_aicCloudRegion", AIC_CLOUD_REGION) - verify(mockExecution).setVariable("CVGN_volumeGroupGetEndpoint", - "${AAA_URI}/${AIC_CLOUD_REGION}/volume-groups/volume-group/" + VOLUME_GROUP_ID) - } - - private void verifyInitProcessVariables(ExecutionEntity mockExecution) { - verify(mockExecution).setVariable("prefix", "CVGN_") - verify(mockExecution).setVariable("CVGN_volumeGroupId", null) - verify(mockExecution).setVariable("CVGN_volumeGroupName", null) - verify(mockExecution).setVariable("CVGN_aicCloudRegion", null) - verify(mockExecution).setVariable("CVGN_volumeGroupGetEndpoint", null) - verify(mockExecution).setVariable("CVGN_volumeGroupNameMatches", false) - verify(mockExecution).setVariable("CVGN_queryVolumeGroupResponseCode", null) - verify(mockExecution).setVariable("CVGN_queryVolumeGroupResponse", "") - verify(mockExecution).setVariable("CVGN_ResponseCode", null) - verify(mockExecution).setVariable("RollbackData", null) - } - - @Test - void checkAAIQueryResult_volumeGroupNamesMatch() { - ExecutionEntity mockExecution = setupMock() - commonPartOfCheckAAIQueryTest(mockExecution, VOLUME_GROUP_NAME) - verify(mockExecution).setVariable("CVGN_volumeGroupNameMatches", true) - } - - @Test - void checkAAIQueryResult_volumeGroupNamesDoNotMatch() { - ExecutionEntity mockExecution = setupMock() - commonPartOfCheckAAIQueryTest(mockExecution, "grName2") - verify(mockExecution, Mockito.times(0)).setVariable("CVGN_volumeGroupNameMatches", true) - } - - private void commonPartOfCheckAAIQueryTest(ExecutionEntity mockExecution, def volumeGroupName) { - when(mockExecution.getVariable("CVGN_volumeGroupName")).thenReturn(VOLUME_GROUP_NAME) - def xml = "<volume-group-name>" + volumeGroupName + "</volume-group-name>" - when(mockExecution.getVariable("CVGN_queryVolumeGroupResponse")).thenReturn(xml) - new ConfirmVolumeGroupName().checkAAIQueryResult(mockExecution) - verify(mockExecution).setVariable("CVGN_volumeGroupNameMatches", false) } @Test public void testQueryAAIForVolumeGroupId() { - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("aai.endpoint")).thenReturn('http://localhost:8090') - when(mockExecution.getVariable("CVGN_volumeGroupGetEndpoint")).thenReturn('/aai/test/volume-groups/volume-group/testVolumeGroup') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - mockData() - - ConfirmVolumeGroupName confirmVolumeGroupName = new ConfirmVolumeGroupName() + AAIResourceUri resourceUri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.VOLUME_GROUP, UriBuilder.fromPath('/aai/test/volume-groups/volume-group/testVolumeGroup').build()); + when(mockExecution.getVariable("CVGN_volumeGroupGetEndpoint")).thenReturn(resourceUri) + VolumeGroup volumeGroup = new VolumeGroup() + volumeGroup.setVolumeGroupId("Test") + when(client.get(VolumeGroup.class,resourceUri)).thenReturn(Optional.of(volumeGroup)) confirmVolumeGroupName.queryAAIForVolumeGroupId(mockExecution) - verify(mockExecution).setVariable("CVGN_queryVolumeGroupResponseCode",200) - verify(mockExecution).setVariable("CVGN_queryVolumeGroupResponse","") + Mockito.verify(mockExecution).setVariable("CVGN_queryVolumeGroupResponseCode",200) + Mockito.verify(mockExecution).setVariable("CVGN_queryVolumeGroupResponse",volumeGroup) } @Test public void testQueryAAIForVolumeGroupId_404() { - - ExecutionEntity mockExecution = setupMock() + AAIResourceUri resourceUri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.VOLUME_GROUP, UriBuilder.fromPath('/aai/test/volume-groups/volume-group/testVolumeGroup').build()); + when(client.get(VolumeGroup.class, resourceUri)).thenReturn(Optional.empty()) + DelegateExecution execution = new DelegateExecutionFake() try { - when(mockExecution.getVariable("CVGN_volumeGroupGetEndpoint")).thenReturn('/aai/test/volume-groups/volume-group/testVolumeGroup') - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') - - mockData() - - ConfirmVolumeGroupName confirmVolumeGroupName = new ConfirmVolumeGroupName() - confirmVolumeGroupName.queryAAIForVolumeGroupId(mockExecution) - } - catch(Exception ex){ - + execution.setVariable("CVGN_volumeGroupGetEndpoint", resourceUri) + confirmVolumeGroupName.queryAAIForVolumeGroupId(execution) } - Mockito.verify(mockExecution,times(4)).setVariable(captor.capture(),captor.capture()) - WorkflowException workflowException = captor.getValue() - Assert.assertEquals("AAI GET Failed",workflowException.getErrorMessage()) - Assert.assertEquals(500,workflowException.getErrorCode()) - } - private void mockData() { - stubFor(get(urlMatching("/aai/test/volume-groups/volume-group/testVolumeGroup")) - .willReturn(aResponse() - .withStatus(200))) - } - - private ExecutionEntity setupMock() { - - ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) - when(mockProcessDefinition.getKey()).thenReturn("ConfirmVolumeGroupName") - RepositoryService mockRepositoryService = mock(RepositoryService.class) - when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) - when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("ConfirmVolumeGroupName") - when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") - ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) - when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getId()).thenReturn("100") - when(mockExecution.getProcessDefinitionId()).thenReturn("ConfirmVolumeGroupName") - when(mockExecution.getProcessInstanceId()).thenReturn("ConfirmVolumeGroupName") - when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) - when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) - return mockExecution + catch(Exception ex){} + Assert.assertEquals(404, execution.getVariable("CVGN_queryVolumeGroupResponseCode")) + Assert.assertEquals("Volume Group not Found!", execution.getVariable("CVGN_queryVolumeGroupResponse")) + } } diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CustomE2EPutServiceTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CustomE2EPutServiceTest.groovy deleted file mode 100644 index 879ef7ab4f..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CustomE2EPutServiceTest.groovy +++ /dev/null @@ -1,72 +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.common.scripts - -import com.github.tomakehurst.wiremock.junit.WireMockRule -import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.junit.Assert -import org.junit.Before -import org.junit.Ignore -import org.junit.Rule -import org.junit.Test -import org.junit.runner.RunWith -import org.mockito.ArgumentCaptor -import org.mockito.Captor -import org.mockito.Mockito -import org.mockito.runners.MockitoJUnitRunner - -import static org.mockito.Mockito.times -import static org.mockito.Mockito.when -import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutServiceInstance - -/** - * @author sushilma - * @since January 10, 2018 - */ -@RunWith(MockitoJUnitRunner.class) -@Ignore -class CustomE2EPutServiceTest extends MsoGroovyTest { - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090) - - @Captor - static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) - - @Test - public void testPutServiceInstance(){ - ExecutionEntity mockExecution = setupMockWithPrefix('CustomE2EPutService','GENPS_') - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') - when(mockExecution.getVariable("mso.workflow.default.aai.v8.customer.uri")).thenReturn('/aai/v8/business/customers/customer') - when(mockExecution.getVariable("GENPS_type")).thenReturn('service-instance') - when(mockExecution.getVariable("GENPS_payload")).thenReturn('') - when(mockExecution.getVariable("GENPS_globalSubscriberId")).thenReturn("1604-MVM-26") - when(mockExecution.getVariable("GENPS_serviceType")).thenReturn("SDN-ETHERNET-INTERNET") - when(mockExecution.getVariable("GENPS_serviceInstanceId")).thenReturn( "1234") - MockPutServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234", "GenericFlows/getServiceInstance.xml"); - - CustomE2EPutService customE2EPutService = new CustomE2EPutService() - customE2EPutService.putServiceInstance(mockExecution); - Mockito.verify(mockExecution, times(6)).setVariable(captor.capture(), captor.capture()) - Assert.assertEquals(200, captor.getAllValues().get(7)) - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleNameTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleNameTest.groovy index c5baf8cc6c..3a408b3310 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleNameTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleNameTest.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -59,7 +59,7 @@ class GenerateVfModuleNameTest { when(mockExecution.getVariable("personaModelId")).thenReturn('personaModelId_test') when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') - when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn('/aai/v8/network/generic-vnfs/generic-vnf') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') when(mockExecution.getVariable("mso.workflow.default.aai.generic-vnf.version")).thenReturn('8') @@ -78,7 +78,7 @@ class GenerateVfModuleNameTest { when(mockExecution.getVariable("personaModelId")).thenReturn('personaModelId_test') when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn('8') - when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn('/aai/v8/network/generic-vnfs/generic-vnf') + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') when(mockExecution.getVariable("mso.workflow.default.aai.generic-vnf.version")).thenReturn('8') diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy index 01e37f0cd7..3a2673c9ee 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy @@ -26,9 +26,40 @@ import org.camunda.bpm.engine.ProcessEngineServices import org.camunda.bpm.engine.RepositoryService import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Rule +import org.junit.rules.ExpectedException +import org.junit.runner.RunWith +import org.mockito.runners.MockitoJUnitRunner +import org.onap.aai.domain.yang.GenericVnf +import org.onap.so.bpmn.mock.FileUtil +import org.onap.so.client.aai.AAIObjectPlurals +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.client.graphinventory.entities.uri.Depth +import org.onap.so.constants.Defaults +@RunWith(MockitoJUnitRunner.class) abstract class MsoGroovyTest { + @Rule + public ExpectedException thrown = ExpectedException.none() + + protected ExecutionEntity mockExecution + protected AAIResourcesClient client + protected AllottedResourceUtils allottedResourceUtils_MOCK + protected final String SEARCH_RESULT_AAI_WITH_RESULTDATA = + FileUtil.readResourceFile("__files/aai/searchResults.json") + protected static final String CLOUD_OWNER = Defaults.CLOUD_OWNER.toString(); + + protected void init(String procName){ + mockExecution = setupMock(procName) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + client = mock(AAIResourcesClient.class) + } + protected ExecutionEntity setupMock(String procName) { ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) when(mockProcessDefinition.getKey()).thenReturn(procName) @@ -64,5 +95,59 @@ abstract class MsoGroovyTest { return mockExecution } + protected <T> Optional<T> getAAIObjectFromJson(Class<T> clazz , String file){ + String json = FileUtil.readResourceFile(file) + AAIResultWrapper resultWrapper = new AAIResultWrapper(json) + return resultWrapper.asBean(clazz) + } + + protected Optional<GenericVnf> mockAAIGenericVnf(String vnfId){ + return mockAAIGenericVnf(vnfId,"__files/aai/GenericVnf.json") + } + protected Optional<GenericVnf> mockAAIGenericVnf(String vnfId,String file){ + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + AAIResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE) + Optional<GenericVnf> genericVnf = getAAIObjectFromJson(GenericVnf.class,file); + when(client.get(GenericVnf.class, resourceUri)).thenReturn(genericVnf) + when(client.get(GenericVnf.class, resourceUriDepthOne)).thenReturn(genericVnf) + return genericVnf + } + + protected Optional<GenericVnf> mockAAIGenericVnfByName(String vnfName){ + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName) + AAIResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName).depth(Depth.ONE) + Optional<GenericVnf> genericVnf = getAAIObjectFromJson(GenericVnf.class,"__files/aai/GenericVnf.json"); + when(client.get(GenericVnf.class, resourceUri)).thenReturn(genericVnf) + when(client.get(GenericVnf.class, resourceUriDepthOne)).thenReturn(genericVnf) + return genericVnf + } + + protected void mockAAIGenericVnfNotFound(String vnfId){ + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE) + AAIResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE) + when(client.get(GenericVnf.class, resourceUri)).thenReturn(Optional.empty()) + when(client.get(GenericVnf.class, resourceUriDepthOne)).thenReturn(Optional.empty()) + } + + protected void mockAAIGenericVnfByNameNotFound(String vnfName){ + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName) + AAIResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName).depth(Depth.ONE) + when(client.get(GenericVnf.class, resourceUri)).thenReturn(Optional.empty()) + when(client.get(GenericVnf.class, resourceUriDepthOne)).thenReturn(Optional.empty()) + } + + protected AAIResultWrapper mockVolumeGroupWrapper(String region, String volumeGroupId, String file){ + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,CLOUD_OWNER, region,volumeGroupId) + String json = FileUtil.readResourceFile(file) + AAIResultWrapper resultWrapper = new AAIResultWrapper(json) + when(client.get(resourceUri)).thenReturn(resultWrapper) + return resultWrapper + } + + void initAR(String procName){ + init(procName) + allottedResourceUtils_MOCK = spy(new AllottedResourceUtils(mock(AbstractServiceTaskProcessor.class))) + when(allottedResourceUtils_MOCK.getAAIClient()).thenReturn(client) + } } 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 c5b8fab9eb..21441b9b73 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 @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -57,7 +57,6 @@ class PrepareUpdateAAIVfModuleTest { ExecutionEntity mockExecution = setupMock() when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable("PUAAIVfMod_vnfId")).thenReturn("skask") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") when(mockExecution.getVariable("mso.workflow.custom.PrepareUpdateAAIVfModule.aai.version")).thenReturn('8') @@ -75,7 +74,7 @@ class PrepareUpdateAAIVfModuleTest { ExecutionEntity mockExecution = setupMock() when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable("PUAAIVfMod_vnfId")).thenReturn("skask") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") when(mockExecution.getVariable("mso.workflow.custom.PrepareUpdateAAIVfModule.aai.version")).thenReturn('8') @@ -105,7 +104,7 @@ class PrepareUpdateAAIVfModuleTest { when(mockExecution.getVariable("PUAAIVfMod_vfModule")).thenReturn(vfModule) when(mockExecution.getVariable("PUAAIVfMod_orchestrationStatus")).thenReturn("created") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") when(mockExecution.getVariable("mso.workflow.custom.PrepareUpdateAAIVfModule.aai.version")).thenReturn('8') @@ -131,7 +130,7 @@ class PrepareUpdateAAIVfModuleTest { when(mockExecution.getVariable("PUAAIVfMod_vfModule")).thenReturn(vfModule) when(mockExecution.getVariable("PUAAIVfMod_orchestrationStatus")).thenReturn("created") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") when(mockExecution.getVariable("mso.workflow.custom.PrepareUpdateAAIVfModule.aai.version")).thenReturn('8') 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 e0166f3602..5641c5e12f 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 @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -65,7 +65,7 @@ class UpdateAAIGenericVnfTest { ExecutionEntity mockExecution = setupMock() when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable("UAAIGenVnf_vnfId")).thenReturn("skask") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") when(mockExecution.getVariable("mso.workflow.custom.UpdateAAIGenericVnf.aai.version")).thenReturn('8') @@ -82,7 +82,7 @@ class UpdateAAIGenericVnfTest { ExecutionEntity mockExecution = setupMock() when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable("UAAIGenVnf_vnfId")).thenReturn("skask") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") when(mockExecution.getVariable("mso.workflow.custom.UpdateAAIGenericVnf.aai.version")).thenReturn('8') @@ -107,7 +107,7 @@ class UpdateAAIGenericVnfTest { when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable("UAAIGenVnf_vnfId")).thenReturn("skask") when(mockExecution.getVariable("UAAIGenVnf_getGenericVnfResponse")).thenReturn(getVfModuleResponse) - when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") when(mockExecution.getVariable("mso.workflow.custom.UpdateAAIGenericVnf.aai.version")).thenReturn('8') @@ -128,7 +128,7 @@ class UpdateAAIGenericVnfTest { when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable("UAAIGenVnf_vnfId")).thenReturn("skask") when(mockExecution.getVariable("UAAIGenVnf_getGenericVnfResponse")).thenReturn(getVfModuleResponse) - when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") when(mockExecution.getVariable("mso.workflow.custom.UpdateAAIGenericVnf.aai.version")).thenReturn('8') diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy index d2f9095e2d..407ffa2915 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -65,7 +65,7 @@ class UpdateAAIVfModuleTest { when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable(prefix + "vnfId")).thenReturn("skask") when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("supercool") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") when(mockExecution.getVariable("mso.workflow.custom.UpdateAAIVfModule.aai.version")).thenReturn('8') @@ -84,7 +84,7 @@ class UpdateAAIVfModuleTest { when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable(prefix + "vnfId")).thenReturn("skask") when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("supercool") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") when(mockExecution.getVariable("mso.workflow.custom.UpdateAAIVfModule.aai.version")).thenReturn('8') @@ -110,7 +110,7 @@ class UpdateAAIVfModuleTest { when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable(prefix + "vnfId")).thenReturn("skask") when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("supercool") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") when(mockExecution.getVariable("mso.workflow.custom.UpdateAAIVfModule.aai.version")).thenReturn('8') @@ -131,7 +131,7 @@ class UpdateAAIVfModuleTest { when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable(prefix + "vnfId")).thenReturn("skask") when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("supercool") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.generic-vnf.uri")).thenReturn("/aai/v8/network/generic-vnfs/generic-vnf") + when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") when(mockExecution.getVariable("mso.workflow.custom.UpdateAAIVfModule.aai.version")).thenReturn('8') diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java index 3b41ff8337..38be9f3790 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java @@ -984,31 +984,6 @@ public class StubResponseAAI { .willReturn(aResponse() .withStatus(404))); } - @Deprecated - public static void MockGENPSIPutServiceInstance(){ - stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml"))); - } - - @Deprecated - public static void MockGENPSIPutServiceSubscription(){ - stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml"))); - } - @Deprecated - public static void MockGENPSIPutServiceInstance_get500(){ - stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET")) - .willReturn(aResponse() - .withStatus(500) - .withHeader("Content-Type", "text/xml") - .withBodyFile("GenericPutServiceInstance/aaiFault.xml"))); - } @Deprecated public static void MockGetGenericVnfById(){ diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java index 33e1390b9c..e5138b394c 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java @@ -561,7 +561,7 @@ public class BBInputSetupMapperLayerTest { @Test public void testMapLocationContext() { CloudRegion expected = new CloudRegion(); - expected.setCloudOwner("att-aic"); + expected.setCloudOwner("test-owner-name"); expected.setLcpCloudRegionId("cloudRegionId"); expected.setComplex("complexName"); expected.setTenantId("tenantId"); @@ -570,11 +570,11 @@ public class BBInputSetupMapperLayerTest { cloudConfig.setLcpCloudRegionId("cloudRegionId"); cloudConfig.setAicNodeClli("aicNodeClli"); org.onap.aai.domain.yang.CloudRegion cloudRegion = new org.onap.aai.domain.yang.CloudRegion(); - cloudRegion.setCloudOwner("att-aic"); + cloudRegion.setCloudOwner("test-owner-name"); cloudRegion.setCloudRegionId("cloudRegionId"); cloudRegion.setComplexName("complexName"); - CloudRegion actual = bbInputSetupMapperLayer.mapCloudRegion(cloudConfig, cloudRegion, "att-aic"); + CloudRegion actual = bbInputSetupMapperLayer.mapCloudRegion(cloudConfig, cloudRegion); assertThat(actual, sameBeanAs(expected)); } @@ -582,7 +582,7 @@ public class BBInputSetupMapperLayerTest { @Test public void testMapCloudRegion() { CloudRegion expected = new CloudRegion(); - expected.setCloudOwner("att-aic"); + expected.setCloudOwner("test-owner-name"); expected.setLcpCloudRegionId("cloudRegionId"); expected.setTenantId("tenantId"); expected.setCloudRegionVersion("cloudRegionVersion"); @@ -593,11 +593,11 @@ public class BBInputSetupMapperLayerTest { cloudConfig.setAicNodeClli("aicNodeClli"); org.onap.aai.domain.yang.CloudRegion cloudRegion = new org.onap.aai.domain.yang.CloudRegion(); - cloudRegion.setCloudOwner("att-aic"); + cloudRegion.setCloudOwner("test-owner-name"); cloudRegion.setCloudRegionId("cloudRegionId"); cloudRegion.setCloudRegionVersion("cloudRegionVersion"); - CloudRegion actual = bbInputSetupMapperLayer.mapCloudRegion(cloudConfig, cloudRegion, "att-aic"); + CloudRegion actual = bbInputSetupMapperLayer.mapCloudRegion(cloudConfig, cloudRegion); assertThat(actual, sameBeanAs(expected)); } @@ -606,7 +606,7 @@ public class BBInputSetupMapperLayerTest { public void testMapCloudRegionWithNullCheck() { CloudRegion expected = new CloudRegion(); - CloudRegion actual = bbInputSetupMapperLayer.mapCloudRegion(null, null, null); + CloudRegion actual = bbInputSetupMapperLayer.mapCloudRegion(null, null); assertThat(actual, sameBeanAs(expected)); } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java index d0ecedf878..eed4b1411f 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java @@ -84,6 +84,7 @@ import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.entities.AAIResultWrapper; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.so.constants.Defaults; import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResource; import org.onap.so.db.catalog.beans.CollectionResourceCustomization; @@ -317,6 +318,9 @@ public class BBInputSetupTest { RequestInfo requestInfo = new RequestInfo(); requestInfo.setSuppressRollback(true); requestDetails.setRequestInfo(requestInfo); + CloudConfiguration cloudConfiguration = new CloudConfiguration(); + cloudConfiguration.setLcpCloudRegionId("myRegionId"); + requestDetails.setCloudConfiguration(cloudConfiguration); doReturn(requestDetails).when(SPY_bbInputSetupUtils).getRequestDetails(executeBB.getRequestId()); Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); String resourceId = "123"; @@ -351,7 +355,7 @@ public class BBInputSetupTest { lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "instanceId"); doReturn(service).when(SPY_bbInputSetupUtils).getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId()); doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById("instanceId"); - doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration(), "att-aic"); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration()); doNothing().when(SPY_bbInputSetup).populateObjectsOnAssignAndCreateFlows(requestDetails, service, "bbName", serviceInstance, lookupKeyMap, resourceId, vnfType); @@ -404,7 +408,7 @@ public class BBInputSetupTest { lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "instanceId"); doReturn(service).when(SPY_bbInputSetupUtils).getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId()); doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById("instanceId"); - doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration(), "att-aic"); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration()); doNothing().when(SPY_bbInputSetup).populateObjectsOnAssignAndCreateFlows(requestDetails, service, "bbName", serviceInstance, lookupKeyMap, resourceId, vnfType); @@ -448,7 +452,7 @@ public class BBInputSetupTest { doReturn(service).when(SPY_bbInputSetupUtils) .getCatalogServiceByModelUUID(requestDetails.getModelInfo().getModelVersionId()); - doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration(), "att-aic"); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration()); doReturn(project).when(bbInputSetupMapperLayer).mapRequestProject(requestDetails.getProject()); doReturn(owningEntity).when(bbInputSetupMapperLayer) .mapRequestOwningEntity(requestDetails.getOwningEntity()); @@ -497,7 +501,7 @@ public class BBInputSetupTest { .getCatalogServiceByModelUUID(requestDetails.getModelInfo().getModelVersionId()); doReturn(service).when(SPY_bbInputSetupUtils).getCatalogServiceByModelVersionAndModelInvariantUUID( requestDetails.getModelInfo().getModelVersion(), requestDetails.getModelInfo().getModelInvariantId()); - doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration(), "att-aic"); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration()); doReturn(project).when(bbInputSetupMapperLayer).mapRequestProject(requestDetails.getProject()); doReturn(owningEntity).when(bbInputSetupMapperLayer) .mapRequestOwningEntity(requestDetails.getOwningEntity()); @@ -543,7 +547,7 @@ public class BBInputSetupTest { .getURIKeysFromServiceInstance(resourceId); doReturn(service).when(SPY_bbInputSetupUtils) .getCatalogServiceByModelUUID(requestDetails.getModelInfo().getModelVersionId()); - doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration(), "att-aic"); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration()); doReturn(customer).when(SPY_bbInputSetup).getCustomerAndServiceSubscription(requestDetails, resourceId); doReturn(serviceSubscription).when(SPY_bbInputSetup).getServiceSubscription(requestDetails, customer); @@ -769,7 +773,7 @@ public class BBInputSetupTest { orchestrationContext.setIsRollbackEnabled(false); CloudRegion cloudRegion = new CloudRegion(); - cloudRegion.setCloudOwner("att-aic"); + cloudRegion.setCloudOwner("test-owner-name"); cloudRegion.setLcpCloudRegionId("lcpCloudRegionId"); cloudRegion.setComplex("complexName"); cloudRegion.setTenantId("tenantId"); @@ -792,11 +796,10 @@ public class BBInputSetupTest { doReturn(uriKeys).when(SPY_bbInputSetupUtils).getURIKeysFromServiceInstance(serviceInstance.getServiceInstanceId()); doReturn(customer).when(SPY_bbInputSetup).mapCustomer(uriKeys.get("global-customer-id"),uriKeys.get("service-type")); - doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration(), "att-aic"); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration()); doReturn(orchestrationContext).when(bbInputSetupMapperLayer).mapOrchestrationContext(requestDetails); doReturn(requestContext).when(bbInputSetupMapperLayer).mapRequestContext(requestDetails); - doReturn(cloudRegion).when(bbInputSetupMapperLayer).mapCloudRegion(requestDetails.getCloudConfiguration(), aaiCloudRegion, - "att-aic"); + doReturn(cloudRegion).when(bbInputSetupMapperLayer).mapCloudRegion(requestDetails.getCloudConfiguration(), aaiCloudRegion); GeneralBuildingBlock actual = SPY_bbInputSetup.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, null); @@ -1769,11 +1772,12 @@ public class BBInputSetupTest { new File(RESOURCE_PATH + "ServiceMacroVfModules.json"), org.onap.so.serviceinstancebeans.Service.class); CloudConfiguration cloudConfig = null; org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = new org.onap.aai.domain.yang.CloudRegion(); + aaiCloudRegion.setCloudOwner("test-owner-name"); Resources resources = serviceMacro.getResources(); - doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(any(CloudConfiguration.class), eq("att-aic")); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(any(CloudConfiguration.class)); CloudRegion expected = new CloudRegion(); expected.setLcpCloudRegionId("mdt1"); - expected.setCloudOwner("att-aic"); + expected.setCloudOwner("test-owner-name"); expected.setTenantId("88a6ca3ee0394ade9403f075db23167e"); CloudRegion actual = SPY_bbInputSetup.getCloudRegionFromMacroRequest(cloudConfig, resources); @@ -2124,8 +2128,7 @@ public class BBInputSetupTest { cloudConfig.setLcpCloudRegionId("lcpCloudRegionId"); requestDetails.setCloudConfiguration(cloudConfig); org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = Mockito.mock(org.onap.aai.domain.yang.CloudRegion.class); - doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration(), - "att-aic"); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration()); executeBB.getBuildingBlock().setBpmnFlowName("DeleteNetworkBB"); executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); @@ -2273,14 +2276,13 @@ public class BBInputSetupTest { any(Service.class), any(String.class)); org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = Mockito.mock(org.onap.aai.domain.yang.CloudRegion.class); - doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration(), - "att-aic"); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration()); VolumeGroup volumeGroup = new VolumeGroup(); volumeGroup.setVolumeGroupId("volumeGroupId"); gBB.getServiceInstance().getVnfs().get(0).getVolumeGroups().add(volumeGroup); org.onap.aai.domain.yang.VolumeGroup aaiVolumeGroup = new org.onap.aai.domain.yang.VolumeGroup(); aaiVolumeGroup.setModelCustomizationId("modelCustId"); - doReturn(aaiVolumeGroup).when(SPY_bbInputSetupUtils).getAAIVolumeGroup("att-aic", + doReturn(aaiVolumeGroup).when(SPY_bbInputSetupUtils).getAAIVolumeGroup(Defaults.CLOUD_OWNER.toString(), cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); executeBB.getBuildingBlock().setBpmnFlowName("UnassignVolumeGroupBB"); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java index eb74ab804e..e1efe1c9c5 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java @@ -174,27 +174,25 @@ public class BBInputSetupUtilsTest { @Test public void testGetCloudRegion() { - String cloudOwner = "cloudOwnerId"; CloudConfiguration cloudConfig = new CloudConfiguration(); cloudConfig.setLcpCloudRegionId("lcpCloudRegionId"); Optional<org.onap.aai.domain.yang.CloudRegion> expected = Optional.of(new org.onap.aai.domain.yang.CloudRegion()); - expected.get().setCloudOwner(cloudOwner); + expected.get().setCloudOwner("cloudOwner"); expected.get().setCloudRegionId("lcpCloudRegionId"); doReturn(expected).when(MOCK_aaiResourcesClient).get(org.onap.aai.domain.yang.CloudRegion.class, - AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudOwner, + AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudConfig.getCloudOwner(), cloudConfig.getLcpCloudRegionId())); - AAIResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudOwner, + AAIResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudConfig.getCloudOwner(), cloudConfig.getLcpCloudRegionId()); - bbInputSetupUtils.getCloudRegion(cloudConfig, cloudOwner); + bbInputSetupUtils.getCloudRegion(cloudConfig); verify(MOCK_aaiResourcesClient, times(1)).get(CloudRegion.class, expectedUri); } @Test public void testGetCloudRegionExceptionTest() { - String cloudOwner = "cloudOwnerId"; - + CloudConfiguration cloudConfig = new CloudConfiguration(); cloudConfig.setLcpCloudRegionId("lcpCloudRegionId"); @@ -203,33 +201,29 @@ public class BBInputSetupUtilsTest { doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class)); - CloudRegion cloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfig, cloudOwner); + CloudRegion cloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfig); assertNull(cloudRegion); } @Test public void testGetCloudRegionEmptyId() { - String cloudOwner = "cloudOwnerId"; - CloudConfiguration cloudConfig = new CloudConfiguration(); cloudConfig.setLcpCloudRegionId(""); RequestDetails requestDetails = new RequestDetails(); requestDetails.setCloudConfiguration(cloudConfig); - CloudRegion cloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfig, cloudOwner); + CloudRegion cloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfig); assertNull(cloudRegion); } @Test public void testGetCloudRegionEmptyConfiguration() { - String cloudOwner = "cloudOwnerId"; - RequestDetails requestDetails = new RequestDetails(); - CloudRegion cloudRegion = bbInputSetupUtils.getCloudRegion(requestDetails.getCloudConfiguration(), cloudOwner); + CloudRegion cloudRegion = bbInputSetupUtils.getCloudRegion(requestDetails.getCloudConfiguration()); assertNull(cloudRegion); } diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json new file mode 100644 index 0000000000..f05449a96f --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json @@ -0,0 +1,6 @@ +{ + "requestInfo" : {"sourceId":"mso","requestType":"create","requestId":"testRequestId","callbackUrl":"http://localhost:28080/mso/WorkflowMesssage/SNIROResponse/testRequestId","transactionId":"testRequestId","timeout":1800}, + "serviceInfo" : {"modelInfo":{"modelName":"testModelName1","modelVersionId":"testModelUUID1","modelVersion":"testModelVersion1","modelInvariantId":"testModelInvariantUUID1"},"serviceInstanceId":"testServiceInstanceId1","serviceName":"testServiceType1"}, + "placementInfo" : {"subscriberInfo":{"subscriberName":"testCustomerName","globalSubscriberId":"testCustomerId"},"placementDemands":[{"resourceModelInfo":{"modelName":"testProxyModelName1","modelVersionId":"testProxyModelUuid1","modelVersion":"testProxyModelVersion1","modelInvariantId":"testProxyModelInvariantUuid1"},"resourceModuleName":"testProxyModelInstanceName1","serviceResourceId":"testProxyId1"},{"resourceModelInfo":{"modelName":"testProxyModelName2","modelVersionId":"testProxyModelUuid2","modelVersion":"testProxyModelVersion2","modelInvariantId":"testProxyModelInvariantUuid2"},"requiredCandidates":[{"candidateType":{"name":"vnfId"},"candidates":["testVnfId"]}],"resourceModuleName":"testProxyModelInstanceName2","serviceResourceId":"testProxyId2"}],"requestParameters":{"aLaCarte":false,"subscriptionServiceType":"iptollfree"}}, + "licenseInfo" : {"licenseDemands":[]} +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json index 4c4c9b3f00..6977224ffa 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json @@ -1,6 +1,6 @@ { "requestInfo" : {"sourceId":"mso","requestType":"create","requestId":"testRequestId","callbackUrl":"http://localhost:28080/mso/WorkflowMesssage/SNIROResponse/testRequestId","transactionId":"testRequestId","timeout":1800}, "serviceInfo" : {"modelInfo":{"modelName":"testModelName1","modelVersionId":"testModelUUID1","modelVersion":"testModelVersion1","modelInvariantId":"testModelInvariantUUID1"},"serviceInstanceId":"testServiceInstanceId1","serviceName":"testServiceType1"}, - "placementInfo" : {"subscriberInfo":{"subscriberName":"testCustomerName","globalSubscriberId":"testCustomerId"},"placementDemands":[{"resourceModelInfo":{"modelName":"testAllottedModelName1","modelVersionId":"testAllottedModelUuid1","modelVersion":"testAllottedModelVersion1","modelInvariantId":"testAllottedModelInvariantUuid1"},"resourceModuleName":"testAllottedInstanceName1","serviceResourceId":"testAllottedResourceId1"},{"resourceModelInfo":{"modelName":"testAllottedModelName2","modelVersionId":"testAllottedModelUuid2","modelVersion":"testAllottedModelVersion2","modelInvariantId":"testAllottedModelInvariantUuid2"},"resourceModuleName":"testAllottedInstanceName2","serviceResourceId":"testAllottedResourceId2"},{"resourceModelInfo":{"modelName":"testAllottedModelName3","modelVersionId":"testAllottedModelUuid3","modelVersion":"testAllottedModelVersion3","modelInvariantId":"testAllottedModelInvariantUuid3"},"resourceModuleName":"testAllottedInstanceName3","serviceResourceId":"testAllottedResourceId3"}],"requestParameters":{"aLaCarte":false,"subscriptionServiceType":"iptollfree"}}, - "licenseInfo" : [] + "placementInfo" : {"subscriberInfo":{"subscriberName":"testCustomerName","globalSubscriberId":"testCustomerId"},"placementDemands":[{"resourceModelInfo":{"modelName":"testAllottedModelName1","modelVersionId":"testAllottedModelUuid1","modelVersion":"testAllottedModelVersion1","modelInvariantId":"testAllottedModelInvariantUuid1"},"resourceModuleName":"testAllottedModelInstanceName1","serviceResourceId":"testAllottedResourceId1"},{"resourceModelInfo":{"modelName":"testAllottedModelName2","modelVersionId":"testAllottedModelUuid2","modelVersion":"testAllottedModelVersion2","modelInvariantId":"testAllottedModelInvariantUuid2"},"resourceModuleName":"testAllottedModelInstanceName2","serviceResourceId":"testAllottedResourceId2"},{"resourceModelInfo":{"modelName":"testAllottedModelName3","modelVersionId":"testAllottedModelUuid3","modelVersion":"testAllottedModelVersion3","modelInvariantId":"testAllottedModelInvariantUuid3"},"resourceModuleName":"testAllottedModelInstanceName3","serviceResourceId":"testAllottedResourceId3"}],"requestParameters":{"aLaCarte":false,"subscriptionServiceType":"iptollfree"}}, + "licenseInfo" : {"licenseDemands":[]} }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json new file mode 100644 index 0000000000..877c6e7e74 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json @@ -0,0 +1,6 @@ +{ + "requestInfo" : {"sourceId":"mso","requestType":"create","requestId":"testRequestId","callbackUrl":"http://localhost:28080/mso/WorkflowMesssage/SNIROResponse/testRequestId","transactionId":"testRequestId","timeout":1800}, + "serviceInfo" : {"modelInfo":{"modelName":"testModelName1","modelVersionId":"testModelUUID1","modelVersion":"testModelVersion1","modelInvariantId":"testModelInvariantUUID1"},"serviceInstanceId":"testServiceInstanceId1","serviceName":"testServiceType1"}, + "placementInfo" : {"subscriberInfo":{"subscriberName":"testCustomerName","globalSubscriberId":"testCustomerId"},"placementDemands":[{"resourceModelInfo":{"modelName":"testProxyModelName1","modelVersionId":"testProxyModelUuid1","modelVersion":"testProxyModelVersion1","modelInvariantId":"testProxyModelInvariantUuid1"},"resourceModuleName":"testProxyModelInstanceName1","serviceResourceId":"testProxyId1"},{"resourceModelInfo":{"modelName":"testProxyModelName2","modelVersionId":"testProxyModelUuid2","modelVersion":"testProxyModelVersion2","modelInvariantId":"testProxyModelInvariantUuid2"},"requiredCandidates":[{"candidateType":{"name":"vnfId"},"candidates":["testVnfId"]}],"resourceModuleName":"testProxyModelInstanceName2","serviceResourceId":"testProxyId2"},{"resourceModelInfo":{"modelName":"testProxyModelName1","modelVersionId":"testProxyModelUuid1","modelVersion":"testProxyModelVersion1","modelInvariantId":"testProxyModelInvariantUuid1"},"resourceModuleName":"testProxyModelInstanceName1","serviceResourceId":"testProxyId1"},{"resourceModelInfo":{"modelName":"testProxyModelName2","modelVersionId":"testProxyModelUuid2","modelVersion":"testProxyModelVersion2","modelInvariantId":"testProxyModelInvariantUuid2"},"requiredCandidates":[{"candidateType":{"name":"vnfId"},"candidates":["testVnfId"]}],"resourceModuleName":"testProxyModelInstanceName2","serviceResourceId":"testProxyId2"},{"resourceModelInfo":{"modelName":"testProxyModelName1","modelVersionId":"testProxyModelUuid1","modelVersion":"testProxyModelVersion1","modelInvariantId":"testProxyModelInvariantUuid1"},"resourceModuleName":"testProxyModelInstanceName1","serviceResourceId":"testProxyId1"},{"resourceModelInfo":{"modelName":"testProxyModelName2","modelVersionId":"testProxyModelUuid2","modelVersion":"testProxyModelVersion2","modelInvariantId":"testProxyModelInvariantUuid2"},"requiredCandidates":[{"candidateType":{"name":"vnfId"},"candidates":["testVnfId"]}],"resourceModuleName":"testProxyModelInstanceName2","serviceResourceId":"testProxyId2"}],"requestParameters":{"aLaCarte":false,"subscriptionServiceType":"iptollfree"}}, + "licenseInfo" : {"licenseDemands":[]} +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockCMExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockCMExpected.json index 8cd04fdd8e..d3698771bf 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockCMExpected.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockCMExpected.json @@ -13,6 +13,7 @@ "is-rollback-enabled": true }, "cloudRegion": { + "lcp-cloud-region-id" : "myRegionId", "cloud-owner": "att-aic" }, "userInput": null, diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpected.json index 9b021ae1e7..cf65143c9a 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpected.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpected.json @@ -17,7 +17,7 @@ }, "cloudRegion": { "lcp-cloud-region-id": "lcpCloudRegionId", - "cloud-owner": "att-aic", + "cloud-owner": "test-owner-name", "tenant-id": "tenantId", "complex": "complexName" }, diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVfModules.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVfModules.json index 3f07e8d526..de20a5a963 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVfModules.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVfModules.json @@ -49,6 +49,7 @@ }, "cloudConfiguration": { "lcpCloudRegionId": "mdt1", + "cloudOwner" : "test-owner-name", "tenantId": "88a6ca3ee0394ade9403f075db23167e" }, "instanceName": "vmxnjr001_AVPN_base_vRE_BV_expansion_001", diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVnfs.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVnfs.json index 4c29f96361..c4ad0ac047 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVnfs.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceMacroVnfs.json @@ -24,6 +24,7 @@ }, "cloudConfiguration": { "lcpCloudRegionId": "mdt1", + "cloudOwner" : "test-owner-name", "tenantId": "88a6ca3ee0394ade9403f075db23167e" }, "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml deleted file mode 100644 index e2db499929..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml +++ /dev/null @@ -1,21 +0,0 @@ -<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" - statusCode="200"> - <rest:headers> - <rest:header name="Transfer-Encoding" value="chunked"/> - <rest:header name="Date" value="Mon,14 Mar 2016 20:53:33 GMT"/> - <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/> - <rest:header name="X-AAI-TXID" - value="localhost-20160314-20:53:33:487-134392"/> - <rest:header name="Content-Type" value="application/xml"/> - <rest:header name="Server" value="Apache-Coyote/1.1"/> - <rest:header name="Cache-Control" value="private"/> - </rest:headers> - <rest:payload contentType="text/xml"> - <network-policy xmlns="http://com.aai.inventory/v8"> - <network-policy-id>9a7b327d9-287aa00-82c4b0-105757</network-policy-id> - <network-policy-fqdn>fqdn123</network-policy-fqdn> - <heat-stack-id>slowburn</heat-stack-id> - <resource-version>145878989</resource-version> - </network-policy> - </rest:payload> -</rest:RESTResponse>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml deleted file mode 100644 index 2126ae7464..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml +++ /dev/null @@ -1,6 +0,0 @@ -<CreateAAIVfModuleVolumeGroupRequest> - <vnf-id>skask</vnf-id> - <vf-module-id>lukewarm</vf-module-id> - <aic-cloud-region>pdk1</aic-cloud-region> - <volume-group-id>78987</volume-group-id> -</CreateAAIVfModuleVolumeGroupRequest>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml deleted file mode 100644 index 5232e530e9..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml +++ /dev/null @@ -1,29 +0,0 @@ -<vnf-request xmlns="http://org.onap/so/infra/vnf-request/v1"> - <request-info> - <request-id>DEV-VF-0011</request-id> - <action>UPDATE_VF_MODULE</action> - <source>PORTAL</source> - </request-info> - <vnf-inputs> - <vnf-id>skask</vnf-id> <!-- Required --> - <vf-module-id>supercool</vf-module-id> <!-- Required --> - <vnf-type>pcrf-capacity</vnf-type> <!-- Optional --> - <vf-module-model-name>PCRF::module-0</vf-module-model-name> <!-- Required --> - <asdc-service-model-version></asdc-service-model-version> <!-- Optional --> - <service-id>serviceIdUUID</service-id> <!-- Required --> - <aic-cloud-region>MDTWNJ21</aic-cloud-region> <!-- Required --> - <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id> <!-- Required --> - <volume-group-id>78987</volume-group-id> <!-- Optional --> - <persona-model-id>introvert</persona-model-id> <!-- Optional --> - <persona-model-version>3.14</persona-model-version> <!-- Optional --> - <contrail-service-instance-fqdn>myhost.appl.edu</contrail-service-instance-fqdn> <!-- Optional --> - <vnf-persona-model-id>introvert</vnf-persona-model-id> <!-- Optional --> - <vnf-persona-model-version>3.14</vnf-persona-model-version> <!-- Optional --> - </vnf-inputs> - <vnf-params> - <param name="oam_network_name">VLAN-OAM-1323</param> - <param name="vm_name">slcp34246vbc246ceb</param> - <param name="ipag_network">970cd2b9-7f09-4a12-af47-182ea38ba1f0</param> - <param name="vpe_network">545cc2c3-1930-4100-b534-5d82d0e12bb6</param> - </vnf-params> -</vnf-request> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/GenericVnf.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/GenericVnf.xml deleted file mode 100644 index c86a4aaa73..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/GenericVnf.xml +++ /dev/null @@ -1,38 +0,0 @@ -<generic-vnf xmlns="http://com.aai.inventory/v7"> - <vnf-id>skask</vnf-id> - <vnf-name>STMTN5MMSC20</vnf-name> - <vnf-type>pcrf-capacity</vnf-type> - <service-id>SDN-MOBILITY</service-id> - <equipment-role>vPCRF</equipment-role> - <orchestration-status>pending-create</orchestration-status> - <in-maint>false</in-maint> - <is-closed-loop-disabled>false</is-closed-loop-disabled> - <persona-model-id>introvert</persona-model-id> - <persona-model-version>2.0</persona-model-version> - <resource-version>0000020</resource-version> - <vf-modules> - <vf-module> - <vf-module-id>lukewarm</vf-module-id> - <vf-module-name>PCRF::module-0-0</vf-module-name> - <persona-model-id>introvert</persona-model-id> - <persona-model-version>2.0</persona-model-version> - <is-base-vf-module>true</is-base-vf-module> - <heat-stack-id>fastburn</heat-stack-id> - <orchestration-status>pending-create</orchestration-status> - <resource-version>0000074</resource-version> - </vf-module> - <vf-module> - <vf-module-id>supercool</vf-module-id> - <vf-module-name>PCRF::module-1-0</vf-module-name> - <persona-model-id>extrovert</persona-model-id> - <persona-model-version>2.0</persona-model-version> - <is-base-vf-module>false</is-base-vf-module> - <heat-stack-id>slowburn</heat-stack-id> - <orchestration-status>pending-create</orchestration-status> - <resource-version>0000075</resource-version> - </vf-module> - </vf-modules> - <relationship-list/> - <l-interfaces/> - <lag-interfaces/> -</generic-vnf> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml deleted file mode 100644 index 65f235cf4b..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml +++ /dev/null @@ -1,5 +0,0 @@ -<PrepareUpdateAAIVfModuleRequest> - <vnf-id>skask</vnf-id> - <vf-module-id>supercool</vf-module-id> - <orchestration-status>pending-delete</orchestration-status> -</PrepareUpdateAAIVfModuleRequest>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml deleted file mode 100644 index f40b6bc991..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml +++ /dev/null @@ -1,21 +0,0 @@ -<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" - statusCode="200"> - <rest:headers> - <rest:header name="Transfer-Encoding" value="chunked"/> - <rest:header name="Date" value="Mon,14 Mar 2016 20:53:33 GMT"/> - <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/> - <rest:header name="X-AAI-TXID" - value="localhost-20160314-20:53:33:487-134392"/> - <rest:header name="Content-Type" value="application/xml"/> - <rest:header name="Server" value="Apache-Coyote/1.1"/> - <rest:header name="Cache-Control" value="private"/> - </rest:headers> - <rest:payload contentType="text/xml"> - <network-policy xmlns="http://com.aai.inventory/v8"> - <network-policy-id>9a7b327d9-287aa00-82c4b0-105757</network-policy-id> - <network-policy-fqdn>GN_EVPN_Test</network-policy-fqdn> - <heat-stack-id>195159195</heat-stack-id> - <resource-version>14567890</resource-version> - </network-policy> - </rest:payload> -</rest:RESTResponse>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyActivateCallback.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyActivateCallback.xml deleted file mode 100644 index 4cab6c6615..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyActivateCallback.xml +++ /dev/null @@ -1,13 +0,0 @@ -<output xmlns="com:att:sdnctl:vnf"> - <vnf-information> - <vnf-id>skask</vnf-id> - </vnf-information> - <response-code>200</response-code> - <svc-request-id>{{REQUEST-ID}}</svc-request-id> - <ack-final-indicator>Y</ack-final-indicator> - <service-information> - <subscriber-name>dontcare</subscriber-name> - <service-instance-id>0</service-instance-id> - <service-type>SDN-MOBILITY</service-type> - </service-information> -</output>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyAssignCallback.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyAssignCallback.xml deleted file mode 100644 index 7d3d0e54d1..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyAssignCallback.xml +++ /dev/null @@ -1,13 +0,0 @@ - <output xmlns="com:att:sdnctl:vnf"> - <vnf-information> - <vnf-id>skask</vnf-id> - </vnf-information> - <response-code>200</response-code> - <svc-request-id>{{REQUEST-ID}}</svc-request-id> - <ack-final-indicator>Y</ack-final-indicator> - <service-information> - <subscriber-name>dontcare</subscriber-name> - <service-instance-id>0</service-instance-id> - <service-type>SDN-MOBILITY</service-type> - </service-information> - </output>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyChangeAssignCallback.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyChangeAssignCallback.xml deleted file mode 100644 index 7d3d0e54d1..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyChangeAssignCallback.xml +++ /dev/null @@ -1,13 +0,0 @@ - <output xmlns="com:att:sdnctl:vnf"> - <vnf-information> - <vnf-id>skask</vnf-id> - </vnf-information> - <response-code>200</response-code> - <svc-request-id>{{REQUEST-ID}}</svc-request-id> - <ack-final-indicator>Y</ack-final-indicator> - <service-information> - <subscriber-name>dontcare</subscriber-name> - <service-instance-id>0</service-instance-id> - <service-type>SDN-MOBILITY</service-type> - </service-information> - </output>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml deleted file mode 100644 index dbd55b0cf4..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml +++ /dev/null @@ -1,315 +0,0 @@ -<output xmlns="com:att:sdnctl:vnf"> -<vnf-list xmlns="com:att:sdnctl:vnf"> - <vnf-id>bd1b3789-6474-4935-94b2-90b656e035d0</vnf-id> - <service-data> - <vnf-id>bd1b3789-6474-4935-94b2-90b656e035d0</vnf-id> - <sdnc-request-header> - <svc-request-id>9ddf628a-9eca-430e-8974-22d520a31be1</svc-request-id> - <svc-action>assign</svc-action> - <svc-notification-url>https://localhost:8443/adapters/rest/SDNCNotify</svc-notification-url> - </sdnc-request-header> - <service-information> - <subscriber-name>notsurewecare</subscriber-name> - <service-instance-id>bd1b3789-6474-4935-94b2-90b656e035d0</service-instance-id> - <service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type> - <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> - </service-information> - <oper-status> - <order-status>PendingCreate</order-status> - </oper-status> - <vnf-request-information> - <aic-cloud-region>VNN1CA52LCP</aic-cloud-region> - <vnf-name>ZVNNMOGX01_base</vnf-name> - <generic-vnf-id>afd0f02a-1ddb-43bb-aded-5113e46e82ae</generic-vnf-id> - <generic-vnf-type>ZVNN1MOGX01-SVC/ZVNN1MOGX01 - VF AUG 1 1</generic-vnf-type> - <generic-vnf-name>ZVNN1MOGX01</generic-vnf-name> - <tenant>33d209df14ac4c08ad60747185d2f3e0</tenant> - <vnf-id>bd1b3789-6474-4935-94b2-90b656e035d0</vnf-id> - <vnf-type>ZVNN1MOGX01 - VF AUG 1::module-0</vnf-type> - </vnf-request-information> - <vnf-topology-information> - <vnf-assignments> - <vnf-networks> - <network-role>mog_exn</network-role> - <network-id>03dbd833-785c-40c0-bf32-37594b5334bc</network-id> - <network-name>MNS-25180-P-VNNYCA01_exn_protected_net_1</network-name> - <contrail-network-fqdn/> - <subnet-id/> - <neutron-id>6f82d234-41a4-48e9-a9e8-415667a72929</neutron-id> - <sriov-vlan-filter-list> - <sriov-vlan-filter>filter1</sriov-vlan-filter> - </sriov-vlan-filter-list> - <sriov-vlan-filter-list> - <sriov-vlan-filter>filter2</sriov-vlan-filter> - </sriov-vlan-filter-list> - </vnf-networks> - <vnf-networks> - <network-role>mog_oam</network-role> - <network-id>3f181cde-9380-4c20-9d3a-e1a4ee74f994</network-id> - <network-name>MNS-25180-P-VNNYCA01_oam_protected_net_1</network-name> - <contrail-network-fqdn/> - <subnet-id/> - <neutron-id>713b6770-13fa-4949-8dbb-a1288c5e5932</neutron-id> - </vnf-networks> - <vnf-networks> - <network-role>mog_cor_B</network-role> - <network-id>821a550a-3f50-4725-995b-f212d5caec7c</network-id> - <network-name>MNS-25180-P-VNNYCA01_cor_direct_net_1</network-name> - <contrail-network-fqdn/> - <subnet-id/> - <neutron-id>18926e56-12b6-4a4d-98b6-37e0c05626ee</neutron-id> - </vnf-networks> - <vnf-networks> - <network-role>mog_cor_A</network-role> - <network-id>3dabf5c0-cffb-420c-8960-8499c74eb25f</network-id> - <network-name>MNS-25180-P-VNNYCA01_cor_direct_net_2</network-name> - <contrail-network-fqdn/> - <subnet-id/> - <neutron-id>35530b29-a4de-48ff-a014-111110ccc652</neutron-id> - </vnf-networks> - <vnf-networks> - <network-role>mog_gn</network-role> - <network-id>3ce97321-6e7f-49af-bd12-f833e377c310</network-id> - <network-name>MNS-25180-P-VNNYCA01_gn_direct_net_1</network-name> - <contrail-network-fqdn/> - <subnet-id/> - <neutron-id>32bfdd2c-28e1-4895-87a6-373bf12c3129</neutron-id> - </vnf-networks> - <vnf-networks> - <network-role>mog_dmz</network-role> - <network-id>d43ca910-02a5-47dc-8510-100a68a3c9e0</network-id> - <network-name>MNS-25180-P-VNNYCA01_dmz_protected_net_1</network-name> - <contrail-network-fqdn/> - <subnet-id/> - <neutron-id>cb9500fb-943f-412e-aea6-458711564a75</neutron-id> - </vnf-networks> - <availability-zones> - <availability-zone>nova</availability-zone> - </availability-zones> - <vnf-vms> - <vm-type>ps</vm-type> - <vm-names> - <vm-name>ZVNN1MOGX01MPS001</vm-name> - </vm-names> - <vm-names> - <vm-name>ZVNN1MOGX01MPS002</vm-name> - </vm-names> - <vm-names> - <vm-name>ZVNN1MOGX01MPS003</vm-name> - </vm-names> - <vm-names> - <vm-name>ZVNN1MOGX01MPS004</vm-name> - </vm-names> - <vm-count>4</vm-count> - <vm-networks> - <network-role>mog_cor_B</network-role> - <network-ips> - <ip-address>107.224.36.251</ip-address> - </network-ips> - <network-ips> - <ip-address>107.224.36.252</ip-address> - </network-ips> - <network-ips> - <ip-address>107.224.36.253</ip-address> - </network-ips> - <network-ips> - <ip-address>107.224.36.254</ip-address> - </network-ips> - <use-dhcp>N</use-dhcp> - </vm-networks> - </vnf-vms> - <vnf-vms> - <vm-type>cm</vm-type> - <vm-names> - <vm-name>ZVNN1MOGX01MCM001</vm-name> - </vm-names> - <vm-names> - <vm-name>ZVNN1MOGX01OAM002</vm-name> - </vm-names> - <vm-count>1</vm-count> - <vm-networks> - <network-role>mog_cor_B</network-role> - <network-ips> - <ip-address>107.224.36.249</ip-address> - </network-ips> - <network-ips> - <ip-address>107.224.36.250</ip-address> - </network-ips> - <use-dhcp>N</use-dhcp> - </vm-networks> - <vm-networks> - <network-role>mog_oam</network-role> - <network-ips> - <ip-address>107.239.167.250</ip-address> - </network-ips> - <network-ips> - <ip-address>107.239.167.251</ip-address> - </network-ips> - <use-dhcp>N</use-dhcp> - </vm-networks> - </vnf-vms> - <vnf-vms> - <vm-type>oam</vm-type> - <vm-names> - <vm-name>ZVNN1MOGX01OAM001</vm-name> - </vm-names> - <vm-names> - <vm-name>ZVNN1MOGX01OAM002</vm-name> - </vm-names> - <vm-count>2</vm-count> - <vm-networks> - <network-role>mog_oam</network-role> - <network-ips> - <ip-address>107.239.167.252</ip-address> - </network-ips> - <network-ips> - <ip-address>107.239.167.251</ip-address> - </network-ips> - <use-dhcp>N</use-dhcp> - </vm-networks> - <vm-networks> - <network-role>mog_cor_B</network-role> - <network-ips> - <ip-address>107.224.36.249</ip-address> - </network-ips> - <network-ips> - <ip-address>107.224.36.250</ip-address> - </network-ips> - <use-dhcp>N</use-dhcp> - </vm-networks> - </vnf-vms> - <vnf-vms> - <vm-type>pd</vm-type> - <vm-names> - <vm-name>ZVNN1MOGX01MPD001</vm-name> - </vm-names> - <vm-names> - <vm-name>ZVNN1MOGX01MPD002</vm-name> - </vm-names> - <vm-count>2</vm-count> - <vm-networks> - <network-role>mog_dmz</network-role> - <network-ips> - <ip-address>107.225.25.253</ip-address> - </network-ips> - <network-ips> - <ip-address>107.225.25.254</ip-address> - </network-ips> - <use-dhcp>N</use-dhcp> - <floating-ip>107.225.254.253</floating-ip> - </vm-networks> - <vm-networks> - <network-role>mog_oam</network-role> - <network-ips> - <ip-address>107.239.167.254</ip-address> - </network-ips> - <network-ips> - <ip-address>107.239.167.253</ip-address> - </network-ips> - <use-dhcp>N</use-dhcp> - <floating-ip>107.239.167.249</floating-ip> - </vm-networks> - <vm-networks> - <network-role>mog_exn</network-role> - <network-ips> - <ip-address>107.224.46.253</ip-address> - </network-ips> - <network-ips> - <ip-address>107.224.46.254</ip-address> - </network-ips> - <use-dhcp>N</use-dhcp> - <floating-ip>107.224.46.252</floating-ip> - </vm-networks> - <vm-networks> - <network-role>mog_cor_B</network-role> - <network-ips> - <ip-address>107.224.36.247</ip-address> - </network-ips> - <network-ips> - <ip-address>107.224.36.248</ip-address> - </network-ips> - <use-dhcp>N</use-dhcp> - <floating-ip>107.224.41.252</floating-ip> - </vm-networks> - <vm-networks> - <network-role>mog_gn</network-role> - <network-ips> - <ip-address>107.224.41.253</ip-address> - </network-ips> - <network-ips> - <ip-address>107.224.41.254</ip-address> - </network-ips> - <use-dhcp>N</use-dhcp> - <floating-ip>107.224.41.252</floating-ip> - </vm-networks> - <vm-networks> - <network-role>mog_cor_A</network-role> - <network-ips> - <ip-address>107.224.38.253</ip-address> - </network-ips> - <network-ips> - <ip-address>107.224.38.254</ip-address> - </network-ips> - <use-dhcp>N</use-dhcp> - </vm-networks> - </vnf-vms> - <vnf-vms> - <vm-type>sm</vm-type> - <vm-names> - <vm-name>ZVNN1MOGX01MSM001</vm-name> - </vm-names> - <vm-names> - <vm-name>ZVNN1MOGX01MSM002</vm-name> - </vm-names> - <vm-names> - <vm-name>ZVNN1MOGX01MSM003</vm-name> - </vm-names> - <vm-names> - <vm-name>ZVNN1MOGX01MSM004</vm-name> - </vm-names> - <vm-count>4</vm-count> - <vm-networks> - <network-role>mog_cor_B</network-role> - <network-ips> - <ip-address>107.224.36.243</ip-address> - </network-ips> - <network-ips> - <ip-address>107.224.36.244</ip-address> - </network-ips> - <network-ips> - <ip-address>107.224.36.245</ip-address> - </network-ips> - <network-ips> - <ip-address>107.224.36.246</ip-address> - </network-ips> - <use-dhcp>N</use-dhcp> - </vm-networks> - </vnf-vms> - </vnf-assignments> - <vnf-topology-identifier> - <vnf-name>ZVNNMOGX01_base</vnf-name> - <service-type>SDN-MOBILITY</service-type> - <vnf-type>ZVNN1MOGX01 - VF AUG 1::module-0</vnf-type> - <generic-vnf-type>ZVNN1MOGX01-SVC/ZVNN1MOGX01 - VF AUG 1 1</generic-vnf-type> - <generic-vnf-name>ZVNN1MOGX01</generic-vnf-name> - </vnf-topology-identifier> - </vnf-topology-information> - <request-information> - <request-id>9ddf628a-9eca-430e-8974-22d520a31be1</request-id> - <notification-url/> - <source>PORTAL</source> - <request-action>VNFActivateRequest</request-action> - </request-information> - </service-data> - <service-status> - <response-code>200</response-code> - <final-indicator>Y</final-indicator> - <request-status>synccomplete</request-status> - <response-timestamp>2016-08-05T16:15:19.398Z</response-timestamp> - <rpc-name>vnf-topology-operation</rpc-name> - <vnfsdn-action>VNFActivateRequest</vnfsdn-action> - <rpc-action>assign</rpc-action> - </service-status> -</vnf-list> - -</output> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml deleted file mode 100644 index e8a69da0f8..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml +++ /dev/null @@ -1,141 +0,0 @@ -<output xmlns="com:att:sdnctl:vnf"> - <vnf-list xmlns="com:att:sdnctl:vnf"> - <vnf-id>28455973-1ee5-4ad1-8d35-c4732679743a</vnf-id> - <service-status> - <response-code>200</response-code> - <final-indicator>Y</final-indicator> - <request-status>synccomplete</request-status> - <response-timestamp>2016-06-08T19:44:59.138Z</response-timestamp> - <rpc-name>vnf-topology-operation</rpc-name> - <vnfsdn-action>VNFActivateRequest</vnfsdn-action> - <rpc-action>assign</rpc-action> - </service-status> - <service-data> - <vnf-id>28455973-1ee5-4ad1-8d35-c4732679743</vnf-id> - <service-information> - <subscriber-name>notsurewecare</subscriber-name> - <service-instance-id>28455973-1ee5-4ad1-8d35-c4732679743a</service-instance-id> - <service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type> - <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> - </service-information> - <sdnc-request-header> - <svc-request-id>5e168556-a5c6-4813-bff3-cc03007afbbc</svc-request-id> - <svc-notification-url>http://localhost:28080/adapters/rest/SDNCNotify</svc-notification-url> - <svc-action>assign</svc-action> - </sdnc-request-header> - <vnf-request-information> - <aic-cloud-region>AAIAIC25</aic-cloud-region> - <vnf-name>MSOTEST06-vSAMP3::base::module-0</vnf-name> - <generic-vnf-id>91ad7ab0-9ffd-471d-971c-3eb913a2cc75</generic-vnf-id> - <generic-vnf-type>Test/vSAMP3 1</generic-vnf-type> - <generic-vnf-name>MSOTEST06</generic-vnf-name> - <tenant>4ae1d3446a4c48b2bec44b6cfba06d68</tenant> - <vnf-id>28455973-1ee5-4ad1-8d35-c4732679743a</vnf-id> - <vnf-type>vSAMP3::base::module-0</vnf-type> - </vnf-request-information> - <oper-status> - <order-status>PendingCreate</order-status> - </oper-status> - <vnf-topology-information> - <vnf-parameters> - <vnf-parameter-name>image</vnf-parameter-name> - <vnf-parameter-value>Ubuntu_Perf</vnf-parameter-value> - </vnf-parameters> - <vnf-parameters> - <vnf-parameter-name>flavor</vnf-parameter-name> - <vnf-parameter-value>m1.small</vnf-parameter-value> - </vnf-parameters> - <vnf-assignments> - <vnf-networks> - <network-role>int_imbl</network-role> - <network-id>680b7453-0ec4-4d96-b355-280d981d418f</network-id> - <network-name>Nimbus-25193-T-Willows2_int_imbl_net_1</network-name> - <contrail-network-fqdn>default-domain:Nimbus-25193-T-Willows2:Nimbus-25193-T-Willows2_int_imbl_net_1</contrail-network-fqdn> - <subnet-id></subnet-id> - <ipv6-subnet-id>775607fb-e16a-45ef-94a7-82fba0d16eec</ipv6-subnet-id> - <neutron-id>640d07fb-e16a-45ef-94a7-82fba0d169bf</neutron-id> - <sriov-vlan-filter-list> - <sriov-vlan-filter>filter1</sriov-vlan-filter> - </sriov-vlan-filter-list> - <sriov-vlan-filter-list> - <sriov-vlan-filter>filter2</sriov-vlan-filter> - </sriov-vlan-filter-list> - </vnf-networks> - <vnf-networks> - <network-role>sgi_protected</network-role> - <network-id>f9039ce9-e3cf-4716-b2d1-ec7912178ea4</network-id> - <network-name>Nimbus-25193-T-Willows2_sgi_protected_net_1</network-name> - <contrail-network-fqdn>default-domain:Nimbus-25193-T-Willows2:Nimbus-25193-T-Willows2_sgi_protected_net_1</contrail-network-fqdn> - <subnet-id>b9999ce9-e3cf-4716-b2d1-ec791217678c</subnet-id> - <ipv6-subnet-id></ipv6-subnet-id> - <neutron-id>bf11bba8-b971-4ab5-8281-215b3fedcd3c</neutron-id> - </vnf-networks> - <vnf-vms> - <vm-type>cm</vm-type> - <vm-names> - <vm-name>ZVNN1MOGX01MCM001</vm-name> - </vm-names> - <vm-names> - <vm-name>ZVNN1MOGX01OAM002</vm-name> - </vm-names> - <vm-count>1</vm-count> - <vm-networks> - <network-role>mog_cor_B</network-role> - <network-ips> - <ip-address>107.224.36.249</ip-address> - </network-ips> - <network-ips> - <ip-address>107.224.36.250</ip-address> - </network-ips> - <network-ips-v6> - <ip-address-ipv6>2606:ae00:2e01:800::67</ip-address-ipv6> - </network-ips-v6> - <use-dhcp>N</use-dhcp> - <floating-ip>107.224.41.252</floating-ip> - <floating-ip-v6>2001:1890:1001:2B32::29:C</floating-ip-v6> - </vm-networks> - <vm-networks> - <network-role>mog_oam</network-role> - <network-ips> - <ip-address>107.239.167.250</ip-address> - </network-ips> - <network-ips> - <ip-address>107.239.167.251</ip-address> - </network-ips> - <network-ips-v6> - <ip-address-ipv6>aa::aa::aa::aa::aa::aa</ip-address-ipv6> - </network-ips-v6> - <network-ips-v6> - <ip-address-ipv6>bb::bb::bb::bb::bb::bb</ip-address-ipv6> - </network-ips-v6> - <interface-route-prefixes> - <interface-route-prefix-cidr>1.2.3.4/26</interface-route-prefix-cidr> - </interface-route-prefixes> - <interface-route-prefixes> - <interface-route-prefix-cidr>2002::/64</interface-route-prefix-cidr> - </interface-route-prefixes> - <use-dhcp>N</use-dhcp> - <floating-ip-v6>1111:1890:1001:2B32::29:D</floating-ip-v6> - </vm-networks> - </vnf-vms> - <availability-zones> - <availability-zone>nova</availability-zone> - </availability-zones> - </vnf-assignments> - <vnf-topology-identifier> - <vnf-name>MSOTEST06-vSAMP3::base::module-0</vnf-name> - <service-type>SDN-MOBILITY</service-type> - <vnf-type>vSAMP3::base::module-0</vnf-type> - <generic-vnf-type>Test/vSAMP3 1</generic-vnf-type> - <generic-vnf-name>MSOTEST06</generic-vnf-name> - </vnf-topology-identifier> - </vnf-topology-information> - <request-information> - <request-id>5e168556-a5c6-4813-bff3-cc03007afbbc</request-id> - <notification-url></notification-url> - <source>SoapUI-bns-vf-base-vSAMP3-9001</source> - <request-action>VNFActivateRequest</request-action> - </request-information> - </service-data> -</vnf-list> -</output> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml deleted file mode 100644 index 77528ccf61..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml +++ /dev/null @@ -1,5 +0,0 @@ -<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> - <soap:Body> - <SDNCAdapterResponse xmlns="http://org.onap/workflow/sdnc/adapter/schema/v1"/> - </soap:Body> -</soap:Envelope>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateAAIGenericVnfRequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateAAIGenericVnfRequest.xml deleted file mode 100644 index 3e7c6503f4..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateAAIGenericVnfRequest.xml +++ /dev/null @@ -1,5 +0,0 @@ -<UpdateAAIGenericVnfRequest> - <vnf-id>skask</vnf-id> - <persona-model-id>introvert</persona-model-id> - <persona-model-version>3.14</persona-model-version> -</UpdateAAIGenericVnfRequest>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateAAIVfModuleRequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateAAIVfModuleRequest.xml deleted file mode 100644 index 8a690403c4..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateAAIVfModuleRequest.xml +++ /dev/null @@ -1,10 +0,0 @@ -<UpdateAAIVfModuleRequest> - <vnf-id>skask</vnf-id> - <vf-module-id>supercool</vf-module-id> - <heat-stack-id>slowburn</heat-stack-id> - <orchestration-status>complete</orchestration-status> - <volume-group-id>78987</volume-group-id> - <persona-model-id>introvert</persona-model-id> - <persona-model-version>3.14</persona-model-version> - <contrail-service-instance-fqdn>myhost.appl.com</contrail-service-instance-fqdn> -</UpdateAAIVfModuleRequest>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateVfModuleRequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateVfModuleRequest.xml deleted file mode 100644 index 0dc1b1d410..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateVfModuleRequest.xml +++ /dev/null @@ -1,35 +0,0 @@ -<vnf-request xmlns="http://org.onap/so/infra/vnf-request/v1"> - <request-info> - <request-id>DEV-VF-0011</request-id> - <action>UPDATE_VF_MODULE</action> - <source>PORTAL</source> - </request-info> - <vnf-inputs> - <vnf-id>skask</vnf-id> <!-- Required --> <!-- with vf-module-id, identifies the vf-module to update --> - <vf-module-id>supercool</vf-module-id> <!-- Required --> <!-- with vnf-id, identifies the vf-module to update --> - <vnf-type>pcrf-capacity</vnf-type> <!-- Required --> <!-- not in vf-module; used for recipe selection/filtering; - thus, not used by UpdateVfModule flow --> - <vf-module-model-name>PCRF::module-0</vf-module-model-name> <!-- Required --> <!-- not in vf-module; used for recipe selection/filtering; - thus, not used by UpdateVfModule flow --> - <asdc-service-model-version></asdc-service-model-version> <!-- Optional --> <!-- not in vf-module; used for recipe selection; - thus, not used by UpdateVfModule flow --> - <service-id>serviceIdUUID</service-id> <!-- Required --> <!-- not in vf-module; used for query filtering; - thus, not used by UpdateVfModule flow --> - <aic-cloud-region>MDTWNJ21</aic-cloud-region> <!-- Required --> <!-- in vf-module as part of volume-group relationship; - however, used for query filtering only; not updatable in AAI --> - <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id> <!-- Required --> <!-- not in vf-module; used to confirm volume group tenant --> - <volume-group-id>78987</volume-group-id> <!-- Optional --> <!-- in vf-module as part of volume-group relationship; used - to update VNF adapter; not updatable in AAI --> - <persona-model-id>introvert</persona-model-id> <!-- Optional --> <!-- Not in AID, in vf-module --> - <persona-model-version>3.14</persona-model-version> <!-- Optional --> <!-- Not in AID, in vf-module --> - <contrail-service-instance-fqdn>myhost.appl.edu</contrail-service-instance-fqdn> <!-- Optional --> <!-- Not in AID, in vf-module --> - <vnf-persona-model-id>introvert</vnf-persona-model-id> <!-- Optional --> <!-- Not in AID, in generic-vnf (as persona-model-id) --> - <vnf-persona-model-version>3.14</vnf-persona-model-version> <!-- Optional --> <!-- Not in AID, in generic-vnf (as persona-model-version) --> - </vnf-inputs> - <vnf-params> - <param name="oam_network_name">VLAN-OAM-1323</param> - <param name="vm_name">slcp34246vbc246ceb</param> - <param name="ipag_network">970cd2b9-7f09-4a12-af47-182ea38ba1f0</param> - <param name="vpe_network">545cc2c3-1930-4100-b534-5d82d0e12bb6</param> - </vnf-params> -</vnf-request> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestCreateCallback.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestCreateCallback.xml deleted file mode 100644 index 49ecd0bf3f..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestCreateCallback.xml +++ /dev/null @@ -1,55 +0,0 @@ -<createVfModuleResponse> - <vnfId>skask</vnfId> - <vfModuleId>supercool</vfModuleId> - <vfModuleStackId>slowburn</vfModuleStackId> - <vfModuleCreated>true</vfModuleCreated> - <vfModuleOutputs> - <entry> - <key>key1</key> - <value>value1</value> - </entry> - <entry> - <key>key2</key> - <value>value2</value> - </entry> - <entry> -<key>server1_private_ip</key> -<value>192.168.28.3</value> -</entry> -<entry> -<key>contrail-service-instance-fqdn</key> -<value>default-domain:MSOTest:MsoNW-RA</value> -</entry> -<entry> -<key>policyKey1_contrail_network_policy_fqdn</key> -<value>MSOTest:DefaultPolicyFQDN1</value> -</entry> -<entry> -<key>policyKey2_contrail_network_policy_fqdn</key> -<value>MSOTest:DefaultPolicyFQDN2</value> -</entry> -<entry> -<key>oam_management_v6_address</key> -<value>2000:abc:bce:1111</value> -</entry> -<entry> -<key>oam_management_v4_address</key> -<value>127.0.0.1</value> -</entry> - </vfModuleOutputs> - <rollback> <!-- JC's doc has "vfModuleRollback" --> - <vnfId>skask</vnfId> - <vfModuleId>supercool</vfModuleId> - <vfModuleStackId>slowburn</vfModuleStackId> - <vfModuleCreated>true</vfModuleCreated> - <tenantId>tenantId</tenantId> - <cloudSiteId>cloudSiteId</cloudSiteId> - <msoRequest> - <requestId>requestId</requestId> - <serviceInstanceId>serviceInstanceId</serviceInstanceId> - </msoRequest> - <messageId>{{MESSAGE-ID}}</messageId> <!-- JC's doc does not have this --> - </rollback> - <messageId>{{MESSAGE-ID}}</messageId> -</createVfModuleResponse> - diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestUpdateCallback.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestUpdateCallback.xml deleted file mode 100644 index c602dd9667..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestUpdateCallback.xml +++ /dev/null @@ -1,16 +0,0 @@ -<updateVfModuleResponse> - <vnfId>skask</vnfId> - <vfModuleId>supercool</vfModuleId> - <vfModuleStackId>slowburn</vfModuleStackId> - <vfModuleOutputs> - <entry> - <key>key1</key> - <value>value1</value> - </entry> - <entry> - <key>key2</key> - <value>value2</value> - </entry> - </vfModuleOutputs> - <messageId>{{MESSAGE-ID}}</messageId> -</updateVfModuleResponse> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml deleted file mode 100644 index 830d2e2237..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml +++ /dev/null @@ -1,15 +0,0 @@ -<updateVolumeGroupResponse> - <volumeGroupId>78987</volumeGroupId> - <volumeGroupStackId>slowburn</volumeGroupStackId> - <vfModuleOutputs> - <entry> - <key>key1</key> - <value>value1</value> - </entry> - <entry> - <key>key2</key> - <value>value2</value> - </entry> - </vfModuleOutputs> - <messageId>{{MESSAGE-ID}}</messageId> -</updateVolumeGroupResponse> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml deleted file mode 100644 index b882c4c6f4..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml +++ /dev/null @@ -1,10 +0,0 @@ -<vf-module xmlns="http://com.aai.inventory/v7"> - <vf-module-id>lukewarm</vf-module-id> - <vf-module-name>PCRF::module-1</vf-module-name> - <heat-stack-id>slowburn</heat-stack-id> - <orchestration-status>pending-create</orchestration-status> - <is-base-vf-module>true</is-base-vf-module> - <resource-version>330-90</resource-version> - <persona-model-id>introvert</persona-model-id> - <persona-model-version>2.0</persona-model-version> -</vf-module>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-new.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-new.xml deleted file mode 100644 index 3b8bea4e4e..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-new.xml +++ /dev/null @@ -1,9 +0,0 @@ -<vf-module xmlns="http://com.aai.inventory/v7"> - <vf-module-id>b37d96db-7d2c-47ce-bf61-a6c7b82fe161</vf-module-id> - <vf-module-name>PCRF::module-0-2</vf-module-name> - <persona-model-id>00000000-0000-0000-0000-000000000000</persona-model-id> - <persona-model-version>1.0</persona-model-version> - <is-base-vf-module>false</is-base-vf-module> - <orchestration-status>pending-create</orchestration-status> - <resource-version>330-90</resource-version> -</vf-module>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-supercool.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-supercool.xml deleted file mode 100644 index 5a2b7300b1..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-supercool.xml +++ /dev/null @@ -1,27 +0,0 @@ -<vf-module xmlns="http://com.aai.inventory/v7"> - <vf-module-id>supercool</vf-module-id> - <vf-module-name>PCRF::module-2</vf-module-name> - <heat-stack-id>fastburn</heat-stack-id> - <orchestration-status>pending-create</orchestration-status> - <is-base-vf-module>false</is-base-vf-module> - <resource-version>330-89</resource-version> - <model-invariant-id>introvert</model-invariant-id> - <model-version-id>2.0</model-version-id> - <relationship-list> - <relationship> - <related-to>volume-group</related-to> - <relationship-data> - <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>cloud-region.cloud-region-id</relationship-key> - <relationship-value>pdk1</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>volume-group.volume-group-id</relationship-key> - <relationship-value>78987</relationship-value> - </relationship-data> - </relationship> - </relationship-list> -</vf-module>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VolumeGroup.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VolumeGroup.xml deleted file mode 100644 index 7e913dd418..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VolumeGroup.xml +++ /dev/null @@ -1,25 +0,0 @@ - <volume-group xmlns="http://com.aai.inventory/v7"> - <volume-group-id>78987</volume-group-id> - <volume-group-name>Volume_2</volume-group-name> - <heat-stack-id>slowburn</heat-stack-id> - <vnf-type>pcrf-capacity</vnf-type> - <orchestration-status>Active</orchestration-status> - <resource-version>0000020</resource-version> - <relationship-list> - <relationship> - <related-to>tenant</related-to> - <relationship-data> - <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>att-aic</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>cloud-region.cloud-region-id</relationship-key> - <relationship-value>MDTWNJ21</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>tenant.tenant-id</relationship-key> - <relationship-value>fba1bd1e195a404cacb9ce17a9b2b421</relationship-value> - </relationship-data> - </relationship> - </relationship-list> - </volume-group>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml b/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml index 236d435cb7..dea3f17f8e 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml +++ b/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml @@ -115,30 +115,6 @@ mso: version: '9' generic-vnf: version: '9' - v8: - customer: - uri: /aai/v8/business/customers/customer - generic-query: - uri: /aai/v8/search/generic-query - l3-network: - uri: /aai/v8/network/l3-networks/l3-network - network-policy: - uri: /aai/v8/network/network-policies/network-policy - nodes-query: - uri: /aai/v8/search/nodes-query - route-table-reference: - uri: /aai/v8/network/route-table-references/route-table-reference - tenant: - uri: /aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant - vce: - uri: /aai/v8/network/vces/vce - vpn-binding: - uri: /aai/v8/network/vpn-bindings/vpn-binding - v9: - cloud-region: - uri: /aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic - generic-vnf: - uri: /aai/v9/network/generic-vnfs/generic-vnf global: default: aai: |