fix tosca template bugs
[modeling/etsicatalog.git] / catalog / pub / utils / toscaparser / testdata / vnf / vcpedpdk / vgmux / Definitions / 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       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     bng_gmux_private_net_id:
73       type: string
74       description: Private network that connects vBNG to vGMUX
75       default: zdfw1bngmux01_private
76     bng_gmux_private_net_cidr:
77       type: string
78       description: The CIDR of the vBNG-vGMUX private network
79       default: 10.1.0.0/24
80     mux_gw_private_net_id:
81       type: string
82       description: Private network that connects vGMUX to vGWs
83       default: zdfw1muxgw01_private
84     mux_gw_private_net_cidr:
85       type: string
86       description: The CIDR of the vGMUX private network
87       default: 10.5.0.0/24
88     brgemu_bng_private_net_cidr:
89       type: string
90       description: The CIDR of the vBRG-vBNG private network
91       default: 10.3.0.0/24
92     vgmux_private_ip_0:
93       type: string
94       description: Private IP address that is assigned to the vGMUX to communicate with the vBNG
95       default: 10.1.0.20
96     vgmux_private_ip_1:
97       type: string
98       description: Private IP address that is assigned to the vGMUX to communicate with ONAP components
99       default: 10.0.101.20
100     vgmux_private_ip_2:
101       type: string
102       description: Private IP address that is assigned to the vGMUX to communicate with vGWs
103       default: 10.5.0.20
104     vgmux_name_0:
105       type: string
106       description: Name of the vGMUX
107       default: zdcpe1cpe01mux01
108     vnf_id:
109       type: string
110       description: The VNF ID is provided by ONAP
111       default: vCPE_Infrastructure_vGMUX_demo_app
112     vf_module_id:
113       type: string
114       description: The vCPE Module ID is provided by ONAP
115       default: vCPE_Intrastructure_Metro_vGMUX
116     bng_gmux_private_ip:
117       type: string
118       description: Private IP address that is assigned to the vBNG to communicate with the vGMUX
119       default: 10.1.0.10
120     dcae_collector_ip:
121       type: string
122       description: dcae collector ip
123       default: 10.0.4.102
124     dcae_collector_port:
125       type: integer
126       description: dcae collector port
127       default: 8080
128     pub_key:
129       type: string
130       description: ssh public key
131       default: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGx6SKrAuCz1V8KGevZueksLdWoPWJP6z3r29Z7TmPVEOjM+7PIPeSs2BVRx3rnHZBAlasMrZ+fJBS25ts9vfC+ItezQah/hr9vrkmwxCR54Lb84poW+sToPeF6i5eZY7W+jWJfLaFSFx9d2vp4zes/fOlT3NvYCXbn/3QdryQoGl7VFI8oemZypVcikZXElJeeKgAVdSwnrzuqtO/tmbXcAeSbYvVjki8ywYcsWMVMYWUWhh+1BAB6kXnTsIWqzrq0Pfvy+81WDwtiqsqmd93HY8hE0scBrXFBZzQS/AYfIFBlEuFNdLczchntjbZ0n7dmDXk8zHtCZYNk7kwb8k/
132     install_script_version:
133       type: string
134       description: install script version number
135       default: 1.2.0-SNAPSHOT
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     cloud_env:
141       type: string
142       description: cloud environment(openstack or rackspace)
143       default: openstack
144
145   node_templates:
146     #onap public net
147 #    VL_public:
148 #      type: tosca.nodes.nfv.VnfVirtualLink
149 #      properties:
150 #        connectivity_type:
151 #          layer_protocol: ipv4
152 #        vl_profile:
153 #          max_bit_rate_requirements:
154 #            root: 10000000
155 #            leaf: 10000000
156 #          min_bit_rate_requirements:
157 #            root: 10000000
158 #            leaf: 10000000
159 #          networkName: { get_input: public_net_id }
160 #
161 #    #onap oam net
162 #    VL_onap_private:
163 #      type: tosca.nodes.nfv.VnfVirtualLink
164 #      properties:
165 #        connectivity_type:
166 #          layer_protocol: ipv4
167 #        vl_profile:
168 #          max_bit_rate_requirements:
169 #            root: 10000000
170 #            leaf: 10000000
171 #          min_bit_rate_requirements:
172 #            root: 10000000
173 #            leaf: 10000000
174 #          networkName: { get_input: onap_private_net_id }
175 #          cidr: { get_input: onap_private_net_cidr }
176
177     #Private network that connects vBNG to vGMUX
178     VL_bng_gmux_private_net:
179       type: tosca.nodes.nfv.VnfVirtualLink
180       properties:
181         connectivity_type:
182           layer_protocol: ipv4
183         vl_profile:
184           max_bit_rate_requirements:
185             root: 10000000
186             leaf: 10000000
187           min_bit_rate_requirements:
188             root: 10000000
189             leaf: 10000000
190           networkName: { get_input: bng_gmux_private_net_id}
191           cidr: { get_input: bng_gmux_private_net_cidr }
192           dhcpEnabled: false
193
194     #Private network that connects vGMUX to vGWs
195     VL_mux_gw_private_net:
196       type: tosca.nodes.nfv.VnfVirtualLink
197       properties:
198         connectivity_type:
199           layer_protocol: ipv4
200         vl_profile:
201           max_bit_rate_requirements:
202             root: 10000000
203             leaf: 10000000
204           min_bit_rate_requirements:
205             root: 10000000
206             leaf: 10000000
207           networkName: { get_input: mux_gw_private_net_id}
208           cidr: { get_input: mux_gw_private_net_cidr }
209           dhcpEnabled: false
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         virtual_network_interface_requirements:
261           - name: dpdk support
262             support_mandatory: true
263             #TODO HPA
264             network_interface_requirements:
265               dataProcessingAccelerationLibrary: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "DPDK"}'
266       requirements:
267         - virtual_binding: VDU_vgmux_0
268         - virtual_link: VL_bng_gmux_private_net
269
270     Cp_vgmux_mux_gw_private_net:
271       type: tosca.nodes.nfv.VduCp
272       properties:
273         layer_protocol: [ipv4]
274         trunk_mode: false
275         protocol_data:
276           - asscociated_layer_protocol: ipv4
277             address_data:
278               address_type: ip_address
279               l3_address_data:
280                 ip_address_assignment: false
281                 floating_ip_activated: false
282                 fixed_ip_address:
283                   - { get_input: vgmux_private_ip_2 }
284         virtual_network_interface_requirements:
285           - name: dpdk support
286             support_mandatory: true
287             #TODO HPA
288             network_interface_requirements:
289               dataProcessingAccelerationLibrary: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "DPDK"}'
290       requirements:
291         - virtual_binding: VDU_vgmux_0
292         - virtual_link: VL_mux_gw_private_net
293
294     VirtualStorage_root_all:
295       # this indicate the VDU root storage size
296       type: tosca.nodes.nfv.Vdu.VirtualStorage
297       properties:
298         type_of_storage: root
299         size_of_storage: 40 GB
300
301     VDU_vgmux_0:
302       type: tosca.nodes.nfv.Vdu.Compute
303       properties:
304         name: { get_input: vgmux_name_0 }
305         description: vgmux
306         configurable_properties:
307           additional_vnfc_configurable_properties: {}
308         vdu_profile:
309           min_number_of_instances: 1
310           max_number_of_instances: 1
311           watchdog: none
312         inject_files: #TODO SDC bug
313           source_path: ../Artifacts/keys/authorized_keys #SSH authorized_keys
314           dest_path: /home/ubuntu/.ssh/authorized_keys
315         meta_data:
316           vnf_id: { get_input: vnf_id }
317           vf_module_id: { get_input: vf_module_id }
318           mux_to_bng_net_ipaddr: { get_input: vgmux_private_ip_0 }
319           oam_ipaddr: { get_input: vgmux_private_ip_1 }
320           mux_gw_net_ipaddr: { get_input: vgmux_private_ip_2 }
321           bng_to_mux_net_ipaddr: { get_input: bng_gmux_private_ip }
322           bng_mux_net_cidr: { get_input: bng_gmux_private_net_cidr }
323           oam_cidr: { get_input: onap_private_net_cidr }
324           mux_gw_net_cidr: { get_input: mux_gw_private_net_cidr }
325           brg_bng_net_cidr: { get_input: brgemu_bng_private_net_cidr }
326           install_script_version: { get_input: install_script_version }
327           cloud_env: { get_input: cloud_env }
328           nexus_artifact_repo: { get_input: nexus_artifact_repo }
329         user_data: |
330           #!/bin/bash
331           METADATA=`curl -s http://169.254.169.254/openstack/2012-08-10/meta_data.json`
332           apt-get -y install jq
333
334           get_metadata () {
335             echo $METADATA | jq -r ".meta.$1"
336           }
337
338           # Create configuration files
339           mkdir /opt/config
340           echo "$(get_metadata mux_to_bng_net_ipaddr)" > /opt/config/mux_to_bng_net_ipaddr.txt
341           echo "$(get_metadata oam_ipaddr)" > /opt/config/oam_ipaddr.txt
342           echo "$(get_metadata mux_gw_net_ipaddr)" > /opt/config/mux_gw_net_ipaddr.txt
343           echo "$(get_metadata bng_to_mux_net_ipaddr)" > /opt/config/bng_to_mux_net_ipaddr.txt
344           echo "$(get_metadata bng_mux_net_cidr)" > /opt/config/bng_mux_net_cidr.txt
345           echo "$(get_metadata oam_cidr)" > /opt/config/oam_cidr.txt
346           echo "$(get_metadata mux_gw_net_cidr)" > /opt/config/mux_gw_net_cidr.txt
347           echo "$(get_metadata brg_bng_net_cidr)" > /opt/config/brg_bng_net_cidr.txt
348           echo "$(get_metadata install_script_version)" > /opt/config/install_script_version.txt
349           echo "$(get_metadata cloud_env)" > /opt/config/cloud_env.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_gmux_install.sh
359           cd /opt
360           chmod +x v_gmux_install.sh
361           ./v_gmux_install.sh
362       capabilities:
363         virtual_compute:
364           properties:
365             virtual_memory:
366               virtual_mem_size: 4096 MB
367               # HPA requirements
368               vdu_memory_requirements:
369                 memoryPageSize: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "2 MB"}'
370                 numberOfPages: '{"schemaVersion": "0","schemaSelector": "","hardwarePlatform": "generic","mandatory": "true", "configurationValue": "1024"}'
371             virtual_cpu:
372               num_virtual_cpu: 2
373               cpu_architecture: generic
374       requirements:
375         - virtual_storage: VirtualStorage_root_all
376       artifacts:
377         sw_image: #TODO need to put glance image name here
378           #file: { get_input: vcpe_image_name }
379           file: ../Artifacts/images/ubuntu_16.04
380           type: tosca.artifacts.nfv.SwImage
381