fix tosca template bugs
[modeling/etsicatalog.git] / catalog / pub / utils / toscaparser / testdata / vnf / vcpesriov / vbng / MainServiceTemplate.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               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_protocol: [ipv4]
307         trunk_mode: false
308         protocol_data:
309           - asscociated_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_protocol: [ipv4]
325         trunk_mode: false
326         protocol_data:
327           - asscociated_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               pciVendorId: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "1234"}'
343               pciDeviceId: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "5678"}'
344               pciNumDevices: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "1"}'
345       requirements:
346         - virtual_binding: VDU_vbng_0
347         - virtual_link: VL_bng_gmux_private_net
348
349     VirtualStorage_root_all:
350       # this indicate the VDU root storage size
351       type: tosca.nodes.nfv.Vdu.VirtualStorage
352       properties:
353         type_of_storage: root
354         size_of_storage: 40 GB
355
356     VDU_vbng_0:
357       type: tosca.nodes.nfv.Vdu.Compute
358       properties:
359         name: { get_input: vbng_name_0 }
360         description: vbng
361         configurable_properties:
362           additional_vnfc_configurable_properties: {}
363         vdu_profile:
364           min_number_of_instances: 1
365           max_number_of_instances: 1
366           watchdog: none
367         inject_files: #TODO SDC bug
368           source_path: ../Artifacts/keys/authorized_keys #SSH authorized_keys
369           dest_path: /home/ubuntu/.ssh/authorized_keys
370         meta_data:
371           vnf_id: { get_input: vnf_id }
372           vf_module_id: { get_input: vf_module_id }
373
374           brgemu_bng_net_ipaddr: { get_input: vbng_private_ip_0 }
375           cpe_signal_net_ipaddr: { get_input: vbng_private_ip_2 }
376           bng_gmux_net_ipaddr: { get_input: vbng_private_ip_3 }
377           oam_ipaddr: { get_input: vbng_private_ip_1 }
378           oam_cidr: { get_input: onap_private_net_cidr }
379           bng_gmux_cidr: { get_input: bng_gmux_private_net_cidr }
380           cpe_signal_cidr: { get_input: cpe_signal_private_net_cidr }
381           brgemu_bng_cidr: { get_input: brgemu_bng_private_net_cidr }
382           dcae_collector_ip: { get_input: dcae_collector_ip }
383           dcae_collector_port: { get_input: dcae_collector_port }
384           demo_artifacts_version: { get_input: demo_artifacts_version }
385           install_script_version: { get_input: install_script_version }
386           sdnc_ip: { get_input: sdnc_ip_addr }
387           cloud_env: { get_input: cloud_env }
388           nexus_artifact_repo: { get_input: nexus_artifact_repo }
389         user_data: |
390           #!/bin/bash
391           METADATA=`curl -s http://169.254.169.254/openstack/2012-08-10/meta_data.json`
392           apt-get -y install jq
393
394           get_metadata () {
395             echo $METADATA | jq -r ".meta.$1"
396           }
397
398           # Create configuration files
399           mkdir /opt/config
400           echo "$(get_metadata brgemu_bng_net_ipaddr)" > /opt/config/brgemu_bng_net_ipaddr.txt
401           echo "$(get_metadata cpe_signal_net_ipaddr)" > /opt/config/cpe_signal_net_ipaddr.txt
402           echo "$(get_metadata bng_gmux_net_ipaddr)" > /opt/config/bng_gmux_net_ipaddr.txt
403           echo "$(get_metadata oam_ipaddr)" > /opt/config/oam_ipaddr.txt
404           echo "$(get_metadata oam_cidr)" > /opt/config/oam_cidr.txt
405           echo "$(get_metadata bng_gmux_cidr)" > /opt/config/bng_gmux_net_cidr.txt
406           echo "$(get_metadata cpe_signal_cidr)" > /opt/config/cpe_signal_net_cidr.txt
407           echo "$(get_metadata brgemu_bng_cidr)" > /opt/config/brgemu_bng_net_cidr.txt
408           echo "$(get_metadata dcae_collector_ip)" > /opt/config/dcae_collector_ip.txt
409           echo "$(get_metadata dcae_collector_port)" > /opt/config/dcae_collector_port.txt
410           echo "$(get_metadata demo_artifacts_version)" > /opt/config/demo_artifacts_version.txt
411           echo "$(get_metadata install_script_version)" > /opt/config/install_script_version.txt
412           echo "$(get_metadata cloud_env)" > /opt/config/cloud_env.txt
413           echo "$(get_metadata sdnc_ip)" > /opt/config/sdnc_ip.txt
414           echo "$(get_metadata nexus_artifact_repo)" > /opt/config/nexus_artifact_repo.txt
415
416           # Download and run install script
417           apt-get -y install unzip
418           INSTALL_SCRIPT_VERSION=$(get_metadata install_script_version)
419           NEXUS_ARTIFACT_REPO=$(get_metadata nexus_artifact_repo)
420           if [[ "${INSTALL_SCRIPT_VERSION}" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi
421           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
422           unzip -j /opt/vcpe-scripts-${INSTALL_SCRIPT_VERSION}.zip -d /opt v_bng_install.sh
423           cd /opt
424           chmod +x v_bng_install.sh
425           ./v_bng_install.sh
426       capabilities:
427         virtual_compute:
428           properties:
429             virtual_memory:
430               virtual_mem_size: 4096 MB
431               # HPA requirements
432               vdu_memory_requirements:
433                 memoryPageSize: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "2 MB"}'
434                 numberOfPages: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "1024"}'
435             virtual_cpu:
436               num_virtual_cpu: 2
437               cpu_architecture: generic
438       requirements:
439         - virtual_storage: VirtualStorage_root_all
440       artifacts:
441         sw_image: #TODO need to put glance image name here
442           #file: { get_input: vcpe_image_name }
443           file: ../Artifacts/images/ubuntu_16.04
444           type: tosca.artifacts.nfv.SwImage