Adapt to latest tosca onboarding DM change
[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_protocols: [ipv4]
107 #        vl_profile:
108 #          max_bitrate_requirements:
109 #            root: 10000000
110 #            leaf: 10000000
111 #          min_bitrate_requirements:
112 #            root: 10000000
113 #            leaf: 10000000
114 #          virtual_link_protocol_data:
115 #            - associated_layer_protocol: ipv4
116 #              l3_protocol_data:
117 #                ip_version: ipv4
118 #                name: { get_input: public_net_id }
119 #
120 #    #onap oam net
121 #    VL_onap_private:
122 #      type: tosca.nodes.nfv.VnfVirtualLink
123 #      properties:
124 #        connectivity_type:
125 #          layer_protocols: [ipv4]
126 #        vl_profile:
127 #          max_bitrate_requirements:
128 #            root: 10000000
129 #            leaf: 10000000
130 #          min_bitrate_requirements:
131 #            root: 10000000
132 #            leaf: 10000000
133 #          virtual_link_protocol_data:
134 #            - associated_layer_protocol: ipv4
135 #              l3_protocol_data:
136 #                ip_version: ipv4
137 #                name: { get_input: onap_private_net_id }
138 #                cidr: { get_input: onap_private_net_cidr }
139
140     #Private network that connects vBRGEMU to vBNG
141     VL_vbrgemu_bng_private_net:
142       type: tosca.nodes.nfv.VnfVirtualLink
143       properties:
144         connectivity_type:
145           layer_protocols: [ipv4]
146         vl_profile:
147           max_bitrate_requirements:
148             root: 10000000
149             leaf: 10000000
150           min_bitrate_requirements:
151             root: 10000000
152             leaf: 10000000
153           virtual_link_protocol_data:
154             - associated_layer_protocol: ipv4
155               l3_protocol_data:
156                 ip_version: ipv4
157                 name: { get_input: vbrgemu_bng_private_net_id}
158                 cidr: { get_input: vbrgemu_bng_private_net_cidr }
159                 dhcp_enabled: false
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         virtual_network_interface_requirements:
193           - name: dpdk support
194             support_mandatory: true
195             network_interface_requirements:
196               dataProcessingAccelerationLibrary: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "DPDK"}'
197       requirements:
198         - virtual_binding: VDU_vbrgemu_0
199         - virtual_link: VL_vbrgemu_bng_private_net
200
201     VDU_vbrgemu_0:
202       type: tosca.nodes.nfv.Vdu.Compute
203       properties:
204         name: { get_input: vbrgemu_name_0 }
205         description: vbrgemu
206         vdu_profile:
207           min_number_of_instances: 1
208           max_number_of_instances: 1
209           watchdog: none
210         inject_files: #TODO SDC bug
211           source_path: ../Artifacts/Deployment/OTHER/authorized_keys #SSH authorized_keys
212           dest_path: /home/ubuntu/.ssh/authorized_keys
213         meta_data:
214           vnf_id: { get_input: vnf_id }
215           vf_module_id: { get_input: vf_module_id }
216           vbrgemu_bng_private_net_cidr: { get_input: vbrgemu_bng_private_net_cidr }
217           demo_artifacts_version: { get_input: demo_artifacts_version }
218           install_script_version: { get_input: install_script_version }
219           sdnc_ip: { get_input: sdnc_ip_addr }
220           cloud_env: { get_input: cloud_env }
221           nexus_artifact_repo: { get_input: nexus_artifact_repo }
222         boot_data: |
223           #!/bin/bash
224           METADATA=`curl -s http://169.254.169.254/openstack/2012-08-10/meta_data.json`
225           apt-get -y install jq
226
227           get_metadata () {
228             echo $METADATA | jq -r ".meta.$1"
229           }
230
231           # Create configuration files
232           mkdir /opt/config
233           echo "$(get_metadata vbrgemu_bng_private_net_cidr)" > /opt/config/brgemu_bng_private_net_cidr.txt
234           echo "$(get_metadata demo_artifacts_version)" > /opt/config/demo_artifacts_version.txt
235           echo "$(get_metadata install_script_version)" > /opt/config/install_script_version.txt
236           echo "$(get_metadata cloud_env)" > /opt/config/cloud_env.txt
237           echo "$(get_metadata sdnc_ip)" > /opt/config/sdnc_ip.txt
238           echo "$(get_metadata nexus_artifact_repo)" > /opt/config/nexus_artifact_repo.txt
239
240           # Download and run install script
241           apt-get -y install unzip
242           INSTALL_SCRIPT_VERSION=$(get_metadata install_script_version)
243           NEXUS_ARTIFACT_REPO=$(get_metadata nexus_artifact_repo)
244           if [[ "${INSTALL_SCRIPT_VERSION}" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi
245           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
246           unzip -j /opt/vcpe-scripts-${INSTALL_SCRIPT_VERSION}.zip -d /opt v_brgemu_install.sh
247           cd /opt
248           chmod +x v_brgemu_install.sh
249           ./v_brgemu_install.sh
250       capabilities:
251         virtual_compute:
252           properties:
253             virtual_memory:
254               virtual_mem_size: 4096 MB
255               vdu_mem_requirements:
256                 memoryPageSize: '{"schemaVersion": "0", "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "2 MB"}'
257                 numberOfPages: '{"schemaVersion": "0","schemaSelector": "","hardwarePlatform": "generic","mandatory": "true", "configurationValue": "1024"}'
258             virtual_cpu:
259               num_virtual_cpu: 2
260               cpu_architecture: generic
261             virtual_local_storage:
262               - size_of_storage: 40 GB
263       artifacts:
264         sw_image: #TODO need to put glance image name here
265           #file: { get_input: vcpe_image_name }
266           file: ../Artifacts/Deployment/OTHER/image
267           type: tosca.artifacts.nfv.SwImage