Merge "Clean old ONAP heat template from demo repository"
[demo.git] / tosca / vCPE / vgmux / MainServiceTemplate_sriov.yaml
1 tosca_definitions_version: tosca_simple_yaml_1_0
2 metadata:
3   template_name: vCPE_vgmux
4   template_version: "1.0"
5   template_author: onap
6 description: vCPE_vgmux
7
8 imports:
9   - onap_dm.yaml
10
11 topology_template:
12 #  substitution_mappings:
13 #    node_type: onap.vcpe_vgmux
14 #    requirements:
15 #      virtual_link: [ Cp_vgmux_public, virtual_link ] # expose as external CP
16 #      virtual_link: [ Cp_vgmux_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     bng_gmux_private_net_id:
34       type: string
35       description: Private network that connects vBNG to vGMUX
36       default: zdfw1bngmux01_private
37     bng_gmux_private_net_cidr:
38       type: string
39       description: The CIDR of the vBNG-vGMUX private network
40       default: 10.1.0.0/24
41     mux_gw_private_net_id:
42       type: string
43       description: Private network that connects vGMUX to vGWs
44       default: zdfw1muxgw01_private
45     mux_gw_private_net_cidr:
46       type: string
47       description: The CIDR of the vGMUX private network
48       default: 10.5.0.0/24
49     brgemu_bng_private_net_cidr:
50       type: string
51       description: The CIDR of the vBRG-vBNG private network
52       default: 10.3.0.0/24
53     vgmux_private_ip_0:
54       type: string
55       description: Private IP address that is assigned to the vGMUX to communicate with the vBNG
56       default: 10.1.0.20
57     vgmux_private_ip_1:
58       type: string
59       description: Private IP address that is assigned to the vGMUX to communicate with ONAP components
60       default: 10.0.101.20
61     vgmux_private_ip_2:
62       type: string
63       description: Private IP address that is assigned to the vGMUX to communicate with vGWs
64       default: 10.5.0.20
65     vgmux_name_0:
66       type: string
67       description: Name of the vGMUX
68       default: zdcpe1cpe01mux01
69     vnf_id:
70       type: string
71       description: The VNF ID is provided by ONAP
72       default: vCPE_Infrastructure_vGMUX_demo_app
73     vf_module_id:
74       type: string
75       description: The vCPE Module ID is provided by ONAP
76       default: vCPE_Intrastructure_Metro_vGMUX
77     bng_gmux_private_ip:
78       type: string
79       description: Private IP address that is assigned to the vBNG to communicate with the vGMUX
80       default: 10.1.0.10
81     dcae_collector_ip:
82       type: string
83       description: dcae collector ip
84       default: 10.0.4.102
85     dcae_collector_port:
86       type: string
87       description: dcae collector port
88       default: "8080"
89     pub_key:
90       type: string
91       description: ssh public key
92       default: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGx6SKrAuCz1V8KGevZueksLdWoPWJP6z3r29Z7TmPVEOjM+7PIPeSs2BVRx3rnHZBAlasMrZ+fJBS25ts9vfC+ItezQah/hr9vrkmwxCR54Lb84poW+sToPeF6i5eZY7W+jWJfLaFSFx9d2vp4zes/fOlT3NvYCXbn/3QdryQoGl7VFI8oemZypVcikZXElJeeKgAVdSwnrzuqtO/tmbXcAeSbYvVjki8ywYcsWMVMYWUWhh+1BAB6kXnTsIWqzrq0Pfvy+81WDwtiqsqmd93HY8hE0scBrXFBZzQS/AYfIFBlEuFNdLczchntjbZ0n7dmDXk8zHtCZYNk7kwb8k/
93     install_script_version:
94       type: string
95       description: install script version number
96       default: 1.2.0-SNAPSHOT
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     cloud_env:
102       type: string
103       description: cloud environment(openstack or rackspace)
104       default: openstack
105
106   node_templates:
107     LLU_VNF:
108       type: tosca.nodes.nfv.VNF
109       properties:
110         descriptor_id: b1bb0ce7-2222-4fa7-95ed-4840d70a1177
111         provider: onap
112         product_name: vcpe_vgmux
113         software_version: '1.0'
114         descriptor_version: '1.0'
115         flavour_id: simple
116         flavour_description: simple
117         vnfm_info: ['gvnfm']
118
119
120     #onap public net
121 #    VL_public:
122 #      type: tosca.nodes.nfv.VnfVirtualLink
123 #      properties:
124 #        connectivity_type:
125 #          layer_protocols: [ipv4]
126 #        vl_profile:
127 #          max_bitrate_requirements:
128 #            root: 10000000
129 #            leaf: 10000000
130 #          min_bitrate_requirements:
131 #            root: 10000000
132 #            leaf: 10000000
133 #          virtual_link_protocol_data:
134 #            - associated_layer_protocol: ipv4
135 #              l3_protocol_data:
136 #                ip_version: ipv4
137 #                name: { get_input: public_net_id }
138 #
139 #    #onap oam net
140 #    VL_onap_private:
141 #      type: tosca.nodes.nfv.VnfVirtualLink
142 #      properties:
143 #        connectivity_type:
144 #          layer_protocols: [ipv4]
145 #        vl_profile:
146 #          max_bitrate_requirements:
147 #            root: 10000000
148 #            leaf: 10000000
149 #          min_bitrate_requirements:
150 #            root: 10000000
151 #            leaf: 10000000
152 #          virtual_link_protocol_data:
153 #            - associated_layer_protocol: ipv4
154 #              l3_protocol_data:
155 #                ip_version: ipv4
156 #                name: { get_input: onap_private_net_id }
157 #                cidr: { get_input: onap_private_net_cidr }
158
159     #Private network that connects vBNG to vGMUX
160     VL_bng_gmux_private_net:
161       type: tosca.nodes.nfv.VnfVirtualLink
162       properties:
163         connectivity_type:
164           layer_protocols: [ipv4]
165         vl_profile:
166           max_bitrate_requirements:
167             root: 10000000
168             leaf: 10000000
169           min_bitrate_requirements:
170             root: 10000000
171             leaf: 10000000
172           virtual_link_protocol_data:
173             - associated_layer_protocol: ipv4
174               l3_protocol_data:
175                 ip_version: ipv4
176                 name: { get_input: bng_gmux_private_net_id}
177                 cidr: { get_input: bng_gmux_private_net_cidr }
178                 dhcp_enabled: false
179               l2_protocol_data:
180                 physical_network: "physnet1"
181
182     #Private network that connects vGMUX to vGWs
183     VL_mux_gw_private_net:
184       type: tosca.nodes.nfv.VnfVirtualLink
185       properties:
186         connectivity_type:
187           layer_protocols: [ipv4]
188         vl_profile:
189           max_bitrate_requirements:
190             root: 10000000
191             leaf: 10000000
192           min_bitrate_requirements:
193             root: 10000000
194             leaf: 10000000
195           virtual_link_protocol_data:
196             - associated_layer_protocol: ipv4
197               l3_protocol_data:
198                 ip_version: ipv4
199                 name: { get_input: mux_gw_private_net_id}
200                 cidr: { get_input: mux_gw_private_net_cidr }
201                 dhcp_enabled: false
202               l2_protocol_data:
203                 physical_network: "physnet1"
204
205     # vgmux related
206     Cp_vgmux_public:
207       type: tosca.nodes.nfv.VduCp
208       properties:
209         layer_protocols: [ipv4]
210         trunk_mode: false
211         protocol:
212           - associated_layer_protocol: ipv4
213             address_data:
214               - address_type: ip_address
215                 l3_address_data:
216                   ip_address_assignment: false
217                   floating_ip_activated: false
218       requirements:
219         - virtual_binding: VDU_vgmux_0
220         #- virtual_link: VL_public
221
222     Cp_vgmux_onap_private:
223       type: tosca.nodes.nfv.VduCp
224       properties:
225         layer_protocols: [ipv4]
226         trunk_mode: false
227         protocol:
228           - associated_layer_protocol: ipv4
229             address_data:
230               - address_type: ip_address
231                 l3_address_data:
232                   ip_address_assignment: false
233                   floating_ip_activated: false
234                   fixed_ip_address:
235                     - { get_input: vgmux_private_ip_1 }
236       requirements:
237         - virtual_binding: VDU_vgmux_0
238         #- virtual_link: VL_onap_private
239
240     Cp_vgmux_bng_gmux_private_net:
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                   fixed_ip_address:
253                     - { get_input: vgmux_private_ip_0 }
254         vnic_type: "direct-physical"
255         virtual_network_interface_requirements:
256           - name: "sriov-support"
257             support_mandatory: true
258             network_interface_requirements:
259               interfaceType: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "SR-IOV"}'
260             nic_io_requirements:
261               logical_node_requirements:
262                 pciVendorId: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "1234"}'
263                 pciDeviceId: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "5678"}'
264                 pciNumDevices: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "1"}'
265       requirements:
266         - virtual_binding: VDU_vgmux_0
267         - virtual_link: VL_bng_gmux_private_net
268
269     Cp_vgmux_mux_gw_private_net:
270       type: tosca.nodes.nfv.VduCp
271       properties:
272         layer_protocols: [ipv4]
273         trunk_mode: false
274         protocol:
275           - associated_layer_protocol: ipv4
276             address_data:
277               - address_type: ip_address
278                 l3_address_data:
279                   ip_address_assignment: false
280                   floating_ip_activated: false
281                   fixed_ip_address:
282                     - { get_input: vgmux_private_ip_2 }
283         vnic_type: "direct-physical"
284         virtual_network_interface_requirements:
285           - name: "sriov-support"
286             support_mandatory: true
287             network_interface_requirements:
288               interfaceType: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "SR-IOV"}'
289             nic_io_requirements:
290               logical_node_requirements:
291                 pciVendorId: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "1234"}'
292                 pciDeviceId: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "5678"}'
293                 pciNumDevices: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "1"}'
294       requirements:
295         - virtual_binding: VDU_vgmux_0
296         - virtual_link: VL_mux_gw_private_net
297
298     VDU_vgmux_0:
299       type: tosca.nodes.nfv.Vdu.Compute
300       properties:
301         name: { get_input: vgmux_name_0 }
302         description: vgmux
303         vdu_profile:
304           min_number_of_instances: 1
305           max_number_of_instances: 1
306           watchdog: none
307         inject_files: #TODO SDC bug
308           source_path: ../Artifacts/Deployment/OTHER/authorized_keys #SSH authorized_keys
309           dest_path: /home/ubuntu/.ssh/authorized_keys
310         meta_data:
311           vnf_id: { get_input: vnf_id }
312           vf_module_id: { get_input: vf_module_id }
313           mux_to_bng_net_ipaddr: { get_input: vgmux_private_ip_0 }
314           oam_ipaddr: { get_input: vgmux_private_ip_1 }
315           mux_gw_net_ipaddr: { get_input: vgmux_private_ip_2 }
316           bng_to_mux_net_ipaddr: { get_input: bng_gmux_private_ip }
317           bng_mux_net_cidr: { get_input: bng_gmux_private_net_cidr }
318           oam_cidr: { get_input: onap_private_net_cidr }
319           mux_gw_net_cidr: { get_input: mux_gw_private_net_cidr }
320           brg_bng_net_cidr: { get_input: brgemu_bng_private_net_cidr }
321           install_script_version: { get_input: install_script_version }
322           cloud_env: { get_input: cloud_env }
323           nexus_artifact_repo: { get_input: nexus_artifact_repo }
324         boot_data: |
325           #!/bin/bash
326           METADATA=`curl -s http://169.254.169.254/openstack/2012-08-10/meta_data.json`
327           apt-get -y install jq
328
329           get_metadata () {
330             echo $METADATA | jq -r ".meta.$1"
331           }
332
333           # Create configuration files
334           mkdir /opt/config
335           echo "$(get_metadata mux_to_bng_net_ipaddr)" > /opt/config/mux_to_bng_net_ipaddr.txt
336           echo "$(get_metadata oam_ipaddr)" > /opt/config/oam_ipaddr.txt
337           echo "$(get_metadata mux_gw_net_ipaddr)" > /opt/config/mux_gw_net_ipaddr.txt
338           echo "$(get_metadata bng_to_mux_net_ipaddr)" > /opt/config/bng_to_mux_net_ipaddr.txt
339           echo "$(get_metadata bng_mux_net_cidr)" > /opt/config/bng_mux_net_cidr.txt
340           echo "$(get_metadata oam_cidr)" > /opt/config/oam_cidr.txt
341           echo "$(get_metadata mux_gw_net_cidr)" > /opt/config/mux_gw_net_cidr.txt
342           echo "$(get_metadata brg_bng_net_cidr)" > /opt/config/brg_bng_net_cidr.txt
343           echo "$(get_metadata install_script_version)" > /opt/config/install_script_version.txt
344           echo "$(get_metadata cloud_env)" > /opt/config/cloud_env.txt
345           echo "$(get_metadata nexus_artifact_repo)" > /opt/config/nexus_artifact_repo.txt
346
347           # Download and run install script
348           apt-get -y install unzip
349           INSTALL_SCRIPT_VERSION=$(get_metadata install_script_version)
350           NEXUS_ARTIFACT_REPO=$(get_metadata nexus_artifact_repo)
351           if [[ "${INSTALL_SCRIPT_VERSION}" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi
352           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
353           unzip -j /opt/vcpe-scripts-${INSTALL_SCRIPT_VERSION}.zip -d /opt v_gmux_install.sh
354           cd /opt
355           chmod +x v_gmux_install.sh
356           ./v_gmux_install.sh
357       capabilities:
358         virtual_compute:
359           properties:
360             virtual_memory:
361               virtual_mem_size: 4096 MB
362               vdu_mem_requirements:
363                 memoryPageSize: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "2 MB"}'
364                 numberOfPages: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "1024"}'
365             virtual_cpu:
366               num_virtual_cpu: 2
367               cpu_architecture: generic
368             virtual_local_storage:
369               - size_of_storage: 40 GB
370       artifacts:
371         sw_image: #TODO need to put glance image name here
372           #file: { get_input: vcpe_image_name }
373           file: ../Artifacts/Deployment/OTHER/image
374           type: tosca.artifacts.nfv.SwImage
375