a895b5713aab3112614f6bba4532a0051eddd29e
[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 description: vCPE_vbrgemu
7
8 imports:
9   - onap_dm.yaml
10
11 node_types:
12   onap.vcpe_vbrgemu:
13     derived_from: tosca.nodes.nfv.VNF
14     properties:
15       descriptor_id:
16         type: string
17         constraints: [ valid_values: [ b1bb0ce7-4444-4fa7-95ed-4840d70a1177 ] ]
18         default: b1bb0ce7-4444-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_vbrgemu ] ]
26         default: vcpe_vbrgemu
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_vbrgemu
51 #    requirements:
52 #      virtual_link: [ Cp_vbrgemu_public, virtual_link ] # expose as external CP
53
54   inputs:
55     vcpe_image_name:
56       type: string
57       description: image name for vcpe in openstack glance
58       default: ubuntu_16.04
59     public_net_id:
60       type: string
61       description: public network id used during onap installation
62       default: external
63     onap_private_net_id:
64       type: string
65       description: onap OAM network id
66       default: oam_onap
67     onap_private_net_cidr:
68       type: string
69       description: oanp OAM network cidr
70       default: 10.0.0.0/16
71     vbrgemu_bng_private_net_id:
72       type: string
73       description: Private network that connects vBRGEMU to vBNG
74       default: zdfw1bngin01_private
75     vbrgemu_bng_private_net_cidr:
76       type: string
77       description: The CIDR of the input side of vBNG private network
78       default: 10.3.0.0/24
79     vbrgemu_private_ip_0:
80       type: string
81       description: Private IP address towards the BRGEMU-BNG network
82       default: 10.3.0.4
83     vbrgemu_name_0:
84       type: string
85       description: Name of the vBRGEMU
86       default: zdcpe1cpe01brgemu01
87     vnf_id:
88       type: string
89       description: The VNF ID is provided by ONAP
90       default: vCPE_Infrastructure_BGREMU_demo_app
91     vf_module_id:
92       type: string
93       description: The vCPE Module ID is provided by ONAP
94       default: vCPE_Customer_BRGEMU
95     pub_key:
96       type: string
97       description: ssh public key
98       default: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGx6SKrAuCz1V8KGevZueksLdWoPWJP6z3r29Z7TmPVEOjM+7PIPeSs2BVRx3rnHZBAlasMrZ+fJBS25ts9vfC+ItezQah/hr9vrkmwxCR54Lb84poW+sToPeF6i5eZY7W+jWJfLaFSFx9d2vp4zes/fOlT3NvYCXbn/3QdryQoGl7VFI8oemZypVcikZXElJeeKgAVdSwnrzuqtO/tmbXcAeSbYvVjki8ywYcsWMVMYWUWhh+1BAB6kXnTsIWqzrq0Pfvy+81WDwtiqsqmd93HY8hE0scBrXFBZzQS/AYfIFBlEuFNdLczchntjbZ0n7dmDXk8zHtCZYNk7kwb8k/
99     install_script_version:
100       type: string
101       description: install script version number
102       default: 1.2.0-SNAPSHOT
103     nexus_artifact_repo:
104       type: string
105       description: Root URL for the Nexus repository for Maven artifacts
106       default: https://nexus.onap.org
107     demo_artifacts_version:
108       type: string
109       description: artifacts version used in demo vnfs
110       default: 1.2.0
111     cloud_env:
112       type: string
113       description: cloud environment(openstack or rackspace)
114       default: openstack
115     sdnc_ip:
116       type: string
117       description: SDNC ip address used to set NAT
118       default: 10.0.7.1
119     compile_state:
120       type: string
121       description: State to compile code or not (done, auto or build)
122       default: auto
123
124   node_templates:
125     #onap public net
126 #    VL_public:
127 #      type: tosca.nodes.nfv.VnfVirtualLink
128 #      properties:
129 #        connectivity_type:
130 #          layer_protocol: ipv4
131 #        vl_profile:
132 #          max_bit_rate_requirements:
133 #            root: 10000000
134 #            leaf: 10000000
135 #          min_bit_rate_requirements:
136 #            root: 10000000
137 #            leaf: 10000000
138 #          networkName: { get_input: public_net_id }
139 #
140 #    #onap oam net
141 #    VL_onap_private:
142 #      type: tosca.nodes.nfv.VnfVirtualLink
143 #      properties:
144 #        connectivity_type:
145 #          layer_protocol: ipv4
146 #        vl_profile:
147 #          max_bit_rate_requirements:
148 #            root: 10000000
149 #            leaf: 10000000
150 #          min_bit_rate_requirements:
151 #            root: 10000000
152 #            leaf: 10000000
153 #          networkName: { get_input: onap_private_net_id }
154 #          cidr: { get_input: onap_private_net_cidr }
155
156     #Private network that connects vBRGEMU to vBNG
157     VL_vbrgemu_bng_private_net:
158       type: tosca.nodes.nfv.VnfVirtualLink
159       properties:
160         connectivity_type:
161           layer_protocol: ipv4
162         vl_profile:
163           max_bit_rate_requirements:
164             root: 10000000
165             leaf: 10000000
166           min_bit_rate_requirements:
167             root: 10000000
168             leaf: 10000000
169           networkName: { get_input: vbrgemu_bng_private_net_id}
170           cidr: { get_input: vbrgemu_bng_private_net_cidr }
171           dhcpEnabled: false
172
173     # vbrgemu related
174     Cp_vbrgemu_public:
175       type: tosca.nodes.nfv.VduCp
176       properties:
177         layer_protocol: [ipv4]
178         trunk_mode: false
179         protocol_data:
180           - asscociated_layer_protocol: ipv4
181             address_data:
182               address_type: ip_address
183               l3_address_data:
184                 ip_address_assignment: false
185                 floating_ip_activated: false
186       requirements:
187         - virtual_binding: VDU_vbrgemu_0
188         #- virtual_link: VL_public
189
190     Cp_vbrgemu_vbrgemu_bng_private_net:
191       type: tosca.nodes.nfv.VduCp
192       properties:
193         layer_protocol: [ipv4]
194         trunk_mode: false
195         protocol_data:
196           - asscociated_layer_protocol: ipv4
197             address_data:
198               address_type: ip_address
199               l3_address_data:
200                 ip_address_assignment: false
201                 floating_ip_activated: false
202                 fixed_ip_address:
203                   - { get_input: vbrgemu_private_ip_0 }
204         virtual_network_interface_requirements:
205           - name: dpdk support
206             support_mandatory: true
207             # TODO HPA
208             network_interface_requirements:
209               #dataProcessingAccelerationLibrary: dpdk_2.2
210               interfaceType: virtio
211       requirements:
212         - virtual_binding: VDU_vbrgemu_0
213         - virtual_link: VL_vbrgemu_bng_private_net
214
215     VirtualStorage_root_all:
216       # this indicate the VDU root storage size
217       type: tosca.nodes.nfv.Vdu.VirtualStorage
218       properties:
219         type_of_storage: root
220         size_of_storage: 40 GB
221
222     VDU_vbrgemu_0:
223       type: tosca.nodes.nfv.Vdu.Compute
224       properties:
225         name: { get_input: vbrgemu_name_0 }
226         description: vbrgemu
227         configurable_properties:
228           additional_vnfc_configurable_properties: {}
229         vdu_profile:
230           min_number_of_instances: 1
231           max_number_of_instances: 1
232           watchdog: none
233         inject_files: #TODO SDC bug
234           source_path: ../Artifacts/keys/authorized_keys #SSH authorized_keys
235           dest_path: /home/ubuntu/.ssh/authorized_keys
236         meta_data:
237           vnf_id: { get_input: vnf_id }
238           vf_module_id: { get_input: vf_module_id }
239           vbrgemu_bng_private_net_cidr: { get_input: vbrgemu_bng_private_net_cidr }
240           demo_artifacts_version: { get_input: demo_artifacts_version }
241           install_script_version: { get_input: install_script_version }
242           sdnc_ip: { get_input: sdnc_ip }
243           cloud_env: { get_input: cloud_env }
244           nexus_artifact_repo: { get_input: nexus_artifact_repo }
245         user_data: |
246           #!/bin/bash
247           METADATA=`curl -s http://169.254.169.254/openstack/2012-08-10/meta_data.json`
248           apt-get -y install jq
249
250           get_metadata () {
251             echo $METADATA | jq -r ".meta.$1"
252           }
253
254           # Create configuration files
255           mkdir /opt/config
256           echo "$(get_metadata vbrgemu_bng_private_net_cidr)" > /opt/config/brgemu_bng_private_net_cidr.txt
257           echo "$(get_metadata demo_artifacts_version)" > /opt/config/demo_artifacts_version.txt
258           echo "$(get_metadata install_script_version)" > /opt/config/install_script_version.txt
259           echo "$(get_metadata cloud_env)" > /opt/config/cloud_env.txt
260           echo "$(get_metadata sdnc_ip)" > /opt/config/sdnc_ip.txt
261           echo "$(get_metadata nexus_artifact_repo)" > /opt/config/nexus_artifact_repo.txt
262
263           # Download and run install script
264           apt-get -y install unzip
265           INSTALL_SCRIPT_VERSION=$(get_metadata install_script_version)
266           NEXUS_ARTIFACT_REPO=$(get_metadata nexus_artifact_repo)
267           if [[ "${INSTALL_SCRIPT_VERSION}" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi
268           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
269           unzip -j /opt/vcpe-scripts-${INSTALL_SCRIPT_VERSION}.zip -d /opt v_brgemu_install.sh
270           cd /opt
271           chmod +x v_brgemu_install.sh
272           ./v_brgemu_install.sh
273       capabilities:
274         virtual_compute:
275           properties:
276             virtual_memory:
277               virtual_mem_size: 4096 MB
278               # HPA requirements
279               vdu_memory_requirements:
280                 memoryPageSize: '{"schema-version": "0", "schema-location": "", "platform-id": "generic", "mandatory": true, "configuration-value": "2 MB"}'
281                 numberOfPages: '{"schema-version": "0","schema-location": "","platform-id": "generic","mandatory": true,"configuration-value": 1024}'
282             virtual_cpu:
283               num_virtual_cpu: 2
284               cpu_architecture: generic
285       requirements:
286         - virtual_storage: VirtualStorage_root_all
287       artifacts:
288         sw_image: #TODO need to put glance image name here
289           #file: { get_input: vcpe_image_name }
290           file: ../Artifacts/images/ubuntu_16.04
291           type: tosca.artifacts.nfv.SwImage