vCPE tosca: Add metadata VNFD_SCHEMA_VERSION
[demo.git] / tosca / vCPE / vbng / MainServiceTemplate.yaml
1 tosca_definitions_version: tosca_simple_yaml_1_0
2 metadata:
3   template_name: vCPE_vbng
4   template_version: "1.0"
5   template_author: onap
6   VNFD_SCHEMA_VERSION: "2.5.1+1"
7 description: vCPE_vbng
8
9 imports:
10   - onap_dm.yaml
11
12 topology_template:
13 #  substitution_mappings:
14 #    node_type: onap.vcpe_vbng
15 #    requirements:
16 #      virtual_link: [ Cp_vbng_public, virtual_link ] # expose as external CP
17 #      virtual_link: [ Cp_vbng_onap_private, virtual_link ] # expose as external CP
18
19   inputs:
20     vcpe_image_name:
21       type: string
22       description: image name for vcpe in openstack glance
23       default: ubuntu_16.04
24     public_net_id:
25       type: string
26       description: public network id used during onap installation
27       default: external
28     onap_private_net_id:
29       type: string
30       description: onap OAM network id
31       default: oam_onap
32     onap_private_net_cidr:
33       type: string
34       description: oanp OAM network cidr
35       default: 10.0.0.0/16
36     brgemu_bng_private_net_id:
37       type: string
38       description: Private network that connects vBRG to vBNG
39       default: zdfw1bngin01_private
40     brgemu_bng_private_net_cidr:
41       type: string
42       description: The CIDR of the input side of vBNG private network
43       default: 10.3.0.0/24
44     bng_gmux_private_net_id:
45       type: string
46       description: Private network that connects vBNG to vGMUX
47       default: zdfw1bngmux01_private
48     bng_gmux_private_net_cidr:
49       type: string
50       description: The CIDR of the input side of vGMUX private network
51       default: 10.1.0.0/24
52     cpe_signal_net_id:
53       type: string
54       description: Private network that connects vCPE elements with vCPE infrastructure elements
55       default: zdfw1cpe01_private
56     cpe_signal_private_net_cidr:
57       type: string
58       description: The CIDR of the vAAA private network
59       default: 10.4.0.0/24
60     vbng_private_ip_0:
61       type: string
62       description: Private IP address that is assigned to the vBNG IN
63       default: 10.3.0.1
64     vbng_private_ip_1:
65       type: string
66       description: Private IP address that is assigned to the vBNG to communicate with ONAP components
67       default: 10.0.101.10
68     vbng_private_ip_2:
69       type: string
70       description: Private IP address that is assigned to the vBNG in the CPE_SIGNAL network
71       default: 10.4.0.3
72     vbng_private_ip_3:
73       type: string
74       description: Private IP address that is assigned to the vBNG to vGMUX port
75       default: 10.1.0.10
76     vbng_name_0:
77       type: string
78       description: Name of the vBNG
79       default: zdcpe1cpe01bng01
80     vnf_id:
81       type: string
82       description: The VNF ID is provided by ONAP
83       default: vCPE_Infrastructure_Metro_vBNG_demo_app
84     vf_module_id:
85       type: string
86       description: The vCPE Module ID is provided by ONAP
87       default: vCPE_Intrastructure_Metro_vBNG
88     dcae_collector_ip:
89       type: string
90       description: dcae collector ip
91       default: 10.0.4.102
92     dcae_collector_port:
93       type: string
94       description: dcae collector port
95       default: "8080"
96     pub_key:
97       type: string
98       description: ssh public key
99       default: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGx6SKrAuCz1V8KGevZueksLdWoPWJP6z3r29Z7TmPVEOjM+7PIPeSs2BVRx3rnHZBAlasMrZ+fJBS25ts9vfC+ItezQah/hr9vrkmwxCR54Lb84poW+sToPeF6i5eZY7W+jWJfLaFSFx9d2vp4zes/fOlT3NvYCXbn/3QdryQoGl7VFI8oemZypVcikZXElJeeKgAVdSwnrzuqtO/tmbXcAeSbYvVjki8ywYcsWMVMYWUWhh+1BAB6kXnTsIWqzrq0Pfvy+81WDwtiqsqmd93HY8hE0scBrXFBZzQS/AYfIFBlEuFNdLczchntjbZ0n7dmDXk8zHtCZYNk7kwb8k/
100     nexus_artifact_repo:
101       type: string
102       description: Root URL for the Nexus repository for Maven artifacts
103       default: https://nexus.onap.org
104     demo_artifacts_version:
105       type: string
106       description: artifacts version used in demo vnfs
107       default: 1.2.0
108     install_script_version:
109       type: string
110       description: install script version number
111       default: 1.2.0-SNAPSHOT
112     cloud_env:
113       type: string
114       description: cloud environment(openstack or rackspace)
115       default: openstack
116     sdnc_ip_addr:
117       type: string
118       description: IP address of the SDNC
119       default: 10.0.7.1
120
121   node_templates:
122     LLU_VNF:
123       type: tosca.nodes.nfv.VNF
124       properties:
125         descriptor_id: b1bb0ce7-2222-4fa7-95ed-4840d70a1177
126         provider: onap
127         product_name: vcpe_vbng
128         software_version: '1.0'
129         descriptor_version: '1.0'
130         flavour_id: simple
131         flavour_description: simple
132         vnfm_info: ['gvnfm']
133
134
135     #onap public net
136 #    VL_public:
137 #      type: tosca.nodes.nfv.VnfVirtualLink
138 #      properties:
139 #        connectivity_type:
140 #          layer_protocols: [ipv4]
141 #        vl_profile:
142 #          max_bitrate_requirements:
143 #            root: 10000000
144 #            leaf: 10000000
145 #          min_bitrate_requirements:
146 #            root: 10000000
147 #            leaf: 10000000
148 #          virtual_link_protocol_data:
149 #            - associated_layer_protocol: ipv4
150 #              l3_protocol_data:
151 #                ip_version: ipv4
152 #                name: { get_input: public_net_id }
153 #
154 #    #onap oam net
155 #    VL_onap_private:
156 #      type: tosca.nodes.nfv.VnfVirtualLink
157 #      properties:
158 #        connectivity_type:
159 #          layer_protocols: [ipv4]
160 #        vl_profile:
161 #          max_bitrate_requirements:
162 #            root: 10000000
163 #            leaf: 10000000
164 #          min_bitrate_requirements:
165 #            root: 10000000
166 #            leaf: 10000000
167 #          virtual_link_protocol_data:
168 #            - associated_layer_protocol: ipv4
169 #              l3_protocol_data:
170 #                ip_version: ipv4
171 #                name: { get_input: onap_private_net_id }
172 #                cidr: { get_input: onap_private_net_cidr }
173
174     #Private network that connects vBRG to vBNG
175     VL_brgemu_bng_private_net:
176       type: tosca.nodes.nfv.VnfVirtualLink
177       properties:
178         connectivity_type:
179           layer_protocols: [ipv4]
180         vl_profile:
181           max_bitrate_requirements:
182             root: 10000000
183             leaf: 10000000
184           min_bitrate_requirements:
185             root: 10000000
186             leaf: 10000000
187           virtual_link_protocol_data:
188             - associated_layer_protocol: ipv4
189               l3_protocol_data:
190                 ip_version: ipv4
191                 name: { get_input: brgemu_bng_private_net_id}
192                 cidr: { get_input: brgemu_bng_private_net_cidr }
193                 dhcp_enabled: false
194
195     #cpe signal network
196     VL_cpe_signal:
197       type: tosca.nodes.nfv.VnfVirtualLink
198       properties:
199         connectivity_type:
200           layer_protocols: [ipv4]
201         vl_profile:
202           max_bitrate_requirements:
203             root: 10000000
204             leaf: 10000000
205           min_bitrate_requirements:
206             root: 10000000
207             leaf: 10000000
208           virtual_link_protocol_data:
209             - associated_layer_protocol: ipv4
210               l3_protocol_data:
211                 ip_version: ipv4
212                 name: { get_input: cpe_signal_net_id}
213                 cidr: { get_input: cpe_signal_private_net_cidr }
214                 dhcp_enabled: false
215
216     #Private network that connects vBNG to vGMUX
217     VL_bng_gmux_private_net:
218       type: tosca.nodes.nfv.VnfVirtualLink
219       properties:
220         connectivity_type:
221           layer_protocols: [ipv4]
222         vl_profile:
223           max_bitrate_requirements:
224             root: 10000000
225             leaf: 10000000
226           min_bitrate_requirements:
227             root: 10000000
228             leaf: 10000000
229           virtual_link_protocol_data:
230             - associated_layer_protocol: ipv4
231               l3_protocol_data:
232                 ip_version: ipv4
233                 name: { get_input: bng_gmux_private_net_id}
234                 cidr: { get_input: bng_gmux_private_net_cidr }
235                 dhcp_enabled: false
236
237     # vbng related
238     Cp_vbng_public:
239       type: tosca.nodes.nfv.VduCp
240       properties:
241         layer_protocols: [ipv4]
242         trunk_mode: false
243         protocol:
244           - associated_layer_protocol: ipv4
245             address_data:
246               - address_type: ip_address
247                 l3_address_data:
248                   ip_address_assignment: false
249                   floating_ip_activated: false
250       requirements:
251         - virtual_binding: VDU_vbng_0
252         #- virtual_link: VL_public
253
254     Cp_vbng_onap_private:
255       type: tosca.nodes.nfv.VduCp
256       properties:
257         layer_protocols: [ipv4]
258         trunk_mode: false
259         protocol:
260           - associated_layer_protocol: ipv4
261             address_data:
262               - address_type: ip_address
263                 l3_address_data:
264                   ip_address_assignment: false
265                   floating_ip_activated: false
266                   fixed_ip_address:
267                     - { get_input: vbng_private_ip_1 }
268       requirements:
269         - virtual_binding: VDU_vbng_0
270         #- virtual_link: VL_onap_private
271
272     Cp_vbng_brgemu_bng_private_net:
273       type: tosca.nodes.nfv.VduCp
274       properties:
275         layer_protocols: [ipv4]
276         trunk_mode: false
277         protocol:
278           - associated_layer_protocol: ipv4
279             address_data:
280               - address_type: ip_address
281                 l3_address_data:
282                   ip_address_assignment: false
283                   floating_ip_activated: false
284                   fixed_ip_address:
285                     - { get_input: vbng_private_ip_0 }
286         virtual_network_interface_requirements:
287           - name: dpdk support
288             support_mandatory: true
289             network_interface_requirements:
290               dataProcessingAccelerationLibrary: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "DPDK"}'
291       requirements:
292         - virtual_binding: VDU_vbng_0
293         - virtual_link: VL_brgemu_bng_private_net
294
295     Cp_vbng_cpe_signal:
296       type: tosca.nodes.nfv.VduCp
297       properties:
298         layer_protocols: [ipv4]
299         trunk_mode: false
300         protocol:
301           - associated_layer_protocol: ipv4
302             address_data:
303               - address_type: ip_address
304                 l3_address_data:
305                   ip_address_assignment: false
306                   floating_ip_activated: false
307                   fixed_ip_address:
308                     - { get_input: vbng_private_ip_2 }
309       requirements:
310         - virtual_binding: VDU_vbng_0
311         - virtual_link: VL_cpe_signal
312
313     Cp_vbng_bng_gmux_private_net:
314       type: tosca.nodes.nfv.VduCp
315       properties:
316         layer_protocols: [ipv4]
317         trunk_mode: false
318         protocol:
319           - associated_layer_protocol: ipv4
320             address_data:
321               - address_type: ip_address
322                 l3_address_data:
323                   ip_address_assignment: false
324                   floating_ip_activated: false
325                   fixed_ip_address:
326                     - { get_input: vbng_private_ip_3 }
327         virtual_network_interface_requirements:
328           - name: dpdk support
329             support_mandatory: true
330             network_interface_requirements:
331               dataProcessingAccelerationLibrary: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "DPDK"}'
332       requirements:
333         - virtual_binding: VDU_vbng_0
334         - virtual_link: VL_bng_gmux_private_net
335
336     VDU_vbng_0:
337       type: tosca.nodes.nfv.Vdu.Compute
338       properties:
339         name: { get_input: vbng_name_0 }
340         description: vbng
341         vdu_profile:
342           min_number_of_instances: 1
343           max_number_of_instances: 1
344           watchdog: none
345         inject_files: #TODO SDC bug
346           source_path: ../Artifacts/Deployment/OTHER/authorized_keys #SSH authorized_keys
347           dest_path: /home/ubuntu/.ssh/authorized_keys
348         meta_data:
349           vnf_id: { get_input: vnf_id }
350           vf_module_id: { get_input: vf_module_id }
351
352           brgemu_bng_net_ipaddr: { get_input: vbng_private_ip_0 }
353           cpe_signal_net_ipaddr: { get_input: vbng_private_ip_2 }
354           bng_gmux_net_ipaddr: { get_input: vbng_private_ip_3 }
355           oam_ipaddr: { get_input: vbng_private_ip_1 }
356           oam_cidr: { get_input: onap_private_net_cidr }
357           bng_gmux_cidr: { get_input: bng_gmux_private_net_cidr }
358           cpe_signal_cidr: { get_input: cpe_signal_private_net_cidr }
359           brgemu_bng_cidr: { get_input: brgemu_bng_private_net_cidr }
360           dcae_collector_ip: { get_input: dcae_collector_ip }
361           dcae_collector_port: { get_input: dcae_collector_port }
362           demo_artifacts_version: { get_input: demo_artifacts_version }
363           install_script_version: { get_input: install_script_version }
364           sdnc_ip: { get_input: sdnc_ip_addr }
365           cloud_env: { get_input: cloud_env }
366           nexus_artifact_repo: { get_input: nexus_artifact_repo }
367         boot_data: |
368           #!/bin/bash
369           METADATA=`curl -s http://169.254.169.254/openstack/2012-08-10/meta_data.json`
370           apt-get -y install jq
371
372           get_metadata () {
373             echo $METADATA | jq -r ".meta.$1"
374           }
375
376           # Create configuration files
377           mkdir /opt/config
378           echo "$(get_metadata brgemu_bng_net_ipaddr)" > /opt/config/brgemu_bng_net_ipaddr.txt
379           echo "$(get_metadata cpe_signal_net_ipaddr)" > /opt/config/cpe_signal_net_ipaddr.txt
380           echo "$(get_metadata bng_gmux_net_ipaddr)" > /opt/config/bng_gmux_net_ipaddr.txt
381           echo "$(get_metadata oam_ipaddr)" > /opt/config/oam_ipaddr.txt
382           echo "$(get_metadata oam_cidr)" > /opt/config/oam_cidr.txt
383           echo "$(get_metadata bng_gmux_cidr)" > /opt/config/bng_gmux_net_cidr.txt
384           echo "$(get_metadata cpe_signal_cidr)" > /opt/config/cpe_signal_net_cidr.txt
385           echo "$(get_metadata brgemu_bng_cidr)" > /opt/config/brgemu_bng_net_cidr.txt
386           echo "$(get_metadata dcae_collector_ip)" > /opt/config/dcae_collector_ip.txt
387           echo "$(get_metadata dcae_collector_port)" > /opt/config/dcae_collector_port.txt
388           echo "$(get_metadata demo_artifacts_version)" > /opt/config/demo_artifacts_version.txt
389           echo "$(get_metadata install_script_version)" > /opt/config/install_script_version.txt
390           echo "$(get_metadata cloud_env)" > /opt/config/cloud_env.txt
391           echo "$(get_metadata sdnc_ip)" > /opt/config/sdnc_ip.txt
392           echo "$(get_metadata nexus_artifact_repo)" > /opt/config/nexus_artifact_repo.txt
393
394           # Download and run install script
395           apt-get -y install unzip
396           INSTALL_SCRIPT_VERSION=$(get_metadata install_script_version)
397           NEXUS_ARTIFACT_REPO=$(get_metadata nexus_artifact_repo)
398           if [[ "${INSTALL_SCRIPT_VERSION}" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi
399           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
400           unzip -j /opt/vcpe-scripts-${INSTALL_SCRIPT_VERSION}.zip -d /opt v_bng_install.sh
401           cd /opt
402           chmod +x v_bng_install.sh
403           ./v_bng_install.sh
404       capabilities:
405         virtual_compute:
406           properties:
407             virtual_memory:
408               virtual_mem_size: 4096 MB
409               vdu_mem_requirements:
410                 memoryPageSize: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "2 MB"}'
411                 numberOfPages: '{"schemaVersion": "0","schemaSelector": "","hardwarePlatform": "generic","mandatory": "true", "configurationValue": "1024"}'
412             virtual_cpu:
413               num_virtual_cpu: 2
414               cpu_architecture: generic
415             virtual_local_storage:
416               - size_of_storage: 40 GB
417       artifacts:
418         sw_image: #TODO need to put glance image name here
419           #file: { get_input: vcpe_image_name }
420           file: ../Artifacts/Deployment/OTHER/image
421           type: tosca.artifacts.nfv.SwImage