fix tosca template bugs
[modeling/etsicatalog.git] / catalog / pub / utils / toscaparser / testdata / vnf / vcpesriov / infra / Definitions / MainServiceTemplate.yaml
1 tosca_definitions_version: tosca_simple_yaml_1_0
2 metadata:
3   template_name: vCPE_infra
4   template_version: "1.0"
5   template_author: onap
6 description: vCPE_infra
7
8 imports:
9   - onap_dm.yaml
10
11 topology_template:
12
13   inputs:
14     vcpe_image_name:
15       type: string
16       description: image name for vcpe in openstack glance
17       default: ubuntu_16.04
18     public_net_id:
19       type: string
20       description: public network id used during onap installation
21       default: external
22     onap_private_net_id:
23       type: string
24       description: onap OAM network id
25       default: oam_onap
26     onap_private_net_cidr:
27       type: string
28       description: oanp OAM network cidr
29       default: 10.0.0.0/16
30     mr_ip_addr:
31       type: string
32       description: message router ip that for vDHCP configuration 
33       default: 10.0.11.1
34     mr_ip_port:
35       type: integer
36       # label: Message Router Port
37       description: IP port of the Message Router that for vDHCP configuration
38       default: 80
39     dcae_collector_ip:
40       type: string
41       description: dcae collector ip
42       default: 10.0.4.102
43     dcae_collector_port:
44       type: integer
45       description: dcae collector port
46       default: 8080
47     nexus_artifact_repo:
48       type: string
49       description: Root URL for the Nexus repository for Maven artifacts
50       default: https://nexus.onap.org
51     demo_artifacts_version:
52       type: string
53       description: artifacts version used in demo vnfs
54       default: 1.2.0
55     install_script_version:
56       type: string
57       description: install script version number
58       default: 1.2.0-SNAPSHOT
59     cloud_env:
60       type: string
61       description: cloud environment(openstack or rackspace)
62       default: openstack
63     pub_key:
64       type: string
65       description: ssh public key
66       default: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGx6SKrAuCz1V8KGevZueksLdWoPWJP6z3r29Z7TmPVEOjM+7PIPeSs2BVRx3rnHZBAlasMrZ+fJBS25ts9vfC+ItezQah/hr9vrkmwxCR54Lb84poW+sToPeF6i5eZY7W+jWJfLaFSFx9d2vp4zes/fOlT3NvYCXbn/3QdryQoGl7VFI8oemZypVcikZXElJeeKgAVdSwnrzuqtO/tmbXcAeSbYvVjki8ywYcsWMVMYWUWhh+1BAB6kXnTsIWqzrq0Pfvy+81WDwtiqsqmd93HY8hE0scBrXFBZzQS/AYfIFBlEuFNdLczchntjbZ0n7dmDXk8zHtCZYNk7kwb8k/
67     cpe_signal_net_id:
68       type: string
69       description: cpe signal net name
70       default: zdfw1cpe01_private
71     cpe_signal_net_cidr:
72       type: string
73       description: cpe signal net cidr
74       default: 10.4.0.0/24
75     cpe_public_net_id:
76       type: string
77       description: cpe public net name
78       default: zdfw1cpe01_public
79     cpe_public_net_cidr:
80       type: string
81       description: cpe public net cidr
82       default: 10.2.0.0/24
83     vdhcp_name_0:
84       type: string
85       description: vdu vdhcp_0 name
86       default: zdcpe1cpe01dhcp01
87     vdhcp_private_ip_0:
88       type: string
89       description: ip of vdhcp port to cpe signal net
90       default: 10.4.0.1
91     vdhcp_private_ip_1:
92       type: string
93       description: ip of vdhcp port to onap oam net
94       default: 10.0.101.1
95     vaaa_name_0:
96       type: string
97       description: vdu vaaa_0 name
98       default: zdcpe1cpe01aaa01
99     vaaa_private_ip_0:
100       type: string
101       description: ip of vaaa port to cpe signal net
102       default: 10.4.0.4
103     vaaa_private_ip_1:
104       type: string
105       description: ip of vaaa port to onap oam net
106       default: 10.0.101.2
107     vdns_name_0:
108       type: string
109       description: vdu vdns_0 name
110       default: zdcpe1cpe01dns01
111     vdns_private_ip_0:
112       type: string
113       description: ip of vdns port to cpe public net
114       default: 10.2.0.1
115     vdns_private_ip_1:
116       type: string
117       description: ip of vdns port to onap oam net
118       default: 10.0.101.3
119     vweb_name_0:
120       type: string
121       description: vdu vweb_0 name
122       default: zdcpe1cpe01web01
123     vweb_private_ip_0:
124       type: string
125       description: ip of vweb port to cpe public net
126       default: 10.2.0.10
127     vweb_private_ip_1:
128       type: string
129       description: ip of vweb port to onap oam net
130       default: 10.0.101.40
131     vnf_id:
132       type: string
133       description: The VNF ID is provided by ONAP
134       default: vCPE_Infrastructure_demo_app
135     vf_module_id:
136       type: string
137       description: The vCPE Module ID is provided by ONAP
138       default: vCPE_Intrastructure
139
140   substitution_mappings:
141     node_type: tosca.nodes.nfv.VNF
142     properties:
143       descriptor_id: b1bb0ce7-1111-4fa7-95ed-4840d70a1177
144       provider: onap
145       product_name: vcpe_infra
146       software_version: '1.0'
147       descriptor_version: '1.0'
148       flavour_id: simple
149       flavour_description: simple
150       vnfm_info: [ 'gvnfm' ]
151
152     requirements:
153       - virtual_link: [ Cp_vaaa_public, virtual_link ] # expose as external CP
154       - virtual_link: [ Cp_vaaa_onap_private, virtual_link ] # expose as external CP
155       - virtual_link: [ Cp_vdns_public, virtual_link ]
156       - virtual_link: [ Cp_vdns_onap_private, virtual_link ]
157       - virtual_link: [ Cp_vdhcp_public, virtual_link ]
158       - virtual_link: [ Cp_vdhcp_onap_private, virtual_link ]
159       - virtual_link: [ Cp_vweb_public, virtual_link ]
160       - virtual_link: [ Cp_vweb_onap_private, virtual_link ]
161
162   node_templates:
163     #onap public net
164 #    VL_public:
165 #      type: tosca.nodes.nfv.VnfVirtualLink
166 #      properties:
167 #        connectivity_type:
168 #          layer_protocol: ipv4
169 #        vl_profile:
170 #          max_bit_rate_requirements:
171 #            root: 10000000
172 #            leaf: 10000000
173 #          min_bit_rate_requirements:
174 #            root: 10000000
175 #            leaf: 10000000
176 #          networkName: { get_input: public_net_id }
177 #
178 #    #onap oam net
179 #    VL_onap_private:
180 #      type: tosca.nodes.nfv.VnfVirtualLink
181 #      properties:
182 #        connectivity_type:
183 #          layer_protocol: ipv4
184 #        vl_profile:
185 #          max_bit_rate_requirements:
186 #            root: 10000000
187 #            leaf: 10000000
188 #          min_bit_rate_requirements:
189 #            root: 10000000
190 #            leaf: 10000000
191 #          networkName: { get_input: onap_private_net_id }
192 #          cidr: { get_input: onap_private_net_cidr }
193
194     #cpe signal network
195     VL_cpe_signal:
196       type: tosca.nodes.nfv.VnfVirtualLink
197       properties:
198         connectivity_type:
199           layer_protocol: ipv4
200         vl_profile:
201           max_bit_rate_requirements:
202             root: 10000000
203             leaf: 10000000
204           min_bit_rate_requirements:
205             root: 10000000
206             leaf: 10000000
207           networkName: { get_input: cpe_signal_net_id}
208           cidr: { get_input: cpe_signal_net_cidr }
209           dhcpEnabled: false
210
211     #cpe public network
212     VL_cpe_public:
213       type: tosca.nodes.nfv.VnfVirtualLink
214       properties:
215         connectivity_type:
216           layer_protocol: ipv4
217         vl_profile:
218           max_bit_rate_requirements:
219             root: 10000000
220             leaf: 10000000
221           min_bit_rate_requirements:
222             root: 10000000
223             leaf: 10000000
224           networkName: { get_input: cpe_public_net_id}
225           cidr: { get_input: cpe_public_net_cidr }
226           dhcpEnabled: false
227
228     # vaaa related
229     Cp_vaaa_public:
230       type: tosca.nodes.nfv.VduCp
231       properties:
232         layer_protocol: [ipv4]
233         trunk_mode: false
234         protocol_data:
235           - asscociated_layer_protocol: ipv4
236             address_data:
237               address_type: ip_address
238               l3_address_data:
239                 ip_address_assignment: false
240                 floating_ip_activated: false
241       requirements:
242         - virtual_binding: VDU_vaaa_0
243 #        - virtual_link: VL_public
244
245     Cp_vaaa_onap_private:
246       type: tosca.nodes.nfv.VduCp
247       properties:
248         layer_protocol: [ipv4]
249         trunk_mode: false
250         protocol_data:
251           - asscociated_layer_protocol: ipv4
252             address_data:
253               address_type: ip_address
254               l3_address_data:
255                 ip_address_assignment: false
256                 floating_ip_activated: false
257                 fixed_ip_address:
258                   - { get_input: vaaa_private_ip_1 }
259       requirements:
260         - virtual_binding: VDU_vaaa_0
261 #        - virtual_link: VL_onap_private
262
263     Cp_vaaa_cpe_signal:
264       type: tosca.nodes.nfv.VduCp
265       properties:
266         layer_protocol: [ipv4]
267         trunk_mode: false
268         protocol_data:
269           - asscociated_layer_protocol: ipv4
270             address_data:
271               address_type: ip_address
272               l3_address_data:
273                 ip_address_assignment: false
274                 floating_ip_activated: false
275                 fixed_ip_address:
276                   - { get_input: vaaa_private_ip_0 }
277       requirements:
278         - virtual_binding: VDU_vaaa_0
279         - virtual_link: VL_cpe_signal
280
281     VirtualStorage_root_all:
282       # this indicate the VDU root storage size
283       type: tosca.nodes.nfv.Vdu.VirtualStorage
284       properties:
285         type_of_storage: root
286         size_of_storage: 40 GB
287
288     VDU_vaaa_0:
289       type: tosca.nodes.nfv.Vdu.Compute
290       properties:
291         name: { get_input: vaaa_name_0 }
292         description: vaaa
293         configurable_properties:
294           additional_vnfc_configurable_properties: {}
295         vdu_profile:
296           min_number_of_instances: 1
297           max_number_of_instances: 1
298           watchdog: none
299         inject_files: #TODO SDC Bug
300           source_path: ../Artifacts/keys/authorized_keys #SSH authorized_keys
301           dest_path: /home/ubuntu/.ssh/authorized_keys
302         meta_data:
303           vnf_id: { get_input: vnf_id }
304           vf_module_id: { get_input: vf_module_id }
305           dcae_collector_ip: { get_input: dcae_collector_ip }
306           dcae_collector_port: { get_input: dcae_collector_port }
307           cpe_signal_net_ipaddr: { get_input: vaaa_private_ip_0 }
308           oam_ipaddr: { get_input: vaaa_private_ip_1 }
309           oam_cidr: { get_input: onap_private_net_cidr }
310           cpe_signal_net_cidr: { get_input: cpe_signal_net_cidr }
311           demo_artifacts_version: { get_input: demo_artifacts_version }
312           install_script_version: { get_input: install_script_version }
313           cloud_env: { get_input: cloud_env }
314           nexus_artifact_repo: { get_input: nexus_artifact_repo }
315         user_data: |
316           #!/bin/bash
317           METADATA=`curl -s http://169.254.169.254/openstack/2012-08-10/meta_data.json`
318           apt-get -y install jq
319
320           get_metadata () {
321             echo $METADATA | jq -r ".meta.$1"
322           }
323
324           # Create configuration files
325           mkdir /opt/config
326           echo "$(get_metadata dcae_collector_ip)" > /opt/config/dcae_collector_ip.txt
327           echo "$(get_metadata dcae_collector_port)" > /opt/config/dcae_collector_port.txt
328           echo "$(get_metadata cpe_signal_net_ipaddr)" > /opt/config/cpe_signal_net_ipaddr.txt
329           echo "$(get_metadata oam_ipaddr)" > /opt/config/oam_ipaddr.txt
330           echo "$(get_metadata oam_cidr)" > /opt/config/oam_cidr.txt
331           echo "$(get_metadata cpe_signal_net_cidr)" > /opt/config/cpe_signal_net_cidr.txt
332           echo "$(get_metadata demo_artifacts_version)" > /opt/config/demo_artifacts_version.txt
333           echo "$(get_metadata install_script_version)" > /opt/config/install_script_version.txt
334           echo "$(get_metadata cloud_env)" > /opt/config/cloud_env.txt
335           echo "$(get_metadata nexus_artifact_repo)" > /opt/config/nexus_artifact_repo.txt
336
337           # Download and run install script
338           apt-get -y install unzip
339           INSTALL_SCRIPT_VERSION=$(get_metadata install_script_version)
340           NEXUS_ARTIFACT_REPO=$(get_metadata nexus_artifact_repo)
341           if [[ "${INSTALL_SCRIPT_VERSION}" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi
342           curl -k -L "${NEXUS_ARTIFACT_REPO}/service/local/artifact/maven/redirect?r=${REPO}&g=org.onap.demo.vnf.vcpe&a=vcpe-scripts&e=zip&v=${INSTALL_SCRIPT_VERSION}" -o /opt/vcpe-scripts-${INSTALL_SCRIPT_VERSION}.zip
343           unzip -j /opt/vcpe-scripts-${INSTALL_SCRIPT_VERSION}.zip -d /opt v_aaa_install.sh
344           cd /opt
345           chmod +x v_aaa_install.sh
346           ./v_aaa_install.sh
347       capabilities:
348         virtual_compute:
349           properties:
350             #TODO add local disk size
351             virtual_memory:
352               virtual_mem_size: 4096 MB
353             virtual_cpu:
354               num_virtual_cpu: 2
355       requirements:
356         - virtual_storage: VirtualStorage_root_all
357       artifacts:
358         sw_image: #TODO need to put glance image name here
359           #file: { get_input: vcpe_image_name }
360           file: ../Artifacts/images/ubuntu_16.04
361           type: tosca.artifacts.nfv.SwImage
362
363     # vdns related
364     Cp_vdns_public:
365       type: tosca.nodes.nfv.VduCp
366       properties:
367         layer_protocol: [ipv4]
368         trunk_mode: false
369         protocol_data:
370           - asscociated_layer_protocol: ipv4
371             address_data:
372               address_type: ip_address
373               l3_address_data:
374                 ip_address_assignment: false
375                 floating_ip_activated: false
376       requirements:
377         - virtual_binding: VDU_vdns_0
378 #        - virtual_link: VL_public
379
380     Cp_vdns_onap_private:
381       type: tosca.nodes.nfv.VduCp
382       properties:
383         layer_protocol: [ipv4]
384         trunk_mode: false
385         protocol_data:
386           - asscociated_layer_protocol: ipv4
387             address_data:
388               address_type: ip_address
389               l3_address_data:
390                 ip_address_assignment: false
391                 floating_ip_activated: false
392                 fixed_ip_address:
393                   - { get_input: vdns_private_ip_1 }
394       requirements:
395         - virtual_binding: VDU_vdns_0
396         #- virtual_link: VL_onap_private
397
398     Cp_vdns_cpe_public:
399       type: tosca.nodes.nfv.VduCp
400       properties:
401         layer_protocol: [ipv4]
402         trunk_mode: false
403         protocol_data:
404           - asscociated_layer_protocol: ipv4
405             address_data:
406               address_type: ip_address
407               l3_address_data:
408                 ip_address_assignment: false
409                 floating_ip_activated: false
410                 fixed_ip_address:
411                   - { get_input: vdns_private_ip_0 }
412       requirements:
413         - virtual_binding: VDU_vdns_0
414         - virtual_link: VL_cpe_public
415
416     VDU_vdns_0:
417       type: tosca.nodes.nfv.Vdu.Compute
418       properties:
419         name: { get_input: vdns_name_0 }
420         description: vdns
421         configurable_properties:
422           additional_vnfc_configurable_properties: {}
423         vdu_profile:
424           min_number_of_instances: 1
425           max_number_of_instances: 1
426           watchdog: none
427         inject_files: # TODO SDC Bug
428           source_path: ../Artifacts/keys/authorized_keys #SSH authorized_keys
429           dest_path: /home/ubuntu/.ssh/authorized_keys
430         meta_data:
431           vnf_id: { get_input: vnf_id }
432           vf_module_id: { get_input: vf_module_id }
433           oam_ipaddr: { get_input: vdns_private_ip_1 }
434           cpe_public_net_ipaddr: { get_input: vdns_private_ip_0 }
435           oam_cidr: { get_input: onap_private_net_cidr }
436           cpe_public_net_cidr: { get_input: cpe_public_net_cidr }
437           demo_artifacts_version: { get_input: demo_artifacts_version }
438           install_script_version: { get_input: install_script_version }
439           cloud_env: { get_input: cloud_env }
440           nexus_artifact_repo: { get_input: nexus_artifact_repo }
441         user_data: |
442           #!/bin/bash
443           METADATA=`curl -s http://169.254.169.254/openstack/2012-08-10/meta_data.json`
444           apt-get -y install jq
445
446           get_metadata () {
447             echo $METADATA | jq -r ".meta.$1"
448           }
449
450           # Create configuration files
451           mkdir /opt/config
452           echo "$(get_metadata oam_ipaddr)" > /opt/config/oam_ipaddr.txt
453           echo "$(get_metadata cpe_public_net_ipaddr)" > /opt/config/cpe_public_net_ipaddr.txt
454           echo "$(get_metadata onap_cidr)" > /opt/config/oam_cidr.txt
455           echo "$(get_metadata cpe_public_net_cidr)" > /opt/config/cpe_public_net_cidr.txt
456           echo "$(get_metadata demo_artifacts_version)" > /opt/config/demo_artifacts_version.txt
457           echo "$(get_metadata install_script_version)" > /opt/config/install_script_version.txt
458           echo "$(get_metadata cloud_env)" > /opt/config/cloud_env.txt
459           echo "$(get_metadata nexus_artifact_repo)" > /opt/config/nexus_artifact_repo.txt
460
461           # Download and run install script
462           apt-get -y install unzip
463           INSTALL_SCRIPT_VERSION=$(get_metadata install_script_version)
464           NEXUS_ARTIFACT_REPO=$(get_metadata nexus_artifact_repo)
465           if [[ "${INSTALL_SCRIPT_VERSION}" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi
466           curl -k -L "${NEXUS_ARTIFACT_REPO}/service/local/artifact/maven/redirect?r=${REPO}&g=org.onap.demo.vnf.vcpe&a=vcpe-scripts&e=zip&v=${INSTALL_SCRIPT_VERSION}" -o /opt/vcpe-scripts-${INSTALL_SCRIPT_VERSION}.zip
467           unzip -j /opt/vcpe-scripts-${INSTALL_SCRIPT_VERSION}.zip -d /opt v_dns_install.sh
468           cd /opt
469           chmod +x v_dns_install.sh
470           ./v_dns_install.sh
471       capabilities:
472         virtual_compute:
473           properties:
474             #TODO add local disk size
475             virtual_memory:
476               virtual_mem_size: 4096 MB
477             virtual_cpu:
478               num_virtual_cpu: 2
479       requirements:
480         - virtual_storage: VirtualStorage_root_all
481       artifacts:
482         sw_image: #TODO need to put glance image name here
483           #file: { get_input: vcpe_image_name }
484           file: ../Artifacts/images/ubuntu_16.04
485           type: tosca.artifacts.nfv.SwImage
486
487     # vdhcp related
488     Cp_vdhcp_public:
489       type: tosca.nodes.nfv.VduCp
490       properties:
491         layer_protocol: [ipv4]
492         trunk_mode: false
493         protocol_data:
494           - asscociated_layer_protocol: ipv4
495             address_data:
496               address_type: ip_address
497               l3_address_data:
498                 ip_address_assignment: false
499                 floating_ip_activated: false
500       requirements:
501         - virtual_binding: VDU_vdhcp_0
502 #        - virtual_link: VL_public
503
504     Cp_vdhcp_onap_private:
505       type: tosca.nodes.nfv.VduCp
506       properties:
507         layer_protocol: [ipv4]
508         trunk_mode: false
509         protocol_data:
510           - asscociated_layer_protocol: ipv4
511             address_data:
512               address_type: ip_address
513               l3_address_data:
514                 ip_address_assignment: false
515                 floating_ip_activated: false
516                 fixed_ip_address:
517                   - { get_input: vdhcp_private_ip_1 }
518       requirements:
519         - virtual_binding: VDU_vdhcp_0
520 #        - virtual_link: VL_onap_private
521
522     Cp_vdhcp_cpe_signal:
523       type: tosca.nodes.nfv.VduCp
524       properties:
525         layer_protocol: [ipv4]
526         trunk_mode: false
527         protocol_data:
528           - asscociated_layer_protocol: ipv4
529             address_data:
530               address_type: ip_address
531               l3_address_data:
532                 ip_address_assignment: false
533                 floating_ip_activated: false
534                 fixed_ip_address:
535                   - { get_input: vdhcp_private_ip_0 }
536       requirements:
537         - virtual_binding: VDU_vdhcp_0
538         - virtual_link: VL_cpe_signal
539
540     VDU_vdhcp_0:
541       type: tosca.nodes.nfv.Vdu.Compute
542       properties:
543         name: { get_input: vdhcp_name_0 }
544         description: vdhcp
545         configurable_properties:
546           additional_vnfc_configurable_properties: {}
547         vdu_profile:
548           min_number_of_instances: 1
549           max_number_of_instances: 1
550           watchdog: none
551         inject_files: #SDC Bug
552           source_path: ../Artifacts/keys/authorized_keys #SSH authorized_keys
553           dest_path: /home/ubuntu/.ssh/authorized_keys
554         meta_data:
555           vnf_id: { get_input: vnf_id }
556           vf_module_id: { get_input: vf_module_id }
557           oam_ipaddr: { get_input: vdhcp_private_ip_1 }
558           cpe_signal_ipaddr: { get_input: vdhcp_private_ip_0 }
559           oam_cidr: { get_input: onap_private_net_cidr }
560           cpe_signal_net_cidr: { get_input: cpe_signal_net_cidr }
561           mr_ip_addr: { get_input: mr_ip_addr }
562           mr_ip_port: { get_input: mr_ip_port }
563           demo_artifacts_version: { get_input: demo_artifacts_version }
564           install_script_version: { get_input: install_script_version }
565           cloud_env: { get_input: cloud_env }
566           nexus_artifact_repo: { get_input: nexus_artifact_repo }
567         user_data: |
568           #!/bin/bash
569           METADATA=`curl -s http://169.254.169.254/openstack/2012-08-10/meta_data.json`
570           apt-get -y install jq
571
572           get_metadata () {
573             echo $METADATA | jq -r ".meta.$1"
574           }
575
576           # Create configuration files
577           mkdir /opt/config
578           echo "$(get_metadata oam_ipaddr)" > /opt/config/oam_ipaddr.txt
579           echo "$(get_metadata cpe_signal_ipaddr)" > /opt/config/cpe_signal_ipaddr.txt
580           echo "$(get_metadata onap_cidr)" > /opt/config/oam_cidr.txt
581           echo "$(get_metadata cpe_signal_net_cidr)" > /opt/config/cpe_signal_net_cidr.txt
582           echo "$(get_metadata mr_ip_addr)" > /opt/config/mr_ip_addr.txt
583           echo "$(get_metadata mr_ip_port)" > /opt/config/mr_ip_port.txt
584           echo "$(get_metadata demo_artifacts_version)" > /opt/config/demo_artifacts_version.txt
585           echo "$(get_metadata install_script_version)" > /opt/config/install_script_version.txt
586           echo "$(get_metadata cloud_env)" > /opt/config/cloud_env.txt
587           echo "$(get_metadata nexus_artifact_repo)" > /opt/config/nexus_artifact_repo.txt
588
589           # Download and run install script
590           apt-get -y install unzip
591           INSTALL_SCRIPT_VERSION=$(get_metadata install_script_version)
592           NEXUS_ARTIFACT_REPO=$(get_metadata nexus_artifact_repo)
593           if [[ "${INSTALL_SCRIPT_VERSION}" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi
594           curl -k -L "${NEXUS_ARTIFACT_REPO}/service/local/artifact/maven/redirect?r=${REPO}&g=org.onap.demo.vnf.vcpe&a=vcpe-scripts&e=zip&v=${INSTALL_SCRIPT_VERSION}" -o /opt/vcpe-scripts-${INSTALL_SCRIPT_VERSION}.zip
595           unzip -j /opt/vcpe-scripts-${INSTALL_SCRIPT_VERSION}.zip -d /opt v_dhcp_install.sh
596           cd /opt
597           chmod +x v_dhcp_install.sh
598           ./v_dhcp_install.sh
599       capabilities:
600         virtual_compute:
601           properties:
602             #TODO add local disk size
603             virtual_memory:
604               virtual_mem_size: 4096 MB
605             virtual_cpu:
606               num_virtual_cpu: 2
607       requirements:
608         - virtual_storage: VirtualStorage_root_all
609       artifacts:
610         sw_image: #TODO need to put glance image name here
611           #file: { get_input: vcpe_image_name }
612           file: ../Artifacts/images/ubuntu_16.04
613           type: tosca.artifacts.nfv.SwImage
614
615     # vweb related
616     Cp_vweb_public:
617       type: tosca.nodes.nfv.VduCp
618       properties:
619         layer_protocol: [ipv4]
620         trunk_mode: false
621         protocol_data:
622           - asscociated_layer_protocol: ipv4
623             address_data:
624               address_type: ip_address
625               l3_address_data:
626                 ip_address_assignment: false
627                 floating_ip_activated: false
628       requirements:
629         - virtual_binding: VDU_vweb_0
630 #        - virtual_link: VL_public
631
632     Cp_vweb_onap_private:
633       type: tosca.nodes.nfv.VduCp
634       properties:
635         layer_protocol: [ipv4]
636         trunk_mode: false
637         protocol_data:
638           - asscociated_layer_protocol: ipv4
639             address_data:
640               address_type: ip_address
641               l3_address_data:
642                 ip_address_assignment: false
643                 floating_ip_activated: false
644                 fixed_ip_address:
645                   - { get_input: vweb_private_ip_1 }
646       requirements:
647         - virtual_binding: VDU_vweb_0
648 #        - virtual_link: VL_onap_private
649
650     Cp_vweb_cpe_public:
651       type: tosca.nodes.nfv.VduCp
652       properties:
653         layer_protocol: [ipv4]
654         trunk_mode: false
655         protocol_data:
656           - asscociated_layer_protocol: ipv4
657             address_data:
658               address_type: ip_address
659               l3_address_data:
660                 ip_address_assignment: false
661                 floating_ip_activated: false
662                 fixed_ip_address:
663                   - { get_input: vweb_private_ip_0 }
664       requirements:
665         - virtual_binding: VDU_vweb_0
666         - virtual_link: VL_cpe_public
667
668     VDU_vweb_0:
669       type: tosca.nodes.nfv.Vdu.Compute
670       properties:
671         name: { get_input: vweb_name_0 }
672         description: vweb
673         configurable_properties:
674           additional_vnfc_configurable_properties: {}
675         vdu_profile:
676           min_number_of_instances: 1
677           max_number_of_instances: 1
678           watchdog: none
679         inject_files: # TODO SDC bug
680           source_path: ../Artifacts/keys/authorized_keys #SSH authorized_keys
681           dest_path: /home/ubuntu/.ssh/authorized_keys
682         meta_data:
683           vnf_id: { get_input: vnf_id }
684           vf_module_id: { get_input: vf_module_id }
685           oam_ipaddr: { get_input: vweb_private_ip_1 }
686           cpe_public_ipaddr: { get_input: vweb_private_ip_0 }
687           oam_cidr: { get_input: onap_private_net_cidr }
688           cpe_public_net_cidr: { get_input: cpe_public_net_cidr }
689           demo_artifacts_version: { get_input: demo_artifacts_version }
690           install_script_version: { get_input: install_script_version }
691           cloud_env: { get_input: cloud_env }
692           nexus_artifact_repo: { get_input: nexus_artifact_repo }
693         user_data: |
694           #!/bin/bash
695           METADATA=`curl -s http://169.254.169.254/openstack/2012-08-10/meta_data.json`
696           apt-get -y install jq
697
698           get_metadata () {
699             echo $METADATA | jq -r ".meta.$1"
700           }
701
702           # Create configuration files
703           mkdir /opt/config
704           echo "$(get_metadata oam_ipaddr)" > /opt/config/oam_ipaddr.txt
705           echo "$(get_metadata cpe_public_ipaddr)" > /opt/config/cpe_public_ipaddr.txt
706           echo "$(get_metadata onap_cidr)" > /opt/config/oam_cidr.txt
707           echo "$(get_metadata cpe_public_net_cidr)" > /opt/config/cpe_public_net_cidr.txt
708           echo "$(get_metadata demo_artifacts_version)" > /opt/config/demo_artifacts_version.txt
709           echo "$(get_metadata install_script_version)" > /opt/config/install_script_version.txt
710           echo "$(get_metadata cloud_env)" > /opt/config/cloud_env.txt
711           echo "$(get_metadata nexus_artifact_repo)" > /opt/config/nexus_artifact_repo.txt
712
713           # Download and run install script
714           apt-get -y install unzip
715           INSTALL_SCRIPT_VERSION=$(get_metadata install_script_version)
716           NEXUS_ARTIFACT_REPO=$(get_metadata nexus_artifact_repo)
717           if [[ "${INSTALL_SCRIPT_VERSION}" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi
718           curl -k -L "${NEXUS_ARTIFACT_REPO}/service/local/artifact/maven/redirect?r=${REPO}&g=org.onap.demo.vnf.vcpe&a=vcpe-scripts&e=zip&v=${INSTALL_SCRIPT_VERSION}" -o /opt/vcpe-scripts-${INSTALL_SCRIPT_VERSION}.zip
719           unzip -j /opt/vcpe-scripts-${INSTALL_SCRIPT_VERSION}.zip -d /opt v_web_install.sh
720           cd /opt
721           chmod +x v_web_install.sh
722           ./v_web_install.sh
723       capabilities:
724         virtual_compute:
725           properties:
726             #TODO add local disk size
727             virtual_memory:
728               virtual_mem_size: 4096 MB
729             virtual_cpu:
730               num_virtual_cpu: 2
731       requirements:
732         - virtual_storage: VirtualStorage_root_all
733       artifacts:
734         sw_image: #TODO need to put glance image name here
735           #file: { get_input: vcpe_image_name }
736           file: ../Artifacts/images/ubuntu_16.04
737           type: tosca.artifacts.nfv.SwImage
738