diff options
author | Lukasz Muszkieta <lukasz.muszkieta@nokia.com> | 2020-06-19 13:52:48 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-06-19 13:52:48 +0000 |
commit | dcca3afc8f9c4de72e84a7573932544996438c7c (patch) | |
tree | c0e6bddf8f93434fd88e6c4b3dfda06cdfa53cc6 /bpmn | |
parent | d91569f2bbb8e4bf99c88bfd5883058818cf203e (diff) | |
parent | d7ea7740fa08583d83ea759776ca35420688de91 (diff) |
Merge "WorkflowAction, traverseNetworkCollection refactoring stage 2"
Diffstat (limited to 'bpmn')
-rw-r--r-- | bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java | 114 |
1 files changed, 59 insertions, 55 deletions
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 ac33d7ad08..95f10c35b2 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 @@ -809,70 +809,74 @@ public class WorkflowAction { } else { CollectionResourceCustomization collectionResourceCustomization = findCatalogNetworkCollection(execution, service); - if (collectionResourceCustomization != null) { - resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION, - collectionResourceCustomization.getModelCustomizationUUID(), false)); - logger.debug("Found a network collection"); - if (collectionResourceCustomization.getCollectionResource() != null) { - if (collectionResourceCustomization.getCollectionResource().getInstanceGroup() != null) { - String toscaNodeType = collectionResourceCustomization.getCollectionResource() - .getInstanceGroup().getToscaNodeType(); - if (toscaNodeType != null && toscaNodeType.contains(NETWORKCOLLECTION)) { - int minNetworks = 0; - org.onap.so.db.catalog.beans.InstanceGroup instanceGroup = - collectionResourceCustomization.getCollectionResource().getInstanceGroup(); - CollectionResourceInstanceGroupCustomization collectionInstCust = null; - if (!instanceGroup.getCollectionInstanceGroupCustomizations().isEmpty()) { - for (CollectionResourceInstanceGroupCustomization collectionInstanceGroupTemp : instanceGroup - .getCollectionInstanceGroupCustomizations()) { - if (collectionInstanceGroupTemp.getModelCustomizationUUID().equalsIgnoreCase( - collectionResourceCustomization.getModelCustomizationUUID())) { - collectionInstCust = collectionInstanceGroupTemp; - break; - } - } - if (collectionInstCust != null - && collectionInstCust.getSubInterfaceNetworkQuantity() != null) { - minNetworks = collectionInstCust.getSubInterfaceNetworkQuantity(); - } - } - logger.debug("minNetworks: {}", minNetworks); - CollectionNetworkResourceCustomization collectionNetworkResourceCust = null; - for (CollectionNetworkResourceCustomization collectionNetworkTemp : instanceGroup - .getCollectionNetworkResourceCustomizations()) { - if (collectionNetworkTemp.getNetworkResourceCustomization() - .getModelCustomizationUUID().equalsIgnoreCase( - collectionResourceCustomization.getModelCustomizationUUID())) { - collectionNetworkResourceCust = collectionNetworkTemp; - break; - } - } - for (int i = 0; i < minNetworks; i++) { - if (collectionNetworkResourceCust != null && collectionInstCust != null) { - Resource resource = new Resource(WorkflowType.VIRTUAL_LINK, - collectionNetworkResourceCust.getModelCustomizationUUID(), false); - resource.setVirtualLinkKey(Integer.toString(i)); - resourceList.add(resource); - } + traverseNetworkCollectionResourceCustomization(resourceList, collectionResourceCustomization); + } + traverseNetworkCollectionCustomization(resourceList, service); + } else { + buildAndThrowException(execution, + "Cannot orchestrate Service-Macro-Create without user params with a vnf. Please update ASDC model for new macro orchestration support or add service_recipe records to route to old macro flows"); + } + } + + private void traverseNetworkCollectionResourceCustomization(List<Resource> resourceList, + CollectionResourceCustomization collectionResourceCustomization) { + if (collectionResourceCustomization != null) { + resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION, + collectionResourceCustomization.getModelCustomizationUUID(), false)); + logger.debug("Found a network collection"); + if (collectionResourceCustomization.getCollectionResource() != null) { + if (collectionResourceCustomization.getCollectionResource().getInstanceGroup() != null) { + String toscaNodeType = collectionResourceCustomization.getCollectionResource().getInstanceGroup() + .getToscaNodeType(); + if (toscaNodeType != null && toscaNodeType.contains(NETWORKCOLLECTION)) { + int minNetworks = 0; + org.onap.so.db.catalog.beans.InstanceGroup instanceGroup = + collectionResourceCustomization.getCollectionResource().getInstanceGroup(); + CollectionResourceInstanceGroupCustomization collectionInstCust = null; + if (!instanceGroup.getCollectionInstanceGroupCustomizations().isEmpty()) { + for (CollectionResourceInstanceGroupCustomization collectionInstanceGroupTemp : instanceGroup + .getCollectionInstanceGroupCustomizations()) { + if (collectionInstanceGroupTemp.getModelCustomizationUUID().equalsIgnoreCase( + collectionResourceCustomization.getModelCustomizationUUID())) { + collectionInstCust = collectionInstanceGroupTemp; + break; } - } else { - logger.debug("Instance Group tosca node type does not contain NetworkCollection: {}", - toscaNodeType); } - } else { - logger.debug("No Instance Group found for network collection."); + if (collectionInstCust != null + && collectionInstCust.getSubInterfaceNetworkQuantity() != null) { + minNetworks = collectionInstCust.getSubInterfaceNetworkQuantity(); + } + } + logger.debug("minNetworks: {}", minNetworks); + CollectionNetworkResourceCustomization collectionNetworkResourceCust = null; + for (CollectionNetworkResourceCustomization collectionNetworkTemp : instanceGroup + .getCollectionNetworkResourceCustomizations()) { + if (collectionNetworkTemp.getNetworkResourceCustomization().getModelCustomizationUUID() + .equalsIgnoreCase(collectionResourceCustomization.getModelCustomizationUUID())) { + collectionNetworkResourceCust = collectionNetworkTemp; + break; + } + } + for (int i = 0; i < minNetworks; i++) { + if (collectionNetworkResourceCust != null && collectionInstCust != null) { + Resource resource = new Resource(WorkflowType.VIRTUAL_LINK, + collectionNetworkResourceCust.getModelCustomizationUUID(), false); + resource.setVirtualLinkKey(Integer.toString(i)); + resourceList.add(resource); + } } } else { - logger.debug("No Network Collection found. collectionResource is null"); + logger.debug("Instance Group tosca node type does not contain NetworkCollection: {}", + toscaNodeType); } } else { - logger.debug("No Network Collection Customization found"); + logger.debug("No Instance Group found for network collection."); } + } else { + logger.debug("No Network Collection found. collectionResource is null"); } - traverseNetworkCollectionCustomization(resourceList, service); } else { - buildAndThrowException(execution, - "Cannot orchestrate Service-Macro-Create without user params with a vnf. Please update ASDC model for new macro orchestration support or add service_recipe records to route to old macro flows"); + logger.debug("No Network Collection Customization found"); } } |