source: trunk/packages/xen-3.1/xen-3.1/tools/xm-test/tests/network/03_network_local_tcp_pos.py @ 34

Last change on this file since 34 was 34, checked in by hartmans, 18 years ago

Add xen and xen-common

  • Property svn:mime-type set to text/script
File size: 2.0 KB
Line 
1#!/usr/bin/python
2
3# Copyright (C) International Business Machines Corp., 2006
4# Author:  <dykman@us.ibm.com>
5
6# TCP tests on local interfaces.
7#  - creates a single guest domain
8#  - sets up a single NIC
9#  - conducts hping tcp tests to the local loopback and IP address
10
11# hping2 127.0.0.1 -c 1 -d $size
12# hping2 $local_IP -c 1 -d $size
13#   where $size = 1, 48, 64, 512, 1440, 1448, 1500, 1505,
14#                 4096, 4192, 32767, 65507, 65508
15
16
17trysizes = [ 1, 48, 64, 512, 1440, 1448, 1500, 1505, 4096, 4192,
18              32767, 65495 ]
19
20from XmTestLib import *
21rc = 0
22
23# Test creates 1 domain, which requires 2 ips: 1 for the domains and 1 for
24# aliases on dom0
25if xmtest_netconf.canRunNetTest(2) == False:
26    SKIP("Don't have enough free configured IPs to run this test")
27
28# Fire up a guest domain w/1 nic
29domain = XmTestDomain()
30domain.newDevice(XenNetDevice, "eth0")
31
32try:
33    console = domain.start()
34except DomainError, e:
35    if verbose:
36        print "Failed to create test domain because:"
37        print e.extra
38    FAIL(str(e))
39
40try:
41    console.setHistorySaveCmds(value=True)
42
43    # First do loopback
44    lofails=""
45    for size in trysizes:
46        out = console.runCmd("hping2 127.0.0.1 -E /dev/urandom -q -c 20 "
47              + "--fast -d " + str(size) + " -N " + str(size))
48        if out["return"]:
49            lofails += " " + str(size)
50
51    # Next comes eth0
52    eth0fails=""
53    netdev = domain.getDevice("eth0")
54    ip = netdev.getNetDevIP()
55    for size in trysizes:
56        out = console.runCmd("hping2 " + ip + " -E /dev/urandom -q -c 20 "
57              + "--fast -d "+ str(size) + " -N " + str(size))
58        if out["return"]:
59            eth0fails += " " + str(size)
60except ConsoleError, e:
61        FAIL(str(e))
62except NetworkError, e:
63        FAIL(str(e))
64
65domain.stop()
66
67# Tally up failures
68failures=""
69if len(lofails):
70        failures += "TCP hping2 over loopback failed for size" + lofails + ". "
71if len(eth0fails):
72        failures += "TCP hping2 over eth0 failed for size" + eth0fails + "."
73if len(failures):
74    FAIL(failures)
75
Note: See TracBrowser for help on using the repository browser.