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