diff options
author | talio <tali.orenbach@amdocs.com> | 2017-12-27 12:59:05 +0200 |
---|---|---|
committer | Avi Gaffa <avi.gaffa@amdocs.com> | 2017-12-27 14:42:02 +0000 |
commit | b220096e336b0e2bff63f596db3b65878dcd5fe1 (patch) | |
tree | 84b5f4d456cc3fc561ec6dbd426e3eef0ed077e5 /openecomp-be/lib/openecomp-heat-lib | |
parent | 549b96f3b8da259ed482bc76be7097aea70b7147 (diff) |
Add tests
Add unit tests for ToscaTreeManager
Change-Id: I772b63799cd34b687e6c81cb235c1c9a36ad34a2
Issue-ID: SDC-802
Signed-off-by: talio <tali.orenbach@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-heat-lib')
17 files changed, 1784 insertions, 0 deletions
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/services/tree/ToscaTreeManagerTest.java b/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/services/tree/ToscaTreeManagerTest.java new file mode 100644 index 0000000000..0cfac52318 --- /dev/null +++ b/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/services/tree/ToscaTreeManagerTest.java @@ -0,0 +1,86 @@ +package org.openecomp.sdc.heat.services.tree; + +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.core.utilities.file.FileUtils; +import org.openecomp.core.utilities.json.JsonUtil; +import org.openecomp.sdc.heat.datatypes.structure.HeatStructureTree; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.regex.Pattern; + +public class ToscaTreeManagerTest { + private static final String BASE_DIR = "/mock/toscaTree/"; + private static final String IN = "in"; + private static final String OUT = "out"; + private static final String EXPECTED_TREE_FILE = "/expectedTree.json"; + private ToscaTreeManager toscaTreeManager = new ToscaTreeManager(); + + @Test + public void testTreeWithDiffFileNames() throws IOException { + String inputDirectory = BASE_DIR + "diffFileNames/" + IN; + String outputFileName = BASE_DIR + "diffFileNames/" + OUT + EXPECTED_TREE_FILE; + + testTreeManager(inputDirectory, outputFileName); + } + + @Test + public void testDirectoriesWithSimilarNameUnderDifferentRoots() throws IOException { + String inputDirectory = BASE_DIR + "similarDirectoryName/" + IN; + String outputFileName = BASE_DIR + "similarDirectoryName/" + OUT + EXPECTED_TREE_FILE; + + testTreeManager(inputDirectory, outputFileName); + } + + @Test + public void testTwoFilesUnderSameDirectory() throws IOException { + String inputDirectory = BASE_DIR + "twoFilesUnderSameDirectory/" + IN; + String outputFileName = BASE_DIR + "twoFilesUnderSameDirectory/" + OUT + EXPECTED_TREE_FILE; + + testTreeManager(inputDirectory, outputFileName); + } + + private void testTreeManager(String inputDirectory, String outputFileName) throws IOException { + initTreeManager(inputDirectory); + toscaTreeManager.createTree(); + HeatStructureTree tree = toscaTreeManager.getTree(); + + validateToscaTree(outputFileName, tree); + } + + private void validateToscaTree(String outputFileName, HeatStructureTree tree) throws IOException { + String actualTree = JsonUtil.object2Json(tree); + File expectedTreeFile = new File(this.getClass().getResource(outputFileName).getFile()); + + String expectedTree; + try(FileInputStream fis = new FileInputStream(expectedTreeFile)) { + expectedTree = new String(FileUtils.toByteArray(fis)); + } + Assert.assertNotNull(expectedTree); + expectedTree = expectedTree.trim().replace("\r", ""); + Assert.assertEquals(expectedTree, actualTree); + } + + private void initTreeManager(String inputDir) throws IOException { + String fileName = inputDir.replace("/", File.separator); + File directory = new File(this.getClass().getResource(inputDir).getFile()); + + addFilesToTreeManager(fileName, directory.listFiles()); + } + + private void addFilesToTreeManager(String baseDir, File[] listFiles) throws IOException { + for (File file : listFiles) { + if (file.isDirectory()) { + addFilesToTreeManager(baseDir, file.listFiles()); + } else { + toscaTreeManager.addFile(getFileNameWithoutTestDirectory(baseDir, file.getPath()), new byte[2]); + } + } + } + + private String getFileNameWithoutTestDirectory(String baseDir, String fileName) { + return fileName.split(Pattern.quote(baseDir) + Pattern.quote(File.separator))[1]; + } +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/diffFileNames/in/Definitions/GlobalSubstitutionTypesServiceTemplate.yaml b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/diffFileNames/in/Definitions/GlobalSubstitutionTypesServiceTemplate.yaml new file mode 100644 index 0000000000..0923257ac8 --- /dev/null +++ b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/diffFileNames/in/Definitions/GlobalSubstitutionTypesServiceTemplate.yaml @@ -0,0 +1,430 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 + +node_types: + tosca.nodes.nfv.ext.ImageFile: + capabilities: + guest_os: + type: tosca.capabilities.nfv.ext.GuestOs + image_fle: + type: tosca.capabilities.nfv.ext.ImageFile + derived_from: tosca.nodes.Root + properties: + file_url: + required: false + type: string + container_type: + required: false + type: string + name: + required: false + type: string + disk_format: + required: false + type: string + version: + required: false + type: string + + tosca.nodes.nfv.ext.LocalStorage: + capabilities: + local_attachment: + type: tosca.capabilities.nfv.ext.LocalAttachment + derived_from: tosca.nodes.Root + properties: + size: + required: false + type: string + disk_type: + required: false + type: string + + tosca.nodes.nfv.ext.zte.VNF: + capabilities: + forwarder: + type: tosca.capabilities.nfv.Forwarder + derived_from: tosca.nodes.Root + properties: + request_reclassification: + required: false + type: boolean + domain_type: + required: false + type: string + nsh_aware: + required: false + type: boolean + plugin_info: + required: false + type: string + adjust_vnf_capacity: + required: false + type: boolean + vnfd_version: + required: false + type: string + vmnumber_overquota_alarm: + required: false + type: boolean + custom_properties: + entry_schema: + type: string + required: false + type: map + version: + required: false + type: string + cross_dc: + required: false + type: boolean + script_info: + required: false + type: string + vendor: + required: false + type: string + is_shared: + required: false + type: boolean + name: + required: false + type: string + vnf_extend_type: + required: false + type: string + id: + required: false + type: string + vnf_type: + required: false + type: string + is_sfc_proxy: + required: false + type: boolean + requirements: + - forwarder: + capability: tosca.capabilities.nfv.Forwarder + occurrences: + - 0 + - UNBOUNDED + - virtualLink: + capability: tosca.capabilities.nfv.VirtualLinkable + occurrences: + - 0 + - UNBOUNDED + + tosca.nodes.nfv.ext.zte.CP: + capabilities: + forwarder: + type: tosca.capabilities.nfv.Forwarder + derived_from: tosca.nodes.Root + properties: + guest_os_mtu: + required: false + type: integer + bandwidth: + required: false + type: integer + interface_name: + required: false + type: string + allowed_address_pairs: + entry_schema: + type: tosca.datatypes.nfv.ext.AddressPairs + required: false + type: list + ip_address: + required: false + type: string + bond: + required: false + type: string + proxiedVNFs: + entry_schema: + type: string + required: false + type: list + sfc_encapsulation: + required: false + type: string + floating_ip_address: + required: false + type: tosca.datatypes.nfv.ext.FloatingIP + service_ip_address: + required: false + type: string + mac_address: + required: false + type: string + proxiedVNFtype: + required: false + type: string + macbond: + required: false + type: string + vnic_type: + required: false + type: string + direction: + required: false + type: string + order: + required: false + type: integer + requirements: + - forwarder: + capability: tosca.capabilities.nfv.Forwarder + occurrences: + - 0 + - UNBOUNDED + - virtualbinding: + capability: tosca.capabilities.nfv.VirtualBindable + occurrences: + - 0 + - UNBOUNDED + - virtualLink: + capability: tosca.capabilities.nfv.VirtualBindable + occurrences: + - 0 + - UNBOUNDED + + tosca.nodes.nfv.ext.zte.VDU: + capabilities: + scalable: + type: tosca.capabilities.Scalable + monitoring_parameter: + type: tosca.capabilities.nfv.Metric + nfv_compute: + type: tosca.capabilities.nfv.ext.Compute.Container.Architecture + virtualbinding: + type: tosca.capabilities.nfv.VirtualBindable + derived_from: tosca.nodes.Root + properties: + manual_scale_select_vim: + required: false + type: boolean + vdu_type: + required: false + type: string + watchdog: + required: false + type: tosca.datatypes.nfv.ext.zte.WatchDog + name: + required: false + type: string + local_affinity_antiaffinity_rule: + required: false + type: tosca.datatypes.nfv.ext.LocalAffinityOrAntiAffinityRule + support_scaling: + required: false + type: boolean + storage_policy: + required: false + type: string + key_vdu: + required: false + type: boolean + location_info: + required: false + type: tosca.datatypes.nfv.ext.LocationInfo + inject_data_list: + entry_schema: + type: tosca.datatypes.nfv.ext.InjectData + required: false + type: list + requirements: + - guest_os: + capability: tosca.capabilities.nfv.ext.GuestOs + occurrences: + - 0 + - UNBOUNDED + - local_storage: + capability: tosca.capabilities.nfv.ext.LocalAttachment + occurrences: + - 0 + - UNBOUNDED + - volume_storage: + capability: tosca.capabilities.Attachment + occurrences: + - 0 + - UNBOUNDED + - dependency: + capability: tosca.capabilities.Node + occurrences: + - 0 + - UNBOUNDED + + tosca.nodes.nfv.ext.zte.VL: + capabilities: + virtual_linkable: + type: tosca.capabilities.nfv.VirtualLinkable + derived_from: tosca.nodes.Root + properties: + segmentation_id: + required: false + type: string + network_name: + required: false + type: string + is_predefined: + required: false + type: boolean + mtu: + required: false + type: integer + dns_nameservers: + entry_schema: + type: string + required: false + type: list + physical_network: + required: false + type: string + dhcp_enabled: + required: false + type: boolean + network_id: + required: false + type: string + host_routes: + entry_schema: + type: tosca.datatypes.nfv.ext.HostRouteInfo + required: false + type: list + ip_version: + required: false + type: integer + vendor: + required: false + type: string + name: + required: false + type: string + start_ip: + required: false + type: string + vlan_transparent: + required: false + type: boolean + cidr: + required: false + type: string + gateway_ip: + required: false + type: string + network_type: + required: false + type: string + end_ip: + required: false + type: string + location_info: + required: false + type: tosca.datatypes.nfv.ext.LocationInfo + + tosca.nodes.nfv.ext.zte.VNF.vCSCF: + capabilities: + forwarder: + type: tosca.capabilities.nfv.Forwarder + derived_from: tosca.nodes.nfv.ext.zte.VNF + properties: + request_reclassification: + required: false + type: boolean + domain_type: + default: CT + required: false + type: string + nsh_aware: + required: false + type: boolean + plugin_info: + required: false + type: string + vnfm_type: + default: ztevmanagerdriver + required: false + type: string + adjust_vnf_capacity: + required: false + type: boolean + vnfd_version: + default: v1.0 + required: false + type: string + vmnumber_overquota_alarm: + required: false + type: boolean + csarVersion: + default: v1.0 + required: false + type: string + csarProvider: + default: ZTE + required: false + type: string + custom_properties: + entry_schema: + type: string + required: false + type: map + version: + default: v1.0 + required: false + type: string + csarType: + default: NFAR + required: false + type: string + cross_dc: + required: false + type: boolean + script_info: + required: false + type: string + vendor: + default: ZTE + required: false + type: string + is_shared: + required: false + type: boolean + name: + default: vCSCF + required: false + type: string + vnf_extend_type: + default: none + required: false + type: string + id: + default: CSCF_NF_ZTE_v1.0 + required: false + type: string + vnf_type: + default: ztevmanagerdriver + required: false + type: string + is_sfc_proxy: + required: false + type: boolean + requirements: + - virtualLink: + capability: tosca.capabilities.nfv.VirtualLinkable + occurrences: + - 0 + - UNBOUNDED + - forwarder: + capability: tosca.capabilities.nfv.Forwarder + occurrences: + - 0 + - UNBOUNDED + - toVNFM: + capability: tosca.capabilities.nfv.VirtualBindable + occurrences: + - 0 + - UNBOUNDED + - toMgmt: + capability: tosca.capabilities.nfv.VirtualBindable + occurrences: + - 0 + - UNBOUNDED
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/diffFileNames/in/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/diffFileNames/in/MainServiceTemplate.yaml new file mode 100644 index 0000000000..eaf7fecdf8 --- /dev/null +++ b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/diffFileNames/in/MainServiceTemplate.yaml @@ -0,0 +1,95 @@ +tosca_definitions_version: tosca_simple_yaml_1_1 +imports: +- GlobalSubstitutionTypes: + file: GlobalSubstitutionTypesServiceTemplate.yaml +#Next section moved from GlobalSubstitutionTypesServiceTemplate +node_types: + org.openecomp.resource.vfc.VNF.vMME: + derived_from: tosca.nodes.Root + description: MME_VFC + properties: + vendor: + type: string + default: ERICSSON + csarVersion: + type: string + default: v1.0 + csarProvider: + type: string + default: ERICSSON + id: + type: string + default: vMME + version: + type: string + default: v1.0 + csarType: + type: string + default: NFAR + requirements: + - virtualLink: + occurrences: + - 0 + - UNBOUNDED + capability: tosca.capabilities.network.Linkable +metadata: + invariantUUID: b638d948-297a-434c-84c1-7cbc08456c4e + UUID: cd6b68ae-c2af-4af4-ada0-d066b02519a0 + name: ZTE-EPC-MME-VF + description: mme vf + type: VF + category: Generic + subcategory: Network Elements + resourceVendor: zte + resourceVendorRelease: '1.0' + resourceVendorModelNumber: '' +topology_template: + inputs: + nf_naming: + type: org.openecomp.datatypes.Naming + default: + ecomp_generated_naming: true + nf_naming_code: + type: string + default: xxxxxx + nf_function: + type: string + default: xxxxxx + availability_zone_max_count: + type: integer + default: 1 + nf_role: + type: string + default: xxxxxx + max_instances: + type: integer + default: 0 + min_instances: + type: integer + default: 0 + nf_type: + type: string + default: xxxxxx + node_templates: + MME-EPC-ZTE: + type: org.openecomp.resource.vfc.VNF.vMME + metadata: + invariantUUID: 2e7e44d1-c6fd-4a9b-8026-130c91b49fe2 + UUID: fa6c6a48-9916-4089-ade0-68ae2b1c2b6d + customizationUUID: 0862b18b-a728-4455-975d-e4debd2719a0 + version: '0.1' + name: ZTE-EPC-MME + description: MME VFC + type: VFC + category: Generic + subcategory: Abstract + resourceVendor: zte + resourceVendorRelease: '1.0' + resourceVendorModelNumber: '' + properties: + vendor: ERICSSON + csarVersion: v1.0 + csarProvider: ERICSSON + id: vMME + version: v1.0 + csarType: NFAR
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/diffFileNames/in/TOSCA-Metadata/TOSCA.meta b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/diffFileNames/in/TOSCA-Metadata/TOSCA.meta new file mode 100644 index 0000000000..f7bb7b4944 --- /dev/null +++ b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/diffFileNames/in/TOSCA-Metadata/TOSCA.meta @@ -0,0 +1,4 @@ +TOSCA-Meta-File-Version: 1.0 +CSAR-Version: 1.1 +Created-By: Feng yuanxing +Entry-Definitions: Definitions/MainServiceTemplate.yml diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/diffFileNames/out/expectedTree.json b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/diffFileNames/out/expectedTree.json new file mode 100644 index 0000000000..4be1e1ddeb --- /dev/null +++ b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/diffFileNames/out/expectedTree.json @@ -0,0 +1,23 @@ +{ + "nested": [ + { + "fileName": "TOSCA-Metadata", + "nested": [ + { + "fileName": "TOSCA.meta" + } + ] + }, + { + "fileName": "MainServiceTemplate.yaml" + }, + { + "fileName": "Definitions", + "nested": [ + { + "fileName": "GlobalSubstitutionTypesServiceTemplate.yaml" + } + ] + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/similarDirectoryName/in/Artifacts/Deployment/OTHER/clearWaterIMSOTHERDEPLOYMENT.zip b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/similarDirectoryName/in/Artifacts/Deployment/OTHER/clearWaterIMSOTHERDEPLOYMENT.zip Binary files differnew file mode 100644 index 0000000000..df1ac6bab3 --- /dev/null +++ b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/similarDirectoryName/in/Artifacts/Deployment/OTHER/clearWaterIMSOTHERDEPLOYMENT.zip diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/similarDirectoryName/in/Artifacts/OTHER/clearWaterIMSOTHER.zip b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/similarDirectoryName/in/Artifacts/OTHER/clearWaterIMSOTHER.zip Binary files differnew file mode 100644 index 0000000000..df1ac6bab3 --- /dev/null +++ b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/similarDirectoryName/in/Artifacts/OTHER/clearWaterIMSOTHER.zip diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/similarDirectoryName/in/Definitions/GlobalSubstitutionTypesServiceTemplate.yaml b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/similarDirectoryName/in/Definitions/GlobalSubstitutionTypesServiceTemplate.yaml new file mode 100644 index 0000000000..0923257ac8 --- /dev/null +++ b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/similarDirectoryName/in/Definitions/GlobalSubstitutionTypesServiceTemplate.yaml @@ -0,0 +1,430 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 + +node_types: + tosca.nodes.nfv.ext.ImageFile: + capabilities: + guest_os: + type: tosca.capabilities.nfv.ext.GuestOs + image_fle: + type: tosca.capabilities.nfv.ext.ImageFile + derived_from: tosca.nodes.Root + properties: + file_url: + required: false + type: string + container_type: + required: false + type: string + name: + required: false + type: string + disk_format: + required: false + type: string + version: + required: false + type: string + + tosca.nodes.nfv.ext.LocalStorage: + capabilities: + local_attachment: + type: tosca.capabilities.nfv.ext.LocalAttachment + derived_from: tosca.nodes.Root + properties: + size: + required: false + type: string + disk_type: + required: false + type: string + + tosca.nodes.nfv.ext.zte.VNF: + capabilities: + forwarder: + type: tosca.capabilities.nfv.Forwarder + derived_from: tosca.nodes.Root + properties: + request_reclassification: + required: false + type: boolean + domain_type: + required: false + type: string + nsh_aware: + required: false + type: boolean + plugin_info: + required: false + type: string + adjust_vnf_capacity: + required: false + type: boolean + vnfd_version: + required: false + type: string + vmnumber_overquota_alarm: + required: false + type: boolean + custom_properties: + entry_schema: + type: string + required: false + type: map + version: + required: false + type: string + cross_dc: + required: false + type: boolean + script_info: + required: false + type: string + vendor: + required: false + type: string + is_shared: + required: false + type: boolean + name: + required: false + type: string + vnf_extend_type: + required: false + type: string + id: + required: false + type: string + vnf_type: + required: false + type: string + is_sfc_proxy: + required: false + type: boolean + requirements: + - forwarder: + capability: tosca.capabilities.nfv.Forwarder + occurrences: + - 0 + - UNBOUNDED + - virtualLink: + capability: tosca.capabilities.nfv.VirtualLinkable + occurrences: + - 0 + - UNBOUNDED + + tosca.nodes.nfv.ext.zte.CP: + capabilities: + forwarder: + type: tosca.capabilities.nfv.Forwarder + derived_from: tosca.nodes.Root + properties: + guest_os_mtu: + required: false + type: integer + bandwidth: + required: false + type: integer + interface_name: + required: false + type: string + allowed_address_pairs: + entry_schema: + type: tosca.datatypes.nfv.ext.AddressPairs + required: false + type: list + ip_address: + required: false + type: string + bond: + required: false + type: string + proxiedVNFs: + entry_schema: + type: string + required: false + type: list + sfc_encapsulation: + required: false + type: string + floating_ip_address: + required: false + type: tosca.datatypes.nfv.ext.FloatingIP + service_ip_address: + required: false + type: string + mac_address: + required: false + type: string + proxiedVNFtype: + required: false + type: string + macbond: + required: false + type: string + vnic_type: + required: false + type: string + direction: + required: false + type: string + order: + required: false + type: integer + requirements: + - forwarder: + capability: tosca.capabilities.nfv.Forwarder + occurrences: + - 0 + - UNBOUNDED + - virtualbinding: + capability: tosca.capabilities.nfv.VirtualBindable + occurrences: + - 0 + - UNBOUNDED + - virtualLink: + capability: tosca.capabilities.nfv.VirtualBindable + occurrences: + - 0 + - UNBOUNDED + + tosca.nodes.nfv.ext.zte.VDU: + capabilities: + scalable: + type: tosca.capabilities.Scalable + monitoring_parameter: + type: tosca.capabilities.nfv.Metric + nfv_compute: + type: tosca.capabilities.nfv.ext.Compute.Container.Architecture + virtualbinding: + type: tosca.capabilities.nfv.VirtualBindable + derived_from: tosca.nodes.Root + properties: + manual_scale_select_vim: + required: false + type: boolean + vdu_type: + required: false + type: string + watchdog: + required: false + type: tosca.datatypes.nfv.ext.zte.WatchDog + name: + required: false + type: string + local_affinity_antiaffinity_rule: + required: false + type: tosca.datatypes.nfv.ext.LocalAffinityOrAntiAffinityRule + support_scaling: + required: false + type: boolean + storage_policy: + required: false + type: string + key_vdu: + required: false + type: boolean + location_info: + required: false + type: tosca.datatypes.nfv.ext.LocationInfo + inject_data_list: + entry_schema: + type: tosca.datatypes.nfv.ext.InjectData + required: false + type: list + requirements: + - guest_os: + capability: tosca.capabilities.nfv.ext.GuestOs + occurrences: + - 0 + - UNBOUNDED + - local_storage: + capability: tosca.capabilities.nfv.ext.LocalAttachment + occurrences: + - 0 + - UNBOUNDED + - volume_storage: + capability: tosca.capabilities.Attachment + occurrences: + - 0 + - UNBOUNDED + - dependency: + capability: tosca.capabilities.Node + occurrences: + - 0 + - UNBOUNDED + + tosca.nodes.nfv.ext.zte.VL: + capabilities: + virtual_linkable: + type: tosca.capabilities.nfv.VirtualLinkable + derived_from: tosca.nodes.Root + properties: + segmentation_id: + required: false + type: string + network_name: + required: false + type: string + is_predefined: + required: false + type: boolean + mtu: + required: false + type: integer + dns_nameservers: + entry_schema: + type: string + required: false + type: list + physical_network: + required: false + type: string + dhcp_enabled: + required: false + type: boolean + network_id: + required: false + type: string + host_routes: + entry_schema: + type: tosca.datatypes.nfv.ext.HostRouteInfo + required: false + type: list + ip_version: + required: false + type: integer + vendor: + required: false + type: string + name: + required: false + type: string + start_ip: + required: false + type: string + vlan_transparent: + required: false + type: boolean + cidr: + required: false + type: string + gateway_ip: + required: false + type: string + network_type: + required: false + type: string + end_ip: + required: false + type: string + location_info: + required: false + type: tosca.datatypes.nfv.ext.LocationInfo + + tosca.nodes.nfv.ext.zte.VNF.vCSCF: + capabilities: + forwarder: + type: tosca.capabilities.nfv.Forwarder + derived_from: tosca.nodes.nfv.ext.zte.VNF + properties: + request_reclassification: + required: false + type: boolean + domain_type: + default: CT + required: false + type: string + nsh_aware: + required: false + type: boolean + plugin_info: + required: false + type: string + vnfm_type: + default: ztevmanagerdriver + required: false + type: string + adjust_vnf_capacity: + required: false + type: boolean + vnfd_version: + default: v1.0 + required: false + type: string + vmnumber_overquota_alarm: + required: false + type: boolean + csarVersion: + default: v1.0 + required: false + type: string + csarProvider: + default: ZTE + required: false + type: string + custom_properties: + entry_schema: + type: string + required: false + type: map + version: + default: v1.0 + required: false + type: string + csarType: + default: NFAR + required: false + type: string + cross_dc: + required: false + type: boolean + script_info: + required: false + type: string + vendor: + default: ZTE + required: false + type: string + is_shared: + required: false + type: boolean + name: + default: vCSCF + required: false + type: string + vnf_extend_type: + default: none + required: false + type: string + id: + default: CSCF_NF_ZTE_v1.0 + required: false + type: string + vnf_type: + default: ztevmanagerdriver + required: false + type: string + is_sfc_proxy: + required: false + type: boolean + requirements: + - virtualLink: + capability: tosca.capabilities.nfv.VirtualLinkable + occurrences: + - 0 + - UNBOUNDED + - forwarder: + capability: tosca.capabilities.nfv.Forwarder + occurrences: + - 0 + - UNBOUNDED + - toVNFM: + capability: tosca.capabilities.nfv.VirtualBindable + occurrences: + - 0 + - UNBOUNDED + - toMgmt: + capability: tosca.capabilities.nfv.VirtualBindable + occurrences: + - 0 + - UNBOUNDED
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/similarDirectoryName/in/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/similarDirectoryName/in/MainServiceTemplate.yaml new file mode 100644 index 0000000000..eaf7fecdf8 --- /dev/null +++ b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/similarDirectoryName/in/MainServiceTemplate.yaml @@ -0,0 +1,95 @@ +tosca_definitions_version: tosca_simple_yaml_1_1 +imports: +- GlobalSubstitutionTypes: + file: GlobalSubstitutionTypesServiceTemplate.yaml +#Next section moved from GlobalSubstitutionTypesServiceTemplate +node_types: + org.openecomp.resource.vfc.VNF.vMME: + derived_from: tosca.nodes.Root + description: MME_VFC + properties: + vendor: + type: string + default: ERICSSON + csarVersion: + type: string + default: v1.0 + csarProvider: + type: string + default: ERICSSON + id: + type: string + default: vMME + version: + type: string + default: v1.0 + csarType: + type: string + default: NFAR + requirements: + - virtualLink: + occurrences: + - 0 + - UNBOUNDED + capability: tosca.capabilities.network.Linkable +metadata: + invariantUUID: b638d948-297a-434c-84c1-7cbc08456c4e + UUID: cd6b68ae-c2af-4af4-ada0-d066b02519a0 + name: ZTE-EPC-MME-VF + description: mme vf + type: VF + category: Generic + subcategory: Network Elements + resourceVendor: zte + resourceVendorRelease: '1.0' + resourceVendorModelNumber: '' +topology_template: + inputs: + nf_naming: + type: org.openecomp.datatypes.Naming + default: + ecomp_generated_naming: true + nf_naming_code: + type: string + default: xxxxxx + nf_function: + type: string + default: xxxxxx + availability_zone_max_count: + type: integer + default: 1 + nf_role: + type: string + default: xxxxxx + max_instances: + type: integer + default: 0 + min_instances: + type: integer + default: 0 + nf_type: + type: string + default: xxxxxx + node_templates: + MME-EPC-ZTE: + type: org.openecomp.resource.vfc.VNF.vMME + metadata: + invariantUUID: 2e7e44d1-c6fd-4a9b-8026-130c91b49fe2 + UUID: fa6c6a48-9916-4089-ade0-68ae2b1c2b6d + customizationUUID: 0862b18b-a728-4455-975d-e4debd2719a0 + version: '0.1' + name: ZTE-EPC-MME + description: MME VFC + type: VFC + category: Generic + subcategory: Abstract + resourceVendor: zte + resourceVendorRelease: '1.0' + resourceVendorModelNumber: '' + properties: + vendor: ERICSSON + csarVersion: v1.0 + csarProvider: ERICSSON + id: vMME + version: v1.0 + csarType: NFAR
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/similarDirectoryName/in/TOSCA-Metadata/TOSCA.meta b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/similarDirectoryName/in/TOSCA-Metadata/TOSCA.meta new file mode 100644 index 0000000000..f7bb7b4944 --- /dev/null +++ b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/similarDirectoryName/in/TOSCA-Metadata/TOSCA.meta @@ -0,0 +1,4 @@ +TOSCA-Meta-File-Version: 1.0 +CSAR-Version: 1.1 +Created-By: Feng yuanxing +Entry-Definitions: Definitions/MainServiceTemplate.yml diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/similarDirectoryName/out/expectedTree.json b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/similarDirectoryName/out/expectedTree.json new file mode 100644 index 0000000000..071887b2fb --- /dev/null +++ b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/similarDirectoryName/out/expectedTree.json @@ -0,0 +1,49 @@ +{ + "nested": [ + { + "fileName": "TOSCA-Metadata", + "nested": [ + { + "fileName": "TOSCA.meta" + } + ] + }, + { + "fileName": "MainServiceTemplate.yaml" + }, + { + "fileName": "Definitions", + "nested": [ + { + "fileName": "GlobalSubstitutionTypesServiceTemplate.yaml" + } + ] + }, + { + "fileName": "Artifacts", + "nested": [ + { + "fileName": "OTHER", + "nested": [ + { + "fileName": "clearWaterIMSOTHER.zip" + } + ] + }, + { + "fileName": "Deployment", + "nested": [ + { + "fileName": "OTHER", + "nested": [ + { + "fileName": "clearWaterIMSOTHERDEPLOYMENT.zip" + } + ] + } + ] + } + ] + } + ] +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/twoFilesUnderSameDirectory/in/Artifacts/OTHER/clearWaterIMSOTHER.zip b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/twoFilesUnderSameDirectory/in/Artifacts/OTHER/clearWaterIMSOTHER.zip Binary files differnew file mode 100644 index 0000000000..df1ac6bab3 --- /dev/null +++ b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/twoFilesUnderSameDirectory/in/Artifacts/OTHER/clearWaterIMSOTHER.zip diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/twoFilesUnderSameDirectory/in/Artifacts/OTHER/clearWaterIMSOTHERDEPLOYMENT.zip b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/twoFilesUnderSameDirectory/in/Artifacts/OTHER/clearWaterIMSOTHERDEPLOYMENT.zip Binary files differnew file mode 100644 index 0000000000..df1ac6bab3 --- /dev/null +++ b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/twoFilesUnderSameDirectory/in/Artifacts/OTHER/clearWaterIMSOTHERDEPLOYMENT.zip diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/twoFilesUnderSameDirectory/in/Definitions/GlobalSubstitutionTypesServiceTemplate.yaml b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/twoFilesUnderSameDirectory/in/Definitions/GlobalSubstitutionTypesServiceTemplate.yaml new file mode 100644 index 0000000000..0923257ac8 --- /dev/null +++ b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/twoFilesUnderSameDirectory/in/Definitions/GlobalSubstitutionTypesServiceTemplate.yaml @@ -0,0 +1,430 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 + +node_types: + tosca.nodes.nfv.ext.ImageFile: + capabilities: + guest_os: + type: tosca.capabilities.nfv.ext.GuestOs + image_fle: + type: tosca.capabilities.nfv.ext.ImageFile + derived_from: tosca.nodes.Root + properties: + file_url: + required: false + type: string + container_type: + required: false + type: string + name: + required: false + type: string + disk_format: + required: false + type: string + version: + required: false + type: string + + tosca.nodes.nfv.ext.LocalStorage: + capabilities: + local_attachment: + type: tosca.capabilities.nfv.ext.LocalAttachment + derived_from: tosca.nodes.Root + properties: + size: + required: false + type: string + disk_type: + required: false + type: string + + tosca.nodes.nfv.ext.zte.VNF: + capabilities: + forwarder: + type: tosca.capabilities.nfv.Forwarder + derived_from: tosca.nodes.Root + properties: + request_reclassification: + required: false + type: boolean + domain_type: + required: false + type: string + nsh_aware: + required: false + type: boolean + plugin_info: + required: false + type: string + adjust_vnf_capacity: + required: false + type: boolean + vnfd_version: + required: false + type: string + vmnumber_overquota_alarm: + required: false + type: boolean + custom_properties: + entry_schema: + type: string + required: false + type: map + version: + required: false + type: string + cross_dc: + required: false + type: boolean + script_info: + required: false + type: string + vendor: + required: false + type: string + is_shared: + required: false + type: boolean + name: + required: false + type: string + vnf_extend_type: + required: false + type: string + id: + required: false + type: string + vnf_type: + required: false + type: string + is_sfc_proxy: + required: false + type: boolean + requirements: + - forwarder: + capability: tosca.capabilities.nfv.Forwarder + occurrences: + - 0 + - UNBOUNDED + - virtualLink: + capability: tosca.capabilities.nfv.VirtualLinkable + occurrences: + - 0 + - UNBOUNDED + + tosca.nodes.nfv.ext.zte.CP: + capabilities: + forwarder: + type: tosca.capabilities.nfv.Forwarder + derived_from: tosca.nodes.Root + properties: + guest_os_mtu: + required: false + type: integer + bandwidth: + required: false + type: integer + interface_name: + required: false + type: string + allowed_address_pairs: + entry_schema: + type: tosca.datatypes.nfv.ext.AddressPairs + required: false + type: list + ip_address: + required: false + type: string + bond: + required: false + type: string + proxiedVNFs: + entry_schema: + type: string + required: false + type: list + sfc_encapsulation: + required: false + type: string + floating_ip_address: + required: false + type: tosca.datatypes.nfv.ext.FloatingIP + service_ip_address: + required: false + type: string + mac_address: + required: false + type: string + proxiedVNFtype: + required: false + type: string + macbond: + required: false + type: string + vnic_type: + required: false + type: string + direction: + required: false + type: string + order: + required: false + type: integer + requirements: + - forwarder: + capability: tosca.capabilities.nfv.Forwarder + occurrences: + - 0 + - UNBOUNDED + - virtualbinding: + capability: tosca.capabilities.nfv.VirtualBindable + occurrences: + - 0 + - UNBOUNDED + - virtualLink: + capability: tosca.capabilities.nfv.VirtualBindable + occurrences: + - 0 + - UNBOUNDED + + tosca.nodes.nfv.ext.zte.VDU: + capabilities: + scalable: + type: tosca.capabilities.Scalable + monitoring_parameter: + type: tosca.capabilities.nfv.Metric + nfv_compute: + type: tosca.capabilities.nfv.ext.Compute.Container.Architecture + virtualbinding: + type: tosca.capabilities.nfv.VirtualBindable + derived_from: tosca.nodes.Root + properties: + manual_scale_select_vim: + required: false + type: boolean + vdu_type: + required: false + type: string + watchdog: + required: false + type: tosca.datatypes.nfv.ext.zte.WatchDog + name: + required: false + type: string + local_affinity_antiaffinity_rule: + required: false + type: tosca.datatypes.nfv.ext.LocalAffinityOrAntiAffinityRule + support_scaling: + required: false + type: boolean + storage_policy: + required: false + type: string + key_vdu: + required: false + type: boolean + location_info: + required: false + type: tosca.datatypes.nfv.ext.LocationInfo + inject_data_list: + entry_schema: + type: tosca.datatypes.nfv.ext.InjectData + required: false + type: list + requirements: + - guest_os: + capability: tosca.capabilities.nfv.ext.GuestOs + occurrences: + - 0 + - UNBOUNDED + - local_storage: + capability: tosca.capabilities.nfv.ext.LocalAttachment + occurrences: + - 0 + - UNBOUNDED + - volume_storage: + capability: tosca.capabilities.Attachment + occurrences: + - 0 + - UNBOUNDED + - dependency: + capability: tosca.capabilities.Node + occurrences: + - 0 + - UNBOUNDED + + tosca.nodes.nfv.ext.zte.VL: + capabilities: + virtual_linkable: + type: tosca.capabilities.nfv.VirtualLinkable + derived_from: tosca.nodes.Root + properties: + segmentation_id: + required: false + type: string + network_name: + required: false + type: string + is_predefined: + required: false + type: boolean + mtu: + required: false + type: integer + dns_nameservers: + entry_schema: + type: string + required: false + type: list + physical_network: + required: false + type: string + dhcp_enabled: + required: false + type: boolean + network_id: + required: false + type: string + host_routes: + entry_schema: + type: tosca.datatypes.nfv.ext.HostRouteInfo + required: false + type: list + ip_version: + required: false + type: integer + vendor: + required: false + type: string + name: + required: false + type: string + start_ip: + required: false + type: string + vlan_transparent: + required: false + type: boolean + cidr: + required: false + type: string + gateway_ip: + required: false + type: string + network_type: + required: false + type: string + end_ip: + required: false + type: string + location_info: + required: false + type: tosca.datatypes.nfv.ext.LocationInfo + + tosca.nodes.nfv.ext.zte.VNF.vCSCF: + capabilities: + forwarder: + type: tosca.capabilities.nfv.Forwarder + derived_from: tosca.nodes.nfv.ext.zte.VNF + properties: + request_reclassification: + required: false + type: boolean + domain_type: + default: CT + required: false + type: string + nsh_aware: + required: false + type: boolean + plugin_info: + required: false + type: string + vnfm_type: + default: ztevmanagerdriver + required: false + type: string + adjust_vnf_capacity: + required: false + type: boolean + vnfd_version: + default: v1.0 + required: false + type: string + vmnumber_overquota_alarm: + required: false + type: boolean + csarVersion: + default: v1.0 + required: false + type: string + csarProvider: + default: ZTE + required: false + type: string + custom_properties: + entry_schema: + type: string + required: false + type: map + version: + default: v1.0 + required: false + type: string + csarType: + default: NFAR + required: false + type: string + cross_dc: + required: false + type: boolean + script_info: + required: false + type: string + vendor: + default: ZTE + required: false + type: string + is_shared: + required: false + type: boolean + name: + default: vCSCF + required: false + type: string + vnf_extend_type: + default: none + required: false + type: string + id: + default: CSCF_NF_ZTE_v1.0 + required: false + type: string + vnf_type: + default: ztevmanagerdriver + required: false + type: string + is_sfc_proxy: + required: false + type: boolean + requirements: + - virtualLink: + capability: tosca.capabilities.nfv.VirtualLinkable + occurrences: + - 0 + - UNBOUNDED + - forwarder: + capability: tosca.capabilities.nfv.Forwarder + occurrences: + - 0 + - UNBOUNDED + - toVNFM: + capability: tosca.capabilities.nfv.VirtualBindable + occurrences: + - 0 + - UNBOUNDED + - toMgmt: + capability: tosca.capabilities.nfv.VirtualBindable + occurrences: + - 0 + - UNBOUNDED
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/twoFilesUnderSameDirectory/in/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/twoFilesUnderSameDirectory/in/MainServiceTemplate.yaml new file mode 100644 index 0000000000..eaf7fecdf8 --- /dev/null +++ b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/twoFilesUnderSameDirectory/in/MainServiceTemplate.yaml @@ -0,0 +1,95 @@ +tosca_definitions_version: tosca_simple_yaml_1_1 +imports: +- GlobalSubstitutionTypes: + file: GlobalSubstitutionTypesServiceTemplate.yaml +#Next section moved from GlobalSubstitutionTypesServiceTemplate +node_types: + org.openecomp.resource.vfc.VNF.vMME: + derived_from: tosca.nodes.Root + description: MME_VFC + properties: + vendor: + type: string + default: ERICSSON + csarVersion: + type: string + default: v1.0 + csarProvider: + type: string + default: ERICSSON + id: + type: string + default: vMME + version: + type: string + default: v1.0 + csarType: + type: string + default: NFAR + requirements: + - virtualLink: + occurrences: + - 0 + - UNBOUNDED + capability: tosca.capabilities.network.Linkable +metadata: + invariantUUID: b638d948-297a-434c-84c1-7cbc08456c4e + UUID: cd6b68ae-c2af-4af4-ada0-d066b02519a0 + name: ZTE-EPC-MME-VF + description: mme vf + type: VF + category: Generic + subcategory: Network Elements + resourceVendor: zte + resourceVendorRelease: '1.0' + resourceVendorModelNumber: '' +topology_template: + inputs: + nf_naming: + type: org.openecomp.datatypes.Naming + default: + ecomp_generated_naming: true + nf_naming_code: + type: string + default: xxxxxx + nf_function: + type: string + default: xxxxxx + availability_zone_max_count: + type: integer + default: 1 + nf_role: + type: string + default: xxxxxx + max_instances: + type: integer + default: 0 + min_instances: + type: integer + default: 0 + nf_type: + type: string + default: xxxxxx + node_templates: + MME-EPC-ZTE: + type: org.openecomp.resource.vfc.VNF.vMME + metadata: + invariantUUID: 2e7e44d1-c6fd-4a9b-8026-130c91b49fe2 + UUID: fa6c6a48-9916-4089-ade0-68ae2b1c2b6d + customizationUUID: 0862b18b-a728-4455-975d-e4debd2719a0 + version: '0.1' + name: ZTE-EPC-MME + description: MME VFC + type: VFC + category: Generic + subcategory: Abstract + resourceVendor: zte + resourceVendorRelease: '1.0' + resourceVendorModelNumber: '' + properties: + vendor: ERICSSON + csarVersion: v1.0 + csarProvider: ERICSSON + id: vMME + version: v1.0 + csarType: NFAR
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/twoFilesUnderSameDirectory/in/TOSCA-Metadata/TOSCA.meta b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/twoFilesUnderSameDirectory/in/TOSCA-Metadata/TOSCA.meta new file mode 100644 index 0000000000..f7bb7b4944 --- /dev/null +++ b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/twoFilesUnderSameDirectory/in/TOSCA-Metadata/TOSCA.meta @@ -0,0 +1,4 @@ +TOSCA-Meta-File-Version: 1.0 +CSAR-Version: 1.1 +Created-By: Feng yuanxing +Entry-Definitions: Definitions/MainServiceTemplate.yml diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/twoFilesUnderSameDirectory/out/expectedTree.json b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/twoFilesUnderSameDirectory/out/expectedTree.json new file mode 100644 index 0000000000..59fec70152 --- /dev/null +++ b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/toscaTree/twoFilesUnderSameDirectory/out/expectedTree.json @@ -0,0 +1,39 @@ +{ + "nested": [ + { + "fileName": "TOSCA-Metadata", + "nested": [ + { + "fileName": "TOSCA.meta" + } + ] + }, + { + "fileName": "MainServiceTemplate.yaml" + }, + { + "fileName": "Definitions", + "nested": [ + { + "fileName": "GlobalSubstitutionTypesServiceTemplate.yaml" + } + ] + }, + { + "fileName": "Artifacts", + "nested": [ + { + "fileName": "OTHER", + "nested": [ + { + "fileName": "clearWaterIMSOTHERDEPLOYMENT.zip" + }, + { + "fileName": "clearWaterIMSOTHER.zip" + } + ] + } + ] + } + ] +}
\ No newline at end of file |