diff options
Diffstat (limited to 'tests/data_plane')
4 files changed, 34 insertions, 7 deletions
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 index 0000000..4921df1 --- /dev/null +++ b/tests/data_plane/vpp_lite_topo/scripts/port_flood.py @@ -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])) diff --git a/tests/data_plane/vpp_lite_topo/test_driver/multihoming.sh b/tests/data_plane/vpp_lite_topo/test_driver/multihoming.sh index 9e34d11..9337e53 100644 --- a/tests/data_plane/vpp_lite_topo/test_driver/multihoming.sh +++ b/tests/data_plane/vpp_lite_topo/test_driver/multihoming.sh @@ -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 diff --git a/tests/data_plane/vpp_lite_topo/test_driver/multihoming_l2.sh b/tests/data_plane/vpp_lite_topo/test_driver/multihoming_l2.sh index 0238046..a5ef259 100644 --- a/tests/data_plane/vpp_lite_topo/test_driver/multihoming_l2.sh +++ b/tests/data_plane/vpp_lite_topo/test_driver/multihoming_l2.sh @@ -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 diff --git a/tests/data_plane/vpp_lite_topo/topologies/2_node_topo.sh b/tests/data_plane/vpp_lite_topo/topologies/2_node_topo.sh index ee2bb31..ef1c2b2 100644 --- a/tests/data_plane/vpp_lite_topo/topologies/2_node_topo.sh +++ b/tests/data_plane/vpp_lite_topo/topologies/2_node_topo.sh @@ -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 |