diff options
author | aribeiro <anderson.ribeiro@est.tech> | 2019-09-11 13:50:46 +0100 |
---|---|---|
committer | Ofir Sonsino <ofir.sonsino@intl.att.com> | 2019-11-04 13:33:00 +0000 |
commit | 5775dd13964a56a60dfbe8fc72e5977672d5acb8 (patch) | |
tree | 5ce7f67dc963e219d338cde4a152f90f9dccc2fc /openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test | |
parent | dd22ca7a392b6532f6ed74d2aa985e14035828d1 (diff) |
Transform custom types for PNFD.
Transformation of customized Node Types for PNFD.
Issue-ID: SDC-2561
Change-Id: Id3e07edff0e5a8cb134aa12c07878e14c33d1512
Signed-off-by: aribeiro <anderson.ribeiro@est.tech>
Diffstat (limited to 'openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test')
12 files changed, 626 insertions, 78 deletions
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/pnfd/PnfTransformationEngineParameterizedTest.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/pnfd/PnfTransformationEngineParameterizedTest.java index e2cbc147ac..a343e1aec0 100644 --- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/pnfd/PnfTransformationEngineParameterizedTest.java +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/pnfd/PnfTransformationEngineParameterizedTest.java @@ -23,6 +23,7 @@ import static org.junit.Assert.assertEquals; import java.io.IOException; import java.io.InputStream; +import java.net.URISyntaxException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -40,6 +41,7 @@ import org.onap.sdc.tosca.datatypes.model.ServiceTemplate; import org.onap.sdc.tosca.services.ToscaExtensionYamlUtil; import org.onap.sdc.tosca.services.YamlUtil; import org.openecomp.core.converter.ServiceTemplateReaderService; +import org.openecomp.core.converter.pnfd.PnfdTransformationEngine; import org.openecomp.core.impl.services.ServiceTemplateReaderServiceImpl; @RunWith(Parameterized.class) @@ -72,7 +74,7 @@ public class PnfTransformationEngineParameterizedTest { @Parameterized.Parameters(name = "{index}: input: {0}, descriptor: {4}, output: {2}") - public static Collection input() throws IOException { + public static Collection input() throws IOException, URISyntaxException { return Files.list(getPathFromClasspath(TEST_CASES_PATH)).map(path -> { try { return buildTestCase(path); @@ -90,7 +92,6 @@ public class PnfTransformationEngineParameterizedTest { if (inputFilePath == null) { return Collections.emptyList(); } - ; final List<Path> transformationDescriptorList; try (final Stream<Path> files = Files.walk(testCasePath.resolve(TRANSFORMATION_DESCRIPTOR_FOLDER))) { transformationDescriptorList = files.filter(path -> Files.isRegularFile(path)) @@ -130,8 +131,8 @@ public class PnfTransformationEngineParameterizedTest { final ServiceTemplateReaderService serviceTemplateReaderService = new ServiceTemplateReaderServiceImpl(descriptor); final ServiceTemplate serviceTemplate = new ServiceTemplate(); - final PnfdTransformationEngine pnfdTransformationEngine = new PnfdTransformationEngine(serviceTemplateReaderService, serviceTemplate - , transformationDescriptorFilePath.toString()); + final PnfdTransformationEngine pnfdTransformationEngine = new PnfdNodeTemplateTransformationEngine( + serviceTemplateReaderService, serviceTemplate, transformationDescriptorFilePath.toString()); pnfdTransformationEngine.transform(); final String result = yamlUtil.objectToYaml(serviceTemplate); @@ -146,7 +147,7 @@ public class PnfTransformationEngineParameterizedTest { } } - private static Path getPathFromClasspath(final String location) { - return Paths.get(Thread.currentThread().getContextClassLoader().getResource(location).getPath()); + private static Path getPathFromClasspath(final String location) throws URISyntaxException { + return Paths.get(PnfTransformationEngineParameterizedTest.class.getClassLoader().getResource(location).toURI()); } }
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/pnfd/PnfTransformationEngineTest.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/pnfd/PnfTransformationEngineTest.java index 280d14888d..be13d775e3 100644 --- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/pnfd/PnfTransformationEngineTest.java +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/pnfd/PnfTransformationEngineTest.java @@ -37,6 +37,7 @@ import org.onap.sdc.tosca.datatypes.model.ServiceTemplate; import org.onap.sdc.tosca.services.ToscaExtensionYamlUtil; import org.onap.sdc.tosca.services.YamlUtil; import org.openecomp.core.converter.ServiceTemplateReaderService; +import org.openecomp.core.converter.pnfd.PnfdTransformationEngine; import org.openecomp.core.impl.services.ServiceTemplateReaderServiceImpl; @RunWith(Parameterized.class) @@ -66,11 +67,14 @@ public class PnfTransformationEngineTest { final ServiceTemplateReaderService serviceTemplateReaderService = new ServiceTemplateReaderServiceImpl(descriptor); final ServiceTemplate serviceTemplate = new ServiceTemplate(); - final PnfdTransformationEngine pnfdTransformationEngine = new PnfdTransformationEngine( + PnfdTransformationEngine pnfdTransformationEngine = new PnfdNodeTypeTransformationEngine( serviceTemplateReaderService, serviceTemplate); pnfdTransformationEngine.transform(); + pnfdTransformationEngine = new PnfdNodeTemplateTransformationEngine(serviceTemplateReaderService, serviceTemplate); + pnfdTransformationEngine.transform(); - final String result = yamlUtil.objectToYaml(serviceTemplate); + final String yamlContent = yamlUtil.objectToYaml(serviceTemplate); + final String result = yamlUtil.objectToYaml(yamlUtil.yamlToObject(yamlContent, ServiceTemplate.class)); final String expectedResult = getExpectedResultFor(inputFilename); assertEquals(expectedResult, result); } diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/pnfd/parser/ConversionDefinitionYamlParserTest.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/pnfd/parser/ConversionDefinitionYamlParserTest.java index 967081ba0f..2326318657 100644 --- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/pnfd/parser/ConversionDefinitionYamlParserTest.java +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/pnfd/parser/ConversionDefinitionYamlParserTest.java @@ -47,7 +47,7 @@ public class ConversionDefinitionYamlParserTest { fail(String.format("Could not load %s", definitionYamlFilePath)); return; } - final ConversionDefinition conversionDefinition = ConversionDefinitionYamlParser.parse(definitionYaml); + final ConversionDefinition conversionDefinition = ConversionDefinitionYamlParser.parse(definitionYaml).orElse(null); assertConversionDefinition(definitionYaml, conversionDefinition); } diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/model-driven-conversion.yaml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/model-driven-conversion.yaml deleted file mode 100644 index 4d1500169e..0000000000 --- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/model-driven-conversion.yaml +++ /dev/null @@ -1,69 +0,0 @@ -- transformation-for: nodeTemplate #or "region: nodeTemplate"; or "object: nodeTemplate" - name: PnfExtCp transformation - description: converts any node template that has a type tosca.nodes.nfv.PnfExtCp - query: #or "find:" - #currently we only support a single attribute and value search. Can be hierarchical like "properties: layer_protocols:". - #must have the same structure in the original node_template declaration, otherwise the attribute will not be found. - type: tosca.nodes.nfv.PnfExtCp - conversions: - - query: #attribute query - #must have the same structure in the original node_template declaration, otherwise the attribute will not be found. - #the value does not matter as we are going to convert it. - type: - to-name: type #new attribute name. We could have a default strategy to copy the original name (in the query) if this entry is not provided. - to-value: - strategy: replace - from: tosca.nodes.nfv.PnfExtCp #could be ignored - to: org.openecomp.resource.cp.v2.extCP - - query: - properties: - layer_protocols: - to-name: ip_requirements - to-value: - strategy: replaceInList - list: - - from: ipv4 - to: - assingment_method: dhcp - ip_version: 4 - - from: ipv6 - to: - assingment_method: dhcp - ip_version: 6 - to-get-input: ipRequirements -- transformation-for: getInputFunction - name: ipRequirements - description: converts IpRequirements inputs when called by a get_input TOSCA function - conversions: - - query: - type: - to-name: type - to-value: - strategy: copy - - query: - description: - to-name: description - to-value: - strategy: copy - - query: - entry_schema: - type: - to-name: type - to-value: - strategy: replace - from: string - to: org.openecomp.datatypes.network.IpRequirements - - query: - default: - to-name: default - to-value: - strategy: replaceInList - list: - - from: ipv4 - to: - assingment_method: dhcp - ip_version: 4 - - from: ipv6 - to: - assingment_method: dhcp - ip_version: 6
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/pnfDescriptor/in/pnfDescriptor_withCustomType.yaml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/pnfDescriptor/in/pnfDescriptor_withCustomType.yaml new file mode 100644 index 0000000000..8fc43390dc --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/pnfDescriptor/in/pnfDescriptor_withCustomType.yaml @@ -0,0 +1,95 @@ +tosca_definitions_version: tosca_simple_yaml_1_1 + +description: the service template of a PNFD + +imports: + - etsi_nfv_sol001_pnfd_2_5_1_types.yaml + +node_types: + myCustomizedNodeType_A: + derived_from: tosca.nodes.nfv.PnfExtCp + myCustomizedNodeType_B: + derived_from: myCustomizedNodeType_A + myCustomizedNodeType_C: + derived_from: AnotherCustomizedNodeType + myCustomizedNodeType_D: + derived_from: myCustomizedNodeType_C + myCustomizedNodeType_E: + derived_from: myCustomizedNodeType_D + properties: + descriptor_id: + type: string + constraints: [ valid_values: [ b1bb0ce7-ebca-4fa7-95ed-4840d70a2233 ] ] + default: b1bb0ce7-ebca-4fa7-95ed-4840d70a2233 + function_description: + type: string + default: an example PNF + provider: + type: string + constraints: [ valid_values: [ MyCompany] ] + default: MyCompany + version: + type: string + constraints: [ valid_values: [ '1.0' ] ] + default: '1.0' + descriptor_invariant_id: + type: string + constraints: [ valid_values: [ 1111-2222-ccaa-bbdd ] ] + default: 1111-2222-ccaa-bbdd + name: + type: string + constraints: [ valid_values: [ExamplePnf] ] + default: ExamplePnf + requirements: + - virtual_link: + capability: tosca.capabilities.nfv.VirtualLinkable + +topology_template: + inputs: + anyOtherInput: + type: string + description: this is input1 + default: defaultValue + protocols: + type: list + description: IP protocols + entry_schema: + type: string + default: [ ipv4, ipv6 ] + + substitution_mappings: + node_type: myCustomizedNodeType_B + requirements: + virtual_link: [ pnfExtCp_1, external_virtual_link ] + + node_templates: + pnf_mainPart: + type: myCustomizedNodeType_B + properties: + descriptor_id: b1bb0ce7-ebca-4fa7-95ed-4840d70a2233 + function_description: an example PNF + provider: Mycompany + version: 1.0 + descriptor_invariant_id: 1111-2222-ccaa-bbdd + name: ExamplePnf + + pnfExtCp_1: + type: tosca.nodes.nfv.PnfExtCp + properties: + protocol: [ associated_layer_protocol: ipv4 ] + trunk_mode: false + layer_protocols: [ ipv4 ] + role: leaf + description: External connection point to access this pnf + requirements: + - dependency: pnf_mainPart + + pnfExtCp_2: + type: tosca.nodes.nfv.PnfExtCp + properties: + trunk_mode: false + layer_protocols: { get_input: protocols } + role: leaf + description: External connection point to access Acme myPnf + requirements: + - dependency: myPnf
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/pnfDescriptor/in/pnfDescriptor_withCustomTypeDerivedFromMultiple.yaml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/pnfDescriptor/in/pnfDescriptor_withCustomTypeDerivedFromMultiple.yaml new file mode 100644 index 0000000000..b3f4ce0f53 --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/pnfDescriptor/in/pnfDescriptor_withCustomTypeDerivedFromMultiple.yaml @@ -0,0 +1,95 @@ +tosca_definitions_version: tosca_simple_yaml_1_1 + +description: the service template of a PNFD + +imports: + - etsi_nfv_sol001_pnfd_2_5_1_types.yaml + +node_types: + myCustomizedNodeType_C: + derived_from: myCustomizedNodeType_B + myCustomizedNodeType_A: + derived_from: tosca.nodes.nfv.PnfExtCp + myCustomizedNodeType_D: + derived_from: myCustomizedNodeType_C + myCustomizedNodeType_E: + derived_from: myCustomizedNodeType_XXXXXX + myCustomizedNodeType_B: + derived_from: myCustomizedNodeType_A + properties: + descriptor_id: + type: string + constraints: [ valid_values: [ b1bb0ce7-ebca-4fa7-95ed-4840d70a2233 ] ] + default: b1bb0ce7-ebca-4fa7-95ed-4840d70a2233 + function_description: + type: string + default: an example PNF + provider: + type: string + constraints: [ valid_values: [ MyCompany] ] + default: MyCompany + version: + type: string + constraints: [ valid_values: [ '1.0' ] ] + default: '1.0' + descriptor_invariant_id: + type: string + constraints: [ valid_values: [ 1111-2222-ccaa-bbdd ] ] + default: 1111-2222-ccaa-bbdd + name: + type: string + constraints: [ valid_values: [ExamplePnf] ] + default: ExamplePnf + requirements: + - virtual_link: + capability: tosca.capabilities.nfv.VirtualLinkable + +topology_template: + inputs: + anyOtherInput: + type: string + description: this is input1 + default: defaultValue + protocols: + type: list + description: IP protocols + entry_schema: + type: string + default: [ ipv4, ipv6 ] + + substitution_mappings: + node_type: myCustomizedNodeType_C + requirements: + virtual_link: [ pnfExtCp_1, external_virtual_link ] + + node_templates: + pnf_mainPart: + type: myCustomizedNodeType_C + properties: + descriptor_id: b1bb0ce7-ebca-4fa7-95ed-4840d70a2233 + function_description: an example PNF + provider: Mycompany + version: 1.0 + descriptor_invariant_id: 1111-2222-ccaa-bbdd + name: ExamplePnf + + pnfExtCp_1: + type: tosca.nodes.nfv.PnfExtCp + properties: + protocol: [ associated_layer_protocol: ipv4 ] + trunk_mode: false + layer_protocols: [ ipv4 ] + role: leaf + description: External connection point to access this pnf + requirements: + - dependency: pnf_mainPart + + pnfExtCp_2: + type: tosca.nodes.nfv.PnfExtCp + properties: + trunk_mode: false + layer_protocols: { get_input: protocols } + role: leaf + description: External connection point to access Acme myPnf + requirements: + - dependency: myPnf
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/pnfDescriptor/in/pnfDescriptor_with_Invalid_CustomType.yaml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/pnfDescriptor/in/pnfDescriptor_with_Invalid_CustomType.yaml new file mode 100644 index 0000000000..d27fbfd70a --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/pnfDescriptor/in/pnfDescriptor_with_Invalid_CustomType.yaml @@ -0,0 +1,95 @@ +tosca_definitions_version: tosca_simple_yaml_1_1 + +description: the service template of a PNFD + +imports: + - etsi_nfv_sol001_pnfd_2_5_1_types.yaml + +node_types: + myCustomizedNodeType_A: + derived_from: tosca.nodes.nfv.INVALID + myCustomizedNodeType_B: + derived_from: myCustomizedNodeType_A + myCustomizedNodeType_C: + derived_from: myCustomizedNodeType_B + myCustomizedNodeType_D: + derived_from: myCustomizedNodeType_C + myCustomizedNodeType_E: + derived_from: myCustomizedNodeType_D + properties: + descriptor_id: + type: string + constraints: [ valid_values: [ b1bb0ce7-ebca-4fa7-95ed-4840d70a2233 ] ] + default: b1bb0ce7-ebca-4fa7-95ed-4840d70a2233 + function_description: + type: string + default: an example PNF + provider: + type: string + constraints: [ valid_values: [ MyCompany] ] + default: MyCompany + version: + type: string + constraints: [ valid_values: [ '1.0' ] ] + default: '1.0' + descriptor_invariant_id: + type: string + constraints: [ valid_values: [ 1111-2222-ccaa-bbdd ] ] + default: 1111-2222-ccaa-bbdd + name: + type: string + constraints: [ valid_values: [ExamplePnf] ] + default: ExamplePnf + requirements: + - virtual_link: + capability: tosca.capabilities.nfv.VirtualLinkable + +topology_template: + inputs: + anyOtherInput: + type: string + description: this is input1 + default: defaultValue + protocols: + type: list + description: IP protocols + entry_schema: + type: string + default: [ ipv4, ipv6 ] + + substitution_mappings: + node_type: 00_Another_NodeTypeMyCompany.examplePnf.1_0 + requirements: + virtual_link: [ pnfExtCp_1, external_virtual_link ] + + node_templates: + pnf_mainPart: + type: wrong_nodeType_Not_Derived_from_any_valid_Node + properties: + descriptor_id: b1bb0ce7-ebca-4fa7-95ed-4840d70a2233 + function_description: an example PNF + provider: Mycompany + version: 1.0 + descriptor_invariant_id: 1111-2222-ccaa-bbdd + name: ExamplePnf + + pnfExtCp_1: + type: tosca.nodes.nfv.PnfExtCp + properties: + protocol: [ associated_layer_protocol: ipv4 ] + trunk_mode: false + layer_protocols: [ ipv4 ] + role: leaf + description: External connection point to access this pnf + requirements: + - dependency: pnf_mainPart + + pnfExtCp_2: + type: tosca.nodes.nfv.PnfExtCp + properties: + trunk_mode: false + layer_protocols: { get_input: protocols } + role: leaf + description: External connection point to access Acme myPnf + requirements: + - dependency: myPnf
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/pnfDescriptor/in/pnfDescriptor_with_Multiple_CustomType.yaml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/pnfDescriptor/in/pnfDescriptor_with_Multiple_CustomType.yaml new file mode 100644 index 0000000000..7a886c4917 --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/pnfDescriptor/in/pnfDescriptor_with_Multiple_CustomType.yaml @@ -0,0 +1,105 @@ +tosca_definitions_version: tosca_simple_yaml_1_1 + +description: the service template of a PNFD + +imports: + - etsi_nfv_sol001_pnfd_2_5_1_types.yaml + +node_types: + myCustomizedNodeType_B: + derived_from: myCustomizedNodeType_A + myCustomizedNodeType_A: + derived_from: tosca.nodes.nfv.PnfExtCp + myCustomizedNodeType_C: + derived_from: myCustomizedNodeType_D + myCustomizedNodeType_D: + derived_from: tosca.nodes.nfv.PnfExtCp + myCustomizedNodeType_E: + derived_from: myCustomizedNodeType_D + properties: + descriptor_id: + type: string + constraints: [ valid_values: [ b1bb0ce7-ebca-4fa7-95ed-4840d70a2233 ] ] + default: b1bb0ce7-ebca-4fa7-95ed-4840d70a2233 + function_description: + type: string + default: an example PNF + provider: + type: string + constraints: [ valid_values: [ MyCompany] ] + default: MyCompany + version: + type: string + constraints: [ valid_values: [ '1.0' ] ] + default: '1.0' + descriptor_invariant_id: + type: string + constraints: [ valid_values: [ 1111-2222-ccaa-bbdd ] ] + default: 1111-2222-ccaa-bbdd + name: + type: string + constraints: [ valid_values: [ExamplePnf] ] + default: ExamplePnf + requirements: + - virtual_link: + capability: tosca.capabilities.nfv.VirtualLinkable + +topology_template: + inputs: + anyOtherInput: + type: string + description: this is input1 + default: defaultValue + protocols: + type: list + description: IP protocols + entry_schema: + type: string + default: [ ipv4, ipv6 ] + + substitution_mappings: + node_type: myCustomizedNodeType_B + requirements: + virtual_link: [ pnfExtCp_1, external_virtual_link ] + + node_templates: + pnf_mainPart: + type: myCustomizedNodeType_B + properties: + descriptor_id: b1bb0ce7-ebca-4fa7-95ed-4840d70a2233 + function_description: an example PNF + provider: Mycompany + version: 1.0 + descriptor_invariant_id: 1111-2222-ccaa-bbdd + name: ExamplePnf + + pnfExtCp_1: + type: tosca.nodes.nfv.PnfExtCp + properties: + protocol: [ associated_layer_protocol: ipv4 ] + trunk_mode: false + layer_protocols: [ ipv4 ] + role: leaf + description: External connection point to access this pnf + requirements: + - dependency: pnf_mainPart + + pnfExtCp_2: + type: tosca.nodes.nfv.PnfExtCp + properties: + trunk_mode: false + layer_protocols: { get_input: protocols } + role: leaf + description: External connection point to access Acme myPnf + requirements: + - dependency: myPnf + + pnfExtCp_3: + type: myCustomizedNodeType_C + properties: + trunk_mode: false + layer_protocols: { get_input: protocols } + role: leaf + description: External connection point to access Acme myPnf + requirements: + - dependency: myPnf
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/pnfDescriptor/out/topologyTemplate_withCustomType.yaml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/pnfDescriptor/out/topologyTemplate_withCustomType.yaml new file mode 100644 index 0000000000..0013ae08dc --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/pnfDescriptor/out/topologyTemplate_withCustomType.yaml @@ -0,0 +1,31 @@ +node_types: + org.openecomp.resource.abstract.myCustomizedNodeType_B: + derived_from: org.openecomp.resource.cp.v2.extCP + org.openecomp.resource.abstract.myCustomizedNodeType_A: + derived_from: org.openecomp.resource.cp.v2.extCP +topology_template: + inputs: + protocols: + type: list + description: IP protocols + default: + - assingment_method: dhcp + ip_version: 4 + - assingment_method: dhcp + ip_version: 6 + entry_schema: + type: org.openecomp.datatypes.network.IpRequirements + node_templates: + pnf_mainPart: + type: org.openecomp.resource.cp.v2.extCP + pnfExtCp_2: + type: org.openecomp.resource.cp.v2.extCP + properties: + ip_requirements: + get_input: protocols + pnfExtCp_1: + type: org.openecomp.resource.cp.v2.extCP + properties: + ip_requirements: + - assingment_method: dhcp + ip_version: 4 diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/pnfDescriptor/out/topologyTemplate_withCustomTypeDerivedFromMultiple.yaml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/pnfDescriptor/out/topologyTemplate_withCustomTypeDerivedFromMultiple.yaml new file mode 100644 index 0000000000..6092097c31 --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/pnfDescriptor/out/topologyTemplate_withCustomTypeDerivedFromMultiple.yaml @@ -0,0 +1,84 @@ +node_types: + org.openecomp.resource.abstract.myCustomizedNodeType_B: + derived_from: org.openecomp.resource.cp.v2.extCP + properties: + descriptor_id: + type: string + required: true + default: b1bb0ce7-ebca-4fa7-95ed-4840d70a2233 + status: supported + constraints: + - valid_values: + - b1bb0ce7-ebca-4fa7-95ed-4840d70a2233 + function_description: + type: string + required: true + default: an example PNF + status: supported + provider: + type: string + required: true + default: MyCompany + status: supported + constraints: + - valid_values: + - MyCompany + version: + type: string + required: true + default: '1.0' + status: supported + constraints: + - valid_values: + - '1.0' + descriptor_invariant_id: + type: string + required: true + default: 1111-2222-ccaa-bbdd + status: supported + constraints: + - valid_values: + - 1111-2222-ccaa-bbdd + name: + type: string + required: true + default: ExamplePnf + status: supported + constraints: + - valid_values: + - ExamplePnf + requirements: + - virtual_link: + capability: tosca.capabilities.nfv.VirtualLinkable + org.openecomp.resource.abstract.myCustomizedNodeType_C: + derived_from: org.openecomp.resource.cp.v2.extCP + org.openecomp.resource.abstract.myCustomizedNodeType_A: + derived_from: org.openecomp.resource.cp.v2.extCP + org.openecomp.resource.abstract.myCustomizedNodeType_D: + derived_from: org.openecomp.resource.cp.v2.extCP +topology_template: + inputs: + protocols: + type: list + description: IP protocols + default: + - assingment_method: dhcp + ip_version: 4 + - assingment_method: dhcp + ip_version: 6 + entry_schema: + type: org.openecomp.datatypes.network.IpRequirements + node_templates: + pnf_mainPart: + type: org.openecomp.resource.cp.v2.extCP + pnfExtCp_2: + type: org.openecomp.resource.cp.v2.extCP + properties: + ip_requirements: + get_input: protocols + pnfExtCp_1: + type: org.openecomp.resource.cp.v2.extCP + properties: + ip_requirements: + - assingment_method: dhcp + ip_version: 4 diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/pnfDescriptor/out/topologyTemplate_with_Invalid_CustomType.yaml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/pnfDescriptor/out/topologyTemplate_with_Invalid_CustomType.yaml new file mode 100644 index 0000000000..3292a94a58 --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/pnfDescriptor/out/topologyTemplate_with_Invalid_CustomType.yaml @@ -0,0 +1,19 @@ +topology_template: + inputs: + protocols: + type: list + description: IP protocols + entry_schema: + type: org.openecomp.datatypes.network.IpRequirements + default: [{assingment_method: dhcp, ip_version: 4}, {assingment_method: dhcp, ip_version: 6}] + node_templates: + pnfExtCp_2: + type: org.openecomp.resource.cp.v2.extCP + properties: + ip_requirements: { get_input: protocols } + pnfExtCp_1: + type: org.openecomp.resource.cp.v2.extCP + properties: + ip_requirements: + - assingment_method: dhcp + ip_version: 4 diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/pnfDescriptor/out/topologyTemplate_with_Multiple_CustomType.yaml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/pnfDescriptor/out/topologyTemplate_with_Multiple_CustomType.yaml new file mode 100644 index 0000000000..3fd846bbef --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/pnfDescriptor/out/topologyTemplate_with_Multiple_CustomType.yaml @@ -0,0 +1,88 @@ +node_types: + org.openecomp.resource.abstract.myCustomizedNodeType_B: + derived_from: org.openecomp.resource.cp.v2.extCP + org.openecomp.resource.abstract.myCustomizedNodeType_C: + derived_from: org.openecomp.resource.cp.v2.extCP + org.openecomp.resource.abstract.myCustomizedNodeType_A: + derived_from: org.openecomp.resource.cp.v2.extCP + org.openecomp.resource.abstract.myCustomizedNodeType_D: + derived_from: org.openecomp.resource.cp.v2.extCP + org.openecomp.resource.abstract.myCustomizedNodeType_E: + derived_from: org.openecomp.resource.cp.v2.extCP + properties: + descriptor_id: + type: string + required: true + default: b1bb0ce7-ebca-4fa7-95ed-4840d70a2233 + status: supported + constraints: + - valid_values: + - b1bb0ce7-ebca-4fa7-95ed-4840d70a2233 + function_description: + type: string + required: true + default: an example PNF + status: supported + provider: + type: string + required: true + default: MyCompany + status: supported + constraints: + - valid_values: + - MyCompany + version: + type: string + required: true + default: '1.0' + status: supported + constraints: + - valid_values: + - '1.0' + descriptor_invariant_id: + type: string + required: true + default: 1111-2222-ccaa-bbdd + status: supported + constraints: + - valid_values: + - 1111-2222-ccaa-bbdd + name: + type: string + required: true + default: ExamplePnf + status: supported + constraints: + - valid_values: + - ExamplePnf + requirements: + - virtual_link: + capability: tosca.capabilities.nfv.VirtualLinkable +topology_template: + inputs: + protocols: + type: list + description: IP protocols + default: + - assingment_method: dhcp + ip_version: 4 + - assingment_method: dhcp + ip_version: 6 + entry_schema: + type: org.openecomp.datatypes.network.IpRequirements + node_templates: + pnf_mainPart: + type: org.openecomp.resource.cp.v2.extCP + pnfExtCp_3: + type: org.openecomp.resource.cp.v2.extCP + pnfExtCp_2: + type: org.openecomp.resource.cp.v2.extCP + properties: + ip_requirements: + get_input: protocols + pnfExtCp_1: + type: org.openecomp.resource.cp.v2.extCP + properties: + ip_requirements: + - assingment_method: dhcp + ip_version: 4 |