[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] xm-test: fix network13 test (protocol and extensions)



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1249475918 -3600
# Node ID 1c3317e2a8eb6ffd2ea7862e08afa7e2ab8049cc
# Parent  e6a18d33879dbd1ebc9089143a09e422cacf3633
xm-test: fix network13 test (protocol and extensions)

Attached there is a patch that fixes the used protocol (was udp - but
nobody was listening...) to icmp echo and added the extension, that
the dom0 and the other guest ips are also pinged.
Because of the many different scenarios (three nested loops) over
packet sizes, two guests and different ip addresses, one run of this
test case takes now about 4.5 minutes.

Signed-off-by: Andreas Florath <xen@xxxxxxxxxxxx>
---
 tools/xm-test/lib/XmTestLib/NetConfig.py               |    2 
 tools/xm-test/lib/XmTestLib/XenDevice.py               |    2 
 tools/xm-test/tests/network/13_network_domU_udp_pos.py |   46 ++++++++++-------
 3 files changed, 31 insertions(+), 19 deletions(-)

diff -r e6a18d33879d -r 1c3317e2a8eb tools/xm-test/lib/XmTestLib/NetConfig.py
--- a/tools/xm-test/lib/XmTestLib/NetConfig.py  Wed Aug 05 13:37:26 2009 +0100
+++ b/tools/xm-test/lib/XmTestLib/NetConfig.py  Wed Aug 05 13:38:38 2009 +0100
@@ -143,7 +143,7 @@ class NetConfig:
         for line in lines:
             ip = re.search('(\d+\.\d+\.\d+\.\d+)', line)
             if ip and self.isIPInRange(ip.group(1)) == True:
-                dcmd = 'ip addr del %s dev %s' % (ip.group(1), DOM0_INTF)
+                dcmd = 'ip addr del %s/32 dev %s' % (ip.group(1), DOM0_INTF)
                 dstatus, doutput = traceCommand(dcmd)
                 if dstatus:
                     raise NetworkError("Failed to remove %s aliases: %d" %
diff -r e6a18d33879d -r 1c3317e2a8eb tools/xm-test/lib/XmTestLib/XenDevice.py
--- a/tools/xm-test/lib/XmTestLib/XenDevice.py  Wed Aug 05 13:37:26 2009 +0100
+++ b/tools/xm-test/lib/XmTestLib/XenDevice.py  Wed Aug 05 13:38:38 2009 +0100
@@ -217,7 +217,7 @@ class XenNetDevice(XenDevice):
     def addDom0AliasCmd(self, dev=DOM0_INTF):
         # Method to add start and remove dom0 alias cmds
         acmd = 'ip addr add %s dev %s' % (self.dom0_alias_ip, dev)
-        rcmd = 'ip addr del %s dev %s' % (self.dom0_alias_ip, dev) 
+        rcmd = 'ip addr del %s/32 dev %s' % (self.dom0_alias_ip, dev) 
         aliascmd = XenNetDevCmd(self, addCmd=acmd, removeCmd=rcmd)
 
         self.dom0_cmds.append(aliascmd)
diff -r e6a18d33879d -r 1c3317e2a8eb 
tools/xm-test/tests/network/13_network_domU_udp_pos.py
--- a/tools/xm-test/tests/network/13_network_domU_udp_pos.py    Wed Aug 05 
13:37:26 2009 +0100
+++ b/tools/xm-test/tests/network/13_network_domU_udp_pos.py    Wed Aug 05 
13:38:38 2009 +0100
@@ -1,14 +1,16 @@
 #!/usr/bin/python
 
 # Copyright (C) International Business Machines Corp., 2006
-# Author:  <dykman@xxxxxxxxxx>
+# Copyright (C) flonatel GmbH & Co. KG, 2009
+# Authors:  <dykman@xxxxxxxxxx>
+#           Andreas Florath <xen@xxxxxxxxxxxx>
 
 # UDP tests to domU interface
 #  - creates two guest domains
 #  - sets up a single NIC on each on same subnet 
 #  - conducts udp tests to the domU IP address.
 
-# hping2 $domU_IP -2 -c 1 -d $size  
+# hping2 $domU_IP -1 -c 7 -d $size  
 #   where $size = 1, 48, 64, 512, 1440, 1500, 1505, 
 #                 4096, 4192, 32767, 65507, 65508
 
@@ -31,7 +33,7 @@ def netDomain():
         FAIL(str(e))
     return dom
     
-rc = 0
+fails = ""
 
 # Test creates 2 domains, which requires 4 ips: 2 for the domains and 2 for
 # aliases on dom0
@@ -39,26 +41,36 @@ if xmtest_netconf.canRunNetTest(4) == Fa
     SKIP("Don't have enough free configured IPs to run this test")
 
 # Fire up a pair of guest domains w/1 nic each
-src = netDomain()
-src_console = src.getConsole()
-dst = netDomain()
+guest1 = netDomain()
+guest1_console = guest1.getConsole()
+guest1_netdev = guest1.getDevice("eth0")
+guest1_ip = guest1_netdev.getNetDevIP()
+guest1_dom0_alias_ip = guest1_netdev.dom0_alias_ip
+guest2 = netDomain()
+guest2_console = guest2.getConsole()
+guest2_netdev = guest2.getDevice("eth0")
+guest2_ip = guest2_netdev.getNetDevIP()
+guest2_dom0_alias_ip = guest2_netdev.dom0_alias_ip
 
+def hping_cmd(ip, size):
+    return "hping2 " + ip + " -E /dev/urandom -1 -q " \
+             + "-c 7 --fast -d " + str(size) + " -N " + str(size)
+
+# Ping everything from guests
 try:
-    # Ping the victim over eth0
-    fails=""
-    dst_netdev = dst.getDevice("eth0")
-    ip2 = dst_netdev.getNetDevIP()
     for size in pingsizes:
-        out = src_console.runCmd("hping2 " + ip2 + " -E /dev/urandom -2 -q "
-              + "-c 20 --fast -d " + str(size) + " -N " + str(size))
-        if out["return"]:
-            fails += " " + str(size) 
-            print out["output"]
+        for console in [(guest1_console, "Guest1Console"),
+                        (guest2_console, "Guest2Console")]:
+            for dest_ip in [guest1_ip, guest1_dom0_alias_ip,
+                            guest2_ip, guest2_dom0_alias_ip ]:
+                out = console[0].runCmd(hping_cmd(dest_ip, size))
+                if out["return"]:
+                    fails += " [%d, %s, %s]" % (size, console[1], dest_ip)
 except ConsoleError, e:
     FAIL(str(e))
 
-src.stop()
-dst.stop()
+guest1.stop()
+guest2.stop()
 
 if len(fails):
     FAIL("UDP hping2 failed for size" + fails + ".")

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.