summaryrefslogtreecommitdiffstats
path: root/openecomp-be
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be')
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/datatypes/Constants.java1
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/VnfTopologyTemplateConverter.java4
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/ToscaModelTest.java27
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/substitutionMappingWithFilter.yaml (renamed from openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/substitutionMappingExt.yaml)0
4 files changed, 13 insertions, 19 deletions
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/datatypes/Constants.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/datatypes/Constants.java
index 2dbc19f8cf..a8d29b9c6a 100644
--- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/datatypes/Constants.java
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/datatypes/Constants.java
@@ -22,6 +22,7 @@ public final class Constants {
public static final String DEFINITIONS_DIR = "Definitions/";
public static final String TOPOLOGY_TEMPLATE = "topology_template";
public static final String NODE_TYPE = "node_type";
+ public static final String NODE_FILTER = "node_filter";
public static final String NODE_TYPES = "node_types";
public static final String METADATA = "metadata";
public static final String NODE_TEMPLATES = "node_templates";
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 f902309c68..fe76ba01fe 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
@@ -47,6 +47,7 @@ import java.util.Optional;
import static org.openecomp.core.converter.datatypes.Constants.CAPABILITIES;
import static org.openecomp.core.converter.datatypes.Constants.INPUTS;
+import static org.openecomp.core.converter.datatypes.Constants.NODE_FILTER;
import static org.openecomp.core.converter.datatypes.Constants.NODE_TYPE;
import static org.openecomp.core.converter.datatypes.Constants.OUTPUTS;
import static org.openecomp.core.converter.datatypes.Constants.REQUIREMENTS;
@@ -122,7 +123,7 @@ public class VnfTopologyTemplateConverter {
nodeTemplate.setDescription((String) nodeTemplateAsMap.get("description"));
nodeTemplate.setDirectives((List<String>) nodeTemplateAsMap.get("directives"));
nodeTemplate.setInterfaces((Map<String, Object>) nodeTemplateAsMap.get("interfaces"));
- nodeTemplate.setNode_filter((NodeFilter) nodeTemplateAsMap.get("node_filter"));
+ nodeTemplate.setNode_filter((NodeFilter) nodeTemplateAsMap.get(NODE_FILTER));
nodeTemplate.setProperties((Map<String, Object>) nodeTemplateAsMap.get("properties"));
nodeTemplate.setRequirements((List<Map<String, RequirementAssignment>>) nodeTemplateAsMap.get("requirements"));
nodeTemplate.setType((String) nodeTemplateAsMap.get("type"));
@@ -168,6 +169,7 @@ public class VnfTopologyTemplateConverter {
convertSubstitutionMappingsSections(CAPABILITIES, substitutionMappings.get(CAPABILITIES)));
substitutionMapping.setRequirements(
convertSubstitutionMappingsSections(REQUIREMENTS, substitutionMappings.get(REQUIREMENTS)));
+ substitutionMapping.setSubstitution_filter((NodeFilter) substitutionMappings.get(NODE_FILTER));
return substitutionMapping;
}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/ToscaModelTest.java b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/ToscaModelTest.java
index 88e8461299..4ad4d2b53e 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/ToscaModelTest.java
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/ToscaModelTest.java
@@ -52,8 +52,6 @@ import org.onap.sdc.tosca.datatypes.model.ServiceTemplate;
import org.onap.sdc.tosca.datatypes.model.SubstitutionMapping;
import org.onap.sdc.tosca.datatypes.model.TopologyTemplate;
import org.onap.sdc.tosca.datatypes.model.extension.RequirementAssignmentExt;
-import org.onap.sdc.tosca.datatypes.model.extension.SubstitutionFilter;
-import org.onap.sdc.tosca.datatypes.model.extension.SubstitutionMappingExt;
import org.onap.sdc.tosca.datatypes.model.heatextend.ParameterDefinitionExt;
import org.onap.sdc.tosca.services.ToscaExtensionYamlUtil;
import org.onap.sdc.tosca.services.YamlUtil;
@@ -89,7 +87,7 @@ public class ToscaModelTest {
private static final String STRING_TYPE = "string";
private static final String ST_WITH_SERVICE_FILTER = "/serviceTemplateWithServiceFilter.yaml";
private static final String SUBSTITUTION_MAPPING = "/serviceTemplateWithSubstitutionMapping.yaml";
- private static final String SUBSTITUTION_MAPPING_EXT = "/substitutionMappingExt.yaml";
+ private static final String SUBSTITUTION_MAPPING_WITH_FILTER = "/substitutionMappingWithFilter.yaml";
@Test
public void testServiceTemplateJavaToYaml() {
@@ -460,40 +458,33 @@ public class ToscaModelTest {
@Test
public void testSubstitutionMapping() throws IOException {
- ServiceTemplate serviceTemplate = getServiceTemplateExt(BASE_DIR + SUBSTITUTION_MAPPING);
-
- SubstitutionMapping substitutionMappings = DataModelUtil.getSubstitutionMappings(serviceTemplate);
+ final ServiceTemplate serviceTemplate = getServiceTemplateExt(BASE_DIR + SUBSTITUTION_MAPPING);
+ final SubstitutionMapping substitutionMappings = DataModelUtil.getSubstitutionMappings(serviceTemplate);
Assert.assertEquals("myNodeType.node", substitutionMappings.getNode_type());
Assert.assertNotNull(substitutionMappings.getCapabilities());
Assert.assertEquals(1,substitutionMappings.getCapabilities().size());
Assert.assertNotNull(substitutionMappings.getRequirements());
Assert.assertEquals(1,substitutionMappings.getRequirements().size());
- Assert.assertEquals(true, substitutionMappings instanceof SubstitutionMappingExt);
- Assert.assertNull(((SubstitutionMappingExt)substitutionMappings).getSubstitution_filter());
-
+ Assert.assertNull(substitutionMappings.getSubstitution_filter());
}
@Test
- public void testSubstitutionMappingExt() throws IOException {
- ServiceTemplate serviceTemplate = getServiceTemplateExt(BASE_DIR + SUBSTITUTION_MAPPING_EXT);
+ public void testSubstitutionMappingWithFilter() throws IOException {
+ final ServiceTemplate serviceTemplate = getServiceTemplateExt(BASE_DIR + SUBSTITUTION_MAPPING_WITH_FILTER);
- SubstitutionMapping substitutionMappings = DataModelUtil.getSubstitutionMappings(serviceTemplate);
+ final SubstitutionMapping substitutionMappings = DataModelUtil.getSubstitutionMappings(serviceTemplate);
Assert.assertEquals("myNodeType.node", substitutionMappings.getNode_type());
Assert.assertNotNull(substitutionMappings.getCapabilities());
Assert.assertEquals(1,substitutionMappings.getCapabilities().size());
Assert.assertNotNull(substitutionMappings.getRequirements());
Assert.assertEquals(1,substitutionMappings.getRequirements().size());
- Assert.assertEquals(true, substitutionMappings instanceof SubstitutionMappingExt);
- SubstitutionFilter substitutionFilter = ((SubstitutionMappingExt) substitutionMappings).getSubstitution_filter();
+ final NodeFilter substitutionFilter = substitutionMappings.getSubstitution_filter();
Assert.assertNotNull(substitutionFilter);
Assert.assertNotNull(substitutionFilter.getProperties());
Assert.assertEquals(2,substitutionFilter.getProperties().size());
- List<Constraint> vendorFilter = substitutionFilter.getProperties().get(0).get("vendor");
+ final List<Constraint> vendorFilter = substitutionFilter.getProperties().get(0).get("vendor");
Assert.assertNotNull(vendorFilter);
Assert.assertNotNull(vendorFilter.get(0).getEqual());
-
-
-
}
private ServiceTemplate getServiceTemplate(String inputPath) throws IOException {
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/substitutionMappingExt.yaml b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/substitutionMappingWithFilter.yaml
index ae6a88ea77..ae6a88ea77 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/substitutionMappingExt.yaml
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/substitutionMappingWithFilter.yaml