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