diff options
Diffstat (limited to 'openecomp-be')
6 files changed, 30 insertions, 54 deletions
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/ServiceTemplateReaderService.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/ServiceTemplateReaderService.java index 3a0b2ce401..afde5052d3 100644 --- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/ServiceTemplateReaderService.java +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/ServiceTemplateReaderService.java @@ -45,7 +45,7 @@ public interface ServiceTemplateReaderService { List<Object> getImports(); - Map<String, Object> getPolicies(); + List<Object> getPolicies(); Map<String, Object> getDataTypes(); } 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 diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/MainServiceTemplate.yaml index a650f7d29d..041afbacf8 100644 --- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/MainServiceTemplate.yaml @@ -548,15 +548,4 @@ topology_template: substitution_mappings: node_type: tosca.nodes.nfv.VNF.vPCRF - policies: - scaling_aspects: - type: tosca.policies.nfv.ScalingAspects - properties: - aspects: - processing: - name: processing - description: aspect for processing - max_scale_level: 5 - step_deltas: - - delta_1 tosca_definitions_version: tosca_simple_yaml_1_0
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/out/MainServiceTemplate.yaml index f40f214929..0f41bb0d8b 100644 --- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/out/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/out/MainServiceTemplate.yaml @@ -544,16 +544,5 @@ topology_template: - virtual_link: capability: virtual_linkable node: Fabric - policies: - scaling_aspects: - type: tosca.policies.nfv.ScalingAspects - properties: - aspects: - processing: - name: processing - description: aspect for processing - max_scale_level: 5 - step_deltas: - - delta_1 substitution_mappings: node_type: tosca.nodes.nfv.VNF.vPCRF diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertPolicies/in/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertPolicies/in/MainServiceTemplate.yaml index 2a3de9d1e9..e2e411ba58 100644 --- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertPolicies/in/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertPolicies/in/MainServiceTemplate.yaml @@ -549,24 +549,24 @@ topology_template: substitution_mappings: node_type: tosca.nodes.nfv.VNF.vPCRF policies: - scaling_aspects: - type: tosca.policies.nfv.ScalingAspects - properties: - aspects: - processing: - name: processing - description: aspect for processing - max_scale_level: 5 - step_deltas: - - delta_1 - instantiation_levels: - type: tosca.policies.nfv.InstantiationLevels - description: test policy - properties: - levels: - instantiation_level_1: - scale_info: - processing: - scale_level: 0 - default_level: instantiation_level_1 + - scaling_aspects: + type: tosca.policies.nfv.ScalingAspects + properties: + aspects: + processing: + name: processing + description: aspect for processing + max_scale_level: 5 + step_deltas: + - delta_1 + - instantiation_levels: + type: tosca.policies.nfv.InstantiationLevels + description: test policy + properties: + levels: + instantiation_level_1: + scale_info: + processing: + scale_level: 0 + default_level: instantiation_level_1 tosca_definitions_version: tosca_simple_yaml_1_0
\ No newline at end of file |