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