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