diff options
author | aleemraja <ar00500721@techmahindra.com> | 2020-09-17 11:58:30 +0530 |
---|---|---|
committer | Aleem Raja <ar00500721@techmahindra.com> | 2020-09-17 06:57:15 +0000 |
commit | 903ed1e60d430c2a4b500283d286dbee0d8eefed (patch) | |
tree | d053636e6bc6516f6c5c5bb43a3e12b5ef5f3ee6 /bpmn | |
parent | 27d9076c191384779c76151c119c69e763bc6c35 (diff) |
Implement Activate and Deactivate Core NSSMF workflow
Issue-ID: SO-3235
Signed-off-by: aleemraja <ar00500721@techmahindra.com>
Change-Id: I37ce7d21eaba8ea60a91a7034508965b2cf3a987
Diffstat (limited to 'bpmn')
3 files changed, 1736 insertions, 0 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateCoreNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateCoreNSSI.groovy new file mode 100644 index 0000000000..306c53a73c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateCoreNSSI.groovy @@ -0,0 +1,685 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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 + * + * 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.infrastructure.scripts + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONObject +import org.onap.logging.filter.base.ONAPComponents +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.CatalogDbUtils +import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.RequestDBUtil +import org.onap.so.serviceinstancebeans.CloudConfiguration +import org.onap.so.serviceinstancebeans.LineOfBusiness +import org.onap.so.serviceinstancebeans.ModelInfo +import org.onap.so.serviceinstancebeans.ModelType +import org.onap.so.serviceinstancebeans.OwningEntity +import org.onap.so.serviceinstancebeans.Platform +import org.onap.so.serviceinstancebeans.Project +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.rest.catalog.beans.Vnf +import org.onap.so.serviceinstancebeans.RequestDetails +import org.onap.so.serviceinstancebeans.RequestInfo +import org.onap.so.serviceinstancebeans.RequestParameters +import org.onap.so.serviceinstancebeans.SubscriberInfo +import org.onap.aai.domain.yang.GenericVnf +import org.onap.aai.domain.yang.RelatedToProperty +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.ServiceInstance +import org.onap.aai.domain.yang.v19.SliceProfile +import org.onap.aai.domain.yang.v19.SliceProfiles +import org.slf4j.Logger +import org.slf4j.LoggerFactory +import org.onap.so.client.HttpClient +import org.onap.so.client.HttpClientFactory +import org.onap.so.db.request.beans.OperationStatus +import org.onap.so.db.request.beans.ResourceOperationStatus +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 com.fasterxml.jackson.databind.ObjectMapper + +import javax.ws.rs.NotFoundException +import javax.ws.rs.core.Response + +class DoActivateCoreNSSI extends AbstractServiceTaskProcessor { + String Prefix="DACTCNSSI_" + private static final Logger logger = LoggerFactory.getLogger(DoActivateCoreNSSI.class); + CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create() + private RequestDBUtil requestDBUtil = new RequestDBUtil() + ExceptionUtil exceptionUtil = new ExceptionUtil() + ObjectMapper mapper = new ObjectMapper(); + + JsonUtils jsonUtil = new JsonUtils() + + private final Long TIMEOUT = 60 * 60 * 1000 + + @Override + public void preProcessRequest(DelegateExecution execution) { + logger.debug(Prefix +" **** Enter DoActivateCoreNSSI ::: preProcessRequest ****") + + String operationType = execution.getVariable("operationType") + String oStatus= "" + + if(operationType.equals("activateInstance")) { + oStatus ="activated" + } else { + oStatus ="deactivated" + } + + execution.setVariable("oStatus", oStatus) + String sNssaiListAsString = jsonUtil.getJsonValue(execution.getVariable("sliceParams"), "snssaiList") + + logger.debug("sNssaiListAsString "+sNssaiListAsString) + + List<String> sNssaiList = jsonUtil.StringArrayToList(sNssaiListAsString) + + logger.debug("sNssaiList "+sNssaiList) + + + String sNssai = sNssaiList.get(0) + execution.setVariable("sNssai", sNssai) + + logger.debug("sNssai: "+sNssai) + + String serviceType = execution.getVariable("subscriptionServiceType") + execution.setVariable("serviceType", serviceType) + logger.debug(Prefix +" **** Exit DoActivateCoreNSSI ::: preProcessRequest ****") + } + + public void getNetworkInstanceWithSPInstanceAssociatedWithNssiId(DelegateExecution execution) { + logger.debug(Prefix +" **** Enter DoActivateCoreNSSI ::: getNetworkInstanceWithSPInstanceAssociatedWithNssiId ****") + //NSSI Id as service Instance Id to get from Request + String serviceInstanceId = execution.getVariable("serviceInstanceID") + String errorMsg = "query Network Service Instance from AAI failed" + AAIResultWrapper wrapper = queryAAI(execution, AAIObjectType.SERVICE_INSTANCE, serviceInstanceId, errorMsg) + Optional<ServiceInstance> nsi = wrapper.asBean(ServiceInstance.class) + String networkServiceInstanceName = "" + String networkServiceInstanceId ="" + if(nsi.isPresent()) { + List<Relationship> relationshipList = nsi.get().getRelationshipList()?.getRelationship() + List spiWithsNssaiAndOrchStatusList = new ArrayList<>() + + for (Relationship relationship : relationshipList) { + String relatedTo = relationship.getRelatedTo() + if (relatedTo == "service-instance") { + List<RelationshipData> relationshipDataList = relationship.getRelationshipData() + List<RelatedToProperty> relatedToPropertyList = relationship.getRelatedToProperty() + for (RelationshipData relationshipData : relationshipDataList) { + if (relationshipData.getRelationshipKey() == "service-instance.service-instance-id") { + execution.setVariable("networkServiceInstanceId", relationshipData.getRelationshipValue()) + } + } + for (RelatedToProperty relatedToProperty : relatedToPropertyList) { + if (relatedToProperty.getPropertyKey() == "service-instance.service-instance-name") { + execution.setVariable("networkServiceInstanceName", relatedToProperty.getPropertyValue()) + } + } + } + + //If related to is allotted-Resource + if (relatedTo == "allotted-resource") { + //get slice Profile Instance Id from allotted resource in list by nssi + List<String> sliceProfileInstanceIdList = new ArrayList<>() + List<RelationshipData> relationshipDataList = relationship.getRelationshipData() + for (RelationshipData relationshipData : relationshipDataList) { + if (relationshipData.getRelationshipKey() == "service-instance.service-instance-id") { + sliceProfileInstanceIdList.add(relationshipData.getRelationshipValue()) + } + } + for (String sliceProfileServiceInstanceId : sliceProfileInstanceIdList) { + String errorSliceProfileMsg = "Slice Profile Service Instance was not found in aai" + + //Query Slice Profile Service Instance From AAI by sliceProfileServiceInstanceId + AAIResultWrapper sliceProfileInstanceWrapper = queryAAI(execution, AAIObjectType.SERVICE_INSTANCE, sliceProfileServiceInstanceId, errorSliceProfileMsg) + Optional<ServiceInstance> sliceProfileServiceInstance = sliceProfileInstanceWrapper.asBean(ServiceInstance.class) + if (sliceProfileServiceInstance.isPresent()) { + String orchestrationStatus= sliceProfileServiceInstance.get().getOrchestrationStatus() + String sNssai = sliceProfileServiceInstance.get().getSliceProfiles().getSliceProfile().get(0).getSNssai() + if(sNssai.equals(execution.getVariable("sNssai"))) { + orchestrationStatus = execution.getVariable("oStatus") + //Slice Profile Service Instance to be updated in AAI + execution.setVariable("sliceProfileServiceInstance", sliceProfileServiceInstance) + } + + Map<String, Object> spiWithsNssaiAndOrchStatus = new LinkedHashMap<>() + spiWithsNssaiAndOrchStatus.put("snssai", sNssai) + spiWithsNssaiAndOrchStatus.put("status", orchestrationStatus) + spiWithsNssaiAndOrchStatusList.add(spiWithsNssaiAndOrchStatus) + } + } + } + } + execution.setVariable("snssaiAndOrchStatusList", spiWithsNssaiAndOrchStatusList) + } + logger.debug("NSSI Id: ${serviceInstanceId}, network Service Instance Id: ${networkServiceInstanceId}, serviceName: ${networkServiceInstanceName}") + //Get ServiceInstance Relationships + getServiceInstanceRelationships(execution) + //Get Vnf Relationships + getVnfRelationships(execution) + logger.debug(Prefix +" **** Exit DoActivateCoreNSSI ::: getNetworkInstanceWithSPInstanceAssociatedWithNssiId ****") + } + + + private String prepareVnfInstanceParamsJson(DelegateExecution execution) { + logger.debug(Prefix +" **** Enter DoActivateCoreNSSI ::: prepareVnfInstanceParamsJson ****") + List instanceParamsvalues = execution.getVariable("snssaiAndOrchStatusList") + Map<String, Object> nSsai= new LinkedHashMap<>() + nSsai.put("sNssai", instanceParamsvalues) + String supportedsNssaiJson = mapper.writeValueAsString(nSsai) + //SupportedNssai + Map<String, Object> supportedNssai= new LinkedHashMap<>() + supportedNssai.put("supportedNssai", supportedsNssaiJson) + logger.debug("**** supportedsNssaiJson**** "+supportedNssai) + logger.debug(Prefix +" **** Exit DoActivateCoreNSSI ::: prepareVnfInstanceParamsJson ****") + return supportedNssai + } + + private void getServiceInstanceRelationships(DelegateExecution execution) { + logger.debug(Prefix +" **** Enter DoActivateCoreNSSI ::: getServiceInstanceRelationships ****") + String serviceInstanceId = execution.getVariable("networkServiceInstanceId") + logger.debug("**** serviceInstanceId :: getServiceInstanceRelationships :: "+serviceInstanceId) + String errorMsg = "query Network Service Instance from AAI failed" + AAIResultWrapper wrapper = queryAAI(execution, AAIObjectType.SERVICE_INSTANCE, serviceInstanceId, errorMsg) + Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) + + String networkServiceModelInvariantUuid = si.get().getModelInvariantId() + execution.setVariable("networkServiceModelInvariantUuid", networkServiceModelInvariantUuid) + if(si.isPresent()) { + List<Relationship> relationshipList = si.get().getRelationshipList()?.getRelationship() + for (Relationship relationship : relationshipList) { + String relatedTo = relationship.getRelatedTo() + if (relatedTo == "owning-entity") { + List<RelationshipData> relationshipDataList = relationship.getRelationshipData() + for (RelationshipData relationshipData : relationshipDataList) { + if (relationshipData.getRelationshipKey() == "owning-entity.owning-entity-id") { + execution.setVariable("owningEntityId", relationshipData.getRelationshipValue()) + } + } + } else if (relatedTo == "generic-vnf") { + List<RelationshipData> relationshipDataList = relationship.getRelationshipData() + List<RelatedToProperty> relatedToPropertyList = relationship.getRelatedToProperty() + + //Get VnfId + for (RelationshipData relationshipData : relationshipDataList) { + if (relationshipData.getRelationshipKey() == "generic-vnf.vnf-id") { + execution.setVariable("vnfId", relationshipData.getRelationshipValue()) + String vnfId = relationshipData.getRelationshipValue() + logger.debug("vnfId :"+vnfId) + } + } + } else if (relatedTo == "project") { + List<RelationshipData> relationshipDataList = relationship.getRelationshipData() + for (RelationshipData relationshipData : relationshipDataList) { + if (relationshipData.getRelationshipKey() == "project.project-name") { + execution.setVariable("projectName", relationshipData.getRelationshipValue()) + } + } + } + } + logger.debug(Prefix +" **** Exit DoActivateCoreNSSI ::: getServiceInstanceRelationships ****") + } + } + + private void getVnfRelationships(DelegateExecution execution) { + + logger.debug(Prefix +" **** Enter DoActivateCoreNSSI ::: getVnfRelationships ****") + String msg = "query Generic Vnf from AAI failed" + try { + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, execution.getVariable('vnfId')) + if (!getAAIClient().exists(uri)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + } + AAIResultWrapper wrapper = getAAIClient().get(uri, NotFoundException.class) + Optional<GenericVnf> vnf = wrapper.asBean(GenericVnf.class) + if(vnf.isPresent()) { + List<Relationship> relationshipList = vnf.get().getRelationshipList()?.getRelationship() + for (Relationship relationship : relationshipList) { + String relatedTo = relationship.getRelatedTo() + if (relatedTo == "tenant") { + List<RelationshipData> relationshipDataList = relationship.getRelationshipData() + for (RelationshipData relationshipData : relationshipDataList) { + if (relationshipData.getRelationshipKey() == "tenant.tenant-id") { + execution.setVariable("tenantId", relationshipData.getRelationshipValue()) + } + } + } else if (relatedTo == "cloud-region") { + List<RelationshipData> relationshipDataList = relationship.getRelationshipData() + + for (RelationshipData relationshipData : relationshipDataList) { + if (relationshipData.getRelationshipKey() == "cloud-region.cloud-owner") { + execution.setVariable("cloudOwner", relationshipData.getRelationshipValue()) + } else if (relationshipData.getRelationshipKey() == "cloud-region.cloud-region-id") { + execution.setVariable("lcpCloudRegionId", relationshipData.getRelationshipValue()) + } + } + } else if (relatedTo == "platform") { + List<RelationshipData> relationshipDataList = relationship.getRelationshipData() + for (RelationshipData relationshipData : relationshipDataList) { + if (relationshipData.getRelationshipKey() == "platform.platform-name") { + execution.setVariable("platformName", relationshipData.getRelationshipValue()) + } + } + } else if (relatedTo == "line-of-business") { + List<RelationshipData> relationshipDataList = relationship.getRelationshipData() + for (RelationshipData relationshipData : relationshipDataList) { + if (relationshipData.getRelationshipKey() == "line-of-business.line-of-business-name") { + execution.setVariable("lineOfBusinessName", relationshipData.getRelationshipValue()) + } + } + } + } + } + } catch(BpmnError e){ + throw e + } catch (Exception ex){ + msg = "Exception in getVnfRelationships " + ex.getMessage() + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.debug(Prefix +" **** Exit DoActivateCoreNSSI ::: getVnfRelationships ****") + } + + + /** + * query AAI + * @param execution + * @param aaiObjectType + * @param instanceId + * @return AAIResultWrapper + */ + private AAIResultWrapper queryAAI(DelegateExecution execution, AAIObjectType aaiObjectType, String instanceId, String errorMsg) { + logger.debug(Prefix +" **** Enter DoActivateCoreNSSI ::: queryAAI ****") + + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String serviceType = execution.getVariable("serviceType") + + AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(aaiObjectType, globalSubscriberId, serviceType, instanceId) + if (!getAAIClient().exists(resourceUri)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMsg) + } + AAIResultWrapper wrapper = getAAIClient().get(resourceUri, NotFoundException.class) + + logger.debug(Prefix +" **** Exit DoActivateCoreNSSI ::: queryAAI ****") + return wrapper + } + + public void getServiceVNFAndVFsFromCatalogDB(DelegateExecution execution) { + logger.debug(Prefix +" **** Exit DoActivateCoreNSSI ::: getServiceVNFAndVFsFromCatalogDB ****") + + String modelInvariantUuid = execution.getVariable("networkServiceModelInvariantUuid") + + try{ + CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create() + String json = catalogDbUtils.getServiceResourcesByServiceModelInvariantUuidString(execution, modelInvariantUuid) + logger.debug("***** JSON IS: "+json) + + String serviceVnfs = jsonUtil.getJsonValue(json, "serviceResources.serviceVnfs") ?: "" + String serviceModelInfo = jsonUtil.getJsonValue(json, "serviceResources.modelInfo") ?: "" + + + execution.setVariable("serviceVnfs",serviceVnfs) + execution.setVariable("serviceModelInfo", serviceModelInfo) + logger.debug(Prefix +" ***** serviceVnfs is: "+ serviceVnfs) + }catch(BpmnError e){ + throw e + } catch (Exception ex){ + String msg = "Exception in getServiceVNFAndVFsFromCatalogDB " + ex.getMessage() + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.debug(Prefix +" **** Exit DoActivateCoreNSSI ::: getServiceVNFAndVFsFromCatalogDB ****") + } + + public void prepareSOMacroRequestPayLoad(DelegateExecution execution) { + logger.debug("**** Enter DoActivateCoreNSSI ::: prepareSOMacroRequestPayLoad ****") + String json = execution.getVariable("serviceVnfs") + logger.debug(">>>> json "+json) + List<Object> vnfList = mapper.readValue(json, List.class); + logger.debug("vnfList: "+vnfList) + Map<String,Object> serviceMap = mapper.readValue(execution.getVariable("serviceModelInfo"), Map.class); + ModelInfo serviceModelInfo = new ModelInfo() + serviceModelInfo.setModelType(ModelType.service) + serviceModelInfo.setModelInvariantId(serviceMap.get("modelInvariantUuid")) + serviceModelInfo.setModelVersionId(serviceMap.get("modelUuid")) + serviceModelInfo.setModelName(serviceMap.get("modelName")) + serviceModelInfo.setModelVersion(serviceMap.get("modelVersion")) + + logger.debug("serviceModelInfo: "+serviceModelInfo) + //List of Vnfs + List<Object> vnfModelInfoList = new ArrayList<>() + + Map vnfMap = vnfList.get(0) + ModelInfo vnfModelInfo = vnfMap.get("modelInfo") + logger.debug("vnfModelInfo "+vnfModelInfo) + + //List of VFModules + List<Map<String, Object>> vfModuleList = vnfMap.get("vfModules") + logger.debug("vfModuleList "+vfModuleList) + + //List of VfModules + List<ModelInfo> vfModelInfoList = new ArrayList<>() + + //Traverse VFModules List and add in vfModelInfoList + for (vfModule in vfModuleList) { + ModelInfo vfModelInfo = vfModule.get("modelInfo") + logger.debug("vfModelInfo "+vfModelInfo) + vfModelInfoList.add(vfModelInfo) + } + + //RequestInfo + RequestInfo requestInfo = new RequestInfo() + + //Dummy Product FamilyId + requestInfo.setProductFamilyId("test1234") + requestInfo.setSource("VID") + requestInfo.setInstanceName(execution.getVariable("networkServiceInstanceName")) + requestInfo.setSuppressRollback(false) + requestInfo.setRequestorId("NBI") + + //Service Level InstanceParams + List<Map<String, Object>> serviceParams = new ArrayList<>() + Map<String, Object> serviceParamsValues = new LinkedHashMap<>() + serviceParams.add(serviceParamsValues) + + //Cloud Configuration + CloudConfiguration cloudConfiguration = new CloudConfiguration() + cloudConfiguration.setLcpCloudRegionId(execution.getVariable("lcpCloudRegionId")) + cloudConfiguration.setTenantId(execution.getVariable("tenantId")) + cloudConfiguration.setCloudOwner(execution.getVariable("cloudOwner")) + + //VFModules List + List<Map<String, Object>> vfModules = new ArrayList<>() + for (ModelInfo vfModuleModelInfo : vfModelInfoList) { + //Individual VFModule List + Map<String, Object> vfModuleValues = new LinkedHashMap<>() + vfModuleValues.put("modelInfo", vfModuleModelInfo) + vfModuleValues.put("instanceName", vfModuleModelInfo.getModelInstanceName()) + + //VFModule InstanceParams should be empty or this field should not be there? + List<Map<String, Object>> vfModuleInstanceParams = new ArrayList<>() + vfModuleValues.put("instanceParams", vfModuleInstanceParams) + } + + //Vnf intsanceParams + ObjectMapper objectMapper = new ObjectMapper(); + Map<String, Object> sliceProfile = objectMapper.readValue(execution.getVariable("sliceProfile"), Map.class); + + List vnfInstanceParamsList = new ArrayList<>() + String supportedsNssaiJson= prepareVnfInstanceParamsJson(execution) + vnfInstanceParamsList.add(supportedsNssaiJson) + + Platform platform = new Platform() + platform.setPlatformName(execution.getVariable("platform")) + + LineOfBusiness lineOfbusiness = new LineOfBusiness() + lineOfbusiness.setLineOfBusinessName(execution.getVariable("lineOfBusiness")) + + //Vnf Values + Map<String, Object> vnfValues = new LinkedHashMap<>() + vnfValues.put("lineOfBusiness", lineOfbusiness) + vnfValues.put("platform", platform) + vnfValues.put("productFamilyId", "test1234") + vnfValues.put("cloudConfiguration", cloudConfiguration) + vnfValues.put("vfModules", vfModules) + vnfValues.put("modelInfo", vnfModelInfo) + vnfValues.put("instanceName", execution.getVariable("vnfInstanceName")) + vnfValues.put("instanceParams",vnfInstanceParamsList) + + vnfModelInfoList.add(vnfValues) + //Service Level Resources + Map<String, Object> serviceResources = new LinkedHashMap<>() + serviceResources.put("vnfs", vnfModelInfoList) + + //Service Values + Map<String, Object> serviceValues = new LinkedHashMap<>() + serviceValues.put("modelInfo", serviceModelInfo) + serviceValues.put("instanceName", execution.getVariable("networkServiceInstanceName")) + serviceValues.put("resources", serviceResources) + serviceValues.put("instanceParams", serviceParams) + + //UserParams Values + Map<String, Object> userParamsValues = new LinkedHashMap<>() + + Map<String, Object> homingSolution = new LinkedHashMap<>() + homingSolution.put("Homing_Solution", "none") + + userParamsValues.put("service", serviceValues) + + //UserParams + List<Map<String, Object>> userParams = new ArrayList<>() + userParams.add(homingSolution) + userParams.add(userParamsValues) + + //Request Parameters + RequestParameters requestParameters = new RequestParameters() + requestParameters.setaLaCarte(false) + requestParameters.setSubscriptionServiceType(execution.getVariable("serviceType")) + requestParameters.setUserParams(userParams) + + //SubscriberInfo + SubscriberInfo subscriberInfo = new SubscriberInfo() + subscriberInfo.setGlobalSubscriberId(execution.getVariable("globalSubscriberId")) + + //Owning Entity + OwningEntity owningEntity = new OwningEntity() + owningEntity.setOwningEntityId(execution.getVariable("owningEntityId")) + + //Project + Project project = new Project() + project.setProjectName(execution.getVariable("projectName")) + + RequestDetails requestDetails = new RequestDetails() + requestDetails.setModelInfo(serviceModelInfo) + requestDetails.setSubscriberInfo(subscriberInfo) + requestDetails.setRequestInfo(requestInfo) + requestDetails.setRequestParameters(requestParameters) + requestDetails.setCloudConfiguration(cloudConfiguration) + requestDetails.setOwningEntity(owningEntity) + requestDetails.setProject(project) + + Map<String, Object> requestDetailsMap = new LinkedHashMap<>() + requestDetailsMap.put("requestDetails", requestDetails) + String requestPayload = objectMapper.writeValueAsString(requestDetailsMap) + + logger.debug("requestDetails "+requestPayload) + execution.setVariable("requestPayload", requestPayload) + + logger.debug(Prefix +" **** Exit DoActivateCoreNSSI ::: prepareSOMacroRequestPayLoad ****") + } + + public void sendPutRequestToSOMacro(DelegateExecution execution) { + + logger.debug(Prefix +" **** Enter DoActivateCoreNSSI ::: sendPutRequestToSOMacro ****") + try { + String msoEndpoint = UrnPropertiesReader.getVariable("mso.infra.endpoint.url", execution) + String url = msoEndpoint+"/serviceInstantiation/v7/serviceInstances/"+execution.getVariable("networkServiceInstanceId")+"/vnfs/"+execution.getVariable("vnfId") + String requestBody = execution.getVariable("requestPayload") + String msoKey = UrnPropertiesReader.getVariable("mso.msoKey", execution) + String basicAuth = UrnPropertiesReader.getVariable("mso.infra.endpoint.auth", execution) + String basicAuthValue = utils.encrypt(basicAuth, msoKey) + String encodeString = utils.getBasicAuth(basicAuthValue, msoKey) + + HttpClient httpClient = getHttpClientFactory().newJsonClient(new URL(url), ONAPComponents.SO) + httpClient.addAdditionalHeader("Authorization", encodeString) + httpClient.addAdditionalHeader("Accept", "application/json") + Response httpResponse = httpClient.put(requestBody) + handleSOResponse(httpResponse, execution) + + } catch (BpmnError e) { + throw e + } catch (any) { + String msg = "Exception in DoActivateCoreNSSSI " + any.getCause() + logger.error(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.debug(Prefix +" **** Exit DoActivateCoreNSSI ::: sendPostRequestToSOMacro ****") + } + + /** + * Handle SO Response for PUT and prepare update operation status + * @param execution + */ + private void handleSOResponse(Response httpResponse, DelegateExecution execution){ + logger.debug(Prefix +" **** Enter DoActivateCoreNSSI ::: handleSOResponse ****") + + int soResponseCode = httpResponse.getStatus() + logger.debug("soResponseCode : "+soResponseCode) + + if (soResponseCode >= 200 && soResponseCode < 204 && httpResponse.hasEntity()) { + String soResponse = httpResponse.readEntity(String.class) + String operationId = execution.getVariable("operationId") + def macroOperationId = jsonUtil.getJsonValue(soResponse, "operationId") + execution.setVariable("macroOperationId", macroOperationId) + execution.setVariable("isSOTimeOut", "no") + execution.setVariable("isSOResponseSucceed","yes") + } + else + { + String serviceName = execution.getVariable("serviceInstanceName") + execution.setVariable("isSOResponseSucceed","no") + prepareFailedOperationStatusUpdate(execution) + } + + logger.debug(Prefix +" **** Exit DoActivateCoreNSSI ::: handleSOResponse ****") + } + + /** + * prepare to call sub process CheckProcessStatus + * @param execution + */ + void prepareCallCheckProcessStatus(DelegateExecution execution){ + logger.debug(Prefix +" **** Enter DoActivateCoreNSSI ::: prepareCallCheckProcessStatus ****") + def successConditions = new ArrayList<>() + successConditions.add("finished") + execution.setVariable("successConditions", successConditions) + def errorConditions = new ArrayList<>() + errorConditions.add("error") + execution.setVariable("errorConditions", errorConditions) + execution.setVariable("processServiceType", "Network service") + execution.setVariable("subOperationType", "PUT") + execution.setVariable("initProgress", 20) + execution.setVariable("endProgress",90) + execution.setVariable("timeOut", TIMEOUT) + logger.debug(Prefix +" **** Exit DoActivateCoreNSSI ::: prepareCallCheckProcessStatus ****") + } + + void prepareUpdateResourceOperationStatus(DelegateExecution execution) { + + logger.debug(Prefix +" **** Enter DoActivateCoreNSSI ::: prepareUpdateResourceOperationStatus ****") + + String nssiOperationId = execution.getVariable("nssiOperationId") + execution.setVariable("operationId", nssiOperationId) + //Prepare Update Status for PUT failure and success + if(execution.getVariable("isTimeOut").equals("YES")) { + logger.debug("TIMEOUT - SO PUT Failure") + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "SO PUT Failure") + } + logger.debug(Prefix +" **** Exit DoActivateCoreNSSI ::: prepareUpdateResourceOperationStatus ****") + } + + void updateSliceProfileOrchestrationStatus(DelegateExecution execution) { + + logger.debug(Prefix +" **** Enter DoActivateCoreNSSI ::: updateSliceProfileOrchestrationStatus ****") + + String globalCustId = execution.getVariable("globalSubscriberId") + String serviceType = execution.getVariable("serviceType") + String oStatus = execution.getVariable("oStatus") + + ServiceInstance si = execution.getVariable("sliceProfileServiceInstance") + String sliceProfileInstanceId = si.getServiceInstanceId() + si.setOrchestrationStatus(oStatus) + + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + globalCustId, serviceType, sliceProfileInstanceId) + try { + + Response response = getAAIClient().update(uri, si) + + if(response.getStatus()!=200 || response.getStatus()!=201 || response.getStatus()!=202) { + exceptionUtil.buildAndThrowWorkflowException(execution, response.getStatus(), "AAI failed to update sliceProlie service Instance orchestration status") + } else { + setResourceOperationStatus(execution) + } + } catch (Exception e) { + logger.info("Update OrchestrationStatus in AAI failed") + String msg = "Update OrchestrationStatus in AAI failed, " + e.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + logger.debug(Prefix +" **** Exit DoActivateCoreNSSI ::: updateSliceProfileOrchestrationStatus ****") + } + + /** + * prepare ResourceOperation status + * @param execution + * @param operationType + */ + private void setResourceOperationStatus(DelegateExecution execution) { + + logger.debug(Prefix +" **** Enter DoActivateCoreNSSI ::: setResourceOperationStatus ****") + + String serviceId = execution.getVariable("nssiId") + String jobId = execution.getVariable("jobId") + String nsiId = execution.getVariable("nsiId") + String operationType = execution.getVariable("operationType") + ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus() + resourceOperationStatus.setServiceId(serviceId) + resourceOperationStatus.setOperationId(jobId) + resourceOperationStatus.setResourceTemplateUUID(nsiId) + resourceOperationStatus.setOperType(operationType) + resourceOperationStatus.setStatus("finished") + resourceOperationStatus.setProgress("100") + resourceOperationStatus.setStatusDescription("Core Activation Successful") + requestDBUtil.prepareUpdateResourceOperationStatus(execution, resourceOperationStatus) + + logger.debug(Prefix +" **** Exit DoActivateCoreNSSI ::: setResourceOperationStatus ****") + } + + void prepareFailedOperationStatusUpdate(DelegateExecution execution){ + logger.debug(Prefix + " **** Enter DoActivateCoreNSSI ::: prepareFailedOperationStatusUpdate ****") + + String serviceId = execution.getVariable("nssiId") + String jobId = execution.getVariable("jobId") + String nsiId = execution.getVariable("nsiId") + String operationType = execution.getVariable("operationType") + + ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus() + resourceOperationStatus.setServiceId(serviceId) + resourceOperationStatus.setOperationId(jobId) + resourceOperationStatus.setResourceTemplateUUID(nsiId) + resourceOperationStatus.setOperType(operationType) + resourceOperationStatus.setProgress(0) + resourceOperationStatus.setStatus("failed") + resourceOperationStatus.setStatusDescription("Core NSSI Activation Failed") + requestDBUtil.prepareUpdateResourceOperationStatus(execution, resourceOperationStatus) + + logger.debug(Prefix + " **** Exit DoActivateCoreNSSI ::: prepareFailedOperationStatusUpdate ****") + } + +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateCoreNSSITest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateCoreNSSITest.groovy new file mode 100644 index 0000000000..a39ca04d71 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateCoreNSSITest.groovy @@ -0,0 +1,631 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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 + * + * 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.infrastructure.scripts + +import static org.junit.Assert.* + +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.Test +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.onap.so.bpmn.common.scripts.MsoGroovyTest +import org.slf4j.Logger +import org.mockito.Mockito +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 static org.mockito.Mockito.spy +import static org.mockito.Mockito.times +import static org.mockito.Mockito.verify +import static org.mockito.Mockito.when +import static org.mockito.ArgumentMatchers.eq + +import javax.ws.rs.NotFoundException + +class DoActivateCoreNSSITest extends MsoGroovyTest { + + DoActivateCoreNSSI doActivate = new DoActivateCoreNSSI() + @Before + void init() throws IOException { + super.init("DoActivateCoreNSSI") + } + + @Captor + static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Test + void testPreProcessRequest(){ + + setUpMockdataFromCommonActivateSliceSubnet() + doActivate.preProcessRequest(mockExecution) + + Mockito.verify(mockExecution, times(1)).setVariable(eq("oStatus"), captor.capture()) + def statusValue = captor.getValue() + assertEquals("deactivated", statusValue) + + Mockito.verify(mockExecution, times(1)).setVariable(eq("sNssai"), captor.capture()) + def sNssai = captor.getValue() + assertEquals("01-5B179BD4", sNssai) + + Mockito.verify(mockExecution,times(3)).setVariable(captor.capture() as String, captor.capture()) + List<ExecutionEntity> values = captor.getAllValues() + assertNotNull(values) + } + + @Test + void testGetNetworkInstanceWithSPInstanceAssociatedWithNssiId(){ + + setUpMockdataFromCommonActivateSliceSubnet() + when(mockExecution.getVariable("serviceType")).thenReturn("5G") + + DoActivateCoreNSSI obj = spy(DoActivateCoreNSSI.class) + when(obj.getAAIClient()).thenReturn(client) + AAIResourceUri resourceUri1 = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "NSSI-C-7Q4-HDBNJ-NSSMF-01-A-ZX") + when(client.exists(resourceUri1)).thenReturn(true) + AAIResultWrapper wrapper1 = new AAIResultWrapper(mockQuerySliceServiceReturn()) + when(client.get(resourceUri1, NotFoundException.class)).thenReturn(wrapper1) + + //networkServiceInstanceId + when(mockExecution.getVariable("networkServiceInstanceId")).thenReturn("206535e7-77c9-4036-9387-3f1cf57b4379") + + AAIResourceUri resourceUri2 = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "206535e7-77c9-4036-9387-3f1cf57b4379") + when(client.exists(resourceUri2)).thenReturn(true) + AAIResultWrapper wrapper2 = new AAIResultWrapper(mockQueryNS()) + when(client.get(resourceUri2, NotFoundException.class)).thenReturn(wrapper2) + + //Check Vnf + when(mockExecution.getVariable("vnfId")).thenReturn("eeb66c6f-36bd-47ad-8294-48f46b1aa912") + AAIResourceUri resourceUri3 = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "eeb66c6f-36bd-47ad-8294-48f46b1aa912") + when(client.exists(resourceUri3)).thenReturn(true) + AAIResultWrapper wrapper3 = new AAIResultWrapper(mockQueryVnf()) + when(client.get(resourceUri3, NotFoundException.class)).thenReturn(wrapper3) + + + //Allotted Resources-1 + //when(mockExecution.getVariable("vnfId")).thenReturn("eeb66c6f-36bd-47ad-8294-48f46b1aa912") + AAIResourceUri resourceUri4 = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "0d3d3cce-46a8-486d-816a-954e71697c4e") + when(client.exists(resourceUri4)).thenReturn(true) + AAIResultWrapper wrapper4 = new AAIResultWrapper(mockServiceProfile1()) + when(client.get(resourceUri4, NotFoundException.class)).thenReturn(wrapper4) + + //Allotted Resources-2 + //when(mockExecution.getVariable("vnfId")).thenReturn("eeb66c6f-36bd-47ad-8294-48f46b1aa912") + AAIResourceUri resourceUri5 = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "1c7046f2-a5a3-4d7f-9da8-388ee641a795") + when(client.exists(resourceUri5)).thenReturn(true) + AAIResultWrapper wrapper5 = new AAIResultWrapper(mockServiceProfile2()) + when(client.get(resourceUri5, NotFoundException.class)).thenReturn(wrapper5) + + obj.getNetworkInstanceWithSPInstanceAssociatedWithNssiId(mockExecution) + + Mockito.verify(mockExecution, times(1)).setVariable(eq("networkServiceInstanceId"), captor.capture()) + assertEquals("206535e7-77c9-4036-9387-3f1cf57b4379", captor.getValue()) + + Mockito.verify(mockExecution, times(1)).setVariable(eq("networkServiceInstanceName"), captor.capture()) + assertEquals("nsi_DemoEmbb", captor.getValue()) + + Mockito.verify(mockExecution, times(1)).setVariable(eq("networkServiceModelInvariantUuid"), captor.capture()) + assertEquals("848c5656-5594-4d41-84bb-7afc7c64765c", captor.getValue()) + + Mockito.verify(mockExecution, times(1)).setVariable(eq("owningEntityId"), captor.capture()) + assertEquals("OE-generic", captor.getValue()) + + //VnfId + Mockito.verify(mockExecution, times(1)).setVariable(eq("vnfId"), captor.capture()) + assertEquals("eeb66c6f-36bd-47ad-8294-48f46b1aa912", captor.getValue()) + + Mockito.verify(mockExecution, times(1)).setVariable(eq("snssaiAndOrchStatusList"), captor.capture()) + List<Map<String, Object>> snssaiList = new ArrayList<>() + Map<String, Object> snssaiMap = new LinkedHashMap<>() + snssaiMap.put("snssai", "01-5C83F071") + snssaiMap.put("status", "activated") + snssaiList.add(snssaiMap) + Map<String, Object> snssaiMap1 = new LinkedHashMap<>() + snssaiMap1.put("snssai", "01-5B179BD4") + snssaiMap1.put("status", "activated") + snssaiList.add(snssaiMap1) + assertEquals(snssaiList, captor.getValue()) + + //Verify Project + Mockito.verify(mockExecution, times(1)).setVariable(eq("projectName"), captor.capture()) + assertEquals("Project-generic", captor.getValue()) + + Mockito.verify(mockExecution, times(1)).setVariable(eq("tenantId"), captor.capture()) + assertEquals("3d5819f1542e4ef9a4ccb0bcb278ca10", captor.getValue()) + + Mockito.verify(mockExecution, times(1)).setVariable(eq("cloudOwner"), captor.capture()) + assertEquals("k8scloudowner", captor.getValue()) + + Mockito.verify(mockExecution, times(1)).setVariable(eq("lcpCloudRegionId"), captor.capture()) + assertEquals("k8sregion", captor.getValue()) + + Mockito.verify(mockExecution, times(1)).setVariable(eq("platformName"), captor.capture()) + assertEquals("test", captor.getValue()) + + Mockito.verify(mockExecution, times(1)).setVariable(eq("lineOfBusinessName"), captor.capture()) + assertEquals("LOB-Demonstration", captor.getValue()) + + } + + @Test + void testPrepareVnfInstanceParamsJson() { + List<Map<String, Object>> snssaiList = new ArrayList<>() + Map<String, Object> snssaiMap = new LinkedHashMap<>() + snssaiMap.put("snssai", "01-5C83F071") + snssaiMap.put("status", "activated") + snssaiList.add(snssaiMap) + Map<String, Object> snssaiMap1 = new LinkedHashMap<>() + snssaiMap1.put("snssai", "01-5B179BD4") + snssaiMap1.put("status", "activated") + snssaiList.add(snssaiMap1) + + when(mockExecution.getVariable("snssaiAndOrchStatusList")).thenReturn(snssaiList) + + String returnedJsonAsString= doActivate.prepareVnfInstanceParamsJson(mockExecution) + + String expectedJsonAsString = """{supportedNssai={"sNssai":[{"snssai":"01-5C83F071","status":"activated"},{"snssai":"01-5B179BD4","status":"activated"}]}}""" + assertEquals(expectedJsonAsString, returnedJsonAsString) + } + + + String mockQueryNS() { + return """ + { + "service-instance-id": "206535e7-77c9-4036-9387-3f1cf57b4379", + "service-instance-name": "nsi_DemoEmbb", + "environment-context": "General_Revenue-Bearing", + "workload-context": "Production", + "model-invariant-id": "848c5656-5594-4d41-84bb-7afc7c64765c", + "model-version-id": "2de92587-3395-44e8-bb2c-b9529747e580", + "resource-version": "1599228110527", + "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/206535e7-77c9-4036-9387-3f1cf57b4379/service-data/service-topology/", + "orchestration-status": "Assigned", + "relationship-list": { + "relationship": [{ + "related-to": "owning-entity", + "relationship-label": "org.onap.relationships.inventory.BelongsTo", + "related-link": "/aai/v19/business/owning-entities/owning-entity/OE-generic", + "relationship-data": [{ + "relationship-key": "owning-entity.owning-entity-id", + "relationship-value": "OE-generic" + }] + }, { + "related-to": "generic-vnf", + "relationship-label": "org.onap.relationships.inventory.ComposedOf", + "related-link": "/aai/v19/network/generic-vnfs/generic-vnf/eeb66c6f-36bd-47ad-8294-48f46b1aa912", + "relationship-data": [{ + "relationship-key": "generic-vnf.vnf-id", + "relationship-value": "eeb66c6f-36bd-47ad-8294-48f46b1aa912" + }], + "related-to-property": [{ + "property-key": "generic-vnf.vnf-name", + "property-value": "vfwuctest 0" + }] + }, { + "related-to": "project", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v19/business/projects/project/Project-generic", + "relationship-data": [{ + "relationship-key": "project.project-name", + "relationship-value": "Project-generic" + }] + }] + } +} + """ + } + + String mockQueryVnf() { + + return """ + { + "vnf-id": "eeb66c6f-36bd-47ad-8294-48f46b1aa912", + "vnf-name": "vfwuctest 0", + "vnf-type": "vfwuctest/null", + "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "prov-status": "PREPROV", + "orchestration-status": "ConfigAssigned", + "in-maint": false, + "is-closed-loop-disabled": false, + "resource-version": "1599228155361", + "model-invariant-id": "1086e068-c932-4b61-ae3b-2d2eb0cbe3ec", + "model-version-id": "7fbb28cf-7dfc-447a-892c-4a3130b371d2", + "model-customization-id": "471b3188-e8f2-470b-9f4d-89e74d45445f", + "relationship-list": { + "relationship": [{ + "related-to": "tenant", + "relationship-label": "org.onap.relationships.inventory.BelongsTo", + "related-link": "/aai/v19/cloud-infrastructure/cloud-regions/cloud-region/k8scloudowner/k8sregion/tenants/tenant/3d5819f1542e4ef9a4ccb0bcb278ca10", + "relationship-data": [{ + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "k8scloudowner" + }, { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "k8sregion" + }, { + "relationship-key": "tenant.tenant-id", + "relationship-value": "3d5819f1542e4ef9a4ccb0bcb278ca10" + }], + "related-to-property": [{ + "property-key": "tenant.tenant-name", + "property-value": "onap-tm5g-dev" + }] + }, { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.LocatedIn", + "related-link": "/aai/v19/cloud-infrastructure/cloud-regions/cloud-region/k8scloudowner/k8sregion", + "relationship-data": [{ + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "k8scloudowner" + }, { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "k8sregion" + }], + "related-to-property": [{ + "property-key": "cloud-region.owner-defined-type", + "property-value": "OwnerType" + }] + }, { + "related-to": "service-instance", + "relationship-label": "org.onap.relationships.inventory.ComposedOf", + "related-link": "/aai/v19/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vfw-k8s/service-instances/service-instance/206535e7-77c9-4036-9387-3f1cf57b4379", + "relationship-data": [{ + "relationship-key": "customer.global-customer-id", + "relationship-value": "Demonstration" + }, { + "relationship-key": "service-subscription.service-type", + "relationship-value": "vfw-k8s" + }, { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "206535e7-77c9-4036-9387-3f1cf57b4379" + }], + "related-to-property": [{ + "property-key": "service-instance.service-instance-name", + "property-value": "vfw-0201" + }] + }, { + "related-to": "platform", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v19/business/platforms/platform/test", + "relationship-data": [{ + "relationship-key": "platform.platform-name", + "relationship-value": "test" + }] + }, { + "related-to": "line-of-business", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v19/business/lines-of-business/line-of-business/LOB-Demonstration", + "relationship-data": [{ + "relationship-key": "line-of-business.line-of-business-name", + "relationship-value": "LOB-Demonstration" + }] + }] + } +} + """ + } + + String mockServiceProfile1() { + return """ + { + "service-instance-id": "0d3d3cce-46a8-486d-816a-954e71697c4e", + "service-instance-name": "DemoEmbb2", + "service-role": "e2esliceprofile-service", + "environment-context": "01-5C83F071", + "model-invariant-id": "040b1b40-3120-446b-b8e3-4f21d153d11e", + "model-version-id": "8b7dabb3-3f27-4555-a9fe-803e862b0292", + "service-instance-location-id": "39-00", + "resource-version": "1593511782269", + "orchestration-status": "activated", + "relationship-list": { + "relationship": [{ + "related-to": "service-instance", + "relationship-label": "org.onap.relationships.inventory.ComposedOf", + "related-link": "/aai/v19/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/4b2bdbc0-cf7e-4c50-882a-f660e3ab8520", + "relationship-data": [{ + "relationship-key": "customer.global-customer-id", + "relationship-value": "5GCustomer" + }, { + "relationship-key": "service-subscription.service-type", + "relationship-value": "5G" + }, { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "4b2bdbc0-cf7e-4c50-882a-f660e3ab8520" + }], + "related-to-property": [{ + "property-key": "service-instance.service-instance-name", + "property-value": "DemoEmbb" + }] + }] + }, + "allotted-resources": { + "allotted-resource": [{ + "id": "362e46c2-cd84-45e4-a6c1-77f4ef88328d", + "model-invariant-id": "e5941a50-ddb4-4f74-be03-25449ae02ddc", + "model-version-id": "ab171d60-c2cc-4903-ac1d-c451b647e461", + "resource-version": "1593511173712", + "type": "Allotted Resource", + "allotted-resource-name": "Allotted_DemoEmbb", + "relationship-list": { + "relationship": [{ + "related-to": "service-instance", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v19/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/ea107578-9854-4718-8145-7c7febf0de6c", + "relationship-data": [{ + "relationship-key": "customer.global-customer-id", + "relationship-value": "5GCustomer" + }, { + "relationship-key": "service-subscription.service-type", + "relationship-value": "5G" + }, { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "ea107578-9854-4718-8145-7c7febf0de6c" + }], + "related-to-property": [{ + "property-key": "service-instance.service-instance-name", + "property-value": "nsi_DemoEmbb" + }] + }] + } + }] + }, + "slice-profiles": { + "slice-profile": [{ + "profile-id": "31a83df8-5bd0-4df7-a50f-7900476b81a2", + "latency": 3, + "max-number-of-UEs": 0, + "coverage-area-TA-list": "Beijing;Beijing;HaidianDistrict;WanshouluStreet", + "ue-mobility-level": "stationary", + "resource-sharing-level": "0", + "exp-data-rate-UL": 500, + "exp-data-rate-DL": 2000, + "activity-factor": 0, + "e2e-latency": 0, + "jitter": 0, + "survival-time": 0, + "exp-data-rate": 0, + "payload-size": 0, + "traffic-density": 0, + "conn-density": 0, + "s-nssai": "01-5C83F071", + "resource-version": "1593525640617" + }] + } +} + + """ + } + + String mockServiceProfile2() { + return """ + { + "service-instance-id": "1c7046f2-a5a3-4d7f-9da8-388ee641a795", + "service-instance-name": "DemoEmbb", + "service-role": "e2esliceprofile-service", + "environment-context": "01-5B179BD4", + "model-invariant-id": "040b1b40-3120-446b-b8e3-4f21d153d12e", + "model-version-id": "8b7dabb3-3f27-4555-a9fe-803e862b0282", + "service-instance-location-id": "39-00", + "resource-version": "1593511782169", + "orchestration-status": "activated", + "relationship-list": { + "relationship": [{ + "related-to": "service-instance", + "relationship-label": "org.onap.relationships.inventory.ComposedOf", + "related-link": "/aai/v19/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/4b2bdbc0-cf7e-4c50-882a-f660e3ab8520", + "relationship-data": [{ + "relationship-key": "customer.global-customer-id", + "relationship-value": "5GCustomer" + }, { + "relationship-key": "service-subscription.service-type", + "relationship-value": "5G" + }, { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "4b2bdbc0-cf7e-4c50-882a-f660e3ab8520" + }], + "related-to-property": [{ + "property-key": "service-instance.service-instance-name", + "property-value": "DemoEmbb" + }] + }] + }, + "allotted-resources": { + "allotted-resource": [{ + "id": "362e46c2-cd84-45e4-a6c1-77f4ef88328d", + "model-invariant-id": "e5941a50-ddb4-4f74-be03-25449ae02ddc", + "model-version-id": "ab171d60-c2cc-4903-ac1d-c451b647e461", + "resource-version": "1593511173712", + "type": "Allotted Resource", + "allotted-resource-name": "Allotted_DemoEmbb", + "relationship-list": { + "relationship": [{ + "related-to": "service-instance", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v19/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/ea107578-9854-4718-8145-7c7febf0de6c", + "relationship-data": [{ + "relationship-key": "customer.global-customer-id", + "relationship-value": "5GCustomer" + }, { + "relationship-key": "service-subscription.service-type", + "relationship-value": "5G" + }, { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "ea107578-9854-4718-8145-7c7febf0de6c" + }], + "related-to-property": [{ + "property-key": "service-instance.service-instance-name", + "property-value": "nsi_DemoEmbb" + }] + }] + } + }] + }, + "slice-profiles": { + "slice-profile": [{ + "profile-id": "b86df550-9d70-452b-a5a9-eb8823417255", + "latency": 6, + "max-number-of-UEs": 0, + "coverage-area-TA-list": "Beijing;Beijing;HaidianDistrict;WanshouluStreet", + "ue-mobility-level": "stationary", + "resource-sharing-level": "0", + "exp-data-rate-UL": 500, + "exp-data-rate-DL": 1000, + "activity-factor": 0, + "e2e-latency": 0, + "jitter": 0, + "survival-time": 0, + "exp-data-rate": 0, + "payload-size": 0, + "traffic-density": 0, + "conn-density": 0, + "s-nssai": "01-5B179BD4", + "resource-version": "1593511356725" + }] + } +} + """ + } + + String mockQuerySliceServiceReturn(){ + String expect = + """{ + "service-instance-id": "NSSI-C-7Q4-HDBNJ-NSSMF-01-A-ZX", + "service-instance-name": "nssi_DemoEmbb", + "service-role": "nssi", + "environment-context": "cn", + "model-invariant-id": "da575e8e-0863-4172-88b3-b3a9ead67895", + "model-version-id": "e398c92f-27da-44b9-a717-1dbfc1bdd82e", + "service-instance-location-id": "39-00", + "resource-version": "1593525640482", + "orchestration-status": "activated", + "relationship-list": { + "relationship": [{ + "related-to": "service-instance", + "relationship-label": "org.onap.relationships.inventory.ComposedOf", + "related-link": "/aai/v19/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/206535e7-77c9-4036-9387-3f1cf57b4379", + "relationship-data": [{ + "relationship-key": "customer.global-customer-id", + "relationship-value": "5GCustomer" + }, { + "relationship-key": "service-subscription.service-type", + "relationship-value": "5G" + }, { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "206535e7-77c9-4036-9387-3f1cf57b4379" + }], + "related-to-property": [{ + "property-key": "service-instance.service-instance-name", + "property-value": "nsi_DemoEmbb" + }] + }, + { + "related-to": "allotted-resource", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v19/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/0d3d3cce-46a8-486d-816a-954e71697c4e/allotted-resources/allotted-resource/d63c241a-4c0b-4294-b4c3-5a57421a1769", + "relationship-data": [{ + "relationship-key": "customer.global-customer-id", + "relationship-value": "5GCustomer" + }, { + "relationship-key": "service-subscription.service-type", + "relationship-value": "5G" + }, { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "0d3d3cce-46a8-486d-816a-954e71697c4e" + }, { + "relationship-key": "allotted-resource.id", + "relationship-value": "d63c241a-4c0b-4294-b4c3-5a57421a1769" + }], + "related-to-property": [{ + "property-key": "allotted-resource.description" + }, { + "property-key": "allotted-resource.allotted-resource-name", + "property-value": "Allotted_DemoEmbb_shared" + }] + }, { + "related-to": "allotted-resource", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v19/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/1c7046f2-a5a3-4d7f-9da8-388ee641a795/allotted-resources/allotted-resource/362e46c2-cd84-45e4-a6c1-77f4ef88328d", + "relationship-data": [{ + "relationship-key": "customer.global-customer-id", + "relationship-value": "5GCustomer" + }, { + "relationship-key": "service-subscription.service-type", + "relationship-value": "5G" + }, { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "1c7046f2-a5a3-4d7f-9da8-388ee641a795" + }, { + "relationship-key": "allotted-resource.id", + "relationship-value": "362e46c2-cd84-45e4-a6c1-77f4ef88328d" + }], + "related-to-property": [{ + "property-key": "allotted-resource.description" + }, { + "property-key": "allotted-resource.allotted-resource-name", + "property-value": "Allotted_DemoEmbb" + }] + } + ] + } +} + """ + return expect + } + + void setUpMockdataFromCommonActivateSliceSubnet() { + + String bpmnRequest = """ + { + "serviceInstanceID": "NSSI-C-7Q4-HDBNJ-NSSMF-01-A-ZX", + "networkType": "an/cn/tn", + "globalSubscriberId": "5GCustomer", + "subscriptionServiceType": "5G", + "additionalProperties": { + "nsiId": "NSI-M-001-HDBNJ-NSMF-01-A-ZX", + "snssaiList": [ + "01-5B179BD4" + ], + "sliceProfileId": "ab9af40f13f721b5f13539d87484098" + } + } + """ + + String sliceParams ="""{ + "nsiId": "NSI-M-001-HDBNJ-NSMF-01-A-ZX", + "snssaiList": [ + "01-5B179BD4" + ], + "sliceProfileId": "ab9af40f13f721b5f13539d87484098" + }""" + + when(mockExecution.getVariable("msoRequestId")).thenReturn("5ad89cf9-0569-4a93-4509-d8324321e2be") + when(mockExecution.getVariable("serviceInstanceID")).thenReturn("NSSI-C-7Q4-HDBNJ-NSSMF-01-A-ZX") + when(mockExecution.getVariable("nsiId")).thenReturn("NSI-M-001-HDBNJ-NSMF-01-A-ZX") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") + when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("5G") + when(mockExecution.getVariable("operationType")).thenReturn("deactivateInstance") + when(mockExecution.getVariable("jobId")).thenReturn("5ad89cf9-0569-4a93-9999-d8324321e2be") + when(mockExecution.getVariable("bpmnRequest")).thenReturn(bpmnRequest) + when(mockExecution.getVariable("sliceParams")).thenReturn(sliceParams) + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateCoreNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateCoreNSSI.bpmn new file mode 100644 index 0000000000..b422545e84 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateCoreNSSI.bpmn @@ -0,0 +1,420 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1r4k2c2" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.0.0"> + <bpmn:process id="DoActivateCoreNSSI" name="DoActivateCoreNSSI" isExecutable="true"> + <bpmn:startEvent id="StartEvent_0lgslwq" name="Start"> + <bpmn:outgoing>SequenceFlow_0wwo1lh</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:scriptTask id="ScriptTask_1x13jc1" name="Pre-process request Check operationType" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0wwo1lh</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_139ejmn</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def activateNssi = new DoActivateCoreNSSI() +activateNssi.preProcessRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_0usuysi" name="Call AAI get VNF/VFs and model info" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1654pt0</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_09nihof</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def activateNssi = new DoActivateCoreNSSI() +activateNssi.getServiceVNFAndVFsFromCatalogDB(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_1t06mlw" name="Prepare request payload for SO macro service api" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_09nihof</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0fbr356</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def activateNssi = new DoActivateCoreNSSI() +activateNssi.prepareSOMacroRequestPayLoad(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_0lxbaxd" name="Call AAI update sliceProlie service Instance status" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1e20i9g</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0j0egoi</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def activateNssi = new DoActivateCoreNSSI() +activateNssi.updateSliceProfileOrchestrationStatus(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_1rjha8r" name="get NSSI instance with relationships and sliceProfile instance" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_139ejmn</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1654pt0</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def activateNssi = new DoActivateCoreNSSI() +activateNssi.getNetworkInstanceWithSPInstanceAssociatedWithNssiId(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_1tfpgcs" name="PUT SO Macro" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1mi4waj</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0rjd7tg</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def activateNssi = new DoActivateCoreNSSI() +activateNssi.sendPutRequestToSOMacro(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_1frasll" name="Prepare Call CheckServiceProcessStatus" scriptFormat="groovy"> + <bpmn:incoming>Flow_039sx2v</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_18x9gdi</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def activateNssi = new DoActivateCoreNSSI() +activateNssi.prepareCallCheckProcessStatus(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_11hntoj" name="CallCheckServiceProcessStatus" calledElement="CheckServiceProcessStatus"> + <bpmn:extensionElements> + <camunda:in source="networkServiceInstanceId" target="serviceInstanceId" /> + <camunda:in source="macroOperationId" target="operationId" /> + <camunda:in source="successConditions" target="successConditions" /> + <camunda:in source="errorConditions" target="errorConditions" /> + <camunda:in source="processServiceType" target="processServiceType" /> + <camunda:in source="timeOut" target="timeOut" /> + <camunda:out source="operationStatus" target="result" /> + <camunda:out source="operationContent" target="reason" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:out source="isTimeOut" target="isTimeOut" /> + <camunda:in source="subOperationType" target="operationType" /> + <camunda:in source="initProgress" target="initProgress" /> + <camunda:in source="endProgress" target="endProgress" /> + <camunda:in source="serviceInstanceID" target="parentServiceInstanceId" /> + <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> + <camunda:in source="operationId" target="parentOperationId" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_18x9gdi</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1l9ry0a</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="ScriptTask_1sfn88d" name="Prepare update Service operation status " scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1l9ry0a</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0wx21io</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def activateNssi = new DoActivateCoreNSSI() +activateNssi.prepareUpdateResourceOperationStatus(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0wwo1lh" sourceRef="StartEvent_0lgslwq" targetRef="ScriptTask_1x13jc1" /> + <bpmn:sequenceFlow id="SequenceFlow_139ejmn" sourceRef="ScriptTask_1x13jc1" targetRef="ScriptTask_1rjha8r" /> + <bpmn:sequenceFlow id="SequenceFlow_1654pt0" sourceRef="ScriptTask_1rjha8r" targetRef="ScriptTask_0usuysi" /> + <bpmn:sequenceFlow id="SequenceFlow_09nihof" sourceRef="ScriptTask_0usuysi" targetRef="ScriptTask_1t06mlw" /> + <bpmn:sequenceFlow id="SequenceFlow_1l9ry0a" sourceRef="CallActivity_11hntoj" targetRef="ScriptTask_1sfn88d" /> + <bpmn:sequenceFlow id="SequenceFlow_0fbr356" sourceRef="ScriptTask_1t06mlw" targetRef="IntermediateThrowEvent_0gueutz" /> + <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_0gueutz" name="Call SO macro api"> + <bpmn:incoming>SequenceFlow_0fbr356</bpmn:incoming> + <bpmn:linkEventDefinition name="CallSO" /> + </bpmn:intermediateThrowEvent> + <bpmn:sequenceFlow id="SequenceFlow_1mi4waj" sourceRef="IntermediateThrowEvent_150o0dl" targetRef="ScriptTask_1tfpgcs" /> + <bpmn:intermediateCatchEvent id="IntermediateThrowEvent_150o0dl" name="Call SO macro api"> + <bpmn:outgoing>SequenceFlow_1mi4waj</bpmn:outgoing> + <bpmn:linkEventDefinition name="CallSO" /> + </bpmn:intermediateCatchEvent> + <bpmn:sequenceFlow id="SequenceFlow_0rjd7tg" sourceRef="ScriptTask_1tfpgcs" targetRef="Gateway_03lo8jx" /> + <bpmn:exclusiveGateway id="ExclusiveGateway_02nqn2k" name="is TimeOut?" default="SequenceFlow_07u1gfw"> + <bpmn:incoming>SequenceFlow_0wx21io</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1e20i9g</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_07u1gfw</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_0wx21io" sourceRef="ScriptTask_1sfn88d" targetRef="ExclusiveGateway_02nqn2k" /> + <bpmn:sequenceFlow id="SequenceFlow_1e20i9g" name="No" sourceRef="ExclusiveGateway_02nqn2k" targetRef="ScriptTask_0lxbaxd"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isTimeOut") == "NO")}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:endEvent id="EndEvent_1061mty" name="End"> + <bpmn:incoming>SequenceFlow_0v0dntm</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_18x9gdi" sourceRef="ScriptTask_1frasll" targetRef="CallActivity_11hntoj" /> + <bpmn:exclusiveGateway id="Gateway_03lo8jx" name="is SO Response OK?" default="Flow_1jchhgj"> + <bpmn:incoming>SequenceFlow_0rjd7tg</bpmn:incoming> + <bpmn:outgoing>Flow_039sx2v</bpmn:outgoing> + <bpmn:outgoing>Flow_1jchhgj</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="Flow_039sx2v" name="Yes" sourceRef="Gateway_03lo8jx" targetRef="ScriptTask_1frasll"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isSOResponseSucceed" ) == "yes")}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:serviceTask id="ServiceTask_02x7eqy" name="Update Service Operation Status"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>Flow_1jchhgj</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0j0egoi</bpmn:incoming> + <bpmn:incoming>SequenceFlow_07u1gfw</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0v0dntm</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0v0dntm" sourceRef="ServiceTask_02x7eqy" targetRef="EndEvent_1061mty" /> + <bpmn:sequenceFlow id="Flow_1jchhgj" name="No" sourceRef="Gateway_03lo8jx" targetRef="ServiceTask_02x7eqy" /> + <bpmn:sequenceFlow id="SequenceFlow_0j0egoi" sourceRef="ScriptTask_0lxbaxd" targetRef="ServiceTask_02x7eqy" /> + <bpmn:sequenceFlow id="SequenceFlow_07u1gfw" name="Yes" sourceRef="ExclusiveGateway_02nqn2k" targetRef="ServiceTask_02x7eqy" /> + <bpmn:subProcess id="Activity_1tmdw60" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true"> + <bpmn:startEvent id="Event_159txw2"> + <bpmn:outgoing>Flow_149oqyp</bpmn:outgoing> + <bpmn:errorEventDefinition id="ErrorEventDefinition_15ur8z3" /> + </bpmn:startEvent> + <bpmn:endEvent id="Event_0c1ec2y"> + <bpmn:incoming>Flow_1qooaff</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="Activity_0u3yna7" name="Handle Unexpected Error" scriptFormat="groovy"> + <bpmn:incoming>Flow_1iqw69c</bpmn:incoming> + <bpmn:outgoing>Flow_1qooaff</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.common.scripts.* +ExceptionUtil ex = new ExceptionUtil() +ex.processJavaException(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="Activity_0u4a0ry" name="Prepare Resource Operation Status Update" scriptFormat="groovy"> + <bpmn:incoming>Flow_149oqyp</bpmn:incoming> + <bpmn:outgoing>Flow_1dh5sht</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def activateNssi = new DoActivateCoreNSSI() +activateNssi.prepareFailedOperationStatusUpdate(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:serviceTask id="Activity_11422x1" name="Update Resource Operation Status"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>Flow_1dh5sht</bpmn:incoming> + <bpmn:outgoing>Flow_1iqw69c</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="Flow_1iqw69c" sourceRef="Activity_11422x1" targetRef="Activity_0u3yna7" /> + <bpmn:sequenceFlow id="Flow_1dh5sht" sourceRef="Activity_0u4a0ry" targetRef="Activity_11422x1" /> + <bpmn:sequenceFlow id="Flow_149oqyp" sourceRef="Event_159txw2" targetRef="Activity_0u4a0ry" /> + <bpmn:sequenceFlow id="Flow_1qooaff" sourceRef="Activity_0u3yna7" targetRef="Event_0c1ec2y" /> + </bpmn:subProcess> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoActivateCoreNSSI"> + <bpmndi:BPMNEdge id="SequenceFlow_07u1gfw_di" bpmnElement="SequenceFlow_07u1gfw"> + <di:waypoint x="976" y="319" /> + <di:waypoint x="1123" y="319" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1041" y="301" width="18" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0j0egoi_di" bpmnElement="SequenceFlow_0j0egoi"> + <di:waypoint x="1099" y="258" /> + <di:waypoint x="1173" y="258" /> + <di:waypoint x="1173" y="279" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="376" y="387" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1jchhgj_di" bpmnElement="Flow_1jchhgj"> + <di:waypoint x="400" y="344" /> + <di:waypoint x="400" y="450" /> + <di:waypoint x="1190" y="450" /> + <di:waypoint x="1190" y="360" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="788" y="432" width="15" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0v0dntm_di" bpmnElement="SequenceFlow_0v0dntm"> + <di:waypoint x="1223" y="319" /> + <di:waypoint x="1263" y="319" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="483" y="448" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_039sx2v_di" bpmnElement="Flow_039sx2v"> + <di:waypoint x="425" y="319" /> + <di:waypoint x="470" y="319" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="439" y="301" width="18" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_18x9gdi_di" bpmnElement="SequenceFlow_18x9gdi"> + <di:waypoint x="570" y="319" /> + <di:waypoint x="610" y="319" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-180.5" y="448" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1e20i9g_di" bpmnElement="SequenceFlow_1e20i9g"> + <di:waypoint x="951" y="294" /> + <di:waypoint x="951" y="258" /> + <di:waypoint x="999" y="258" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="959" y="273" width="15" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0wx21io_di" bpmnElement="SequenceFlow_0wx21io"> + <di:waypoint x="868" y="319" /> + <di:waypoint x="926" y="319" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="137" y="448" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0rjd7tg_di" bpmnElement="SequenceFlow_0rjd7tg"> + <di:waypoint x="330" y="319" /> + <di:waypoint x="375" y="319" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-336" y="448" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1mi4waj_di" bpmnElement="SequenceFlow_1mi4waj"> + <di:waypoint x="178" y="319" /> + <di:waypoint x="230" y="319" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-489.5" y="448" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0fbr356_di" bpmnElement="SequenceFlow_0fbr356"> + <di:waypoint x="1020" y="120" /> + <di:waypoint x="1132" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="384" y="249" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1l9ry0a_di" bpmnElement="SequenceFlow_1l9ry0a"> + <di:waypoint x="710" y="319" /> + <di:waypoint x="768" y="319" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-21" y="448" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_09nihof_di" bpmnElement="SequenceFlow_09nihof"> + <di:waypoint x="820" y="120" /> + <di:waypoint x="920" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-460" y="189" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1654pt0_di" bpmnElement="SequenceFlow_1654pt0"> + <di:waypoint x="610" y="120" /> + <di:waypoint x="720" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-910" y="189" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_139ejmn_di" bpmnElement="SequenceFlow_139ejmn"> + <di:waypoint x="430" y="120" /> + <di:waypoint x="510" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-381" y="245" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0wwo1lh_di" bpmnElement="SequenceFlow_0wwo1lh"> + <di:waypoint x="242" y="120" /> + <di:waypoint x="330" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-489.5" y="249" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="StartEvent_0lgslwq_di" bpmnElement="StartEvent_0lgslwq"> + <dc:Bounds x="206" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="211" y="142" width="25" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1x13jc1_di" bpmnElement="ScriptTask_1x13jc1"> + <dc:Bounds x="330" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0usuysi_di" bpmnElement="ScriptTask_0usuysi"> + <dc:Bounds x="720" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1t06mlw_di" bpmnElement="ScriptTask_1t06mlw"> + <dc:Bounds x="920" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0lxbaxd_di" bpmnElement="ScriptTask_0lxbaxd"> + <dc:Bounds x="999" y="218" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1rjha8r_di" bpmnElement="ScriptTask_1rjha8r"> + <dc:Bounds x="510" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1tfpgcs_di" bpmnElement="ScriptTask_1tfpgcs"> + <dc:Bounds x="230" y="279" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1frasll_di" bpmnElement="ScriptTask_1frasll"> + <dc:Bounds x="470" y="279" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_11hntoj_di" bpmnElement="CallActivity_11hntoj"> + <dc:Bounds x="610" y="279" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1sfn88d_di" bpmnElement="ScriptTask_1sfn88d"> + <dc:Bounds x="768" y="279" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateThrowEvent_1808y0j_di" bpmnElement="IntermediateThrowEvent_0gueutz"> + <dc:Bounds x="1132" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1106" y="142" width="90" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateCatchEvent_11m7660_di" bpmnElement="IntermediateThrowEvent_150o0dl"> + <dc:Bounds x="142" y="301" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="115" y="341" width="90" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_02nqn2k_di" bpmnElement="ExclusiveGateway_02nqn2k" isMarkerVisible="true"> + <dc:Bounds x="926" y="294" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="922" y="354" width="59" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1061mty_di" bpmnElement="EndEvent_1061mty"> + <dc:Bounds x="1263" y="301" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1271" y="344" width="20" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_03lo8jx_di" bpmnElement="Gateway_03lo8jx" isMarkerVisible="true"> + <dc:Bounds x="375" y="294" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="360" y="264" width="80" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_02x7eqy_di" bpmnElement="ServiceTask_02x7eqy"> + <dc:Bounds x="1123" y="279" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1tmdw60_di" bpmnElement="Activity_1tmdw60" isExpanded="true"> + <dc:Bounds x="400" y="560" width="781" height="196" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="Flow_1qooaff_di" bpmnElement="Flow_1qooaff"> + <di:waypoint x="960" y="664" /> + <di:waypoint x="1068" y="664" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_149oqyp_di" bpmnElement="Flow_149oqyp"> + <di:waypoint x="466" y="664" /> + <di:waypoint x="530" y="664" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1dh5sht_di" bpmnElement="Flow_1dh5sht"> + <di:waypoint x="630" y="664" /> + <di:waypoint x="690" y="664" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1iqw69c_di" bpmnElement="Flow_1iqw69c"> + <di:waypoint x="790" y="664" /> + <di:waypoint x="860" y="664" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="Event_159txw2_di" bpmnElement="Event_159txw2"> + <dc:Bounds x="430" y="646" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_0c1ec2y_di" bpmnElement="Event_0c1ec2y"> + <dc:Bounds x="1068" y="646" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0u3yna7_di" bpmnElement="Activity_0u3yna7"> + <dc:Bounds x="860" y="624" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0u4a0ry_di" bpmnElement="Activity_0u4a0ry"> + <dc:Bounds x="530" y="624" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_11422x1_di" bpmnElement="Activity_11422x1"> + <dc:Bounds x="690" y="624" width="100" height="80" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> |