Merge "Adapt to latest tosca onboarding DM change"
[demo.git] / tosca / vCPE / vgmux / MainServiceTemplate.yaml
1 tosca_definitions_version: tosca_simple_yaml_1_0
2 metadata:
3   template_name: vCPE_vgmux
4   template_version: "1.0"
5   template_author: onap
6 description: vCPE_vgmux
7
8 imports:
9   - onap_dm.yaml
10
11 topology_template:
12 #  substitution_mappings:
13 #    node_type: onap.vcpe_vgmux
14 #    requirements:
15 #      virtual_link: [ Cp_vgmux_public, virtual_link ] # expose as external CP
16 #      virtual_link: [ Cp_vgmux_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     bng_gmux_private_net_id:
36       type: string
37       description: Private network that connects vBNG to vGMUX
38       default: zdfw1bngmux01_private
39     bng_gmux_private_net_cidr:
40       type: string
41       description: The CIDR of the vBNG-vGMUX private network
42       default: 10.1.0.0/24
43     mux_gw_private_net_id:
44       type: string
45       description: Private network that connects vGMUX to vGWs
46       default: zdfw1muxgw01_private
47     mux_gw_private_net_cidr:
48       type: string
49       description: The CIDR of the vGMUX private network
50       default: 10.5.0.0/24
51     brgemu_bng_private_net_cidr:
52       type: string
53       description: The CIDR of the vBRG-vBNG private network
54       default: 10.3.0.0/24
55     vgmux_private_ip_0:
56       type: string
57       description: Private IP address that is assigned to the vGMUX to communicate with the vBNG
58       default: 10.1.0.20
59     vgmux_private_ip_1:
60       type: string
61       description: Private IP address that is assigned to the vGMUX to communicate with ONAP components
62       default: 10.0.101.20
63     vgmux_private_ip_2:
64       type: string
65       description: Private IP address that is assigned to the vGMUX to communicate with vGWs
66       default: 10.5.0.20
67     vgmux_name_0:
68       type: string
69       description: Name of the vGMUX
70       default: zdcpe1cpe01mux01
71     vnf_id:
72       type: string
73       description: The VNF ID is provided by ONAP
74       default: vCPE_Infrastructure_vGMUX_demo_app
75     vf_module_id:
76       type: string
77       description: The vCPE Module ID is provided by ONAP
78       default: vCPE_Intrastructure_Metro_vGMUX
79     bng_gmux_private_ip:
80       type: string
81       description: Private IP address that is assigned to the vBNG to communicate with the vGMUX
82       default: 10.1.0.10
83     dcae_collector_ip:
84       type: string
85       description: dcae collector ip
86       default: 10.0.4.102
87     dcae_collector_port:
88       type: string
89       description: dcae collector port
90       default: "8080"
91     pub_key:
92       type: string
93       description: ssh public key
94       default: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGx6SKrAuCz1V8KGevZueksLdWoPWJP6z3r29Z7TmPVEOjM+7PIPeSs2BVRx3rnHZBAlasMrZ+fJBS25ts9vfC+ItezQah/hr9vrkmwxCR54Lb84poW+sToPeF6i5eZY7W+jWJfLaFSFx9d2vp4zes/fOlT3NvYCXbn/3QdryQoGl7VFI8oemZypVcikZXElJeeKgAVdSwnrzuqtO/tmbXcAeSbYvVjki8ywYcsWMVMYWUWhh+1BAB6kXnTsIWqzrq0Pfvy+81WDwtiqsqmd93HY8hE0scBrXFBZzQS/AYfIFBlEuFNdLczchntjbZ0n7dmDXk8zHtCZYNk7kwb8k/
95     install_script_version:
96       type: string
97       description: install script version number
98       default: 1.2.0-SNAPSHOT
99     nexus_artifact_repo:
100       type: string
101       description: Root URL for the Nexus repository for Maven artifacts
102       default: https://nexus.onap.org
103     cloud_env:
104       type: string
105       description: cloud environment(openstack or rackspace)
106       default: openstack
107
108   node_templates:
109     LLU_VNF:
110       type: tosca.nodes.nfv.VNF
111       properties:
112         descriptor_id: b1bb0ce7-2222-4fa7-95ed-4840d70a1177
113         provider: onap
114         product_name: vcpe_vgmux
115         software_version: '1.0'
116         descriptor_version: '1.0'
117         flavour_id: simple
118         flavour_description: simple
119         vnfm_info: ['gvnfm']
120
121
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 vBNG to vGMUX
162     VL_bng_gmux_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                 ip_version: ipv4
178                 name: { get_input: bng_gmux_private_net_id}
179                 cidr: { get_input: bng_gmux_private_net_cidr }
180                 dhcp_enabled: false
181
182     #Private network that connects vGMUX to vGWs
183     VL_mux_gw_private_net:
184       type: tosca.nodes.nfv.VnfVirtualLink
185       properties:
186         connectivity_type:
187           layer_protocols: [ipv4]
188         vl_profile:
189           max_bitrate_requirements:
190             root: 10000000
191             leaf: 10000000
192           min_bitrate_requirements:
193             root: 10000000
194             leaf: 10000000
195           virtual_link_protocol_data:
196             - associated_layer_protocol: ipv4
197               l3_protocol_data:
198                 ip_version: ipv4
199                 name: { get_input: mux_gw_private_net_id}
200                 cidr: { get_input: mux_gw_private_net_cidr }
201                 dhcp_enabled: false
202
203     # vgmux related
204     Cp_vgmux_public:
205       type: tosca.nodes.nfv.VduCp
206       properties:
207         layer_protocols: [ipv4]
208         trunk_mode: false
209         protocol:
210           - associated_layer_protocol: ipv4
211             address_data:
212               - address_type: ip_address
213                 l3_address_data:
214                   ip_address_assignment: false
215                   floating_ip_activated: false
216       requirements:
217         - virtual_binding: VDU_vgmux_0
218         #- virtual_link: VL_public
219
220     Cp_vgmux_onap_private:
221       type: tosca.nodes.nfv.VduCp
222       properties:
223         layer_protocols: [ipv4]
224         trunk_mode: false
225         protocol:
226           - associated_layer_protocol: ipv4
227             address_data:
228               - address_type: ip_address
229                 l3_address_data:
230                   ip_address_assignment: false
231                   floating_ip_activated: false
232                   fixed_ip_address:
233                     - { get_input: vgmux_private_ip_1 }
234       requirements:
235         - virtual_binding: VDU_vgmux_0
236         #- virtual_link: VL_onap_private
237
238     Cp_vgmux_bng_gmux_private_net:
239       type: tosca.nodes.nfv.VduCp
240       properties:
241         layer_protocols: [ipv4]
242         trunk_mode: false
243         protocol:
244           - associated_layer_protocol: ipv4
245             address_data:
246               - address_type: ip_address
247                 l3_address_data:
248                   ip_address_assignment: false
249                   floating_ip_activated: false
250                   fixed_ip_address:
251                     - { get_input: vgmux_private_ip_0 }
252         virtual_network_interface_requirements:
253           - name: dpdk support
254             support_mandatory: true
255             network_interface_requirements:
256               dataProcessingAccelerationLibrary: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "DPDK"}'
257       requirements:
258         - virtual_binding: VDU_vgmux_0
259         - virtual_link: VL_bng_gmux_private_net
260
261     Cp_vgmux_mux_gw_private_net:
262       type: tosca.nodes.nfv.VduCp
263       properties:
264         layer_protocols: [ipv4]
265         trunk_mode: false
266         protocol:
267           - associated_layer_protocol: ipv4
268             address_data:
269               - address_type: ip_address
270                 l3_address_data:
271                   ip_address_assignment: false
272                   floating_ip_activated: false
273                   fixed_ip_address:
274                     - { get_input: vgmux_private_ip_2 }
275         virtual_network_interface_requirements:
276           - name: dpdk support
277             support_mandatory: true
278             network_interface_requirements:
279               dataProcessingAccelerationLibrary: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "DPDK"}'
280       requirements:
281         - virtual_binding: VDU_vgmux_0
282         - virtual_link: VL_mux_gw_private_net
283
284     VDU_vgmux_0:
285       type: tosca.nodes.nfv.Vdu.Compute
286       properties:
287         name: { get_input: vgmux_name_0 }
288         description: vgmux
289         vdu_profile:
290           min_number_of_instances: 1
291           max_number_of_instances: 1
292           watchdog: none
293         inject_files: #TODO SDC bug
294           source_path: ../Artifacts/Deployment/OTHER/authorized_keys #SSH authorized_keys
295           dest_path: /home/ubuntu/.ssh/authorized_keys
296         meta_data:
297           vnf_id: { get_input: vnf_id }
298           vf_module_id: { get_input: vf_module_id }
299           mux_to_bng_net_ipaddr: { get_input: vgmux_private_ip_0 }
300           oam_ipaddr: { get_input: vgmux_private_ip_1 }
301           mux_gw_net_ipaddr: { get_input: vgmux_private_ip_2 }
302           bng_to_mux_net_ipaddr: { get_input: bng_gmux_private_ip }
303           bng_mux_net_cidr: { get_input: bng_gmux_private_net_cidr }
304           oam_cidr: { get_input: onap_private_net_cidr }
305           mux_gw_net_cidr: { get_input: mux_gw_private_net_cidr }
306           brg_bng_net_cidr: { get_input: brgemu_bng_private_net_cidr }
307           install_script_version: { get_input: install_script_version }
308           cloud_env: { get_input: cloud_env }
309           nexus_artifact_repo: { get_input: nexus_artifact_repo }
310         boot_data: |
311           #!/bin/bash
312           METADATA=`curl -s http://169.254.169.254/openstack/2012-08-10/meta_data.json`
313           apt-get -y install jq
314
315           get_metadata () {
316             echo $METADATA | jq -r ".meta.$1"
317           }
318
319           # Create configuration files
320           mkdir /opt/config
321           echo "$(get_metadata mux_to_bng_net_ipaddr)" > /opt/config/mux_to_bng_net_ipaddr.txt
322           echo "$(get_metadata oam_ipaddr)" > /opt/config/oam_ipaddr.txt
323           echo "$(get_metadata mux_gw_net_ipaddr)" > /opt/config/mux_gw_net_ipaddr.txt
324           echo "$(get_metadata bng_to_mux_net_ipaddr)" > /opt/config/bng_to_mux_net_ipaddr.txt
325           echo "$(get_metadata bng_mux_net_cidr)" > /opt/config/bng_mux_net_cidr.txt
326           echo "$(get_metadata oam_cidr)" > /opt/config/oam_cidr.txt
327           echo "$(get_metadata mux_gw_net_cidr)" > /opt/config/mux_gw_net_cidr.txt
328           echo "$(get_metadata brg_bng_net_cidr)" > /opt/config/brg_bng_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 nexus_artifact_repo)" > /opt/config/nexus_artifact_repo.txt
332
333           # Download and run install script
334           apt-get -y install unzip
335           INSTALL_SCRIPT_VERSION=$(get_metadata install_script_version)
336           NEXUS_ARTIFACT_REPO=$(get_metadata nexus_artifact_repo)
337           if [[ "${INSTALL_SCRIPT_VERSION}" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi
338           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
339           unzip -j /opt/vcpe-scripts-${INSTALL_SCRIPT_VERSION}.zip -d /opt v_gmux_install.sh
340           cd /opt
341           chmod +x v_gmux_install.sh
342           ./v_gmux_install.sh
343       capabilities:
344         virtual_compute:
345           properties:
346             virtual_memory:
347               virtual_mem_size: 4096 MB
348               vdu_mem_requirements:
349                 memoryPageSize: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "2 MB"}'
350                 numberOfPages: '{"schemaVersion": "0","schemaSelector": "","hardwarePlatform": "generic","mandatory": "true", "configurationValue": "1024"}'
351             virtual_cpu:
352               num_virtual_cpu: 2
353               cpu_architecture: generic
354             virtual_local_storage:
355               - size_of_storage: 40 GB
356       artifacts:
357         sw_image: #TODO need to put glance image name here
358           #file: { get_input: vcpe_image_name }
359           file: ../Artifacts/Deployment/OTHER/image
360           type: tosca.artifacts.nfv.SwImage
361