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