summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-heat-lib/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-heat-lib/src/test')
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/EnvironmentTest.java38
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/HeatOrchestrationTemplateTest.java122
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/envSettings.env36
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/testHeat.yml524
4 files changed, 720 insertions, 0 deletions
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/EnvironmentTest.java b/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/EnvironmentTest.java
new file mode 100644
index 0000000000..2c0cf0b1aa
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/EnvironmentTest.java
@@ -0,0 +1,38 @@
+package org.openecomp.sdc.heat.datatypes.model;
+
+import org.openecomp.core.utilities.yaml.YamlUtil;
+import org.junit.Test;
+
+import java.io.InputStream;
+
+public class EnvironmentTest {
+
+ @Test
+ public void testYamlToServiceTemplateObj() {
+ YamlUtil yamlUtil = new YamlUtil();
+ InputStream yamlFile = yamlUtil.loadYamlFileIs("/mock/model/envSettings.env");
+ Environment envVars = yamlUtil.yamlToObject(yamlFile, Environment.class);
+ envVars.toString();
+ }
+
+ @Test
+ public void test() {
+ String heatResourceName = "server_abc_0u";
+ String novaServerPrefix = "server_";
+ if (heatResourceName.startsWith(novaServerPrefix)) {
+ heatResourceName = heatResourceName.substring(novaServerPrefix.length());
+ }
+ int lastIndexOfUnderscore = heatResourceName.lastIndexOf("_");
+ if (heatResourceName.length() == lastIndexOfUnderscore) {
+ System.out.println(heatResourceName);
+ } else {
+ String heatResourceNameSuffix = heatResourceName.substring(lastIndexOfUnderscore + 1);
+ try {
+ Integer.parseInt(heatResourceNameSuffix);
+ System.out.println(heatResourceName.substring(0, lastIndexOfUnderscore));
+ } catch (NumberFormatException ignored) {
+ System.out.println(heatResourceName);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/HeatOrchestrationTemplateTest.java b/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/HeatOrchestrationTemplateTest.java
new file mode 100644
index 0000000000..09c83ca217
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/HeatOrchestrationTemplateTest.java
@@ -0,0 +1,122 @@
+package org.openecomp.sdc.heat.datatypes.model;
+
+import org.openecomp.core.utilities.yaml.YamlUtil;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class HeatOrchestrationTemplateTest {
+
+ @Test
+ public void testYamlToServiceTemplateObj() {
+ YamlUtil yamlUtil = new YamlUtil();
+ InputStream yamlFile = yamlUtil.loadYamlFileIs("/mock/model/testHeat.yml");
+ HeatOrchestrationTemplate heatOrchestrationTemplate =
+ yamlUtil.yamlToObject(yamlFile, HeatOrchestrationTemplate.class);
+ heatOrchestrationTemplate.toString();
+ }
+
+ @Test
+ public void createHotTemplate() {
+ HeatOrchestrationTemplate template = new HeatOrchestrationTemplate();
+ template.setHeat_template_version("2016-04-14");
+ template.setDescription("test description for hot template");
+ Map<String, Parameter> params = createParameters();
+ template.setParameters(params);
+ List<ParameterGroup> parameterGroup = new ArrayList<>();
+ ParameterGroup paramsGroup = new ParameterGroup();
+ paramsGroup.setDescription("params group test description");
+ paramsGroup.setLabel("params group test label");
+ String paramName = params.get("param1").getLabel();
+ List<String> paramsNames = new ArrayList<>();
+ paramsNames.add(paramName);
+ paramsGroup.setParameters(paramsNames);
+ parameterGroup.add(paramsGroup);
+ template.setParameter_groups(parameterGroup);
+ Map<String, Object> conditions = new HashMap<>();
+ conditions.put("key1", "val1");
+ HashMap<String, Object> mapValue = new HashMap<>();
+ mapValue.put("innerKey", "innerVal");
+ conditions.put("key2", mapValue);
+ template.setConditions(conditions);
+
+ Map<String, Resource> resources = new HashMap<>();
+ Resource resource = new Resource();
+ resource.setMetadata("resource metadata");
+ resource.setType("resource type");
+ //Map<String, String> resourceProps = new ;
+ Map<String, Object> resourceProps = new HashMap<>();
+ resourceProps.put("aaa", "bbb");
+ //resourceProps.add(resourceProp);
+ resource.setProperties(resourceProps);
+ resources.put("R1", resource);
+ resource = new Resource();
+ resource.setMetadata("resource2 metadata");
+ resource.setType("resource2 type");
+ //resourceProps = new ArrayList<>();
+ resourceProps = new HashMap<>();
+ resourceProps.put("aaa2", "bbb2");
+ //resourceProps.add(resourceProp);
+ resource.setProperties(resourceProps);
+ List<String> dependsOn = new ArrayList<>();
+ dependsOn.add("R1");
+ resource.setDepends_on(dependsOn);
+ resource.setDeletion_policy("all");
+ resource.setUpdate_policy("once");
+ resources.put("R2", resource);
+ template.setResources(resources);
+
+ YamlUtil yamlUtil = new YamlUtil();
+ String yml = yamlUtil.objectToYaml(template);
+ Assert.assertNotNull(yml);
+ try {
+ HeatOrchestrationTemplate heatOrchestrationTemplate =
+ yamlUtil.yamlToObject(yml, HeatOrchestrationTemplate.class);
+ Assert.assertNotNull(heatOrchestrationTemplate);
+ } catch (Exception ignored) {
+ }
+ }
+
+ private Map<String, Parameter> createParameters() {
+ Map<String, Parameter> params = new HashMap<>();
+ Parameter param;
+ for (int i = 0; i < 2; i++) {
+ param = new Parameter();
+ param.setDescription("param " + i + " desc");
+ param.setLabel("param " + i + " label");
+ param.set_default("PARAM " + i + " default");
+ param.setHidden(i % 2 == 0);
+ param.setImmutable(i % 2 == 0);
+ param.setType(i % 2 == 0 ? ParameterType.STRING.getDisplayName()
+ : ParameterType.BOOLEAN.getDisplayName());
+ params.put("param" + i, param);
+ }
+
+ return params;
+ }
+
+ private List<Constraint> createConstraints() {
+ List<Constraint> constraints = new ArrayList<>();
+ Constraint constraint = new Constraint();
+ constraint.setLength(new Integer[]{2, 4});
+ constraints.add(constraint);
+ constraint = new Constraint();
+ constraint.setPattern("some regex");
+ constraints.add(constraint);
+ constraint = new Constraint();
+ constraint.setRange(new Integer[]{5, 8});
+ constraints.add(constraint);
+ constraint = new Constraint();
+ List<Object> validValues = new ArrayList<>();
+ validValues.add("abc");
+ validValues.add("def");
+ constraint.setValid_values(validValues);
+ constraints.add(constraint);
+ return constraints;
+ }
+} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/envSettings.env b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/envSettings.env
new file mode 100644
index 0000000000..4f5e20a55f
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/envSettings.env
@@ -0,0 +1,36 @@
+parameters:
+ czid: RDM1
+ vf_inst_number: 01
+ admin_password: cisco123
+ vpc_vip_addr: 172.17.32.112
+ vpc_vip_gateway: 172.17.32.1
+ availability_zone: nova
+
+ instance_image_cf1: SGW_19.2.0v-CF1-ATTM1.0.1_nimbus
+ instance_image_cf2: SGW_19.2.0v-CF2-ATTM1.0.1_nimbus
+ instance_image_sf: SGW_19.2.0v-SFn-ATTM1.0.1_nimbus
+ instance_flavor_cf: m1.xlarge
+ instance_flavor_sf: m1.xlarge
+
+
+ instance_network: mns-oam_direct_net_0
+ cgw_int_di2_net: nimbus_int_sae_gw_di-2_net_0
+ cgw_gn_net: mns-gn_direct_net_0
+ cgw_cor_net: mns-cor_direct_net_0
+ cgw_sgi_protected_net: nimbus_sgi_protected_net_0
+ cgw_sgi_ims_net: nimbus_sgi_ims_net_0
+ cgw_oam_calea_net: nimbus_oam_calea_net_0
+ cgw_int_icsr_net: nimbus_int_icsr_net_0
+
+ # CF VNFs Neutron static IP for management port
+ CF01-OAM-IP: 172.17.32.110
+ CF02-OAM-IP: 172.17.32.111
+ # SF VNFs Neutron static IPs for port 1-6
+ SF03-IP: { gn_ip: [107.243.0.5, "2606:ae00:2e01:140::5"], cor_ip: [107.243.3.5, "fd00:ae00:2e01:40::5"], sgi_prot_ip: [107.243.1.5, "fd00:ae00:2030:a40::5"], sgi_ims_ip: [107.243.2.5, "fd00:ae00:2030:b40::5"], oam_calea_ip: [107.243.4.5], int_icsr_ip: [172.26.0.5, "fd00:2600:2600::5"]}
+ SF04-IP: { gn_ip: [107.243.0.6, "2606:ae00:2e01:140::6"], cor_ip: [107.243.3.6, "fd00:ae00:2e01:40::6"], sgi_prot_ip: [107.243.1.6, "fd00:ae00:2030:a40::6"], sgi_ims_ip: [107.243.2.6, "fd00:ae00:2030:b40::6"], oam_calea_ip: [107.243.4.6], int_icsr_ip: [172.26.0.10, "fd00:2600:2600::10"]}
+ SF05-IP: { gn_ip: [107.243.0.7, "2606:ae00:2e01:140::7"], cor_ip: [107.243.3.7, "fd00:ae00:2e01:40::7"], sgi_prot_ip: [107.243.1.7, "fd00:ae00:2030:a40::7"], sgi_ims_ip: [107.243.2.7, "fd00:ae00:2030:b40::7"], oam_calea_ip: [107.243.4.7], int_icsr_ip: [172.26.0.9, "fd00:2600:2600::9"]}
+ SF06-IP: { gn_ip: [107.243.0.8, "2606:ae00:2e01:140::8"], cor_ip: [107.243.3.8, "fd00:ae00:2e01:40::8"], sgi_prot_ip: [107.243.1.8, "fd00:ae00:2030:a40::8"], sgi_ims_ip: [107.243.2.8, "fd00:ae00:2030:b40::8"], oam_calea_ip: [107.243.4.8], int_icsr_ip: [172.26.0.8, "fd00:2600:2600::8"]}
+ # Volume size for HDD attaching to CF card for CDR storage
+ vol_size_1: 16
+ vol_size_2: 16
+
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/testHeat.yml b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/testHeat.yml
new file mode 100644
index 0000000000..d1eb621731
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/testHeat.yml
@@ -0,0 +1,524 @@
+heat_template_version: 2013-05-23
+
+description: vSeGW/vSRX Firewall Template
+
+parameter_groups:
+- label: System Settings
+ description: System Level Settings
+ parameters:
+ - availability_zone_0
+ - vnf_name
+ - vnf_id
+
+parameters:
+ availability_zone_0:
+ type: string
+ description: Availability Zone
+ vnf_name:
+ type: string
+ description: Unique name for this VNF instance
+ vnf_id:
+ type: string
+ description: Unique ID for this VNF instance
+
+# Note we are requesting a flavor with 10 physical CPU cores and may be limited by 16 vCPU flavor.
+ flavor_segw_name:
+ type: string
+ description: flavor type
+# The image will be provided as a qcow2 KVM image.
+ image_segw_name:
+ type: string
+ description: Image use to boot a server
+
+ flavor_vsrxfw_name:
+ type: string
+ description: flavor type
+ image_vsrxfw_name:
+ type: string
+ description: Image use to boot a server
+
+ INTERNET_direct_net_id:
+ type: string
+ description: The Internet
+
+ oam_mgmt_net_0_id:
+ type: string
+ description: Name of OAM mgmt network
+
+ oam_protected_net_0_id:
+ type: string
+ description: Name of OAM protected network
+
+ Mobility_OAM_protected_net_0_id:
+ type: string
+ description: Network name for OAM
+
+ GN_direct_net_0_id:
+ type: string
+ description: Network name for GN network
+
+ Mobility_OAM_protected_net_1_id:
+ type: string
+ description: Network name for OAM
+
+ GN_direct_net_1_id:
+ type: string
+ description: Network name for GN network
+
+ HSL_direct_net_id:
+ type: string
+ description: Name of HSL (Logging) network
+ HSL_direct_net_cidr:
+ type: string
+ description: HSL (Logging) network address (CIDR notation)
+
+ int_dummi0_net_id:
+ type: string
+ description: Dummi Parent Network for port
+ int_dummi1_net_id:
+ type: string
+ description: Dummi Parent Network for port
+# int_dummi2_net_id:
+# type: string
+# description: Dummi Parent Network for port
+# int_dummi3_net_id:
+# type: string
+# description: Dummi Parent Network for port
+# int_dummi4_net_id:
+# type: string
+# description: Dummi Parent Network for port
+# int_dummi5_net_id:
+# type: string
+# description: Dummi Parent Network for port
+
+ int_dummi0_cidr:
+ type: string
+ description: IPv4 prefix (CIDR notation)
+ int_dummi1_cidr:
+ type: string
+ description: IPv4 prefix (CIDR notation)
+# int_dummi2_cidr:
+# type: string
+# description: IPv4 prefix (CIDR notation)
+# int_dummi3_cidr:
+# type: string
+# description: IPv4 prefix (CIDR notation)
+# int_dummi4_cidr:
+# type: string
+# description: IPv4 prefix (CIDR notation)
+# int_dummi5_cidr:
+# type: string
+# description: IPv4 prefix (CIDR notation)
+
+ segw_0_inet_ip_0:
+ type: string
+ label: segw_0 port ens10 Ingress IP address alias_0
+ description: SeGW's Ingress interface IPv4 address, primary
+ segw_0_inet_ip_1:
+ type: string
+ label: segw_0 port ens10 Ingress IP address alias_1
+ description: SeGW's Ingress interface IPv4 address, alias 1
+ segw_0_inet_ip_2:
+ type: string
+ label: segw_0 port ens10 Ingress IP address alias_2
+ description: SeGW's Ingress interface IPv4 address, alias 2
+
+ segw_1_inet_ip_0:
+ type: string
+ label: segw_1 port ens10 Ingress IP address alias_0
+ description: SeGW's Ingress interface IPv4 address, primary
+ segw_1_inet_ip_1:
+ type: string
+ label: segw_1 port ens10 Ingress IP address alias_1
+ description: SeGW's Ingress interface IPv4 address, alias 1
+ segw_1_inet_ip_2:
+ type: string
+ label: segw_1 port ens10 Ingress IP address alias_2
+ description: SeGW's Ingress interface IPv4 address, alias 2
+ segw_0_oam_protected_ip:
+ type: string
+ label: segw_0 OAM MGMT IP address
+ description: segw_0 OAM MGMT IP address
+ segw_1_oam_protected_ip:
+ type: string
+ label: segw_1 OAM MGMT IP address
+ description: segw_1 OAM MGMT IP address
+
+# vsrx_fw_0_GN_direct_ip:
+# type: string
+# label: vsrx_fw_0 GN Direct IP address
+# description: vsrx_fw_0 GN Direct IP address
+# vsrx_fw_1_GN_direct_ip:
+# type: string
+# label: vsrx_fw_1 GN Direct IP address
+# description: vsrx_fw_1 GN Direct IP address
+# vsrx_fw_2_OAM_protected_ip:
+# type: string
+# label: vsrx_fw_2 OAM Protected IP address
+# description: vsrx_fw_2 OAM Protected IP address
+# vsrx_fw_3_OAM_protected_ip:
+# type: string
+# label: vsrx_fw_3 OAM Protected IP address
+# description: vsrx_fw_3 OAM Protected IP address
+
+ segw_0_name:
+ type: string
+ default: vSeGW_0
+ description: name of VM
+ segw_1_name:
+ type: string
+ default: vSeGW_1
+ description: name of VM
+ vsrx_fw_0_name:
+ type: string
+ default: vSRX_FW_0
+ description: name of VM
+ vsrx_fw_1_name:
+ type: string
+ default: vSRX_FW_1
+ description: name of VM
+ vsrx_fw_2_name:
+ type: string
+ default: vSRX_FW_2
+ description: name of VM
+ vsrx_fw_3_name:
+ type: string
+ default: vSRX_FW_3
+ description: name of VM
+
+ security_group_name:
+ type: string
+ label: SEGW security group name
+ description: SEGW security group name
+
+resources:
+
+ SeGW_Affinity:
+ type: OS::Nova::ServerGroup
+ properties:
+ policies: ["anti-affinity"]
+ vSRXFW_Affinity:
+ type: OS::Nova::ServerGroup
+ properties:
+ policies: ["anti-affinity"]
+
+ Dummi0_net:
+ type: OS::Contrail::VirtualNetwork
+ properties:
+ name: { get_param: int_dummi0_net_id }
+ Dummi0_subnet:
+ type: OS::Neutron::Subnet
+ properties:
+ network_id: { get_resource: Dummi0_net }
+ cidr: { get_param: int_dummi0_cidr }
+
+ Dummi1_net:
+ type: OS::Contrail::VirtualNetwork
+ properties:
+ name: { get_param: int_dummi1_net_id }
+ Dummi1_subnet:
+ type: OS::Neutron::Subnet
+ properties:
+ network_id: { get_resource: Dummi1_net }
+ cidr: { get_param: int_dummi1_cidr }
+
+ hsl_direct_net:
+ type: OS::Contrail::VirtualNetwork
+ properties:
+ name: { get_param: HSL_direct_net_id }
+
+ hsl_ip_subnet:
+ type: OS::Neutron::Subnet
+ properties:
+ network_id: { get_resource: hsl_direct_net }
+ cidr: { get_param: HSL_direct_net_cidr }
+
+ segw_security_group:
+ type: OS::Neutron::SecurityGroup
+ properties:
+ description: vscp security group
+ name: {get_param: security_group_name}
+# Need to add any-any rule through GUI to get SCTP traffic to work - any-any rules are not supported in heat template
+ rules: [{"direction": egress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": tcp, "remote_ip_prefix": 0.0.0.0/0},
+ {"direction": egress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": udp, "remote_ip_prefix": 0.0.0.0/0},
+ {"direction": egress, "ethertype": IPv4, "protocol": icmp, "remote_ip_prefix": 0.0.0.0/0},
+ {"direction": ingress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": tcp, "remote_ip_prefix": 0.0.0.0/0},
+ {"direction": ingress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": udp, "remote_ip_prefix": 0.0.0.0/0},
+ {"direction": ingress, "ethertype": IPv4, "protocol": icmp, "remote_ip_prefix": 0.0.0.0/0}
+ ]
+
+ server_segw_segw_0:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: segw_0_name }
+ image: { get_param: image_segw_name }
+ availability_zone: { get_param: availability_zone_0 }
+ flavor: { get_param: flavor_segw_name }
+ scheduler_hints: { group: { get_resource: SeGW_Affinity } }
+ networks:
+ - port: { get_resource: port_segw_0_oam_protected }
+ - port: { get_resource: port_segw_0_internet }
+ - port: { get_resource: port_segw_0_dummi }
+ metadata:
+ vnf_id: { get_param: vnf_id }
+
+ port_segw_0_oam_protected:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: oam_protected_net_0_id }
+ fixed_ips: [{"ip_address": {get_param: segw_0_oam_protected_ip}}]
+ security_groups: [{get_resource: segw_security_group}]
+
+ port_segw_0_internet:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: INTERNET_direct_net_id }
+ fixed_ips: [{"ip_address": {get_param: segw_0_inet_ip_0}}, {"ip_address": {get_param: segw_0_inet_ip_1}}, {"ip_address": {get_param: segw_0_inet_ip_2}}]
+ security_groups: [{get_resource: segw_security_group}]
+
+ port_segw_0_dummi:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_resource: Dummi0_net }
+ security_groups: [{get_resource: segw_security_group}]
+
+ server_segw_segw_1:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: segw_1_name }
+ image: { get_param: image_segw_name }
+ availability_zone: { get_param: availability_zone_0 }
+ flavor: { get_param: flavor_segw_name }
+ scheduler_hints: { group: { get_resource: SeGW_Affinity } }
+ networks:
+ - port: { get_resource: port_segw_1_oam_protected }
+ - port: { get_resource: port_segw_1_internet }
+ - port: { get_resource: port_segw_1_dummi }
+ metadata:
+ vnf_id: { get_param: vnf_id }
+
+ port_segw_1_oam_protected:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: oam_protected_net_0_id }
+ fixed_ips: [{"ip_address": {get_param: segw_1_oam_protected_ip}}]
+ security_groups: [{get_resource: segw_security_group}]
+
+ port_segw_1_internet:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: INTERNET_direct_net_id }
+ fixed_ips: [{"ip_address": {get_param: segw_1_inet_ip_0}}, {"ip_address": {get_param: segw_1_inet_ip_1}}, {"ip_address": {get_param: segw_1_inet_ip_2}}]
+ security_groups: [{get_resource: segw_security_group}]
+
+ port_segw_1_dummi:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_resource: Dummi1_net }
+ security_groups: [{get_resource: segw_security_group}]
+
+ server_vsrx_fw_0:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: vsrx_fw_0_name }
+ image: { get_param: image_vsrxfw_name }
+ availability_zone: { get_param: availability_zone_0 }
+ flavor: { get_param: flavor_vsrxfw_name }
+ scheduler_hints: { group: { get_resource: vSRXFW_Affinity } }
+ networks:
+ - port: { get_resource: port_vsrx_fw_0_oam_mgmt }
+ - port: { get_resource: port_vsrx_fw_0_dummi }
+ - port: { get_resource: port_vsrx_fw_0_GN }
+ - port: { get_resource: port_vsrx_fw_0_HSL }
+
+ metadata:
+ vnf_id: { get_param: vnf_id }
+
+ port_vsrx_fw_0_oam_mgmt:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: oam_mgmt_net_0_id }
+ security_groups: [{get_resource: segw_security_group}]
+
+ port_vsrx_fw_0_dummi:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_resource: Dummi0_net }
+ security_groups: [{get_resource: segw_security_group}]
+
+ port_vsrx_fw_0_GN:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: GN_direct_net_0_id }
+# fixed_ips: [{"ip_address": {get_param: vsrx_fw_0_GN_direct_ip}}]
+ security_groups: [{get_resource: segw_security_group}]
+
+ port_vsrx_fw_0_HSL:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_resource: hsl_direct_net }
+ security_groups: [{get_resource: segw_security_group}]
+
+ server_vsrx_fw_1:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: vsrx_fw_1_name }
+ image: { get_param: image_vsrxfw_name }
+ availability_zone: { get_param: availability_zone_0 }
+ flavor: { get_param: flavor_vsrxfw_name }
+ scheduler_hints: { group: { get_resource: vSRXFW_Affinity } }
+ networks:
+ - port: { get_resource: port_vsrx_fw_1_oam_mgmt }
+ - port: { get_resource: port_vsrx_fw_1_dummi }
+ - port: { get_resource: port_vsrx_fw_1_GN }
+ - port: { get_resource: port_vsrx_fw_1_HSL }
+
+ metadata:
+ vnf_id: { get_param: vnf_id }
+
+ port_vsrx_fw_1_oam_mgmt:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: oam_mgmt_net_0_id }
+ security_groups: [{get_resource: segw_security_group}]
+
+ port_vsrx_fw_1_dummi:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_resource: Dummi1_net }
+ security_groups: [{get_resource: segw_security_group}]
+
+ port_vsrx_fw_1_GN:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: GN_direct_net_1_id }
+# fixed_ips: [{"ip_address": {get_param: vsrx_fw_1_GN_direct_ip}}]
+ security_groups: [{get_resource: segw_security_group}]
+
+ port_vsrx_fw_1_HSL:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_resource: hsl_direct_net }
+ security_groups: [{get_resource: segw_security_group}]
+
+ server_vsrx_fw_2:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: vsrx_fw_2_name }
+ image: { get_param: image_vsrxfw_name }
+ availability_zone: { get_param: availability_zone_0 }
+ flavor: { get_param: flavor_vsrxfw_name }
+ scheduler_hints: { group: { get_resource: vSRXFW_Affinity } }
+ networks:
+ - port: { get_resource: port_vsrx_fw_2_oam_mgmt }
+ - port: { get_resource: port_vsrx_fw_2_dummi }
+ - port: { get_resource: port_vsrx_fw_2_OAM }
+ - port: { get_resource: port_vsrx_fw_2_HSL }
+
+ metadata:
+ vnf_id: { get_param: vnf_id }
+
+ port_vsrx_fw_2_oam_mgmt:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: oam_mgmt_net_0_id }
+ security_groups: [{get_resource: segw_security_group}]
+
+ port_vsrx_fw_2_dummi:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_resource: Dummi0_net }
+ security_groups: [{get_resource: segw_security_group}]
+
+ port_vsrx_fw_2_OAM:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: Mobility_OAM_protected_net_0_id }
+# fixed_ips: [{"ip_address": {get_param: vsrx_fw_2_OAM_protected_ip}}]
+ security_groups: [{get_resource: segw_security_group}]
+
+ port_vsrx_fw_2_HSL:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_resource: hsl_direct_net }
+ security_groups: [{get_resource: segw_security_group}]
+
+ server_vsrx_fw_3:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: vsrx_fw_3_name }
+ image: { get_param: image_vsrxfw_name }
+ availability_zone: { get_param: availability_zone_0 }
+ flavor: { get_param: flavor_vsrxfw_name }
+ scheduler_hints: { group: { get_resource: vSRXFW_Affinity } }
+ networks:
+ - port: { get_resource: port_vsrx_fw_3_oam_mgmt }
+ - port: { get_resource: port_vsrx_fw_3_dummi }
+ - port: { get_resource: port_vsrx_fw_3_OAM }
+ - port: { get_resource: port_vsrx_fw_3_HSL }
+
+ metadata:
+ vnf_id: { get_param: vnf_id }
+
+ port_vsrx_fw_3_oam_mgmt:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: oam_mgmt_net_0_id }
+ security_groups: [{get_resource: segw_security_group}]
+
+ port_vsrx_fw_3_dummi:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_resource: Dummi1_net }
+ security_groups: [{get_resource: segw_security_group}]
+
+ port_vsrx_fw_3_OAM:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: Mobility_OAM_protected_net_1_id }
+# fixed_ips: [{"ip_address": {get_param: vsrx_fw_3_OAM_protected_ip}}]
+ security_groups: [{get_resource: segw_security_group}]
+
+ port_vsrx_fw_3_HSL:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_resource: hsl_direct_net }
+ security_groups: [{get_resource: segw_security_group}]
+
+conditions:
+ cd1: True
+ cd2:
+ get_param: param1
+ cd3:
+ equals:
+ - get_param: param2
+ - yes
+ cd4:
+ not:
+ equals:
+ - get_param: param3
+ - yes
+ cd5:
+ and:
+ - equals:
+ - get_param: env_type
+ - prod
+ - not:
+ equals:
+ - get_param: zone
+ - beijing
+ cd6:
+ or:
+ - equals:
+ - get_param: zone
+ - shanghai
+ - equals:
+ - get_param: zone
+ - beijing
+ cd7:
+ not: cd4
+ cd8:
+ and:
+ - cd1
+ - cd2
+ create_prod_res: {equals : [{get_param: env_type}, "prod"]} \ No newline at end of file