b192bd69ba8b92d0957105facf8afb98c661d545
[demo.git] / tosca / vCPE / vbng / MainServiceTemplate.yaml
1 tosca_definitions_version: tosca_simple_yaml_1_0
2 metadata:
3   template_name: vCPE_vbng
4   template_version: "1.0"
5   template_author: onap
6 description: vCPE_vbng
7
8 imports:
9   - onap_dm.yaml
10
11 node_types:
12   onap.vcpe_vbng:
13     derived_from: tosca.nodes.nfv.VNF
14     properties:
15       descriptor_id:
16         type: string
17         constraints: [ valid_values: [ b1bb0ce7-5555-4fa7-95ed-4840d70a1177 ] ]
18         default: b1bb0ce7-5555-4fa7-95ed-4840d70a1177
19       provider:
20         type: string
21         constraints: [ valid_values: [ onap ] ]
22         default: onap
23       product_name:
24         type: string
25         constraints: [ valid_values: [ vcpe_vbng ] ]
26         default: vcpe_vbng
27       software_version:
28         type: string
29         constraints: [ valid_values: [ '1.0' ] ]
30         default: '1.0'
31       descriptor_version:
32         type: string
33         constraints: [ valid_values: [ '1.0' ] ]
34         default: '1.0'
35       flavour_id:
36         type: string
37         constraints: [ valid_values: [ simple ] ]  #only one and only allowed one DF in this example
38         default: simple
39       flavour_description:
40         type: string
41         default: simple
42       vnfm_info:
43         type: list
44         entry_schema:
45           type: string
46         default: ['gvnfm']
47
48 topology_template:
49 #  substitution_mappings:
50 #    node_type: onap.vcpe_vbng
51 #    requirements:
52 #      virtual_link: [ Cp_vbng_public, virtual_link ] # expose as external CP
53 #      virtual_link: [ Cp_vbng_onap_private, virtual_link ] # expose as external CP
54
55   inputs:
56     vcpe_image_name:
57       type: string
58       description: image name for vcpe in openstack glance
59       default: ubuntu_16.04
60     public_net_id:
61       type: string
62       description: public network id used during onap installation
63       default: external
64     onap_private_net_id:
65       type: string
66       description: onap OAM network id
67       default: oam_onap
68     onap_private_net_cidr:
69       type: string
70       description: oanp OAM network cidr
71       default: 10.0.0.0/16
72     brgemu_bng_private_net_id:
73       type: string
74       description: Private network that connects vBRG to vBNG
75       default: zdfw1bngin01_private
76     brgemu_bng_private_net_cidr:
77       type: string
78       description: The CIDR of the input side of vBNG private network
79       default: 10.3.0.0/24
80     bng_gmux_private_net_id:
81       type: string
82       description: Private network that connects vBNG to vGMUX
83       default: zdfw1bngmux01_private
84     bng_gmux_private_net_cidr:
85       type: string
86       description: The CIDR of the input side of vGMUX private network
87       default: 10.1.0.0/24
88     cpe_signal_net_id:
89       type: string
90       description: Private network that connects vCPE elements with vCPE infrastructure elements
91       default: zdfw1cpe01_private
92     cpe_signal_private_net_cidr:
93       type: string
94       description: The CIDR of the vAAA private network
95       default: 10.4.0.0/24
96     vbng_private_ip_0:
97       type: string
98       description: Private IP address that is assigned to the vBNG IN
99       default: 10.3.0.1
100     vbng_private_ip_1:
101       type: string
102       description: Private IP address that is assigned to the vBNG to communicate with ONAP components
103       default: 10.0.101.10
104     vbng_private_ip_2:
105       type: string
106       description: Private IP address that is assigned to the vBNG in the CPE_SIGNAL network
107       default: 10.4.0.3
108     vbng_private_ip_3:
109       type: string
110       description: Private IP address that is assigned to the vBNG to vGMUX port
111       default: 10.1.0.10
112     vbng_name_0:
113       type: string
114       description: Name of the vBNG
115       default: zdcpe1cpe01bng01
116     vnf_id:
117       type: string
118       description: The VNF ID is provided by ONAP
119       default: vCPE_Infrastructure_Metro_vBNG_demo_app
120     vf_module_id:
121       type: string
122       description: The vCPE Module ID is provided by ONAP
123       default: vCPE_Intrastructure_Metro_vBNG
124     dcae_collector_ip:
125       type: string
126       description: dcae collector ip
127       default: 10.0.4.102
128     dcae_collector_port:
129       type: integer
130       description: dcae collector port
131       default: 8080
132     pub_key:
133       type: string
134       description: ssh public key
135       default: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGx6SKrAuCz1V8KGevZueksLdWoPWJP6z3r29Z7TmPVEOjM+7PIPeSs2BVRx3rnHZBAlasMrZ+fJBS25ts9vfC+ItezQah/hr9vrkmwxCR54Lb84poW+sToPeF6i5eZY7W+jWJfLaFSFx9d2vp4zes/fOlT3NvYCXbn/3QdryQoGl7VFI8oemZypVcikZXElJeeKgAVdSwnrzuqtO/tmbXcAeSbYvVjki8ywYcsWMVMYWUWhh+1BAB6kXnTsIWqzrq0Pfvy+81WDwtiqsqmd93HY8hE0scBrXFBZzQS/AYfIFBlEuFNdLczchntjbZ0n7dmDXk8zHtCZYNk7kwb8k/
136     nexus_artifact_repo:
137       type: string
138       description: Root URL for the Nexus repository for Maven artifacts
139       default: https://nexus.onap.org
140     demo_artifacts_version:
141       type: string
142       description: artifacts version used in demo vnfs
143       default: 1.2.0
144     install_script_version:
145       type: string
146       description: install script version number
147       default: 1.2.0-SNAPSHOT
148     cloud_env:
149       type: string
150       description: cloud environment(openstack or rackspace)
151       default: openstack
152     sdnc_ip_addr:
153       type: string
154       description: IP address of the SDNC
155       default: 10.0.7.1
156
157   node_templates:
158     #onap public net
159 #    VL_public:
160 #      type: tosca.nodes.nfv.VnfVirtualLink
161 #      properties:
162 #        connectivity_type:
163 #          layer_protocol: ipv4
164 #        vl_profile:
165 #          max_bit_rate_requirements:
166 #            root: 10000000
167 #            leaf: 10000000
168 #          min_bit_rate_requirements:
169 #            root: 10000000
170 #            leaf: 10000000
171 #          networkName: { get_input: public_net_id }
172 #
173 #    #onap oam net
174 #    VL_onap_private:
175 #      type: tosca.nodes.nfv.VnfVirtualLink
176 #      properties:
177 #        connectivity_type:
178 #          layer_protocol: ipv4
179 #        vl_profile:
180 #          max_bit_rate_requirements:
181 #            root: 10000000
182 #            leaf: 10000000
183 #          min_bit_rate_requirements:
184 #            root: 10000000
185 #            leaf: 10000000
186 #          networkName: { get_input: onap_private_net_id }
187 #          cidr: { get_input: onap_private_net_cidr }
188
189     #Private network that connects vBRG to vBNG
190     VL_brgemu_bng_private_net:
191       type: tosca.nodes.nfv.VnfVirtualLink
192       properties:
193         connectivity_type:
194           layer_protocol: ipv4
195         vl_profile:
196           max_bit_rate_requirements:
197             root: 10000000
198             leaf: 10000000
199           min_bit_rate_requirements:
200             root: 10000000
201             leaf: 10000000
202           networkName: { get_input: brgemu_bng_private_net_id}
203           cidr: { get_input: brgemu_bng_private_net_cidr }
204           dhcpEnabled: false
205
206     #cpe signal network
207     VL_cpe_signal:
208       type: tosca.nodes.nfv.VnfVirtualLink
209       properties:
210         connectivity_type:
211           layer_protocol: ipv4
212         vl_profile:
213           max_bit_rate_requirements:
214             root: 10000000
215             leaf: 10000000
216           min_bit_rate_requirements:
217             root: 10000000
218             leaf: 10000000
219           networkName: { get_input: cpe_signal_net_id}
220           cidr: { get_input: cpe_signal_private_net_cidr }
221           dhcpEnabled: false
222
223     #Private network that connects vBNG to vGMUX
224     VL_bng_gmux_private_net:
225       type: tosca.nodes.nfv.VnfVirtualLink
226       properties:
227         connectivity_type:
228           layer_protocol: ipv4
229         vl_profile:
230           max_bit_rate_requirements:
231             root: 10000000
232             leaf: 10000000
233           min_bit_rate_requirements:
234             root: 10000000
235             leaf: 10000000
236           networkName: { get_input: bng_gmux_private_net_id}
237           cidr: { get_input: bng_gmux_private_net_cidr }
238           dhcpEnabled: false
239
240     # vbng related
241     Cp_vbng_public:
242       type: tosca.nodes.nfv.VduCp
243       properties:
244         layer_protocol: [ipv4]
245         trunk_mode: false
246         protocol_data:
247           - asscociated_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       requirements:
254         - virtual_binding: VDU_vbng_0
255         #- virtual_link: VL_public
256
257     Cp_vbng_onap_private:
258       type: tosca.nodes.nfv.VduCp
259       properties:
260         layer_protocol: [ipv4]
261         trunk_mode: false
262         protocol_data:
263           - asscociated_layer_protocol: ipv4
264             address_data:
265               address_type: ip_address
266               l3_address_data:
267                 ip_address_assignment: false
268                 floating_ip_activated: false
269                 fixed_ip_address:
270                   - { get_input: vbng_private_ip_1 }
271       requirements:
272         - virtual_binding: VDU_vbng_0
273         #- virtual_link: VL_onap_private
274
275     Cp_vbng_brgemu_bng_private_net:
276       type: tosca.nodes.nfv.VduCp
277       properties:
278         layer_protocol: [ipv4]
279         trunk_mode: false
280         protocol_data:
281           - asscociated_layer_protocol: ipv4
282             address_data:
283               address_type: ip_address
284               l3_address_data:
285                 ip_address_assignment: false
286                 floating_ip_activated: false
287                 fixed_ip_address:
288                   - { get_input: vbng_private_ip_0 }
289         virtual_network_interface_requirements:
290           - name: dpdk support
291             support_mandatory: true
292             # TODO HPA
293             network_interface_requirements:
294               #dataProcessingAccelerationLibrary: dpdk_2.2
295               interfaceType: virtio
296       requirements:
297         - virtual_binding: VDU_vbng_0
298         - virtual_link: VL_brgemu_bng_private_net
299
300     Cp_vbng_cpe_signal:
301       type: tosca.nodes.nfv.VduCp
302       properties:
303         layer_protocol: [ipv4]
304         trunk_mode: false
305         protocol_data:
306           - asscociated_layer_protocol: ipv4
307             address_data:
308               address_type: ip_address
309               l3_address_data:
310                 ip_address_assignment: false
311                 floating_ip_activated: false
312                 fixed_ip_address:
313                   - { get_input: vbng_private_ip_2 }
314       requirements:
315         - virtual_binding: VDU_vbng_0
316         - virtual_link: VL_cpe_signal
317
318     Cp_vbng_bng_gmux_private_net:
319       type: tosca.nodes.nfv.VduCp
320       properties:
321         layer_protocol: [ipv4]
322         trunk_mode: false
323         protocol_data:
324           - asscociated_layer_protocol: ipv4
325             address_data:
326               address_type: ip_address
327               l3_address_data:
328                 ip_address_assignment: false
329                 floating_ip_activated: false
330                 fixed_ip_address:
331                   - { get_input: vbng_private_ip_3 }
332         virtual_network_interface_requirements:
333           - name: dpdk support
334             support_mandatory: true
335             # TODO HPA
336             network_interface_requirements:
337               #dataProcessingAccelerationLibrary: dpdk_2.2
338               interfaceType: virtio
339       requirements:
340         - virtual_binding: VDU_vbng_0
341         - virtual_link: VL_bng_gmux_private_net
342
343     VirtualStorage_root_all:
344       # this indicate the VDU root storage size
345       type: tosca.nodes.nfv.Vdu.VirtualStorage
346       properties:
347         type_of_storage: root
348         size_of_storage: 40 GB
349
350     VDU_vbng_0:
351       type: tosca.nodes.nfv.Vdu.Compute
352       properties:
353         name: { get_input: vbng_name_0 }
354         description: vbng
355         configurable_properties:
356           additional_vnfc_configurable_properties: {}
357         vdu_profile:
358           min_number_of_instances: 1
359           max_number_of_instances: 1
360           watchdog: none
361         inject_files: #TODO SDC bug
362           source_path: ../Artifacts/keys/authorized_keys #SSH authorized_keys
363           dest_path: /home/ubuntu/.ssh/authorized_keys
364         meta_data:
365           vnf_id: { get_input: vnf_id }
366           vf_module_id: { get_input: vf_module_id }
367
368           brgemu_bng_net_ipaddr: { get_input: vbng_private_ip_0 }
369           cpe_signal_net_ipaddr: { get_input: vbng_private_ip_2 }
370           bng_gmux_net_ipaddr: { get_input: vbng_private_ip_3 }
371           oam_ipaddr: { get_input: vbng_private_ip_1 }
372           oam_cidr: { get_input: oam_private_net_cidr }
373           bng_gmux_cidr: { get_input: bng_gmux_private_net_cidr }
374           cpe_signal_cidr: { get_input: cpe_signal_private_net_cidr }
375           brgemu_bng_cidr: { get_input: brgemu_bng_private_net_cidr }
376           dcae_collector_ip: { get_input: dcae_collector_ip }
377           dcae_collector_port: { get_input: dcae_collector_port }
378           demo_artifacts_version: { get_input: demo_artifacts_version }
379           install_script_version: { get_input: install_script_version }
380           sdnc_ip: { get_input: sdnc_ip }
381           cloud_env: { get_input: cloud_env }
382           nexus_artifact_repo: { get_input: nexus_artifact_repo }
383         user_data: |
384           #!/bin/bash
385           METADATA=`curl -s http://169.254.169.254/openstack/2012-08-10/meta_data.json`
386           apt-get -y install jq
387
388           get_metadata () {
389             echo $METADATA | jq -r ".meta.$1"
390           }
391
392           # Create configuration files
393           mkdir /opt/config
394           echo "$(get_metadata brgemu_bng_net_ipaddr)" > /opt/config/brgemu_bng_net_ipaddr.txt
395           echo "$(get_metadata cpe_signal_net_ipaddr)" > /opt/config/cpe_signal_net_ipaddr.txt
396           echo "$(get_metadata bng_gmux_net_ipaddr)" > /opt/config/bng_gmux_net_ipaddr.txt
397           echo "$(get_metadata oam_ipaddr)" > /opt/config/oam_ipaddr.txt
398           echo "$(get_metadata oam_cidr)" > /opt/config/oam_cidr.txt
399           echo "$(get_metadata bng_gmux_cidr)" > /opt/config/bng_gmux_net_cidr.txt
400           echo "$(get_metadata cpe_signal_cidr)" > /opt/config/cpe_signal_net_cidr.txt
401           echo "$(get_metadata brgemu_bng_cidr)" > /opt/config/brgemu_bng_net_cidr.txt
402           echo "$(get_metadata dcae_collector_ip)" > /opt/config/dcae_collector_ip.txt
403           echo "$(get_metadata dcae_collector_port)" > /opt/config/dcae_collector_port.txt
404           echo "$(get_metadata demo_artifacts_version)" > /opt/config/demo_artifacts_version.txt
405           echo "$(get_metadata install_script_version)" > /opt/config/install_script_version.txt
406           echo "$(get_metadata cloud_env)" > /opt/config/cloud_env.txt
407           echo "$(get_metadata sdnc_ip)" > /opt/config/sdnc_ip.txt
408           echo "$(get_metadata nexus_artifact_repo)" > /opt/config/nexus_artifact_repo.txt
409
410           # Download and run install script
411           apt-get -y install unzip
412           INSTALL_SCRIPT_VERSION=$(get_metadata install_script_version)
413           NEXUS_ARTIFACT_REPO=$(get_metadata nexus_artifact_repo)
414           if [[ "${INSTALL_SCRIPT_VERSION}" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi
415           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
416           unzip -j /opt/vcpe-scripts-${INSTALL_SCRIPT_VERSION}.zip -d /opt v_bng_install.sh
417           cd /opt
418           chmod +x v_bng_install.sh
419           ./v_bng_install.sh
420       capabilities:
421         virtual_compute:
422           properties:
423             virtual_memory:
424               virtual_mem_size: 4096 MB
425               # HPA requirements
426               vdu_memory_requirements:
427                 memoryPageSize: '{"schema-version": "0", "schema-location": "", "platform-id": "generic", "mandatory": true, "configuration-value": "2 MB"}'
428                 numberOfPages: '{"schema-version": "0","schema-location": "","platform-id": "generic","mandatory": true,"configuration-value": 1024}'
429             virtual_cpu:
430               num_virtual_cpu: 2
431               cpu_architecture: generic
432       requirements:
433         - virtual_storage: VirtualStorage_root_all
434       artifacts:
435         sw_image: #TODO need to put glance image name here
436           #file: { get_input: vcpe_image_name }
437           file: ../Artifacts/images/ubuntu_16.04
438           type: tosca.artifacts.nfv.SwImage