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