diff options
author | 2020-08-04 15:40:02 +0200 | |
---|---|---|
committer | 2020-08-11 11:02:14 +0000 | |
commit | 547b491752b577aff4a3c0f520cc87247e2f2c38 (patch) | |
tree | 220a76dfe89bf589ad7a73b5c66e616cf258f3b4 /openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp | |
parent | 38e9beac2e4e5f7abf6e1d9ee21517a19fb8e45e (diff) |
Fix policy element type
CSAR onboarding phase: policy element type fixed
from map to list according TOSCA format documentation.
Change-Id: I654f4b049a8f5129938a5d5f8307e105e2bed024
Issue-ID: SDC-3152
Signed-off-by: Dmitry Puzikov <d.puzikov2@partner.samsung.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp')
2 files changed, 9 insertions, 11 deletions
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/VnfTopologyTemplateConverter.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/VnfTopologyTemplateConverter.java index fe76ba01fe..dd7e11ab2b 100644 --- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/VnfTopologyTemplateConverter.java +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/VnfTopologyTemplateConverter.java @@ -207,11 +207,9 @@ public class VnfTopologyTemplateConverter { } private void convertPolicies(ServiceTemplate serviceTemplate, ServiceTemplateReaderService readerService) { - Map<String, Object> policiesAsMap = readerService.getPolicies(); - for (Map.Entry<String, Object> policy : policiesAsMap.entrySet()) { - PolicyDefinition policyDefinition = convertPolicy(policy.getValue()); - DataModelUtil.addPolicyDefinition(serviceTemplate, policy.getKey(), policyDefinition); - } + List<Object> policiesList = readerService.getPolicies(); + policiesList.forEach(policiesListItem -> ((Map<String, Object>) policiesListItem).forEach((key, value) -> + DataModelUtil.addPolicyDefinition(serviceTemplate, key, convertPolicy(value)))); } private PolicyDefinition convertPolicy(Object policyCandidate) { diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/services/ServiceTemplateReaderServiceImpl.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/services/ServiceTemplateReaderServiceImpl.java index e39a5a6c2e..9cd2d7ea07 100644 --- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/services/ServiceTemplateReaderServiceImpl.java +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/services/ServiceTemplateReaderServiceImpl.java @@ -61,13 +61,13 @@ public class ServiceTemplateReaderServiceImpl implements ServiceTemplateReaderSe } @Override - public Map<String, Object> getPolicies() { - Map<String, Object> policiesAsMap = new HashMap<>(); - if (!Objects.isNull(this.getTopologyTemplate()) && !Objects.isNull( - ((Map<String, Object>) this.getTopologyTemplate()).get(POLICIES))) { - policiesAsMap = (Map<String, Object>) ((Map<String, Object>) this.getTopologyTemplate()).get(POLICIES); + public List<Object> getPolicies() { + List<Object> policiesList = new ArrayList<>(); + if (Objects.nonNull(this.getTopologyTemplate()) && Objects.nonNull( + ((Map<String, Object>) this.getTopologyTemplate()).get(POLICIES))) { + policiesList = (List<Object>) ((Map<String, Object>) this.getTopologyTemplate()).get(POLICIES); } - return policiesAsMap; + return policiesList; } @Override |