3fda350cdbcd13a5c5f54323af4c47024adc6dde
[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: string
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: string
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     #onap public net
126 #    VL_public:
127 #      type: tosca.nodes.nfv.VnfVirtualLink
128 #      properties:
129 #        connectivity_type:
130 #          layer_protocols: [ipv4]
131 #        vl_profile:
132 #          max_bitrate_requirements:
133 #            root: 10000000
134 #            leaf: 10000000
135 #          min_bitrate_requirements:
136 #            root: 10000000
137 #            leaf: 10000000
138 #          virtual_link_protocol_data:
139 #            - associated_layer_protocol: ipv4
140 #              l3_protocol_data:
141 #                ip_version: ipv4
142 #                name: { get_input: public_net_id }
143 #
144 #    #onap oam net
145 #    VL_onap_private:
146 #      type: tosca.nodes.nfv.VnfVirtualLink
147 #      properties:
148 #        connectivity_type:
149 #          layer_protocols: [ipv4]
150 #        vl_profile:
151 #          max_bitrate_requirements:
152 #            root: 10000000
153 #            leaf: 10000000
154 #          min_bitrate_requirements:
155 #            root: 10000000
156 #            leaf: 10000000
157 #          virtual_link_protocol_data:
158 #            - associated_layer_protocol: ipv4
159 #              l3_protocol_data:
160 #                ip_version: ipv4
161 #                name: { get_input: onap_private_net_id }
162 #                cidr: { get_input: onap_private_net_cidr }
163
164     #Private network that connects vGMUX to vGWs
165     VL_mux_gw_private_net:
166       type: tosca.nodes.nfv.VnfVirtualLink
167       properties:
168         connectivity_type:
169           layer_protocols: [ipv4]
170         vl_profile:
171           max_bitrate_requirements:
172             root: 10000000
173             leaf: 10000000
174           min_bitrate_requirements:
175             root: 10000000
176             leaf: 10000000
177           virtual_link_protocol_data:
178             - associated_layer_protocol: ipv4
179               l3_protocol_data:
180                 name: { get_input: mux_gw_private_net_id }
181                 ip_version: ipv4
182                 cidr: { get_input: mux_gw_private_net_cidr }
183                 dhcp_enabled: false
184
185     #cpe public network
186     VL_cpe_public:
187       type: tosca.nodes.nfv.VnfVirtualLink
188       properties:
189         connectivity_type:
190           layer_protocols: [ipv4]
191         vl_profile:
192           max_bitrate_requirements:
193             root: 10000000
194             leaf: 10000000
195           min_bitrate_requirements:
196             root: 10000000
197             leaf: 10000000
198           virtual_link_protocol_data:
199             - associated_layer_protocol: ipv4
200               l3_protocol_data:
201                 name: { get_input: cpe_public_net_id }
202                 ip_version: ipv4
203                 cidr: { get_input: cpe_public_net_cidr }
204                 dhcp_enabled: false
205
206     # vgw related
207     Cp_vgw_public:
208       type: tosca.nodes.nfv.VduCp
209       properties:
210         layer_protocols: [ipv4]
211         trunk_mode: false
212         protocol:
213           - associated_layer_protocol: ipv4
214             address_data:
215               - address_type: ip_address
216                 l3_address_data:
217                   ip_address_assignment: false
218                   floating_ip_activated: false
219       requirements:
220         - virtual_binding: VDU_vgw_0
221         #- virtual_link: VL_public
222
223     Cp_vgw_onap_private:
224       type: tosca.nodes.nfv.VduCp
225       properties:
226         layer_protocols: [ipv4]
227         trunk_mode: false
228         protocol:
229           - associated_layer_protocol: ipv4
230             address_data:
231               - address_type: ip_address
232                 l3_address_data:
233                   ip_address_assignment: false
234                   floating_ip_activated: false
235                   fixed_ip_address:
236                     - { get_input: vgw_private_ip_1 }
237       requirements:
238         - virtual_binding: VDU_vgw_0
239         #- virtual_link: VL_onap_private
240
241     Cp_vgw_mux_gw_private_net:
242       type: tosca.nodes.nfv.VduCp
243       properties:
244         layer_protocols: [ipv4]
245         trunk_mode: false
246         protocol:
247           - associated_layer_protocol: ipv4
248             address_data:
249               - address_type: ip_address
250                 l3_address_data:
251                   ip_address_assignment: false
252                   floating_ip_activated: false
253                   fixed_ip_address:
254                     - { get_input: vgw_private_ip_0 }
255         virtual_network_interface_requirements:
256           - name: dpdk support
257             support_mandatory: true
258             network_interface_requirements:
259               dataProcessingAccelerationLibrary: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "DPDK"}'
260       requirements:
261         - virtual_binding: VDU_vgw_0
262         - virtual_link: VL_mux_gw_private_net
263
264     Cp_vgw_cpe_public:
265       type: tosca.nodes.nfv.VduCp
266       properties:
267         layer_protocols: [ipv4]
268         trunk_mode: false
269         protocol:
270           - associated_layer_protocol: ipv4
271             address_data:
272               - address_type: ip_address
273                 l3_address_data:
274                   ip_address_assignment: false
275                   floating_ip_activated: false
276                   fixed_ip_address:
277                     - { get_input: vgw_private_ip_2 }
278       requirements:
279         - virtual_binding: VDU_vgw_0
280         - virtual_link: VL_cpe_public
281
282     VDU_vgw_0:
283       type: tosca.nodes.nfv.Vdu.Compute
284       properties:
285         name: { get_input: vgw_name_0 }
286         description: vgw
287         vdu_profile:
288           min_number_of_instances: 1
289           max_number_of_instances: 1
290           watchdog: none
291         inject_files: # TODO SDC BUG
292           source_path: ../Artifacts/Deployment/OTHER/authorized_keys #SSH authorized_keys
293           dest_path: /home/ubuntu/.ssh/authorized_keys
294         meta_data:
295           vnf_id: { get_input: vnf_id }
296           vf_module_id: { get_input: vf_module_id }
297           mux_gw_private_net_ipaddr: { get_input: vgw_private_ip_0 }
298           oam_ipaddr: { get_input: vgw_private_ip_1 }
299           oam_cidr: { get_input: onap_private_net_cidr }
300           cpe_public_net_cidr: { get_input: cpe_public_net_cidr }
301           mux_gw_private_net_cidr: { get_input: mux_gw_private_net_cidr }
302           mux_ip_addr: { get_input: mux_ip_addr }
303           vg_vgmux_tunnel_vni: { get_input: vg_vgmux_tunnel_vni }
304           install_script_version: { get_input: install_script_version }
305           cloud_env: { get_input: cloud_env }
306           nexus_artifact_repo: { get_input: nexus_artifact_repo }
307         boot_data: |
308           #!/bin/bash
309           METADATA=`curl -s http://169.254.169.254/openstack/2012-08-10/meta_data.json`
310           apt-get -y install jq
311
312           get_metadata () {
313             echo $METADATA | jq -r ".meta.$1"
314           }
315
316           # Create configuration files
317           mkdir /opt/config
318           echo "$(get_metadata oam_ipaddr)" > /opt/config/oam_ipaddr.txt
319           echo "$(get_metadata oam_cidr)" > /opt/config/oam_cidr.txt
320           echo "$(get_metadata cpe_public_net_cidr)" > /opt/config/cpe_public_net_cidr.txt
321           echo "$(get_metadata mux_gw_private_net_ipaddr)" > /opt/config/mux_gw_private_net_ipaddr.txt
322           echo "$(get_metadata mux_gw_private_net_cidr)" > /opt/config/mux_gw_private_net_cidr.txt
323           echo "$(get_metadata install_script_version)" > /opt/config/install_script_version.txt
324           echo "$(get_metadata cloud_env)" > /opt/config/cloud_env.txt
325           echo "$(get_metadata mux_ip_addr)" > /opt/config/mux_ip_addr.txt
326           echo "$(get_metadata vg_vgmux_tunnel_vni)" > /opt/config/vg_vgmux_tunnel_vni.txt
327           echo "$(get_metadata nexus_artifact_repo)" > /opt/config/nexus_artifact_repo.txt
328
329           # Download and run install script
330           apt-get -y install unzip
331           INSTALL_SCRIPT_VERSION=$(get_metadata install_script_version)
332           NEXUS_ARTIFACT_REPO=$(get_metadata nexus_artifact_repo)
333           if [[ "${INSTALL_SCRIPT_VERSION}" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi
334           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
335           unzip -j /opt/vcpe-scripts-${INSTALL_SCRIPT_VERSION}.zip -d /opt v_gw_install.sh
336           cd /opt
337           chmod +x v_gw_install.sh
338           ./v_gw_install.sh
339       capabilities:
340         virtual_compute:
341           properties:
342             virtual_memory:
343               virtual_mem_size: 4096 MB
344               vdu_mem_requirements:
345                 memoryPageSize: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "2 MB"}'
346                 numberOfPages: '{"schemaVersion": "0","schemaSelector": "","hardwarePlatform": "generic","mandatory": "true", "configurationValue": "1024"}'
347             virtual_cpu:
348               num_virtual_cpu: 2
349               cpu_architecture: generic
350             virtual_local_storage:
351               - size_of_storage: 40 GB
352       artifacts:
353         sw_image: #TODO need to put glance image name here
354           #file: { get_input: vcpe_image_name }
355           file: ../Artifacts/Deployment/OTHER/image
356           type: tosca.artifacts.nfv.SwImage