summaryrefslogtreecommitdiffstats
path: root/vnfs/vLB/scripts
diff options
context:
space:
mode:
authorMarco Platania <platania@research.att.com>2017-08-15 13:44:48 -0400
committerMarco Platania <platania@research.att.com>2017-08-15 13:44:48 -0400
commita445ef826ac13e271f89f3e6b221df2d0be3d623 (patch)
tree9d7c978f5ec9f95de0853914ac0095cf29e96cee /vnfs/vLB/scripts
parent0f379776bf59d6f0faf5c8e24996eeaf6bbb6239 (diff)
Update vLB to Ubuntu 1604 and VPP 1707
vLB based on Ubuntu 1404 and VPP 1609 doesn't work in some OpenStack labs Change-Id: Ibbd904d0eed1f02b7aca2d173e469c53f235f700 Issue-ID: UCA-34 Signed-off-by: Marco Platania <platania@research.att.com>
Diffstat (limited to 'vnfs/vLB/scripts')
-rw-r--r--vnfs/vLB/scripts/.DS_Storebin8196 -> 0 bytes
-rw-r--r--vnfs/vLB/scripts/add_dns.sh13
-rw-r--r--vnfs/vLB/scripts/dnsmembership.sh4
-rw-r--r--vnfs/vLB/scripts/remove_dns.sh14
-rw-r--r--vnfs/vLB/scripts/v_dns_install.sh13
-rwxr-xr-xvnfs/vLB/scripts/v_lb_init.sh42
-rw-r--r--vnfs/vLB/scripts/v_lb_install.sh36
-rw-r--r--vnfs/vLB/scripts/v_packetgen_for_dns_demo_init.sh43
-rw-r--r--vnfs/vLB/scripts/v_packetgen_install.sh37
9 files changed, 138 insertions, 64 deletions
diff --git a/vnfs/vLB/scripts/.DS_Store b/vnfs/vLB/scripts/.DS_Store
deleted file mode 100644
index 32f7ecab..00000000
--- a/vnfs/vLB/scripts/.DS_Store
+++ /dev/null
Binary files differ
diff --git a/vnfs/vLB/scripts/add_dns.sh b/vnfs/vLB/scripts/add_dns.sh
index 04dfc771..9f250f0c 100644
--- a/vnfs/vLB/scripts/add_dns.sh
+++ b/vnfs/vLB/scripts/add_dns.sh
@@ -7,15 +7,18 @@ then
fi
DNS_IPADDR=$1
-MY_PUBLIC_IP=$(cat /opt/config/local_public_ipaddr.txt)
-MY_PRIVATE_IP=$(cat /opt/config/local_private_ipaddr.txt)
+IP_TO_PKTGEN_NET=$(cat /opt/config/ip_to_pktgen_net.txt)
+IP_TO_DNS_NET=$(cat /opt/config/ip_to_dns_net.txt)
+GRE_IPADDR=$(cat /opt/config/gre_ipaddr.txt)
-vppctl lb as $MY_PUBLIC_IP"/32" $DNS_IPADDR
-GRE=$(vppctl create gre tunnel src $MY_PRIVATE_IP dst $DNS_IPADDR)
+#vppctl lb as $MY_PUBLIC_IP"/32" $DNS_IPADDR
+vppctl lb as $IP_TO_PKTGEN_NET"/32" $DNS_IPADDR
+GRE=$(vppctl create gre tunnel src $IP_TO_DNS_NET dst $DNS_IPADDR)
+vppctl set int ip address $GRE $GRE_IPADDR"/24"
vppctl set int state $GRE up
# Update the number of vDNSs currently active
FD="/opt/VES/code/evel_training/VESreporting/active_dns.txt"
CURR_DNS=$(cat $FD)
let CURR_DNS=$CURR_DNS+1
-echo $CURR_DNS > $FD
+echo $CURR_DNS > $FD \ No newline at end of file
diff --git a/vnfs/vLB/scripts/dnsmembership.sh b/vnfs/vLB/scripts/dnsmembership.sh
index 345dc3ff..e18ab803 100644
--- a/vnfs/vLB/scripts/dnsmembership.sh
+++ b/vnfs/vLB/scripts/dnsmembership.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-MY_PUBLIC_IP=$(cat /opt/config/local_public_ipaddr.txt)
+IP_TO_PKTGEN_NET=$(cat /opt/config/ip_to_pktgen_net.txt)
VERSION=$(cat /opt/config/demo_artifacts_version.txt)
-java -jar dns-manager-$VERSION.jar $MY_PUBLIC_IP 8888 10 3 0
+java -jar dns-manager-$VERSION.jar $IP_TO_PKTGEN_NET 8888 10 3 0
diff --git a/vnfs/vLB/scripts/remove_dns.sh b/vnfs/vLB/scripts/remove_dns.sh
index 1d505abe..f400aa0f 100644
--- a/vnfs/vLB/scripts/remove_dns.sh
+++ b/vnfs/vLB/scripts/remove_dns.sh
@@ -2,23 +2,23 @@
if [ ! "$#" -eq 1 ]
then
- echo "Usage: ./add_dns.sh [remote DNS server]"
+ echo "Usage: ./remove_dns.sh [remote DNS server]"
exit
fi
DNS_IPADDR=$1
-MY_PUBLIC_IP=$(cat /opt/config/local_public_ipaddr.txt)
-MY_PRIVATE_IP=$(cat /opt/config/local_private_ipaddr.txt)
+IP_TO_PKTGEN_NET=$(cat /opt/config/ip_to_pktgen_net.txt)
+IP_TO_DNS_NET=$(cat /opt/config/ip_to_dns_net.txt)
-vppctl lb as $MY_PUBLIC_ID"/32" $DNS_IPADDR del
-vppctl create gre tunnel src $MY_PRIVATE_IP dst $DNS_IPADDR del
+vppctl lb as $IP_TO_PKTGEN_NET"/32" $DNS_IPADDR del
+vppctl create gre tunnel src $IP_TO_DNS_NET dst $DNS_IPADDR del
# Update the number of vDNSs currently active
FD="/opt/VES/code/evel_training/VESreporting/active_dns.txt"
CURR_DNS=$(cat $FD)
let CURR_DNS=$CURR_DNS-1
if [[ $CURR_DNS -lt 0 ]]
-then
+then
CURR_DNS=0
fi
-echo $CURR_DNS > $FD
+echo $CURR_DNS > $FD \ No newline at end of file
diff --git a/vnfs/vLB/scripts/v_dns_install.sh b/vnfs/vLB/scripts/v_dns_install.sh
index 83441ac9..19dc047e 100644
--- a/vnfs/vLB/scripts/v_dns_install.sh
+++ b/vnfs/vLB/scripts/v_dns_install.sh
@@ -92,4 +92,17 @@ sleep 1
cd /opt
mv vdns.sh /etc/init.d
update-rc.d vdns.sh defaults
+
+# Rename network interface in openstack Ubuntu 16.04 images. Then, reboot the VM to pick up changes
+if [[ $CLOUD_ENV != "rackspace" ]]
+then
+ sed -i "s/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\"net.ifnames=0 biosdevname=0\"/g" /etc/default/grub
+ grub-mkconfig -o /boot/grub/grub.cfg
+ sed -i "s/ens[0-9]*/eth0/g" /etc/network/interfaces.d/*.cfg
+ sed -i "s/ens[0-9]*/eth0/g" /etc/udev/rules.d/70-persistent-net.rules
+ echo 'network: {config: disabled}' >> /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
+ echo "APT::Periodic::Unattended-Upgrade \"0\";" >> /etc/apt/apt.conf.d/10periodic
+ reboot
+fi
+
./v_dns_init.sh \ No newline at end of file
diff --git a/vnfs/vLB/scripts/v_lb_init.sh b/vnfs/vLB/scripts/v_lb_init.sh
index 8767a943..3c816c8d 100755
--- a/vnfs/vLB/scripts/v_lb_init.sh
+++ b/vnfs/vLB/scripts/v_lb_init.sh
@@ -1,7 +1,7 @@
#!/bin/bash
# Start VPP
-start vpp
+systemctl start vpp
sleep 1
# Compute the network CIDR from the Netmask
@@ -25,30 +25,41 @@ mask2cidr() {
echo "$nbits"
}
-IPADDR1_MASK=$(ifconfig eth0 | grep "Mask" | awk '{print $4}' | awk -F ":" '{print $2}')
+IPADDR1_MASK=$(ifconfig eth3 | 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)
+IPADDR1=$(ifconfig eth3 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
IPADDR2=$(ifconfig eth1 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
-HWADDR1=$(ifconfig eth0 | grep HWaddr | tr -s ' ' | cut -d' ' -f5)
+HWADDR1=$(ifconfig eth3 | grep HWaddr | tr -s ' ' | cut -d' ' -f5)
HWADDR2=$(ifconfig eth1 | grep HWaddr | tr -s ' ' | cut -d' ' -f5)
-FAKE_HWADDR1=$(echo -n 00; dd bs=1 count=5 if=/dev/urandom 2>/dev/null |hexdump -v -e '/1 ":%02X"')
-FAKE_HWADDR2=$(echo -n 00; dd bs=1 count=5 if=/dev/urandom 2>/dev/null |hexdump -v -e '/1 ":%02X"')
+FAKE_HWADDR1=$(echo -n 00; dd bs=1 count=5 if=/dev/urandom 2>/dev/null | hexdump -v -e '/1 ":%02X"')
+FAKE_HWADDR2=$(echo -n 00; dd bs=1 count=5 if=/dev/urandom 2>/dev/null | hexdump -v -e '/1 ":%02X"')
GW=$(route -n | grep "^0.0.0.0" | awk '{print $2}')
+PKTGEN_IPADDR=$(cat /opt/config/pktgen_ipaddr.txt)
+VIP=$(cat /opt/config/vip.txt)
-ifconfig eth0 down
-ifconfig eth0 hw ether $FAKE_HWADDR1
-ip addr flush dev eth0
-ifconfig eth0 up
+while [ $(ping -c 1 $PKTGEN_IPADDR | grep received | cut -d" " -f4) != 1 ];
+do
+ echo "Wait";
+ sleep 1;
+done
+
+sleep 3
+PKTGEN_MAC=$(arp -n | grep -w $PKTGEN_IPADDR | tr -s ' ' | cut -d' ' -f3)
+
+ifconfig eth3 down
+ifconfig eth3 hw ether $FAKE_HWADDR1
+ip addr flush dev eth3
+ifconfig eth3 up
vppctl tap connect tappub hwaddr $HWADDR1
-vppctl set int ip address tap-0 $IPADDR1"/"$IPADDR1_CIDR
+vppctl set int ip address tap-0 $VIP"/"$IPADDR1_CIDR
vppctl set int state tap-0 up
brctl addbr br0
brctl addif br0 tappub
-brctl addif br0 eth0
+brctl addif br0 eth3
ifconfig br0 up
ifconfig eth1 down
@@ -66,13 +77,16 @@ sleep 1
vppctl lb conf ip4-src-address $IPADDR2
vppctl lb vip $IPADDR1"/32" encap gre4
-vppctl ip route add 0.0.0.0/0 via $GW
sleep 1
+vppctl set ip arp proxy $IPADDR1" - "$IPADDR1
+vppctl set interface proxy-arp tap-0 enable
+vppctl set ip arp tap-0 $PKTGEN_IPADDR $PKTGEN_MAC
+
cd /opt/FDserver
./dnsmembership.sh &>/dev/null &disown
# Start VES client
cd /opt/VES/code/evel_training/VESreporting/
echo 0 > active_dns.txt
-./go-client.sh &>/dev/null &disown
+./go-client.sh &>/dev/null &disown \ No newline at end of file
diff --git a/vnfs/vLB/scripts/v_lb_install.sh b/vnfs/vLB/scripts/v_lb_install.sh
index 394a6c8c..9d4a0c9e 100644
--- a/vnfs/vLB/scripts/v_lb_install.sh
+++ b/vnfs/vLB/scripts/v_lb_install.sh
@@ -25,7 +25,7 @@ then
MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1)
- IP=$(cat /opt/config/local_private_ipaddr.txt)
+ IP=$(cat /opt/config/ip_to_dns_net.txt)
BITS=$(cat /opt/config/vlb_private_net_cidr.txt | cut -d"/" -f2)
NETMASK=$(cdr2mask $BITS)
echo "auto eth1" >> /etc/network/interfaces
@@ -43,8 +43,18 @@ then
echo " netmask $NETMASK" >> /etc/network/interfaces
echo " mtu $MTU" >> /etc/network/interfaces
+ IP=$(cat /opt/config/ip_to_pktgen_net.txt)
+ BITS=$(cat /opt/config/pktgen_private_net_cidr.txt | cut -d"/" -f2)
+ NETMASK=$(cdr2mask $BITS)
+ echo "auto eth3" >> /etc/network/interfaces
+ echo "iface eth3 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 eth3
fi
# Download required dependencies
@@ -86,16 +96,9 @@ 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"
+export UBUNTU="xenial"
+export RELEASE=".stable.1707"
rm /etc/apt/sources.list.d/99fd.io.list
echo "deb [trusted=yes] https://nexus.fd.io/content/repositories/fd.io$RELEASE.ubuntu.$UBUNTU.main/ ./" | sudo tee -a /etc/apt/sources.list.d/99fd.io.list
apt-get update
@@ -112,4 +115,17 @@ sleep 1
cd /opt
mv vlb.sh /etc/init.d
update-rc.d vlb.sh defaults
+
+# Rename network interface in openstack Ubuntu 16.04 images. Then, reboot the VM to pick up changes
+if [[ $CLOUD_ENV != "rackspace" ]]
+then
+ sed -i "s/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\"net.ifnames=0 biosdevname=0\"/g" /etc/default/grub
+ grub-mkconfig -o /boot/grub/grub.cfg
+ sed -i "s/ens[0-9]*/eth0/g" /etc/network/interfaces.d/*.cfg
+ sed -i "s/ens[0-9]*/eth0/g" /etc/udev/rules.d/70-persistent-net.rules
+ echo 'network: {config: disabled}' >> /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
+ echo "APT::Periodic::Unattended-Upgrade \"0\";" >> /etc/apt/apt.conf.d/10periodic
+ reboot
+fi
+
./v_lb_init.sh \ No newline at end of file
diff --git a/vnfs/vLB/scripts/v_packetgen_for_dns_demo_init.sh b/vnfs/vLB/scripts/v_packetgen_for_dns_demo_init.sh
index 9e7879bc..86f0b00f 100644
--- a/vnfs/vLB/scripts/v_packetgen_for_dns_demo_init.sh
+++ b/vnfs/vLB/scripts/v_packetgen_for_dns_demo_init.sh
@@ -1,7 +1,7 @@
#!/bin/bash
# Start VPP
-start vpp
+systemctl start vpp
sleep 1
# Compute the network CIDR from the Netmask
@@ -25,51 +25,45 @@ mask2cidr() {
echo "$nbits"
}
-IPADDR1_MASK=$(ifconfig eth0 | grep "Mask" | awk '{print $4}' | awk -F ":" '{print $2}')
+IPADDR1_MASK=$(ifconfig eth1 | grep "Mask" | awk '{print $4}' | awk -F ":" '{print $2}')
IPADDR1_CIDR=$(mask2cidr $IPADDR1_MASK)
# Configure VPP for vPacketGenerator
-IPADDR1=$(ifconfig eth0 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
-HWADDR1=$(ifconfig eth0 | grep HWaddr | tr -s ' ' | cut -d' ' -f5)
+IPADDR1=$(ifconfig eth1 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
+HWADDR1=$(ifconfig eth1 | grep HWaddr | tr -s ' ' | cut -d' ' -f5)
FAKE_HWADDR1=$(echo -n 00; dd bs=1 count=5 if=/dev/urandom 2>/dev/null | hexdump -v -e '/1 ":%02X"')
VLB_IPADDR=$(cat /opt/config/vlb_ipaddr.txt)
GW=$(route -n | grep "^0.0.0.0" | awk '{print $2}')
-ifconfig eth0 down
-ifconfig eth0 hw ether $FAKE_HWADDR1
-ip addr flush dev eth0
-ifconfig eth0 up
+ifconfig eth1 down
+ifconfig eth1 hw ether $FAKE_HWADDR1
+ip addr flush dev eth1
+ifconfig eth1 up
vppctl tap connect tap111 hwaddr $HWADDR1
vppctl set int ip address tap-0 $IPADDR1"/"$IPADDR1_CIDR
vppctl set int state tap-0 up
brctl addbr br0
brctl addif br0 tap111
-brctl addif br0 eth0
+brctl addif br0 eth1
ifconfig br0 up
vppctl ip route add 0.0.0.0/0 via $GW
sleep 1
-
# Set br0 with public IP and valid MAC so that Linux will have public network access
ifconfig br0 hw ether $HWADDR1
ifconfig br0 $IPADDR1 netmask $IPADDR1_MASK
route add default gw $GW
#Adding static arp entry for VPP so that it will be able to send packets to default GW
-ping -c 1 $VLB_IPADDR &>/dev/null &disown
-sleep 3
+while [ $(ping -c 1 $VLB_IPADDR | grep received | cut -d" " -f4) != 1 ];
+do
+ echo "Wait";
+ sleep 1;
+done
-GW_MAC=$(arp -n | grep -w $GW | tr -s ' ' | cut -d' ' -f3)
+sleep 3
VLB_MAC=$(arp -n | grep -w $VLB_IPADDR | tr -s ' ' | cut -d' ' -f3)
-
-# If VLB is in our network, we will use its MAC
-if [ ! -z "$VLB_MAC" ]
-then
- vppctl set ip arp tap-0 $VLB_IPADDR $VLB_MAC
-fi
-
-# Add arp entry for default GW
-vppctl set ip arp tap-0 $GW $GW_MAC
+vppctl set ip arp tap-0 $VLB_IPADDR $VLB_MAC
# Install packet streams
sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns1
@@ -104,6 +98,8 @@ vppctl exec /opt/dns_streams/stream_dns7
vppctl exec /opt/dns_streams/stream_dns8
vppctl exec /opt/dns_streams/stream_dns9
vppctl exec /opt/dns_streams/stream_dns10
+
+vppctl set int ip address pg0 $(cat /opt/config/pg_int.txt)"/"$IPADDR1_CIDR
sleep 1
# Start HoneyComb
@@ -116,5 +112,4 @@ sleep 20
# Enable traffic flows
cd /opt
chmod +x run_streams_dns.sh
-./run_streams_dns.sh &>/dev/null &disown
-
+./run_streams_dns.sh &>/dev/null &disown \ No newline at end of file
diff --git a/vnfs/vLB/scripts/v_packetgen_install.sh b/vnfs/vLB/scripts/v_packetgen_install.sh
index 2a2d7a24..50d4fce8 100644
--- a/vnfs/vLB/scripts/v_packetgen_install.sh
+++ b/vnfs/vLB/scripts/v_packetgen_install.sh
@@ -14,6 +14,26 @@ then
# 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/pktgen_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 $IP" >> /etc/network/interfaces
+ echo " netmask $NETMASK" >> /etc/network/interfaces
+ echo " mtu $MTU" >> /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
fi
# Download required dependencies
@@ -46,8 +66,8 @@ chmod +x run_streams_dns.sh
chmod +x vdnspacketgen_change_streams_ports.sh
# Install VPP
-export UBUNTU="trusty"
-export RELEASE=".stable.1609"
+export UBUNTU="xenial"
+export RELEASE=".stable.1707"
rm /etc/apt/sources.list.d/99fd.io.list
echo "deb [trusted=yes] https://nexus.fd.io/content/repositories/fd.io$RELEASE.ubuntu.$UBUNTU.main/ ./" | sudo tee -a /etc/apt/sources.list.d/99fd.io.list
apt-get update
@@ -58,4 +78,17 @@ sleep 1
cd /opt
mv vpacketgenfordnsdemo.sh /etc/init.d
update-rc.d vpacketgenfordnsdemo.sh defaults
+
+# Rename network interface in openstack Ubuntu 16.04 images. Then, reboot the VM to pick up changes
+if [[ $CLOUD_ENV != "rackspace" ]]
+then
+ sed -i "s/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\"net.ifnames=0 biosdevname=0\"/g" /etc/default/grub
+ grub-mkconfig -o /boot/grub/grub.cfg
+ sed -i "s/ens[0-9]*/eth0/g" /etc/network/interfaces.d/*.cfg
+ sed -i "s/ens[0-9]*/eth0/g" /etc/udev/rules.d/70-persistent-net.rules
+ echo 'network: {config: disabled}' >> /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
+ echo "APT::Periodic::Unattended-Upgrade \"0\";" >> /etc/apt/apt.conf.d/10periodic
+ reboot
+fi
+
./v_packetgen_for_dns_demo_init.sh