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