diff options
author | zm330 <zhangminyj@chinamobile.com> | 2019-07-29 15:19:40 +0800 |
---|---|---|
committer | zm330 <zhangminyj@chinamobile.com> | 2019-07-29 15:53:06 +0800 |
commit | b05d98d452bff903411f4b1efcadc9003206f7f3 (patch) | |
tree | 7cd0199af8bb136931db0453cfd6ac6a6fa18c1d /asdc-controller/src/main/java/org | |
parent | f5a69be34850dc102c02514a8126e79f00226fa6 (diff) |
repair vfcInstanceGroup order
Issue-ID: SO-2164
Change-Id: I827342692dc4e4241b22c6eb8dd455b2b9385fa8
Signed-off-by: zm330 <zhangminyj@chinamobile.com>
Diffstat (limited to 'asdc-controller/src/main/java/org')
-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); } } } |