debuggers.hg

view tools/xm-test/tests/network/11_network_domU_ping_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
line source
1 #!/usr/bin/python
3 # Copyright (C) International Business Machines Corp., 2005
4 # Author: <dykman@us.ibm.com>
6 # Ping tests to domU interface
7 # - creates two guest domains
8 # - sets up a single NIC on each on same subnet
9 # - conducts ping tests to the domU IP address.
11 # ping -c 1 -s $size $domU_IP
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, 65507 ]
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 pinger = netDomain()
43 pinger_console = pinger.getConsole()
44 victim = netDomain()
46 try:
47 # Ping the victim over eth0
48 fails=""
49 v_netdev = victim.getDevice("eth0")
50 ip2 = v_netdev.getNetDevIP()
51 for size in pingsizes:
52 out = pinger_console.runCmd("ping -q -c 1 -s " + str(size) + " " + ip2)
53 if out["return"]:
54 fails += " " + str(size)
55 except ConsoleError, e:
56 FAIL(str(e))
58 pinger.stop()
59 victim.stop()
61 if len(fails):
62 FAIL("Ping failed for size" + fails + ".")