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