fix tosca template bugs
[modeling/etsicatalog.git] / catalog / pub / utils / toscaparser / testdata / vnf / vcpesriov / 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   VNFD_SCHEMA_VERSION: "2.5.1+1"
7 description: vCPE_vgw
8
9 imports:
10   - onap_dm.yaml
11
12 node_types:
13   onap.vcpe_vgw:
14     derived_from: tosca.nodes.nfv.VNF
15     properties:
16       descriptor_id:
17         type: string
18         constraints: [ valid_values: [ b1bb0ce7-2222-4fa7-95ed-4840d70a1177 ] ]
19         default: b1bb0ce7-2222-4fa7-95ed-4840d70a1177
20       provider:
21         type: string
22         constraints: [ valid_values: [ onap ] ]
23         default: onap
24       product_name:
25         type: string
26         constraints: [ valid_values: [ vcpe_vgw ] ]
27         default: vcpe_vgw
28       software_version:
29         type: string
30         constraints: [ valid_values: [ '1.0' ] ]
31         default: '1.0'
32       descriptor_version:
33         type: string
34         constraints: [ valid_values: [ '1.0' ] ]
35         default: '1.0'
36       flavour_id:
37         type: string
38         constraints: [ valid_values: [ simple ] ]  #only one and only allowed one DF in this example
39         default: simple
40       flavour_description:
41         type: string
42         default: ""
43       vnfm_info:
44         type: list
45         entry_schema:
46           type: string
47         default: ['gvnfm']
48     requirements:
49       - virtual_link_public:
50           capability: tosca.capabilities.nfv.VirtualLinkable
51           relationship: tosca.relationships.nfv.VirtualLinksTo
52           occurrences: [ 0, 1 ]     
53       - virtual_link_private:
54           capability: tosca.capabilities.nfv.VirtualLinkable
55           relationship: tosca.relationships.nfv.VirtualLinksTo
56           occurrences: [ 0, 1 ]     
57
58 topology_template:
59   substitution_mappings:
60     node_type: onap.vcpe_vgw
61     requirements:
62       virtual_link_public: [ Cp_vgw_public, virtual_link ] # expose as external CP
63
64   inputs:
65     vcpe_image_name:
66       type: string
67       description: image name for vcpe in openstack glance
68       default: ubuntu_16.04
69     public_net_id:
70       type: string
71       description: public network id used during onap installation
72       default: external
73     onap_private_net_id:
74       type: string
75       description: onap OAM network id
76       default: oam_onap
77     onap_private_net_cidr:
78       type: string
79       description: oanp OAM network cidr
80       default: 10.0.0.0/16
81     mux_gw_private_net_id:
82       type: string
83       description: Private network that connects vGMUX to vGWs
84       default: zdfw1muxgw01_private
85     mux_gw_private_net_cidr:
86       type: string
87       description: he CIDR of the vGMUX private network
88       default: 10.5.0.0/24
89     cpe_public_net_id:
90       type: string
91       description: cpe public net name
92       default: zdfw1cpe01_public
93     cpe_public_net_cidr:
94       type: string
95       description: cpe public net cidr
96       default: 10.2.0.0/24
97     vgw_private_ip_0:
98       type: string
99       description: Private IP address that is assigned to the vGW to communicate with vGMUX
100       default: 10.5.0.21
101     vgw_private_ip_1:
102       type: string
103       description: Private IP address that is assigned to the vGW to communicate with ONAP components
104       default: 10.0.101.30
105     vgw_private_ip_2:
106       type: string
107       description: Private IP address that is assigned to the vGW to communicate with vCPE public network
108       default: 10.2.0.3
109     vgw_name_0:
110       type: string
111       description: Name of the vGW
112       default: zdcpe1cpe01gw01
113     dcae_collector_ip:
114       type: string
115       description: dcae collector ip
116       default: 10.0.4.102
117     dcae_collector_port:
118       type: string
119       description: dcae collector port
120       default: "8080"
121     pub_key:
122       type: string
123       description: ssh public key
124       default: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGx6SKrAuCz1V8KGevZueksLdWoPWJP6z3r29Z7TmPVEOjM+7PIPeSs2BVRx3rnHZBAlasMrZ+fJBS25ts9vfC+ItezQah/hr9vrkmwxCR54Lb84poW+sToPeF6i5eZY7W+jWJfLaFSFx9d2vp4zes/fOlT3NvYCXbn/3QdryQoGl7VFI8oemZypVcikZXElJeeKgAVdSwnrzuqtO/tmbXcAeSbYvVjki8ywYcsWMVMYWUWhh+1BAB6kXnTsIWqzrq0Pfvy+81WDwtiqsqmd93HY8hE0scBrXFBZzQS/AYfIFBlEuFNdLczchntjbZ0n7dmDXk8zHtCZYNk7kwb8k/
125     nexus_artifact_repo:
126       type: string
127       description: Root URL for the Nexus repository for Maven artifacts
128       default: https://nexus.onap.org
129     demo_artifacts_version:
130       type: string
131       description: artifacts version used in demo vnfs
132       default: 1.2.0
133     install_script_version:
134       type: string
135       description: install script version number
136       default: 1.2.0-SNAPSHOT
137     cloud_env:
138       type: string
139       description: cloud environment(openstack or rackspace)
140       default: openstack
141     mux_ip_addr:
142       type: string
143       description: IP address of vGMUX
144       default: 10.5.0.20
145     vg_vgmux_tunnel_vni:
146       type: string
147       description: vni value of vG-vGMUX vxlan tunnel
148       default: "100"
149     vnf_id:
150       type: string
151       description: The VNF ID is provided by ONAP
152       default: vCPE_Infrastructure_GW_demo_app
153     vf_module_id:
154       type: string
155       description: The vCPE Module ID is provided by ONAP
156       default: vCPE_Customer_GW
157
158   node_templates:
159     LLU_VNF:
160       type: onap.vcpe_vgw
161       properties:
162         descriptor_id: b1bb0ce7-2222-4fa7-95ed-4840d70a1177
163         provider: onap
164         product_name: vcpe_vgw
165         software_version: '1.0'
166         descriptor_version: '1.0'
167         flavour_id: simple
168         flavour_description: simple
169         vnfm_info: ['gvnfm']
170
171     #Private network that connects vGMUX to vGWs
172     VL_mux_gw_private_net:
173       type: tosca.nodes.nfv.VnfVirtualLink
174       properties:
175         connectivity_type:
176           layer_protocols: [ipv4]
177         vl_profile:
178           max_bitrate_requirements:
179             root: 10000000
180             leaf: 10000000
181           min_bitrate_requirements:
182             root: 10000000
183             leaf: 10000000
184           virtual_link_protocol_data:
185             - associated_layer_protocol: ipv4
186               l3_protocol_data:
187                 name: { get_input: mux_gw_private_net_id }
188                 ip_version: ipv4
189                 cidr: { get_input: mux_gw_private_net_cidr }
190                 dhcp_enabled: false
191
192     #cpe public network
193     VL_cpe_public:
194       type: tosca.nodes.nfv.VnfVirtualLink
195       properties:
196         connectivity_type:
197           layer_protocols: [ipv4]
198         vl_profile:
199           max_bitrate_requirements:
200             root: 10000000
201             leaf: 10000000
202           min_bitrate_requirements:
203             root: 10000000
204             leaf: 10000000
205           virtual_link_protocol_data:
206             - associated_layer_protocol: ipv4
207               l3_protocol_data:
208                 name: { get_input: cpe_public_net_id }
209                 ip_version: ipv4
210                 cidr: { get_input: cpe_public_net_cidr }
211                 dhcp_enabled: false
212
213     # vgw related
214     Cp_vgw_public:
215       type: tosca.nodes.nfv.VduCp
216       properties:
217         layer_protocols: [ipv4]
218         trunk_mode: false
219         protocol:
220           - associated_layer_protocol: ipv4
221             address_data:
222               - address_type: ip_address
223                 l3_address_data:
224                   ip_address_assignment: false
225                   floating_ip_activated: false
226       requirements:
227         - virtual_binding: VDU_vgw_0
228         #- virtual_link: VL_public
229
230     Cp_vgw_mux_gw_private_net:
231       type: tosca.nodes.nfv.VduCp
232       properties:
233         layer_protocols: [ipv4]
234         trunk_mode: false
235         protocol:
236           - associated_layer_protocol: ipv4
237             address_data:
238               - address_type: ip_address
239                 l3_address_data:
240                   ip_address_assignment: false
241                   floating_ip_activated: false
242                   fixed_ip_address:
243                     - { get_input: vgw_private_ip_0 }
244         virtual_network_interface_requirements:
245           - name: dpdk support
246             support_mandatory: true
247             network_interface_requirements:
248               dataProcessingAccelerationLibrary: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "DPDK"}'
249       requirements:
250         - virtual_binding: VDU_vgw_0
251         - virtual_link: VL_mux_gw_private_net
252
253     Cp_vgw_cpe_public:
254       type: tosca.nodes.nfv.VduCp
255       properties:
256         layer_protocols: [ipv4]
257         trunk_mode: false
258         protocol:
259           - associated_layer_protocol: ipv4
260             address_data:
261               - address_type: ip_address
262                 l3_address_data:
263                   ip_address_assignment: false
264                   floating_ip_activated: false
265                   fixed_ip_address:
266                     - { get_input: vgw_private_ip_2 }
267       requirements:
268         - virtual_binding: VDU_vgw_0
269         - virtual_link: VL_cpe_public
270
271     VDU_vgw_0:
272       type: tosca.nodes.nfv.Vdu.Compute
273       properties:
274         name: { get_input: vgw_name_0 }
275         description: vgw
276         vdu_profile:
277           min_number_of_instances: 1
278           max_number_of_instances: 1
279           watchdog: none
280         inject_files: # TODO SDC BUG
281           source_path: ../Artifacts/Deployment/OTHER/authorized_keys #SSH authorized_keys
282           dest_path: /home/ubuntu/.ssh/authorized_keys
283         meta_data:
284           vnf_id: { get_input: vnf_id }
285           vf_module_id: { get_input: vf_module_id }
286           mux_gw_private_net_ipaddr: { get_input: vgw_private_ip_0 }
287           oam_ipaddr: { get_input: vgw_private_ip_1 }
288           oam_cidr: { get_input: onap_private_net_cidr }
289           cpe_public_net_cidr: { get_input: cpe_public_net_cidr }
290           mux_gw_private_net_cidr: { get_input: mux_gw_private_net_cidr }
291           mux_ip_addr: { get_input: mux_ip_addr }
292           vg_vgmux_tunnel_vni: { get_input: vg_vgmux_tunnel_vni }
293           install_script_version: { get_input: install_script_version }
294           cloud_env: { get_input: cloud_env }
295           nexus_artifact_repo: { get_input: nexus_artifact_repo }
296         boot_data: |
297           #!/bin/bash
298           METADATA=`curl -s http://169.254.169.254/openstack/2012-08-10/meta_data.json`
299           apt-get -y install jq
300
301           get_metadata () {
302             echo $METADATA | jq -r ".meta.$1"
303           }
304
305           # Create configuration files
306           mkdir /opt/config
307           echo "$(get_metadata oam_ipaddr)" > /opt/config/oam_ipaddr.txt
308           echo "$(get_metadata oam_cidr)" > /opt/config/oam_cidr.txt
309           echo "$(get_metadata cpe_public_net_cidr)" > /opt/config/cpe_public_net_cidr.txt
310           echo "$(get_metadata mux_gw_private_net_ipaddr)" > /opt/config/mux_gw_private_net_ipaddr.txt
311           echo "$(get_metadata mux_gw_private_net_cidr)" > /opt/config/mux_gw_private_net_cidr.txt
312           echo "$(get_metadata install_script_version)" > /opt/config/install_script_version.txt
313           echo "$(get_metadata cloud_env)" > /opt/config/cloud_env.txt
314           echo "$(get_metadata mux_ip_addr)" > /opt/config/mux_ip_addr.txt
315           echo "$(get_metadata vg_vgmux_tunnel_vni)" > /opt/config/vg_vgmux_tunnel_vni.txt
316           echo "$(get_metadata nexus_artifact_repo)" > /opt/config/nexus_artifact_repo.txt
317
318           # Download and run install script
319           apt-get -y install unzip
320           INSTALL_SCRIPT_VERSION=$(get_metadata install_script_version)
321           NEXUS_ARTIFACT_REPO=$(get_metadata nexus_artifact_repo)
322           if [[ "${INSTALL_SCRIPT_VERSION}" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi
323           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
324           unzip -j /opt/vcpe-scripts-${INSTALL_SCRIPT_VERSION}.zip -d /opt v_gw_install.sh
325           cd /opt
326           chmod +x v_gw_install.sh
327           ./v_gw_install.sh
328       capabilities:
329         virtual_compute:
330           properties:
331             virtual_memory:
332               virtual_mem_size: 4096 MB
333               vdu_mem_requirements:
334                 memoryPageSize: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "2 MB"}'
335                 numberOfPages: '{"schemaVersion": "0","schemaSelector": "","hardwarePlatform": "generic","mandatory": "true", "configurationValue": "1024"}'
336             virtual_cpu:
337               num_virtual_cpu: 2
338               cpu_architecture: generic
339             virtual_local_storage:
340               - size_of_storage: 40 GB
341       artifacts:
342         sw_image: #TODO need to put glance image name here
343           #file: { get_input: vcpe_image_name }
344           file: ../Artifacts/Deployment/OTHER/image
345           type: tosca.artifacts.nfv.SwImage