4a3a342982eac2bf6415ff87c88ec43ce8901a84
[demo.git] / tosca / vCPE / vgw / MainServiceTemplate_sriov.yaml
1 tosca_definitions_version: tosca_simple_yaml_1_0
2 metadata:
3   template_name: vCPE_vgw
4   template_version: "1.0"
5   template_author: onap
6 description: vCPE_vgw
7
8 imports:
9   - onap_dm.yaml
10
11 node_types:
12   onap.vcpe_vgw:
13     derived_from: tosca.nodes.nfv.VNF
14     properties:
15       descriptor_id:
16         type: string
17         constraints: [ valid_values: [ b1bb0ce7-2222-4fa7-95ed-4840d70a1177 ] ]
18         default: b1bb0ce7-2222-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_vgw ] ]
26         default: vcpe_vgw
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_vgw
51   #  requirements:
52   #    virtual_link: [ Cp_vgw_public, virtual_link ] # expose as external CP
53   #    virtual_link: [ Cp_vgw_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     mux_gw_private_net_id:
71       type: string
72       description: Private network that connects vGMUX to vGWs
73       default: zdfw1muxgw01_private
74     mux_gw_private_net_cidr:
75       type: string
76       description: he CIDR of the vGMUX private network
77       default: 10.5.0.0/24
78     cpe_public_net_id:
79       type: string
80       description: cpe public net name
81       default: zdfw1cpe01_public
82     cpe_public_net_cidr:
83       type: string
84       description: cpe public net cidr
85       default: 10.2.0.0/24
86     vgw_private_ip_0:
87       type: string
88       description: Private IP address that is assigned to the vGW to communicate with vGMUX
89       default: 10.5.0.21
90     vgw_private_ip_1:
91       type: string
92       description: Private IP address that is assigned to the vGW to communicate with ONAP components
93       default: 10.0.101.30
94     vgw_private_ip_2:
95       type: string
96       description: Private IP address that is assigned to the vGW to communicate with vCPE public network
97       default: 10.2.0.3
98     vgw_name_0:
99       type: string
100       description: Name of the vGW
101       default: zdcpe1cpe01gw01
102     dcae_collector_ip:
103       type: string
104       description: dcae collector ip
105       default: 10.0.4.102
106     dcae_collector_port:
107       type: integer
108       description: dcae collector port
109       default: 8080
110     pub_key:
111       type: string
112       description: ssh public key
113       default: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGx6SKrAuCz1V8KGevZueksLdWoPWJP6z3r29Z7TmPVEOjM+7PIPeSs2BVRx3rnHZBAlasMrZ+fJBS25ts9vfC+ItezQah/hr9vrkmwxCR54Lb84poW+sToPeF6i5eZY7W+jWJfLaFSFx9d2vp4zes/fOlT3NvYCXbn/3QdryQoGl7VFI8oemZypVcikZXElJeeKgAVdSwnrzuqtO/tmbXcAeSbYvVjki8ywYcsWMVMYWUWhh+1BAB6kXnTsIWqzrq0Pfvy+81WDwtiqsqmd93HY8hE0scBrXFBZzQS/AYfIFBlEuFNdLczchntjbZ0n7dmDXk8zHtCZYNk7kwb8k/
114     nexus_artifact_repo:
115       type: string
116       description: Root URL for the Nexus repository for Maven artifacts
117       default: https://nexus.onap.org
118     demo_artifacts_version:
119       type: string
120       description: artifacts version used in demo vnfs
121       default: 1.2.0
122     install_script_version:
123       type: string
124       description: install script version number
125       default: 1.2.0-SNAPSHOT
126     cloud_env:
127       type: string
128       description: cloud environment(openstack or rackspace)
129       default: openstack
130     mux_ip_addr:
131       type: string
132       description: IP address of vGMUX
133       default: 10.5.0.20
134     vg_vgmux_tunnel_vni:
135       type: integer
136       description: vni value of vG-vGMUX vxlan tunnel
137       default: 100
138     vnf_id:
139       type: string
140       description: The VNF ID is provided by ONAP
141       default: vCPE_Infrastructure_GW_demo_app
142     vf_module_id:
143       type: string
144       description: The vCPE Module ID is provided by ONAP
145       default: vCPE_Customer_GW
146
147   node_templates:
148     #onap public net
149 #    VL_public:
150 #      type: tosca.nodes.nfv.VnfVirtualLink
151 #      properties:
152 #        connectivity_type:
153 #          layer_protocol: ipv4
154 #        vl_profile:
155 #          max_bit_rate_requirements:
156 #            root: 10000000
157 #            leaf: 10000000
158 #          min_bit_rate_requirements:
159 #            root: 10000000
160 #            leaf: 10000000
161 #          networkName: { get_input: public_net_id }
162 #
163 #    #onap oam net
164 #    VL_onap_private:
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: onap_private_net_id }
177 #          cidr: { get_input: onap_private_net_cidr }
178
179     #Private network that connects vGMUX to vGWs
180     VL_mux_gw_private_net:
181       type: tosca.nodes.nfv.VnfVirtualLink
182       properties:
183         connectivity_type:
184           layer_protocol: ipv4
185         vl_profile:
186           max_bit_rate_requirements:
187             root: 10000000
188             leaf: 10000000
189           min_bit_rate_requirements:
190             root: 10000000
191             leaf: 10000000
192           networkName: { get_input: mux_gw_private_net_id}
193           cidr: { get_input: mux_gw_private_net_cidr }
194           dhcpEnabled: false
195           physicalNetwork: "physnet1"
196
197     #cpe public network
198     VL_cpe_public:
199       type: tosca.nodes.nfv.VnfVirtualLink
200       properties:
201         connectivity_type:
202           layer_protocol: ipv4
203         vl_profile:
204           max_bit_rate_requirements:
205             root: 10000000
206             leaf: 10000000
207           min_bit_rate_requirements:
208             root: 10000000
209             leaf: 10000000
210           networkName: { get_input: cpe_public_net_id}
211           cidr: { get_input: cpe_public_net_cidr }
212           dhcpEnabled: false
213
214     # vgw related
215     Cp_vgw_public:
216       type: tosca.nodes.nfv.VduCp
217       properties:
218         layer_protocol: [ipv4]
219         trunk_mode: false
220         protocol_data:
221           - asscociated_layer_protocol: ipv4
222             address_data:
223               address_type: ip_address
224               l3_address_data:
225                 ip_address_assignment: false
226                 floating_ip_activated: false
227       requirements:
228         - virtual_binding: VDU_vgw_0
229         #- virtual_link: VL_public
230
231     Cp_vgw_onap_private:
232       type: tosca.nodes.nfv.VduCp
233       properties:
234         layer_protocol: [ipv4]
235         trunk_mode: false
236         protocol_data:
237           - asscociated_layer_protocol: ipv4
238             address_data:
239               address_type: ip_address
240               l3_address_data:
241                 ip_address_assignment: false
242                 floating_ip_activated: false
243                 fixed_ip_address:
244                   - { get_input: vgw_private_ip_1 }
245       requirements:
246         - virtual_binding: VDU_vgw_0
247         #- virtual_link: VL_onap_private
248
249     Cp_vgw_mux_gw_private_net:
250       type: tosca.nodes.nfv.VduCp
251       properties:
252         layer_protocol: [ipv4]
253         trunk_mode: false
254         protocol_data:
255           - asscociated_layer_protocol: ipv4
256             address_data:
257               address_type: ip_address
258               l3_address_data:
259                 ip_address_assignment: false
260                 floating_ip_activated: false
261                 fixed_ip_address:
262                   - { get_input: vgw_private_ip_0 }
263         vnic_type: "direct"
264         virtual_network_interface_requirements:
265           - name: "sriov-support"
266             support_mandatory: true
267             network_interface_requirements:
268               interfaceType: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "SR-IOV"}'
269             nic_io_requirements:
270               logical_node_requirements:
271                 pciVendorId: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "1234"}'
272                 pciDeviceId: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "5678"}'
273                 pciNumDevices: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "1"}'
274       requirements:
275         - virtual_binding: VDU_vgw_0
276         - virtual_link: VL_mux_gw_private_net
277
278     Cp_vgw_cpe_public:
279       type: tosca.nodes.nfv.VduCp
280       properties:
281         layer_protocol: [ipv4]
282         trunk_mode: false
283         protocol_data:
284           - asscociated_layer_protocol: ipv4
285             address_data:
286               address_type: ip_address
287               l3_address_data:
288                 ip_address_assignment: false
289                 floating_ip_activated: false
290                 fixed_ip_address:
291                   - { get_input: vgw_private_ip_2 }
292       requirements:
293         - virtual_binding: VDU_vgw_0
294         - virtual_link: VL_cpe_public
295
296     VirtualStorage_root_all:
297       # this indicate the VDU root storage size
298       type: tosca.nodes.nfv.Vdu.VirtualStorage
299       properties:
300         type_of_storage: root
301         size_of_storage: 40 GB
302
303     VDU_vgw_0:
304       type: tosca.nodes.nfv.Vdu.Compute
305       properties:
306         name: { get_input: vgw_name_0 }
307         description: vgw
308         configurable_properties:
309           additional_vnfc_configurable_properties: {}
310         vdu_profile:
311           min_number_of_instances: 1
312           max_number_of_instances: 1
313           watchdog: none
314         inject_files: # TODO SDC BUG
315           source_path: ../Artifacts/keys/authorized_keys #SSH authorized_keys
316           dest_path: /home/ubuntu/.ssh/authorized_keys
317         meta_data:
318           vnf_id: { get_input: vnf_id }
319           vf_module_id: { get_input: vf_module_id }
320           mux_gw_private_net_ipaddr: { get_input: vgw_private_ip_0 }
321           oam_ipaddr: { get_input: vgw_private_ip_1 }
322           oam_cidr: { get_input: onap_private_net_cidr }
323           cpe_public_net_cidr: { get_input: cpe_public_net_cidr }
324           mux_gw_private_net_cidr: { get_input: mux_gw_private_net_cidr }
325           mux_ip_addr: { get_input: mux_ip_addr }
326           vg_vgmux_tunnel_vni: { get_input: vg_vgmux_tunnel_vni }
327           install_script_version: { get_input: install_script_version }
328           cloud_env: { get_input: cloud_env }
329           nexus_artifact_repo: { get_input: nexus_artifact_repo }
330         user_data: |
331           #!/bin/bash
332           METADATA=`curl -s http://169.254.169.254/openstack/2012-08-10/meta_data.json`
333           apt-get -y install jq
334
335           get_metadata () {
336             echo $METADATA | jq -r ".meta.$1"
337           }
338
339           # Create configuration files
340           mkdir /opt/config
341           echo "$(get_metadata oam_ipaddr)" > /opt/config/oam_ipaddr.txt
342           echo "$(get_metadata oam_cidr)" > /opt/config/oam_cidr.txt
343           echo "$(get_metadata cpe_public_net_cidr)" > /opt/config/cpe_public_net_cidr.txt
344           echo "$(get_metadata mux_gw_private_net_ipaddr)" > /opt/config/mux_gw_private_net_ipaddr.txt
345           echo "$(get_metadata mux_gw_private_net_cidr)" > /opt/config/mux_gw_private_net_cidr.txt
346           echo "$(get_metadata install_script_version)" > /opt/config/install_script_version.txt
347           echo "$(get_metadata cloud_env)" > /opt/config/cloud_env.txt
348           echo "$(get_metadata mux_ip_addr)" > /opt/config/mux_ip_addr.txt
349           echo "$(get_metadata vg_vgmux_tunnel_vni)" > /opt/config/vg_vgmux_tunnel_vni.txt
350           echo "$(get_metadata nexus_artifact_repo)" > /opt/config/nexus_artifact_repo.txt
351
352           # Download and run install script
353           apt-get -y install unzip
354           INSTALL_SCRIPT_VERSION=$(get_metadata install_script_version)
355           NEXUS_ARTIFACT_REPO=$(get_metadata nexus_artifact_repo)
356           if [[ "${INSTALL_SCRIPT_VERSION}" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi
357           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
358           unzip -j /opt/vcpe-scripts-${INSTALL_SCRIPT_VERSION}.zip -d /opt v_gw_install.sh
359           cd /opt
360           chmod +x v_gw_install.sh
361           ./v_gw_install.sh
362       capabilities:
363         virtual_compute:
364           properties:
365             #TODO add local disk size
366             virtual_memory:
367               virtual_mem_size: 4096 MB
368               # HPA requirements
369               vdu_memory_requirements:
370                 memoryPageSize: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "2 MB"}'
371                 numberOfPages: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "1024"}'
372             virtual_cpu:
373               num_virtual_cpu: 2
374               cpu_architecture: generic
375       requirements:
376         - virtual_storage: VirtualStorage_root_all
377       artifacts:
378         sw_image: #TODO need to put glance image name here
379           #file: { get_input: vcpe_image_name }
380           file: ../Artifacts/images/ubuntu_16.04
381           type: tosca.artifacts.nfv.SwImage