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

[Xen-changelog] Adding hping TCP and UDP tests. They hping a number of packets to



# HG changeset patch
# User stekloff@xxxxxxxxxxxxxxxxxxxxx
# Node ID 8c1badb84c3ed6160822771441d68151b1f62052
# Parent  b13e54483c1aedf59e66e4addaa03eba70019780
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@xxxxxxxxxx>
Signed-off-by: Daniel Stekloff <dsteklof@xxxxxxxxxx>

diff -r b13e54483c1a -r 8c1badb84c3e tools/xm-test/tests/network/Makefile.am
--- a/tools/xm-test/tests/network/Makefile.am   Thu Mar  9 23:49:08 2006
+++ b/tools/xm-test/tests/network/Makefile.am   Thu Mar  9 23:49:54 2006
@@ -1,10 +1,15 @@
 
 SUBDIRS =
-
 TESTS = \
        02_network_local_ping_pos.test          \
+       03_network_local_tcp_pos.test           \
+       04_network_local_udp_pos.test           \
        05_network_dom0_ping_pos.test           \
-       11_network_domU_ping_pos.test
+       06_network_dom0_tcp_pos.test            \
+       07_network_dom0_udp_pos.test            \
+       11_network_domU_ping_pos.test           \
+       12_network_domU_tcp_pos.test            \
+       13_network_domU_udp_pos.test
 
 
 
diff -r b13e54483c1a -r 8c1badb84c3e 
tools/xm-test/tests/network/03_network_local_tcp_pos.py
--- /dev/null   Thu Mar  9 23:49:08 2006
+++ b/tools/xm-test/tests/network/03_network_local_tcp_pos.py   Thu Mar  9 
23:49:54 2006
@@ -0,0 +1,95 @@
+#!/usr/bin/python
+
+# Copyright (C) International Business Machines Corp., 2006
+# Author:  <dykman@xxxxxxxxxx>
+
+# TCP tests on local interfaces.
+#  - creates a single guest domain
+#  - sets up a single NIC
+#  - conducts hping tcp tests to the local loopback and IP address
+
+# hping2 127.0.0.1 -c 1 -d $size
+# hping2 $local_IP -c 1 -d $size
+#   where $size = 1, 48, 64, 512, 1440, 1448, 1500, 1505,
+#                 4096, 4192, 32767, 65507, 65508
+
+
+trysizes = [ 1, 48, 64, 512, 1440, 1448, 1500, 1505, 4096, 4192, 
+              32767, 65495 ]
+
+
+from XmTestLib import *
+rc = 0
+
+Net = XmNetwork()
+
+try:
+    # read an IP address from the config
+    ip   = Net.ip("dom1", "eth0")
+    mask = Net.mask("dom1", "eth0")
+except NetworkError, e:
+    FAIL(str(e))
+
+# Fire up a guest domain w/1 nic
+if ENABLE_HVM_SUPPORT:
+    brg = "xenbr0"
+    config = {"vif" : ['type=ioemu, bridge=%s' % brg]}
+else:
+    brg = None
+    config = {"vif" : ['ip=%s' % ip]}
+
+domain = XmTestDomain(extraConfig=config)
+try:
+    domain.start()
+except DomainError, e:
+    if verbose:
+        print "Failed to create test domain because:"
+        print e.extra
+    FAIL(str(e))
+
+
+# Attach a console
+try:
+    console = XmConsole(domain.getName(), historySaveCmds=True)
+except ConsoleError, e:
+    FAIL(str(e))
+
+try:
+    # Activate the console
+    console.sendInput("bhs")
+
+    # Bring up the "lo" interface.
+    console.runCmd("ifconfig lo 127.0.0.1")
+
+    console.runCmd("ifconfig eth0 inet "+ip+" netmask "+mask+" up")
+
+    # First do loopback 
+    lofails=""
+    for size in trysizes:
+        out = console.runCmd("hping2 127.0.0.1 -E /dev/urandom -q -c 20 " 
+              + "--fast -d " + str(size))
+        if out["return"]:
+            lofails += " " + str(size)
+
+    # Next comes eth0
+    eth0fails=""
+    for size in trysizes:
+        out = console.runCmd("hping2 " + ip + " -E /dev/urandom -q -c 20 "
+              + "--fast -d "+ str(size))
+        if out["return"]:
+            eth0fails += " " + str(size) 
+except ConsoleError, e:
+        FAIL(str(e))
+except NetworkError, e:
+        FAIL(str(e))
+
+
+# Tally up failures
+failures=""
+if len(lofails):
+        failures += "TCP hping2 over loopback failed for size" + lofails + ". "
+if len(eth0fails):
+        failures += "TCP hping2 over eth0 failed for size" + eth0fails + "."
+if len(failures):
+    FAIL(failures)
+
diff -r b13e54483c1a -r 8c1badb84c3e 
tools/xm-test/tests/network/04_network_local_udp_pos.py
--- /dev/null   Thu Mar  9 23:49:08 2006
+++ b/tools/xm-test/tests/network/04_network_local_udp_pos.py   Thu Mar  9 
23:49:54 2006
@@ -0,0 +1,96 @@
+#!/usr/bin/python
+
+# Copyright (C) International Business Machines Corp., 2006
+# Author:  <dykman@xxxxxxxxxx>
+
+# UDP tests on local interfaces.
+#  - creates a single guest domain
+#  - sets up a single NIC
+#  - conducts hping udp tests to the local loopback and IP address
+
+# hping2 127.0.0.1 -2 -c 1 -d $size
+# hping2 $local_IP -2 -c 1 -d $size
+#   where $size = 1, 48, 64, 512, 1440, 1448, 1500, 1505,
+#                 4096, 4192, 32767, 65507, 65508
+
+
+trysizes = [ 1, 48, 64, 512, 1440, 1448, 1500, 1505, 4096, 4192, 
+              32767, 65495 ]
+
+from XmTestLib import *
+rc = 0
+
+Net = XmNetwork()
+
+try:
+    # read an IP address from the config
+    ip   = Net.ip("dom1", "eth0")
+    mask = Net.mask("dom1", "eth0")
+except NetworkError, e:
+    FAIL(str(e))
+
+# Fire up a guest domain w/1 nic
+if ENABLE_HVM_SUPPORT:
+    brg = "xenbr0"
+    config = {"vif" : ['type=ioemu, bridge=%s' % brg]}
+else:
+    brg = None
+    config = {"vif" : ['ip=%s' % ip]}
+
+domain = XmTestDomain(extraConfig=config)
+try:
+    domain.start()
+except DomainError, e:
+    if verbose:
+        print "Failed to create test domain because:"
+        print e.extra
+    FAIL(str(e))
+
+
+# Attach a console
+try:
+    console = XmConsole(domain.getName(), historySaveCmds=True)
+except ConsoleError, e:
+    FAIL(str(e))
+
+try:
+    # Activate the console
+    console.sendInput("bhs")
+
+    # Bring up the "lo" interface.
+    console.runCmd("ifconfig lo 127.0.0.1")
+
+    console.runCmd("ifconfig eth0 inet "+ip+" netmask "+mask+" up")
+
+    # First do loopback 
+    lofails=""
+    for size in trysizes:
+        out = console.runCmd("hping2 127.0.0.1 -E /dev/urandom -2 -q -c 20 "
+              + "--fast -d " + str(size))
+        if out["return"]:
+            lofails += " " + str(size)
+            print out["output"]
+
+    # Next comes eth0
+    eth0fails=""
+    for size in trysizes:
+        out = console.runCmd("hping2 " + ip + " -E /dev/urandom -2 -q -c 20 "
+              + "--fast -d " + str(size))
+        if out["return"]:
+            eth0fails += " " + str(size) 
+            print out["output"]
+except ConsoleError, e:
+        FAIL(str(e))
+except NetworkError, e:
+        FAIL(str(e))
+
+
+# Tally up failures
+failures=""
+if len(lofails):
+        failures += "UDP hping2 over loopback failed for size" + lofails + ". "
+if len(eth0fails):
+        failures += "UDP hping2 over eth0 failed for size" + eth0fails + "."
+if len(failures):
+    FAIL(failures)
+
diff -r b13e54483c1a -r 8c1badb84c3e 
tools/xm-test/tests/network/06_network_dom0_tcp_pos.py
--- /dev/null   Thu Mar  9 23:49:08 2006
+++ b/tools/xm-test/tests/network/06_network_dom0_tcp_pos.py    Thu Mar  9 
23:49:54 2006
@@ -0,0 +1,81 @@
+#!/usr/bin/python
+
+# Copyright (C) International Business Machines Corp., 2006
+# Author:  <dykman@xxxxxxxxxx>
+
+# TCP tests to dom0.
+#  - determines dom0 network
+#  - creates a single guest domain
+#  - sets up a single NIC on same subnet as dom0
+#  - conducts hping2 tcp tests to the dom0 IP address
+
+# hping2 $dom0_IP -c 1 -d $size
+#   where $size = 1, 48, 64, 512, 1440, 1448, 1500, 1505,
+#                 4096, 4192, 32767, 65507, 65508
+
+trysizes = [ 1, 48, 64, 512, 1440, 1500, 1505, 4096, 4192, 
+                32767, 65495 ]
+
+
+
+from XmTestLib import *
+rc = 0
+
+Net = XmNetwork()
+
+try:
+    # read an IP address from the config
+    ip     = Net.ip("dom1", "eth0")
+    mask   = Net.mask("dom1", "eth0")
+except NetworkError, e:
+        FAIL(str(e))
+
+# Fire up a guest domain w/1 nic
+if ENABLE_HVM_SUPPORT:
+    brg = "xenbr0"
+    config = {"vif" : ['type=ioemu, bridge=%s' % brg]}
+else:
+    brg = None
+    config = {"vif"  : ["ip=%s" % ip]}
+
+domain = XmTestDomain(extraConfig=config)
+try:
+    domain.start()
+except DomainError, e:
+    if verbose:
+        print "Failed to create test domain because:"
+        print e.extra
+    FAIL(str(e))
+
+
+# Attach a console
+try:
+    console = XmConsole(domain.getName(), historySaveCmds=True)
+    # Activate the console
+    console.sendInput("bhs")
+except ConsoleError, e:
+    FAIL(str(e))
+
+try:
+    # Add a suitable dom0 IP address 
+    dom0ip = Net.ip("dom0", "eth0", todomname=domain.getName(), toeth="eth0", 
bridge=brg)
+except NetworkError, e:
+        FAIL(str(e))
+
+try:
+    console.runCmd("ifconfig eth0 inet "+ip+" netmask "+mask+" up")
+
+    # Ping dom0
+    fails=""
+    for size in trysizes:
+        out = console.runCmd("hping2 " + dom0ip + " -E /dev/urandom -q -c 20 "
+              + "--fast -d " + str(size))
+        if out["return"]:
+            fails += " " + str(size) 
+            print out["output"]
+except ConsoleError, e:
+        FAIL(str(e))
+
+if len(fails):
+    FAIL("TCP hping2 to dom0 failed for size" + fails + ".")
+
diff -r b13e54483c1a -r 8c1badb84c3e 
tools/xm-test/tests/network/07_network_dom0_udp_pos.py
--- /dev/null   Thu Mar  9 23:49:08 2006
+++ b/tools/xm-test/tests/network/07_network_dom0_udp_pos.py    Thu Mar  9 
23:49:54 2006
@@ -0,0 +1,81 @@
+#!/usr/bin/python
+
+# Copyright (C) International Business Machines Corp., 2006
+# Author:  <dykman@xxxxxxxxxx>
+
+# UDP tests to dom0.
+#  - determines dom0 network
+#  - creates a single guest domain
+#  - sets up a single NIC on same subnet as dom0
+#  - conducts hping2 udp tests to the dom0 IP address
+
+# hping2 $dom0_IP -2 -c 1 -d $size
+#   where $size = 1, 48, 64, 512, 1440, 1448, 1500, 1505,
+#                 4096, 4192, 32767, 65507, 65508
+
+trysizes = [ 1, 48, 64, 512, 1440, 1500, 1505, 4096, 4192, 
+                32767, 65495 ]
+
+
+
+from XmTestLib import *
+rc = 0
+
+Net = XmNetwork()
+
+try:
+    # read an IP address from the config
+    ip     = Net.ip("dom1", "eth0")
+    mask   = Net.mask("dom1", "eth0")
+except NetworkError, e:
+        FAIL(str(e))
+
+# Fire up a guest domain w/1 nic
+if ENABLE_HVM_SUPPORT:
+    brg = "xenbr0"
+    config = {"vif" : ['type=ioemu, bridge=%s' % brg]}
+else:
+    brg = None
+    config = {"vif"  : ["ip=%s" % ip]}
+
+domain = XmTestDomain(extraConfig=config)
+try:
+    domain.start()
+except DomainError, e:
+    if verbose:
+        print "Failed to create test domain because:"
+        print e.extra
+    FAIL(str(e))
+
+
+# Attach a console
+try:
+    console = XmConsole(domain.getName(), historySaveCmds=True)
+    # Activate the console
+    console.sendInput("bhs")
+except ConsoleError, e:
+    FAIL(str(e))
+
+try:
+    # Add a suitable dom0 IP address 
+    dom0ip = Net.ip("dom0", "eth0", todomname=domain.getName(), toeth="eth0", 
bridge=brg)
+except NetworkError, e:
+        FAIL(str(e))
+
+try:
+    console.runCmd("ifconfig eth0 inet "+ip+" netmask "+mask+" up")
+
+    # Ping dom0
+    fails=""
+    for size in trysizes:
+        out = console.runCmd("hping2 " + dom0ip + " -E /dev/urandom -2 -q -c 
20"
+             + " --fast -d " + str(size))
+        if out["return"]:
+            fails += " " + str(size) 
+            print out["output"]
+except ConsoleError, e:
+        FAIL(str(e))
+
+if len(fails):
+    FAIL("UDP hping2 to dom0 failed for size" + fails + ".")
+
diff -r b13e54483c1a -r 8c1badb84c3e 
tools/xm-test/tests/network/12_network_domU_tcp_pos.py
--- /dev/null   Thu Mar  9 23:49:08 2006
+++ b/tools/xm-test/tests/network/12_network_domU_tcp_pos.py    Thu Mar  9 
23:49:54 2006
@@ -0,0 +1,82 @@
+#!/usr/bin/python
+
+# Copyright (C) International Business Machines Corp., 2006
+# Author:  <dykman@xxxxxxxxxx>
+
+# TCP tests to domU interface
+#  - creates two guest domains
+#  - sets up a single NIC on each on same subnet 
+#  - conducts tcp tests to the domU IP address.
+
+# hping2 $domU_IP -c 1 -d $size 
+#   where $size = 1, 48, 64, 512, 1440, 1500, 1505, 
+#                 4096, 4192, 32767, 65507, 65508
+
+pingsizes = [ 1, 48, 64, 512, 1440, 1500, 1505, 4096, 4192, 16384, 24567, 
+              32767, 65495 ]
+
+from XmTestLib import *
+
+def netDomain(ip):
+    if ENABLE_HVM_SUPPORT:
+        config = {"vif" : ['type=ioemu']}
+    else:
+        config = {"vif"  : ["ip=%s" % ip]}
+
+    dom = XmTestDomain(extraConfig=config)
+    try:
+        dom.start()
+    except DomainError, e:
+        if verbose:
+            print "Failed to create test domain because:"
+            print e.extra
+        FAIL(str(e))
+    try:
+        # Attach a console
+        console = XmConsole(dom.getName(), historySaveCmds=True)
+        # Activate the console
+        console.sendInput("bhs")
+    except ConsoleError, e:
+        FAIL(str(e))
+    return console
+    
+rc = 0
+
+Net = XmNetwork()
+
+try:
+    # pick an IP address 
+    ip1   = Net.ip("dom1", "eth2")
+    mask1 = Net.mask("dom1", "eth2")
+except NetworkError, e:
+    FAIL(str(e))
+
+try:
+    # pick another IP address 
+    ip2   = Net.ip("dom2", "eth2")
+    mask2 = Net.mask("dom2", "eth2")
+except NetworkError, e:
+    FAIL(str(e))
+
+# Fire up a pair of guest domains w/1 nic each
+src_console = netDomain(ip1)
+dst_console = netDomain(ip2)
+
+try:
+    src_console.runCmd("ifconfig eth0 inet "+ip1+" netmask "+mask1+" up")
+    dst_console.runCmd("ifconfig eth0 inet "+ip2+" netmask "+mask2+" up")
+
+    # Ping the victim over eth0
+    fails=""
+    for size in pingsizes:
+        out = src_console.runCmd("hping2 " + ip2 + " -E /dev/urandom -q -c 20 "
+              + "--fast -d " + str(size))
+        if out["return"]:
+            fails += " " + str(size) 
+            print out["output"]
+except ConsoleError, e:
+    FAIL(str(e))
+
+if len(fails):
+    FAIL("TCP hping2 failed for size" + fails + ".")
+
diff -r b13e54483c1a -r 8c1badb84c3e 
tools/xm-test/tests/network/13_network_domU_udp_pos.py
--- /dev/null   Thu Mar  9 23:49:08 2006
+++ b/tools/xm-test/tests/network/13_network_domU_udp_pos.py    Thu Mar  9 
23:49:54 2006
@@ -0,0 +1,82 @@
+#!/usr/bin/python
+
+# Copyright (C) International Business Machines Corp., 2006
+# Author:  <dykman@xxxxxxxxxx>
+
+# 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  
+#   where $size = 1, 48, 64, 512, 1440, 1500, 1505, 
+#                 4096, 4192, 32767, 65507, 65508
+
+pingsizes = [ 1, 48, 64, 512, 1440, 1500, 1505, 4096, 4192, 
+              32767, 65495 ]
+
+from XmTestLib import *
+
+def netDomain(ip):
+    if ENABLE_HVM_SUPPORT:
+        config = {"vif" : ['type=ioemu']}
+    else:
+        config = {"vif"  : ["ip=%s" % ip]}
+
+    dom = XmTestDomain(extraConfig=config)
+    try:
+        dom.start()
+    except DomainError, e:
+        if verbose:
+            print "Failed to create test domain because:"
+            print e.extra
+        FAIL(str(e))
+    try:
+        # Attach a console
+        console = XmConsole(dom.getName(), historySaveCmds=True)
+        # Activate the console
+        console.sendInput("bhs")
+    except ConsoleError, e:
+        FAIL(str(e))
+    return console
+    
+rc = 0
+
+Net = XmNetwork()
+
+try:
+    # pick an IP address 
+    ip1   = Net.ip("dom1", "eth2")
+    mask1 = Net.mask("dom1", "eth2")
+except NetworkError, e:
+    FAIL(str(e))
+
+try:
+    # pick another IP address 
+    ip2   = Net.ip("dom2", "eth2")
+    mask2 = Net.mask("dom2", "eth2")
+except NetworkError, e:
+    FAIL(str(e))
+
+# Fire up a pair of guest domains w/1 nic each
+src_console = netDomain(ip1)
+dst_console = netDomain(ip2)
+
+try:
+    src_console.runCmd("ifconfig eth0 inet "+ip1+" netmask "+mask1+" up")
+    dst_console.runCmd("ifconfig eth0 inet "+ip2+" netmask "+mask2+" up")
+
+    # Ping the victim over eth0
+    fails=""
+    for size in pingsizes:
+        out = src_console.runCmd("hping2 " + ip2 + " -E /dev/urandom -2 -q "
+              + "-c 20 --fast -d " + str(size))
+        if out["return"]:
+            fails += " " + str(size) 
+            print out["output"]
+except ConsoleError, e:
+    FAIL(str(e))
+
+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®.