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