Upgrade vFW and vLB to VES 5.x
[demo.git] / vnfs / vLB / scripts / v_lb_init.sh
index e41c4ef..1bad172 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 # Start VPP
-start vpp
+systemctl start vpp
 sleep 1
 
 # Compute the network CIDR from the Netmask
@@ -25,28 +25,33 @@ 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)
+PKTGEN_MAC=$(cat /opt/config/pktgen_mac.txt)
+VIP=$(cat /opt/config/vip.txt)
 
-ifconfig eth0 down
-ifconfig eth0 hw ether $FAKE_HWADDR1
-ip addr flush dev eth0
-ifconfig eth0 up
+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
@@ -54,7 +59,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
@@ -64,13 +69,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/
+cd /opt/VES/evel/evel-library/code/VESreporting/
 echo 0 > active_dns.txt
-./go-client.sh &>/dev/null &disown
+./go-client.sh &>/dev/null &disown
\ No newline at end of file