diff options
author | Seshu Kumar M <seshu.kumar.m@huawei.com> | 2019-07-30 05:46:43 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-07-30 05:46:43 +0000 |
commit | d329015449b429f9b4dcced679a6e4e09b9e2430 (patch) | |
tree | 6eceaac502ccd30d49a8c61fcd11b83ef6fd0a8b /asdc-controller/src/main | |
parent | 5bc663e5831a87b897d43f0f7fb7ec8bce88e633 (diff) | |
parent | b05d98d452bff903411f4b1efcadc9003206f7f3 (diff) |
Merge "repair vfcInstanceGroup order"
Diffstat (limited to 'asdc-controller/src/main')
-rw-r--r-- | asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java index a08206b477..e4c95f6290 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java @@ -1087,9 +1087,9 @@ public class ToscaResourceInstaller { tempGroupList.addAll(groupList); for (Group group : groupList) { + boolean isAllExists = true; ArrayList<NodeTemplate> members = group.getMemberNodes(); for (NodeTemplate memberNode : members) { - boolean isAllExists = true; RequirementAssignments requirements = iSdcCsarHelper.getRequirementsOf(memberNode); if (requirements == null || requirements.getAll() == null || requirements.getAll().isEmpty()) { continue; @@ -1097,27 +1097,28 @@ public class ToscaResourceInstaller { List<RequirementAssignment> rqaList = requirements.getAll(); for (RequirementAssignment rqa : rqaList) { String name = rqa.getNodeTemplateName(); - for (NodeTemplate node : nodes) { - if (name.equals(node.getName())) { - break; - } + Optional<NodeTemplate> findNode = + nodes.stream().filter(node -> node.getName().equals(name)).findFirst(); + if (!findNode.isPresent()) { + isAllExists = false; + break; } - - isAllExists = false; - break; } - - if (isAllExists) { - strSequence.add(group.getName()); - tempGroupList.remove(group); - nodes.addAll(group.getMemberNodes()); + if (!isAllExists) { + break; } } - if (!tempGroupList.isEmpty() && tempGroupList.size() < groupList.size()) { - getVNFCGroupSequenceList(strSequence, tempGroupList, nodes, iSdcCsarHelper); + if (isAllExists) { + strSequence.add(group.getName()); + tempGroupList.remove(group); + nodes.addAll(group.getMemberNodes()); } } + + if (tempGroupList.size() != 0 && tempGroupList.size() < groupList.size()) { + getVNFCGroupSequenceList(strSequence, tempGroupList, nodes, iSdcCsarHelper); + } } public void processWatchdog(String distributionId, String servideUUID, Optional<String> distributionNotification, @@ -1896,7 +1897,13 @@ public class ToscaResourceInstaller { vnfcCustomization .setDescription(testNull(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); vnfcCustomization.setResourceInput(getVnfcResourceInput(vfcTemplate, inputList)); - vfcInstanceGroupCustom.getVnfcCustomizations().add(vnfcCustomization); + List<VnfcCustomization> vnfcCustomizations = vfcInstanceGroupCustom.getVnfcCustomizations(); + + if (vnfcCustomizations == null) { + vnfcCustomizations = new ArrayList<>(); + vfcInstanceGroupCustom.setVnfcCustomizations(vnfcCustomizations); + } + vnfcCustomizations.add(vnfcCustomization); } } } |