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