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