fix tosca template bugs
[modeling/etsicatalog.git] / catalog / pub / utils / toscaparser / testdata / vnf / vcpesriov / vgmux / MainServiceTemplate.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 node_types:
12   onap.vcpe_vgmux:
13     derived_from: tosca.nodes.nfv.VNF
14     properties:
15       descriptor_id:
16         type: string
17         constraints: [ valid_values: [ b1bb0ce7-3333-4fa7-95ed-4840d70a1177 ] ]
18         default: b1bb0ce7-3333-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_vgmux ] ]
26         default: vcpe_vgmux
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_vgmux
51 #    requirements:
52 #      virtual_link: [ Cp_vgmux_public, virtual_link ] # expose as external CP
53 #      virtual_link: [ Cp_vgmux_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     bng_gmux_private_net_id:
71       type: string
72       description: Private network that connects vBNG to vGMUX
73       default: zdfw1bngmux01_private
74     bng_gmux_private_net_cidr:
75       type: string
76       description: The CIDR of the vBNG-vGMUX private network
77       default: 10.1.0.0/24
78     mux_gw_private_net_id:
79       type: string
80       description: Private network that connects vGMUX to vGWs
81       default: zdfw1muxgw01_private
82     mux_gw_private_net_cidr:
83       type: string
84       description: The CIDR of the vGMUX private network
85       default: 10.5.0.0/24
86     brgemu_bng_private_net_cidr:
87       type: string
88       description: The CIDR of the vBRG-vBNG private network
89       default: 10.3.0.0/24
90     vgmux_private_ip_0:
91       type: string
92       description: Private IP address that is assigned to the vGMUX to communicate with the vBNG
93       default: 10.1.0.20
94     vgmux_private_ip_1:
95       type: string
96       description: Private IP address that is assigned to the vGMUX to communicate with ONAP components
97       default: 10.0.101.20
98     vgmux_private_ip_2:
99       type: string
100       description: Private IP address that is assigned to the vGMUX to communicate with vGWs
101       default: 10.5.0.20
102     vgmux_name_0:
103       type: string
104       description: Name of the vGMUX
105       default: zdcpe1cpe01mux01
106     vnf_id:
107       type: string
108       description: The VNF ID is provided by ONAP
109       default: vCPE_Infrastructure_vGMUX_demo_app
110     vf_module_id:
111       type: string
112       description: The vCPE Module ID is provided by ONAP
113       default: vCPE_Intrastructure_Metro_vGMUX
114     bng_gmux_private_ip:
115       type: string
116       description: Private IP address that is assigned to the vBNG to communicate with the vGMUX
117       default: 10.1.0.10
118     dcae_collector_ip:
119       type: string
120       description: dcae collector ip
121       default: 10.0.4.102
122     dcae_collector_port:
123       type: integer
124       description: dcae collector port
125       default: 8080
126     pub_key:
127       type: string
128       description: ssh public key
129       default: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGx6SKrAuCz1V8KGevZueksLdWoPWJP6z3r29Z7TmPVEOjM+7PIPeSs2BVRx3rnHZBAlasMrZ+fJBS25ts9vfC+ItezQah/hr9vrkmwxCR54Lb84poW+sToPeF6i5eZY7W+jWJfLaFSFx9d2vp4zes/fOlT3NvYCXbn/3QdryQoGl7VFI8oemZypVcikZXElJeeKgAVdSwnrzuqtO/tmbXcAeSbYvVjki8ywYcsWMVMYWUWhh+1BAB6kXnTsIWqzrq0Pfvy+81WDwtiqsqmd93HY8hE0scBrXFBZzQS/AYfIFBlEuFNdLczchntjbZ0n7dmDXk8zHtCZYNk7kwb8k/
130     install_script_version:
131       type: string
132       description: install script version number
133       default: 1.2.0-SNAPSHOT
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     cloud_env:
139       type: string
140       description: cloud environment(openstack or rackspace)
141       default: openstack
142
143   node_templates:
144     #onap public net
145 #    VL_public:
146 #      type: tosca.nodes.nfv.VnfVirtualLink
147 #      properties:
148 #        connectivity_type:
149 #          layer_protocol: ipv4
150 #        vl_profile:
151 #          max_bit_rate_requirements:
152 #            root: 10000000
153 #            leaf: 10000000
154 #          min_bit_rate_requirements:
155 #            root: 10000000
156 #            leaf: 10000000
157 #          networkName: { get_input: public_net_id }
158 #
159 #    #onap oam net
160 #    VL_onap_private:
161 #      type: tosca.nodes.nfv.VnfVirtualLink
162 #      properties:
163 #        connectivity_type:
164 #          layer_protocol: ipv4
165 #        vl_profile:
166 #          max_bit_rate_requirements:
167 #            root: 10000000
168 #            leaf: 10000000
169 #          min_bit_rate_requirements:
170 #            root: 10000000
171 #            leaf: 10000000
172 #          networkName: { get_input: onap_private_net_id }
173 #          cidr: { get_input: onap_private_net_cidr }
174
175     #Private network that connects vBNG to vGMUX
176     VL_bng_gmux_private_net:
177       type: tosca.nodes.nfv.VnfVirtualLink
178       properties:
179         connectivity_type:
180           layer_protocol: ipv4
181         vl_profile:
182           max_bit_rate_requirements:
183             root: 10000000
184             leaf: 10000000
185           min_bit_rate_requirements:
186             root: 10000000
187             leaf: 10000000
188           networkName: { get_input: bng_gmux_private_net_id}
189           cidr: { get_input: bng_gmux_private_net_cidr }
190           dhcpEnabled: false
191           physicalNetwork: "physnet1"
192
193     #Private network that connects vGMUX to vGWs
194     VL_mux_gw_private_net:
195       type: tosca.nodes.nfv.VnfVirtualLink
196       properties:
197         connectivity_type:
198           layer_protocol: ipv4
199         vl_profile:
200           max_bit_rate_requirements:
201             root: 10000000
202             leaf: 10000000
203           min_bit_rate_requirements:
204             root: 10000000
205             leaf: 10000000
206           networkName: { get_input: mux_gw_private_net_id}
207           cidr: { get_input: mux_gw_private_net_cidr }
208           dhcpEnabled: false
209           physicalNetwork: "physnet1"
210
211     # vgmux related
212     Cp_vgmux_public:
213       type: tosca.nodes.nfv.VduCp
214       properties:
215         layer_protocol: [ipv4]
216         trunk_mode: false
217         protocol_data:
218           - asscociated_layer_protocol: ipv4
219             address_data:
220               address_type: ip_address
221               l3_address_data:
222                 ip_address_assignment: false
223                 floating_ip_activated: false
224       requirements:
225         - virtual_binding: VDU_vgmux_0
226         #- virtual_link: VL_public
227
228     Cp_vgmux_onap_private:
229       type: tosca.nodes.nfv.VduCp
230       properties:
231         layer_protocol: [ipv4]
232         trunk_mode: false
233         protocol_data:
234           - asscociated_layer_protocol: ipv4
235             address_data:
236               address_type: ip_address
237               l3_address_data:
238                 ip_address_assignment: false
239                 floating_ip_activated: false
240                 fixed_ip_address:
241                   - { get_input: vgmux_private_ip_1 }
242       requirements:
243         - virtual_binding: VDU_vgmux_0
244         #- virtual_link: VL_onap_private
245
246     Cp_vgmux_bng_gmux_private_net:
247       type: tosca.nodes.nfv.VduCp
248       properties:
249         layer_protocol: [ipv4]
250         trunk_mode: false
251         protocol_data:
252           - asscociated_layer_protocol: ipv4
253             address_data:
254               address_type: ip_address
255               l3_address_data:
256                 ip_address_assignment: false
257                 floating_ip_activated: false
258                 fixed_ip_address:
259                   - { get_input: vgmux_private_ip_0 }
260         vnic_type: "direct"
261         virtual_network_interface_requirements:
262           - name: "sriov-support"
263             support_mandatory: true
264             network_interface_requirements:
265               interfaceType: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "SR-IOV"}'
266             nic_io_requirements:
267               pciVendorId: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "1234"}'
268               pciDeviceId: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "5678"}'
269               pciNumDevices: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "1"}'
270       requirements:
271         - virtual_binding: VDU_vgmux_0
272         - virtual_link: VL_bng_gmux_private_net
273
274     Cp_vgmux_mux_gw_private_net:
275       type: tosca.nodes.nfv.VduCp
276       properties:
277         layer_protocol: [ipv4]
278         trunk_mode: false
279         protocol_data:
280           - asscociated_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: vgmux_private_ip_2 }
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               pciVendorId: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "1234"}'
296               pciDeviceId: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "5678"}'
297               pciNumDevices: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "1"}'
298       requirements:
299         - virtual_binding: VDU_vgmux_0
300         - virtual_link: VL_mux_gw_private_net
301
302     VirtualStorage_root_all:
303       # this indicate the VDU root storage size
304       type: tosca.nodes.nfv.Vdu.VirtualStorage
305       properties:
306         type_of_storage: root
307         size_of_storage: 40 GB
308
309     VDU_vgmux_0:
310       type: tosca.nodes.nfv.Vdu.Compute
311       properties:
312         name: { get_input: vgmux_name_0 }
313         description: vgmux
314         configurable_properties:
315           additional_vnfc_configurable_properties: {}
316         vdu_profile:
317           min_number_of_instances: 1
318           max_number_of_instances: 1
319           watchdog: none
320         inject_files: #TODO SDC bug
321           source_path: ../Artifacts/keys/authorized_keys #SSH authorized_keys
322           dest_path: /home/ubuntu/.ssh/authorized_keys
323         meta_data:
324           vnf_id: { get_input: vnf_id }
325           vf_module_id: { get_input: vf_module_id }
326           mux_to_bng_net_ipaddr: { get_input: vgmux_private_ip_0 }
327           oam_ipaddr: { get_input: vgmux_private_ip_1 }
328           mux_gw_net_ipaddr: { get_input: vgmux_private_ip_2 }
329           bng_to_mux_net_ipaddr: { get_input: bng_gmux_private_ip }
330           bng_mux_net_cidr: { get_input: bng_gmux_private_net_cidr }
331           oam_cidr: { get_input: onap_private_net_cidr }
332           mux_gw_net_cidr: { get_input: mux_gw_private_net_cidr }
333           brg_bng_net_cidr: { get_input: brgemu_bng_private_net_cidr }
334           install_script_version: { get_input: install_script_version }
335           cloud_env: { get_input: cloud_env }
336           nexus_artifact_repo: { get_input: nexus_artifact_repo }
337         user_data: |
338           #!/bin/bash
339           METADATA=`curl -s http://169.254.169.254/openstack/2012-08-10/meta_data.json`
340           apt-get -y install jq
341
342           get_metadata () {
343             echo $METADATA | jq -r ".meta.$1"
344           }
345
346           # Create configuration files
347           mkdir /opt/config
348           echo "$(get_metadata mux_to_bng_net_ipaddr)" > /opt/config/mux_to_bng_net_ipaddr.txt
349           echo "$(get_metadata oam_ipaddr)" > /opt/config/oam_ipaddr.txt
350           echo "$(get_metadata mux_gw_net_ipaddr)" > /opt/config/mux_gw_net_ipaddr.txt
351           echo "$(get_metadata bng_to_mux_net_ipaddr)" > /opt/config/bng_to_mux_net_ipaddr.txt
352           echo "$(get_metadata bng_mux_net_cidr)" > /opt/config/bng_mux_net_cidr.txt
353           echo "$(get_metadata oam_cidr)" > /opt/config/oam_cidr.txt
354           echo "$(get_metadata mux_gw_net_cidr)" > /opt/config/mux_gw_net_cidr.txt
355           echo "$(get_metadata brg_bng_net_cidr)" > /opt/config/brg_bng_net_cidr.txt
356           echo "$(get_metadata install_script_version)" > /opt/config/install_script_version.txt
357           echo "$(get_metadata cloud_env)" > /opt/config/cloud_env.txt
358           echo "$(get_metadata nexus_artifact_repo)" > /opt/config/nexus_artifact_repo.txt
359
360           # Download and run install script
361           apt-get -y install unzip
362           INSTALL_SCRIPT_VERSION=$(get_metadata install_script_version)
363           NEXUS_ARTIFACT_REPO=$(get_metadata nexus_artifact_repo)
364           if [[ "${INSTALL_SCRIPT_VERSION}" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi
365           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
366           unzip -j /opt/vcpe-scripts-${INSTALL_SCRIPT_VERSION}.zip -d /opt v_gmux_install.sh
367           cd /opt
368           chmod +x v_gmux_install.sh
369           ./v_gmux_install.sh
370       capabilities:
371         virtual_compute:
372           properties:
373             virtual_memory:
374               virtual_mem_size: 4096 MB
375               # HPA requirements
376               vdu_memory_requirements:
377                 memoryPageSize: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "2 MB"}'
378                 numberOfPages: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "1024"}'
379             virtual_cpu:
380               num_virtual_cpu: 2
381               cpu_architecture: generic
382       requirements:
383         - virtual_storage: VirtualStorage_root_all
384       artifacts:
385         sw_image: #TODO need to put glance image name here
386           #file: { get_input: vcpe_image_name }
387           file: ../Artifacts/images/ubuntu_16.04
388           type: tosca.artifacts.nfv.SwImage
389