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