X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=vnfs%2FvLB%2Fscripts%2Fv_lb_install.sh;h=da1c5b414afda6c658d0371a49aca8e0b958ff44;hb=9f94d8c2fd838c1607f630dfdd5f936605d9873f;hp=254a47534ad72637dfe0e648ff6c4e897de40919;hpb=0d0df1dd2beeaed841a2538b95dcc02cd15f98df;p=demo.git diff --git a/vnfs/vLB/scripts/v_lb_install.sh b/vnfs/vLB/scripts/v_lb_install.sh index 254a4753..da1c5b41 100644 --- a/vnfs/vLB/scripts/v_lb_install.sh +++ b/vnfs/vLB/scripts/v_lb_install.sh @@ -6,25 +6,45 @@ 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) +# Convert Network CIDR to Netmask +cdr2mask () { + # Number of args to shift, 255..255, first non-255 byte, zeroes + set -- $(( 5 - ($1 / 8) )) 255 255 255 255 $(( (255 << (8 - ($1 % 8))) & 255 )) 0 0 0 + [ $1 -gt 1 ] && shift $1 || shift + echo ${1-0}.${2-0}.${3-0}.${4-0} +} + # 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) + # Allow remote login as root + mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk + cp /home/ubuntu/.ssh/authorized_keys /root/.ssh + + MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) + + IP=$(cat /opt/config/local_private_ipaddr.txt) + BITS=$(cat /opt/config/vlb_private_net_cidr.txt | cut -d"/" -f2) + NETMASK=$(cdr2mask $BITS) 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 + echo " address $IP" >> /etc/network/interfaces + echo " netmask $NETMASK" >> /etc/network/interfaces + echo " mtu $MTU" >> /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 + IP=$(cat /opt/config/oam_private_ipaddr.txt) + BITS=$(cat /opt/config/onap_private_net_cidr.txt | cut -d"/" -f2) + NETMASK=$(cdr2mask $BITS) + echo "auto eth2" >> /etc/network/interfaces + echo "iface eth2 inet static" >> /etc/network/interfaces + echo " address $IP" >> /etc/network/interfaces + echo " netmask $NETMASK" >> /etc/network/interfaces + echo " mtu $MTU" >> /etc/network/interfaces ifup eth1 -# ifup eth2 + ifup eth2 fi # Download required dependencies