debuggers.hg

view tools/xm-test/tests/network/13_network_domU_udp_pos.py @ 0:7d21f7218375

Exact replica of unstable on 051908 + README-this
author Mukesh Rathor
date Mon May 19 15:34:57 2008 -0700 (2008-05-19)
parents
children b22f9ab1716a
line source
1 #!/usr/bin/python
3 # Copyright (C) International Business Machines Corp., 2006
4 # Author: <dykman@us.ibm.com>
6 # UDP tests to domU interface
7 # - creates two guest domains
8 # - sets up a single NIC on each on same subnet
9 # - conducts udp tests to the domU IP address.
11 # hping2 $domU_IP -2 -c 1 -d $size
12 # where $size = 1, 48, 64, 512, 1440, 1500, 1505,
13 # 4096, 4192, 32767, 65507, 65508
15 pingsizes = [ 1, 48, 64, 512, 1440, 1500, 1505, 4096, 4192,
16 32767, 65495 ]
18 from XmTestLib import *
20 def netDomain():
22 dom = XmTestDomain()
23 dom.newDevice(XenNetDevice, "eth0")
24 try:
25 console = dom.start()
26 console.setHistorySaveCmds(value=True)
27 except DomainError, e:
28 if verbose:
29 print "Failed to create test domain because:"
30 print e.extra
31 FAIL(str(e))
32 return dom
34 rc = 0
36 # Test creates 2 domains, which requires 4 ips: 2 for the domains and 2 for
37 # aliases on dom0
38 if xmtest_netconf.canRunNetTest(4) == False:
39 SKIP("Don't have enough free configured IPs to run this test")
41 # Fire up a pair of guest domains w/1 nic each
42 src = netDomain()
43 src_console = src.getConsole()
44 dst = netDomain()
46 try:
47 # Ping the victim over eth0
48 fails=""
49 dst_netdev = dst.getDevice("eth0")
50 ip2 = dst_netdev.getNetDevIP()
51 for size in pingsizes:
52 out = src_console.runCmd("hping2 " + ip2 + " -E /dev/urandom -2 -q "
53 + "-c 20 --fast -d " + str(size) + " -N " + str(size))
54 if out["return"]:
55 fails += " " + str(size)
56 print out["output"]
57 except ConsoleError, e:
58 FAIL(str(e))
60 src.stop()
61 dst.stop()
63 if len(fails):
64 FAIL("UDP hping2 failed for size" + fails + ".")