3 # Read configuration files
4 NEXUS_REPO=$(cat /opt/config/nexus_repo.txt)
5 ARTIFACTS_VERSION=$(cat /opt/config/artifacts_version.txt)
6 CLOUD_ENV=$(cat /opt/config/cloud_env.txt)
8 if [[ $CLOUD_ENV != "rackspace" ]]
10 # Add host name to /etc/host to avoid warnings in openstack images
11 echo 127.0.0.1 $(hostname) >> /etc/hosts
13 # Allow remote login as root
14 mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk
15 cp /home/ubuntu/.ssh/authorized_keys /root/.ssh
17 # Set the Bind configuration file name based on the deployment environment
18 ZONE_FILE="bind_zones"
19 OPTIONS_FILE="bind_options"
21 ZONE_FILE="db_simpledemo_openecomp_org"
22 OPTIONS_FILE="named.conf.options"
25 # Set private IP in /etc/network/interfaces manually in the presence of public interface
26 # Some VM images don't add the private interface automatically, we have to do it during the component installation
27 if [[ $CLOUD_ENV == "openstack_nofloat" ]]
29 LOCAL_IP=$(cat /opt/config/dns_ip_addr.txt)
30 CIDR=$(cat /opt/config/oam_network_cidr.txt)
31 BITMASK=$(echo $CIDR | cut -d"/" -f2)
33 # Compute the netmask based on the network cidr
34 if [[ $BITMASK == "8" ]]
37 elif [[ $BITMASK == "16" ]]
40 elif [[ $BITMASK == "24" ]]
45 echo "auto eth1" >> /etc/network/interfaces
46 echo "iface eth1 inet static" >> /etc/network/interfaces
47 echo " address $LOCAL_IP" >> /etc/network/interfaces
48 echo " netmask $NETMASK" >> /etc/network/interfaces
52 # Download dependencies
53 add-apt-repository -y ppa:openjdk-r/ppa
55 apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk bind9 bind9utils bind9-doc ntp ntpdate
59 curl -k $NEXUS_REPO/org.openecomp.demo/boot/$ARTIFACTS_VERSION/$ZONE_FILE -o /etc/bind/zones/db.simpledemo.openecomp.org
60 curl -k $NEXUS_REPO/org.openecomp.demo/boot/$ARTIFACTS_VERSION/$OPTIONS_FILE -o /etc/bind/named.conf.options
61 curl -k $NEXUS_REPO/org.openecomp.demo/boot/$ARTIFACTS_VERSION/named.conf.local -o /etc/bind/named.conf.local
63 # Set the private IP address of each ONAP VM in the Bind configuration in OpenStack deployments
64 if [[ $CLOUD_ENV != "rackspace" ]]
66 sed -i "s/dns_ip_addr/"$(cat /opt/config/dns_ip_addr.txt)"/g" /etc/bind/named.conf.options
67 sed -i "s/external_dns/"$(cat /opt/config/external_dns.txt)"/g" /etc/bind/named.conf.options
68 sed -i "s/aai_ip_addr/"$(cat /opt/config/aai_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.openecomp.org
69 sed -i "s/appc_ip_addr/"$(cat /opt/config/appc_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.openecomp.org
70 sed -i "s/dcae_ip_addr/"$(cat /opt/config/dcae_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.openecomp.org
71 sed -i "s/dns_ip_addr/"$(cat /opt/config/dns_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.openecomp.org
72 sed -i "s/mso_ip_addr/"$(cat /opt/config/mso_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.openecomp.org
73 sed -i "s/mr_ip_addr/"$(cat /opt/config/mr_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.openecomp.org
74 sed -i "s/policy_ip_addr/"$(cat /opt/config/policy_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.openecomp.org
75 sed -i "s/portal_ip_addr/"$(cat /opt/config/portal_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.openecomp.org
76 sed -i "s/robot_ip_addr/"$(cat /opt/config/robot_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.openecomp.org
77 sed -i "s/sdc_ip_addr/"$(cat /opt/config/sdc_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.openecomp.org
78 sed -i "s/sdnc_ip_addr/"$(cat /opt/config/sdnc_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.openecomp.org
79 sed -i "s/vid_ip_addr/"$(cat /opt/config/vid_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.openecomp.org
80 sed -i "s/dcae_coll_ip_addr/"$(cat /opt/config/dcae_coll_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.openecomp.org
85 sed -i "s/OPTIONS=.*/OPTIONS=\"-4 -u bind\"/g" /etc/default/bind9