aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java27
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy70
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSliceTest.groovy7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java7
5 files changed, 99 insertions, 15 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java
index ea7de687ee..c02afc3327 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Copyright (C) 2020 Nokia.
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -26,6 +28,7 @@ import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
+import org.onap.so.bpmn.common.BBConstants;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.listener.ListenerRunner;
@@ -49,17 +52,21 @@ public class FlowManipulatorListenerRunner extends ListenerRunner {
}
public void modifyFlows(List<ExecuteBuildingBlock> flowsToExecute, BuildingBlockExecution execution) {
+ int sequenceBeforeFlowManipulator;
+ do {
+ sequenceBeforeFlowManipulator = execution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
+ ExecuteBuildingBlock currentBB = flowsToExecute.get(execution.getCurrentSequence());
+ List<FlowManipulator> filtered = filterListeners(flowManipulators,
+ (item -> item.shouldRunFor(currentBB.getBuildingBlock().getBpmnFlowName(),
+ execution.getCurrentSequence() == 0, execution)));
- ExecuteBuildingBlock currentBB = flowsToExecute.get(execution.getCurrentSequence());
- List<FlowManipulator> filtered = filterListeners(flowManipulators,
- (item -> item.shouldRunFor(currentBB.getBuildingBlock().getBpmnFlowName(),
- execution.getCurrentSequence() == 0, execution)));
-
- logger.info("Running flow manipulators:\n{}",
- filtered.stream().map(item -> item.getClass().getName()).collect(Collectors.joining("\n")));
- filtered.forEach(item -> item.run(flowsToExecute, currentBB, execution));
-
+ logger.info("Running flow manipulators:\n{}",
+ filtered.stream().map(item -> item.getClass().getName()).collect(Collectors.joining("\n")));
+ filtered.forEach(item -> item.run(flowsToExecute, currentBB, execution));
+ } while (isBuildingBlockSkipped(sequenceBeforeFlowManipulator, execution));
}
-
+ private boolean isBuildingBlockSkipped(int sequenceBeforeFlowManipulator, BuildingBlockExecution execution) {
+ return sequenceBeforeFlowManipulator != (int) execution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
+ }
}
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/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/adapter/vnf/tasks/VnfAdapterCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java
index 663b097b78..685dbe2dca 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java
@@ -121,8 +121,7 @@ public class VnfAdapterCreateTasks {
try {
volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
} catch (BBObjectNotFoundException bbException) {
- logger.error("Exception occurred if bb object not found in VnfAdapterCreateTasks createVfModule ",
- bbException);
+ logger.info("Volume Group not found in GBB. ");
}
CloudRegion cloudRegion = gBBInput.getCloudRegion();
RequestContext requestContext = gBBInput.getRequestContext();
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
index 43a85051be..217b3a848e 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
@@ -102,8 +102,11 @@ public class WorkflowActionBBTasks {
List<ExecuteBuildingBlock> flowsToExecute =
(List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
execution.setVariable("MacroRollback", false);
-
- flowManipulatorListenerRunner.modifyFlows(flowsToExecute, new DelegateExecutionImpl(execution));
+ try {
+ flowManipulatorListenerRunner.modifyFlows(flowsToExecute, new DelegateExecutionImpl(execution));
+ } catch (NullPointerException ex) {
+ workflowAction.buildAndThrowException(execution, "Error in FlowManipulator Modify Flows", ex);
+ }
int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence);