Change metadata from integer to string
[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_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 vBNG to vGMUX
154     VL_bng_gmux_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: bng_gmux_private_net_id}
167           cidr: { get_input: bng_gmux_private_net_cidr }
168           dhcpEnabled: false
169
170     #Private network that connects vGMUX to vGWs
171     VL_mux_gw_private_net:
172       type: tosca.nodes.nfv.VnfVirtualLink
173       properties:
174         connectivity_type:
175           layer_protocol: ipv4
176         vl_profile:
177           max_bit_rate_requirements:
178             root: 10000000
179             leaf: 10000000
180           min_bit_rate_requirements:
181             root: 10000000
182             leaf: 10000000
183           networkName: { get_input: mux_gw_private_net_id}
184           cidr: { get_input: mux_gw_private_net_cidr }
185           dhcpEnabled: false
186
187     # vgmux related
188     Cp_vgmux_public:
189       type: tosca.nodes.nfv.VduCp
190       properties:
191         layer_protocol: [ipv4]
192         trunk_mode: false
193         protocol_data:
194           - asscociated_layer_protocol: ipv4
195             address_data:
196               address_type: ip_address
197               l3_address_data:
198                 ip_address_assignment: false
199                 floating_ip_activated: false
200       requirements:
201         - virtual_binding: VDU_vgmux_0
202         #- virtual_link: VL_public
203
204     Cp_vgmux_onap_private:
205       type: tosca.nodes.nfv.VduCp
206       properties:
207         layer_protocol: [ipv4]
208         trunk_mode: false
209         protocol_data:
210           - asscociated_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                 fixed_ip_address:
217                   - { get_input: vgmux_private_ip_1 }
218       requirements:
219         - virtual_binding: VDU_vgmux_0
220         #- virtual_link: VL_onap_private
221
222     Cp_vgmux_bng_gmux_private_net:
223       type: tosca.nodes.nfv.VduCp
224       properties:
225         layer_protocol: [ipv4]
226         trunk_mode: false
227         protocol_data:
228           - asscociated_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: vgmux_private_ip_0 }
236         virtual_network_interface_requirements:
237           - name: dpdk support
238             support_mandatory: true
239             #TODO HPA
240             network_interface_requirements:
241               dataProcessingAccelerationLibrary: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "DPDK"}'
242       requirements:
243         - virtual_binding: VDU_vgmux_0
244         - virtual_link: VL_bng_gmux_private_net
245
246     Cp_vgmux_mux_gw_private_net:
247       type: tosca.nodes.nfv.VduCp
248       properties:
249         layer_protocol: [ipv4]
250         trunk_mode: false
251         protocol_data:
252           - asscociated_layer_protocol: ipv4
253             address_data:
254               address_type: ip_address
255               l3_address_data:
256                 ip_address_assignment: false
257                 floating_ip_activated: false
258                 fixed_ip_address:
259                   - { get_input: vgmux_private_ip_2 }
260         virtual_network_interface_requirements:
261           - name: dpdk support
262             support_mandatory: true
263             #TODO HPA
264             network_interface_requirements:
265               dataProcessingAccelerationLibrary: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "DPDK"}'
266       requirements:
267         - virtual_binding: VDU_vgmux_0
268         - virtual_link: VL_mux_gw_private_net
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_vgmux_0:
278       type: tosca.nodes.nfv.Vdu.Compute
279       properties:
280         name: { get_input: vgmux_name_0 }
281         description: vgmux
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_to_bng_net_ipaddr: { get_input: vgmux_private_ip_0 }
295           oam_ipaddr: { get_input: vgmux_private_ip_1 }
296           mux_gw_net_ipaddr: { get_input: vgmux_private_ip_2 }
297           bng_to_mux_net_ipaddr: { get_input: bng_gmux_private_ip }
298           bng_mux_net_cidr: { get_input: bng_gmux_private_net_cidr }
299           oam_cidr: { get_input: onap_private_net_cidr }
300           mux_gw_net_cidr: { get_input: mux_gw_private_net_cidr }
301           brg_bng_net_cidr: { get_input: brgemu_bng_private_net_cidr }
302           install_script_version: { get_input: install_script_version }
303           cloud_env: { get_input: cloud_env }
304           nexus_artifact_repo: { get_input: nexus_artifact_repo }
305         user_data: |
306           #!/bin/bash
307           METADATA=`curl -s http://169.254.169.254/openstack/2012-08-10/meta_data.json`
308           apt-get -y install jq
309
310           get_metadata () {
311             echo $METADATA | jq -r ".meta.$1"
312           }
313
314           # Create configuration files
315           mkdir /opt/config
316           echo "$(get_metadata mux_to_bng_net_ipaddr)" > /opt/config/mux_to_bng_net_ipaddr.txt
317           echo "$(get_metadata oam_ipaddr)" > /opt/config/oam_ipaddr.txt
318           echo "$(get_metadata mux_gw_net_ipaddr)" > /opt/config/mux_gw_net_ipaddr.txt
319           echo "$(get_metadata bng_to_mux_net_ipaddr)" > /opt/config/bng_to_mux_net_ipaddr.txt
320           echo "$(get_metadata bng_mux_net_cidr)" > /opt/config/bng_mux_net_cidr.txt
321           echo "$(get_metadata oam_cidr)" > /opt/config/oam_cidr.txt
322           echo "$(get_metadata mux_gw_net_cidr)" > /opt/config/mux_gw_net_cidr.txt
323           echo "$(get_metadata brg_bng_net_cidr)" > /opt/config/brg_bng_net_cidr.txt
324           echo "$(get_metadata install_script_version)" > /opt/config/install_script_version.txt
325           echo "$(get_metadata cloud_env)" > /opt/config/cloud_env.txt
326           echo "$(get_metadata nexus_artifact_repo)" > /opt/config/nexus_artifact_repo.txt
327
328           # Download and run install script
329           apt-get -y install unzip
330           INSTALL_SCRIPT_VERSION=$(get_metadata install_script_version)
331           NEXUS_ARTIFACT_REPO=$(get_metadata nexus_artifact_repo)
332           if [[ "${INSTALL_SCRIPT_VERSION}" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi
333           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
334           unzip -j /opt/vcpe-scripts-${INSTALL_SCRIPT_VERSION}.zip -d /opt v_gmux_install.sh
335           cd /opt
336           chmod +x v_gmux_install.sh
337           ./v_gmux_install.sh
338       capabilities:
339         virtual_compute:
340           properties:
341             virtual_memory:
342               virtual_mem_size: 4096 MB
343               # HPA requirements
344               vdu_memory_requirements:
345                 memoryPageSize: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "2 MB"}'
346                 numberOfPages: '{"schemaVersion": "0","schemaSelector": "","hardwarePlatform": "generic","mandatory": "true", "configurationValue": "1024"}'
347             virtual_cpu:
348               num_virtual_cpu: 2
349               cpu_architecture: generic
350       requirements:
351         - virtual_storage: VirtualStorage_root_all
352       artifacts:
353         sw_image: #TODO need to put glance image name here
354           #file: { get_input: vcpe_image_name }
355           file: ../Artifacts/Deployment/OTHER/image
356           type: tosca.artifacts.nfv.SwImage
357