fix tosca template bugs
[modeling/etsicatalog.git] / catalog / pub / utils / toscaparser / testdata / vnf / vcpedpdk / 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       default: external
64     onap_private_net_id:
65       type: string
66       description: onap OAM network id
67       default: oam_onap
68     onap_private_net_cidr:
69       type: string
70       description: oanp OAM network cidr
71       default: 10.0.0.0/16
72     brgemu_bng_private_net_id:
73       type: string
74       description: Private network that connects vBRG to vBNG
75       default: zdfw1bngin01_private
76     brgemu_bng_private_net_cidr:
77       type: string
78       description: The CIDR of the input side of vBNG private network
79       default: 10.3.0.0/24
80     bng_gmux_private_net_id:
81       type: string
82       description: Private network that connects vBNG to vGMUX
83       default: zdfw1bngmux01_private
84     bng_gmux_private_net_cidr:
85       type: string
86       description: The CIDR of the input side of vGMUX private network
87       default: 10.1.0.0/24
88     cpe_signal_net_id:
89       type: string
90       description: Private network that connects vCPE elements with vCPE infrastructure elements
91       default: zdfw1cpe01_private
92     cpe_signal_private_net_cidr:
93       type: string
94       description: The CIDR of the vAAA private network
95       default: 10.4.0.0/24
96     vbng_private_ip_0:
97       type: string
98       description: Private IP address that is assigned to the vBNG IN
99       default: 10.3.0.1
100     vbng_private_ip_1:
101       type: string
102       description: Private IP address that is assigned to the vBNG to communicate with ONAP components
103       default: 10.0.101.10
104     vbng_private_ip_2:
105       type: string
106       description: Private IP address that is assigned to the vBNG in the CPE_SIGNAL network
107       default: 10.4.0.3
108     vbng_private_ip_3:
109       type: string
110       description: Private IP address that is assigned to the vBNG to vGMUX port
111       default: 10.1.0.10
112     vbng_name_0:
113       type: string
114       description: Name of the vBNG
115       default: zdcpe1cpe01bng01
116     vnf_id:
117       type: string
118       description: The VNF ID is provided by ONAP
119       default: vCPE_Infrastructure_Metro_vBNG_demo_app
120     vf_module_id:
121       type: string
122       description: The vCPE Module ID is provided by ONAP
123       default: vCPE_Intrastructure_Metro_vBNG
124     dcae_collector_ip:
125       type: string
126       description: dcae collector ip
127       default: 10.0.4.102
128     dcae_collector_port:
129       type: integer
130       description: dcae collector port
131       default: 8080
132     pub_key:
133       type: string
134       description: ssh public key
135       default: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGx6SKrAuCz1V8KGevZueksLdWoPWJP6z3r29Z7TmPVEOjM+7PIPeSs2BVRx3rnHZBAlasMrZ+fJBS25ts9vfC+ItezQah/hr9vrkmwxCR54Lb84poW+sToPeF6i5eZY7W+jWJfLaFSFx9d2vp4zes/fOlT3NvYCXbn/3QdryQoGl7VFI8oemZypVcikZXElJeeKgAVdSwnrzuqtO/tmbXcAeSbYvVjki8ywYcsWMVMYWUWhh+1BAB6kXnTsIWqzrq0Pfvy+81WDwtiqsqmd93HY8hE0scBrXFBZzQS/AYfIFBlEuFNdLczchntjbZ0n7dmDXk8zHtCZYNk7kwb8k/
136     nexus_artifact_repo:
137       type: string
138       description: Root URL for the Nexus repository for Maven artifacts
139       default: https://nexus.onap.org
140     demo_artifacts_version:
141       type: string
142       description: artifacts version used in demo vnfs
143       default: 1.2.0
144     install_script_version:
145       type: string
146       description: install script version number
147       default: 1.2.0-SNAPSHOT
148     cloud_env:
149       type: string
150       description: cloud environment(openstack or rackspace)
151       default: openstack
152     sdnc_ip_addr:
153       type: string
154       description: IP address of the SDNC
155       default: 10.0.7.1
156
157   node_templates:
158     #onap public net
159 #    VL_public:
160 #      type: tosca.nodes.nfv.VnfVirtualLink
161 #      properties:
162 #        connectivity_type:
163 #          layer_protocol: ipv4
164 #        vl_profile:
165 #          max_bit_rate_requirements:
166 #            root: 10000000
167 #            leaf: 10000000
168 #          min_bit_rate_requirements:
169 #            root: 10000000
170 #            leaf: 10000000
171 #          networkName: { get_input: public_net_id }
172 #
173 #    #onap oam net
174 #    VL_onap_private:
175 #      type: tosca.nodes.nfv.VnfVirtualLink
176 #      properties:
177 #        connectivity_type:
178 #          layer_protocol: ipv4
179 #        vl_profile:
180 #          max_bit_rate_requirements:
181 #            root: 10000000
182 #            leaf: 10000000
183 #          min_bit_rate_requirements:
184 #            root: 10000000
185 #            leaf: 10000000
186 #          networkName: { get_input: onap_private_net_id }
187 #          cidr: { get_input: onap_private_net_cidr }
188
189     #Private network that connects vBRG to vBNG
190     VL_brgemu_bng_private_net:
191       type: tosca.nodes.nfv.VnfVirtualLink
192       properties:
193         connectivity_type:
194           layer_protocol: ipv4
195         vl_profile:
196           max_bit_rate_requirements:
197             root: 10000000
198             leaf: 10000000
199           min_bit_rate_requirements:
200             root: 10000000
201             leaf: 10000000
202           networkName: { get_input: brgemu_bng_private_net_id}
203           cidr: { get_input: brgemu_bng_private_net_cidr }
204           dhcpEnabled: false
205
206     #cpe signal network
207     VL_cpe_signal:
208       type: tosca.nodes.nfv.VnfVirtualLink
209       properties:
210         connectivity_type:
211           layer_protocol: ipv4
212         vl_profile:
213           max_bit_rate_requirements:
214             root: 10000000
215             leaf: 10000000
216           min_bit_rate_requirements:
217             root: 10000000
218             leaf: 10000000
219           networkName: { get_input: cpe_signal_net_id}
220           cidr: { get_input: cpe_signal_private_net_cidr }
221           dhcpEnabled: false
222
223     #Private network that connects vBNG to vGMUX
224     VL_bng_gmux_private_net:
225       type: tosca.nodes.nfv.VnfVirtualLink
226       properties:
227         connectivity_type:
228           layer_protocol: ipv4
229         vl_profile:
230           max_bit_rate_requirements:
231             root: 10000000
232             leaf: 10000000
233           min_bit_rate_requirements:
234             root: 10000000
235             leaf: 10000000
236           networkName: { get_input: bng_gmux_private_net_id}
237           cidr: { get_input: bng_gmux_private_net_cidr }
238           dhcpEnabled: false
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         virtual_network_interface_requirements:
290           - name: dpdk support
291             support_mandatory: true
292             # TODO HPA
293             network_interface_requirements:
294               dataProcessingAccelerationLibrary: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "DPDK"}'
295       requirements:
296         - virtual_binding: VDU_vbng_0
297         - virtual_link: VL_brgemu_bng_private_net
298
299     Cp_vbng_cpe_signal:
300       type: tosca.nodes.nfv.VduCp
301       properties:
302         layer_protocol: [ipv4]
303         trunk_mode: false
304         protocol_data:
305           - asscociated_layer_protocol: ipv4
306             address_data:
307               address_type: ip_address
308               l3_address_data:
309                 ip_address_assignment: false
310                 floating_ip_activated: false
311                 fixed_ip_address:
312                   - { get_input: vbng_private_ip_2 }
313       requirements:
314         - virtual_binding: VDU_vbng_0
315         - virtual_link: VL_cpe_signal
316
317     Cp_vbng_bng_gmux_private_net:
318       type: tosca.nodes.nfv.VduCp
319       properties:
320         layer_protocol: [ipv4]
321         trunk_mode: false
322         protocol_data:
323           - asscociated_layer_protocol: ipv4
324             address_data:
325               address_type: ip_address
326               l3_address_data:
327                 ip_address_assignment: false
328                 floating_ip_activated: false
329                 fixed_ip_address:
330                   - { get_input: vbng_private_ip_3 }
331         virtual_network_interface_requirements:
332           - name: dpdk support
333             support_mandatory: true
334             # TODO HPA
335             network_interface_requirements:
336               dataProcessingAccelerationLibrary: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "DPDK"}'
337       requirements:
338         - virtual_binding: VDU_vbng_0
339         - virtual_link: VL_bng_gmux_private_net
340
341     VirtualStorage_root_all:
342       # this indicate the VDU root storage size
343       type: tosca.nodes.nfv.Vdu.VirtualStorage
344       properties:
345         type_of_storage: root
346         size_of_storage: 40 GB
347
348     VDU_vbng_0:
349       type: tosca.nodes.nfv.Vdu.Compute
350       properties:
351         name: { get_input: vbng_name_0 }
352         description: vbng
353         configurable_properties:
354           additional_vnfc_configurable_properties: {}
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/keys/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         user_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               # HPA requirements
424               vdu_memory_requirements:
425                 memoryPageSize: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "2 MB"}'
426                 numberOfPages: '{"schemaVersion": "0","schemaSelector": "","hardwarePlatform": "generic","mandatory": "true", "configurationValue": "1024"}'
427             virtual_cpu:
428               num_virtual_cpu: 2
429               cpu_architecture: generic
430       requirements:
431         - virtual_storage: VirtualStorage_root_all
432       artifacts:
433         sw_image: #TODO need to put glance image name here
434           #file: { get_input: vcpe_image_name }
435           file: ../Artifacts/images/ubuntu_16.04
436           type: tosca.artifacts.nfv.SwImage