diff options
Diffstat (limited to 'bpmn')
8 files changed, 101 insertions, 12 deletions
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 37b30567c7..4eb9eedad5 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 @@ -674,7 +674,7 @@ return json.toString() requestInfo.setCallbackUrl(callbackUrl) requestInfo.setSourceId("so") requestInfo.setTimeout(timeOut) - //requestInfo.setNumSolutions() + requestInfo.setNumSolutions(100) nsiReqBody.setRequestInfo(requestInfo) nsiReqBody.setNSTInfo(nstInfo) @@ -703,7 +703,7 @@ return json.toString() requestInfo.setCallbackUrl(callbackUrl) requestInfo.setSourceId("so") requestInfo.setTimeout(timeOut) - //requestInfo.setNumSolutions() + requestInfo.setNumSolutions(100) nssiReqBody.setRequestInfo(requestInfo) nssiReqBody.setSliceProfile(sliceProfile) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy index 70acadf0d8..c136d52b13 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy @@ -315,12 +315,14 @@ public class CreateSliceService extends AbstractServiceTaskProcessor { logger.debug("Start prepareSelectNSTRequest") String requestId = execution.getVariable("msoRequestId") String messageType = "NSTSelectionResponse" - Map<String, Object> serviceProfile = execution.getVariable("serviceProfile") as Map<String, Object> execution.setVariable("nstSelectionUrl", "/api/oof/v1/selection/nst") execution.setVariable("nstSelection_messageType", messageType) execution.setVariable("nstSelection_correlator", requestId) String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution); execution.setVariable("nstSelection_timeout", timeout) + + Map<String, Object> serviceProfile = execution.getVariable("serviceProfile") as Map<String, Object> + serviceProfile.remove("profileId") String oofRequest = oofUtils.buildSelectNSTRequest(requestId, messageType, serviceProfile) execution.setVariable("nstSelection_oofRequest", oofRequest) logger.debug("Finish prepareSelectNSTRequest") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy index b5e1e6b82a..c5a928aaf9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy @@ -49,7 +49,9 @@ import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory import org.onap.logging.filter.base.ONAPComponents import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.aai.domain.yang.NetworkRoute import org.onap.aai.domain.yang.v19.ServiceInstance +import org.onap.aai.domain.yang.v20.Relationship import org.onap.aaiclient.client.aai.AAIObjectType import org.onap.aaiclient.client.aai.entities.AAIResultWrapper import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel @@ -86,6 +88,15 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor { //networkServiceModelUuid String networkServiceModelUuid = jsonUtil.getJsonValue(execution.getVariable("networkServiceModelInfo"), "modelUuid") ?: "" execution.setVariable("networkServiceModelUuid", networkServiceModelUuid) + String sliceParams = execution.getVariable("sliceParams") + logger.debug("sliceParams "+sliceParams) + List<String> bhEndPoints = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceParams, "endPoints")) + if(bhEndPoints.empty) { + logger.debug("End point info is empty") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "End point info is empty") + }else { + execution.setVariable("bh_endpoint", bhEndPoints.get(0)) + } logger.debug(Prefix+ " **** Exit DoAllocateCoreNonSharedSlice::: preProcessRequest ****") } @@ -376,6 +387,8 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor { if(response.getStatus()!=200 || response.getStatus()!=201 || response.getStatus()!=202) { exceptionUtil.buildAndThrowWorkflowException(execution, response.getStatus(), "Set association of NSSI and Network service instance has failed in AAI") } else { + //end point update + createEndPointsInAai(execution) execution.setVariable("progress", 100) execution.setVariable("status", "finished") execution.setVariable("statusDescription", "DoAllocateCoreNonSharedNSSI success") @@ -389,6 +402,63 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor { logger.debug(Prefix+ " **** Exit DoAllocateCoreNonSharedSlice ::: updateRelationship ****") } + private void createEndPointsInAai(DelegateExecution execution) { + String type = "endpoint" + String function = "core_EP" + int prefixLength = 24 + String addressFamily = "ipv4" + //BH RAN end point update + String bh_endpoint = execution.getVariable("bhEndPoints") + String bh_routeId = UUID.randomUUID().toString() + execution.setVariable("coreEp_ID_bh", bh_routeId) + String role = "CN" + String cnIpAddress = jsonUtil.getJsonValue(bh_endpoint, "IpAddress") + String LogicalLinkId = jsonUtil.getJsonValue(bh_endpoint, "LogicalLinkId") + String nextHopInfo = jsonUtil.getJsonValue(bh_endpoint, "nextHopInfo") + NetworkRoute bh_ep = new NetworkRoute() + bh_ep.setRouteId(bh_routeId) + bh_ep.setFunction(function) + bh_ep.setRole(role) + bh_ep.setType(type) + bh_ep.setIpAddress(cnIpAddress) + bh_ep.setLogicalInterfaceId(LogicalLinkId) + bh_ep.setNextHop(nextHopInfo) + bh_ep.setPrefixLength(prefixLength) + bh_ep.setAddressFamily(addressFamily) + try { + AAIResourcesClient client = new AAIResourcesClient() + logger.debug("creating bh endpoint . ID : "+bh_routeId+" node details : "+bh_ep.toString()) + AAIResourceUri networkRouteUri = AAIUriFactory.createResourceUri( new AAIObjectType(AAINamespaceConstants.NETWORK, NetworkRoute.class), bh_routeId) + client.create(networkRouteUri, bh_ep) + //relationship b/w bh_ep and Core NSSI + def coreNssi = execution.getVariable("NSSIserviceInstanceId") + Relationship relationship = new Relationship() + String relatedLink = "aai/v21/network/network-routes/network-route/${bh_routeId}" + relationship.setRelatedLink(relatedLink) + relationship.setRelatedTo("network-route") + relationship.setRelationshipLabel("org.onap.relationships.inventory.ComposedOf") + try { + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + execution.getVariable("globalSubscriberId"), + execution.getVariable("subscriptionServiceType"), + coreNssi).relationshipAPI() + client.create(uri, relationship) + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + String msg = "Exception in CreateCommunicationService.createRelationShipInAAI. " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + String msg = "Exception in createEndPointsInAai " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + /** * prepare ResourceOperation status * @param execution diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy index 1c4bbdcd26..1d7acd31c1 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy @@ -333,7 +333,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ execution.setVariable("AnAllocateNssiNbiRequest", nbiRequest) execution.setVariable("anSliceTaskInfo", sliceTaskInfo) - execution.setVariable("anSubnetType", SubnetType.AN_NF) + execution.setVariable("anSubnetType", SubnetType.AN) } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy index bc4060e10d..2cce68a2b6 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy @@ -43,7 +43,6 @@ import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.json.JsonUtils import org.slf4j.Logger import org.slf4j.LoggerFactory -import org.springframework.http.ResponseEntity import org.springframework.util.StringUtils class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ @@ -331,6 +330,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter Map<String, Object> profileInfo = sliceParams.getServiceProfile() + profileInfo.remove("profileId") TemplateInfo nstInfo = sliceParams.getNSTInfo() List<TemplateInfo> nsstInfos = execution.getVariable("nsstInfos") as List<TemplateInfo> @@ -596,7 +596,8 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ Map nssiNeedHandlerInfo = nssiNeedHandlerInfos.get(currNssiIndex) as Map TemplateInfo nsstInfo = nssiNeedHandlerInfo.get("nsstInfo") as TemplateInfo - Object profileInfo = nssiNeedHandlerInfo.get("sliceProfile") + Map<String, Object> profileInfo = nssiNeedHandlerInfo.get("sliceProfile") as Map + profileInfo.remove("profileId") String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution) logger.debug( "get NSI option OOF Url: " + urlString) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSliceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSliceTest.groovy index 1eddf66b86..6b15407dd0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSliceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSliceTest.groovy @@ -58,9 +58,13 @@ class DoAllocateCoreNonSharedSliceTest extends MsoGroovyTest { "modelInstanceName" : "5gcembb_proxy 0" }""" + String sliceParams= """{\r\n\t\"sliceProfile\": {\r\n\t\t\"snssaiList\": [\r\n\t\t\t\"001-100001\"\r\n\t\t],\r\n\t\t\"sliceProfileId\": \"ab9af40f13f721b5f13539d87484098\",\r\n\t\t\"plmnIdList\": [\r\n\t\t\t\"460-00\",\r\n\t\t\t\"460-01\"\r\n\t\t],\r\n\t\t\"perfReq\": {\r\n\t\t\t\"perfReqEmbbList \": [{\r\n\t\t\t\t\"activityFactor\": 50\r\n\t\t\t}]\r\n\t\t},\r\n\t\t\"maxNumberofUEs\": 200,\r\n\t\t\"coverageAreaTAList\": [\r\n\t\t\t\"1\",\r\n\t\t\t\"2\",\r\n\t\t\t\"3\",\r\n\t\t\t\"4\"\r\n\t\t],\r\n\t\t\"latency\": 2,\r\n\t\t\"resourceSharingLevel\": \"non-shared\"\r\n\t},\r\n\t\"endPoints\": [{\r\n\t\t\"IpAdress\": \"\",\r\n\t\t\"LogicalLinkId\": \"\",\r\n\t\t\"nextHopInfo\": \"\"\r\n\t}],\r\n\t\"nsiInfo\": {\r\n\t\t\"nsiId\": \"NSI-M-001-HDBNJ-NSMF-01-A-ZX\",\r\n\t\t\"nsiName\": \"eMBB-001\"\r\n\t},\r\n\t\"scriptName\": \"AN1\"\r\n}""" + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("123456") when(mockExecution.getVariable("networkServiceModelInfo")).thenReturn(networkServiceModelInfo) + when(mockExecution.getVariable("sliceParams")).thenReturn(sliceParams) + DoAllocateCoreNonSharedSlice allocateNssi = new DoAllocateCoreNonSharedSlice() allocateNssi.preProcessRequest(mockExecution) @@ -73,7 +77,8 @@ class DoAllocateCoreNonSharedSliceTest extends MsoGroovyTest { Mockito.verify(mockExecution, times(1)).setVariable(eq("orchestrationStatus"), captor.capture()) assertEquals("created", captor.getValue()) - Mockito.verify(mockExecution, times(4)).setVariable(captor.capture() as String, captor.capture()) + + Mockito.verify(mockExecution, times(5)).setVariable(captor.capture() as String, captor.capture()) } @Test diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java index 7c4f735577..5d95f973bf 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java @@ -178,6 +178,7 @@ public class WorkflowAction { public void selectExecutionList(DelegateExecution execution) throws Exception { try { + fillExecutionDefault(execution); final String bpmnRequest = (String) execution.getVariable(BBConstants.G_BPMN_REQUEST); ServiceInstancesRequest sIRequest = new ObjectMapper().readValue(bpmnRequest, ServiceInstancesRequest.class); @@ -1251,9 +1252,12 @@ public class WorkflowAction { foundVfModuleOrVG = true; } - if (vfModuleCustomization.getVfModule() != null - && vfModuleCustomization.getVfModule().getModuleHeatTemplate() != null - && vfModuleCustomization.getHeatEnvironment() != null) { + if ((vfModuleCustomization.getVfModule() != null) + && ((vfModuleCustomization.getVfModule().getModuleHeatTemplate() != null + && vfModuleCustomization.getHeatEnvironment() != null)) + || (vfModuleCustomization.getVfModule().getModelName() != null + && vfModuleCustomization.getVfModule().getModelName() + .contains("helm"))) { foundVfModuleOrVG = true; Resource resource = new Resource(WorkflowType.VFMODULE, vfModuleCustomization.getModelCustomizationUUID(), false); @@ -1871,12 +1875,15 @@ public class WorkflowAction { return generatedResourceId; } - private void fillExecution(DelegateExecution execution, boolean suppressRollback, String resourceId, - WorkflowType resourceType) { + private void fillExecutionDefault(DelegateExecution execution) { execution.setVariable("sentSyncResponse", false); execution.setVariable(HOMING, false); execution.setVariable("calledHoming", false); execution.setVariable(BBConstants.G_ISTOPLEVELFLOW, true); + } + + private void fillExecution(DelegateExecution execution, boolean suppressRollback, String resourceId, + WorkflowType resourceType) { execution.setVariable("suppressRollback", suppressRollback); execution.setVariable("resourceId", resourceId); execution.setVariable("resourceType", resourceType); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java index 50ff074866..7f22c5138e 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java @@ -243,6 +243,10 @@ public class WorkflowActionTest extends BaseTaskTest { SPY_workflowAction.selectExecutionList(execution); assertEquals(execution.getVariable("WorkflowActionErrorMessage"), "Exception while setting execution list. serviceInstance with name (instanceName) and different version id (3c40d244-808e-42ca-b09a-256d83d19d0a) already exists. The name must be unique."); + + // verify default values are present in failure case + assertEquals(true, execution.getVariable("isTopLevelFlow")); + assertEquals(false, execution.getVariable("sentSyncResponse")); } /** |