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