Fix spacing issues in YAML files in heat
[demo.git] / heat / vCPE / vbrgemu / base_vcpe_vbrgemu.yaml
1 ##########################################################################
2 #
3 #==================LICENSE_START==========================================
4 #
5 #
6 # Copyright 2017 AT&T Intellectual Property. All rights reserved.
7 #
8 # Licensed under the Apache License, Version 2.0 (the "License");
9 # you may not use this file except in compliance with the License.
10 # You may obtain a copy of the License at
11 #        http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 #
19 #==================LICENSE_END============================================
20 #
21 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
22 #
23 ##########################################################################
24
25 heat_template_version: 2013-05-23
26
27 description: Heat template to deploy vCPE vBRG Emulator (vBRGEMU)
28
29 #######################################################################
30 #                                                                     #
31 # PARAMETERS                                                                                                #
32 #                                                                     #
33 #     0_port should get IP address from DHCP discover through vBNG    #
34 #     DCAE is not monitoring the BRGEMULATOR                          #
35 #######################################################################
36
37 parameters:
38   vcpe_image_name:
39     type: string
40     label: Image name or ID
41     description: Image to be used for compute instance
42   vcpe_flavor_name:
43     type: string
44     label: Flavor
45     description: Type of instance (flavor) to be used
46   public_net_id:
47     type: string
48     label: Public network name or ID
49     description: Public network that enables remote connection to VNF
50   vbrgemu_bng_private_net_id:
51     type: string
52     label: vBNG private network name or ID
53     description: Private network that connects vBRGEMU to vBNG
54   vbrgemu_bng_private_subnet_id:
55     type: string
56     label: vBNG private sub-network name or ID
57     description: vBNG private sub-network name or ID
58   vbrgemu_bng_private_net_cidr:
59     type: string
60     label: vBNG IN private network CIDR
61     description: The CIDR of the input side of vBNG private network
62  # vbrgemu_private_net_id:
63  #   type: string
64  #   label: vBRGEMU Home private network name or ID
65  #   description: Private network that connects vBRGEMU to local devices
66   #vbrgemu_private_net_cidr:
67   #  type: string
68   #  label: vBRGEMU Home private network CIDR
69   #  description: The CIDR of the input side of vBRGEMU Home private network
70 ##  vbrgemu_private_ip_0:
71 ##    type: string
72 ##    label: vGW private IP address
73 ##    description: Private IP address towards the BRGEMU-BNG network
74 ##    VPP will use DHCP so does not need to be provided by preload
75   #vbrgemu_private_ip_1:
76   #  type: string
77   #  label: vGW private IP address
78   #  description: Private IP address towards the BRGEMU private network
79   vbrgemu_name_0:
80     type: string
81     label: vBRG name
82     description: Name of the vBRG
83   vnf_id:
84     type: string
85     label: VNF ID
86     description: The VNF ID is provided by ONAP
87   vf_module_id:
88     type: string
89     label: vCPE module ID
90     description: The vCPE Module ID is provided by ONAP
91   key_name:
92     type: string
93     label: Key pair name
94     description: Public/Private key pair name
95   pub_key:
96     type: string
97     label: Public key
98     description: Public key to be installed on the compute instance
99   script_version:
100     type: string
101     label: Installation script version number
102     description: Version number of the scripts that install the vFW demo app
103   demo_artifacts_version:
104     type: string
105     label: Artifacts version used in demo vnfs
106     description: Artifacts (jar, tar.gz) version used in demo vnfs
107   nexus_artifact_repo:
108     type: string
109     description: Root URL for the Nexus repository for Maven artifacts.
110     default: "https://nexus.onap.org"
111   cloud_env:
112     type: string
113     label: Cloud environment
114     description: Cloud environment (e.g., openstack, rackspace)
115   sdnc_ip:
116     type: string
117     label: SDNC ip address
118     description: SDNC ip address used to set NAT
119
120 #############
121 #           #
122 # RESOURCES #
123 #           #
124 #############
125
126 resources:
127
128   random-str:
129     type: OS::Heat::RandomString
130     properties:
131       length: 4
132
133   my_keypair:
134     type: OS::Nova::KeyPair
135     properties:
136       name:
137         str_replace:
138           template: base_rand
139           params:
140             base: { get_param: key_name }
141             rand: { get_resource: random-str }
142       public_key: { get_param: pub_key }
143       save_private_key: false
144
145   #vbrgemu_private_network:
146   #  type: OS::Neutron::Net
147   #  properties:
148   #    name: { get_param: vbrgemu_private_net_id }
149
150   #vbrgemu_private_subnet:
151   #  type: OS::Neutron::Subnet
152   #  properties:
153   #    name: { get_param: vbrgemu_private_net_id }
154   #    network_id: { get_resource: vbrgemu_private_network }
155   #    cidr: { get_param: vbrgemu_private_net_cidr }
156
157   # Virtual BRG Emulator Instantiation
158   # 0_port should get IP address from DHCP discover through vBNG once the VNF is running
159   vbrgemu_private_0_port:
160     type: OS::Neutron::Port
161     properties:
162       network: { get_param: vbrgemu_bng_private_net_id }
163    #    fixed_ips: [{"subnet": { get_param: vbrgemu_bng_private_subnet_id }}]
164   ##    fixed_ips: [{"subnet": { get_param: vbrgemu_bng_private_subnet_id }, "ip_address": { get_param: vbrgemu_private_ip_0 }}]
165
166   #vbrgemu_private_1_port:
167   #  type: OS::Neutron::Port
168   #  properties:
169   #    network: { get_resource: vbrgemu_private_network }
170   #    fixed_ips: [{"subnet": { get_resource: vbrgemu_private_subnet }, "ip_address": { get_param: vbrgemu_private_ip_1 }}]
171
172   vbrgemu_0:
173     type: OS::Nova::Server
174     properties:
175       image: { get_param: vcpe_image_name }
176       flavor: { get_param: vcpe_flavor_name }
177       name: { get_param: vbrgemu_name_0 }
178       key_name: { get_resource: my_keypair }
179       networks:
180         - network: { get_param: public_net_id }
181         - port: { get_resource: vbrgemu_private_0_port }
182         #- port: { get_resource: vbrgemu_private_1_port }
183       metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
184       user_data_format: RAW
185       user_data:
186         str_replace:
187           params:
188            # __brgemu_net_ipaddr__: { get_param: vbrgemu_private_ip_1 }
189            # __brgemu_cidr__: { get_param: vbrgemu_private_net_cidr }
190             __brgemu_bng_private_net_cidr__: { get_param: vbrgemu_bng_private_net_cidr }
191             __demo_artifacts_version__: { get_param: demo_artifacts_version }
192             __script_version__: { get_param: script_version }
193             __cloud_env__: { get_param: cloud_env }
194             __sdnc_ip__: { get_param: sdnc_ip }
195             __nexus_artifact_repo__: { get_param: nexus_artifact_repo }
196           template: |
197             #!/bin/bash
198
199             # Create configuration files
200             mkdir /opt/config
201             #echo "__brgemu_net_ipaddr__" > /opt/config/brgemu_net_ipaddr.txt
202             #echo "__brgemu_cidr__" > /opt/config/brgemu_net_cidr.txt
203             echo "__brgemu_bng_private_net_cidr__" > /opt/config/brgemu_bng_private_net_cidr.txt
204             echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
205             echo "__script_version__" > /opt/config/script_version.txt
206             echo "__cloud_env__" > /opt/config/cloud_env.txt
207             echo "__sdnc_ip__" > /opt/config/sdnc_ip.txt
208             echo "__nexus_artifact_repo__" > /opt/config/nexus_artifact_repo.txt
209
210             # Download and run install script
211             apt-get update
212             apt-get -y install unzip
213             if [[ "__script_version__" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi
214             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=__script_version__" -o /opt/vcpe-scripts-__script_version__.zip
215             unzip -j /opt/vcpe-scripts-__script_version__.zip -d /opt v_brgemu_install.sh
216             cd /opt
217             chmod +x v_brgemu_install.sh
218             ./v_brgemu_install.sh