Initial OpenECOMP MSO commit
[so.git] / packages / arquillian-unit-tests / src / test / resources / resource-examples / asdc / demo-vfw-V1 / artifacts / base_vfw.yaml
1 heat_template_version: 2013-05-23
2
3 description: Heat template to deploy vFirewall demo app for OpenECOMP
4
5 parameters:
6   vfw_image_name:
7     type: string
8     label: Image name or ID
9     description: Image to be used for compute instance
10   vfw_flavor_name:
11     type: string
12     label: Flavor
13     description: Type of instance (flavor) to be used
14   public_net_id:
15     type: string
16     label: Public network name or ID
17     description: Public network that enables remote connection to VNF
18   unprotected_private_net_id:
19     type: string
20     label: Unprotected private network name or ID
21     description: Private network that connects vPacketGenerator with vFirewall
22   protected_private_net_id:
23     type: string
24     label: Protected private network name or ID
25     description: Private network that connects vFirewall with vSink
26   ecomp_private_net_id:
27     type: string
28     label: ECOMP management network name or ID
29     description: Private network that connects ECOMP component and the VNF
30   unprotected_private_net_cidr:
31     type: string
32     label: Unprotected private network CIDR
33     description: The CIDR of the unprotected private network
34   protected_private_net_cidr:
35     type: string
36     label: Protected private network CIDR
37     description: The CIDR of the protected private network
38   ecomp_private_net_cidr:
39     type: string
40     label: ECOMP private network CIDR
41     description: The CIDR of the protected private network
42   vfw_private_ip_0:
43     type: string
44     label: vFirewall private IP address towards the unprotected network
45     description: Private IP address that is assigned to the vFirewall to communicate with the vPacketGenerator
46   vfw_private_ip_1:
47     type: string
48     label: vFirewall private IP address towards the protected network
49     description: Private IP address that is assigned to the vFirewall to communicate with the vSink
50   vfw_private_ip_2:
51     type: string
52     label: vFirewall private IP address towards the ECOMP management network
53     description: Private IP address that is assigned to the vFirewall to communicate with ECOMP components
54   vpg_private_ip_0:
55     type: string
56     label: vPacketGenerator private IP address towards the unprotected network
57     description: Private IP address that is assigned to the vPacketGenerator to communicate with the vFirewall
58   vpg_private_ip_1:
59     type: string
60     label: vPacketGenerator private IP address towards the ECOMP management network
61     description: Private IP address that is assigned to the vPacketGenerator to communicate with ECOMP components
62   vsn_private_ip_0:
63     type: string
64     label: vSink private IP address towards the protected network
65     description: Private IP address that is assigned to the vSink to communicate with the vFirewall
66   vsn_private_ip_1:
67     type: string
68     label: vSink private IP address towards the ECOMP management network
69     description: Private IP address that is assigned to the vSink to communicate with ECOMP components
70   vfw_name_0:
71     type: string
72     label: vFirewall name
73     description: Name of the vFirewall
74   vpg_name_0:
75     type: string
76     label: vPacketGenerator name
77     description: Name of the vPacketGenerator
78   vsn_name_0:
79     type: string
80     label: vSink name
81     description: Name of the vSink
82   vnf_id:
83     type: string
84     label: VNF ID
85     description: The VNF ID is provided by ECOMP
86   vf_module_id:
87     type: string
88     label: vFirewall module ID
89     description: The vFirewall Module ID is provided by ECOMP
90   webserver_ip:
91     type: string
92     label: Webserver IP address
93     description: IP address of the webserver that hosts the source code and binaries
94   dcae_collector_ip:
95     type: string
96     label: DCAE collector IP address
97     description: IP address of the DCAE collector
98   key_name:
99     type: string
100     label: Key pair name
101     description: Public/Private key pair name
102   pub_key:
103     type: string
104     label: Public key
105     description: Public key to be installed on the compute instance
106
107 resources:
108   my_keypair:
109     type: OS::Nova::KeyPair
110     properties:
111       name: { get_param: key_name }
112       public_key: { get_param: pub_key }
113       save_private_key: false
114
115   unprotected_private_network:
116     type: OS::Neutron::Net
117     properties:
118       name: { get_param: unprotected_private_net_id }
119
120   protected_private_network:
121     type: OS::Neutron::Net
122     properties:
123       name: { get_param: protected_private_net_id }
124
125   unprotected_private_subnet:
126     type: OS::Neutron::Subnet
127     properties:
128       network_id: { get_resource: unprotected_private_network }
129       cidr: { get_param: unprotected_private_net_cidr }
130
131   protected_private_subnet:
132     type: OS::Neutron::Subnet
133     properties:
134       network_id: { get_resource: protected_private_network }
135       cidr: { get_param: protected_private_net_cidr }
136
137   vfw_0:
138     type: OS::Nova::Server
139     properties:
140       image: { get_param: vfw_image_name }
141       flavor: { get_param: vfw_flavor_name }
142       name: { get_param: vfw_name_0 }
143       key_name: { get_resource: my_keypair }
144       networks:
145         - network: { get_param: public_net_id }
146         - port: { get_resource: vfw_private_0_port }
147         - port: { get_resource: vfw_private_1_port }
148         - port: { get_resource: vfw_private_2_port }
149       metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
150       user_data_format: RAW
151       user_data:
152         str_replace:
153           params:
154             __webserver__: { get_param: webserver_ip }
155             __dcae_collector_ip__ : { get_param: dcae_collector_ip }
156           template: |
157             #!/bin/bash
158
159             WEBSERVER_IP=__webserver__
160             DCAE_COLLECTOR_IP=__dcae_collector_ip__
161
162             mkdir /opt/config
163             cd /opt
164             wget http://$WEBSERVER_IP/demo_repo/v_firewall_init.sh
165             wget http://$WEBSERVER_IP/demo_repo/vfirewall.sh
166             chmod +x v_firewall_init.sh
167             chmod +x vfirewall.sh
168             echo $WEBSERVER_IP > config/webserver_ip.txt
169             echo $DCAE_COLLECTOR_IP > config/dcae_collector_ip.txt
170             echo "no" > config/install.txt
171             mv vfirewall.sh /etc/init.d
172             sudo update-rc.d vfirewall.sh defaults
173             ./v_firewall_init.sh
174
175   vfw_private_0_port:
176     type: OS::Neutron::Port
177     properties:
178       network: { get_resource: unprotected_private_network }
179       fixed_ips: [{"subnet": { get_resource: unprotected_private_subnet }, "ip_address": { get_param: vfw_private_ip_0 }}]
180
181   vfw_private_1_port:
182     type: OS::Neutron::Port
183     properties:
184       network: { get_resource: protected_private_network }
185       fixed_ips: [{"subnet": { get_resource: protected_private_subnet }, "ip_address": { get_param: vfw_private_ip_1 }}]
186
187   vfw_private_2_port:
188     type: OS::Neutron::Port
189     properties:
190       network: { get_param: ecomp_private_net_id }
191       fixed_ips: [{"subnet": { get_param: ecomp_private_net_id }, "ip_address": { get_param: vfw_private_ip_2 }}]
192
193   vpg_0:
194     type: OS::Nova::Server
195     properties:
196       image: { get_param: vfw_image_name }
197       flavor: { get_param: vfw_flavor_name }
198       name: { get_param: vpg_name_0 }
199       key_name: { get_resource: my_keypair }
200       networks:
201         - network: { get_param: public_net_id }
202         - port: { get_resource: vpg_private_0_port }
203         - port: { get_resource: vpg_private_1_port }
204       metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
205       user_data_format: RAW
206       user_data:
207         str_replace:
208           params:
209             __webserver__: { get_param: webserver_ip }
210             __fw_ipaddr__: { get_param: vfw_private_ip_0 }
211             __protected_net_cidr__: { get_param: protected_private_net_cidr }
212             __sink_ipaddr__: { get_param: vsn_private_ip_0 }
213           template: |
214             #!/bin/bash
215
216             WEBSERVER_IP=__webserver__
217             FW_IPADDR=__fw_ipaddr__
218             PROTECTED_NET_CIDR=__protected_net_cidr__
219             SINK_IPADDR=__sink_ipaddr__
220
221             mkdir /opt/config
222             cd /opt
223             wget http://$WEBSERVER_IP/demo_repo/v_packetgen_init.sh
224             wget http://$WEBSERVER_IP/demo_repo/vpacketgen.sh
225             chmod +x v_packetgen_init.sh
226             chmod +x vpacketgen.sh
227             echo $WEBSERVER_IP > config/webserver_ip.txt
228             echo $FW_IPADDR > config/fw_ipaddr.txt
229             echo $PROTECTED_NET_CIDR > config/protected_net_cidr.txt
230             echo $SINK_IPADDR > config/sink_ipaddr.txt
231             echo "no" > config/install.txt
232             mv vpacketgen.sh /etc/init.d
233             sudo update-rc.d vpacketgen.sh defaults
234             ./v_packetgen_init.sh
235
236   vpg_private_0_port:
237     type: OS::Neutron::Port
238     properties:
239       network: { get_resource: unprotected_private_network }
240       fixed_ips: [{"subnet": { get_resource: unprotected_private_subnet }, "ip_address": { get_param: vpg_private_ip_0 }}]
241
242   vpg_private_1_port:
243     type: OS::Neutron::Port
244     properties:
245       network: { get_param: ecomp_private_net_id }
246       fixed_ips: [{"subnet": { get_param: ecomp_private_net_id }, "ip_address": { get_param: vpg_private_ip_1 }}]
247
248   vsn_0:
249     type: OS::Nova::Server
250     properties:
251       image: { get_param: vfw_image_name }
252       flavor: { get_param: vfw_flavor_name }
253       name: { get_param: vsn_name_0 }
254       key_name: { get_resource: my_keypair }
255       networks:
256         - network: { get_param: public_net_id }
257         - port: { get_resource: vsn_private_0_port }
258         - port: { get_resource: vsn_private_1_port }
259       metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
260       user_data_format: RAW
261       user_data:
262         str_replace:
263           params:
264             __webserver__: { get_param: webserver_ip }
265             __protected_net_gw__: { get_param: vfw_private_ip_1 }
266             __unprotected_net__: { get_param: unprotected_private_net_cidr }
267           template: |
268             #!/bin/bash
269
270             WEBSERVER_IP=__webserver__
271             PROTECTED_NET_GW=__protected_net_gw__
272             UNPROTECTED_NET=__unprotected_net__
273             UNPROTECTED_NET=$(echo $UNPROTECTED_NET | cut -d'/' -f1)
274
275             mkdir /opt/config
276             cd /opt
277             wget http://$WEBSERVER_IP/demo_repo/v_sink_init.sh
278             wget http://$WEBSERVER_IP/demo_repo/vsink.sh
279             chmod +x v_sink_init.sh
280             chmod +x vsink.sh
281             echo $PROTECTED_NET_GW > config/protected_net_gw.txt
282             echo $UNPROTECTED_NET > config/unprotected_net.txt
283             echo "no" > config/install.txt
284             mv vsink.sh /etc/init.d
285             sudo update-rc.d vsink.sh defaults
286             ./v_sink_init.sh
287
288   vsn_private_0_port:
289     type: OS::Neutron::Port
290     properties:
291       network: { get_resource: protected_private_network }
292       fixed_ips: [{"subnet": { get_resource: protected_private_subnet }, "ip_address": { get_param: vsn_private_ip_0 }}]
293
294   vsn_private_1_port:
295     type: OS::Neutron::Port
296     properties:
297       network: { get_param: ecomp_private_net_id }
298       fixed_ips: [{"subnet": { get_param: ecomp_private_net_id }, "ip_address": { get_param: vsn_private_ip_1 }}]