summaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2018-09-09 10:27:05 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2018-09-10 09:50:16 -0400
commit636dcb76e69ea9344750fc01b739ade57d20f7f6 (patch)
tree7c3443caf5a395a854151a211f08c97c59b71d12 /bpmn
parentdf20b8670136d4c26c0ba28dde131ca8e0702546 (diff)
updated create task BB
updated aai create task test to verify creation of obj updated assignfabricconfig bpmn test with extra task added junit test in aai config resources vfmod and vnfc workflowaction passes more config id info to execute updated assign config to connect objects in aai config Change-Id: I19468f2bb83f4509e87d380a7c98a9f19358e1ef Issue-ID: SO-1001 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java21
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java64
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java17
4 files changed, 90 insertions, 24 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java
index 6fcad95144..03559afb33 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java
@@ -27,6 +27,9 @@ public class Resource {
private boolean generated;
private boolean baseVfModule;
private String virtualLinkKey;
+ private String vnfCustomizationId;
+ private String vfModuleCustomizationId;
+ private String cvnfModuleCustomizationId;
public Resource(WorkflowType resourceType, String resourceId, boolean generated){
this.resourceId = resourceId;
@@ -64,4 +67,22 @@ public class Resource {
public void setVirtualLinkKey(String virtualLinkKey) {
this.virtualLinkKey = virtualLinkKey;
}
+ public String getVnfCustomizationId() {
+ return vnfCustomizationId;
+ }
+ public void setVnfCustomizationId(String vnfCustomizationId) {
+ this.vnfCustomizationId = vnfCustomizationId;
+ }
+ public String getVfModuleCustomizationId() {
+ return vfModuleCustomizationId;
+ }
+ public void setVfModuleCustomizationId(String vfModuleCustomizationId) {
+ this.vfModuleCustomizationId = vfModuleCustomizationId;
+ }
+ public String getCvnfModuleCustomizationId() {
+ return cvnfModuleCustomizationId;
+ }
+ public void setCvnfModuleCustomizationId(String cvnfModuleCustomizationId) {
+ this.cvnfModuleCustomizationId = cvnfModuleCustomizationId;
+ }
}
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 57d097e87a..5809d16492 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
@@ -43,6 +43,7 @@ import org.onap.aai.domain.yang.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup;
@@ -167,9 +168,10 @@ public class WorkflowAction {
} else {
key = modelInfo.getModelCustomizationId();
}
+ Resource resourceKey = new Resource(resourceType, key, aLaCarte);
for (OrchestrationFlow orchFlow : orchFlows) {
- ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, key, apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null);
+ ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey, apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false);
flowsToExecute.add(ebb);
}
} else {
@@ -564,7 +566,10 @@ public class WorkflowAction {
if(!vnfCustomizationUUID.equals("")&&!vfModuleCustomizationUUID.equals("")){
List<String> configs = traverseCatalogDbForConfiguration(vnfCustomizationUUID,vfModuleCustomizationUUID);
for(String config : configs){
- resourceCounter.add(new Resource(WorkflowType.CONFIGURATION,config,false));
+ Resource configResource = new Resource(WorkflowType.CONFIGURATION,config,false);
+ resource.setVnfCustomizationId(vnf.getModelInfo().getModelCustomizationId());
+ resource.setVfModuleCustomizationId(vfModule.getModelInfo().getModelCustomizationId());
+ resourceCounter.add(configResource);
}
}
}
@@ -820,69 +825,73 @@ public class WorkflowAction {
for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.SERVICE == x.getResourceType()).collect(Collectors.toList()).size(); i++) {
workflowResourceIds.setServiceInstanceId(resourceId);
flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.SERVICE == x.getResourceType())
- .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null));
+ .collect(Collectors.toList()).get(i), apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false));
}
} else if (orchFlow.getFlowName().contains(VNF)) {
for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.VNF == x.getResourceType()).collect(Collectors.toList()).size(); i++) {
flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.VNF == x.getResourceType())
- .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null));
+ .collect(Collectors.toList()).get(i), apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false));
}
} else if (orchFlow.getFlowName().contains(NETWORK)
&& !orchFlow.getFlowName().contains(NETWORKCOLLECTION)) {
for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.NETWORK == x.getResourceType()).collect(Collectors.toList()).size(); i++) {
flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.NETWORK == x.getResourceType())
- .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null));
+ .collect(Collectors.toList()).get(i), apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false));
}
for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.VIRTUAL_LINK == x.getResourceType()).collect(Collectors.toList()).size(); i++) {
Resource resource = resourceCounter.stream().filter(x -> WorkflowType.VIRTUAL_LINK == x.getResourceType())
.collect(Collectors.toList()).get(i);
- flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resource.getResourceId(), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, true, resource.getVirtualLinkKey()));
+ flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resource, apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, true, resource.getVirtualLinkKey(), false));
}
} else if (orchFlow.getFlowName().contains(VFMODULE)) {
List<Resource> vfModuleResourcesSorted = sortVfModulesByBaseFirst(resourceCounter.stream().filter(x -> WorkflowType.VFMODULE == x.getResourceType())
.collect(Collectors.toList()));
for (int i = 0; i < vfModuleResourcesSorted.size(); i++) {
- flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, vfModuleResourcesSorted.get(i).getResourceId(), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null));
+ flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, vfModuleResourcesSorted.get(i), apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false));
}
} else if (orchFlow.getFlowName().contains(VOLUMEGROUP)) {
for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.VOLUMEGROUP == x.getResourceType()).collect(Collectors.toList()).size(); i++) {
flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.VOLUMEGROUP == x.getResourceType())
- .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null));
+ .collect(Collectors.toList()).get(i), apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false));
}
} else if (orchFlow.getFlowName().contains(NETWORKCOLLECTION)) {
for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType()).collect(Collectors.toList()).size(); i++) {
flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType())
- .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null));
+ .collect(Collectors.toList()).get(i), apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false));
}
} else if (orchFlow.getFlowName().contains(CONFIGURATION)) {
for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.CONFIGURATION == x.getResourceType()).collect(Collectors.toList()).size(); i++) {
flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.CONFIGURATION == x.getResourceType())
- .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null));
+ .collect(Collectors.toList()).get(i), apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, true));
}
}else {
- flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, "", apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null));
+ flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, null, apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false));
}
}
return flowsToExecute;
}
- protected ExecuteBuildingBlock buildExecuteBuildingBlock(OrchestrationFlow orchFlow, String requestId, String key,
+ protected ExecuteBuildingBlock buildExecuteBuildingBlock(OrchestrationFlow orchFlow, String requestId, Resource resource,
String apiVersion, String resourceId, String requestAction, boolean aLaCarte, String vnfType,
- WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, boolean isVirtualLink, String virtualLinkKey) {
+ WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, boolean isVirtualLink, String virtualLinkKey, boolean isConfiguration) {
ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock();
BuildingBlock buildingBlock = new BuildingBlock();
buildingBlock.setBpmnFlowName(orchFlow.getFlowName());
buildingBlock.setMsoId(UUID.randomUUID().toString());
- buildingBlock.setKey(key);
+ if(resource == null){
+ buildingBlock.setKey("");
+ }else{
+ buildingBlock.setKey(resource.getResourceId());
+ }
buildingBlock.setIsVirtualLink(isVirtualLink);
buildingBlock.setVirtualLinkKey(virtualLinkKey);
executeBuildingBlock.setApiVersion(apiVersion);
@@ -894,6 +903,13 @@ public class WorkflowAction {
executeBuildingBlock.setRequestId(requestId);
executeBuildingBlock.setBuildingBlock(buildingBlock);
executeBuildingBlock.setRequestDetails(requestDetails);
+ if(isConfiguration){
+ ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys();
+ configurationResourceKeys.setCvnfcCustomizationUUID(resource.getCvnfModuleCustomizationId());
+ configurationResourceKeys.setVfModuleCustomizationUUID(resource.getVfModuleCustomizationId());
+ configurationResourceKeys.setVnfResourceCustomizationUUID(resource.getVnfCustomizationId());
+ executeBuildingBlock.setConfigurationResourceKeys(configurationResourceKeys);
+ }
return executeBuildingBlock;
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
index e9dc3742f5..e13a765cf2 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
@@ -148,6 +148,18 @@ public class AAIConfigurationResources {
AAIResourceUri vpnBindingURI = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, vpnId);
injectionHelper.getAaiClient().connect(configurationURI, vpnBindingURI);
}
+
+ public void connectConfigurationToVfModule(String configurationId, String vfModuleId, String vnfId){
+ AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
+ AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId);
+ injectionHelper.getAaiClient().connect(configurationURI, vfModuleURI);
+ }
+
+ public void connectConfigurationToVnfc(String configurationId, String vnfcName){
+ AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
+ AAIResourceUri vnfcURI = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfcName);
+ injectionHelper.getAaiClient().connect(configurationURI, vnfcURI);
+ }
/**
* method to delete Configuration details in A&AI
*
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
index 5948c66baa..3dc9a4da63 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
@@ -43,6 +43,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
@@ -63,6 +64,7 @@ public class AAIConfigurationResourcesTest extends TestDataSetup{
private ServiceInstance serviceInstance;
private GenericVnf genericVnf;
private VpnBinding vpnBinding;
+ private VfModule vfModule;
@Mock
protected AAIResourcesClient MOCK_aaiResourcesClient;
@@ -82,6 +84,7 @@ public class AAIConfigurationResourcesTest extends TestDataSetup{
serviceProxy = buildServiceProxy();
serviceInstance = buildServiceInstance();
genericVnf = buildGenericVnf();
+ vfModule = buildVfModule();
vpnBinding = buildVpnBinding();
doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient();
}
@@ -126,6 +129,20 @@ public class AAIConfigurationResourcesTest extends TestDataSetup{
aaiConfigurationResources.connectConfigurationToGenericVnf(configuration.getConfigurationId(), genericVnf.getVnfId());
verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
}
+
+ @Test
+ public void connectConfigurationToVfModuleTest() {
+ doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
+ aaiConfigurationResources.connectConfigurationToVfModule(configuration.getConfigurationId(), vfModule.getVfModuleId(),genericVnf.getVnfId());
+ verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
+ }
+
+ @Test
+ public void connectConfigurationToVnfcTest() {
+ doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
+ aaiConfigurationResources.connectConfigurationToVnfc(configuration.getConfigurationId(), "vnfcName");
+ verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
+ }
@Test
public void connectConfigurationToVpnBindingTest() {