ia64/xen-unstable
changeset 9216:8c1badb84c3e
Adding hping TCP and UDP tests. They hping a number of packets to
local interface, dom0, and from domU to domU. HVM support included.
Signed-off-by: Jim Dykman <dykman@us.ibm.com>
Signed-off-by: Daniel Stekloff <dsteklof@us.ibm.com>
local interface, dom0, and from domU to domU. HVM support included.
Signed-off-by: Jim Dykman <dykman@us.ibm.com>
Signed-off-by: Daniel Stekloff <dsteklof@us.ibm.com>
author | stekloff@localhost.localdomain |
---|---|
date | Fri Mar 10 00:49:54 2006 +0100 (2006-03-10) |
parents | b13e54483c1a |
children | 3ea1c6118fc2 |
files | tools/xm-test/tests/network/03_network_local_tcp_pos.py tools/xm-test/tests/network/04_network_local_udp_pos.py tools/xm-test/tests/network/06_network_dom0_tcp_pos.py tools/xm-test/tests/network/07_network_dom0_udp_pos.py tools/xm-test/tests/network/12_network_domU_tcp_pos.py tools/xm-test/tests/network/13_network_domU_udp_pos.py tools/xm-test/tests/network/Makefile.am |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/tools/xm-test/tests/network/03_network_local_tcp_pos.py Fri Mar 10 00:49:54 2006 +0100 1.3 @@ -0,0 +1,95 @@ 1.4 +#!/usr/bin/python 1.5 + 1.6 +# Copyright (C) International Business Machines Corp., 2006 1.7 +# Author: <dykman@us.ibm.com> 1.8 + 1.9 +# TCP tests on local interfaces. 1.10 +# - creates a single guest domain 1.11 +# - sets up a single NIC 1.12 +# - conducts hping tcp tests to the local loopback and IP address 1.13 + 1.14 +# hping2 127.0.0.1 -c 1 -d $size 1.15 +# hping2 $local_IP -c 1 -d $size 1.16 +# where $size = 1, 48, 64, 512, 1440, 1448, 1500, 1505, 1.17 +# 4096, 4192, 32767, 65507, 65508 1.18 + 1.19 + 1.20 +trysizes = [ 1, 48, 64, 512, 1440, 1448, 1500, 1505, 4096, 4192, 1.21 + 32767, 65495 ] 1.22 + 1.23 + 1.24 +from XmTestLib import * 1.25 +rc = 0 1.26 + 1.27 +Net = XmNetwork() 1.28 + 1.29 +try: 1.30 + # read an IP address from the config 1.31 + ip = Net.ip("dom1", "eth0") 1.32 + mask = Net.mask("dom1", "eth0") 1.33 +except NetworkError, e: 1.34 + FAIL(str(e)) 1.35 + 1.36 +# Fire up a guest domain w/1 nic 1.37 +if ENABLE_HVM_SUPPORT: 1.38 + brg = "xenbr0" 1.39 + config = {"vif" : ['type=ioemu, bridge=%s' % brg]} 1.40 +else: 1.41 + brg = None 1.42 + config = {"vif" : ['ip=%s' % ip]} 1.43 + 1.44 +domain = XmTestDomain(extraConfig=config) 1.45 +try: 1.46 + domain.start() 1.47 +except DomainError, e: 1.48 + if verbose: 1.49 + print "Failed to create test domain because:" 1.50 + print e.extra 1.51 + FAIL(str(e)) 1.52 + 1.53 + 1.54 +# Attach a console 1.55 +try: 1.56 + console = XmConsole(domain.getName(), historySaveCmds=True) 1.57 +except ConsoleError, e: 1.58 + FAIL(str(e)) 1.59 + 1.60 +try: 1.61 + # Activate the console 1.62 + console.sendInput("bhs") 1.63 + 1.64 + # Bring up the "lo" interface. 1.65 + console.runCmd("ifconfig lo 127.0.0.1") 1.66 + 1.67 + console.runCmd("ifconfig eth0 inet "+ip+" netmask "+mask+" up") 1.68 + 1.69 + # First do loopback 1.70 + lofails="" 1.71 + for size in trysizes: 1.72 + out = console.runCmd("hping2 127.0.0.1 -E /dev/urandom -q -c 20 " 1.73 + + "--fast -d " + str(size)) 1.74 + if out["return"]: 1.75 + lofails += " " + str(size) 1.76 + 1.77 + # Next comes eth0 1.78 + eth0fails="" 1.79 + for size in trysizes: 1.80 + out = console.runCmd("hping2 " + ip + " -E /dev/urandom -q -c 20 " 1.81 + + "--fast -d "+ str(size)) 1.82 + if out["return"]: 1.83 + eth0fails += " " + str(size) 1.84 +except ConsoleError, e: 1.85 + FAIL(str(e)) 1.86 +except NetworkError, e: 1.87 + FAIL(str(e)) 1.88 + 1.89 + 1.90 +# Tally up failures 1.91 +failures="" 1.92 +if len(lofails): 1.93 + failures += "TCP hping2 over loopback failed for size" + lofails + ". " 1.94 +if len(eth0fails): 1.95 + failures += "TCP hping2 over eth0 failed for size" + eth0fails + "." 1.96 +if len(failures): 1.97 + FAIL(failures) 1.98 +
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/tools/xm-test/tests/network/04_network_local_udp_pos.py Fri Mar 10 00:49:54 2006 +0100 2.3 @@ -0,0 +1,96 @@ 2.4 +#!/usr/bin/python 2.5 + 2.6 +# Copyright (C) International Business Machines Corp., 2006 2.7 +# Author: <dykman@us.ibm.com> 2.8 + 2.9 +# UDP tests on local interfaces. 2.10 +# - creates a single guest domain 2.11 +# - sets up a single NIC 2.12 +# - conducts hping udp tests to the local loopback and IP address 2.13 + 2.14 +# hping2 127.0.0.1 -2 -c 1 -d $size 2.15 +# hping2 $local_IP -2 -c 1 -d $size 2.16 +# where $size = 1, 48, 64, 512, 1440, 1448, 1500, 1505, 2.17 +# 4096, 4192, 32767, 65507, 65508 2.18 + 2.19 + 2.20 +trysizes = [ 1, 48, 64, 512, 1440, 1448, 1500, 1505, 4096, 4192, 2.21 + 32767, 65495 ] 2.22 + 2.23 +from XmTestLib import * 2.24 +rc = 0 2.25 + 2.26 +Net = XmNetwork() 2.27 + 2.28 +try: 2.29 + # read an IP address from the config 2.30 + ip = Net.ip("dom1", "eth0") 2.31 + mask = Net.mask("dom1", "eth0") 2.32 +except NetworkError, e: 2.33 + FAIL(str(e)) 2.34 + 2.35 +# Fire up a guest domain w/1 nic 2.36 +if ENABLE_HVM_SUPPORT: 2.37 + brg = "xenbr0" 2.38 + config = {"vif" : ['type=ioemu, bridge=%s' % brg]} 2.39 +else: 2.40 + brg = None 2.41 + config = {"vif" : ['ip=%s' % ip]} 2.42 + 2.43 +domain = XmTestDomain(extraConfig=config) 2.44 +try: 2.45 + domain.start() 2.46 +except DomainError, e: 2.47 + if verbose: 2.48 + print "Failed to create test domain because:" 2.49 + print e.extra 2.50 + FAIL(str(e)) 2.51 + 2.52 + 2.53 +# Attach a console 2.54 +try: 2.55 + console = XmConsole(domain.getName(), historySaveCmds=True) 2.56 +except ConsoleError, e: 2.57 + FAIL(str(e)) 2.58 + 2.59 +try: 2.60 + # Activate the console 2.61 + console.sendInput("bhs") 2.62 + 2.63 + # Bring up the "lo" interface. 2.64 + console.runCmd("ifconfig lo 127.0.0.1") 2.65 + 2.66 + console.runCmd("ifconfig eth0 inet "+ip+" netmask "+mask+" up") 2.67 + 2.68 + # First do loopback 2.69 + lofails="" 2.70 + for size in trysizes: 2.71 + out = console.runCmd("hping2 127.0.0.1 -E /dev/urandom -2 -q -c 20 " 2.72 + + "--fast -d " + str(size)) 2.73 + if out["return"]: 2.74 + lofails += " " + str(size) 2.75 + print out["output"] 2.76 + 2.77 + # Next comes eth0 2.78 + eth0fails="" 2.79 + for size in trysizes: 2.80 + out = console.runCmd("hping2 " + ip + " -E /dev/urandom -2 -q -c 20 " 2.81 + + "--fast -d " + str(size)) 2.82 + if out["return"]: 2.83 + eth0fails += " " + str(size) 2.84 + print out["output"] 2.85 +except ConsoleError, e: 2.86 + FAIL(str(e)) 2.87 +except NetworkError, e: 2.88 + FAIL(str(e)) 2.89 + 2.90 + 2.91 +# Tally up failures 2.92 +failures="" 2.93 +if len(lofails): 2.94 + failures += "UDP hping2 over loopback failed for size" + lofails + ". " 2.95 +if len(eth0fails): 2.96 + failures += "UDP hping2 over eth0 failed for size" + eth0fails + "." 2.97 +if len(failures): 2.98 + FAIL(failures) 2.99 +
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/tools/xm-test/tests/network/06_network_dom0_tcp_pos.py Fri Mar 10 00:49:54 2006 +0100 3.3 @@ -0,0 +1,81 @@ 3.4 +#!/usr/bin/python 3.5 + 3.6 +# Copyright (C) International Business Machines Corp., 2006 3.7 +# Author: <dykman@us.ibm.com> 3.8 + 3.9 +# TCP tests to dom0. 3.10 +# - determines dom0 network 3.11 +# - creates a single guest domain 3.12 +# - sets up a single NIC on same subnet as dom0 3.13 +# - conducts hping2 tcp tests to the dom0 IP address 3.14 + 3.15 +# hping2 $dom0_IP -c 1 -d $size 3.16 +# where $size = 1, 48, 64, 512, 1440, 1448, 1500, 1505, 3.17 +# 4096, 4192, 32767, 65507, 65508 3.18 + 3.19 +trysizes = [ 1, 48, 64, 512, 1440, 1500, 1505, 4096, 4192, 3.20 + 32767, 65495 ] 3.21 + 3.22 + 3.23 + 3.24 +from XmTestLib import * 3.25 +rc = 0 3.26 + 3.27 +Net = XmNetwork() 3.28 + 3.29 +try: 3.30 + # read an IP address from the config 3.31 + ip = Net.ip("dom1", "eth0") 3.32 + mask = Net.mask("dom1", "eth0") 3.33 +except NetworkError, e: 3.34 + FAIL(str(e)) 3.35 + 3.36 +# Fire up a guest domain w/1 nic 3.37 +if ENABLE_HVM_SUPPORT: 3.38 + brg = "xenbr0" 3.39 + config = {"vif" : ['type=ioemu, bridge=%s' % brg]} 3.40 +else: 3.41 + brg = None 3.42 + config = {"vif" : ["ip=%s" % ip]} 3.43 + 3.44 +domain = XmTestDomain(extraConfig=config) 3.45 +try: 3.46 + domain.start() 3.47 +except DomainError, e: 3.48 + if verbose: 3.49 + print "Failed to create test domain because:" 3.50 + print e.extra 3.51 + FAIL(str(e)) 3.52 + 3.53 + 3.54 +# Attach a console 3.55 +try: 3.56 + console = XmConsole(domain.getName(), historySaveCmds=True) 3.57 + # Activate the console 3.58 + console.sendInput("bhs") 3.59 +except ConsoleError, e: 3.60 + FAIL(str(e)) 3.61 + 3.62 +try: 3.63 + # Add a suitable dom0 IP address 3.64 + dom0ip = Net.ip("dom0", "eth0", todomname=domain.getName(), toeth="eth0", bridge=brg) 3.65 +except NetworkError, e: 3.66 + FAIL(str(e)) 3.67 + 3.68 +try: 3.69 + console.runCmd("ifconfig eth0 inet "+ip+" netmask "+mask+" up") 3.70 + 3.71 + # Ping dom0 3.72 + fails="" 3.73 + for size in trysizes: 3.74 + out = console.runCmd("hping2 " + dom0ip + " -E /dev/urandom -q -c 20 " 3.75 + + "--fast -d " + str(size)) 3.76 + if out["return"]: 3.77 + fails += " " + str(size) 3.78 + print out["output"] 3.79 +except ConsoleError, e: 3.80 + FAIL(str(e)) 3.81 + 3.82 +if len(fails): 3.83 + FAIL("TCP hping2 to dom0 failed for size" + fails + ".") 3.84 +
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/tools/xm-test/tests/network/07_network_dom0_udp_pos.py Fri Mar 10 00:49:54 2006 +0100 4.3 @@ -0,0 +1,81 @@ 4.4 +#!/usr/bin/python 4.5 + 4.6 +# Copyright (C) International Business Machines Corp., 2006 4.7 +# Author: <dykman@us.ibm.com> 4.8 + 4.9 +# UDP tests to dom0. 4.10 +# - determines dom0 network 4.11 +# - creates a single guest domain 4.12 +# - sets up a single NIC on same subnet as dom0 4.13 +# - conducts hping2 udp tests to the dom0 IP address 4.14 + 4.15 +# hping2 $dom0_IP -2 -c 1 -d $size 4.16 +# where $size = 1, 48, 64, 512, 1440, 1448, 1500, 1505, 4.17 +# 4096, 4192, 32767, 65507, 65508 4.18 + 4.19 +trysizes = [ 1, 48, 64, 512, 1440, 1500, 1505, 4096, 4192, 4.20 + 32767, 65495 ] 4.21 + 4.22 + 4.23 + 4.24 +from XmTestLib import * 4.25 +rc = 0 4.26 + 4.27 +Net = XmNetwork() 4.28 + 4.29 +try: 4.30 + # read an IP address from the config 4.31 + ip = Net.ip("dom1", "eth0") 4.32 + mask = Net.mask("dom1", "eth0") 4.33 +except NetworkError, e: 4.34 + FAIL(str(e)) 4.35 + 4.36 +# Fire up a guest domain w/1 nic 4.37 +if ENABLE_HVM_SUPPORT: 4.38 + brg = "xenbr0" 4.39 + config = {"vif" : ['type=ioemu, bridge=%s' % brg]} 4.40 +else: 4.41 + brg = None 4.42 + config = {"vif" : ["ip=%s" % ip]} 4.43 + 4.44 +domain = XmTestDomain(extraConfig=config) 4.45 +try: 4.46 + domain.start() 4.47 +except DomainError, e: 4.48 + if verbose: 4.49 + print "Failed to create test domain because:" 4.50 + print e.extra 4.51 + FAIL(str(e)) 4.52 + 4.53 + 4.54 +# Attach a console 4.55 +try: 4.56 + console = XmConsole(domain.getName(), historySaveCmds=True) 4.57 + # Activate the console 4.58 + console.sendInput("bhs") 4.59 +except ConsoleError, e: 4.60 + FAIL(str(e)) 4.61 + 4.62 +try: 4.63 + # Add a suitable dom0 IP address 4.64 + dom0ip = Net.ip("dom0", "eth0", todomname=domain.getName(), toeth="eth0", bridge=brg) 4.65 +except NetworkError, e: 4.66 + FAIL(str(e)) 4.67 + 4.68 +try: 4.69 + console.runCmd("ifconfig eth0 inet "+ip+" netmask "+mask+" up") 4.70 + 4.71 + # Ping dom0 4.72 + fails="" 4.73 + for size in trysizes: 4.74 + out = console.runCmd("hping2 " + dom0ip + " -E /dev/urandom -2 -q -c 20" 4.75 + + " --fast -d " + str(size)) 4.76 + if out["return"]: 4.77 + fails += " " + str(size) 4.78 + print out["output"] 4.79 +except ConsoleError, e: 4.80 + FAIL(str(e)) 4.81 + 4.82 +if len(fails): 4.83 + FAIL("UDP hping2 to dom0 failed for size" + fails + ".") 4.84 +
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/tools/xm-test/tests/network/12_network_domU_tcp_pos.py Fri Mar 10 00:49:54 2006 +0100 5.3 @@ -0,0 +1,82 @@ 5.4 +#!/usr/bin/python 5.5 + 5.6 +# Copyright (C) International Business Machines Corp., 2006 5.7 +# Author: <dykman@us.ibm.com> 5.8 + 5.9 +# TCP tests to domU interface 5.10 +# - creates two guest domains 5.11 +# - sets up a single NIC on each on same subnet 5.12 +# - conducts tcp tests to the domU IP address. 5.13 + 5.14 +# hping2 $domU_IP -c 1 -d $size 5.15 +# where $size = 1, 48, 64, 512, 1440, 1500, 1505, 5.16 +# 4096, 4192, 32767, 65507, 65508 5.17 + 5.18 +pingsizes = [ 1, 48, 64, 512, 1440, 1500, 1505, 4096, 4192, 16384, 24567, 5.19 + 32767, 65495 ] 5.20 + 5.21 +from XmTestLib import * 5.22 + 5.23 +def netDomain(ip): 5.24 + if ENABLE_HVM_SUPPORT: 5.25 + config = {"vif" : ['type=ioemu']} 5.26 + else: 5.27 + config = {"vif" : ["ip=%s" % ip]} 5.28 + 5.29 + dom = XmTestDomain(extraConfig=config) 5.30 + try: 5.31 + dom.start() 5.32 + except DomainError, e: 5.33 + if verbose: 5.34 + print "Failed to create test domain because:" 5.35 + print e.extra 5.36 + FAIL(str(e)) 5.37 + try: 5.38 + # Attach a console 5.39 + console = XmConsole(dom.getName(), historySaveCmds=True) 5.40 + # Activate the console 5.41 + console.sendInput("bhs") 5.42 + except ConsoleError, e: 5.43 + FAIL(str(e)) 5.44 + return console 5.45 + 5.46 +rc = 0 5.47 + 5.48 +Net = XmNetwork() 5.49 + 5.50 +try: 5.51 + # pick an IP address 5.52 + ip1 = Net.ip("dom1", "eth2") 5.53 + mask1 = Net.mask("dom1", "eth2") 5.54 +except NetworkError, e: 5.55 + FAIL(str(e)) 5.56 + 5.57 +try: 5.58 + # pick another IP address 5.59 + ip2 = Net.ip("dom2", "eth2") 5.60 + mask2 = Net.mask("dom2", "eth2") 5.61 +except NetworkError, e: 5.62 + FAIL(str(e)) 5.63 + 5.64 +# Fire up a pair of guest domains w/1 nic each 5.65 +src_console = netDomain(ip1) 5.66 +dst_console = netDomain(ip2) 5.67 + 5.68 +try: 5.69 + src_console.runCmd("ifconfig eth0 inet "+ip1+" netmask "+mask1+" up") 5.70 + dst_console.runCmd("ifconfig eth0 inet "+ip2+" netmask "+mask2+" up") 5.71 + 5.72 + # Ping the victim over eth0 5.73 + fails="" 5.74 + for size in pingsizes: 5.75 + out = src_console.runCmd("hping2 " + ip2 + " -E /dev/urandom -q -c 20 " 5.76 + + "--fast -d " + str(size)) 5.77 + if out["return"]: 5.78 + fails += " " + str(size) 5.79 + print out["output"] 5.80 +except ConsoleError, e: 5.81 + FAIL(str(e)) 5.82 + 5.83 +if len(fails): 5.84 + FAIL("TCP hping2 failed for size" + fails + ".") 5.85 +
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/tools/xm-test/tests/network/13_network_domU_udp_pos.py Fri Mar 10 00:49:54 2006 +0100 6.3 @@ -0,0 +1,82 @@ 6.4 +#!/usr/bin/python 6.5 + 6.6 +# Copyright (C) International Business Machines Corp., 2006 6.7 +# Author: <dykman@us.ibm.com> 6.8 + 6.9 +# UDP tests to domU interface 6.10 +# - creates two guest domains 6.11 +# - sets up a single NIC on each on same subnet 6.12 +# - conducts udp tests to the domU IP address. 6.13 + 6.14 +# hping2 $domU_IP -2 -c 1 -d $size 6.15 +# where $size = 1, 48, 64, 512, 1440, 1500, 1505, 6.16 +# 4096, 4192, 32767, 65507, 65508 6.17 + 6.18 +pingsizes = [ 1, 48, 64, 512, 1440, 1500, 1505, 4096, 4192, 6.19 + 32767, 65495 ] 6.20 + 6.21 +from XmTestLib import * 6.22 + 6.23 +def netDomain(ip): 6.24 + if ENABLE_HVM_SUPPORT: 6.25 + config = {"vif" : ['type=ioemu']} 6.26 + else: 6.27 + config = {"vif" : ["ip=%s" % ip]} 6.28 + 6.29 + dom = XmTestDomain(extraConfig=config) 6.30 + try: 6.31 + dom.start() 6.32 + except DomainError, e: 6.33 + if verbose: 6.34 + print "Failed to create test domain because:" 6.35 + print e.extra 6.36 + FAIL(str(e)) 6.37 + try: 6.38 + # Attach a console 6.39 + console = XmConsole(dom.getName(), historySaveCmds=True) 6.40 + # Activate the console 6.41 + console.sendInput("bhs") 6.42 + except ConsoleError, e: 6.43 + FAIL(str(e)) 6.44 + return console 6.45 + 6.46 +rc = 0 6.47 + 6.48 +Net = XmNetwork() 6.49 + 6.50 +try: 6.51 + # pick an IP address 6.52 + ip1 = Net.ip("dom1", "eth2") 6.53 + mask1 = Net.mask("dom1", "eth2") 6.54 +except NetworkError, e: 6.55 + FAIL(str(e)) 6.56 + 6.57 +try: 6.58 + # pick another IP address 6.59 + ip2 = Net.ip("dom2", "eth2") 6.60 + mask2 = Net.mask("dom2", "eth2") 6.61 +except NetworkError, e: 6.62 + FAIL(str(e)) 6.63 + 6.64 +# Fire up a pair of guest domains w/1 nic each 6.65 +src_console = netDomain(ip1) 6.66 +dst_console = netDomain(ip2) 6.67 + 6.68 +try: 6.69 + src_console.runCmd("ifconfig eth0 inet "+ip1+" netmask "+mask1+" up") 6.70 + dst_console.runCmd("ifconfig eth0 inet "+ip2+" netmask "+mask2+" up") 6.71 + 6.72 + # Ping the victim over eth0 6.73 + fails="" 6.74 + for size in pingsizes: 6.75 + out = src_console.runCmd("hping2 " + ip2 + " -E /dev/urandom -2 -q " 6.76 + + "-c 20 --fast -d " + str(size)) 6.77 + if out["return"]: 6.78 + fails += " " + str(size) 6.79 + print out["output"] 6.80 +except ConsoleError, e: 6.81 + FAIL(str(e)) 6.82 + 6.83 +if len(fails): 6.84 + FAIL("UDP hping2 failed for size" + fails + ".") 6.85 +
7.1 --- a/tools/xm-test/tests/network/Makefile.am Fri Mar 10 00:49:08 2006 +0100 7.2 +++ b/tools/xm-test/tests/network/Makefile.am Fri Mar 10 00:49:54 2006 +0100 7.3 @@ -1,10 +1,15 @@ 7.4 7.5 SUBDIRS = 7.6 - 7.7 TESTS = \ 7.8 02_network_local_ping_pos.test \ 7.9 + 03_network_local_tcp_pos.test \ 7.10 + 04_network_local_udp_pos.test \ 7.11 05_network_dom0_ping_pos.test \ 7.12 - 11_network_domU_ping_pos.test 7.13 + 06_network_dom0_tcp_pos.test \ 7.14 + 07_network_dom0_udp_pos.test \ 7.15 + 11_network_domU_ping_pos.test \ 7.16 + 12_network_domU_tcp_pos.test \ 7.17 + 13_network_domU_udp_pos.test 7.18 7.19 7.20