aboutsummaryrefslogtreecommitdiffstats
path: root/vnfs/vLB/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'vnfs/vLB/scripts')
-rw-r--r--vnfs/vLB/scripts/v_dns_install.sh24
-rwxr-xr-xvnfs/vLB/scripts/v_lb_init.sh4
-rw-r--r--vnfs/vLB/scripts/v_lb_install.sh24
3 files changed, 39 insertions, 13 deletions
diff --git a/vnfs/vLB/scripts/v_dns_install.sh b/vnfs/vLB/scripts/v_dns_install.sh
index 279205c3..5e51ee2c 100644
--- a/vnfs/vLB/scripts/v_dns_install.sh
+++ b/vnfs/vLB/scripts/v_dns_install.sh
@@ -6,6 +6,14 @@ 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
@@ -17,18 +25,22 @@ then
MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1)
- VDNS_PRIVATE_IP_O=$(cat /opt/config/local_private_ipaddr.txt)
+ 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 $VDNS_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
- VDNS_PRIVATE_IP_1=$(cat /opt/config/oam_private_ipaddr.txt)
+ 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 $VDNS_PRIVATE_IP_1" >> /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
ifup eth1
diff --git a/vnfs/vLB/scripts/v_lb_init.sh b/vnfs/vLB/scripts/v_lb_init.sh
index e41c4ef3..8767a943 100755
--- a/vnfs/vLB/scripts/v_lb_init.sh
+++ b/vnfs/vLB/scripts/v_lb_init.sh
@@ -27,6 +27,8 @@ mask2cidr() {
IPADDR1_MASK=$(ifconfig eth0 | grep "Mask" | awk '{print $4}' | awk -F ":" '{print $2}')
IPADDR1_CIDR=$(mask2cidr $IPADDR1_MASK)
+IPADDR2_MASK=$(ifconfig eth1 | grep "Mask" | awk '{print $4}' | awk -F ":" '{print $2}')
+IPADDR2_CIDR=$(mask2cidr $IPADDR2_MASK)
# Configure VPP for vPacketGenerator
IPADDR1=$(ifconfig eth0 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
@@ -54,7 +56,7 @@ ifconfig eth1 hw ether $FAKE_HWADDR2
ip addr flush dev eth1
ifconfig eth1 up
vppctl tap connect tap111 hwaddr $HWADDR2
-vppctl set int ip address tap-1 $IPADDR2"/24"
+vppctl set int ip address tap-1 $IPADDR2"/"$IPADDR2_CIDR
vppctl set int state tap-1 up
brctl addbr br1
brctl addif br1 tap111
diff --git a/vnfs/vLB/scripts/v_lb_install.sh b/vnfs/vLB/scripts/v_lb_install.sh
index 73fee3d7..da1c5b41 100644
--- a/vnfs/vLB/scripts/v_lb_install.sh
+++ b/vnfs/vLB/scripts/v_lb_install.sh
@@ -6,6 +6,14 @@ 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
@@ -17,18 +25,22 @@ then
MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1)
- VLB_PRIVATE_IP_O=$(cat /opt/config/local_private_ipaddr.txt)
+ 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)
+ 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 $VLB_PRIVATE_IP_1" >> /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
ifup eth1