59585450e2297fb04b020f482b0e496da2f7b826
[demo.git] / heat / vLB / base_vlb_rackspace.yaml
1 heat_template_version: 2013-05-23
2
3 description: Heat template to deploy vLoadBalancer/vDNS demo app for ONAP
4
5 parameters:
6   vlb_image_name:
7     type: string
8     label: Image name or ID
9     description: Image to be used for compute instance
10   vlb_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   vlb_private_net_id:
19     type: string
20     label: vLoadBalancer private network name or ID
21     description: Private network that connects vLoadBalancer with vDNSs
22   onap_private_net_id:
23     type: string
24     label: ONAP management network name or ID
25     description: Private network that connects ONAP components and the VNF
26   onap_private_subnet_id:
27     type: string
28     label: ONAP management sub-network name or ID
29     description: Private sub-network that connects ONAP components and the VNF
30   vlb_private_net_cidr:
31     type: string
32     label: vLoadBalancer private network CIDR
33     description: The CIDR of the vLoadBalancer private network
34   onap_private_net_cidr:
35     type: string
36     label: ONAP private network CIDR
37     description: The CIDR of the protected private network
38   vlb_private_ip_0:
39     type: string
40     label: vLoadBalancer private IP address towards the private network
41     description: Private IP address that is assigned to the vLoadBalancer to communicate with the vDNSs
42   vlb_private_ip_1:
43     type: string
44     label: vLoadBalancer private IP address towards the ONAP management network
45     description: Private IP address that is assigned to the vLoadBalancer to communicate with ONAP components
46   vdns_private_ip_0:
47     type: string
48     label: vDNS private IP address towards the private network
49     description: Private IP address that is assigned to the vDNS to communicate with the vLoadBalancer
50   vdns_private_ip_1:
51     type: string
52     label: vDNS private IP address towards the ONAP management network
53     description: Private IP address that is assigned to the vDNS to communicate with ONAP components
54   vlb_name_0:
55     type: string
56     label: vLoadBalancer name
57     description: Name of the vLoadBalancer
58   vdns_name_0:
59     type: string
60     label: vDNS name
61     description: Name of the vDNS
62   vnf_id:
63     type: string
64     label: VNF ID
65     description: The VNF ID is provided by ONAP
66   vf_module_id:
67     type: string
68     label: vFirewall module ID
69     description: The vLoadBalancer Module ID is provided by ONAP
70   dcae_collector_ip:
71     type: string
72     label: DCAE collector IP address
73     description: IP address of the DCAE collector
74   dcae_collector_port:
75     type: string
76     label: DCAE collector port
77     description: Port of the DCAE collector
78   key_name:
79     type: string
80     label: Key pair name
81     description: Public/Private key pair name
82   pub_key:
83     type: string
84     label: Public key
85     description: Public key to be installed on the compute instance
86   repo_url_blob:
87     type: string
88     label: Repository URL
89     description: URL of the repository that hosts the demo packages
90   repo_url_artifacts:
91     type: string
92     label: Repository URL
93     description: URL of the repository that hosts the demo packages
94   install_script_version:
95     type: string
96     label: Installation script version number
97     description: Version number of the scripts that install the vFW demo app
98   demo_artifacts_version:
99     type: string
100     label: Artifacts version used in demo vnfs
101     description: Artifacts (jar, tar.gz) version used in demo vnfs
102   cloud_env:
103     type: string
104     label: Cloud environment
105     description: Cloud environment (e.g., openstack, rackspace)
106
107 resources:
108
109   random-str:
110     type: OS::Heat::RandomString
111     properties:
112       length: 4
113
114   my_keypair:
115     type: OS::Nova::KeyPair
116     properties:
117       name:
118         str_replace:
119           template: base_rand
120           params:
121             base: { get_param: key_name }
122             rand: { get_resource: random-str }
123       public_key: { get_param: pub_key }
124       save_private_key: false
125
126   vlb_private_network:
127     type: OS::Neutron::Net
128     properties:
129       name: { get_param: vlb_private_net_id }
130
131   vlb_private_subnet:
132     type: OS::Neutron::Subnet
133     properties:
134       name: { get_param: vlb_private_net_id }
135       network_id: { get_resource: vlb_private_network }
136       cidr: { get_param: vlb_private_net_cidr }
137
138   # Virtual Load Balancer Instantiation
139   vlb_private_0_port:
140     type: OS::Neutron::Port
141     properties:
142       network: { get_resource: vlb_private_network }
143       fixed_ips: [{"subnet": { get_resource: vlb_private_subnet }, "ip_address": { get_param: vlb_private_ip_0 }}]
144
145   vlb_private_1_port:
146     type: OS::Neutron::Port
147     properties:
148       network: { get_param: onap_private_net_id }
149       fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vlb_private_ip_1 }}]
150
151   vlb_0:
152     type: OS::Nova::Server
153     properties:
154       image: { get_param: vlb_image_name }
155       flavor: { get_param: vlb_flavor_name }
156       name: { get_param: vlb_name_0 }
157       key_name: { get_resource: my_keypair }
158       networks:
159         - network: { get_param: public_net_id }
160         - port: { get_resource: vlb_private_0_port }
161         - port: { get_resource: vlb_private_1_port }
162       metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
163       user_data_format: RAW
164       user_data:
165         str_replace:
166           params:
167             __dcae_collector_ip__: { get_param: dcae_collector_ip }
168             __dcae_collector_port__: { get_param: dcae_collector_port }
169             __local_private_ipaddr__: { get_param: vlb_private_ip_0 }
170             __local_public_ipaddr__: { get_attr: [vlb_0, first_address] }
171             __repo_url_blob__ : { get_param: repo_url_blob }
172             __repo_url_artifacts__ : { get_param: repo_url_artifacts }
173             __demo_artifacts_version__ : { get_param: demo_artifacts_version }
174             __install_script_version__ : { get_param: install_script_version }
175             __cloud_env__ : { get_param: cloud_env }
176           template: |
177             #!/bin/bash
178
179             # Create configuration files
180             mkdir /opt/config
181             echo "__dcae_collector_ip__" > /opt/config/dcae_collector_ip.txt
182             echo "__dcae_collector_port__" > /opt/config/dcae_collector_port.txt
183             echo "__local_private_ipaddr__" > /opt/config/local_private_ipaddr.txt
184             echo "__local_public_ipaddr__" > /opt/config/local_public_ipaddr.txt
185             echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt
186             echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt
187             echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
188             echo "__install_script_version__" > /opt/config/install_script_version.txt
189             echo "__cloud_env__" > /opt/config/cloud_env.txt
190
191             # Download and run install script
192             curl -k __repo_url_blob__/org.openecomp.demo/vnfs/vlb/__install_script_version__/v_lb_install.sh -o /opt/v_lb_install.sh
193             cd /opt
194             chmod +x v_lb_install.sh
195             ./v_lb_install.sh
196
197
198   # Virtual DNS Instantiation
199   vdns_private_0_port:
200     type: OS::Neutron::Port
201     properties:
202       network: { get_resource: vlb_private_network }
203       fixed_ips: [{"subnet": { get_resource: vlb_private_subnet }, "ip_address": { get_param: vdns_private_ip_0 }}]
204
205   vdns_private_1_port:
206     type: OS::Neutron::Port
207     properties:
208       network: { get_param: onap_private_net_id }
209       fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vdns_private_ip_1 }}]
210
211   vdns_0:
212     type: OS::Nova::Server
213     properties:
214       image: { get_param: vlb_image_name }
215       flavor: { get_param: vlb_flavor_name }
216       name: { get_param: vdns_name_0 }
217       key_name: { get_resource: my_keypair }
218       networks:
219         - network: { get_param: public_net_id }
220         - port: { get_resource: vdns_private_0_port }
221         - port: { get_resource: vdns_private_1_port }
222       metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
223       user_data_format: RAW
224       user_data:
225         str_replace:
226           params:
227             __lb_oam_int__ : { get_param: vlb_private_ip_1 }
228             __lb_private_ipaddr__: { get_param: vlb_private_ip_0 }
229             __local_private_ipaddr__: { get_param: vdns_private_ip_0 }
230             __repo_url_blob__ : { get_param: repo_url_blob }
231             __repo_url_artifacts__ : { get_param: repo_url_artifacts }
232             __demo_artifacts_version__ : { get_param: demo_artifacts_version }
233             __install_script_version__ : { get_param: install_script_version }
234             __cloud_env__ : { get_param: cloud_env }
235           template: |
236             #!/bin/bash
237
238             # Create configuration files
239             mkdir /opt/config
240             echo "__lb_oam_int__" > /opt/config/lb_oam_int.txt
241             echo "__lb_private_ipaddr__" > /opt/config/lb_private_ipaddr.txt
242             echo "__local_private_ipaddr__" > /opt/config/local_private_ipaddr.txt
243             echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt
244             echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt
245             echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
246             echo "__install_script_version__" > /opt/config/install_script_version.txt
247             echo "__cloud_env__" > /opt/config/cloud_env.txt
248
249             # Download and run install script
250             curl -k __repo_url_blob__/org.openecomp.demo/vnfs/vlb/__install_script_version__/v_dns_install.sh -o /opt/v_dns_install.sh
251             cd /opt
252             chmod +x v_dns_install.sh
253             ./v_dns_install.sh