601619083482e1e48da47d810ad8b0d2b0098d27
[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_protocol: ipv4
104 #        vl_profile:
105 #          max_bit_rate_requirements:
106 #            root: 10000000
107 #            leaf: 10000000
108 #          min_bit_rate_requirements:
109 #            root: 10000000
110 #            leaf: 10000000
111 #          networkName: { get_input: public_net_id }
112 #
113 #    #onap oam net
114 #    VL_onap_private:
115 #      type: tosca.nodes.nfv.VnfVirtualLink
116 #      properties:
117 #        connectivity_type:
118 #          layer_protocol: ipv4
119 #        vl_profile:
120 #          max_bit_rate_requirements:
121 #            root: 10000000
122 #            leaf: 10000000
123 #          min_bit_rate_requirements:
124 #            root: 10000000
125 #            leaf: 10000000
126 #          networkName: { get_input: onap_private_net_id }
127 #          cidr: { get_input: onap_private_net_cidr }
128
129     #Private network that connects vBRGEMU to vBNG
130     VL_vbrgemu_bng_private_net:
131       type: tosca.nodes.nfv.VnfVirtualLink
132       properties:
133         connectivity_type:
134           layer_protocol: ipv4
135         vl_profile:
136           max_bit_rate_requirements:
137             root: 10000000
138             leaf: 10000000
139           min_bit_rate_requirements:
140             root: 10000000
141             leaf: 10000000
142           networkName: { get_input: vbrgemu_bng_private_net_id}
143           cidr: { get_input: vbrgemu_bng_private_net_cidr }
144           dhcpEnabled: false
145           physicalNetwork: "physnet1"
146
147     # vbrgemu related
148     Cp_vbrgemu_public:
149       type: tosca.nodes.nfv.VduCp
150       properties:
151         layer_protocol: [ipv4]
152         trunk_mode: false
153         protocol_data:
154           - asscociated_layer_protocol: ipv4
155             address_data:
156               address_type: ip_address
157               l3_address_data:
158                 ip_address_assignment: false
159                 floating_ip_activated: false
160       requirements:
161         - virtual_binding: VDU_vbrgemu_0
162         #- virtual_link: VL_public
163
164     Cp_vbrgemu_vbrgemu_bng_private_net:
165       type: tosca.nodes.nfv.VduCp
166       properties:
167         layer_protocol: [ipv4]
168         trunk_mode: false
169         protocol_data:
170           - asscociated_layer_protocol: ipv4
171             address_data:
172               address_type: ip_address
173               l3_address_data:
174                 ip_address_assignment: false
175                 floating_ip_activated: false
176                 fixed_ip_address:
177                   - { get_input: vbrgemu_private_ip_0 }
178         vnic_type: "direct"
179         virtual_network_interface_requirements:
180           - name: "sriov-support"
181             support_mandatory: true
182             network_interface_requirements:
183               interfaceType: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "SR-IOV"}'
184             nic_io_requirements:
185               logical_node_requirements:
186                 pciVendorId: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "1234"}'
187                 pciDeviceId: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "5678"}'
188                 pciNumDevices: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "1"}'
189       requirements:
190         - virtual_binding: VDU_vbrgemu_0
191         - virtual_link: VL_vbrgemu_bng_private_net
192
193     VirtualStorage_root_all:
194       # this indicate the VDU root storage size
195       type: tosca.nodes.nfv.Vdu.VirtualStorage
196       properties:
197         type_of_storage: root
198         size_of_storage: 40 GB
199
200     VDU_vbrgemu_0:
201       type: tosca.nodes.nfv.Vdu.Compute
202       properties:
203         name: { get_input: vbrgemu_name_0 }
204         description: vbrgemu
205         configurable_properties:
206           additional_vnfc_configurable_properties: {}
207         vdu_profile:
208           min_number_of_instances: 1
209           max_number_of_instances: 1
210           watchdog: none
211         inject_files: #TODO SDC bug
212           source_path: ../Artifcats/keys/authorized_keys #SSH authorized_keys
213           dest_path: /home/ubuntu/.ssh/authorized_keys
214         meta_data:
215           vnf_id: { get_input: vnf_id }
216           vf_module_id: { get_input: vf_module_id }
217           vbrgemu_bng_private_net_cidr: { get_input: vbrgemu_bng_private_net_cidr }
218           demo_artifacts_version: { get_input: demo_artifacts_version }
219           install_script_version: { get_input: install_script_version }
220           sdnc_ip: { get_input: sdnc_ip_addr }
221           cloud_env: { get_input: cloud_env }
222           nexus_artifact_repo: { get_input: nexus_artifact_repo }
223         user_data: |
224           #!/bin/bash
225           METADATA=`curl -s http://169.254.169.254/openstack/2012-08-10/meta_data.json`
226           apt-get -y install jq
227
228           get_metadata () {
229             echo $METADATA | jq -r ".meta.$1"
230           }
231
232           # Create configuration files
233           mkdir /opt/config
234           echo "$(get_metadata vbrgemu_bng_private_net_cidr)" > /opt/config/brgemu_bng_private_net_cidr.txt
235           echo "$(get_metadata demo_artifacts_version)" > /opt/config/demo_artifacts_version.txt
236           echo "$(get_metadata install_script_version)" > /opt/config/install_script_version.txt
237           echo "$(get_metadata cloud_env)" > /opt/config/cloud_env.txt
238           echo "$(get_metadata sdnc_ip)" > /opt/config/sdnc_ip.txt
239           echo "$(get_metadata nexus_artifact_repo)" > /opt/config/nexus_artifact_repo.txt
240
241           # Download and run install script
242           apt-get -y install unzip
243           INSTALL_SCRIPT_VERSION=$(get_metadata install_script_version)
244           NEXUS_ARTIFACT_REPO=$(get_metadata nexus_artifact_repo)
245           if [[ "${INSTALL_SCRIPT_VERSION}" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi
246           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
247           unzip -j /opt/vcpe-scripts-${INSTALL_SCRIPT_VERSION}.zip -d /opt v_brgemu_install.sh
248           cd /opt
249           chmod +x v_brgemu_install.sh
250           ./v_brgemu_install.sh
251       capabilities:
252         virtual_compute:
253           properties:
254             virtual_memory:
255               virtual_mem_size: 4096 MB
256               # HPA requirements
257               vdu_memory_requirements:
258                 memoryPageSize: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "2 MB"}'
259                 numberOfPages: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "1024"}'
260             virtual_cpu:
261               num_virtual_cpu: 2
262               cpu_architecture: generic
263       requirements:
264         - virtual_storage: VirtualStorage_root_all
265       artifacts:
266         sw_image: #TODO need to put glance image name here
267           #file: { get_input: vcpe_image_name }
268           file: ../Artifacts/Deployment/OTHER/image
269           type: tosca.artifacts.nfv.SwImage