Fix multihoming tests 10/6410/1 stable/1704
authorFilip Tehlar <ftehlar@cisco.com>
Tue, 25 Apr 2017 11:13:36 +0000 (13:13 +0200)
committerFilip Tehlar <ftehlar@cisco.com>
Tue, 25 Apr 2017 11:13:36 +0000 (13:13 +0200)
Change-Id: I170753e52a9e7ac3d7ce93e847332e796c6cf30d
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
tests/data_plane/vpp_lite_topo/scripts/port_flood.py [new file with mode: 0755]
tests/data_plane/vpp_lite_topo/test_driver/multihoming.sh
tests/data_plane/vpp_lite_topo/test_driver/multihoming_l2.sh
tests/data_plane/vpp_lite_topo/topologies/2_node_topo.sh

diff --git a/tests/data_plane/vpp_lite_topo/scripts/port_flood.py b/tests/data_plane/vpp_lite_topo/scripts/port_flood.py
new file mode 100755 (executable)
index 0000000..4921df1
--- /dev/null
@@ -0,0 +1,28 @@
+#/usr/bin/env python
+
+import sys
+import socket
+
+
+def do_flood(host, num):
+  try:
+    socket.inet_aton(host)
+    is_ip4 = True
+  except socket.error:
+    try:
+      socket.inet_pton(socket.AF_INET6, host)
+      is_ip4 = False
+    except socket.error:
+        raise Exception('Invlid ip4/6 address!')
+
+  family = socket.AF_INET if is_ip4 else socket.AF_INET6
+
+  for port in range(num):
+    sock = socket.socket(family, socket.SOCK_DGRAM)
+    sock.sendto('test', (host, port + 1))
+
+
+if __name__ == '__main__':
+  if len(sys.argv) < 2:
+    raise Exception('IP and packet count expected!')
+  do_flood(sys.argv[1], int(sys.argv[2]))
index 9e34d11..9337e53 100644 (file)
@@ -30,10 +30,10 @@ function test_multihoming
   assert_rc_ok $? multihoming_topo_clean "No response received!"
 
   # do some port sweeping to see that load balancing works
-  ip netns exec vppns1 nc -n -z "${2}" 1-1000 > /dev/null 2>&1
+  ip netns exec vppns1 python scripts/port_flood.py "${2}" 1000
 
   # check that it works
-  pkts=$(echo "show int" | nc 0 5002 | grep host-intervpp11 | awk '{print $6}' | tr -d '\r')
+  pkts=$(echo "show int" | nc 0 5003 | grep host-intervpp12 | awk '{print $6}' | tr -d '\r')
 
   if [ $pkts -gt 450 ] && [ $pkts -lt 550 ] ; then
     rc=0
index 0238046..a5ef259 100644 (file)
@@ -39,10 +39,10 @@ function test_multihoming
   maybe_pause $3
 
   # do some port sweeping to see that load balancing works
-  ip netns exec vppns1 nc -n -z "${2}" 1-1000 > /dev/null 2>&1
+  ip netns exec vppns1 python scripts/port_flood.py "${2}" 1000
 
   # check that it works
-  pkts=$(echo "show int" | nc 0 5002 | grep host-intervpp11 | awk '{print $6}' | tr -d '\r')
+  pkts=$(echo "show int" | nc 0 5003 | grep host-intervpp12 | awk '{print $6}' | tr -d '\r')
 
   if [ $pkts -gt 450 ] && [ $pkts -lt 550 ] ; then
     rc=0
index ee2bb31..ef1c2b2 100644 (file)
@@ -19,9 +19,8 @@
 function set_arp
 {
   odl_mac=`ip a show dev odl | grep "link/ether" | awk '{print $2}'`
-  echo "set ip arp host-xtr1 6.0.3.100 $odl_mac" | nc 0 5002
-  echo "set ip arp host-xtr2 6.0.3.100 $odl_mac" | nc 0 5003
-  echo "set ip arp host-xtr3 6.0.3.100 $odl_mac" | nc 0 5004
+  echo "set ip arp host-intervpp1 6.0.3.100 $odl_mac" | nc 0 5002
+  echo "set ip arp host-intervpp2 6.0.3.100 $odl_mac" | nc 0 5003
 
   mac=`ip netns exec vppns1 ip a show dev veth_vpp1  | grep "link/ether" | awk '{print $2}'`
   echo "set ip arp host-vpp1 6.0.1.2 $mac" | nc 0 5002