f04cd98a77a0022e843a9131bffcb9f28f4d0d62
[demo.git] / tosca / vCPE / vbng / MainServiceTemplate_sriov.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 description: vCPE_vbng
7
8 imports:
9   - onap_dm.yaml
10
11 topology_template:
12 #  substitution_mappings:
13 #    node_type: onap.vcpe_vbng
14 #    requirements:
15 #      virtual_link: [ Cp_vbng_public, virtual_link ] # expose as external CP
16 #      virtual_link: [ Cp_vbng_onap_private, virtual_link ] # expose as external CP
17
18   inputs:
19     vcpe_image_name:
20       type: string
21       description: image name for vcpe in openstack glance
22       default: ubuntu_16.04
23     public_net_id:
24       type: string
25       description: public network id used during onap installation
26     onap_private_net_id:
27       type: string
28       description: onap OAM network id
29     onap_private_net_cidr:
30       type: string
31       description: oanp OAM network cidr
32       default: 10.0.0.0/16
33     brgemu_bng_private_net_id:
34       type: string
35       description: Private network that connects vBRG to vBNG
36       default: zdfw1bngin01_private
37     brgemu_bng_private_net_cidr:
38       type: string
39       description: The CIDR of the input side of vBNG private network
40       default: 10.3.0.0/24
41     bng_gmux_private_net_id:
42       type: string
43       description: Private network that connects vBNG to vGMUX
44       default: zdfw1bngmux01_private
45     bng_gmux_private_net_cidr:
46       type: string
47       description: The CIDR of the input side of vGMUX private network
48       default: 10.1.0.0/24
49     cpe_signal_net_id:
50       type: string
51       description: Private network that connects vCPE elements with vCPE infrastructure elements
52       default: zdfw1cpe01_private
53     cpe_signal_private_net_cidr:
54       type: string
55       description: The CIDR of the vAAA private network
56       default: 10.4.0.0/24
57     vbng_private_ip_0:
58       type: string
59       description: Private IP address that is assigned to the vBNG IN
60       default: 10.3.0.1
61     vbng_private_ip_1:
62       type: string
63       description: Private IP address that is assigned to the vBNG to communicate with ONAP components
64       default: 10.0.101.10
65     vbng_private_ip_2:
66       type: string
67       description: Private IP address that is assigned to the vBNG in the CPE_SIGNAL network
68       default: 10.4.0.3
69     vbng_private_ip_3:
70       type: string
71       description: Private IP address that is assigned to the vBNG to vGMUX port
72       default: 10.1.0.10
73     vbng_name_0:
74       type: string
75       description: Name of the vBNG
76       default: zdcpe1cpe01bng01
77     vnf_id:
78       type: string
79       description: The VNF ID is provided by ONAP
80       default: vCPE_Infrastructure_Metro_vBNG_demo_app
81     vf_module_id:
82       type: string
83       description: The vCPE Module ID is provided by ONAP
84       default: vCPE_Intrastructure_Metro_vBNG
85     dcae_collector_ip:
86       type: string
87       description: dcae collector ip
88       default: 10.0.4.102
89     dcae_collector_port:
90       type: string
91       description: dcae collector port
92       default: "8080"
93     pub_key:
94       type: string
95       description: ssh public key
96       default: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGx6SKrAuCz1V8KGevZueksLdWoPWJP6z3r29Z7TmPVEOjM+7PIPeSs2BVRx3rnHZBAlasMrZ+fJBS25ts9vfC+ItezQah/hr9vrkmwxCR54Lb84poW+sToPeF6i5eZY7W+jWJfLaFSFx9d2vp4zes/fOlT3NvYCXbn/3QdryQoGl7VFI8oemZypVcikZXElJeeKgAVdSwnrzuqtO/tmbXcAeSbYvVjki8ywYcsWMVMYWUWhh+1BAB6kXnTsIWqzrq0Pfvy+81WDwtiqsqmd93HY8hE0scBrXFBZzQS/AYfIFBlEuFNdLczchntjbZ0n7dmDXk8zHtCZYNk7kwb8k/
97     nexus_artifact_repo:
98       type: string
99       description: Root URL for the Nexus repository for Maven artifacts
100       default: https://nexus.onap.org
101     demo_artifacts_version:
102       type: string
103       description: artifacts version used in demo vnfs
104       default: 1.2.0
105     install_script_version:
106       type: string
107       description: install script version number
108       default: 1.2.0-SNAPSHOT
109     cloud_env:
110       type: string
111       description: cloud environment(openstack or rackspace)
112       default: openstack
113     sdnc_ip_addr:
114       type: string
115       description: IP address of the SDNC
116       default: 10.0.7.1
117
118   node_templates:
119     LLU_VNF:
120       type: tosca.nodes.nfv.VNF
121       properties:
122         descriptor_id: b1bb0ce7-2222-4fa7-95ed-4840d70a1177
123         provider: onap
124         product_name: vcpe_vbng
125         software_version: '1.0'
126         descriptor_version: '1.0'
127         flavour_id: simple
128         flavour_description: simple
129         vnfm_info: ['gvnfm']
130
131
132     #onap public net
133 #    VL_public:
134 #      type: tosca.nodes.nfv.VnfVirtualLink
135 #      properties:
136 #        connectivity_type:
137 #          layer_protocol: ipv4
138 #        vl_profile:
139 #          max_bit_rate_requirements:
140 #            root: 10000000
141 #            leaf: 10000000
142 #          min_bit_rate_requirements:
143 #            root: 10000000
144 #            leaf: 10000000
145 #          networkName: { get_input: public_net_id }
146 #
147 #    #onap oam net
148 #    VL_onap_private:
149 #      type: tosca.nodes.nfv.VnfVirtualLink
150 #      properties:
151 #        connectivity_type:
152 #          layer_protocol: ipv4
153 #        vl_profile:
154 #          max_bit_rate_requirements:
155 #            root: 10000000
156 #            leaf: 10000000
157 #          min_bit_rate_requirements:
158 #            root: 10000000
159 #            leaf: 10000000
160 #          networkName: { get_input: onap_private_net_id }
161 #          cidr: { get_input: onap_private_net_cidr }
162
163     #Private network that connects vBRG to vBNG
164     VL_brgemu_bng_private_net:
165       type: tosca.nodes.nfv.VnfVirtualLink
166       properties:
167         connectivity_type:
168           layer_protocol: ipv4
169         vl_profile:
170           max_bit_rate_requirements:
171             root: 10000000
172             leaf: 10000000
173           min_bit_rate_requirements:
174             root: 10000000
175             leaf: 10000000
176           networkName: { get_input: brgemu_bng_private_net_id}
177           cidr: { get_input: brgemu_bng_private_net_cidr }
178           dhcpEnabled: false
179           physicalNetwork: "physnet1"
180
181     #cpe signal network
182     VL_cpe_signal:
183       type: tosca.nodes.nfv.VnfVirtualLink
184       properties:
185         connectivity_type:
186           layer_protocol: ipv4
187         vl_profile:
188           max_bit_rate_requirements:
189             root: 10000000
190             leaf: 10000000
191           min_bit_rate_requirements:
192             root: 10000000
193             leaf: 10000000
194           networkName: { get_input: cpe_signal_net_id}
195           cidr: { get_input: cpe_signal_private_net_cidr }
196           dhcpEnabled: false
197
198     #Private network that connects vBNG to vGMUX
199     VL_bng_gmux_private_net:
200       type: tosca.nodes.nfv.VnfVirtualLink
201       properties:
202         connectivity_type:
203           layer_protocol: ipv4
204         vl_profile:
205           max_bit_rate_requirements:
206             root: 10000000
207             leaf: 10000000
208           min_bit_rate_requirements:
209             root: 10000000
210             leaf: 10000000
211           networkName: { get_input: bng_gmux_private_net_id}
212           cidr: { get_input: bng_gmux_private_net_cidr }
213           dhcpEnabled: false
214           physicalNetwork: "physnet1"
215
216     # vbng related
217     Cp_vbng_public:
218       type: tosca.nodes.nfv.VduCp
219       properties:
220         layer_protocol: [ipv4]
221         trunk_mode: false
222         protocol_data:
223           - asscociated_layer_protocol: ipv4
224             address_data:
225               address_type: ip_address
226               l3_address_data:
227                 ip_address_assignment: false
228                 floating_ip_activated: false
229       requirements:
230         - virtual_binding: VDU_vbng_0
231         #- virtual_link: VL_public
232
233     Cp_vbng_onap_private:
234       type: tosca.nodes.nfv.VduCp
235       properties:
236         layer_protocol: [ipv4]
237         trunk_mode: false
238         protocol_data:
239           - asscociated_layer_protocol: ipv4
240             address_data:
241               address_type: ip_address
242               l3_address_data:
243                 ip_address_assignment: false
244                 floating_ip_activated: false
245                 fixed_ip_address:
246                   - { get_input: vbng_private_ip_1 }
247       requirements:
248         - virtual_binding: VDU_vbng_0
249         #- virtual_link: VL_onap_private
250
251     Cp_vbng_brgemu_bng_private_net:
252       type: tosca.nodes.nfv.VduCp
253       properties:
254         layer_protocol: [ipv4]
255         trunk_mode: false
256         protocol_data:
257           - asscociated_layer_protocol: ipv4
258             address_data:
259               address_type: ip_address
260               l3_address_data:
261                 ip_address_assignment: false
262                 floating_ip_activated: false
263                 fixed_ip_address:
264                   - { get_input: vbng_private_ip_0 }
265         vnic_type: "direct"
266         virtual_network_interface_requirements:
267           - name: "sriov-support"
268             support_mandatory: true
269             network_interface_requirements:
270               interfaceType: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "SR-IOV"}'
271             nic_io_requirements:
272               logical_node_requirements:
273                 pciVendorId: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "1234"}'
274                 pciDeviceId: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "5678"}'
275                 pciNumDevices: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "1"}'
276       requirements:
277         - virtual_binding: VDU_vbng_0
278         - virtual_link: VL_brgemu_bng_private_net
279
280     Cp_vbng_cpe_signal:
281       type: tosca.nodes.nfv.VduCp
282       properties:
283         layer_protocol: [ipv4]
284         trunk_mode: false
285         protocol_data:
286           - asscociated_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: vbng_private_ip_2 }
294       requirements:
295         - virtual_binding: VDU_vbng_0
296         - virtual_link: VL_cpe_signal
297
298     Cp_vbng_bng_gmux_private_net:
299       type: tosca.nodes.nfv.VduCp
300       properties:
301         layer_protocol: [ipv4]
302         trunk_mode: false
303         protocol_data:
304           - asscociated_layer_protocol: ipv4
305             address_data:
306               address_type: ip_address
307               l3_address_data:
308                 ip_address_assignment: false
309                 floating_ip_activated: false
310                 fixed_ip_address:
311                   - { get_input: vbng_private_ip_3 }
312         vnic_type: "direct"
313         virtual_network_interface_requirements:
314           - name: "sriov-support"
315             support_mandatory: true
316             network_interface_requirements:
317               interfaceType: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "SR-IOV"}'
318             nic_io_requirements:
319               logical_node_requirements:
320                 pciVendorId: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "1234"}'
321                 pciDeviceId: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "5678"}'
322                 pciNumDevices: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "1"}'
323       requirements:
324         - virtual_binding: VDU_vbng_0
325         - virtual_link: VL_bng_gmux_private_net
326
327     VirtualStorage_root_all:
328       # this indicate the VDU root storage size
329       type: tosca.nodes.nfv.Vdu.VirtualStorage
330       properties:
331         type_of_storage: root
332         size_of_storage: 40 GB
333
334     VDU_vbng_0:
335       type: tosca.nodes.nfv.Vdu.Compute
336       properties:
337         name: { get_input: vbng_name_0 }
338         description: vbng
339         configurable_properties:
340           additional_vnfc_configurable_properties: {}
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         user_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               # HPA requirements
410               vdu_memory_requirements:
411                 memoryPageSize: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "2 MB"}'
412                 numberOfPages: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "1024"}'
413             virtual_cpu:
414               num_virtual_cpu: 2
415               cpu_architecture: generic
416       requirements:
417         - virtual_storage: VirtualStorage_root_all
418       artifacts:
419         sw_image: #TODO need to put glance image name here
420           #file: { get_input: vcpe_image_name }
421           file: ../Artifacts/Deployment/OTHER/image
422           type: tosca.artifacts.nfv.SwImage