DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 1 | heat_template_version: 2013-05-23 |
| 2 | |
Jerry Flood | 3fc36a3 | 2017-10-11 11:09:19 -0400 | [diff] [blame] | 3 | description: Heat template to deploy a vDNS for OpenECOMP (scaling-up scenario) |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 4 | |
| 5 | parameters: |
| 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 Flood | 3fc36a3 | 2017-10-11 11:09:19 -0400 | [diff] [blame] | 22 | ecomp_private_net_id: |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 23 | type: string |
Jerry Flood | 3fc36a3 | 2017-10-11 11:09:19 -0400 | [diff] [blame] | 24 | label: ECOMP management network name or ID |
| 25 | description: Private network that connects ECOMP component and the VNF |
| 26 | ecomp_private_subnet_id: |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 27 | type: string |
Jerry Flood | 3fc36a3 | 2017-10-11 11:09:19 -0400 | [diff] [blame] | 28 | label: ECOMP management sub-network name or ID |
| 29 | description: Private sub-network that connects ECOMP component and the VNF |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 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 |
Jerry Flood | 3fc36a3 | 2017-10-11 11:09:19 -0400 | [diff] [blame] | 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 |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 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 |
Jerry Flood | 3fc36a3 | 2017-10-11 11:09:19 -0400 | [diff] [blame] | 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 |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 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 |
Jerry Flood | 3fc36a3 | 2017-10-11 11:09:19 -0400 | [diff] [blame] | 53 | description: The VNF ID is provided by ECOMP |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 54 | vf_module_id: |
| 55 | type: string |
| 56 | label: vFirewall module ID |
Jerry Flood | 3fc36a3 | 2017-10-11 11:09:19 -0400 | [diff] [blame] | 57 | description: The vLoadBalancer Module ID is provided by ECOMP |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 58 | 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 |
jf9860 | 9ab2634 | 2017-02-28 15:07:36 -0500 | [diff] [blame] | 66 | repo_url_blob: |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 67 | type: string |
| 68 | label: Repository URL |
| 69 | description: URL of the repository that hosts the demo packages |
jf9860 | 9ab2634 | 2017-02-28 15:07:36 -0500 | [diff] [blame] | 70 | 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 |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 78 | |
| 79 | resources: |
jf9860 | 9ab2634 | 2017-02-28 15:07:36 -0500 | [diff] [blame] | 80 | |
| 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 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 98 | 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 } |
jf9860 | 9ab2634 | 2017-02-28 15:07:36 -0500 | [diff] [blame] | 104 | key_name: { get_resource: my_keypair } |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 105 | 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 Flood | 3fc36a3 | 2017-10-11 11:09:19 -0400 | [diff] [blame] | 114 | __lb_oam_int__ : { get_param: vlb_private_ip_1 } |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 115 | __lb_private_ipaddr__: { get_param: vlb_private_ip_0 } |
| 116 | __local_private_ipaddr__: { get_param: vdns_private_ip_0 } |
Jerry Flood | 3fc36a3 | 2017-10-11 11:09:19 -0400 | [diff] [blame] | 117 | __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 } |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 120 | template: | |
| 121 | #!/bin/bash |
| 122 | |
Jerry Flood | 3fc36a3 | 2017-10-11 11:09:19 -0400 | [diff] [blame] | 123 | 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 Flood | d750315 | 2017-10-09 16:33:00 -0400 | [diff] [blame] | 129 | |
Jerry Flood | 3fc36a3 | 2017-10-11 11:09:19 -0400 | [diff] [blame] | 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 |
| 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 |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 140 | cd /opt |
Jerry Flood | 3fc36a3 | 2017-10-11 11:09:19 -0400 | [diff] [blame] | 141 | |
| 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 }}] |