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