fix tosca template bugs
[modeling/etsicatalog.git] / catalog / pub / utils / toscaparser / testdata / vnf / vcpesriov / vbrgemu / Definitions / 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_addr:
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: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "DPDK"}'
210       requirements:
211         - virtual_binding: VDU_vbrgemu_0
212         - virtual_link: VL_vbrgemu_bng_private_net
213
214     VirtualStorage_root_all:
215       # this indicate the VDU root storage size
216       type: tosca.nodes.nfv.Vdu.VirtualStorage
217       properties:
218         type_of_storage: root
219         size_of_storage: 40 GB
220
221     VDU_vbrgemu_0:
222       type: tosca.nodes.nfv.Vdu.Compute
223       properties:
224         name: { get_input: vbrgemu_name_0 }
225         description: vbrgemu
226         configurable_properties:
227           additional_vnfc_configurable_properties: {}
228         vdu_profile:
229           min_number_of_instances: 1
230           max_number_of_instances: 1
231           watchdog: none
232         inject_files: #TODO SDC bug
233           source_path: ../Artifacts/keys/authorized_keys #SSH authorized_keys
234           dest_path: /home/ubuntu/.ssh/authorized_keys
235         meta_data:
236           vnf_id: { get_input: vnf_id }
237           vf_module_id: { get_input: vf_module_id }
238           vbrgemu_bng_private_net_cidr: { get_input: vbrgemu_bng_private_net_cidr }
239           demo_artifacts_version: { get_input: demo_artifacts_version }
240           install_script_version: { get_input: install_script_version }
241           sdnc_ip: { get_input: sdnc_ip_addr }
242           cloud_env: { get_input: cloud_env }
243           nexus_artifact_repo: { get_input: nexus_artifact_repo }
244         user_data: |
245           #!/bin/bash
246           METADATA=`curl -s http://169.254.169.254/openstack/2012-08-10/meta_data.json`
247           apt-get -y install jq
248
249           get_metadata () {
250             echo $METADATA | jq -r ".meta.$1"
251           }
252
253           # Create configuration files
254           mkdir /opt/config
255           echo "$(get_metadata vbrgemu_bng_private_net_cidr)" > /opt/config/brgemu_bng_private_net_cidr.txt
256           echo "$(get_metadata demo_artifacts_version)" > /opt/config/demo_artifacts_version.txt
257           echo "$(get_metadata install_script_version)" > /opt/config/install_script_version.txt
258           echo "$(get_metadata cloud_env)" > /opt/config/cloud_env.txt
259           echo "$(get_metadata sdnc_ip)" > /opt/config/sdnc_ip.txt
260           echo "$(get_metadata nexus_artifact_repo)" > /opt/config/nexus_artifact_repo.txt
261
262           # Download and run install script
263           apt-get -y install unzip
264           INSTALL_SCRIPT_VERSION=$(get_metadata install_script_version)
265           NEXUS_ARTIFACT_REPO=$(get_metadata nexus_artifact_repo)
266           if [[ "${INSTALL_SCRIPT_VERSION}" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi
267           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
268           unzip -j /opt/vcpe-scripts-${INSTALL_SCRIPT_VERSION}.zip -d /opt v_brgemu_install.sh
269           cd /opt
270           chmod +x v_brgemu_install.sh
271           ./v_brgemu_install.sh
272       capabilities:
273         virtual_compute:
274           properties:
275             virtual_memory:
276               virtual_mem_size: 4096 MB
277               # HPA requirements
278               vdu_memory_requirements:
279                 memoryPageSize: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "2 MB"}'
280                 numberOfPages: '{"schemaVersion": "0","schemaSelector": "","hardwarePlatform": "generic","mandatory": "true", "configurationValue": "1024"}'
281             virtual_cpu:
282               num_virtual_cpu: 2
283               cpu_architecture: generic
284       requirements:
285         - virtual_storage: VirtualStorage_root_all
286       artifacts:
287         sw_image: #TODO need to put glance image name here
288           #file: { get_input: vcpe_image_name }
289           file: ../Artifacts/images/ubuntu_16.04
290           type: tosca.artifacts.nfv.SwImage