blob: 003deb9103832e30596248ac031c0a71625086ee [file] [log] [blame]
DR695Hccff30b2017-02-17 18:44:24 -05001heat_template_version: 2013-05-23
2
3description: Heat template to deploy a vDNS for OpenECOMP (scaling-up scenario)
4
5parameters:
6 vlb_image_name:
7 type: string
8 label: Image name or ID
9 description: Image to be used for compute instance
10 vlb_flavor_name:
11 type: string
12 label: Flavor
13 description: Type of instance (flavor) to be used
14 public_net_id:
15 type: string
16 label: Public network name or ID
17 description: Public network that enables remote connection to VNF
18 vlb_private_net_id:
19 type: string
20 label: vLoadBalancer private network name or ID
21 description: Private network that connects vLoadBalancer with vDNSs
22 ecomp_private_net_id:
23 type: string
24 label: ECOMP management network name or ID
25 description: Private network that connects ECOMP component and the VNF
26 ecomp_private_subnet_id:
27 type: string
28 label: ECOMP management sub-network name or ID
29 description: Private sub-network that connects ECOMP component and the VNF
30 vlb_private_ip_0:
31 type: string
32 label: vLoadBalancer private IP address towards the private network
33 description: Private IP address that is assigned to the vLoadBalancer to communicate with the vDNSs
34 vlb_private_ip_1:
35 type: string
36 label: vLoadBalancer private IP address towards the ECOMP management network
37 description: Private IP address that is assigned to the vLoadBalancer to communicate with ECOMP components
38 vdns_private_ip_0:
39 type: string
40 label: vDNS private IP address towards the private network
41 description: Private IP address that is assigned to the vDNS to communicate with the vLoadBalancer
42 vdns_private_ip_1:
43 type: string
44 label: vDNS private IP address towards the ECOMP management network
45 description: Private IP address that is assigned to the vDNS to communicate with ECOMP components
46 vdns_name_0:
47 type: string
48 label: vDNS name
49 description: Name of the vDNS
50 vnf_id:
51 type: string
52 label: VNF ID
53 description: The VNF ID is provided by ECOMP
54 vf_module_id:
55 type: string
56 label: vFirewall module ID
57 description: The vLoadBalancer Module ID is provided by ECOMP
DR695Hccff30b2017-02-17 18:44:24 -050058 key_name:
59 type: string
60 label: Key pair name
61 description: Public/Private key pair name
62 pub_key:
63 type: string
64 label: Public key
65 description: Public key to be installed on the compute instance
jf98609ab26342017-02-28 15:07:36 -050066 repo_url_blob:
DR695Hccff30b2017-02-17 18:44:24 -050067 type: string
68 label: Repository URL
69 description: URL of the repository that hosts the demo packages
jf98609ab26342017-02-28 15:07:36 -050070 repo_url_artifacts:
71 type: string
72 label: Repository URL
73 description: URL of the repository that hosts the demo packages
74 demo_artifacts_version:
75 type: string
76 label: Artifacts version used in demo vnfs
77 description: Artifacts (jar, tar.gz) version used in demo vnfs
DR695Hccff30b2017-02-17 18:44:24 -050078
79resources:
jf98609ab26342017-02-28 15:07:36 -050080
81 random-str:
82 type: OS::Heat::RandomString
83 properties:
84 length: 4
85
86 my_keypair:
87 type: OS::Nova::KeyPair
88 properties:
89 name:
90 str_replace:
91 template: base_rand
92 params:
93 base: { get_param: key_name }
94 rand: { get_resource: random-str }
95 public_key: { get_param: pub_key }
96 save_private_key: false
97
DR695Hccff30b2017-02-17 18:44:24 -050098 vdns_0:
99 type: OS::Nova::Server
100 properties:
101 image: { get_param: vlb_image_name }
102 flavor: { get_param: vlb_flavor_name }
103 name: { get_param: vdns_name_0 }
jf98609ab26342017-02-28 15:07:36 -0500104 key_name: { get_resource: my_keypair }
DR695Hccff30b2017-02-17 18:44:24 -0500105 networks:
106 - network: { get_param: public_net_id }
107 - port: { get_resource: vdns_private_0_port }
108 - port: { get_resource: vdns_private_1_port }
109 metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
110 user_data_format: RAW
111 user_data:
112 str_replace:
113 params:
DR695Hccff30b2017-02-17 18:44:24 -0500114 __lb_oam_int__ : { get_param: vlb_private_ip_1 }
115 __lb_private_ipaddr__: { get_param: vlb_private_ip_0 }
116 __local_private_ipaddr__: { get_param: vdns_private_ip_0 }
jf98609ab26342017-02-28 15:07:36 -0500117 __repo_url_blob__ : { get_param: repo_url_blob }
118 __repo_url_artifacts__ : { get_param: repo_url_artifacts }
119 __demo_artifacts_version__ : { get_param: demo_artifacts_version }
DR695Hccff30b2017-02-17 18:44:24 -0500120 template: |
121 #!/bin/bash
122
DR695Hccff30b2017-02-17 18:44:24 -0500123 LB_OAM_INT=__lb_oam_int__
124 LB_PRIVATE_IPADDR=__lb_private_ipaddr__
125 LOCAL_PRIVATE_IPADDR=__local_private_ipaddr__
jf98609ab26342017-02-28 15:07:36 -0500126 REPO_URL_BLOB=__repo_url_blob__
127 REPO_URL_ARTIFACTS=__repo_url_artifacts__
128 DEMO_ARTIFACTS_VERSION=__demo_artifacts_version__
DR695Hccff30b2017-02-17 18:44:24 -0500129
130 # Download required dependencies
131 add-apt-repository -y ppa:openjdk-r/ppa
132 apt-get update
133 apt-get install -y wget openjdk-8-jdk bind9 bind9utils bind9-doc apt-transport-https ca-certificates
jf98609ab26342017-02-28 15:07:36 -0500134 apt-get install -y maven
DR695Hccff30b2017-02-17 18:44:24 -0500135 sleep 1
136
DR695Hccff30b2017-02-17 18:44:24 -0500137 # Download vDNS demo code for DNS Server
138 mkdir /opt/config
jf98609ab26342017-02-28 15:07:36 -0500139 mkdir /opt/FDclient
DR695Hccff30b2017-02-17 18:44:24 -0500140 cd /opt
jf98609ab26342017-02-28 15:07:36 -0500141
142 wget $REPO_URL_BLOB/org.openecomp.demo/vnfs/vlb/$DEMO_ARTIFACTS_VERSION/v_dns_init.sh
143 wget $REPO_URL_BLOB/org.openecomp.demo/vnfs/vlb/$DEMO_ARTIFACTS_VERSION/vdns.sh
144 wget $REPO_URL_BLOB/org.openecomp.demo/vnfs/vlb/$DEMO_ARTIFACTS_VERSION/dnsclient.sh
145 wget $REPO_URL_BLOB/org.openecomp.demo/vnfs/vlb/$DEMO_ARTIFACTS_VERSION/set_gre_tunnel.sh
146
147 mvn org.apache.maven.plugins:maven-dependency-plugin:2.10:get -DremoteRepositories=$REPO_URL_ARTIFACTS -Dartifact=org.openecomp.demo.vnf.vlb:dns-client:$DEMO_ARTIFACTS_VERSION:jar -Dtransitive=false -Ddest=.
148
149 mv dns-client-$DEMO_ARTIFACTS_VERSION.jar /opt/FDclient/
150 mv dnsclient.sh /opt/FDclient/
151 mv set_gre_tunnel.sh /opt/FDclient/
152
DR695Hccff30b2017-02-17 18:44:24 -0500153 chmod +x v_dns_init.sh
154 chmod +x vdns.sh
jf98609ab26342017-02-28 15:07:36 -0500155 chmod +x /opt/FDclient/dnsclient.sh
156 chmod +x /opt/FDclient/set_gre_tunnel.sh
157
DR695Hccff30b2017-02-17 18:44:24 -0500158 echo $LB_OAM_INT > config/lb_oam_int.txt
159 echo $LB_PRIVATE_IPADDR > config/lb_private_ipaddr.txt
160 echo $LOCAL_PRIVATE_IPADDR > config/local_private_ipaddr.txt
jf98609ab26342017-02-28 15:07:36 -0500161 echo $DEMO_ARTIFACTS_VERSION > config/artifacts_version.txt
DR695Hccff30b2017-02-17 18:44:24 -0500162
163 # Download Bind config files
164 cd /opt/config
jf98609ab26342017-02-28 15:07:36 -0500165 wget $REPO_URL_BLOB/org.openecomp.demo/vnfs/vlb/$DEMO_ARTIFACTS_VERSION/db_dnsdemo_openecomp_org
166 wget $REPO_URL_BLOB/org.openecomp.demo/vnfs/vlb/$DEMO_ARTIFACTS_VERSION/named.conf.options
167 wget $REPO_URL_BLOB/org.openecomp.demo/vnfs/vlb/$DEMO_ARTIFACTS_VERSION/named.conf.local
DR695Hccff30b2017-02-17 18:44:24 -0500168
169 # Configure Bind
170 modprobe ip_gre
171 mkdir /etc/bind/zones
172 sed -i "s/OPTIONS=.*/OPTIONS=\"-4 -u bind\"/g" /etc/default/bind9
jf98609ab26342017-02-28 15:07:36 -0500173 mv db_dnsdemo_openecomp_org /etc/bind/zones/db.dnsdemo.openecomp.org
174 mv named.conf.options /etc/bind/
175 mv named.conf.local /etc/bind/
DR695Hccff30b2017-02-17 18:44:24 -0500176 sleep 1
177
178 # Run instantiation script
179 cd /opt
180 mv vdns.sh /etc/init.d
181 update-rc.d vdns.sh defaults
182 ./v_dns_init.sh
183
184 vdns_private_0_port:
185 type: OS::Neutron::Port
186 properties:
187 network: { get_param: vlb_private_net_id }
188 fixed_ips: [{"subnet": { get_param: vlb_private_net_id }, "ip_address": { get_param: vdns_private_ip_0 }}]
189
190 vdns_private_1_port:
191 type: OS::Neutron::Port
192 properties:
193 network: { get_param: ecomp_private_net_id }
194 fixed_ips: [{"subnet": { get_param: ecomp_private_subnet_id }, "ip_address": { get_param: vdns_private_ip_1 }}]