vCPE tosca: Add metadata VNFD_SCHEMA_VERSION
[demo.git] / tosca / vCPE / vbrgemu / MainServiceTemplate.yaml
1 tosca_definitions_version: tosca_simple_yaml_1_0
2 metadata:
3   template_name: vCPE_vbrgemu
4   template_version: "1.0"
5   template_author: onap
6   VNFD_SCHEMA_VERSION: "2.5.1+1"
7 description: vCPE_vbrgemu
8
9 imports:
10   - onap_dm.yaml
11
12 topology_template:
13 #  substitution_mappings:
14 #    node_type: onap.vcpe_vbrgemu
15 #    requirements:
16 #      virtual_link: [ Cp_vbrgemu_public, 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     vbrgemu_bng_private_net_id:
36       type: string
37       description: Private network that connects vBRGEMU to vBNG
38       default: zdfw1bngin01_private
39     vbrgemu_bng_private_net_cidr:
40       type: string
41       description: The CIDR of the input side of vBNG private network
42       default: 10.3.0.0/24
43     vbrgemu_private_ip_0:
44       type: string
45       description: Private IP address towards the BRGEMU-BNG network
46       default: 10.3.0.4
47     vbrgemu_name_0:
48       type: string
49       description: Name of the vBRGEMU
50       default: zdcpe1cpe01brgemu01
51     vnf_id:
52       type: string
53       description: The VNF ID is provided by ONAP
54       default: vCPE_Infrastructure_BGREMU_demo_app
55     vf_module_id:
56       type: string
57       description: The vCPE Module ID is provided by ONAP
58       default: vCPE_Customer_BRGEMU
59     pub_key:
60       type: string
61       description: ssh public key
62       default: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGx6SKrAuCz1V8KGevZueksLdWoPWJP6z3r29Z7TmPVEOjM+7PIPeSs2BVRx3rnHZBAlasMrZ+fJBS25ts9vfC+ItezQah/hr9vrkmwxCR54Lb84poW+sToPeF6i5eZY7W+jWJfLaFSFx9d2vp4zes/fOlT3NvYCXbn/3QdryQoGl7VFI8oemZypVcikZXElJeeKgAVdSwnrzuqtO/tmbXcAeSbYvVjki8ywYcsWMVMYWUWhh+1BAB6kXnTsIWqzrq0Pfvy+81WDwtiqsqmd93HY8hE0scBrXFBZzQS/AYfIFBlEuFNdLczchntjbZ0n7dmDXk8zHtCZYNk7kwb8k/
63     install_script_version:
64       type: string
65       description: install script version number
66       default: 1.2.0-SNAPSHOT
67     nexus_artifact_repo:
68       type: string
69       description: Root URL for the Nexus repository for Maven artifacts
70       default: https://nexus.onap.org
71     demo_artifacts_version:
72       type: string
73       description: artifacts version used in demo vnfs
74       default: 1.2.0
75     cloud_env:
76       type: string
77       description: cloud environment(openstack or rackspace)
78       default: openstack
79     sdnc_ip_addr:
80       type: string
81       description: SDNC ip address used to set NAT
82       default: 10.0.7.1
83     compile_state:
84       type: string
85       description: State to compile code or not (done, auto or build)
86       default: auto
87
88   node_templates:
89     LLU_VNF:
90       type: tosca.nodes.nfv.VNF
91       properties:
92         descriptor_id: b1bb0ce7-2222-4fa7-95ed-4840d70a1177
93         provider: onap
94         product_name: vcpe_vbrgemu
95         software_version: '1.0'
96         descriptor_version: '1.0'
97         flavour_id: simple
98         flavour_description: simple
99         vnfm_info: ['gvnfm']
100
101
102     #onap public net
103 #    VL_public:
104 #      type: tosca.nodes.nfv.VnfVirtualLink
105 #      properties:
106 #        connectivity_type:
107 #          layer_protocols: [ipv4]
108 #        vl_profile:
109 #          max_bitrate_requirements:
110 #            root: 10000000
111 #            leaf: 10000000
112 #          min_bitrate_requirements:
113 #            root: 10000000
114 #            leaf: 10000000
115 #          virtual_link_protocol_data:
116 #            - associated_layer_protocol: ipv4
117 #              l3_protocol_data:
118 #                ip_version: ipv4
119 #                name: { get_input: public_net_id }
120 #
121 #    #onap oam net
122 #    VL_onap_private:
123 #      type: tosca.nodes.nfv.VnfVirtualLink
124 #      properties:
125 #        connectivity_type:
126 #          layer_protocols: [ipv4]
127 #        vl_profile:
128 #          max_bitrate_requirements:
129 #            root: 10000000
130 #            leaf: 10000000
131 #          min_bitrate_requirements:
132 #            root: 10000000
133 #            leaf: 10000000
134 #          virtual_link_protocol_data:
135 #            - associated_layer_protocol: ipv4
136 #              l3_protocol_data:
137 #                ip_version: ipv4
138 #                name: { get_input: onap_private_net_id }
139 #                cidr: { get_input: onap_private_net_cidr }
140
141     #Private network that connects vBRGEMU to vBNG
142     VL_vbrgemu_bng_private_net:
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: vbrgemu_bng_private_net_id}
159                 cidr: { get_input: vbrgemu_bng_private_net_cidr }
160                 dhcp_enabled: false
161
162     # vbrgemu related
163     Cp_vbrgemu_public:
164       type: tosca.nodes.nfv.VduCp
165       properties:
166         layer_protocols: [ipv4]
167         trunk_mode: false
168         protocol:
169           - associated_layer_protocol: ipv4
170             address_data:
171               - address_type: ip_address
172                 l3_address_data:
173                   ip_address_assignment: false
174                   floating_ip_activated: false
175       requirements:
176         - virtual_binding: VDU_vbrgemu_0
177         #- virtual_link: VL_public
178
179     Cp_vbrgemu_vbrgemu_bng_private_net:
180       type: tosca.nodes.nfv.VduCp
181       properties:
182         layer_protocols: [ipv4]
183         trunk_mode: false
184         protocol:
185           - associated_layer_protocol: ipv4
186             address_data:
187               - address_type: ip_address
188                 l3_address_data:
189                   ip_address_assignment: false
190                   floating_ip_activated: false
191                   fixed_ip_address:
192                     - { get_input: vbrgemu_private_ip_0 }
193         virtual_network_interface_requirements:
194           - name: dpdk support
195             support_mandatory: true
196             network_interface_requirements:
197               dataProcessingAccelerationLibrary: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "DPDK"}'
198       requirements:
199         - virtual_binding: VDU_vbrgemu_0
200         - virtual_link: VL_vbrgemu_bng_private_net
201
202     VDU_vbrgemu_0:
203       type: tosca.nodes.nfv.Vdu.Compute
204       properties:
205         name: { get_input: vbrgemu_name_0 }
206         description: vbrgemu
207         vdu_profile:
208           min_number_of_instances: 1
209           max_number_of_instances: 1
210           watchdog: none
211         inject_files: #TODO SDC bug
212           source_path: ../Artifacts/Deployment/OTHER/authorized_keys #SSH authorized_keys
213           dest_path: /home/ubuntu/.ssh/authorized_keys
214         meta_data:
215           vnf_id: { get_input: vnf_id }
216           vf_module_id: { get_input: vf_module_id }
217           vbrgemu_bng_private_net_cidr: { get_input: vbrgemu_bng_private_net_cidr }
218           demo_artifacts_version: { get_input: demo_artifacts_version }
219           install_script_version: { get_input: install_script_version }
220           sdnc_ip: { get_input: sdnc_ip_addr }
221           cloud_env: { get_input: cloud_env }
222           nexus_artifact_repo: { get_input: nexus_artifact_repo }
223         boot_data: |
224           #!/bin/bash
225           METADATA=`curl -s http://169.254.169.254/openstack/2012-08-10/meta_data.json`
226           apt-get -y install jq
227
228           get_metadata () {
229             echo $METADATA | jq -r ".meta.$1"
230           }
231
232           # Create configuration files
233           mkdir /opt/config
234           echo "$(get_metadata vbrgemu_bng_private_net_cidr)" > /opt/config/brgemu_bng_private_net_cidr.txt
235           echo "$(get_metadata demo_artifacts_version)" > /opt/config/demo_artifacts_version.txt
236           echo "$(get_metadata install_script_version)" > /opt/config/install_script_version.txt
237           echo "$(get_metadata cloud_env)" > /opt/config/cloud_env.txt
238           echo "$(get_metadata sdnc_ip)" > /opt/config/sdnc_ip.txt
239           echo "$(get_metadata nexus_artifact_repo)" > /opt/config/nexus_artifact_repo.txt
240
241           # Download and run install script
242           apt-get -y install unzip
243           INSTALL_SCRIPT_VERSION=$(get_metadata install_script_version)
244           NEXUS_ARTIFACT_REPO=$(get_metadata nexus_artifact_repo)
245           if [[ "${INSTALL_SCRIPT_VERSION}" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi
246           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
247           unzip -j /opt/vcpe-scripts-${INSTALL_SCRIPT_VERSION}.zip -d /opt v_brgemu_install.sh
248           cd /opt
249           chmod +x v_brgemu_install.sh
250           ./v_brgemu_install.sh
251       capabilities:
252         virtual_compute:
253           properties:
254             virtual_memory:
255               virtual_mem_size: 4096 MB
256               vdu_mem_requirements:
257                 memoryPageSize: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "2 MB"}'
258                 numberOfPages: '{"schemaVersion": "0","schemaSelector": "","hardwarePlatform": "generic","mandatory": "true", "configurationValue": "1024"}'
259             virtual_cpu:
260               num_virtual_cpu: 2
261               cpu_architecture: generic
262             virtual_local_storage:
263               - size_of_storage: 40 GB
264       artifacts:
265         sw_image: #TODO need to put glance image name here
266           #file: { get_input: vcpe_image_name }
267           file: ../Artifacts/Deployment/OTHER/image
268           type: tosca.artifacts.nfv.SwImage