blob: 003deb9103832e30596248ac031c0a71625086ee [file] [log] [blame]
DR695Hccff30b2017-02-17 18:44:24 -05001heat_template_version: 2013-05-23
2
Jerry Flood3fc36a32017-10-11 11:09:19 -04003description: Heat template to deploy a vDNS for OpenECOMP (scaling-up scenario)
DR695Hccff30b2017-02-17 18:44:24 -05004
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
Jerry Flood3fc36a32017-10-11 11:09:19 -040022 ecomp_private_net_id:
DR695Hccff30b2017-02-17 18:44:24 -050023 type: string
Jerry Flood3fc36a32017-10-11 11:09:19 -040024 label: ECOMP management network name or ID
25 description: Private network that connects ECOMP component and the VNF
26 ecomp_private_subnet_id:
DR695Hccff30b2017-02-17 18:44:24 -050027 type: string
Jerry Flood3fc36a32017-10-11 11:09:19 -040028 label: ECOMP management sub-network name or ID
29 description: Private sub-network that connects ECOMP component and the VNF
DR695Hccff30b2017-02-17 18:44:24 -050030 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
Jerry Flood3fc36a32017-10-11 11:09:19 -040036 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
DR695Hccff30b2017-02-17 18:44:24 -050038 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
Jerry Flood3fc36a32017-10-11 11:09:19 -040044 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
DR695Hccff30b2017-02-17 18:44:24 -050046 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
Jerry Flood3fc36a32017-10-11 11:09:19 -040053 description: The VNF ID is provided by ECOMP
DR695Hccff30b2017-02-17 18:44:24 -050054 vf_module_id:
55 type: string
56 label: vFirewall module ID
Jerry Flood3fc36a32017-10-11 11:09:19 -040057 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:
Jerry Flood3fc36a32017-10-11 11:09:19 -0400114 __lb_oam_int__ : { get_param: vlb_private_ip_1 }
DR695Hccff30b2017-02-17 18:44:24 -0500115 __lb_private_ipaddr__: { get_param: vlb_private_ip_0 }
116 __local_private_ipaddr__: { get_param: vdns_private_ip_0 }
Jerry Flood3fc36a32017-10-11 11:09:19 -0400117 __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
Jerry Flood3fc36a32017-10-11 11:09:19 -0400123 LB_OAM_INT=__lb_oam_int__
124 LB_PRIVATE_IPADDR=__lb_private_ipaddr__
125 LOCAL_PRIVATE_IPADDR=__local_private_ipaddr__
126 REPO_URL_BLOB=__repo_url_blob__
127 REPO_URL_ARTIFACTS=__repo_url_artifacts__
128 DEMO_ARTIFACTS_VERSION=__demo_artifacts_version__
Jerry Floodd7503152017-10-09 16:33:00 -0400129
Jerry Flood3fc36a32017-10-11 11:09:19 -0400130 # 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
134 apt-get install -y maven
135 sleep 1
136
137 # Download vDNS demo code for DNS Server
138 mkdir /opt/config
139 mkdir /opt/FDclient
DR695Hccff30b2017-02-17 18:44:24 -0500140 cd /opt
Jerry Flood3fc36a32017-10-11 11:09:19 -0400141
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
153 chmod +x v_dns_init.sh
154 chmod +x vdns.sh
155 chmod +x /opt/FDclient/dnsclient.sh
156 chmod +x /opt/FDclient/set_gre_tunnel.sh
157
158 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
161 echo $DEMO_ARTIFACTS_VERSION > config/artifacts_version.txt
162
163 # Download Bind config files
164 cd /opt/config
165 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
168
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
173 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/
176 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 }}]