ia64/xen-unstable

changeset 8301:da3b19d7bf9e

Two domUs, ping from one to the other

Signed-off-by: Jim Dykman <dykman@us.ibm.com>
author emellor@leeni.uk.xensource.com
date Fri Dec 09 10:40:41 2005 +0000 (2005-12-09)
parents 9d812d5470e8
children a8be51efaf46 9558361d8040
files tools/xm-test/tests/network/11_network_domU_ping_pos.py
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tools/xm-test/tests/network/11_network_domU_ping_pos.py	Fri Dec 09 10:40:41 2005 +0000
     1.3 @@ -0,0 +1,79 @@
     1.4 +#!/usr/bin/python
     1.5 +
     1.6 +# Copyright (C) International Business Machines Corp., 2005
     1.7 +# Author:  <dykman@us.ibm.com>
     1.8 +
     1.9 +# Ping tests to domU interface
    1.10 +#  - creates two guest domains
    1.11 +#  - sets up a single NIC on each on same subnet 
    1.12 +#  - conducts ping tests to the domU IP address.
    1.13 +
    1.14 +# ping -c 1 -s $size $domU_IP 
    1.15 +#   where $size = 1, 48, 64, 512, 1440, 1500, 1505, 
    1.16 +#                 4096, 4192, 32767, 65507, 65508
    1.17 +
    1.18 +pingsizes = [ 1, 48, 64, 512, 1440, 1500, 1505, 4096, 4192, 
    1.19 +              32767, 65507 ]
    1.20 +
    1.21 +
    1.22 +
    1.23 +from XmTestLib import *
    1.24 +
    1.25 +
    1.26 +def netDomain(ip):
    1.27 +    dom = XmTestDomain(extraOpts={ 'nics' : 1 })
    1.28 +    try:
    1.29 +        dom.configSetVar('vif', " [ 'ip=" + ip + "' ]")
    1.30 +        dom.start()
    1.31 +    except DomainError, e:
    1.32 +        if verbose:
    1.33 +            print "Failed to create test domain because:"
    1.34 +            print e.extra
    1.35 +        FAIL(str(e))
    1.36 +    try:
    1.37 +        # Attach a console
    1.38 +        console = XmConsole(dom.getName(), historySaveCmds=True)
    1.39 +        # Activate the console
    1.40 +        console.sendInput("bhs")
    1.41 +    except ConsoleError, e:
    1.42 +        FAIL(str(e))
    1.43 +    return console
    1.44 +    
    1.45 +rc = 0
    1.46 +
    1.47 +Net = XmNetwork()
    1.48 +
    1.49 +try:
    1.50 +    # pick an IP address 
    1.51 +    ip1   = Net.ip("dom1", "eth2")
    1.52 +    mask1 = Net.mask("dom1", "eth2")
    1.53 +except NetworkError, e:
    1.54 +    FAIL(str(e))
    1.55 +
    1.56 +try:
    1.57 +    # pick another IP address 
    1.58 +    ip2   = Net.ip("dom2", "eth2")
    1.59 +    mask2 = Net.mask("dom2", "eth2")
    1.60 +except NetworkError, e:
    1.61 +    FAIL(str(e))
    1.62 +
    1.63 +# Fire up a pair of guest domains w/1 nic each
    1.64 +pinger_console = netDomain(ip1)
    1.65 +victim_console = netDomain(ip2)
    1.66 +
    1.67 +try:
    1.68 +    pinger_console.runCmd("ifconfig eth0 inet "+ip1+" netmask "+mask1+" up")
    1.69 +    victim_console.runCmd("ifconfig eth0 inet "+ip2+" netmask "+mask2+" up")
    1.70 +
    1.71 +    # Ping the victim over eth0
    1.72 +    fails=""
    1.73 +    for size in pingsizes:
    1.74 +        out = pinger_console.runCmd("ping -q -c 1 -s " + str(size) + " " + ip2)
    1.75 +        if out["return"]:
    1.76 +            fails += " " + str(size) 
    1.77 +except ConsoleError, e:
    1.78 +    FAIL(str(e))
    1.79 +
    1.80 +if len(fails):
    1.81 +    FAIL("Ping failed for size" + fails + ".")
    1.82 +