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