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