Merge "Add dns list for demo vagrant"
[demo.git] / vnfs / vLB / scripts / v_lb_install.sh
index b5f6fd6..254a475 100644 (file)
@@ -6,6 +6,27 @@ DEMO_ARTIFACTS_VERSION=$(cat /opt/config/demo_artifacts_version.txt)
 INSTALL_SCRIPT_VERSION=$(cat /opt/config/install_script_version.txt)
 CLOUD_ENV=$(cat /opt/config/cloud_env.txt)
 
+# OpenStack network configuration
+if [[ $CLOUD_ENV == "openstack" ]]
+then
+       echo 127.0.0.1 $(hostname) >> /etc/hosts
+
+       VLB_PRIVATE_IP_O=$(cat /opt/config/local_private_ipaddr.txt)
+       echo "auto eth1" >> /etc/network/interfaces
+       echo "iface eth1 inet static" >> /etc/network/interfaces
+       echo "    address $VLB_PRIVATE_IP_O" >> /etc/network/interfaces
+       echo "    netmask 255.255.255.0" >> /etc/network/interfaces
+
+#      VLB_PRIVATE_IP_1=$(cat /opt/config/oam_private_ipaddr.txt)
+#      echo "auto eth2" >> /etc/network/interfaces
+#      echo "iface eth2 inet static" >> /etc/network/interfaces
+#      echo "    address $VLB_PRIVATE_IP_1" >> /etc/network/interfaces
+#      echo "    netmask 255.255.255.0" >> /etc/network/interfaces
+
+       ifup eth1
+#      ifup eth2
+fi
+
 # Download required dependencies
 add-apt-repository -y ppa:openjdk-r/ppa
 apt-get update
@@ -45,6 +66,13 @@ chmod +x /opt/FDserver/dnsmembership.sh
 chmod +x /opt/FDserver/add_dns.sh
 chmod +x /opt/FDserver/remove_dns.sh
 
+# Create a file with public IP of the VM if it doesn't exist. This is for VMs directly attached to the external network.
+if [ ! -e /opt/config/local_public_ipaddr.txt ]
+then
+       IP_ADDRESS=$(ifconfig eth0 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
+       echo $IP_ADDRESS > /opt/config/local_public_ipaddr.txt
+fi
+
 # Install VPP
 export UBUNTU="trusty"
 export RELEASE=".stable.1609"