Initial version vCPE TOSCA infra template
[demo.git] / tosca / vCPE / infra / base_vcpe_infra_rackspace_tosca.yaml
1 tosca_definitions_version: tosca_simple_yaml_1_0
2
3 imports:
4   - aria-1.0
5   - https://gerrit.onap.org/r/gitweb?p=so.git;a=blob_plain;f=aria/multivim-plugin/src/main/python/multivim-plugin/plugin.yaml
6
7 topology_template:
8   description: TOSCA template to deploy vCPE Infrastructue emlements (vAAA, vDHCP, vDNS_DHCP, webServer_sink) for ONAP
9
10   inputs:
11     multivim_config:
12       type: onap.multivim.datatypes.Config
13       description: MultiVIM connection configuration
14     vcpe_image_name:
15       type: string
16       description: Image to be used for compute instance
17     vcpe_flavor_name:
18       type: string
19       description: Type of instance (flavor) to be used
20     public_net_id:
21       type: string
22       description: Public network that enables remote connection to VNF
23     onap_private_net_id:
24       type: string
25       description: Private network that connects ONAP components and the VNF
26     onap_private_subnet_id:
27       type: string
28       description: Private sub-network that connects ONAP components and the VNF
29     onap_private_net_cidr:
30       type: string
31       description: The CIDR of the protected private network
32     cpe_signal_net_id:
33       type: string
34       description: Private network that connects vAAA with vDNSs
35     cpe_signal_net_cidr:
36       type: string
37       description: The CIDR of the vAAA private network
38     cpe_public_net_id:
39       type: string
40       description: Private network that connects vGW to emulated internet
41     cpe_public_net_cidr:
42       type: string
43       description: The CIDR of the vCPE public
44     vaaa_private_ip_0:
45       type: string
46       description: Private IP address that is assigned to the vAAA to communicate with the vCPE components 
47     vaaa_private_ip_1:
48       type: string
49       description: Private IP address that is assigned to the vAAA to communicate with ONAP components
50     vdns_private_ip_0:
51       type: string
52       description: Private IP address that is assigned to the vDNS to communicate with the vCPE components
53     vdns_private_ip_1:
54       type: string
55       description: Private IP address that is assigned to the vDNS to communicate with ONAP components
56     vdhcp_private_ip_0:
57       type: string
58       description: Private IP address that is assigned to the vDHCP to communicate with the vCPE components
59     vdhcp_private_ip_1:
60       type: string
61       description: Private IP address that is assigned to the vDHCP to communicate with ONAP components
62     vweb_private_ip_0:
63       type: string
64       description: Private IP address that is assigned to the vWEB to communicate with the vGWs 
65     vweb_private_ip_1:
66       type: string
67       description: Private IP address that is assigned to the vWEB to communicate with ONAP components
68     vaaa_name_0:
69       type: string
70       description: Name of the vAAA
71     vdns_name_0:
72       type: string
73       description: Name of the vDNS
74     vdhcp_name_0:
75       type: string
76       description: Name of the vDHCP
77     vweb_name_0:
78       type: string
79       description: Name of the vWEB 
80     vnf_id:
81       type: string
82       description: The VNF ID is provided by ONAP
83     vf_module_id:
84       type: string
85       description: The vAAA Module ID is provided by ONAP
86     dcae_collector_ip:
87       type: string
88       description: IP address of the DCAE collector
89     dcae_collector_port:
90       type: string
91       description: Port of the DCAE collector
92     key_name:
93       type: string
94       description: Public/Private key pair name
95     pub_key:
96       type: string
97       description: Public key to be installed on the compute instance
98     repo_url_blob:
99       type: string
100       description: URL of the repository that hosts the demo packages
101     repo_url_artifacts:
102       type: string
103       description: URL of the repository that hosts the demo packages
104     install_script_version:
105       type: string
106       description: Version number of the scripts that install the vFW demo app
107     demo_artifacts_version:
108       type: string
109       description: Artifacts (jar, tar.gz) version used in demo vnfs
110     cloud_env:
111       type: string
112
113   
114 ##################
115 #                #
116 # NODE TEMPLATES #
117 #                #
118 ##################
119
120   node_templates:
121
122     my_keypair:
123       type: onap.multivim.nodes.KeyPair
124       properties:
125         resource_id: vcpe_kp
126         multivim_config:
127           custom_configuration:
128             public_key: { get_input: pub_key }
129         multivim_config: { get_input: multivim_config }
130
131     onap_private_network:
132       type: onap.multivim.nodes.Network
133       properties:
134         use_external_resource: true
135         resource_id: { get_input: onap_private_net_id }
136         multivim_config: { get_input: multivim_config }
137   
138     onap_private_subnet:
139       type: onap.multivim.nodes.Subnet
140       properties:
141         use_external_resource: true
142         resource_id: { get_input: onap_private_subnet_id }
143         multivim_config: { get_input: multivim_config }
144
145     cpe_signal_network:
146       type: onap.multivim.nodes.Network
147       properties:
148         resource_id: { get_input: cpe_signal_net_id }
149         multivim_config: { get_input: multivim_config }
150
151     cpe_signal_subnet:
152       type: onap.multivim.nodes.Subnet
153       properties:
154         resource_id: { get_input: cpe_signal_net_id }
155         subnet:
156           cidr: { get_input: cpe_signal_net_cidr }
157         multivim_config: { get_input: multivim_config }
158       requirements:
159         - network: cpe_signal_network
160
161     cpe_public_network:
162       type: onap.multivim.nodes.Network
163       properties:
164         resource_id: { get_input: cpe_public_net_id }
165         multivim_config: { get_input: multivim_config }
166
167     cpe_public_subnet:
168       type: onap.multivim.nodes.Subnet
169       properties:
170         resource_id: { get_input: cpe_public_net_id }
171         subnet:
172           cidr: { get_input: cpe_public_net_cidr }
173         multivim_config: { get_input: multivim_config }
174       requirements:
175         - network: cpe_public_network
176
177     # Virtual AAA server Instantiation
178     vaaa_private_0_port:
179       type: onap.multivim.nodes.Port
180       properties:
181         fixed_ip: { get_input: vaaa_private_ip_0 }
182         multivim_config: { get_input: multivim_config }
183       requirements:
184         - network: cpe_signal_network
185         - subnet: cpe_signal_subnet
186
187     vaaa_private_1_port:
188       type: onap.multivim.nodes.Port
189       properties:
190         fixed_ip: { get_input: vaaa_private_ip_1 }
191         multivim_config: { get_input: multivim_config }
192       requirements:
193         - network: onap_private_network
194         - subnet: onap_private_subnet
195
196     # NOTE: may need management_network_name
197     vaaa_0:
198       type: onap.multivim.nodes.Server
199       properties:
200         image: { get_input: vcpe_image_name }
201         flavor: { get_input: vcpe_flavor_name }
202         resource_id: { get_input: vaaa_name_0 }
203         management_network_name: onap_private_network
204         multivim_config: { get_input: multivim_config }
205         server:
206           metadata: {vnf_id: { get_input: vnf_id }, vf_module_id: { get_input: vf_module_id }}
207           userdata: { concat: [
208                               "#!/bin/bash\n",
209                               "mkdir /opt/config\n",
210                               "echo ",{ get_input: dcae_collector_ip}," > /opt/config/dcae_collector_ip.txt\n",
211                               "echo ",{ get_input: dcae_collector_port}," > /opt/config/dcae_collector_port.txt\n",
212                               "echo ",{ get_input: vaaa_private_ip_0}," > /opt/config/cpe_signal_net_ipaddr.txt\n",
213                               "echo ",{ get_input: vaaa_private_ip_1}," > /opt/config/oam_ipaddr.txt\n",
214                               "echo ",{ get_input: onap_private_net_cidr}," > /opt/config/oam_cidr.txt\n",
215                               "echo ",{ get_input: cpe_signal_net_cidr}," > /opt/config/cpe_signal_net_cidr.txt\n",
216                               "echo ",{ get_input: repo_url_blob}," > /opt/config/repo_url_blob.txt\n",
217                               "echo ",{ get_input: repo_url_artifacts}," > /opt/config/repo_url_artifacts.txt\n",
218                               "echo ",{ get_input: demo_artifacts_version}," > /opt/config/demo_artifacts_version.txt\n",
219                               "echo ",{ get_input: install_script_version}," > /opt/config/install_script_version.txt\n",
220                               "echo ",{ get_input: cloud_env}," > /opt/config/cloud_env.txt\n",
221                               "curl -k ",{get_input: repo_url_blob},"/org.onap.demo/vnfs/vcpe/",{get_input: install_script_version},"/v_aaa_install.sh -o /opt/v_aaa_install.sh\n",
222                               "cd /opt\n",
223                               "chmod +x v_aaa_install.sh\n",
224                               "./v_aaa_install.sh\n"
225                             ] 
226                    }
227       requirements:
228         - key_pair: my_keypair
229         - port: vaaa_private_0_port
230         - port: vaaa_private_1_port
231
232     # Virtual DNS Instantiation
233     vdns_private_0_port:
234       type: onap.multivim.nodes.Port
235       properties:
236         fixed_ip: { get_input: vdns_private_ip_0 }
237         multivim_config: { get_input: multivim_config }
238       requirements:
239         - network: cpe_public_network
240
241     vdns_private_1_port:
242       type: onap.multivim.nodes.Port
243       properties:
244         fixed_ip: { get_input: vdns_private_ip_1 }
245         multivim_config: { get_input: multivim_config }
246       requirements:
247         - network: onap_private_network
248
249     vdns_0:
250       type: onap.multivim.nodes.Server
251       properties:
252         image: { get_input: vcpe_image_name }
253         flavor: { get_input: vcpe_flavor_name }
254         resource_id: { get_input: vdns_name_0 }
255         management_network_name: onap_private_network
256         multivim_config: { get_input: multivim_config }
257         server:
258           metadata: {vnf_id: { get_input: vnf_id }, vf_module_id: { get_input: vf_module_id }}
259           userdata: { concat: [
260                               "#!/bin/bash\n",
261                               "mkdir /opt/config\n",
262                               "echo ",{get_input: vdns_private_ip_1}," > /opt/config/oam_ipaddr.txt\n",
263                               "echo ",{get_input: vdns_private_ip_0}," > /opt/config/cpe_public_net_ipaddr.txt\n",
264                               "echo ",{get_input: onap_private_net_cidr}," > /opt/config/oam_cidr.txt\n",
265                               "echo ",{get_input: cpe_public_net_cidr}," > /opt/config/cpe_public_net_cidr.txt\n",
266                               "echo ",{get_input: repo_url_blob}," > /opt/config/repo_url_blob.txt\n",
267                               "echo ",{get_input: repo_url_artifacts}," > /opt/config/repo_url_artifacts.txt\n",
268                               "echo ",{get_input: demo_artifacts_version}," > /opt/config/demo_artifacts_version.txt\n",
269                               "echo ",{get_input: install_script_version}," > /opt/config/install_script_version.txt\n",
270                               "echo ",{get_input: cloud_env}," > /opt/config/cloud_env.txt\n",
271                               "curl -k ",{get_input: repo_url_blob},"/org.onap.demo/vnfs/vcpe/",{get_input: install_script_version},"/v_dns_install.sh -o /opt/v_dns_install.sh\n",
272                               "cd /opt\n",
273                               "chmod +x v_dns_install.sh\n",
274                               "./v_dns_install.sh\n"
275                             ]
276                    }
277       requirements:    
278         - port: vdns_private_0_port
279         - port: vdns_private_1_port
280
281   # Virtual DHCP Instantiation
282     vdhcp_private_0_port:
283       type: onap.multivim.nodes.Port
284       properties:
285         fixed_ip: { get_input: vdhcp_private_ip_0 }
286         multivim_config: { get_input: multivim_config }
287       requirements:
288         - network: cpe_signal_network
289         - subnet: cpe_signal_subnet
290
291     vdhcp_private_1_port:
292       type: onap.multivim.nodes.Port
293       properties:
294         fixed_ip: { get_input: vdhcp_private_ip_1 }
295         multivim_config: { get_input: multivim_config }
296       requirements:
297         - subnet: onap_private_subnet
298
299     vdhcp_0:
300       type: onap.multivim.nodes.Server
301       properties:
302         image: { get_input: vcpe_image_name }
303         flavor: { get_input: vcpe_flavor_name }
304         resource_id: { get_input: vdhcp_name_0 }
305         management_network_name: onap_private_network
306         multivim_config: { get_input: multivim_config }
307         server:
308           metadata: {vnf_id: { get_input: vnf_id }, vf_module_id: { get_input: vf_module_id }}
309           userdata: { concat: [
310                               "#!/bin/bash\n",
311                               "mkdir /opt/config\n",
312                               "echo ",{get_input: vdns_private_ip_1}," > /opt/config/oam_ipaddr.txt\n",
313                               "echo ",{get_input: vdhcp_private_ip_0}," > /opt/config/cpe_signal_ipaddr.txt\n",
314                               "echo ",{get_input: onap_private_net_cidr}," > /opt/config/oam_cidr.txt\n",
315                               "echo ",{get_input: cpe_signal_net_cidr}," > /opt/config/cpe_signal_net_cidr.txt\n",
316                               "echo ",{get_input: repo_url_blob}," > /opt/config/repo_url_blob.txt\n",
317                               "echo ",{get_input: repo_url_artifacts}," > /opt/config/repo_url_artifacts.txt\n",
318                               "echo ",{get_input: demo_artifacts_version}," > /opt/config/demo_artifacts_version.txt\n",
319                               "echo ",{get_input: install_script_version}," > /opt/config/install_script_version.txt\n",
320                               "echo ",{get_input: cloud_env}," > /opt/config/cloud_env.txt\n",
321                               "curl -k ",{get_input: repo_url_blob},"/org.onap.demo/vnfs/vcpe/",{get_input: install_script_version},"/v_dhcp_install.sh -o /opt/v_dhcp_install.sh\n",
322                               "cd /opt\n",
323                               "chmod +x v_dhcp_install.sh\n",
324                               "./v_dhcp_install.sh\n"
325                             ]
326                     }
327       requirements:
328         - key_pair: my_keypair
329         - port: vdhcp_private_0_port
330         - port: vdhcp_private_1_port
331
332     # vWEB instantiaion
333     vweb_private_0_port:
334       type: onap.multivim.nodes.Port
335       properties:
336         fixed_ip: { get_input: vweb_private_ip_0 }
337         multivim_config: { get_input: multivim_config }
338       requirements:
339         - network: cpe_public_network
340         - subnet: cpe_public_subnet
341
342     vweb_private_1_port:
343       type: onap.multivim.nodes.Port
344       properties:
345         fixed_ip: { get_input: vweb_private_ip_1 }
346         multivim_config: { get_input: multivim_config }
347       requirements:
348         - network: onap_private_network
349         - subnet: onap_private_subnet
350
351     vweb_0:
352       type: onap.multivim.nodes.Server
353       properties:
354         image: { get_input: vcpe_image_name }
355         flavor: { get_input: vcpe_flavor_name }
356         resource_id: { get_input: vweb_name_0 }
357         management_network_name: onap_private_network
358         multivim_config: { get_input: multivim_config }
359         server:
360           metadata: {vnf_id: { get_input: vnf_id }, vf_module_id: { get_input: vf_module_id }}
361           userdata: { concat: [
362                                "#!/bin/bash\n",
363                                "mkdir /opt/config\n",
364                                "echo ",{get_input: vweb_private_ip_1}," > /opt/config/oam_ipaddr.txt\n",
365                                "echo ",{get_input: vweb_private_ip_0}," > /opt/config/cpe_public_ipaddr.txt\n",
366                                "echo ",{get_input: onap_private_net_cidr}," > /opt/config/oam_cidr.txt\n",
367                                "echo ",{get_input: cpe_public_net_cidr}," > /opt/config/cpe_public_net_cidr.txt\n",
368                                "echo ",{get_input: repo_url_blob}," > /opt/config/repo_url_blob.txt\n",
369                                "echo ",{get_input: repo_url_artifacts}," > /opt/config/repo_url_artifacts.txt\n",
370                                "echo ",{get_input: demo_artifacts_version}," > /opt/config/demo_artifacts_version.txt\n",
371                                "echo ",{get_input: install_script_version}," > /opt/config/install_script_version.txt\n",
372                                "echo ",{get_input: cloud_env}," > /opt/config/cloud_env.txt\n",
373                                "curl -k ",{get_input: repo_url_blob},"/org.onap.demo/vnfs/vcpe/",{get_input: install_script_version},"/v_web_install.sh -o /opt/v_web_install.sh\n",
374                                "cd /opt\n",
375                                "chmod +x v_web_install.sh\n",
376                                "./v_web_install.sh\n"
377                             ]
378                   }
379       requirements:
380         - key_pair: my_keypair
381         - port: vweb_private_0_port
382         - port: vweb_private_1_port
383