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