diff options
Diffstat (limited to 'bpmn/MSOCommonBPMN')
66 files changed, 716 insertions, 1474 deletions
diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml index 5d9c1a3acd..ec8ad3127c 100644 --- a/bpmn/MSOCommonBPMN/pom.xml +++ b/bpmn/MSOCommonBPMN/pom.xml @@ -1,6 +1,5 @@ <?xml version="1.0"?> -<project - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" +<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <parent> @@ -23,7 +22,7 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.0</version> - <configuration> + <configuration> <compilerId>groovy-eclipse-compiler</compilerId> </configuration> 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 ecd90165c2..66e896ead7 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 @@ -38,8 +38,8 @@ import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.GenericVnf import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.client.HttpClient -import org.onap.so.client.aai.AAIVersion -import org.onap.so.client.aai.entities.uri.AAIUri +import org.onap.aaiclient.client.aai.AAIVersion +import org.onap.aaiclient.client.aai.entities.uri.AAIUri import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory 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 e83e7e2ea2..ec3dac511d 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 @@ -33,7 +33,7 @@ import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.client.HttpClientFactory -import org.onap.so.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.AAIResourcesClient import org.springframework.web.util.UriUtils import org.slf4j.Logger import org.slf4j.LoggerFactory 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 e5fff9c100..d85c387029 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 @@ -23,7 +23,7 @@ package org.onap.so.bpmn.common.scripts import org.onap.so.logger.LoggingAnchor -import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper import org.onap.logging.filter.base.ErrorCode import static org.apache.commons.lang3.StringUtils.isBlank; @@ -37,10 +37,10 @@ import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.AllottedResource import org.onap.so.bpmn.core.WorkflowException import org.onap.so.client.PreconditionFailedException -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.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy index 7b49fa06b3..91f73e2306 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy @@ -443,7 +443,6 @@ class CatalogDbUtils { String queryEndpoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + endPoint def responseData = '' HttpClient client = httpClientFactory.newJsonClient(new URL(queryEndpoint), ONAPComponents.CATALOG_DB) - client.addAdditionalHeader(ONAPLogConstants.Headers.REQUEST_ID, UUID.randomUUID().toString()) client.addAdditionalHeader('X-FromAppId', "BPMN") client.addAdditionalHeader('Accept', MediaType.APPLICATION_JSON) String basicAuthCred = execution.getVariable("BasicAuthHeaderValueDB") diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy index a86e1de772..40776e4925 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy @@ -51,7 +51,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { execution.setVariable("CMSO_mso-bpel-name",msoBpelName) if (utils.nodeExists(xml, "request-information")) { - throw new BpmnError("500", "FalloutHandler subflow does not support this request type.") + throw new BpmnError("500", "CompleteMsoProcess subflow does not support this request type.") } def request_id = "" @@ -60,7 +60,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { } } catch (BpmnError e) { - throw e; + exceptionUtil.buildAndThrowWorkflowException(execution, 500, e.getMessage()) } catch (Exception e) { logger.debug("Exception Occured During PreProcessRequest: " + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in preprocess") 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 9c8d8bfa12..c5a0e46fe5 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 @@ -26,9 +26,9 @@ package org.onap.so.bpmn.common.scripts import org.camunda.bpm.engine.delegate.DelegateExecution 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.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.LoggingAnchor 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 24375e59cc..f5cf541076 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 @@ -22,17 +22,18 @@ package org.onap.so.bpmn.common.scripts -import org.onap.so.logger.LoggingAnchor import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.VolumeGroup -import org.onap.so.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.AAIResultWrapper -import org.onap.so.client.aai.entities.Relationships -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory -import org.onap.so.constants.Defaults +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.Relationships +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder import org.onap.logging.filter.base.ErrorCode +import org.onap.so.constants.Defaults +import org.onap.so.logger.LoggingAnchor import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -71,7 +72,7 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{ if(relationships.isPresent()){ List<AAIResourceUri> tenantUris = relationships.get().getRelatedAAIUris(AAIObjectType.TENANT) for (AAIResourceUri tenantURI: tenantUris){ - volumeGroupTenantId = tenantURI.getURIKeys().get("tenant-id") + volumeGroupTenantId = tenantURI.getURIKeys().get(AAIFluentTypeBuilder.Types.TENANT.getUriParams().tenantId) } } //Determine if Tenant Ids match 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 c0124cfd50..9758c126a9 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 @@ -27,11 +27,11 @@ import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.GenericVnf import org.onap.aai.domain.yang.GenericVnfs import org.onap.so.bpmn.core.RollbackData -import org.onap.so.client.aai.AAIObjectPlurals -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.aaiclient.client.aai.AAIObjectPlurals +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth import org.onap.so.db.catalog.beans.OrchestrationStatus import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.LoggingAnchor 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 7e46784af2..8a74307df6 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 @@ -24,9 +24,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.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.slf4j.Logger import org.slf4j.LoggerFactory 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 4b33676955..8c6ebefc49 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 @@ -25,10 +25,10 @@ package org.onap.so.bpmn.common.scripts import org.onap.so.logger.LoggingAnchor import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.GenericVnf -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.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger 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 a5111a62d3..b390f7675a 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 @@ -186,7 +186,6 @@ class ExternalAPIUtil { HttpClient httpClient = httpClientFactory.newJsonClient(new URL(url), ONAPComponents.AAI) httpClient.addBasicAuthHeader(execution.getVariable("URN_externalapi_auth"), execution.getVariable("URN_mso_msoKey")) httpClient.addAdditionalHeader("X-FromAppId", "MSO") - httpClient.addAdditionalHeader("X-TransactionId", uuid) httpClient.addAdditionalHeader("Target",execution.getVariable("SPPartnerUrl")) apiResponse = httpClient.post(payload) 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 203ccb97f6..9593aa15be 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 @@ -38,10 +38,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.HttpClient -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.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth import org.onap.logging.filter.base.ONAPComponents; import org.onap.so.logger.MessageEnum import org.slf4j.Logger diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/NssmfAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/NssmfAdapterUtils.groovy new file mode 100644 index 0000000000..775f088136 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/NssmfAdapterUtils.groovy @@ -0,0 +1,149 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + # Copyright (c) 2019, CMCC Technologies Co., Ltd. + # + # 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.apache.commons.lang3.StringUtils +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONArray +import org.json.JSONObject +import org.onap.logging.filter.base.ErrorCode +import org.onap.logging.filter.base.ONAPComponents +import org.onap.logging.ref.slf4j.ONAPLogConstants +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.HttpClient +import org.onap.so.client.HttpClientFactory +import org.onap.so.logger.LoggingAnchor +import org.onap.so.logger.MessageEnum +import org.slf4j.Logger +import org.slf4j.LoggerFactory +import org.springframework.web.util.UriUtils + +import javax.ws.rs.core.MediaType +import javax.ws.rs.core.Response + +/*** + * Utilities for accessing Catalog DB Adapter to retrieve Networks, VNF/VFModules, AllottedResources and complete ServiceResources information + * + */ + +class NssmfAdapterUtils { + private static final Logger logger = LoggerFactory.getLogger( NssmfAdapterUtils.class); + + private HttpClientFactory httpClientFactory + private MsoUtils utils + private JsonUtils jsonUtils + + NssmfAdapterUtils(HttpClientFactory httpClientFactory, JsonUtils jsonUtils) { + this.httpClientFactory = httpClientFactory + this.utils = new MsoUtils() + this.jsonUtils = jsonUtils + } + + + public <T> T sendPostRequestNSSMF (DelegateExecution execution, String endPoint, String nssmfRequest, Class<T> entityType) { + try { + + String nssmfEndpoint = UrnPropertiesReader.getVariable("mso.adapters.nssmf.endpoint",execution) + String queryEndpoint = nssmfEndpoint + endPoint + def responseData + HttpClient client = httpClientFactory.newJsonClient(new URL(queryEndpoint), ONAPComponents.EXTERNAL) + String basicAuthCred = execution.getVariable("BasicAuthHeaderValue") + client.addAdditionalHeader("Authorization", StringUtils.defaultIfEmpty(basicAuthCred, getBasicDBAuthHeader(execution))) + + logger.debug('sending POST to NSSMF endpoint: ' + endPoint) + Response response = client.post(nssmfRequest) + + responseData = response.readEntity(entityType) + if (responseData != null) { + logger.debug("Received data from NSSMF: " + responseData) + } + + logger.debug('Response code:' + response.getStatus()) + logger.debug('Response:' + System.lineSeparator() + responseData) + if (response.getStatus() >= 200 && response.getStatus() < 300) { + // parse response as needed + return responseData + } + else { + return null + } + } + catch (Exception e) { + logger.debug("ERROR WHILE QUERYING CATALOG DB: " + e.message) + throw e + } + + } + + public String sendPostRequestNSSMF (DelegateExecution execution, String endPoint, String nssmfRequest) { + try { + + String nssmfEndpoint = UrnPropertiesReader.getVariable("mso.adapters.nssmf.endpoint",execution) + String queryEndpoint = nssmfEndpoint + endPoint + def responseData + HttpClient client = httpClientFactory.newJsonClient(new URL(queryEndpoint), ONAPComponents.EXTERNAL) + String basicAuthCred = execution.getVariable("BasicAuthHeaderValue") + client.addAdditionalHeader("Authorization", StringUtils.defaultIfEmpty(basicAuthCred, getBasicDBAuthHeader(execution))) + + logger.debug('sending POST to NSSMF endpoint: ' + endPoint) + Response response = client.post(nssmfRequest) + + responseData = response.readEntity(String.class) + if (responseData != null) { + logger.debug("Received data from NSSMF: " + responseData) + } + + logger.debug('Response code:' + response.getStatus()) + logger.debug('Response:' + System.lineSeparator() + responseData) + if (response.getStatus() >= 200 && response.getStatus() < 300) { + // parse response as needed + return responseData + } + else { + return null + } + } + catch (Exception e) { + logger.debug("ERROR WHILE QUERYING CATALOG DB: " + e.message) + throw e + } + + } + + + private String getBasicDBAuthHeader(DelegateExecution execution) { + + String encodedString = null + try { + String basicAuthValueDB = UrnPropertiesReader.getVariable("mso.adapters.db.auth", execution) + logger.debug("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB) + + encodedString = utils.getBasicAuth(basicAuthValueDB, UrnPropertiesReader.getVariable("mso.msoKey", execution)) + execution.setVariable("BasicAuthHeaderValue", encodedString) + } catch (IOException ex) { + String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage() + logger.error(dataErrorMessage) + } + return encodedString + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy index 34cbb00735..d307a4e7bc 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy @@ -534,6 +534,7 @@ class OofUtils { public String buildSelectNSTRequest(String requestId, Map<String, Object> profileInfo) { def transactionId = requestId logger.debug( "transactionId is: " + transactionId) + String callbackUrl = "http://0.0.0.0:9000/callback/" ObjectMapper objectMapper = new ObjectMapper() String json = objectMapper.writeValueAsString(profileInfo) StringBuilder response = new StringBuilder() @@ -543,11 +544,45 @@ class OofUtils { " \"transactionId\": \"${transactionId}\",\n" + " \"requestId\": \"${requestId}\",\n" + " \"sourceId\": \"so\",\n" + - " \"timeout\": 600\n" + + " \"timeout\": 600,\n" + + " \"callbackUrl\": \"${callbackUrl}\"\n" + " },\n") - response.append(",\n \"serviceInfo\": \n") + response.append(" \"serviceProfile\": {\n" + + " \"serviceProfileParameters\": ") + response.append(json); + response.append("\n }\n") + response.append("\n}\n") + return response.toString() + } + + public String buildSelectNSIRequest(String requestId, String nstInfo, Map<String, Object> profileInfo){ + + def transactionId = requestId + logger.debug( "transactionId is: " + transactionId) + String callbackUrl = "http://0.0.0.0:9000/callback/" + ObjectMapper objectMapper = new ObjectMapper(); + String json = objectMapper.writeValueAsString(profileInfo); + StringBuilder response = new StringBuilder(); + response.append( + "{\n" + + " \"requestInfo\": {\n" + + " \"transactionId\": \"${transactionId}\",\n" + + " \"requestId\": \"${requestId}\",\n" + + " \"sourceId\": \"so\",\n" + + " \"timeout\": 600,\n" + + " \"callbackUrl\": \"${callbackUrl}\"\n" + + " },\n" + + " \"serviceInfo\": {\n" + + " \"serviceInstanceId\": \"\",\n" + + " \"serviceName\": \"\"\n" + + " },\n" + + " \"NSTInfoList\": [\n") + response.append(nstInfo); + response.append("\n ],\n") + response.append("\n \"serviceProfile\": \n") response.append(json); response.append("\n }\n") return response.toString() } + } 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 50c4e56547..051f69381a 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 @@ -30,12 +30,12 @@ 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.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth import org.springframework.web.util.UriUtils import org.onap.so.logger.MessageEnum import org.slf4j.Logger diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy index ebaf65ff81..55f1187d69 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy @@ -224,9 +224,6 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { URL url = new URL(sdncAdapterUrl) HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.SDNC_ADAPTER) - httpClient.addAdditionalHeader("X-ONAP-RequestID", execution.getVariable("mso-request-id")) - httpClient.addAdditionalHeader("X-ONAP-InvocationID", UUID.randomUUID().toString()) - httpClient.addAdditionalHeader("X-ONAP-PartnerName", "SO-SDNCAdapter") httpClient.addAdditionalHeader("mso-request-id", execution.getVariable("mso-request-id")) httpClient.addAdditionalHeader("mso-service-instance-id", execution.getVariable("mso-service-instance-id")) httpClient.addAdditionalHeader("Authorization", execution.getVariable(prefix + "basicAuthHeaderValue")) 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 f19933fa8b..9a78472540 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 @@ -27,10 +27,10 @@ import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.GenericVnf 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.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth import org.onap.logging.filter.base.ErrorCode import org.onap.so.logger.MessageEnum import org.slf4j.Logger 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 9b12413177..20f9721b2e 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 @@ -27,9 +27,9 @@ import javax.ws.rs.NotFoundException 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.client.aai.AAIObjectType -import org.onap.so.client.aai.entities.uri.AAIResourceUri -import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy deleted file mode 100644 index e8f842471c..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy +++ /dev/null @@ -1,458 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Modifications Copyright (c) 2019 Samsung - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.common.scripts - -import org.onap.so.logger.LoggingAnchor -import org.onap.so.client.HttpClientFactory -import org.onap.logging.filter.base.ErrorCode - -import javax.ws.rs.core.Response -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.client.HttpClient -import org.onap.so.logger.MessageEnum -import org.slf4j.Logger -import org.slf4j.LoggerFactory -import org.onap.logging.filter.base.ONAPComponents; -import java.util.UUID -import org.onap.so.utils.Components - - -@Deprecated //Use vnfAdapterRestV2 -class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { - private static final Logger logger = LoggerFactory.getLogger( VnfAdapterRestV1.class); - - - ExceptionUtil exceptionUtil = new ExceptionUtil() - - // VNF Response Processing - public void preProcessRequest (DelegateExecution execution) { - def method = getClass().getSimpleName() + '.preProcessRequest(' + - 'execution=' + execution.getId() + - ')' - logger.trace('Entered ' + method) - - def prefix="VNFREST_" - execution.setVariable("prefix", prefix) - setSuccessIndicator(execution, false) - - try { - String request = validateRequest(execution, "mso-request-id") - - // Get the request type (the name of the root element) from the request - - Node root = new XmlParser().parseText(request) - String requestType = root.name() - execution.setVariable(prefix + 'requestType', requestType) - logger.debug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType) - - logger.debug('VnfAdapterRestV1, request: ' + request) - // Get the messageId from the request - - String messageId = getChildText(root, 'messageId') - - if ('rollbackVolumeGroupRequest'.equals(requestType)) { - messageId = getMessageIdForVolumeGroupRollback(root) - } - - if (messageId == null || messageId.isEmpty()) { - String msg = getProcessKey(execution) + ': no messageId in ' + requestType - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } - - execution.setVariable('VNFAResponse_CORRELATOR', messageId) - logger.debug(getProcessKey(execution) + ': VNFAResponse_CORRELATOR = ' + messageId) - - // Get the notificationUrl from the request - - String notificationUrl = getChildText(root, 'notificationUrl') - - if (notificationUrl == null || notificationUrl.isEmpty()) { - String msg = getProcessKey(execution) + ': no notificationUrl in ' + requestType - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } - - execution.setVariable(prefix + 'notificationUrl', notificationUrl) - logger.debug(getProcessKey(execution) + ': ' + prefix + 'notificationUrl = ' + notificationUrl) - - // Determine the VnfAdapter endpoint - - String vnfAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.vnf.rest.endpoint", execution) - - if (vnfAdapterEndpoint == null || vnfAdapterEndpoint.isEmpty()) { - String msg = getProcessKey(execution) + ': mso:adapters:vnf:rest:endpoint URN mapping is not defined' - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } - - while (vnfAdapterEndpoint.endsWith('/')) { - vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, vnfAdapterEndpoint.length()-1) - } - - String vnfAdapterMethod = null - String vnfAdapterUrl = null - String vnfAdapterRequest = request - - if ('createVfModuleRequest'.equals(requestType)) { - String vnfId = getChildText(root, 'vnfId') - - if (vnfId == null || vnfId.isEmpty()) { - String msg = getProcessKey(execution) + ': no vnfId in ' + requestType - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } - - vnfAdapterMethod = 'POST' - vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') + '/vf-modules' - - } else if ('updateVfModuleRequest'.equals(requestType)) { - String vnfId = getChildText(root, 'vnfId') - - if (vnfId == null || vnfId.isEmpty()) { - String msg = getProcessKey(execution) + ': no vnfId in ' + requestType - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } - - String vfModuleId = getChildText(root, 'vfModuleId') - - if (vfModuleId == null || vfModuleId.isEmpty()) { - String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } - - vnfAdapterMethod = 'PUT' - vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') + - '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8') - - } else if ('deleteVfModuleRequest'.equals(requestType)) { - String vnfId = getChildText(root, 'vnfId') - - if (vnfId == null || vnfId.isEmpty()) { - String msg = getProcessKey(execution) + ': no vnfId in ' + requestType - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } - - String vfModuleId = getChildText(root, 'vfModuleId') - - if (vfModuleId == null || vfModuleId.isEmpty()) { - String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } - - vnfAdapterMethod = 'DELETE' - vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') + - '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8') - - } else if ('rollbackVfModuleRequest'.equals(requestType)) { - Node vfModuleRollbackNode = getChild(root, 'vfModuleRollback') - - if (vfModuleRollbackNode == null) { - String msg = getProcessKey(execution) + ': no vfModuleRollback in ' + requestType - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } - - String vnfId = getChildText(vfModuleRollbackNode, 'vnfId') - - if (vnfId == null || vnfId.isEmpty()) { - String msg = getProcessKey(execution) + ': no vnfId in ' + requestType - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } - - String vfModuleId = getChildText(vfModuleRollbackNode, 'vfModuleId') - - if (vfModuleId == null || vfModuleId.isEmpty()) { - String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } - - vnfAdapterMethod = 'DELETE' - vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') + - '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8') + '/rollback' - - } else if ('createVolumeGroupRequest'.equals(requestType)) { - vnfAdapterMethod = 'POST' - if (vnfAdapterEndpoint.endsWith('v1/vnfs')) { - vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length())) - } - vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups' - - } else if ('updateVolumeGroupRequest'.equals(requestType)) { - String volumeGroupId = getChildText(root, 'volumeGroupId') - - if (volumeGroupId == null || volumeGroupId.isEmpty()) { - String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } - - vnfAdapterMethod = 'PUT' - if (vnfAdapterEndpoint.endsWith('v1/vnfs')) { - vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length())) - } - vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8') - - } else if ('deleteVolumeGroupRequest'.equals(requestType)) { - String volumeGroupId = getChildText(root, 'volumeGroupId') - - if (volumeGroupId == null || volumeGroupId.isEmpty()) { - String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } - - vnfAdapterMethod = 'DELETE' - if (vnfAdapterEndpoint.endsWith('v1/vnfs')) { - vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length())) - } - vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8') - - } else if ('rollbackVolumeGroupRequest'.equals(requestType)) { - String volumeGroupId = getVolumeGroupIdFromRollbackRequest(root) - - if (volumeGroupId == null || volumeGroupId.isEmpty()) { - String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } - - vnfAdapterMethod = 'DELETE' - if (vnfAdapterEndpoint.endsWith('v1/vnfs')) { - vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length())) - } - vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8') + '/rollback' - - } else { - String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } - - execution.setVariable(prefix + 'vnfAdapterMethod', vnfAdapterMethod) - logger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterMethod = ' + vnfAdapterMethod) - execution.setVariable(prefix + 'vnfAdapterUrl', vnfAdapterUrl) - logger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterUrl = ' + vnfAdapterUrl) - execution.setVariable(prefix + 'vnfAdapterRequest', vnfAdapterRequest) - logger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterRequest = \n' + vnfAdapterRequest) - - // Get the Basic Auth credentials for the VnfAdapter - - String basicAuthValue = UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution) - - if (basicAuthValue == null || basicAuthValue.isEmpty()) { - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN", - ErrorCode.UnknownError.getValue()); - } else { - try { - def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution)) - execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString) - } catch (IOException ex) { - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - getProcessKey(execution) + ": Unable to encode BasicAuth credentials for VnfAdapter", - "BPMN", ErrorCode.UnknownError.getValue(), ex); - } - } - - } catch (BpmnError e) { - logger.debug(" Rethrowing MSOWorkflowException") - throw e - } catch (Exception e) { - String msg = 'Caught exception in ' + method + ": " + e - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); - logger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } - } - - public String getVolumeGroupIdFromRollbackRequest(Node root) { - return root.'volumeGroupRollback'.'volumeGroupId'.text() - } - - public String getMessageIdForVolumeGroupRollback(Node root) { - return root.'volumeGroupRollback'.'messageId'.text() - } - - /** - * This method is used instead of an HTTP Connector task because the - * connector does not allow DELETE with a body. - */ - public void sendRequestToVnfAdapter(DelegateExecution execution) { - def method = getClass().getSimpleName() + '.sendRequestToVnfAdapter(' + - 'execution=' + execution.getId() + - ')' - logger.trace('Entered ' + method) - - String prefix = execution.getVariable('prefix') - - try { - String vnfAdapterMethod = execution.getVariable(prefix + 'vnfAdapterMethod') - String vnfAdapterUrl = execution.getVariable(prefix + 'vnfAdapterUrl') - String vnfAdapterRequest = execution.getVariable(prefix + 'vnfAdapterRequest') - - URL url = new URL(vnfAdapterUrl); - - HttpClient httpClient = new HttpClientFactory().newXmlClient(url, ONAPComponents.VNF_ADAPTER) - httpClient.addAdditionalHeader("Authorization", execution.getVariable(prefix + "basicAuthHeaderValue")) - - httpClient.addAdditionalHeader("X-ONAP-RequestID", execution.getVariable("mso-request-id")) - httpClient.addAdditionalHeader("X-ONAP-InvocationID", UUID.randomUUID().toString()) - httpClient.addAdditionalHeader("X-ONAP-PartnerName", "SO-VNFAdapter") - Response response; - - if ("GET".equals(vnfAdapterMethod)) { - response = httpClient.get() - } else if ("PUT".equals(vnfAdapterMethod)) { - response = httpClient.put(vnfAdapterRequest) - } else if ("POST".equals(vnfAdapterMethod)) { - response = httpClient.post(vnfAdapterRequest) - } else if ("DELETE".equals(vnfAdapterMethod)) { - response = httpClient.delete(vnfAdapterRequest) - } else { - String msg = 'Unsupported HTTP method "' + vnfAdapterMethod + '" in ' + method + ": " + e - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } - - execution.setVariable(prefix + "vnfAdapterStatusCode", response.getStatus()) - if(response.hasEntity()){ - execution.setVariable(prefix + "vnfAdapterResponse", response.readEntity(String.class)) - } - } catch (BpmnError e) { - throw e - } catch (Exception e) { - String msg = 'Caught exception in ' + method + ": " + e - logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) - } - } - - public void processCallback(DelegateExecution execution){ - def method = getClass().getSimpleName() + '.processCallback(' + - 'execution=' + execution.getId() + - ')' - logger.trace('Entered ' + method) - - String callback = execution.getVariable('VNFAResponse_MESSAGE') - - try { - logger.debug(getProcessKey(execution) + ": received callback:\n" + callback) - - // The XML callback is available to the calling flow in any case, - // even if a WorkflowException is generated. - execution.setVariable(getProcessKey(execution) + 'Response', callback) - // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead. - execution.setVariable("WorkflowResponse", callback) - - callback = utils.removeXmlPreamble(callback) - - Node root = new XmlParser().parseText(callback) - if (root.name().endsWith('Exception')) { - vnfAdapterWorkflowException(execution, callback) - } - } catch (Exception e) { - logger.debug("Error encountered within VnfAdapterRest ProcessCallback method: {}", e.getMessage(), e) - exceptionUtil.buildAndThrowWorkflowException(execution, 7020, "Error encountered within VnfAdapterRest ProcessCallback method", ONAPComponents.SO) - } - } - - /** - * Tries to parse the response as XML to extract the information to create - * a WorkflowException. If the response cannot be parsed, a more generic - * WorkflowException is created. - */ - public void vnfAdapterWorkflowException(DelegateExecution execution, Object response) { - try { - Node root = new XmlParser().parseText(response) - String category = getChildText(root, "category") - category = category == null || category.isEmpty() ? "" : " category='" + category + "'" - String message = getChildText(root, "message") - message = message == null || message.isEmpty() ? "" : " message='" + message + "'" - String rolledBack = getChildText(root, "rolledBack") - rolledBack = rolledBack == null || rolledBack.isEmpty() ? "" : " rolledBack='" + rolledBack + "'" - exceptionUtil.buildWorkflowException(execution, 7020, "Received " + root.name() + - " from VnfAdapter:" + category + message + rolledBack, Components.OPENSTACK); - } catch (Exception e) { - response = response == null || String.valueOf(response).isEmpty() ? "NONE" : response - exceptionUtil.buildWorkflowException(execution, 7020, "Received error from VnfAdapter: " + response, Components.OPENSTACK) - } - } - - /** - * Gets the named child of the specified node. - * @param node the node - * @param name the child name - * @return the child node, or null if no such child exists - */ - private Node getChild(Node node, String name) { - for (Node child : node.children()) { - if (child.name() == name) { - return child - } - } - return null - } - - /** - * Gets the text of the named child of the specified node. - * @param node the node - * @param name the child name - * @return the child node text, or null if no such child exists - */ - private String getChildText(Node node, String name) { - Node child = getChild(node, name) - return child == null ? null : child.text() - } - - public Logger getLogger() { - return logger; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy deleted file mode 100644 index 91b29d3867..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy +++ /dev/null @@ -1,97 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Modifications Copyright (c) 2019 Samsung - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.common.scripts - -import org.onap.so.logger.LoggingAnchor -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.onap.so.bpmn.core.WorkflowException -import org.onap.logging.filter.base.ErrorCode -import org.onap.so.logger.MessageEnum -import org.slf4j.Logger -import org.slf4j.LoggerFactory - - - -class VnfAdapterUtils { - private static final Logger logger = LoggerFactory.getLogger( VnfAdapterUtils.class); - - - private AbstractServiceTaskProcessor taskProcessor - - public VnfAdapterUtils(AbstractServiceTaskProcessor taskProcessor) { - this.taskProcessor = taskProcessor - } - - ExceptionUtil exceptionUtil = new ExceptionUtil() - - public void validateVnfResponse(DelegateExecution execution, String responseVar, String responseCodeVar, String errorResponseVar) { - def method = getClass().getSimpleName() + '.validateVnfResponse(' + - 'execution=' + execution.getId() + - ', responseVar=' + responseVar + - ', responseCodeVar=' + responseCodeVar + - ', errorResponseVar=' + errorResponseVar + - ')' - logger.trace('Entered ' + method) - - try { - def prefix = execution.getVariable('prefix') - - def response = execution.getVariable(responseVar) - def responseCode = execution.getVariable(responseCodeVar) - def errorResponse = execution.getVariable(errorResponseVar) - - // The following if statement never appears to be true as any VNF Adapter error seems to be stored in 'errorResponse'. - // Also, the value is stored as a WorkflowException object, not a String. Added the else if to provide the proper - // functionality but leaving the original code in case it is hit under some circumstances. - if (response.contains("WorkflowException")) { - execution.setVariable(prefix + "ErrorResponse", response) - //execution.setVariable(prefix + "ResponseCode", responseCode) - logger.debug(" Sub Vnf flow Error WorkflowException Response - " + "\n" + response) - throw new BpmnError("MSOWorkflowException") - } else if (errorResponse != null && errorResponse instanceof WorkflowException) { - // Not sure the variables with the associated prefix are still used - execution.setVariable(prefix + "ErrorResponse", errorResponse.getErrorMessage()) - execution.setVariable(prefix + "ResponseCode", errorResponse.getErrorCode()) - logger.debug("Sub Vnf flow Error WorkflowException " + prefix + "ErrorResponse" + " - " + errorResponse.getErrorMessage()) - // this is the important part to ensure we hit the Fallout Handler - throw new BpmnError("MSOWorkflowException") - } else if (errorResponse != null && errorResponse instanceof WorkflowException) { - // Not sure the variables with the associated prefix are still used - execution.setVariable(prefix + "ErrorResponse", errorResponse.getErrorMessage()) - execution.setVariable(prefix + "ResponseCode", errorResponse.getErrorCode()) - logger.debug("Sub Vnf flow Error WorkflowException " + prefix + "ErrorResponse" + " - " + errorResponse.getErrorMessage()) - // this is the important part to ensure we hit the Fallout Handler - throw new BpmnError("MSOWorkflowException") - } - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - 'Caught exception in ' + method, "BPMN", - ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); - exceptionUtil.buildAndThrowWorkflowException(execution, 5000, 'Internal Error- Unable to validate VNF Response ' + e.getMessage()) - } - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java index 9e9c4b5cfa..d966528f6c 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java @@ -21,7 +21,6 @@ package org.onap.so.bpmn.appc.payload; import java.util.Optional; -import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersHealthCheck; import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersQuiesce; import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersResumeTraffic; import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersDistributeTraffic; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java index 3791c5d461..21132aa665 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java @@ -20,15 +20,13 @@ package org.onap.so.bpmn.common; -import org.onap.so.client.aai.AAICommonObjectMapperProvider; -import org.onap.so.client.aai.AAIQueryClient; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider; +import org.onap.aaiclient.client.aai.AAIQueryClient; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; import org.onap.so.client.cds.CDSProcessingClient; import org.onap.so.client.cds.CDSProcessingListener; import org.onap.so.client.policy.PolicyClientImpl; -import org.onap.so.client.sdno.SDNOValidator; -import org.onap.so.client.sdno.SDNOValidatorImpl; import org.springframework.stereotype.Component; /* @@ -51,10 +49,6 @@ public class InjectionHelper { return new AAIQueryClient(); } - public SDNOValidator getSdnoValidator() { - return new SDNOValidatorImpl(); - } - public AAICommonObjectMapperProvider getAaiCommonObjectMapperProvider() { return new AAICommonObjectMapperProvider(); } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/OofInfraUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/OofInfraUtils.java index f25d4b440a..5f0cab3da8 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/OofInfraUtils.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/OofInfraUtils.java @@ -52,7 +52,7 @@ public class OofInfraUtils { getCloudsite = Optional.ofNullable(client.getCloudSite(cloudSite.getId(), endpoint + "/cloudSite/")) .orElse(new CloudSite()); if (!cloudSite.getId().equals(getCloudsite.getId())) { - client.postCloudSite(cloudSite); + client.postOofHomingCloudSite(cloudSite); logger.debug("Did not findd cloudsite : {}", cloudSite.getId()); logger.debug("Will create cloudSite: {}", cloudSite.toString()); } else { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/ShallowCopy.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/ShallowCopy.java index 3fc0808741..55a9f348c0 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/ShallowCopy.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/ShallowCopy.java @@ -20,10 +20,8 @@ package org.onap.so.bpmn.servicedecomposition; -import com.fasterxml.jackson.databind.ObjectMapper; import javax.persistence.Id; import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; public interface ShallowCopy<T> { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LineOfBusiness.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LineOfBusiness.java index 1105572e3a..e241696573 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LineOfBusiness.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LineOfBusiness.java @@ -21,7 +21,6 @@ package org.onap.so.bpmn.servicedecomposition.bbobjects; import java.io.Serializable; -import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; import org.apache.commons.lang3.builder.EqualsBuilder; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/License.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/License.java index 93d85daad1..fcc21f1df2 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/License.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/License.java @@ -23,10 +23,8 @@ package org.onap.so.bpmn.servicedecomposition.generalobjects; import java.io.Serializable; import java.util.ArrayList; import java.util.List; -import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; -import com.fasterxml.jackson.annotation.JsonInclude.Include; @JsonRootName("license") public class License implements Serializable { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/OrchestrationContext.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/OrchestrationContext.java index a98cdc712d..8f4a39a119 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/OrchestrationContext.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/OrchestrationContext.java @@ -23,7 +23,6 @@ package org.onap.so.bpmn.servicedecomposition.generalobjects; import java.io.Serializable; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; -import org.onap.so.bpmn.servicedecomposition.ShallowCopy; @JsonRootName("orchestration-context") public class OrchestrationContext implements Serializable { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionInfo.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionInfo.java index 643113573e..c9b8613be1 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionInfo.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionInfo.java @@ -23,7 +23,6 @@ package org.onap.so.bpmn.servicedecomposition.homingobjects; import java.io.Serializable; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; -import org.onap.so.bpmn.servicedecomposition.ShallowCopy; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; @JsonRootName("solution") diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoVolumeGroup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoVolumeGroup.java index bb493f5aa9..4466a2c741 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoVolumeGroup.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoVolumeGroup.java @@ -21,7 +21,6 @@ package org.onap.so.bpmn.servicedecomposition.modelinfo; import java.io.Serializable; -import com.fasterxml.jackson.annotation.JsonProperty; public class ModelInfoVolumeGroup extends ModelInfoVfModule implements Serializable { 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 f0954c3695..bfa77212c4 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 @@ -34,14 +34,36 @@ import java.util.UUID; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; import org.javatuples.Pair; +import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.Relationships; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.common.DelegateExecutionImpl; -import org.onap.so.bpmn.servicedecomposition.bbobjects.*; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; +import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy; import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; +import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Vnfc; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding; import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; @@ -52,12 +74,6 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException; import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.ServiceModelNotFoundException; -import org.onap.so.client.aai.AAICommonObjectMapperProvider; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.Relationships; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResource; @@ -77,7 +93,6 @@ import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.ModelType; import org.onap.so.serviceinstancebeans.Networks; -import org.onap.so.serviceinstancebeans.Pnfs; import org.onap.so.serviceinstancebeans.RelatedInstance; import org.onap.so.serviceinstancebeans.RelatedInstanceList; import org.onap.so.serviceinstancebeans.RequestDetails; @@ -108,6 +123,7 @@ public class BBInputSetup implements JavaDelegate { private static final String NETWORK_COLLECTION = "NetworkCollection"; private static final String PREPROV = "PREPROV"; private static final String CREATEVOLUME = "CreateVolume"; + private static final String CONTROLLER = "Controller"; @Autowired private BBInputSetupUtils bbInputSetupUtils; @@ -631,18 +647,22 @@ public class BBInputSetup implements JavaDelegate { break; } } + VfModuleCustomization vfResourceCustomization = null; if (vnfResourceCustomization != null) { - VfModuleCustomization vfResourceCustomization = vnfResourceCustomization.getVfModuleCustomizations() - .stream() // Convert to steam + vfResourceCustomization = vnfResourceCustomization.getVfModuleCustomizations().stream() // Convert to steam .filter(x -> modelInfo.getModelCustomizationId().equalsIgnoreCase(x.getModelCustomizationUUID()))// find // what // we // want .findAny() // If 'findAny' then return found .orElse(null); - if (vfResourceCustomization != null) { - vfModule.setModelInfoVfModule(this.mapperLayer.mapCatalogVfModuleToVfModule(vfResourceCustomization)); - } + } + if (vfResourceCustomization == null) { + vfResourceCustomization = bbInputSetupUtils + .getVfModuleCustomizationByModelCuztomizationUUID(modelInfo.getModelCustomizationId()); + } + if (vfResourceCustomization != null) { + vfModule.setModelInfoVfModule(this.mapperLayer.mapCatalogVfModuleToVfModule(vfResourceCustomization)); } } @@ -1040,7 +1060,8 @@ public class BBInputSetup implements JavaDelegate { protected ServiceSubscription getServiceSubscriptionFromURI(String resourceId, Customer customer) { Map<String, String> uriKeys = bbInputSetupUtils.getURIKeysFromServiceInstance(resourceId); - String subscriptionServiceType = uriKeys.get("service-type"); + String subscriptionServiceType = + uriKeys.get(AAIFluentTypeBuilder.Types.SERVICE_SUBSCRIPTION.getUriParams().serviceType); org.onap.aai.domain.yang.ServiceSubscription serviceSubscriptionAAI = bbInputSetupUtils.getAAIServiceSubscription(customer.getGlobalCustomerId(), subscriptionServiceType); if (serviceSubscriptionAAI != null) { @@ -1052,7 +1073,7 @@ public class BBInputSetup implements JavaDelegate { protected Customer getCustomerFromURI(String resourceId) { Map<String, String> uriKeys = bbInputSetupUtils.getURIKeysFromServiceInstance(resourceId); - String globalCustomerId = uriKeys.get("global-customer-id"); + String globalCustomerId = uriKeys.get(AAIFluentTypeBuilder.Types.CUSTOMER.getUriParams().globalCustomerId); org.onap.aai.domain.yang.Customer customerAAI = this.bbInputSetupUtils.getAAICustomer(globalCustomerId); if (customerAAI != null) { return mapperLayer.mapAAICustomer(customerAAI); @@ -1081,8 +1102,9 @@ public class BBInputSetup implements JavaDelegate { if (customer == null) { Map<String, String> uriKeys = bbInputSetupUtils .getURIKeysFromServiceInstance(parameter.getServiceInstance().getServiceInstanceId()); - String globalCustomerId = uriKeys.get("global-customer-id"); - String subscriptionServiceType = uriKeys.get("service-type"); + String globalCustomerId = uriKeys.get(AAIFluentTypeBuilder.Types.CUSTOMER.getUriParams().globalCustomerId); + String subscriptionServiceType = + uriKeys.get(AAIFluentTypeBuilder.Types.SERVICE_SUBSCRIPTION.getUriParams().serviceType); customer = mapCustomer(globalCustomerId, subscriptionServiceType); } outputBB.setServiceInstance(parameter.getServiceInstance()); @@ -1383,7 +1405,8 @@ public class BBInputSetup implements JavaDelegate { cloudRegion = mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion); } gBB.setCloudRegion(cloudRegion); - if (bbName.contains(VNF)) { + if (bbName.contains(VNF) || (bbName.contains(CONTROLLER) + && (VNF).equalsIgnoreCase(executeBB.getBuildingBlock().getBpmnScope()))) { for (GenericVnf genericVnf : serviceInstance.getVnfs()) { if (lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID) != null && genericVnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) { @@ -1395,7 +1418,8 @@ public class BBInputSetup implements JavaDelegate { this.mapCatalogVnf(genericVnf, modelInfo, service); } } - } else if (bbName.contains(VF_MODULE)) { + } else if (bbName.contains(VF_MODULE) || (bbName.contains(CONTROLLER) + && (VF_MODULE).equalsIgnoreCase(executeBB.getBuildingBlock().getBpmnScope()))) { for (GenericVnf vnf : serviceInstance.getVnfs()) { for (VfModule vfModule : vnf.getVfModules()) { if (lookupKeyMap.get(ResourceKey.VF_MODULE_ID) != null @@ -1499,7 +1523,8 @@ public class BBInputSetup implements JavaDelegate { BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(executeBB.getRequestId()).setService(service) .setBbName(bbName).setServiceInstance(serviceInstance).setLookupKeyMap(lookupKeyMap).build(); - if (bbName.contains(VNF)) { + if (bbName.contains(VNF) || (bbName.contains(CONTROLLER) + && (VNF).equalsIgnoreCase(executeBB.getBuildingBlock().getBpmnScope()))) { vnfs = findVnfsByKey(key, resources, vnfs); String vnfId = lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID); // This stores the vnf id in request db to be retrieved later when @@ -1527,7 +1552,8 @@ public class BBInputSetup implements JavaDelegate { resources.getPnfs().stream() .filter(pnfs -> Objects.equals(key, pnfs.getModelInfo().getModelCustomizationId())).findFirst() .ifPresent(pnfs -> BBInputSetupPnf.populatePnfToServiceInstance(pnfs, pnfId, serviceInstance)); - } else if (bbName.contains(VF_MODULE) || bbName.contains(VOLUME_GROUP)) { + } else if (bbName.contains(VF_MODULE) || bbName.contains(VOLUME_GROUP) || (bbName.contains(CONTROLLER) + && (VF_MODULE).equalsIgnoreCase(executeBB.getBuildingBlock().getBpmnScope()))) { Pair<Vnfs, VfModules> vnfsAndVfModules = getVfModulesAndItsVnfsByKey(key, resources); if (vnfsAndVfModules != null) { vfModules = vnfsAndVfModules.getValue1(); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java index 68161a8dd5..4379864bfe 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java @@ -23,7 +23,6 @@ package org.onap.so.bpmn.servicedecomposition.tasks; import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; -import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoPnf; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.onap.so.serviceinstancebeans.Pnfs; @@ -37,10 +36,6 @@ final class BBInputSetupPnf { Pnf pnf = new Pnf(); pnf.setPnfId(pnfId); pnf.setPnfName(pnfs.getInstanceName()); - pnf.setModelInfoPnf(new ModelInfoPnf()); - pnf.getModelInfoPnf().setModelCustomizationUuid(pnfs.getModelInfo().getModelCustomizationId()); - pnf.getModelInfoPnf().setModelInvariantUuid(pnfs.getModelInfo().getModelInvariantId()); - pnf.getModelInfoPnf().setModelUuid(pnfs.getModelInfo().getModelVersionId()); pnf.setOrchestrationStatus(OrchestrationStatus.PRECREATED); serviceInstance.getPnfs().add(pnf); 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 85f5f1f728..4e0b5634ea 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 @@ -48,14 +48,14 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.MultipleObjectsFoundException; import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException; -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.AAIPluralResourceUri; -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.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth; import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAI.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAI.java index e4012e1290..c7e3234a56 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAI.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAI.java @@ -28,10 +28,10 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; -import org.onap.so.client.aai.AAICommonObjectMapperProvider; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.Relationships; +import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.Relationships; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java index c05557a317..c6a921abb5 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java @@ -20,8 +20,9 @@ package org.onap.so.client.appc; -import java.util.HashMap; +import java.io.IOException; import java.util.List; +import java.util.Map; import java.util.Optional; import org.onap.appc.client.lcm.model.Action; import org.onap.appc.client.lcm.model.Status; @@ -40,10 +41,11 @@ public class ApplicationControllerAction { protected ApplicationControllerOrchestrator client = new ApplicationControllerOrchestrator(); private String errorCode = "1002"; private String errorMessage = "Unable to reach App C Servers"; + private static final String PAYLOAD_NOT_PRESENT_ERROR_MSG = "Payload is not present for "; private static Logger logger = LoggerFactory.getLogger(ApplicationControllerAction.class); public void runAppCCommand(Action action, String msoRequestId, String vnfId, Optional<String> payload, - HashMap<String, String> payloadInfo, String controllerType) { + Map<String, String> payloadInfo, String controllerType) { Status appCStatus = null; try { String vnfName = payloadInfo.getOrDefault("vnfName", ""); @@ -96,20 +98,8 @@ public class ApplicationControllerAction { logger.warn("vserverIds null in AppCClient"); break; } - String vmId = ""; - String vserverId = ""; - ObjectMapper mapper = new ObjectMapper(); - List<String> vmIdJsonList = mapper.readValue(vmIds, new TypeReference<List<String>>() {}); - List<String> vserverIdJsonList = mapper.readValue(vserverIds, new TypeReference<List<String>>() {}); - int i = 0; - while (i < vmIdJsonList.size()) { - vmId = vmIdJsonList.get(i); - vserverId = vserverIdJsonList.get(i); - Optional<String> vserverIdString = Optional.of(vserverId); - appCStatus = - snapshotAction(msoRequestId, vnfId, vmId, vserverIdString, identityUrl, controllerType); - i++; - } + appCStatus = getSnapshotActionAppcStatus(msoRequestId, vnfId, controllerType, identityUrl, vmIds, + vserverIds); break; case ConfigModify: case ConfigScaleOut: @@ -140,29 +130,44 @@ public class ApplicationControllerAction { logger.error("Error building Appc request: {}", e.getMessage(), e); errorCode = "1002"; errorMessage = e.getMessage(); - } catch (NoSuchMethodError e) { - logger.error("Error building Appc request: {}", e.getMessage(), e); - errorMessage = e.getMessage(); } catch (Exception e) { logger.error("Error building Appc request: {}", e.getMessage(), e); errorMessage = e.getMessage(); } } + private Status getSnapshotActionAppcStatus(String msoRequestId, String vnfId, String controllerType, + String identityUrl, String vmIds, String vserverIds) + throws IOException, ApplicationControllerOrchestratorException { + Status appcStatus = null; + String vmId = ""; + String vserverId = ""; + ObjectMapper mapper = new ObjectMapper(); + List<String> vmIdJsonList = mapper.readValue(vmIds, new TypeReference<List<String>>() {}); + List<String> vserverIdJsonList = mapper.readValue(vserverIds, new TypeReference<List<String>>() {}); + int i = 0; + while (i < vmIdJsonList.size()) { + vmId = vmIdJsonList.get(i); + vserverId = vserverIdJsonList.get(i); + Optional<String> vserverIdString = Optional.of(vserverId); + appcStatus = snapshotAction(msoRequestId, vnfId, vmId, vserverIdString, identityUrl, controllerType); + i++; + } + return appcStatus; + } + private Status payloadAction(Action action, String msoRequestId, String vnfId, Optional<String> payload, - String controllerType) - throws JsonProcessingException, IllegalArgumentException, ApplicationControllerOrchestratorException { + String controllerType) throws ApplicationControllerOrchestratorException { if (!(payload.isPresent())) { - throw new IllegalArgumentException("Payload is not present for " + action.toString()); + throw new IllegalArgumentException(PAYLOAD_NOT_PRESENT_ERROR_MSG + action.toString()); } return client.vnfCommand(action, msoRequestId, vnfId, Optional.empty(), payload, controllerType); } private Status quiesceTrafficAction(String msoRequestId, String vnfId, Optional<String> payload, String vnfName, - String controllerType) - throws JsonProcessingException, IllegalArgumentException, ApplicationControllerOrchestratorException { + String controllerType) throws JsonProcessingException, ApplicationControllerOrchestratorException { if (!(payload.isPresent())) { - throw new IllegalArgumentException("Payload is not present for " + Action.QuiesceTraffic.toString()); + throw new IllegalArgumentException(PAYLOAD_NOT_PRESENT_ERROR_MSG + Action.QuiesceTraffic.toString()); } payload = PayloadClient.quiesceTrafficFormat(payload, vnfName); return client.vnfCommand(Action.QuiesceTraffic, msoRequestId, vnfId, Optional.empty(), payload, controllerType); @@ -170,19 +175,18 @@ public class ApplicationControllerAction { private Status upgradeAction(Action action, String msoRequestId, String vnfId, Optional<String> payload, String vnfName, String controllerType) - throws JsonProcessingException, IllegalArgumentException, ApplicationControllerOrchestratorException { + throws JsonProcessingException, ApplicationControllerOrchestratorException { if (!(payload.isPresent())) { - throw new IllegalArgumentException("Payload is not present for " + action.toString()); + throw new IllegalArgumentException(PAYLOAD_NOT_PRESENT_ERROR_MSG + action.toString()); } payload = PayloadClient.upgradeFormat(payload, vnfName); return client.vnfCommand(action, msoRequestId, vnfId, Optional.empty(), payload, controllerType); } private Status distributeTrafficAction(String msoRequestId, String vnfId, Optional<String> payload, String vnfName, - String controllerType) - throws JsonProcessingException, IllegalArgumentException, ApplicationControllerOrchestratorException { + String controllerType) throws JsonProcessingException, ApplicationControllerOrchestratorException { if (!(payload.isPresent())) { - throw new IllegalArgumentException("Payload is not present for " + Action.DistributeTraffic.toString()); + throw new IllegalArgumentException(PAYLOAD_NOT_PRESENT_ERROR_MSG + Action.DistributeTraffic.toString()); } payload = PayloadClient.distributeTrafficFormat(payload, vnfName); return client.vnfCommand(Action.DistributeTraffic, msoRequestId, vnfId, Optional.empty(), payload, @@ -191,10 +195,10 @@ public class ApplicationControllerAction { private Status distributeTrafficCheckAction(String msoRequestId, String vnfId, Optional<String> payload, String vnfName, String controllerType) - throws JsonProcessingException, IllegalArgumentException, ApplicationControllerOrchestratorException { + throws JsonProcessingException, ApplicationControllerOrchestratorException { if (!(payload.isPresent())) { throw new IllegalArgumentException( - "Payload is not present for " + Action.DistributeTrafficCheck.toString()); + PAYLOAD_NOT_PRESENT_ERROR_MSG + Action.DistributeTrafficCheck.toString()); } payload = PayloadClient.distributeTrafficCheckFormat(payload, vnfName); return client.vnfCommand(Action.DistributeTrafficCheck, msoRequestId, vnfId, Optional.empty(), payload, diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerConfiguration.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerConfiguration.java index 165d9577af..b39ba5f63f 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerConfiguration.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerConfiguration.java @@ -22,7 +22,6 @@ package org.onap.so.client.appc; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; -import org.springframework.stereotype.Service; @Configuration public class ApplicationControllerConfiguration { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerSupport.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerSupport.java index 10d3d85ffc..144cb257a6 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerSupport.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerSupport.java @@ -26,7 +26,6 @@ import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import org.springframework.stereotype.Component; import org.onap.appc.client.lcm.api.LifeCycleManagerStateful; import org.onap.appc.client.lcm.api.ResponseHandler; import org.onap.appc.client.lcm.model.Status; @@ -36,7 +35,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectWriter; -import org.springframework.stereotype.Service; public class ApplicationControllerSupport { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/PayloadConstants.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/PayloadConstants.java index 808d427d65..2812de799d 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/PayloadConstants.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/PayloadConstants.java @@ -6,6 +6,8 @@ * ================================================================================ * Modifications Copyright (C) 2020 Nordix * ================================================================================ + * Modifications Copyright (c) 2020 Tech Mahindra + * ================================================================================ * 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 @@ -36,7 +38,7 @@ public final class PayloadConstants { public static final String SEPARATOR = "-"; public static final String PNF_SCOPE = "pnf"; public static final String VNF_SCOPE = "vnf"; - public static final String VF_MODULE_SCOPE = "vfModule"; + public static final String VF_MODULE_SCOPE = "vfmodule"; public static final String SERVICE_SCOPE = "service"; public static final String RESOLUTION_KEY = "resolution-key"; public static final String CDS_ACTOR = "cds"; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VfModuleCDSRequestProvider.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VfModuleCDSRequestProvider.java index bba8925f21..478b65c349 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VfModuleCDSRequestProvider.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VfModuleCDSRequestProvider.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2019 Bell Canada * ================================================================================ + * Modifications Copyright (c) 2020 Tech Mahindra + * ================================================================================ * 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 @@ -31,7 +33,6 @@ import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.exception.PayloadGenerationException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.ConfigurableBeanFactory; -import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; import java.util.List; @@ -81,8 +82,8 @@ public class VfModuleCDSRequestProvider implements CDSRequestProvider { final String modelCustomizationUuidForVnf = genericVnf.getModelInfoGenericVnf().getModelCustomizationUuid(); - blueprintName = genericVnf.getBlueprintName(); - blueprintVersion = genericVnf.getBlueprintVersion(); + blueprintName = genericVnf.getModelInfoGenericVnf().getBlueprintName(); + blueprintVersion = genericVnf.getModelInfoGenericVnf().getBlueprintVersion(); VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); vfModuleName = vfModule.getVfModuleName(); @@ -103,9 +104,10 @@ public class VfModuleCDSRequestProvider implements CDSRequestProvider { final GeneralBuildingBlock buildingBlock = execution.getGeneralBuildingBlock(); List<Map<String, Object>> userParamsFromRequest = buildingBlock.getRequestContext().getRequestParameters().getUserParams(); - - configureInstanceParamsForVfModule.populateInstanceParams(vfModuleObject, userParamsFromRequest, - modelCustomizationUuidForVnf, modelCustomizationUuidForVfModule); + if (userParamsFromRequest != null && userParamsFromRequest.size() != 0) { + configureInstanceParamsForVfModule.populateInstanceParams(vfModuleObject, userParamsFromRequest, + modelCustomizationUuidForVnf, modelCustomizationUuidForVfModule); + } } catch (Exception e) { throw new PayloadGenerationException("Failed to buildPropertyObject for VF-Module", e); } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VnfCDSRequestProvider.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VnfCDSRequestProvider.java index d33976d229..6251eb6fad 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VnfCDSRequestProvider.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VnfCDSRequestProvider.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2019 Bell Canada * ================================================================================ + * Modifications Copyright (c) 2020 Tech Mahindra + * ================================================================================ * 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 @@ -79,8 +81,8 @@ public class VnfCDSRequestProvider implements CDSRequestProvider { final String modelCustomizationUuid = genericVnf.getModelInfoGenericVnf().getModelCustomizationUuid(); resolutionKey = genericVnf.getVnfName(); - blueprintName = genericVnf.getBlueprintName(); - blueprintVersion = genericVnf.getBlueprintVersion(); + blueprintName = genericVnf.getModelInfoGenericVnf().getBlueprintName(); + blueprintVersion = genericVnf.getModelInfoGenericVnf().getBlueprintVersion(); vnfObject.addProperty("service-instance-id", serviceInstance.getServiceInstanceId()); vnfObject.addProperty("service-model-uuid", serviceInstance.getModelInfoServiceInstance().getModelUuid()); @@ -91,9 +93,10 @@ public class VnfCDSRequestProvider implements CDSRequestProvider { final GeneralBuildingBlock buildingBlock = execution.getGeneralBuildingBlock(); List<Map<String, Object>> userParamsFromRequest = buildingBlock.getRequestContext().getRequestParameters().getUserParams(); - - configureInstanceParamsForVnf.populateInstanceParams(vnfObject, userParamsFromRequest, - modelCustomizationUuid); + if (userParamsFromRequest != null && userParamsFromRequest.size() != 0) { + configureInstanceParamsForVnf.populateInstanceParams(vnfObject, userParamsFromRequest, + modelCustomizationUuid); + } } catch (Exception e) { throw new PayloadGenerationException("Failed to buildPropertyObjectForVnf", e); } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java index 30fd2c8770..948c9326d8 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java @@ -38,8 +38,8 @@ import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider; import org.onap.logging.filter.base.ErrorCode; import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; @@ -80,7 +80,7 @@ public class ExceptionBuilder { } logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue(), msg.toString()); + ErrorCode.UnknownError.getValue(), msg); execution.setVariable(errorVariable, exception.getMessage()); } catch (Exception ex) { // log trace, allow process to complete gracefully @@ -113,7 +113,7 @@ public class ExceptionBuilder { } logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue(), msg.toString()); + ErrorCode.UnknownError.getValue(), msg); execution.setVariable(errorVariable, exception.getMessage()); } catch (Exception ex) { // log trace, allow process to complete gracefully @@ -144,7 +144,7 @@ public class ExceptionBuilder { } } logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue(), msg.toString()); + ErrorCode.UnknownError.getValue(), msg); execution.setVariable(errorVariable, exception.getMessage()); } catch (Exception ex) { // log trace, allow process to complete gracefully @@ -176,7 +176,7 @@ public class ExceptionBuilder { } } logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", - ErrorCode.UnknownError.getValue(), msg.toString()); + ErrorCode.UnknownError.getValue(), msg); execution.setVariable(errorVariable, exception.getMessage()); } catch (Exception ex) { // log trace, allow process to complete gracefully @@ -260,7 +260,7 @@ public class ExceptionBuilder { public void processAuditException(DelegateExecutionImpl execution, boolean flowShouldContinue) { logger.debug("Processing Audit Results"); - String auditListString = (String) execution.getVariable("auditInventoryResult"); + String auditListString = execution.getVariable("auditInventoryResult"); String processKey = getProcessKey(execution.getDelegateExecution()); if (auditListString != null) { StringBuilder errorMessage = new StringBuilder(); @@ -304,6 +304,7 @@ public class ExceptionBuilder { } catch (IOException | BBObjectNotFoundException e) { errorMessage = errorMessage.append("process objects in AAI. "); + logger.error("Exception occurred in processAuditException", e); } if (flowShouldContinue) { @@ -329,7 +330,7 @@ public class ExceptionBuilder { } } - public void processVnfAdapterException(DelegateExecution execution) { + public void processOpenstackAdapterException(DelegateExecution execution) { StringBuilder workflowExceptionMessage = new StringBuilder(); logger.debug("Processing Vnf Adapter Exception"); try { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java index c88e9ae34f..692d581b0d 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java @@ -23,8 +23,8 @@ package org.onap.so.client.restproperties; import java.net.MalformedURLException; import java.net.URL; import org.onap.so.bpmn.core.UrnPropertiesReader; -import org.onap.so.client.aai.AAIProperties; -import org.onap.so.client.aai.AAIVersion; +import org.onap.aaiclient.client.aai.AAIProperties; +import org.onap.aaiclient.client.aai.AAIVersion; import org.springframework.stereotype.Component; @Component @@ -33,11 +33,10 @@ public class AAIPropertiesImpl implements AAIProperties { public static final String MSO_MSO_KEY = "mso.msoKey"; public static final String AAI_AUTH = "aai.auth"; public static final String AAI_ENDPOINT = "aai.endpoint"; - private UrnPropertiesReader reader; @Override public URL getEndpoint() throws MalformedURLException { - return new URL(reader.getVariable(AAI_ENDPOINT)); + return new URL(UrnPropertiesReader.getVariable(AAI_ENDPOINT)); } @Override @@ -52,11 +51,11 @@ public class AAIPropertiesImpl implements AAIProperties { @Override public String getAuth() { - return reader.getVariable(AAI_AUTH); + return UrnPropertiesReader.getVariable(AAI_AUTH); } @Override public String getKey() { - return reader.getVariable(MSO_MSO_KEY); + return UrnPropertiesReader.getVariable(MSO_MSO_KEY); } } diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterTask.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/OpenstackAdapterTask.bpmn index 69b68e534e..e437f13d7b 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterTask.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/OpenstackAdapterTask.bpmn @@ -1,6 +1,6 @@ <?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_GraPIIyxEeWmdMDkx6Uftw" 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="vnfAdapterTask" name="vnfAdapterTask" isExecutable="true"> +<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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_GraPIIyxEeWmdMDkx6Uftw" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> + <bpmn2:process id="openstackAdapterTask" name="openstackAdapterTask" isExecutable="true"> <bpmn2:endEvent id="EndEvent_6"> <bpmn2:incoming>SequenceFlow_13uy51h</bpmn2:incoming> </bpmn2:endEvent> @@ -24,10 +24,10 @@ <bpmn2:outgoing>SequenceFlow_0o8wnkx</bpmn2:outgoing> </bpmn2:exclusiveGateway> <bpmn2:sequenceFlow id="SequenceFlow_13uy51h" name="Yes" sourceRef="ExclusiveGateway_1fn953y" targetRef="EndEvent_6"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("OpenstackPollSuccess") == true }]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("OpenstackPollSuccess") == true }</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_0o8wnkx" name="No" sourceRef="ExclusiveGateway_1fn953y" targetRef="EndEvent_1dt01ez"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("OpenstackPollSuccess") == false }]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("OpenstackPollSuccess") == false }</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:exclusiveGateway id="ExclusiveGateway_08a6you" name="Success?"> <bpmn2:incoming>SequenceFlow_1ff2y8j</bpmn2:incoming> @@ -35,10 +35,10 @@ <bpmn2:outgoing>SequenceFlow_007m32h</bpmn2:outgoing> </bpmn2:exclusiveGateway> <bpmn2:sequenceFlow id="SequenceFlow_1p39f4r" name="Yes" sourceRef="ExclusiveGateway_08a6you" targetRef="ServiceTask_11iuzx9"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("OpenstackInvokeSuccess") == true }]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("OpenstackInvokeSuccess") == true }</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_007m32h" name="No" sourceRef="ExclusiveGateway_08a6you" targetRef="EndEvent_0rxprkw"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("OpenstackInvokeSuccess") == false }]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("OpenstackInvokeSuccess") == false }</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:subProcess id="SubProcess_0y17e8j" name="Error Handling" triggeredByEvent="true"> <bpmn2:startEvent id="StartEvent_17oglfe"> @@ -48,7 +48,7 @@ <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_040yoan"> <bpmn2:incoming>SequenceFlow_0y1by9x</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_006myq9</bpmn2:outgoing> - <bpmn2:compensateEventDefinition waitForCompletion="true" activityRef="executeOpenstackAction" /> + <bpmn2:compensateEventDefinition activityRef="executeOpenstackAction" /> </bpmn2:intermediateThrowEvent> <bpmn2:exclusiveGateway id="ExclusiveGateway_0qlnby0" name="Poll Rollback Status?" default="SequenceFlow_1piwh1c"> <bpmn2:incoming>SequenceFlow_006myq9</bpmn2:incoming> @@ -66,13 +66,13 @@ <bpmn2:incoming>SequenceFlow_1nku4uk</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1yx80cq</bpmn2:outgoing> </bpmn2:exclusiveGateway> - <bpmn2:serviceTask id="buildError" name=" Process Exception " camunda:expression="${ExceptionBuilder.processVnfAdapterException(execution)}"> + <bpmn2:serviceTask id="buildError" name=" Process Exception " camunda:expression="${ExceptionBuilder.processOpenstackAdapterException(execution)}"> <bpmn2:incoming>SequenceFlow_1yx80cq</bpmn2:incoming> <bpmn2:incoming>SequenceFlow_1az3a2q</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0bnzfqb</bpmn2:outgoing> </bpmn2:serviceTask> <bpmn2:sequenceFlow id="SequenceFlow_1ubla93" name="Yes" sourceRef="ExclusiveGateway_0qlnby0" targetRef="ServiceTask_120p27h"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("PollRollbackStatus") == true}]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("PollRollbackStatus") == true}</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_1piwh1c" name="No" sourceRef="ExclusiveGateway_0qlnby0" targetRef="ExclusiveGateway_0tuxj9l" /> <bpmn2:sequenceFlow id="SequenceFlow_1nku4uk" sourceRef="ServiceTask_120p27h" targetRef="ExclusiveGateway_0tuxj9l" /> @@ -88,7 +88,7 @@ <bpmn2:outgoing>SequenceFlow_1az3a2q</bpmn2:outgoing> </bpmn2:exclusiveGateway> <bpmn2:sequenceFlow id="SequenceFlow_0y1by9x" name="Yes" sourceRef="ExclusiveGateway_18ndby1" targetRef="IntermediateThrowEvent_040yoan"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("backout") == true }]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{execution.getVariable("backout") == true }</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_1az3a2q" name="No" sourceRef="ExclusiveGateway_18ndby1" targetRef="buildError" /> </bpmn2:subProcess> @@ -109,226 +109,226 @@ <bpmn2:error id="Error_1" name="MSO Workflow Exception" errorCode="MSOWorkflowException" /> <bpmn2:message id="Message_1" name="WorkflowMessage" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="vnfAdapterTask"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="openstackAdapterTask"> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_54" bpmnElement="StartEvent_1"> - <dc:Bounds x="110" y="146" width="36" height="36" /> + <dc:Bounds x="160" y="146" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="116" y="187" width="24" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_StartEvent_54" targetElement="ServiceTask_0rcy900_di"> - <di:waypoint xsi:type="dc:Point" x="146" y="164" /> - <di:waypoint xsi:type="dc:Point" x="253" y="163" /> + <di:waypoint x="196" y="164" /> + <di:waypoint x="303" y="163" /> <bpmndi:BPMNLabel> <dc:Bounds x="154.5" y="145.5" width="90" height="6" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="_BPMNShape_EndEvent_158" bpmnElement="EndEvent_6"> - <dc:Bounds x="929" y="146" width="36" height="36" /> + <dc:Bounds x="979" y="146" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="924" y="187" width="46" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0rcy900_di" bpmnElement="executeOpenstackAction"> - <dc:Bounds x="253" y="124" width="100" height="80" /> + <dc:Bounds x="303" y="124" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1ff2y8j_di" bpmnElement="SequenceFlow_1ff2y8j"> - <di:waypoint xsi:type="dc:Point" x="353" y="164" /> - <di:waypoint xsi:type="dc:Point" x="404" y="164" /> + <di:waypoint x="403" y="164" /> + <di:waypoint x="454" y="164" /> <bpmndi:BPMNLabel> <dc:Bounds x="333.5" y="139" width="90" height="20" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_11iuzx9_di" bpmnElement="ServiceTask_11iuzx9"> - <dc:Bounds x="541" y="124" width="100" height="80" /> + <dc:Bounds x="591" y="124" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0ecut35_di" bpmnElement="SequenceFlow_0ecut35"> - <di:waypoint xsi:type="dc:Point" x="641" y="164" /> - <di:waypoint xsi:type="dc:Point" x="676" y="164" /> + <di:waypoint x="691" y="164" /> + <di:waypoint x="726" y="164" /> <bpmndi:BPMNLabel> <dc:Bounds x="613.5" y="139" width="90" height="20" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_1fn953y_di" bpmnElement="ExclusiveGateway_1fn953y" isMarkerVisible="true"> - <dc:Bounds x="676" y="139" width="50" height="50" /> + <dc:Bounds x="726" y="139" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="676" y="119" width="49" height="12" /> + <dc:Bounds x="727" y="119" width="48" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_13uy51h_di" bpmnElement="SequenceFlow_13uy51h"> - <di:waypoint xsi:type="dc:Point" x="726" y="164" /> - <di:waypoint xsi:type="dc:Point" x="929" y="164" /> + <di:waypoint x="776" y="164" /> + <di:waypoint x="979" y="164" /> <bpmndi:BPMNLabel> - <dc:Bounds x="746.6875" y="166" width="19" height="12" /> + <dc:Bounds x="797" y="166" width="18" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0o8wnkx_di" bpmnElement="SequenceFlow_0o8wnkx"> - <di:waypoint xsi:type="dc:Point" x="701" y="189" /> - <di:waypoint xsi:type="dc:Point" x="701" y="249" /> + <di:waypoint x="751" y="189" /> + <di:waypoint x="751" y="249" /> <bpmndi:BPMNLabel> - <dc:Bounds x="706" y="198" width="14" height="12" /> + <dc:Bounds x="756" y="198" width="15" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_120p27h_di" bpmnElement="ServiceTask_120p27h"> - <dc:Bounds x="496" y="443" width="100" height="80" /> + <dc:Bounds x="546" y="443" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_08a6you_di" bpmnElement="ExclusiveGateway_08a6you" isMarkerVisible="true"> - <dc:Bounds x="404" y="139" width="50" height="50" /> + <dc:Bounds x="454" y="139" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="409" y="117" width="49" height="12" /> + <dc:Bounds x="460" y="117" width="48" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1p39f4r_di" bpmnElement="SequenceFlow_1p39f4r"> - <di:waypoint xsi:type="dc:Point" x="454" y="164" /> - <di:waypoint xsi:type="dc:Point" x="541" y="164" /> + <di:waypoint x="504" y="164" /> + <di:waypoint x="591" y="164" /> <bpmndi:BPMNLabel> - <dc:Bounds x="472" y="168" width="19" height="12" /> + <dc:Bounds x="523" y="168" width="18" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_007m32h_di" bpmnElement="SequenceFlow_007m32h"> - <di:waypoint xsi:type="dc:Point" x="429" y="189" /> - <di:waypoint xsi:type="dc:Point" x="429" y="249" /> + <di:waypoint x="479" y="189" /> + <di:waypoint x="479" y="249" /> <bpmndi:BPMNLabel> - <dc:Bounds x="435" y="198" width="14" height="12" /> + <dc:Bounds x="485" y="198" width="15" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="SubProcess_09bkjg0_di" bpmnElement="SubProcess_0y17e8j" isExpanded="true"> - <dc:Bounds x="151" y="404" width="787" height="344" /> + <dc:Bounds x="201" y="404" width="787" height="344" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BoundaryEvent_04c5efr_di" bpmnElement="BoundaryEvent_1ysr7mk"> - <dc:Bounds x="335" y="186" width="36" height="36" /> + <dc:Bounds x="385" y="186" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="353" y="226" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Association_1cnlu6p_di" bpmnElement="Association_1cnlu6p"> - <di:waypoint xsi:type="dc:Point" x="353" y="222" /> - <di:waypoint xsi:type="dc:Point" x="353" y="267" /> - <di:waypoint xsi:type="dc:Point" x="321" y="267" /> + <di:waypoint x="403" y="222" /> + <di:waypoint x="403" y="267" /> + <di:waypoint x="371" y="267" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0vacscp_di" bpmnElement="Task_0zbd85n"> - <dc:Bounds x="221" y="227" width="100" height="80" /> + <dc:Bounds x="271" y="227" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_0lzcn0v_di" bpmnElement="EndEvent_0rxprkw"> - <dc:Bounds x="411" y="249" width="36" height="36" /> + <dc:Bounds x="461" y="249" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="429" y="288.658" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_14424k5_di" bpmnElement="EndEvent_1dt01ez"> - <dc:Bounds x="683" y="249" width="36" height="36" /> + <dc:Bounds x="733" y="249" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="701" y="288.658" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="StartEvent_1wrpebh_di" bpmnElement="StartEvent_17oglfe"> - <dc:Bounds x="181" y="599" width="36" height="36" /> + <dc:Bounds x="231" y="599" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="198.35199999999998" y="638.658" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_0gltuh4_di" bpmnElement="IntermediateThrowEvent_040yoan"> - <dc:Bounds x="365" y="529" width="36" height="36" /> + <dc:Bounds x="415" y="529" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="382.352" y="569" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_0qlnby0_di" bpmnElement="ExclusiveGateway_0qlnby0" isMarkerVisible="true"> - <dc:Bounds x="429.352" y="522" width="50" height="50" /> + <dc:Bounds x="479" y="522" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="484" y="535" width="62" height="24" /> + <dc:Bounds x="533" y="535" width="65" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_02rhau9_di" bpmnElement="SequenceFlow_02rhau9"> - <di:waypoint xsi:type="dc:Point" x="217" y="617" /> - <di:waypoint xsi:type="dc:Point" x="284" y="617" /> + <di:waypoint x="267" y="617" /> + <di:waypoint x="334" y="617" /> <bpmndi:BPMNLabel> <dc:Bounds x="250.5" y="596" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_006myq9_di" bpmnElement="SequenceFlow_006myq9"> - <di:waypoint xsi:type="dc:Point" x="401" y="547" /> - <di:waypoint xsi:type="dc:Point" x="429" y="547" /> + <di:waypoint x="451" y="547" /> + <di:waypoint x="479" y="547" /> <bpmndi:BPMNLabel> <dc:Bounds x="415" y="526" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_0tuxj9l_di" bpmnElement="ExclusiveGateway_0tuxj9l" isMarkerVisible="true"> - <dc:Bounds x="608.352" y="522" width="50" height="50" /> + <dc:Bounds x="658" y="522" width="50" height="50" /> <bpmndi:BPMNLabel> <dc:Bounds x="633.352" y="576" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_108cgfw_di" bpmnElement="buildError"> - <dc:Bounds x="695" y="577" width="100" height="80" /> + <dc:Bounds x="745" y="577" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1ubla93_di" bpmnElement="SequenceFlow_1ubla93"> - <di:waypoint xsi:type="dc:Point" x="454" y="522" /> - <di:waypoint xsi:type="dc:Point" x="454" y="483" /> - <di:waypoint xsi:type="dc:Point" x="496" y="483" /> + <di:waypoint x="504" y="522" /> + <di:waypoint x="504" y="483" /> + <di:waypoint x="546" y="483" /> <bpmndi:BPMNLabel> - <dc:Bounds x="461" y="489" width="19" height="12" /> + <dc:Bounds x="512" y="489" width="18" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1piwh1c_di" bpmnElement="SequenceFlow_1piwh1c"> - <di:waypoint xsi:type="dc:Point" x="454" y="572" /> - <di:waypoint xsi:type="dc:Point" x="454" y="603" /> - <di:waypoint xsi:type="dc:Point" x="633" y="603" /> - <di:waypoint xsi:type="dc:Point" x="633" y="572" /> + <di:waypoint x="504" y="572" /> + <di:waypoint x="504" y="603" /> + <di:waypoint x="683" y="603" /> + <di:waypoint x="683" y="572" /> <bpmndi:BPMNLabel> - <dc:Bounds x="460" y="576.85" width="14" height="12" /> + <dc:Bounds x="510" y="577" width="15" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1nku4uk_di" bpmnElement="SequenceFlow_1nku4uk"> - <di:waypoint xsi:type="dc:Point" x="596" y="483" /> - <di:waypoint xsi:type="dc:Point" x="633" y="483" /> - <di:waypoint xsi:type="dc:Point" x="633" y="522" /> + <di:waypoint x="646" y="483" /> + <di:waypoint x="683" y="483" /> + <di:waypoint x="683" y="522" /> <bpmndi:BPMNLabel> <dc:Bounds x="614.5" y="462" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1yx80cq_di" bpmnElement="SequenceFlow_1yx80cq"> - <di:waypoint xsi:type="dc:Point" x="658" y="547" /> - <di:waypoint xsi:type="dc:Point" x="745" y="547" /> - <di:waypoint xsi:type="dc:Point" x="745" y="577" /> + <di:waypoint x="708" y="547" /> + <di:waypoint x="795" y="547" /> + <di:waypoint x="795" y="577" /> <bpmndi:BPMNLabel> <dc:Bounds x="656.5" y="526" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0bnzfqb_di" bpmnElement="SequenceFlow_0bnzfqb"> - <di:waypoint xsi:type="dc:Point" x="795" y="617" /> - <di:waypoint xsi:type="dc:Point" x="870" y="617" /> + <di:waypoint x="845" y="617" /> + <di:waypoint x="920" y="617" /> <bpmndi:BPMNLabel> <dc:Bounds x="787.5" y="596" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_1l1f6zj_di" bpmnElement="EndEvent_1yiy2fi"> - <dc:Bounds x="870" y="599" width="36" height="36" /> + <dc:Bounds x="920" y="599" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="887.352" y="639" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_18ndby1_di" bpmnElement="ExclusiveGateway_18ndby1" isMarkerVisible="true"> - <dc:Bounds x="284.352" y="592" width="50" height="50" /> + <dc:Bounds x="334" y="592" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="338" y="605" width="54" height="24" /> + <dc:Bounds x="388" y="605" width="54" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0y1by9x_di" bpmnElement="SequenceFlow_0y1by9x"> - <di:waypoint xsi:type="dc:Point" x="309" y="592" /> - <di:waypoint xsi:type="dc:Point" x="309" y="547" /> - <di:waypoint xsi:type="dc:Point" x="365" y="547" /> + <di:waypoint x="359" y="592" /> + <di:waypoint x="359" y="547" /> + <di:waypoint x="415" y="547" /> <bpmndi:BPMNLabel> - <dc:Bounds x="315" y="558" width="19" height="12" /> + <dc:Bounds x="366" y="558" width="18" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1az3a2q_di" bpmnElement="SequenceFlow_1az3a2q"> - <di:waypoint xsi:type="dc:Point" x="309" y="642" /> - <di:waypoint xsi:type="dc:Point" x="309" y="686" /> - <di:waypoint xsi:type="dc:Point" x="745" y="686" /> - <di:waypoint xsi:type="dc:Point" x="745" y="657" /> + <di:waypoint x="359" y="642" /> + <di:waypoint x="359" y="686" /> + <di:waypoint x="795" y="686" /> + <di:waypoint x="795" y="657" /> <bpmndi:BPMNLabel> - <dc:Bounds x="318" y="657" width="14" height="12" /> + <dc:Bounds x="368" y="657" width="15" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterRestV1.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterRestV1.bpmn deleted file mode 100644 index db93df9f09..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterRestV1.bpmn +++ /dev/null @@ -1,441 +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:camunda="http://camunda.org/schema/1.0/bpmn" 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="_GraPIIyxEeWmdMDkx6Uftw" exporter="camunda modeler" exporterVersion="2.7.0" targetNamespace="http://camunda.org/schema/1.0/bpmn"> - <bpmn2:process id="vnfAdapterRestV1" name="vnfAdapterRestV1" isExecutable="true"> - <bpmn2:scriptTask id="ScriptTask_2" name="Log Response" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -def vnfAdapterRestV1 = new VnfAdapterRestV1() -def statusCode = execution.getVariable('VNFREST_vnfAdapterStatusCode') -String response = String.valueOf(execution.getVariable('VNFREST_vnfAdapterResponse')) -def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') -def processKey = vnfAdapterRestV1.getProcessKey(execution) -vnfAdapterRestV1.getLogger().debug("{} received response from VnfAdapter: statusCode= {} response={}", processKey, statusCode, (response.isEmpty() ? "" : "\n" + response))]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:scriptTask id="ScriptTask_3" name="Workflow Exception (no connection)"> - <bpmn2:incoming>SequenceFlow_17</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_35</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -def exceptionUtil = new ExceptionUtil() -exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Failed to communicate with VnfAdapter")]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:scriptTask id="ScriptTask_4" name="Workflow Exception (bad response)" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_23</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_36</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* - -String res = execution.getVariable(VNFREST_vnfAdapterResponse) - -def vnfAdapterRestV1 = new VnfAdapterRestV1() -vnfAdapterRestV1.vnfAdapterWorkflowException(execution, res)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_14" name="" sourceRef="ScriptTask_2" targetRef="ExclusiveGateway_1"/> - <bpmn2:exclusiveGateway id="ExclusiveGateway_1" default="SequenceFlow_23"> - <bpmn2:incoming>SequenceFlow_14</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_17</bpmn2:outgoing> - <bpmn2:outgoing>SequenceFlow_23</bpmn2:outgoing> - <bpmn2:outgoing>SequenceFlow_24</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="SequenceFlow_17" name="404" sourceRef="ExclusiveGateway_1" targetRef="ScriptTask_3"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("VNFREST_vnfAdapterStatusCode") == '404'}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:sequenceFlow id="SequenceFlow_23" name="other" sourceRef="ExclusiveGateway_1" targetRef="ScriptTask_4"/> - <bpmn2:sequenceFlow id="SequenceFlow_24" name="2xx" sourceRef="ExclusiveGateway_1" targetRef="waitForAsyncMessage"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("VNFREST_vnfAdapterStatusCode") == '200' || execution.getVariable("VNFREST_vnfAdapterStatusCode") == '202'}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:boundaryEvent id="BoundaryEvent_1" name="Timeout" attachedToRef="waitForAsyncMessage"> - <bpmn2:outgoing>SequenceFlow_27</bpmn2:outgoing> - <bpmn2:timerEventDefinition id="TimerEventDefinition_1"> - <bpmn2:timeDuration xsi:type="bpmn2:tFormalExpression"><![CDATA[${UrnPropertiesReader.getVariable("mso.po.timeout", execution)}]]></bpmn2:timeDuration> - </bpmn2:timerEventDefinition> - </bpmn2:boundaryEvent> - <bpmn2:subProcess id="waitForAsyncMessage" name="Wait for Callback"> - <bpmn2:incoming>SequenceFlow_24</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_28</bpmn2:outgoing> - <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_1" name="Catch Event"> - <bpmn2:incoming>SequenceFlow_25</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_26</bpmn2:outgoing> - <bpmn2:messageEventDefinition id="MessageEventDefinition_1" messageRef="Message_1"/> - </bpmn2:intermediateCatchEvent> - <bpmn2:sequenceFlow id="SequenceFlow_26" name="" sourceRef="IntermediateCatchEvent_1" targetRef="EndEvent_2"/> - <bpmn2:startEvent id="StartEvent_3"> - <bpmn2:outgoing>SequenceFlow_25</bpmn2:outgoing> - </bpmn2:startEvent> - <bpmn2:sequenceFlow id="SequenceFlow_25" name="" sourceRef="StartEvent_3" targetRef="IntermediateCatchEvent_1"/> - <bpmn2:endEvent id="EndEvent_2"> - <bpmn2:incoming>SequenceFlow_26</bpmn2:incoming> - </bpmn2:endEvent> - </bpmn2:subProcess> - <bpmn2:sequenceFlow id="SequenceFlow_27" name="" sourceRef="BoundaryEvent_1" targetRef="ScriptTask_5"/> - <bpmn2:scriptTask id="ScriptTask_5" name="Workflow Exception (timeout)" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_27</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_34</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -def exceptionUtil = new ExceptionUtil() -exceptionUtil.buildAndThrowWorkflowException(execution, 7010, "VnfAdapter Callback Timeout Error")]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_28" name="" sourceRef="waitForAsyncMessage" targetRef="ScriptTask_6"/> - <bpmn2:scriptTask id="ScriptTask_6" name="Process Callback" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_28</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_33</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -def vnfAdapterRestV1 = new VnfAdapterRestV1() -vnfAdapterRestV1.processCallback(execution) -]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_33" name="" sourceRef="ScriptTask_6" targetRef="ExclusiveGateway_2"/> - <bpmn2:sequenceFlow id="SequenceFlow_34" name="" sourceRef="ScriptTask_5" targetRef="EndEvent_8"/> - <bpmn2:endEvent id="EndEvent_8"> - <bpmn2:incoming>SequenceFlow_34</bpmn2:incoming> - <bpmn2:errorEventDefinition id="_ErrorEventDefinition_21" errorRef="Error_1"/> - </bpmn2:endEvent> - <bpmn2:sequenceFlow id="SequenceFlow_35" name="" sourceRef="ScriptTask_3" targetRef="EndEvent_9"/> - <bpmn2:endEvent id="EndEvent_9"> - <bpmn2:incoming>SequenceFlow_35</bpmn2:incoming> - <bpmn2:errorEventDefinition id="_ErrorEventDefinition_22" errorRef="Error_1"/> - </bpmn2:endEvent> - <bpmn2:endEvent id="EndEvent_10"> - <bpmn2:incoming>SequenceFlow_36</bpmn2:incoming> - <bpmn2:errorEventDefinition id="_ErrorEventDefinition_23" errorRef="Error_1"/> - </bpmn2:endEvent> - <bpmn2:sequenceFlow id="SequenceFlow_36" name="" sourceRef="ScriptTask_4" targetRef="EndEvent_10"/> - <bpmn2:endEvent id="EndEvent_7"> - <bpmn2:incoming>SequenceFlow_32</bpmn2:incoming> - <bpmn2:errorEventDefinition id="_ErrorEventDefinition_20" errorRef="Error_1"/> - </bpmn2:endEvent> - <bpmn2:exclusiveGateway id="ExclusiveGateway_2" name="Callback
Exception?" default="SequenceFlow_31"> - <bpmn2:incoming>SequenceFlow_33</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_31</bpmn2:outgoing> - <bpmn2:outgoing>SequenceFlow_32</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="SequenceFlow_31" name="no" sourceRef="ExclusiveGateway_2" targetRef="ScriptTask_setSuccess"/> - <bpmn2:sequenceFlow id="SequenceFlow_32" name="yes" sourceRef="ExclusiveGateway_2" targetRef="EndEvent_7"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("WorkflowException") != null}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:scriptTask id="ScriptTask_setSuccess" name="Set Success Indicator" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_31</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -def vnfAdapterRestV1 = new VnfAdapterRestV1() -vnfAdapterRestV1.setSuccessIndicator(execution, true)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="ScriptTask_setSuccess" targetRef="EndEvent_6"/> - <bpmn2:endEvent id="EndEvent_6" name="End Flow"> - <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> - </bpmn2:endEvent> - <bpmn2:scriptTask id="ScriptTask_7" name="Send Request to Vnf Adapter" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -def vnfAdapterRestV1 = new VnfAdapterRestV1() -vnfAdapterRestV1.sendRequestToVnfAdapter(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="ScriptTask_7" targetRef="ScriptTask_2"/> - <bpmn2:subProcess id="SubProcess_1" name="Error Handling Sub Process" triggeredByEvent="true"> - <bpmn2:scriptTask id="ScriptTask_8" name="Process Error" 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 exUtil = new ExceptionUtil() -exUtil.processSubflowsBPMNException(execution) -]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="ScriptTask_8" targetRef="EndEvent_1"/> - <bpmn2:endEvent id="EndEvent_1"> - <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming> - </bpmn2:endEvent> - <bpmn2:startEvent id="StartEvent_2"> - <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing> - <bpmn2:errorEventDefinition id="_ErrorEventDefinition_89"/> - </bpmn2:startEvent> - <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="StartEvent_2" targetRef="ScriptTask_8"/> - </bpmn2:subProcess> - <bpmn2:scriptTask id="ScriptTask_1" name="Pre-Process Request" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.onap.so.bpmn.common.scripts.* -def vnfAdapterRestV1 = new VnfAdapterRestV1() -vnfAdapterRestV1.preProcessRequest(execution) -]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="ScriptTask_1" targetRef="ScriptTask_7"/> - <bpmn2:startEvent id="StartEvent_1" name="Start"> - <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing> - </bpmn2:startEvent> - <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="StartEvent_1" targetRef="ScriptTask_1"/> - </bpmn2:process> - <bpmn2:error id="Error_1" errorCode="MSOWorkflowException" name="MSO Workflow Exception"/> - <bpmn2:message id="Message_1" name="WorkflowMessage"/> - <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="vnfAdapterRestV1"> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_56" bpmnElement="ScriptTask_1"> - <dc:Bounds height="80.0" width="100.0" x="204.0" y="148.0"/> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_SubProcess_14" bpmnElement="waitForAsyncMessage" isExpanded="true"> - <dc:Bounds height="154.0" width="265.0" x="744.0" y="275.0"/> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_58" bpmnElement="ScriptTask_6"> - <dc:Bounds height="80.0" width="100.0" x="1046.0" y="311.0"/> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_59" bpmnElement="ScriptTask_5"> - <dc:Bounds height="80.0" width="100.0" x="827.0" y="492.0"/> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_BoundaryEvent_24" bpmnElement="BoundaryEvent_1"> - <dc:Bounds height="36.0" width="36.0" x="859.0" y="411.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="22.0" width="52.0" x="894.0" y="441.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_IntermediateCatchEvent_20" bpmnElement="IntermediateCatchEvent_1"> - <dc:Bounds height="36.0" width="36.0" x="863.0" y="330.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="22.0" width="76.0" x="843.0" y="371.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_78" bpmnElement="ScriptTask_4"> - <dc:Bounds height="80.0" width="97.0" x="744.0" y="148.0"/> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_79" bpmnElement="ScriptTask_2"> - <dc:Bounds height="80.0" width="100.0" x="492.0" y="148.0"/> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_54" bpmnElement="StartEvent_1"> - <dc:Bounds height="36.0" width="36.0" x="84.0" y="170.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="22.0" width="34.0" x="85.0" y="211.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_168" bpmnElement="ScriptTask_3"> - <dc:Bounds height="80.0" width="97.0" x="744.0" y="24.0"/> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_StartEvent_54" targetElement="_BPMNShape_ScriptTask_56"> - <di:waypoint xsi:type="dc:Point" x="120.0" y="188.0"/> - <di:waypoint xsi:type="dc:Point" x="204.0" y="188.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="6.0" width="6.0" x="130.0" y="188.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_105" bpmnElement="ExclusiveGateway_1" isMarkerVisible="true"> - <dc:Bounds height="50.0" width="50.0" x="624.0" y="162.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="0.0" width="0.0" x="649.0" y="217.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_18" bpmnElement="SequenceFlow_14" sourceElement="_BPMNShape_ScriptTask_79" targetElement="_BPMNShape_ExclusiveGateway_105"> - <di:waypoint xsi:type="dc:Point" x="592.0" y="188.0"/> - <di:waypoint xsi:type="dc:Point" x="624.0" y="187.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="6.0" width="6.0" x="611.0" y="187.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_19" bpmnElement="SequenceFlow_17" sourceElement="_BPMNShape_ExclusiveGateway_105" targetElement="_BPMNShape_ScriptTask_168"> - <di:waypoint xsi:type="dc:Point" x="649.0" y="162.0"/> - <di:waypoint xsi:type="dc:Point" x="649.0" y="64.0"/> - <di:waypoint xsi:type="dc:Point" x="744.0" y="64.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="22.0" width="27.0" x="688.0" y="64.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_20" bpmnElement="SequenceFlow_23" sourceElement="_BPMNShape_ExclusiveGateway_105" targetElement="_BPMNShape_ScriptTask_78"> - <di:waypoint xsi:type="dc:Point" x="674.0" y="187.0"/> - <di:waypoint xsi:type="dc:Point" x="709.0" y="187.0"/> - <di:waypoint xsi:type="dc:Point" x="709.0" y="188.0"/> - <di:waypoint xsi:type="dc:Point" x="744.0" y="188.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="22.0" width="35.0" x="684.0" y="188.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_25" bpmnElement="SequenceFlow_24" sourceElement="_BPMNShape_ExclusiveGateway_105" targetElement="_BPMNShape_SubProcess_14"> - <di:waypoint xsi:type="dc:Point" x="649.0" y="212.0"/> - <di:waypoint xsi:type="dc:Point" x="649.0" y="353.0"/> - <di:waypoint xsi:type="dc:Point" x="708.0" y="353.0"/> - <di:waypoint xsi:type="dc:Point" x="744.0" y="353.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="22.0" width="27.0" x="688.0" y="328.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_55" bpmnElement="StartEvent_3"> - <dc:Bounds height="36.0" width="36.0" x="768.0" y="330.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="0.0" width="0.0" x="786.0" y="371.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_27" bpmnElement="SequenceFlow_25" sourceElement="_BPMNShape_StartEvent_55" targetElement="_BPMNShape_IntermediateCatchEvent_20"> - <di:waypoint xsi:type="dc:Point" x="804.0" y="348.0"/> - <di:waypoint xsi:type="dc:Point" x="863.0" y="348.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="6.0" width="6.0" x="833.0" y="348.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_EndEvent_156" bpmnElement="EndEvent_2"> - <dc:Bounds height="36.0" width="36.0" x="948.0" y="330.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="0.0" width="0.0" x="966.0" y="371.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_28" bpmnElement="SequenceFlow_26" sourceElement="_BPMNShape_IntermediateCatchEvent_20" targetElement="_BPMNShape_EndEvent_156"> - <di:waypoint xsi:type="dc:Point" x="899.0" y="348.0"/> - <di:waypoint xsi:type="dc:Point" x="929.0" y="348.0"/> - <di:waypoint xsi:type="dc:Point" x="929.0" y="347.0"/> - <di:waypoint xsi:type="dc:Point" x="948.0" y="348.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="6.0" width="6.0" x="926.0" y="348.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_29" bpmnElement="SequenceFlow_27" sourceElement="_BPMNShape_BoundaryEvent_24" targetElement="_BPMNShape_ScriptTask_59"> - <di:waypoint xsi:type="dc:Point" x="877.0" y="447.0"/> - <di:waypoint xsi:type="dc:Point" x="877.0" y="492.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="6.0" width="6.0" x="874.0" y="472.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_30" bpmnElement="SequenceFlow_28" sourceElement="_BPMNShape_SubProcess_14" targetElement="_BPMNShape_ScriptTask_58"> - <di:waypoint xsi:type="dc:Point" x="1008.0" y="351.0"/> - <di:waypoint xsi:type="dc:Point" x="1046.0" y="351.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="6.0" width="6.0" x="1023.0" y="351.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_106" bpmnElement="ExclusiveGateway_2" isMarkerVisible="true"> - <dc:Bounds height="50.0" width="50.0" x="1188.0" y="325.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="38.0" width="71.0" x="1179.0" y="288.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_EndEvent_158" bpmnElement="EndEvent_6"> - <dc:Bounds height="36.0" width="36.0" x="1463.0" y="333.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="22.0" width="60.0" x="1451.0" y="374.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_33" bpmnElement="SequenceFlow_31" sourceElement="_BPMNShape_ExclusiveGateway_106" targetElement="_BPMNShape_ScriptTask_236"> - <di:waypoint xsi:type="dc:Point" x="1238.0" y="350.0"/> - <di:waypoint xsi:type="dc:Point" x="1308.0" y="350.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="22.0" width="20.0" x="1248.0" y="350.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_EndEvent_159" bpmnElement="EndEvent_7"> - <dc:Bounds height="36.0" width="36.0" x="1196.0" y="426.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="0.0" width="0.0" x="1214.0" y="467.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_34" bpmnElement="SequenceFlow_32" sourceElement="_BPMNShape_ExclusiveGateway_106" targetElement="_BPMNShape_EndEvent_159"> - <di:waypoint xsi:type="dc:Point" x="1213.0" y="375.0"/> - <di:waypoint xsi:type="dc:Point" x="1213.0" y="392.0"/> - <di:waypoint xsi:type="dc:Point" x="1214.0" y="392.0"/> - <di:waypoint xsi:type="dc:Point" x="1214.0" y="426.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="22.0" width="27.0" x="1223.0" y="390.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_35" bpmnElement="SequenceFlow_33" sourceElement="_BPMNShape_ScriptTask_58" targetElement="_BPMNShape_ExclusiveGateway_106"> - <di:waypoint xsi:type="dc:Point" x="1146.0" y="351.0"/> - <di:waypoint xsi:type="dc:Point" x="1173.0" y="351.0"/> - <di:waypoint xsi:type="dc:Point" x="1173.0" y="350.0"/> - <di:waypoint xsi:type="dc:Point" x="1188.0" y="350.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="6.0" width="6.0" x="1170.0" y="350.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_EndEvent_160" bpmnElement="EndEvent_8"> - <dc:Bounds height="36.0" width="36.0" x="974.0" y="514.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="0.0" width="0.0" x="992.0" y="555.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_36" bpmnElement="SequenceFlow_34" sourceElement="_BPMNShape_ScriptTask_59" targetElement="_BPMNShape_EndEvent_160"> - <di:waypoint xsi:type="dc:Point" x="927.0" y="532.0"/> - <di:waypoint xsi:type="dc:Point" x="974.0" y="532.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="6.0" width="6.0" x="951.0" y="532.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_EndEvent_161" bpmnElement="EndEvent_9"> - <dc:Bounds height="36.0" width="36.0" x="891.0" y="46.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="0.0" width="0.0" x="909.0" y="87.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_37" bpmnElement="SequenceFlow_35" sourceElement="_BPMNShape_ScriptTask_168" targetElement="_BPMNShape_EndEvent_161"> - <di:waypoint xsi:type="dc:Point" x="840.0" y="64.0"/> - <di:waypoint xsi:type="dc:Point" x="891.0" y="64.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="6.0" width="6.0" x="865.0" y="64.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_EndEvent_162" bpmnElement="EndEvent_10"> - <dc:Bounds height="36.0" width="36.0" x="892.0" y="170.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="0.0" width="0.0" x="910.0" y="211.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_38" bpmnElement="SequenceFlow_36" sourceElement="_BPMNShape_ScriptTask_78" targetElement="_BPMNShape_EndEvent_162"> - <di:waypoint xsi:type="dc:Point" x="840.0" y="188.0"/> - <di:waypoint xsi:type="dc:Point" x="892.0" y="188.0"/> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_236" bpmnElement="ScriptTask_setSuccess"> - <dc:Bounds height="83.0" width="97.0" x="1308.0" y="309.0"/> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_ScriptTask_236" targetElement="_BPMNShape_EndEvent_158"> - <di:waypoint xsi:type="dc:Point" x="1404.0" y="350.0"/> - <di:waypoint xsi:type="dc:Point" x="1422.0" y="350.0"/> - <di:waypoint xsi:type="dc:Point" x="1422.0" y="351.0"/> - <di:waypoint xsi:type="dc:Point" x="1463.0" y="351.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="6.0" width="6.0" x="1419.0" y="351.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_237" bpmnElement="ScriptTask_7"> - <dc:Bounds height="83.0" width="97.0" x="360.0" y="146.0"/> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_56" targetElement="_BPMNShape_ScriptTask_237"> - <di:waypoint xsi:type="dc:Point" x="304.0" y="188.0"/> - <di:waypoint xsi:type="dc:Point" x="344.0" y="188.0"/> - <di:waypoint xsi:type="dc:Point" x="344.0" y="187.0"/> - <di:waypoint xsi:type="dc:Point" x="360.0" y="187.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="6.0" width="6.0" x="317.0" y="188.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_237" targetElement="_BPMNShape_ScriptTask_79"> - <di:waypoint xsi:type="dc:Point" x="456.0" y="187.0"/> - <di:waypoint xsi:type="dc:Point" x="474.0" y="187.0"/> - <di:waypoint xsi:type="dc:Point" x="474.0" y="188.0"/> - <di:waypoint xsi:type="dc:Point" x="492.0" y="188.0"/> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_SubProcess_24" bpmnElement="SubProcess_1" isExpanded="true"> - <dc:Bounds height="181.0" width="382.0" x="180.0" y="532.0"/> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_66" bpmnElement="StartEvent_2"> - <dc:Bounds height="36.0" width="36.0" x="225.0" y="605.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="0.0" width="0.0" x="243.0" y="646.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_EndEvent_207" bpmnElement="EndEvent_1"> - <dc:Bounds height="36.0" width="36.0" x="477.0" y="605.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="0.0" width="0.0" x="495.0" y="646.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_266" bpmnElement="ScriptTask_8"> - <dc:Bounds height="83.0" width="97.0" x="323.0" y="581.0"/> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_StartEvent_66" targetElement="_BPMNShape_ScriptTask_266"> - <di:waypoint xsi:type="dc:Point" x="261.0" y="623.0"/> - <di:waypoint xsi:type="dc:Point" x="323.0" y="622.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="6.0" width="6.0" x="273.0" y="623.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ScriptTask_266" targetElement="_BPMNShape_EndEvent_207"> - <di:waypoint xsi:type="dc:Point" x="419.0" y="622.0"/> - <di:waypoint xsi:type="dc:Point" x="477.0" y="623.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="6.0" width="6.0" x="445.0" y="623.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - </bpmndi:BPMNPlane> - </bpmndi:BPMNDiagram> -</bpmn2:definitions>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtilsTest.groovy index 97db9775c9..f0b1bfe047 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtilsTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtilsTest.groovy @@ -27,10 +27,10 @@ import org.junit.Test import org.mockito.Mockito import org.mockito.internal.stubbing.answers.DoesNothing import org.onap.aai.domain.yang.AllottedResource -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.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import javax.ws.rs.core.UriBuilder import static org.junit.Assert.assertEquals import static org.junit.Assert.assertTrue diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy index fda6b8e6e3..216f34573b 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy @@ -136,7 +136,6 @@ class CatalogDbUtilsTest { } private void verifyHeadersInHttpClient() { - verify(httpClientMock).addAdditionalHeader(eq(ONAPLogConstants.Headers.REQUEST_ID), anyString()) verify(httpClientMock).addAdditionalHeader("X-FromAppId", "BPMN") verify(httpClientMock).addAdditionalHeader("Accept", MediaType.APPLICATION_JSON) verify(httpClientMock).addAdditionalHeader("Authorization", AUTHORIZATION_HEADER) 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 79aacdfbe9..8a80d79cf9 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 @@ -34,10 +34,10 @@ import org.onap.aai.domain.yang.VolumeGroup import org.onap.so.bpmn.common.scripts.ConfirmVolumeGroupName import org.onap.so.bpmn.common.scripts.ConfirmVolumeGroupNameFactory import org.onap.so.bpmn.common.scripts.ExceptionUtil -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.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults import org.springframework.http.HttpStatus diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenantTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenantTest.groovy index e40b877177..cd57434d5f 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenantTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenantTest.groovy @@ -36,10 +36,10 @@ import org.onap.aai.domain.yang.Relationship import org.onap.aai.domain.yang.RelationshipData import org.onap.aai.domain.yang.RelationshipList import org.onap.aai.domain.yang.VolumeGroup -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.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults class ConfirmVolumeGroupTenantTest extends MsoGroovyTest { diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleTest.groovy index dac038fab3..6994639e0f 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleTest.groovy @@ -41,7 +41,7 @@ import org.onap.aai.domain.yang.GenericVnf import org.onap.aai.domain.yang.VfModule import org.onap.aai.domain.yang.VfModules import org.onap.so.bpmn.core.UrnPropertiesReader -import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri import org.springframework.core.env.Environment class CreateAAIVfModuleTest extends MsoGroovyTest{ diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroupTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroupTest.groovy index ea38ed8c83..4f36aec827 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroupTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroupTest.groovy @@ -28,9 +28,9 @@ import org.junit.Before import org.junit.Test import org.mockito.Mockito import org.mockito.Spy -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.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.so.constants.Defaults class CreateAAIVfModuleVolumeGroupTest extends MsoGroovyTest{ diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModuleTest.groovy index 2a872511e7..32a50776e6 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModuleTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModuleTest.groovy @@ -39,7 +39,7 @@ import org.mockito.Mockito import org.mockito.Spy import org.onap.aai.domain.yang.GenericVnf import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri class DeleteAAIVfModuleTest extends MsoGroovyTest{ diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy index 7abfcffb13..e6d5fb86e6 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy @@ -129,7 +129,6 @@ class ExternalAPIUtilTest { // THEN then(httpClient).should(times(1)).addBasicAuthHeader("value_externalapi_auth", "value_mso_msoKey") then(httpClient).should(times(1)).addAdditionalHeader("X-FromAppId", "MSO") - then(httpClient).should(times(1)).addAdditionalHeader("X-TransactionId", UUID_STR) ResponseAssert.assertThat(apiResponse) .hasStatusCode(HttpStatus.ACCEPTED) .hasBody(BODY_PAYLOAD) 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 59b34c4074..c8eeb0a957 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 @@ -33,14 +33,14 @@ import org.mockito.junit.MockitoJUnitRunner import org.onap.aai.domain.yang.GenericVnf import org.onap.so.bpmn.mock.FileUtil import org.onap.so.client.HttpClient -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.AAIPluralResourceUri -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.aaiclient.client.aai.AAIObjectPlurals +import org.onap.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth import org.onap.so.constants.Defaults @RunWith(MockitoJUnitRunner.Silent.class) @@ -57,9 +57,10 @@ abstract class MsoGroovyTest { protected static final String CLOUD_OWNER = Defaults.CLOUD_OWNER.toString(); protected void init(String procName){ - mockExecution = setupMock(procName) - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + // mockExecution = setupMock(procName) + // when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") client = mock(AAIResourcesClient.class) + mockExecution = mock(ExecutionEntity.class) } protected ExecutionEntity setupMock(String procName) { 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 99b178c044..1918d10fe7 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 @@ -25,7 +25,7 @@ import org.junit.rules.ExpectedException import static org.mockito.Mockito.* import javax.ws.rs.NotFoundException - +import org.camunda.bpm.engine.ProcessEngineServices import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity import org.junit.Before @@ -35,9 +35,9 @@ import org.mockito.ArgumentCaptor import org.mockito.Captor import org.mockito.MockitoAnnotations import org.mockito.Spy -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.aaiclient.client.aai.AAIObjectType +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.aai.domain.yang.VfModule import com.github.tomakehurst.wiremock.junit.WireMockRule @@ -57,6 +57,7 @@ class UpdateAAIVfModuleTest extends MsoGroovyTest { void init() throws IOException { super.init("UpdateAAIVfModule") when(updateAAIVfModule.getAAIClient()).thenReturn(client) + mockExecution = setupMock("UpdateAAIVfModule") } @Test @@ -110,7 +111,7 @@ class UpdateAAIVfModuleTest extends MsoGroovyTest { when(mockExecution.getVariable(prefix + "getVfModuleResponse")).thenReturn(vfModule) doNothing().when(client).update(isA(AAIResourceUri.class) as AAIResourceUri, anyObject()) updateAAIVfModule.updateVfModule(mockExecution) - verify(mockExecution).setVariable("UAAIVfMod_updateVfModuleResponseCode", 200) + verify(mockExecution).setVariable("UAAIVfMod_updateVfModuleResponseCode", 200) } @Test @@ -126,7 +127,7 @@ class UpdateAAIVfModuleTest extends MsoGroovyTest { doThrow(new NotFoundException("Vf Module not found")).when(client).update(isA(AAIResourceUri.class) as AAIResourceUri, anyObject()) thrown.expect(BpmnError.class) updateAAIVfModule.updateVfModule(mockExecution) - verify(mockExecution).setVariable("UAAIVfMod_updateVfModuleResponseCode", 404) + verify(mockExecution).setVariable("UAAIVfMod_updateVfModuleResponseCode", 404) } @@ -143,7 +144,6 @@ class UpdateAAIVfModuleTest extends MsoGroovyTest { doThrow(new IllegalStateException("Error in AAI client")).when(client).update(isA(AAIResourceUri.class) as AAIResourceUri, anyObject()) thrown.expect(BpmnError.class) updateAAIVfModule.updateVfModule(mockExecution) - verify(mockExecution).setVariable("UAAIVfMod_updateVfModuleResponseCode", 500) - + verify(mockExecution).setVariable("UAAIVfMod_updateVfModuleResponseCode", 500) } } diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy deleted file mode 100644 index 75ddca5e98..0000000000 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy +++ /dev/null @@ -1,135 +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.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity -import org.junit.Before -import org.junit.Test -import org.junit.runner.RunWith -import org.mockito.MockitoAnnotations -import org.mockito.internal.debugging.MockitoDebuggerImpl -import org.mockito.runners.MockitoJUnitRunner -import org.onap.so.bpmn.mock.FileUtil - -import static org.mockito.Mockito.* -import static org.junit.Assert.*; - -@RunWith(MockitoJUnitRunner.class) -public class VnfAdapterRestV1Test { - - @Before - public void init() - { - MockitoAnnotations.initMocks(this) - } - - - @Test - public void testPreProcessRequest() { - - String sdncAdapterWorkflowRequest = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfadapter_request.xml"); - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - when(mockExecution.getVariable("prefix")).thenReturn("VNFREST_") - when(mockExecution.getVariable("mso-request-id")).thenReturn("testMsoRequestId") - when(mockExecution.getVariable("VNFREST_Request")).thenReturn(sdncAdapterWorkflowRequest) - when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("5E12ACACBD552A415E081E29F2C4772F9835792A51C766CCFDD7433DB5220B59969CB2798C") - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - - when(mockExecution.getVariable("mso.adapters.vnf.rest.endpoint")).thenReturn("http://localhost:18080/vnfs/rest/v1/vnfs") - - when(mockExecution.getVariable("mso.adapters.sdnc.timeout")).thenReturn("PT5M") - - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("testProcessKey")).thenReturn("testProcessKey") - - - VnfAdapterRestV1 vnfAdapterRestV1 = new VnfAdapterRestV1() - vnfAdapterRestV1.preProcessRequest(mockExecution) - - MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() - //debugger.printInvocations(mockExecution) - - - verify(mockExecution).setVariable("prefix","VNFREST_") - - verify(mockExecution).setVariable("VNFREST_SuccessIndicator",false) - verify(mockExecution).setVariable("VNFREST_requestType","createVfModuleRequest") - verify(mockExecution).setVariable("VNFAResponse_CORRELATOR","8892cffa-3514-45d4-b2b0-0fde9a96e323-1511813289000") - verify(mockExecution).setVariable("VNFREST_vnfAdapterMethod","POST") - verify(mockExecution).setVariable("VNFREST_notificationUrl","http://localhost:18080/mso/WorkflowMessage/VNFAResponse/8892cffa-3514-45d4-b2b0-0fde9a96e323-1511813289000") - verify(mockExecution).setVariable("VNFREST_vnfAdapterUrl","http://localhost:18080/vnfs/rest/v1/vnfs/6d2e2469-8708-47c3-a0d4-73fa28a8a50b/vf-modules") - - } - - String rollbackReq = """ -<rollbackVolumeGroupRequest> - <volumeGroupRollback> - <volumeGroupId>8a07b246-155e-4b08-b56e-76e98a3c2d66</volumeGroupId> - <volumeGroupStackId>phmaz401me6-vpevre-VOLUMEGROUP/dbd560b6-b03f-4a17-92e7-8942459a60c1</volumeGroupStackId> - <cloudSiteId>mtrnj1b</cloudSiteId> - <cloudOwnerId>CloudOwner</cloudOwnerId> - <tenantId>cfb5e0a790374c9a98a1c0d2044206a7</tenantId> - <volumeGroupCreated>true</volumeGroupCreated> - <msoRequest> - <requestId>1e1a72ca-7300-4ac4-b718-30351f3b6845</requestId> - <serviceInstanceId>15eb2c68-f771-4030-b185-cff179fdad44</serviceInstanceId> - </msoRequest> - <messageId>683ca1ac-2145-4a00-9484-20d48bd701aa</messageId> - </volumeGroupRollback> - <skipAAI>true</skipAAI> - <notificationUrl>http://localhost:8080/mso/WorkflowMessage/VNFAResponse/683ca1ac-2145-4a00-9484-20d48bd701aa</notificationUrl> -</rollbackVolumeGroupRequest> -""" - - @Test - public void testGetVolumeGroupId() { - Node root = new XmlParser().parseText(rollbackReq) - VnfAdapterRestV1 vnfAdapterRestV1 = new VnfAdapterRestV1() - def volGrpId = vnfAdapterRestV1.getVolumeGroupIdFromRollbackRequest(root) - assertEquals('8a07b246-155e-4b08-b56e-76e98a3c2d66', volGrpId) - } - - - @Test - public void testGetMessageId() { - Node root = new XmlParser().parseText(rollbackReq) - - VnfAdapterRestV1 p = new VnfAdapterRestV1() - def messageId = p.getMessageIdForVolumeGroupRollback(root) - assertEquals('683ca1ac-2145-4a00-9484-20d48bd701aa', messageId) - } - - @Test - public void testProcessCallback() { - - String sdncAdapterWorkflowRequest = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfAdapterCallback.xml"); - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - - when(mockExecution.getVariable("VNFAResponse_MESSAGE")).thenReturn(sdncAdapterWorkflowRequest) - when(mockExecution.getVariable("testProcessKey")).thenReturn("testProcessKey") - - VnfAdapterRestV1 vnfAdapterRestV1 = new VnfAdapterRestV1() - vnfAdapterRestV1.processCallback(mockExecution) - - verify(mockExecution).setVariable("testProcessKeyResponse" ,sdncAdapterWorkflowRequest) - - } -} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java index 96ea1cad9b..9d64977577 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java @@ -27,7 +27,7 @@ import java.io.IOException; import org.junit.BeforeClass; import org.junit.Test; import org.onap.so.client.RestPropertiesLoader; -import org.onap.so.client.aai.AAIProperties; +import org.onap.aaiclient.client.aai.AAIProperties; import org.onap.so.client.dmaap.DmaapProperties; import org.onap.so.client.dmaap.DmaapPropertiesLoader; import org.onap.so.client.sdno.dmaap.SDNOHealthCheckDmaapConsumer; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnfTest.java index aa9943b9b1..0eef9cccd8 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnfTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnfTest.java @@ -29,7 +29,6 @@ import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.db.catalog.beans.OrchestrationStatus; -import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.Pnfs; import static org.mockito.Mockito.doReturn; @@ -39,22 +38,11 @@ public class BBInputSetupPnfTest { @Mock private Pnfs pnfs; - @Mock - private ModelInfo modelInfo; - @Test public void populatePnfShouldSetRequiredFields() { final String pnfId = "PNF_id1"; final String pnfName = "PNF_name1"; - final String modelCustomizationId = "8421fe03-fd1b-4bf7-845a-c3fe91edb031"; - final String modelInvariantId = "3360a2a5-22ff-44c7-8935-08c8e5ecbd06"; - final String modelVersionId = "b80c3a52-abd4-436c-a22e-9c5da768781a"; - - doReturn(modelCustomizationId).when(modelInfo).getModelCustomizationId(); - doReturn(modelInvariantId).when(modelInfo).getModelInvariantId(); - doReturn(modelVersionId).when(modelInfo).getModelVersionId(); doReturn(pnfName).when(pnfs).getInstanceName(); - doReturn(modelInfo).when(pnfs).getModelInfo(); ServiceInstance serviceInstance = new ServiceInstance(); BBInputSetupPnf.populatePnfToServiceInstance(pnfs, pnfId, serviceInstance); @@ -65,9 +53,6 @@ public class BBInputSetupPnfTest { assertEquals(pnfId, pnf.getPnfId()); assertEquals(pnfName, pnf.getPnfName()); - assertEquals(modelCustomizationId, pnf.getModelInfoPnf().getModelCustomizationUuid()); - assertEquals(modelInvariantId, pnf.getModelInfoPnf().getModelInvariantUuid()); - assertEquals(modelVersionId, pnf.getModelInfoPnf().getModelUuid()); assertEquals(OrchestrationStatus.PRECREATED, pnf.getOrchestrationStatus()); } } 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 df7337c0d9..458919c48e 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 @@ -58,6 +58,12 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; +import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; @@ -94,11 +100,6 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceProxy; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException; import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.ServiceModelNotFoundException; -import org.onap.so.client.aai.AAICommonObjectMapperProvider; -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.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResource; import org.onap.so.db.catalog.beans.CollectionResourceCustomization; @@ -944,8 +945,8 @@ public class BBInputSetupTest { cloudRegion.setTenantId("tenantId"); Map<String, String> uriKeys = new HashMap<>(); - uriKeys.put("global-customer-id", "global-customer-id"); - uriKeys.put("service-type", "service-type"); + uriKeys.put(AAIFluentTypeBuilder.Types.CUSTOMER.getUriParams().globalCustomerId, "global-customer-id"); + uriKeys.put(AAIFluentTypeBuilder.Types.SERVICE_SUBSCRIPTION.getUriParams().serviceType, "service-type"); Customer customer = new Customer(); ServiceSubscription serviceSubscription = new ServiceSubscription(); @@ -2484,6 +2485,58 @@ public class BBInputSetupTest { } @Test + public void test_getGBBMacroNoUserParamsExistingService_forControllerExecutionBB() throws Exception { + // given + String requestAction = "unassignInstance"; + GeneralBuildingBlock gBB = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + L3Network network = new L3Network(); + network.setNetworkId("networkId"); + gBB.getServiceInstance().getNetworks().add(network); + ServiceInstance serviceInstance = gBB.getServiceInstance(); + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper + .readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacro.json"), RequestDetails.class); + requestDetails.getRequestParameters().setUserParams(null); + Map<ResourceKey, String> lookupKeyMap = prepareLookupKeyMap(); + Service service = Mockito.mock(Service.class); + CloudConfiguration cloudConfiguration = new CloudConfiguration(); + cloudConfiguration.setLcpCloudRegionId("cloudRegionId"); + org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = new org.onap.aai.domain.yang.ServiceInstance(); + org.onap.aai.domain.yang.L3Network aaiNetwork = new org.onap.aai.domain.yang.L3Network(); + aaiNetwork.setModelCustomizationId("modelCustId"); + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("vnfId"); + gBB.getServiceInstance().getVnfs().add(vnf); + org.onap.aai.domain.yang.GenericVnf aaiVnf = new org.onap.aai.domain.yang.GenericVnf(); + aaiVnf.setModelCustomizationId("modelCustId"); + + ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys(); + executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails); + BuildingBlock buildingBlock = executeBB.getBuildingBlock(); + buildingBlock.setBpmnFlowName("ControllerExecutionBB").setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); + buildingBlock.setBpmnScope("VNF"); + + aaiServiceInstance.setModelVersionId("modelVersionId"); + doReturn(service).when(SPY_bbInputSetupUtils) + .getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId()); + doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils) + .getAAIServiceInstanceById(lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID)); + doReturn(serviceInstance).when(SPY_bbInputSetup).getExistingServiceInstance(aaiServiceInstance); + doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(any(BBInputSetupParameter.class)); + doReturn(aaiVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId()); + doNothing().when(SPY_bbInputSetup).mapCatalogVnf(any(GenericVnf.class), any(ModelInfo.class), + any(Service.class)); + // when + SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap, + executeBB.getBuildingBlock().getBpmnFlowName(), requestAction, cloudConfiguration); + // then + verify(SPY_bbInputSetup, times(1)).mapCatalogVnf(any(GenericVnf.class), any(ModelInfo.class), + any(Service.class)); + } + + @Test public void test_getGBBMacroNoUserParamsExistingService_forActivateVnfBB() throws Exception { // given String requestAction = "unassignInstance"; @@ -2535,6 +2588,66 @@ public class BBInputSetupTest { } @Test + public void test_getGBBMacroNoUserParamsExistingService_forControllerExecutionBB_VFModule() throws Exception { + // given + String requestAction = "unassignInstance"; + GeneralBuildingBlock gBB = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + L3Network network = new L3Network(); + network.setNetworkId("networkId"); + gBB.getServiceInstance().getNetworks().add(network); + ServiceInstance serviceInstance = gBB.getServiceInstance(); + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper + .readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacro.json"), RequestDetails.class); + requestDetails.getRequestParameters().setUserParams(null); + Map<ResourceKey, String> lookupKeyMap = prepareLookupKeyMap(); + Service service = Mockito.mock(Service.class); + CloudConfiguration cloudConfiguration = new CloudConfiguration(); + cloudConfiguration.setLcpCloudRegionId("cloudRegionId"); + org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = new org.onap.aai.domain.yang.ServiceInstance(); + org.onap.aai.domain.yang.L3Network aaiNetwork = new org.onap.aai.domain.yang.L3Network(); + aaiNetwork.setModelCustomizationId("modelCustId"); + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("vnfId"); + gBB.getServiceInstance().getVnfs().add(vnf); + org.onap.aai.domain.yang.GenericVnf aaiVnf = new org.onap.aai.domain.yang.GenericVnf(); + aaiVnf.setModelCustomizationId("modelCustId"); + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("vfModuleId"); + gBB.getServiceInstance().getVnfs().get(0).getVfModules().add(vfModule); + org.onap.aai.domain.yang.VfModule aaiVfModule = new org.onap.aai.domain.yang.VfModule(); + aaiVfModule.setModelCustomizationId("modelCustId"); + + ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys(); + executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails); + BuildingBlock buildingBlock = executeBB.getBuildingBlock(); + buildingBlock.setBpmnFlowName("ControllerExecutionBB").setKey("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"); + buildingBlock.setBpmnScope("VfModule"); + + aaiServiceInstance.setModelVersionId("modelVersionId"); + doReturn(service).when(SPY_bbInputSetupUtils) + .getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId()); + doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils) + .getAAIServiceInstanceById(lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID)); + doReturn(serviceInstance).when(SPY_bbInputSetup).getExistingServiceInstance(aaiServiceInstance); + doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(any(BBInputSetupParameter.class)); + doReturn(aaiVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId()); + doNothing().when(SPY_bbInputSetup).mapCatalogVnf(any(GenericVnf.class), any(ModelInfo.class), + any(Service.class)); + doReturn(aaiVfModule).when(SPY_bbInputSetupUtils).getAAIVfModule(vnf.getVnfId(), vfModule.getVfModuleId()); + // when + SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap, + executeBB.getBuildingBlock().getBpmnFlowName(), requestAction, cloudConfiguration); + // then + verify(SPY_bbInputSetup, times(1)).mapCatalogVnf(any(GenericVnf.class), any(ModelInfo.class), + any(Service.class)); + verify(SPY_bbInputSetup, times(1)).mapCatalogVfModule(any(VfModule.class), any(ModelInfo.class), + any(Service.class), any(String.class)); + } + + @Test public void test_getGBBMacroNoUserParamsExistingService_forUnassignVfModuleBB() throws Exception { // given String requestAction = "unassignInstance"; @@ -2947,6 +3060,31 @@ public class BBInputSetupTest { } @Test + public void testMapCatalogVfModuleIfNoVfUnderVnf() { + String vnfModelCustomizationUUID = "vnfResourceCustUUID"; + String vfModuleCustomizationUUID = "vfModelCustomizationUUID"; + VfModule vfModule = new VfModule(); + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelCustomizationUuid(vfModuleCustomizationUUID); + Service service = new Service(); + VnfResourceCustomization vnfResourceCust = new VnfResourceCustomization(); + vnfResourceCust.setModelCustomizationUUID(vnfModelCustomizationUUID); + VfModuleCustomization vfModuleCust = new VfModuleCustomization(); + vfModuleCust.setModelCustomizationUUID(vfModuleCustomizationUUID); + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + doReturn(vfModuleCust).when(SPY_bbInputSetupUtils) + .getVfModuleCustomizationByModelCuztomizationUUID(vfModuleCustomizationUUID); + doReturn(modelInfoVfModule).when(bbInputSetupMapperLayer).mapCatalogVfModuleToVfModule(vfModuleCust); + + SPY_bbInputSetup.mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID); + + assertThat(vfModule.getModelInfoVfModule(), sameBeanAs(modelInfoVfModule)); + + verify(SPY_bbInputSetupUtils, times(1)) + .getVfModuleCustomizationByModelCuztomizationUUID(modelInfo.getModelCustomizationId()); + } + + @Test public void testPopulateVfModule() throws Exception { String vnfId = "vnfId"; String vfModuleId = "vfModuleId"; 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 64e1b40739..b623475939 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 @@ -71,13 +71,13 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.MultipleObjectsFoundException; import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException; -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.uri.AAIPluralResourceUri; -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.aaiclient.client.aai.AAIObjectPlurals; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth; import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; import org.onap.so.db.catalog.beans.Service; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAITest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAITest.java index 1f4c8d3f1d..edd214f85f 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAITest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/CloudInfoFromAAITest.java @@ -42,10 +42,10 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; -import org.onap.so.client.aai.AAICommonObjectMapperProvider; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.Relationships; +import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; +import org.onap.aaiclient.client.aai.entities.Relationships; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonMappingException; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractVnfCDSRequestProviderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractVnfCDSRequestProviderTest.java index 9c3ce60400..06defaa84c 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractVnfCDSRequestProviderTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractVnfCDSRequestProviderTest.java @@ -44,6 +44,7 @@ import org.onap.so.serviceinstancebeans.*; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.LinkedList; import java.util.Map; @RunWith(MockitoJUnitRunner.Silent.class) @@ -202,4 +203,10 @@ public abstract class AbstractVnfCDSRequestProviderTest { executeBuildingBlock.setBuildingBlock(buildingBlock); buildingBlockExecution.setVariable(BUILDING_BLOCK, executeBuildingBlock); } + + protected void setScopeAndActionWithoutUserParams(String scope, String action) { + buildingBlockExecution.getGeneralBuildingBlock().getRequestContext().getRequestParameters() + .setUserParams(new LinkedList<>()); + setScopeAndAction(scope, action); + } } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/GeneratePayloadForCdsTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/GeneratePayloadForCdsTest.java index 998976589c..20bd765338 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/GeneratePayloadForCdsTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/GeneratePayloadForCdsTest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2019 Bell Canada. * ================================================================================ + * Modifications Copyright (c) 2020 Tech Mahindra + * ================================================================================ * 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 @@ -52,7 +54,7 @@ public class GeneratePayloadForCdsTest { private static final String VNF_SCOPE = "vnf"; private static final String SERVICE_SCOPE = "service"; private static final String SERVICE_ACTION = "create"; - private static final String VF_SCOPE = "vfModule"; + private static final String VF_SCOPE = "vfmodule"; private static final String ASSIGN_ACTION = "configAssign"; private static final String DEPLOY_ACTION = "configDeploy"; private static final String DOWNLOAD_ACTION = "downloadNESw"; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VfModuleCDSRequestProviderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VfModuleCDSRequestProviderTest.java index 2ca09d9ab3..f224ebf21e 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VfModuleCDSRequestProviderTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VfModuleCDSRequestProviderTest.java @@ -25,8 +25,14 @@ import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.Test; import org.mockito.InjectMocks; import org.mockito.Mock; +import org.mockito.Spy; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.client.exception.PayloadGenerationException; +import org.onap.so.serviceinstancebeans.Service; +import org.springframework.beans.factory.annotation.Autowired; +import java.util.List; +import java.util.Map; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; @@ -34,11 +40,19 @@ import static org.mockito.Mockito.*; public class VfModuleCDSRequestProviderTest extends AbstractVnfCDSRequestProviderTest { + @Autowired + private ObjectMapper objectMapper; + + @Spy + protected ExtractServiceFromUserParameters extractServiceFromUserParameters; + + @Spy + @InjectMocks + protected ConfigureInstanceParamsForVfModule configureInstanceParamsForVfModule; + @InjectMocks private VfModuleCDSRequestProvider vfModuleCDSRequestProvider; - @Mock - protected ConfigureInstanceParamsForVfModule configureInstanceParamsForVfModule; @Test public void testRequestPayloadForConfigDeployVfModule() throws Exception { @@ -52,7 +66,8 @@ public class VfModuleCDSRequestProviderTest extends AbstractVnfCDSRequestProvide ResourceKey.GENERIC_VNF_ID); doReturn(createVfModule()).when(extractPojosForBB).extractByKey(buildingBlockExecution, ResourceKey.VF_MODULE_ID); - doNothing().when(configureInstanceParamsForVfModule).populateInstanceParams(any(), any(), anyString(), + doReturn(getUserParams()).when(extractServiceFromUserParameters).getServiceFromRequestUserParams(anyList()); + doCallRealMethod().when(configureInstanceParamsForVfModule).populateInstanceParams(any(), any(), anyString(), anyString()); // when @@ -76,5 +91,39 @@ public class VfModuleCDSRequestProviderTest extends AbstractVnfCDSRequestProvide assertThat(propertiesNode.get("vnf-id").asText()).isEqualTo(GENERIC_VNF_ID); } + @Test + public void testRequestPayloadForConfigDeployVfModuleWithoutUserParams() throws Exception { + // given + setScopeAndActionWithoutUserParams(VF_SCOPE, DEPLOY_ACTION); + ServiceInstance serviceInstance = createServiceInstance(); + + doReturn(serviceInstance).when(extractPojosForBB).extractByKey(buildingBlockExecution, + ResourceKey.SERVICE_INSTANCE_ID); + doReturn(createGenericVnf()).when(extractPojosForBB).extractByKey(buildingBlockExecution, + ResourceKey.GENERIC_VNF_ID); + doReturn(createVfModule()).when(extractPojosForBB).extractByKey(buildingBlockExecution, + ResourceKey.VF_MODULE_ID); + doReturn(getUserParams()).when(extractServiceFromUserParameters).getServiceFromRequestUserParams(anyList()); + doCallRealMethod().when(configureInstanceParamsForVfModule).populateInstanceParams(any(), any(), anyString(), + anyString()); + + vfModuleCDSRequestProvider.setExecutionObject(buildingBlockExecution); + String payload = vfModuleCDSRequestProvider.buildRequestPayload(DEPLOY_ACTION).get(); + // verify + ObjectMapper mapper = new ObjectMapper(); + JsonNode payloadJson = mapper.readTree(payload); + JsonNode requestNode = payloadJson.findValue("configDeploy-request"); + JsonNode propertiesNode = payloadJson.findValue("configDeploy-properties"); + + assertNotNull(payload); + assertTrue(verfiyJsonFromString(payload)); + assertThat(requestNode.get("resolution-key").asText()).isEqualTo(VF_MODULE_NAME); + assertThat(propertiesNode.get("service-instance-id").asText()).isEqualTo(SERVICE_INSTANCE_ID); + assertThat(propertiesNode.get("vf-module-id").asText()).isEqualTo(VF_MODULE_ID); + assertThat(propertiesNode.get("vf-module-name").asText()).isEqualTo(VF_MODULE_NAME); + assertThat(propertiesNode.get("vf-module-customization-uuid").asText()).isEqualTo(VF_MODULE_CUSTOMIZATION_UUID); + assertThat(propertiesNode.get("service-model-uuid").asText()).isEqualTo(SERVICE_MODEL_UUID); + assertThat(propertiesNode.get("vnf-id").asText()).isEqualTo(GENERIC_VNF_ID); + } } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java index aae62445de..e05a3bda8f 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java @@ -40,8 +40,8 @@ import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.bpmn.mock.FileUtil; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider; import org.onap.so.objects.audit.AAIObjectAudit; import org.onap.so.objects.audit.AAIObjectAuditList; import org.springframework.beans.BeanUtils; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/AAIPropertiesImplTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/AAIPropertiesImplTest.java index 0d6fede4bf..fc8dfa86c4 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/AAIPropertiesImplTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/AAIPropertiesImplTest.java @@ -24,7 +24,7 @@ import static org.junit.Assert.assertEquals; import java.net.MalformedURLException; import java.net.URL; import org.junit.Test; -import org.onap.so.client.aai.AAIVersion; +import org.onap.aaiclient.client.aai.AAIVersion; public class AAIPropertiesImplTest { diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/ThreadedReadTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/ThreadedReadTest.java index badf444fc6..cd07f7b970 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/ThreadedReadTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/ThreadedReadTest.java @@ -35,7 +35,7 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import org.junit.Test; import org.onap.so.client.RestPropertiesLoader; -import org.onap.so.client.aai.AAIProperties; +import org.onap.aaiclient.client.aai.AAIProperties; import org.onap.so.BaseTest; public class ThreadedReadTest { |