Change metadata from integer to string
[demo.git] / tosca / vCPE / vgmux / MainServiceTemplate_sriov.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
12 topology_template:
13 #  substitution_mappings:
14 #    node_type: onap.vcpe_vgmux
15 #    requirements:
16 #      virtual_link: [ Cp_vgmux_public, virtual_link ] # expose as external CP
17 #      virtual_link: [ Cp_vgmux_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     bng_gmux_private_net_id:
35       type: string
36       description: Private network that connects vBNG to vGMUX
37       default: zdfw1bngmux01_private
38     bng_gmux_private_net_cidr:
39       type: string
40       description: The CIDR of the vBNG-vGMUX private network
41       default: 10.1.0.0/24
42     mux_gw_private_net_id:
43       type: string
44       description: Private network that connects vGMUX to vGWs
45       default: zdfw1muxgw01_private
46     mux_gw_private_net_cidr:
47       type: string
48       description: The CIDR of the vGMUX private network
49       default: 10.5.0.0/24
50     brgemu_bng_private_net_cidr:
51       type: string
52       description: The CIDR of the vBRG-vBNG private network
53       default: 10.3.0.0/24
54     vgmux_private_ip_0:
55       type: string
56       description: Private IP address that is assigned to the vGMUX to communicate with the vBNG
57       default: 10.1.0.20
58     vgmux_private_ip_1:
59       type: string
60       description: Private IP address that is assigned to the vGMUX to communicate with ONAP components
61       default: 10.0.101.20
62     vgmux_private_ip_2:
63       type: string
64       description: Private IP address that is assigned to the vGMUX to communicate with vGWs
65       default: 10.5.0.20
66     vgmux_name_0:
67       type: string
68       description: Name of the vGMUX
69       default: zdcpe1cpe01mux01
70     vnf_id:
71       type: string
72       description: The VNF ID is provided by ONAP
73       default: vCPE_Infrastructure_vGMUX_demo_app
74     vf_module_id:
75       type: string
76       description: The vCPE Module ID is provided by ONAP
77       default: vCPE_Intrastructure_Metro_vGMUX
78     bng_gmux_private_ip:
79       type: string
80       description: Private IP address that is assigned to the vBNG to communicate with the vGMUX
81       default: 10.1.0.10
82     dcae_collector_ip:
83       type: string
84       description: dcae collector ip
85       default: 10.0.4.102
86     dcae_collector_port:
87       type: string
88       description: dcae collector port
89       default: "8080"
90     pub_key:
91       type: string
92       description: ssh public key
93       default: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGx6SKrAuCz1V8KGevZueksLdWoPWJP6z3r29Z7TmPVEOjM+7PIPeSs2BVRx3rnHZBAlasMrZ+fJBS25ts9vfC+ItezQah/hr9vrkmwxCR54Lb84poW+sToPeF6i5eZY7W+jWJfLaFSFx9d2vp4zes/fOlT3NvYCXbn/3QdryQoGl7VFI8oemZypVcikZXElJeeKgAVdSwnrzuqtO/tmbXcAeSbYvVjki8ywYcsWMVMYWUWhh+1BAB6kXnTsIWqzrq0Pfvy+81WDwtiqsqmd93HY8hE0scBrXFBZzQS/AYfIFBlEuFNdLczchntjbZ0n7dmDXk8zHtCZYNk7kwb8k/
94     install_script_version:
95       type: string
96       description: install script version number
97       default: 1.2.0-SNAPSHOT
98     nexus_artifact_repo:
99       type: string
100       description: Root URL for the Nexus repository for Maven artifacts
101       default: https://nexus.onap.org
102     cloud_env:
103       type: string
104       description: cloud environment(openstack or rackspace)
105       default: openstack
106
107   node_templates:
108     LLU_VNF:
109       type: tosca.nodes.nfv.VNF
110       properties:
111         descriptor_id: b1bb0ce7-2222-4fa7-95ed-4840d70a1177
112         provider: onap
113         product_name: vcpe_vgmux
114         software_version: '1.0'
115         descriptor_version: '1.0'
116         flavour_id: simple
117         flavour_description: simple
118         vnfm_info: ['gvnfm']
119
120
121     #onap public net
122 #    VL_public:
123 #      type: tosca.nodes.nfv.VnfVirtualLink
124 #      properties:
125 #        connectivity_type:
126 #          layer_protocol: ipv4
127 #        vl_profile:
128 #          max_bit_rate_requirements:
129 #            root: 10000000
130 #            leaf: 10000000
131 #          min_bit_rate_requirements:
132 #            root: 10000000
133 #            leaf: 10000000
134 #          networkName: { get_input: public_net_id }
135 #
136 #    #onap oam net
137 #    VL_onap_private:
138 #      type: tosca.nodes.nfv.VnfVirtualLink
139 #      properties:
140 #        connectivity_type:
141 #          layer_protocol: ipv4
142 #        vl_profile:
143 #          max_bit_rate_requirements:
144 #            root: 10000000
145 #            leaf: 10000000
146 #          min_bit_rate_requirements:
147 #            root: 10000000
148 #            leaf: 10000000
149 #          networkName: { get_input: onap_private_net_id }
150 #          cidr: { get_input: onap_private_net_cidr }
151
152     #Private network that connects vBNG to vGMUX
153     VL_bng_gmux_private_net:
154       type: tosca.nodes.nfv.VnfVirtualLink
155       properties:
156         connectivity_type:
157           layer_protocol: ipv4
158         vl_profile:
159           max_bit_rate_requirements:
160             root: 10000000
161             leaf: 10000000
162           min_bit_rate_requirements:
163             root: 10000000
164             leaf: 10000000
165           networkName: { get_input: bng_gmux_private_net_id}
166           cidr: { get_input: bng_gmux_private_net_cidr }
167           dhcpEnabled: false
168           physicalNetwork: "physnet1"
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           physicalNetwork: "physnet1"
187
188     # vgmux related
189     Cp_vgmux_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_vgmux_0
203         #- virtual_link: VL_public
204
205     Cp_vgmux_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: vgmux_private_ip_1 }
219       requirements:
220         - virtual_binding: VDU_vgmux_0
221         #- virtual_link: VL_onap_private
222
223     Cp_vgmux_bng_gmux_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: vgmux_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_vgmux_0
250         - virtual_link: VL_bng_gmux_private_net
251
252     Cp_vgmux_mux_gw_private_net:
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: vgmux_private_ip_2 }
266         vnic_type: "direct"
267         virtual_network_interface_requirements:
268           - name: "sriov-support"
269             support_mandatory: true
270             network_interface_requirements:
271               interfaceType: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "SR-IOV"}'
272             nic_io_requirements:
273               logical_node_requirements:
274                 pciVendorId: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "1234"}'
275                 pciDeviceId: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "5678"}'
276                 pciNumDevices: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "1"}'
277       requirements:
278         - virtual_binding: VDU_vgmux_0
279         - virtual_link: VL_mux_gw_private_net
280
281     VirtualStorage_root_all:
282       # this indicate the VDU root storage size
283       type: tosca.nodes.nfv.Vdu.VirtualStorage
284       properties:
285         type_of_storage: root
286         size_of_storage: 40 GB
287
288     VDU_vgmux_0:
289       type: tosca.nodes.nfv.Vdu.Compute
290       properties:
291         name: { get_input: vgmux_name_0 }
292         description: vgmux
293         configurable_properties:
294           additional_vnfc_configurable_properties: {}
295         vdu_profile:
296           min_number_of_instances: 1
297           max_number_of_instances: 1
298           watchdog: none
299         inject_files: #TODO SDC bug
300           source_path: ../Artifacts/Deployment/OTHER/authorized_keys #SSH authorized_keys
301           dest_path: /home/ubuntu/.ssh/authorized_keys
302         meta_data:
303           vnf_id: { get_input: vnf_id }
304           vf_module_id: { get_input: vf_module_id }
305           mux_to_bng_net_ipaddr: { get_input: vgmux_private_ip_0 }
306           oam_ipaddr: { get_input: vgmux_private_ip_1 }
307           mux_gw_net_ipaddr: { get_input: vgmux_private_ip_2 }
308           bng_to_mux_net_ipaddr: { get_input: bng_gmux_private_ip }
309           bng_mux_net_cidr: { get_input: bng_gmux_private_net_cidr }
310           oam_cidr: { get_input: onap_private_net_cidr }
311           mux_gw_net_cidr: { get_input: mux_gw_private_net_cidr }
312           brg_bng_net_cidr: { get_input: brgemu_bng_private_net_cidr }
313           install_script_version: { get_input: install_script_version }
314           cloud_env: { get_input: cloud_env }
315           nexus_artifact_repo: { get_input: nexus_artifact_repo }
316         user_data: |
317           #!/bin/bash
318           METADATA=`curl -s http://169.254.169.254/openstack/2012-08-10/meta_data.json`
319           apt-get -y install jq
320
321           get_metadata () {
322             echo $METADATA | jq -r ".meta.$1"
323           }
324
325           # Create configuration files
326           mkdir /opt/config
327           echo "$(get_metadata mux_to_bng_net_ipaddr)" > /opt/config/mux_to_bng_net_ipaddr.txt
328           echo "$(get_metadata oam_ipaddr)" > /opt/config/oam_ipaddr.txt
329           echo "$(get_metadata mux_gw_net_ipaddr)" > /opt/config/mux_gw_net_ipaddr.txt
330           echo "$(get_metadata bng_to_mux_net_ipaddr)" > /opt/config/bng_to_mux_net_ipaddr.txt
331           echo "$(get_metadata bng_mux_net_cidr)" > /opt/config/bng_mux_net_cidr.txt
332           echo "$(get_metadata oam_cidr)" > /opt/config/oam_cidr.txt
333           echo "$(get_metadata mux_gw_net_cidr)" > /opt/config/mux_gw_net_cidr.txt
334           echo "$(get_metadata brg_bng_net_cidr)" > /opt/config/brg_bng_net_cidr.txt
335           echo "$(get_metadata install_script_version)" > /opt/config/install_script_version.txt
336           echo "$(get_metadata cloud_env)" > /opt/config/cloud_env.txt
337           echo "$(get_metadata nexus_artifact_repo)" > /opt/config/nexus_artifact_repo.txt
338
339           # Download and run install script
340           apt-get -y install unzip
341           INSTALL_SCRIPT_VERSION=$(get_metadata install_script_version)
342           NEXUS_ARTIFACT_REPO=$(get_metadata nexus_artifact_repo)
343           if [[ "${INSTALL_SCRIPT_VERSION}" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi
344           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
345           unzip -j /opt/vcpe-scripts-${INSTALL_SCRIPT_VERSION}.zip -d /opt v_gmux_install.sh
346           cd /opt
347           chmod +x v_gmux_install.sh
348           ./v_gmux_install.sh
349       capabilities:
350         virtual_compute:
351           properties:
352             virtual_memory:
353               virtual_mem_size: 4096 MB
354               # HPA requirements
355               vdu_memory_requirements:
356                 memoryPageSize: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "2 MB"}'
357                 numberOfPages: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "1024"}'
358             virtual_cpu:
359               num_virtual_cpu: 2
360               cpu_architecture: generic
361       requirements:
362         - virtual_storage: VirtualStorage_root_all
363       artifacts:
364         sw_image: #TODO need to put glance image name here
365           #file: { get_input: vcpe_image_name }
366           file: ../Artifacts/Deployment/OTHER/image
367           type: tosca.artifacts.nfv.SwImage
368