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