aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test')
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerTest.java51
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeValidationOutput/MANIFEST.json35
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeValidationOutput/hot-nimbus-pps_v1.0.env12
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeValidationOutput/hot-nimbus-pps_v1.0.yaml94
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeValidationOutput/hot-nimbus-psm_v1.0.env12
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeValidationOutput/hot-nimbus-psm_v1.0.yaml109
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeValidationOutput/hot-nimbus-psm_volume.yaml21
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeValidationOutput/nested-pps_v1.0.yaml98
8 files changed, 432 insertions, 0 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerTest.java
new file mode 100644
index 0000000000..6a9f8df12d
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerTest.java
@@ -0,0 +1,51 @@
+package org.openecomp.sdc.heat.services.tree;
+
+import org.openecomp.sdc.heat.datatypes.structure.HeatStructureTree;
+import org.openecomp.core.utilities.file.FileContentHandler;
+import org.openecomp.core.utilities.file.FileUtils;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.URL;
+
+public class HeatTreeManagerTest {
+
+ @Test
+ public void testHeatTreeCreation() {
+
+ FileContentHandler fileContentMap = new FileContentHandler();
+ URL url = this.getClass().getResource("/heatTreeValidationOutput");
+
+ File templateDir = new File(url.getFile());
+ File[] files = templateDir.listFiles();
+
+ if (files == null || files.length == 0) {
+ return;
+ }
+
+ for (File file : files) {
+ fileContentMap.addFile(file.getName(), getFileContent(file));
+ }
+
+ HeatTreeManager heatTreeManager = HeatTreeManagerUtil.initHeatTreeManager(fileContentMap);
+ heatTreeManager.createTree();
+ HeatStructureTree tree = heatTreeManager.getTree();
+ Assert.assertNotNull(tree);
+ Assert.assertEquals(tree.getHEAT().size(), 2);
+ }
+
+ private byte[] getFileContent(File file) {
+ try {
+ return FileUtils.toByteArray(new FileInputStream(file));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ return new byte[0];
+ }
+
+
+}
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeValidationOutput/MANIFEST.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeValidationOutput/MANIFEST.json
new file mode 100644
index 0000000000..f1553f5c74
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeValidationOutput/MANIFEST.json
@@ -0,0 +1,35 @@
+{
+ "name": "hot-mog",
+ "description": "HOT template to create hot mog server",
+ "version": "2013-05-23",
+ "data": [
+ {
+ "file": "hot-nimbus-pps_v1.0.yaml",
+ "type": "HEAT",
+ "data": [
+ {
+ "file": "hot-nimbus-pps_v1.0.env",
+ "type": "HEAT_ENV"
+ }
+ ]
+ },
+ {
+ "file": "hot-nimbus-psm_v1.0.yaml",
+ "type": "HEAT",
+ "data": [
+ {
+ "file": "hot-nimbus-psm_v1.0.env",
+ "type": "HEAT_ENV"
+ }
+ ]
+ },
+ {
+ "file": "hot-nimbus-psm_volume.yaml",
+ "type": "HEAT_VOL"
+ },
+ {
+ "file": "nested-pps_v1.0.yaml",
+ "type": "HEAT"
+ }
+ ]
+} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeValidationOutput/hot-nimbus-pps_v1.0.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeValidationOutput/hot-nimbus-pps_v1.0.env
new file mode 100644
index 0000000000..809835d2b8
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeValidationOutput/hot-nimbus-pps_v1.0.env
@@ -0,0 +1,12 @@
+parameters:
+ pcrf_pps_server_names: ZRDM1PCRF01PPS001,ZRDM1PCRF01PPS002,ZRDM1PCRF01PPS003,ZRDM1PCRF01PPS004,ZRDM1PCRF01PPS005,ZRDM1PCRF01PPS006
+ pcrf_pps_image_name: PCRF_8.995-ATTM1.0.3.qcow2
+ pcrf_pps_flavor_name: lc.3xlarge
+ availabilityzone_name: nova
+ pcrf_cps_net_name: Mobisupport-25193-I-INT1_int_pcrf_net_0
+ pcrf_cps_net_ips: 172.26.16.7,172.26.16.8,172.26.16.9,172.26.16.10,172.26.16.11,172.26.16.12
+ pcrf_cps_net_mask: 255.255.255.0
+ pcrf_security_group_name: nimbus_security_group
+ pcrf_vnf_id: 730797234b4a40aa99335157b02871cd
+ mock_param: abskdjska
+
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeValidationOutput/hot-nimbus-pps_v1.0.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeValidationOutput/hot-nimbus-pps_v1.0.yaml
new file mode 100644
index 0000000000..d3318ee0ca
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeValidationOutput/hot-nimbus-pps_v1.0.yaml
@@ -0,0 +1,94 @@
+heat_template_version: 2013-05-23
+
+description: heat template that creates PCRF Policy Server stack
+
+parameters:
+ pcrf_pps_server_names:
+ type: comma_delimited_list
+ label: PCRF PS server names
+ description: PCRF PS server names
+ pcrf_pps_image_name:
+ type: string
+ default: True
+ label: PCRF PS image name
+ description: PCRF PS image name
+ pcrf_pps_flavor_name:
+ type: string
+ label: PCRF PS flavor name
+ description: flavor name of PCRF PS instance
+ availabilityzone_name:
+ type: string
+ label: availabilityzone name
+ description: availabilityzone name
+ pcrf_cps_net_name:
+ type: string
+ label: CPS network name
+ description: CPS network name
+ pcrf_cps_net_ips:
+ type: comma_delimited_list
+ label: CPS network ips
+ description: CPS network ips
+ pcrf_cps_net_mask:
+ type: string
+ label: CPS network mask
+ description: CPS network mask
+ pcrf_security_group_name:
+ type: string
+ label: security group name
+ description: the name of security group
+ pcrf_vnf_id:
+ type: string
+ label: PCRF VNF Id
+ description: PCRF VNF Id
+ availability_zone_1:
+ type: string
+ label: PCRF VNF Id
+ description: PCRF VNF Id
+
+
+resources:
+ server_pcrf_pps_001:
+ type: nested-pps_v1.0.yaml
+ properties:
+ pcrf_pps_server_name: { get_param: [pcrf_pps_server_names, 0] }
+ pcrf_pps_image_name: { get_param: pcrf_pps_image_name }
+ pcrf_pps_flavor_name: { get_param: pcrf_pps_flavor_name }
+ availabilityzone_name: { get_param: availabilityzone_name }
+ pcrf_security_group_name: { get_param: pcrf_security_group_name }
+ pcrf_cps_net_name: { get_param: pcrf_cps_net_name }
+ pcrf_cps_net_ip: { get_param: [pcrf_cps_net_ips, 0] }
+ pcrf_cps_net_mask: { get_param: pcrf_cps_net_mask }
+ pcrf_vnf_id: {get_param: pcrf_vnf_id}
+
+
+ availability_zone_legal_name_1:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: [pcrf_pps_server_names, 0] }
+ availability_zone: {get_param: availability_zone_1}
+ metadata:
+ vnf_id: { get_param: pcrf_vnf_id }
+ vf_module_id: { get_param: pcrf_vnf_module_id }
+
+ availability_zone_illegal_name_1:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: [pcrf_pps_server_names, 0] }
+ availability_zone: {get_param: availability_zone_name}
+ metadata:
+ vnf_id: { get_param: pcrf_vnf_id }
+ vf_module_id: { get_param: pcrf_vnf_module_id }
+
+ availability_zone_illegal_name_2:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: [pcrf_pps_server_names, 0] }
+ availability_zone: {get_param: availability_zone}
+ metadata:
+ vnf_id: { get_param: pcrf_vnf_id }
+ vf_module_id: { get_param: pcrf_vnf_module_id }
+
+ SecurityGroup_expose:
+ type: OS::Neutron::SecurityGroup
+
+
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeValidationOutput/hot-nimbus-psm_v1.0.env b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeValidationOutput/hot-nimbus-psm_v1.0.env
new file mode 100644
index 0000000000..809835d2b8
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeValidationOutput/hot-nimbus-psm_v1.0.env
@@ -0,0 +1,12 @@
+parameters:
+ pcrf_pps_server_names: ZRDM1PCRF01PPS001,ZRDM1PCRF01PPS002,ZRDM1PCRF01PPS003,ZRDM1PCRF01PPS004,ZRDM1PCRF01PPS005,ZRDM1PCRF01PPS006
+ pcrf_pps_image_name: PCRF_8.995-ATTM1.0.3.qcow2
+ pcrf_pps_flavor_name: lc.3xlarge
+ availabilityzone_name: nova
+ pcrf_cps_net_name: Mobisupport-25193-I-INT1_int_pcrf_net_0
+ pcrf_cps_net_ips: 172.26.16.7,172.26.16.8,172.26.16.9,172.26.16.10,172.26.16.11,172.26.16.12
+ pcrf_cps_net_mask: 255.255.255.0
+ pcrf_security_group_name: nimbus_security_group
+ pcrf_vnf_id: 730797234b4a40aa99335157b02871cd
+ mock_param: abskdjska
+
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeValidationOutput/hot-nimbus-psm_v1.0.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeValidationOutput/hot-nimbus-psm_v1.0.yaml
new file mode 100644
index 0000000000..072a8ba934
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeValidationOutput/hot-nimbus-psm_v1.0.yaml
@@ -0,0 +1,109 @@
+heat_template_version: 2013-05-23
+
+description: heat template that creates PCRF Policy Server stack
+
+parameters:
+ pcrf_pps_server_names:
+ type: comma_delimited_list
+ label: PCRF PS server names
+ description: PCRF PS server names
+ pcrf_pps_image_name:
+ type: string
+ default: True
+ label: PCRF PS image name
+ description: PCRF PS image name
+ pcrf_pps_flavor_name:
+ type: string
+ label: PCRF PS flavor name
+ description: flavor name of PCRF PS instance
+ availabilityzone_name:
+ type: string
+ label: availabilityzone name
+ description: availabilityzone name
+ pcrf_cps_net_name:
+ type: string
+ label: CPS network name
+ description: CPS network name
+ pcrf_cps_net_ips:
+ type: comma_delimited_list
+ label: CPS network ips
+ description: CPS network ips
+ pcrf_cps_net_mask:
+ type: string
+ label: CPS network mask
+ description: CPS network mask
+ pcrf_security_group_name:
+ type: string
+ label: security group name
+ description: the name of security group
+ pcrf_vnf_id:
+ type: string
+ label: PCRF VNF Id
+ description: PCRF VNF Id
+ availability_zone_1:
+ type: string
+ label: PCRF VNF Id
+ description: PCRF VNF Id
+ pcrf_images:
+ type: string
+ label: PCRF VNF Id
+ description: PCRF VNF Id
+ pcrf_network_v0_ips:
+ type: string
+ label: PCRF VNF Id
+ description: PCRF VNF Id
+ network_net_id:
+ type: string
+ label: PCRF VNF Id
+ description: PCRF VNF Id
+
+
+resources:
+ server_pcrf_pps_001:
+ type: nested-pps_v1.0.yaml
+ properties:
+ pcrf_pps_server_name: { get_param: [pcrf_pps_server_names, 0] }
+ pcrf_pps_image_name: { get_param: pcrf_pps_image_name }
+ pcrf_pps_flavor_name: { get_param: pcrf_pps_flavor_name }
+ availabilityzone_name: { get_param: availabilityzone_name }
+ pcrf_security_group_name: { get_param: pcrf_security_group_name }
+ pcrf_cps_net_name: { get_param: pcrf_cps_net_name }
+ pcrf_cps_net_ip: { get_param: [pcrf_cps_net_ips, 0] }
+ pcrf_cps_net_mask: { get_param: pcrf_cps_net_mask }
+ pcrf_vnf_id: {get_param: pcrf_vnf_id}
+
+
+ resource_illegal_image:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: [pcrf_pps_server_names, 0] }
+ image: {get_param: pcrf_images}
+ flavor: {get_param: pcrf_flavor_11}
+ metadata:
+ vnf_id: { get_param: pcrf_vnf_id }
+ vf_module_id: { get_param: pcrf_vnf_module_id }
+
+ resource_illegal_network_1:
+ type: OS::Neutron::Port
+ properties:
+ name: { get_param: [pcrf_pps_server_names, 0] }
+ network: {get_param: network_net_id}
+
+ resource_illegal_network_2:
+ type: OS::Neutron::Port
+ properties:
+ name: { get_param: [pcrf_pps_server_names, 0] }
+ network: {get_param: network_net_id}
+ fixed_ips:
+ - ip_address: {get_param: pcrf_network_v0_ips}
+
+ availability_zone_illegal_name_2:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: [pcrf_pps_server_names, 0] }
+ availability_zone: {get_param: availability_zone}
+ metadata:
+ vnf_id: { get_param: pcrf_vnf_id }
+ vf_module_id: { get_param: pcrf_vnf_module_id }
+
+
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeValidationOutput/hot-nimbus-psm_volume.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeValidationOutput/hot-nimbus-psm_volume.yaml
new file mode 100644
index 0000000000..288607cf55
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeValidationOutput/hot-nimbus-psm_volume.yaml
@@ -0,0 +1,21 @@
+
+heat_template_version: 2013-05-23
+
+parameters:
+ not_null:
+ type: number
+ label: not_number
+
+
+resources:
+ volume_not_expose:
+ type: OS::Cinder::Volume
+ properties:
+ not_null: {get_param: not_null}
+
+
+outputs:
+ not_expose_resource_network_output:
+ description: the pcrf_server
+ value: { get_resource: volume_expose }
+
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeValidationOutput/nested-pps_v1.0.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeValidationOutput/nested-pps_v1.0.yaml
new file mode 100644
index 0000000000..cb23fb8e8c
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/resources/heatTreeValidationOutput/nested-pps_v1.0.yaml
@@ -0,0 +1,98 @@
+heat_template_version: 2013-05-23
+
+description: heat template that creates PCRF Policy Server stack
+
+parameters:
+ pcrf_pps_server_name:
+ type: string
+ default: True
+ label: PCRF PS server name
+ description: PCRF PS server name
+ pcrf_pps_image_name:
+ type: string
+ label: PCRF PS image name
+ description: PCRF PS image name
+ pcrf_pps_flavor_name:
+ type: string
+ label: PCRF PS flavor name
+ description: flavor name of PCRF PS instance
+ availability_zone_0:
+ type: string
+ label: availabilityzone name
+ description: availabilityzone name
+ pcrf_cps_net_name:
+ type: string
+ label: CPS network name
+ description: CPS network name
+ pcrf_cps_net_ip:
+ type: string
+ label: CPS network ip
+ description: CPS network ip
+ pcrf_cps_net_mask:
+ type: string
+ label: CPS network mask
+ description: CPS network mask
+ pcrf_security_group_name:
+ type: string
+ label: security group name
+ description: the name of security group
+ pcrf_vnf_id:
+ type: string
+ label: PCRF VNF Id
+ description: PCRF VNF Id
+
+resources:
+ script_init:
+ type: OS::Heat::SoftwareConfig
+ properties:
+ group: ungrouped
+ config:
+ str_replace:
+ params:
+ $vm_name: { get_param: pcrf_pps_server_name }
+ network:
+ type: OS::Heat::CloudConfig
+ properties:
+ cloud_config:
+ write_files:
+ - path: /etc/sysconfig/network-scripts/ifcfg-eth0
+ permissions: "0644"
+ content:
+ str_replace:
+ params:
+ $dev: eth0
+ $ip: { get_param: pcrf_cps_net_ip }
+ $netmask: { get_param: pcrf_cps_net_mask }
+ runcmd:
+ - ifdown eth0 && ifup eth0
+
+ pcrf_server_init:
+ type: OS::Heat::MultipartMime
+ properties:
+ parts:
+ - config: { get_resource: network}
+ - config: { get_resource: script_init}
+
+ pcrf_server_pps:
+ type: OS::Nova::Server
+ properties:
+ config_drive: "True"
+ name: { get_param: pcrf_pps_server_name }
+ image: { get_param: pcrf_pps_image_name }
+ flavor: { get_param: pcrf_pps_flavor_name }
+ availability_zone: { get_param: availability_zone_0 }
+ networks:
+ - port: { get_resource: pcrf_pps_port_0}
+ user_data_format: RAW
+ user_data:
+ get_resource: pcrf_server_init
+ metadata:
+ vnf_id: {get_param: pcrf_vnf_id}
+
+ pcrf_pps_port_0:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: pcrf_cps_net_name }
+ fixed_ips:
+ - ip_address: { get_param: pcrf_cps_net_ip }
+ security_groups: [{ get_param: pcrf_security_group_name }]