Fix spacing issues in YAML files in heat
[demo.git] / heat / vLB_HPA / vLB_SRIOV_NIC / base_vlb.yaml
1 ##########################################################################
2 #
3 #==================LICENSE_START==========================================
4 #
5 #
6 # Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
7 #
8 # Licensed under the Apache License, Version 2.0 (the "License");
9 # you may not use this file except in compliance with the License.
10 # You may obtain a copy of the License at
11 #        http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 #
19 #==================LICENSE_END============================================
20 #
21 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
22 #
23 ##########################################################################
24
25 heat_template_version: 2013-05-23
26
27 description: Heat template to deploy vLoadBalancer/vDNS demo app for ONAP
28
29 ##############
30 #            #
31 # PARAMETERS #
32 #            #
33 ##############
34
35 parameters:
36   vlb_image_name:
37     type: string
38     label: Image name or ID
39     description: Image to be used for compute instance
40   vlb_flavor_name:
41     type: string
42     label: Flavor
43     description: Type of instance (flavor) to be used
44   vdns_flavor_name:
45     type: string
46     label: Flavor
47     description: Type of instance (flavor) to be used
48   vpg_flavor_name:
49     type: string
50     label: Flavor
51     description: Type of instance (flavor) to be used
52   public_net_id:
53     type: string
54     label: Public network name or ID
55     description: Public network that enables remote connection to VNF
56   vlb_private_net_id:
57     type: string
58     label: vLoadBalancer private network name or ID
59     description: Private network that connects vLoadBalancer with vDNSs
60   pktgen_private_net_id:
61     type: string
62     label: vPacketGen private network name or ID
63     description: Private network that connects vLoadBalancer with vPacketGen
64   vlb_private_provider_net:
65     type: string
66     label: name of provider network to be used to create vlb_private_net
67     description: provider network for private network that connects vLoadBalancer with vDNSs
68   pktgen_private_provider_net:
69     type: string
70     label: name of provider network to be used to create pktgen_private_net_id
71     description: provider network for private network that connects vLoadBalancer with vPacketGen
72   onap_private_net_id:
73     type: string
74     label: ONAP management network name or ID
75     description: Private network that connects ONAP component and the VNF
76   onap_private_subnet_id:
77     type: string
78     label: ONAP management sub-network name or ID
79     description: Private sub-network that connects ONAP component and the VNF
80   vlb_private_net_cidr:
81     type: string
82     label: vLoadBalancer private network CIDR
83     description: The CIDR of the vLoadBalancer private network
84   pktgen_private_net_cidr:
85     type: string
86     label: vPacketGen private network CIDR
87     description: The CIDR of the vPacketGen private network
88   onap_private_net_cidr:
89     type: string
90     label: ONAP private network CIDR
91     description: The CIDR of the protected private network
92   vlb_private_ip_0:
93     type: string
94     label: vLoadBalancer private IP address towards the private network
95     description: Private IP address that is assigned to the vLoadBalancer to communicate with the vDNSs
96   vlb_private_ip_1:
97     type: string
98     label: vLoadBalancer private IP address towards the ONAP management network
99     description: Private IP address that is assigned to the vLoadBalancer to communicate with ONAP components
100   vlb_private_ip_2:
101     type: string
102     label: vLoadBalancer private IP address towards the vPacketGen network
103     description: Private IP address that is assigned to the vLoadBalancer to communicate with vPacketGen
104   vdns_private_ip_0:
105     type: string
106     label: vDNS private IP address towards the private network
107     description: Private IP address that is assigned to the vDNS to communicate with the vLoadBalancer
108   vdns_private_ip_1:
109     type: string
110     label: vDNS private IP address towards the ONAP management network
111     description: Private IP address that is assigned to the vDNS to communicate with ONAP components
112   vpg_private_ip_0:
113     type: string
114     label: vPacketGen private IP address towards the vPacketGen private network
115     description: Private IP address that is assigned to the vPacketGen to communicate with the vLoadBalancer
116   vpg_private_ip_1:
117     type: string
118     label: vPacketGen private IP address towards the ONAP management network
119     description: Private IP address that is assigned to the vPacketGen to communicate with ONAP components
120   vlb_private_0_port_vnic_type:
121     type: string
122     description: vlb port 0 vnic type (normal, direct)
123     default: normal
124   vlb_private_1_port_vnic_type:
125     type: string
126     description: vlb port 1 vnic type (normal, direct)
127     default: normal
128   vlb_private_2_port_vnic_type:
129     type: string
130     description: vlb port 2 vnic type (normal, direct)
131     default: normal
132   vpg_private_0_port_vnic_type:
133     type: string
134     description: vpg port 0 vnic type (normal, direct)
135     default: normal
136   vpg_private_1_port_vnic_type:
137     type: string
138     description: vpg port 1 vnic type (normal, direct)
139     default: normal
140   vdns_private_0_port_vnic_type:
141     type: string
142     description: vdns port 0 vnic type (normal, direct)
143     default: normal
144   vdns_private_1_port_vnic_type:
145     type: string
146     description: vdns port 1 vnic type (normal, direct)
147     default: normal
148   vip:
149     type: string
150     label: Virtual Private IP of the vLoadBalancer
151     description: Virtual Private IP that is assigned to the vLoadBalancer's VPP layer
152   gre_ipaddr:
153     type: string
154     label: IP Address of the GRE tunnel
155     description: IP address assigned to the GRE tunnel on the vLoadBalancer
156   pg_int:
157     type: string
158     label: IP Address of the output vPacketGen interface
159     description: IP address assigned to the output interface of the vPacketGen's VPP layer
160   vlb_name_0:
161     type: string
162     label: vLoadBalancer name
163     description: Name of the vLoadBalancer
164   vdns_name_0:
165     type: string
166     label: vDNS name
167     description: Name of the vDNS
168   vpg_name_0:
169     type: string
170     label: vPKTGEN name
171     description: Name of the vPKTGEN
172   vnf_id:
173     type: string
174     label: VNF ID
175     description: The VNF ID is provided by ONAP
176   vf_module_id:
177     type: string
178     label: vFirewall module ID
179     description: The vLoadBalancer Module ID is provided by ONAP
180   dcae_collector_ip:
181     type: string
182     label: DCAE collector IP address
183     description: IP address of the DCAE collector
184   dcae_collector_port:
185     type: string
186     label: DCAE collector port
187     description: Port of the DCAE collector
188   key_name:
189     type: string
190     label: Key pair name
191     description: Public/Private key pair name
192   pub_key:
193     type: string
194     label: Public key
195     description: Public key to be installed on the compute instance
196   demo_artifacts_version:
197     type: string
198     label: Artifacts version used in demo vnfs
199     description: Artifacts (jar, tar.gz) version used in demo vnfs
200   nexus_artifact_repo:
201     type: string
202     description: Root URL for the Nexus repository for Maven artifacts.
203     default: "https://nexus.onap.org"
204   install_script_version:
205     type: string
206     label: Installation script version number
207     description: Version number of the scripts that install the vFW demo app
208   cloud_env:
209     type: string
210     label: Cloud environment
211     description: Cloud environment (e.g., openstack, rackspace)
212   sec_group:
213     type: string
214     description: ONAP Security Group
215
216
217 #############
218 #           #
219 # RESOURCES #
220 #           #
221 #############
222
223 resources:
224
225   random-str:
226     type: OS::Heat::RandomString
227     properties:
228       length: 4
229
230   my_keypair:
231     type: OS::Nova::KeyPair
232     properties:
233       name:
234         str_replace:
235           template: base_rand
236           params:
237             base: { get_param: key_name }
238             rand: { get_resource: random-str }
239       public_key: { get_param: pub_key }
240       save_private_key: false
241
242   vlb_private_network:
243     type: OS::Neutron::ProviderNet
244     properties:
245       name: { get_param: vlb_private_net_id }
246       physical_network: {get_param: vlb_private_provider_net}
247       network_type: vlan
248
249   vlb_private_subnet:
250     type: OS::Neutron::Subnet
251     properties:
252       name: { get_param: vlb_private_net_id }
253       network_id: { get_resource: vlb_private_network }
254       cidr: { get_param: vlb_private_net_cidr }
255
256   pktgen_private_network:
257     type: OS::Neutron::ProviderNet
258     properties:
259       name: { get_param: pktgen_private_net_id }
260       physical_network: {get_param: pktgen_private_provider_net}
261       network_type: vlan
262
263   pktgen_private_subnet:
264     type: OS::Neutron::Subnet
265     properties:
266       name: { get_param: pktgen_private_net_id }
267       network_id: { get_resource: pktgen_private_network }
268       cidr: { get_param: pktgen_private_net_cidr }
269
270   vlb_private_0_port:
271     type: OS::Neutron::Port
272     properties:
273       network: { get_resource: vlb_private_network }
274       binding:vnic_type: { get_param: vlb_private_0_port_vnic_type}
275       fixed_ips: [{"subnet": { get_resource: vlb_private_subnet }, "ip_address": { get_param: vlb_private_ip_0 }}]
276       security_groups:
277       - { get_param: sec_group }
278
279
280   vlb_private_1_port:
281     type: OS::Neutron::Port
282     properties:
283       network: { get_param: onap_private_net_id }
284       binding:vnic_type: { get_param: vlb_private_1_port_vnic_type}
285       fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vlb_private_ip_1 }}]
286       security_groups:
287       - { get_param: sec_group }
288
289   vlb_private_2_port:
290     type: OS::Neutron::Port
291     properties:
292       network: { get_resource: pktgen_private_network }
293       binding:vnic_type: { get_param: vlb_private_2_port_vnic_type}
294       fixed_ips: [{"subnet": { get_resource: pktgen_private_subnet }, "ip_address": { get_param: vlb_private_ip_2 }}]
295       security_groups:
296       - { get_param: sec_group }
297
298   vlb_0:
299     type: OS::Nova::Server
300     properties:
301       image: { get_param: vlb_image_name }
302       flavor: { get_param: vlb_flavor_name }
303       name: { get_param: vlb_name_0 }
304       key_name: { get_resource: my_keypair }
305       networks:
306         - network: { get_param: public_net_id }
307         - port: { get_resource: vlb_private_0_port }
308         - port: { get_resource: vlb_private_1_port }
309         - port: { get_resource: vlb_private_2_port }
310       metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
311       user_data_format: RAW
312       user_data:
313         str_replace:
314           params:
315             __dcae_collector_ip__: { get_param: dcae_collector_ip }
316             __dcae_collector_port__: { get_param: dcae_collector_port }
317             __ip_to_dns_net__: { get_param: vlb_private_ip_0 }
318             __ip_to_pktgen_net__: { get_param: vlb_private_ip_2 }
319             __vip__: { get_param: vip }
320             __gre_ipaddr__: { get_param: gre_ipaddr }
321             __pktgen_ipaddr__: { get_param: vpg_private_ip_0 }
322             __oam_private_ipaddr__: { get_param: vlb_private_ip_1 }
323             __demo_artifacts_version__: { get_param: demo_artifacts_version }
324             __install_script_version__: { get_param: install_script_version }
325             __vlb_private_net_cidr__: { get_param: vlb_private_net_cidr }
326             __onap_private_net_cidr__: { get_param: onap_private_net_cidr }
327             __pktgen_private_net_cidr__: { get_param: pktgen_private_net_cidr }
328             __pktgen_mac__: { get_attr: [vpg_private_0_port, mac_address] }
329             __cloud_env__: { get_param: cloud_env }
330             __nexus_artifact_repo__: { get_param: nexus_artifact_repo }
331           template: |
332             #!/bin/bash
333
334             # Create configuration files
335             mkdir /opt/config
336             echo "__dcae_collector_ip__" > /opt/config/dcae_collector_ip.txt
337             echo "__dcae_collector_port__" > /opt/config/dcae_collector_port.txt
338             echo "__ip_to_dns_net__" > /opt/config/ip_to_dns_net.txt
339             echo "__ip_to_pktgen_net__" > /opt/config/ip_to_pktgen_net.txt
340             echo "__vip__" > /opt/config/vip.txt
341             echo "__gre_ipaddr__" > /opt/config/gre_ipaddr.txt
342             echo "__pktgen_ipaddr__" > /opt/config/pktgen_ipaddr.txt
343             echo "__oam_private_ipaddr__" > /opt/config/oam_private_ipaddr.txt
344             echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
345             echo "__install_script_version__" > /opt/config/install_script_version.txt
346             echo "__vlb_private_net_cidr__" > /opt/config/vlb_private_net_cidr.txt
347             echo "__pktgen_private_net_cidr__" > /opt/config/pktgen_private_net_cidr.txt
348             echo "__onap_private_net_cidr__" > /opt/config/onap_private_net_cidr.txt
349             echo "__pktgen_mac__" > /opt/config/pktgen_mac.txt
350             echo "__cloud_env__" > /opt/config/cloud_env.txt
351             echo "__nexus_artifact_repo__" > /opt/config/nexus_artifact_repo.txt
352
353             # Download and run install script
354             apt-get update
355             apt-get -y install unzip
356             if [[ "__install_script_version__" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi
357             curl -k -L "__nexus_artifact_repo__/service/local/artifact/maven/redirect?r=${REPO}&g=org.onap.demo.vnf.vlb&a=vlb-scripts&e=zip&v=__install_script_version__" -o /opt/vlb-scripts-__install_script_version__.zip
358             unzip -j /opt/vlb-scripts-__install_script_version__.zip -d /opt v_lb_install.sh
359             cd /opt
360             chmod +x v_lb_install.sh
361             ./v_lb_install.sh
362
363
364   vdns_private_0_port:
365     type: OS::Neutron::Port
366     properties:
367       network: { get_resource: vlb_private_network }
368       binding:vnic_type: { get_param: vdns_private_0_port_vnic_type}
369       fixed_ips: [{"subnet": { get_resource: vlb_private_subnet }, "ip_address": { get_param: vdns_private_ip_0 }}]
370       security_groups:
371       - { get_param: sec_group }
372
373   vdns_private_1_port:
374     type: OS::Neutron::Port
375     properties:
376       network: { get_param: onap_private_net_id }
377       binding:vnic_type: { get_param: vdns_private_1_port_vnic_type}
378       fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vdns_private_ip_1 }}]
379       security_groups:
380       - { get_param: sec_group }
381
382
383   vdns_0:
384     type: OS::Nova::Server
385     properties:
386       image: { get_param: vlb_image_name }
387       flavor: { get_param: vdns_flavor_name }
388       name: { get_param: vdns_name_0 }
389       key_name: { get_resource: my_keypair }
390       networks:
391         - network: { get_param: public_net_id }
392         - port: { get_resource: vdns_private_0_port }
393         - port: { get_resource: vdns_private_1_port }
394       metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
395       user_data_format: RAW
396       user_data:
397         str_replace:
398           params:
399             __lb_oam_int__: { get_param: vlb_private_ip_1 }
400             __lb_private_ipaddr__: { get_param: vlb_private_ip_0 }
401             __local_private_ipaddr__: { get_param: vdns_private_ip_0 }
402             __oam_private_ipaddr__: { get_param: vdns_private_ip_1 }
403             __demo_artifacts_version__: { get_param: demo_artifacts_version }
404             __install_script_version__: { get_param: install_script_version }
405             __vlb_private_net_cidr__: { get_param: vlb_private_net_cidr }
406             __onap_private_net_cidr__: { get_param: onap_private_net_cidr }
407             __cloud_env__: { get_param: cloud_env }
408             __nexus_artifact_repo__: { get_param: nexus_artifact_repo }
409           template: |
410             #!/bin/bash
411
412             # Create configuration files
413             mkdir /opt/config
414             echo "__lb_oam_int__" > /opt/config/lb_oam_int.txt
415             echo "__lb_private_ipaddr__" > /opt/config/lb_private_ipaddr.txt
416             echo "__local_private_ipaddr__" > /opt/config/local_private_ipaddr.txt
417             echo "__oam_private_ipaddr__" > /opt/config/oam_private_ipaddr.txt
418             echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
419             echo "__install_script_version__" > /opt/config/install_script_version.txt
420             echo "__vlb_private_net_cidr__" > /opt/config/vlb_private_net_cidr.txt
421             echo "__onap_private_net_cidr__" > /opt/config/onap_private_net_cidr.txt
422             echo "__cloud_env__" > /opt/config/cloud_env.txt
423             echo "__nexus_artifact_repo__" > /opt/config/nexus_artifact_repo.txt
424
425             # Download and run install script
426             apt-get update
427             apt-get -y install unzip
428             if [[ "__install_script_version__" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi
429             curl -k -L "__nexus_artifact_repo__/service/local/artifact/maven/redirect?r=${REPO}&g=org.onap.demo.vnf.vlb&a=vlb-scripts&e=zip&v=__install_script_version__" -o /opt/vlb-scripts-__install_script_version__.zip
430             unzip -j /opt/vlb-scripts-__install_script_version__.zip -d /opt v_dns_install.sh
431             cd /opt
432             chmod +x v_dns_install.sh
433             ./v_dns_install.sh
434
435
436   vpg_private_0_port:
437     type: OS::Neutron::Port
438     properties:
439       network: { get_resource: pktgen_private_network }
440       binding:vnic_type: { get_param: vpg_private_0_port_vnic_type}
441       fixed_ips: [{"subnet": { get_resource: pktgen_private_subnet }, "ip_address": { get_param: vpg_private_ip_0 }}]
442       security_groups:
443       - { get_param: sec_group }
444
445   vpg_private_1_port:
446     type: OS::Neutron::Port
447     properties:
448       network: { get_param: onap_private_net_id }
449       binding:vnic_type: { get_param: vpg_private_1_port_vnic_type}
450       fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vpg_private_ip_1 }}]
451       security_groups:
452       - { get_param: sec_group }
453
454   vpg_0:
455     type: OS::Nova::Server
456     properties:
457       image: { get_param: vlb_image_name }
458       flavor: { get_param: vpg_flavor_name }
459       name: { get_param: vpg_name_0 }
460       key_name: { get_resource: my_keypair }
461       networks:
462         - network: { get_param: public_net_id }
463         - port: { get_resource: vpg_private_0_port }
464         - port: { get_resource: vpg_private_1_port }
465       user_data_format: RAW
466       user_data:
467         str_replace:
468           params:
469             __local_private_ipaddr__: { get_param: vpg_private_ip_0 }
470             __oam_private_ipaddr__: { get_param: vpg_private_ip_1 }
471             __onap_private_net_cidr__: { get_param: onap_private_net_cidr }
472             __pktgen_private_net_cidr__: { get_param: pktgen_private_net_cidr }
473             __vlb_ipaddr__: { get_param: vlb_private_ip_2 }
474             __demo_artifacts_version__: { get_param: demo_artifacts_version }
475             __install_script_version__: { get_param: install_script_version }
476             __pg_int__: { get_param: pg_int }
477             __vlb_mac__: { get_attr: [vlb_private_2_port, mac_address] }
478             __cloud_env__: { get_param: cloud_env }
479             __nexus_artifact_repo__: { get_param: nexus_artifact_repo }
480           template: |
481             #!/bin/bash
482
483             # Create configuration files
484             mkdir /opt/config
485             echo "__oam_private_ipaddr__" > /opt/config/oam_private_ipaddr.txt
486             echo "__onap_private_net_cidr__" > /opt/config/onap_private_net_cidr.txt
487             echo "__local_private_ipaddr__" > /opt/config/local_private_ipaddr.txt
488             echo "__pktgen_private_net_cidr__" > /opt/config/pktgen_private_net_cidr.txt
489             echo "__vlb_ipaddr__" > /opt/config/vlb_ipaddr.txt
490             echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
491             echo "__install_script_version__" > /opt/config/install_script_version.txt
492             echo "__pg_int__" > /opt/config/pg_int.txt
493             echo "__vlb_mac__" > /opt/config/vlb_mac.txt
494             echo "__cloud_env__" > /opt/config/cloud_env.txt
495             echo "__nexus_artifact_repo__" > /opt/config/nexus_artifact_repo.txt
496
497             # Download and run install script
498             apt-get update
499             apt-get -y install unzip
500             if [[ "__install_script_version__" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi
501             curl -k -L "__nexus_artifact_repo__/service/local/artifact/maven/redirect?r=${REPO}&g=org.onap.demo.vnf.vlb&a=vlb-scripts&e=zip&v=__install_script_version__" -o /opt/vlb-scripts-__install_script_version__.zip
502             unzip -j /opt/vlb-scripts-__install_script_version__.zip -d /opt v_packetgen_install.sh
503             cd /opt
504             chmod +x v_packetgen_install.sh
505             ./v_packetgen_install.sh