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