ia64/xen-unstable

changeset 8300:9d812d5470e8

Single domU, ping to dom0.

Signed-off-by: Jim Dykman <dykman@us.ibm.com>
author emellor@leeni.uk.xensource.com
date Fri Dec 09 10:40:28 2005 +0000 (2005-12-09)
parents a22ad856d199
children da3b19d7bf9e
files tools/xm-test/tests/network/05_network_dom0_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/05_network_dom0_ping_pos.py	Fri Dec 09 10:40:28 2005 +0000
     1.3 @@ -0,0 +1,73 @@
     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 dom0 interface
    1.10 +#  - determines dom0 network
    1.11 +#  - creates a single guest domain
    1.12 +#  - sets up a single NIC on same subnet as dom0
    1.13 +#  - conducts ping tests to the dom0 IP address.
    1.14 +
    1.15 +# ping -c 1 -s $size $dom0_IP 
    1.16 +#   where $size = 1, 48, 64, 512, 1440, 1500, 1505, 
    1.17 +#                 4096, 4192, 32767, 65507, 65508
    1.18 +
    1.19 +pingsizes = [ 1, 48, 64, 512, 1440, 1500, 1505, 4096, 4192, 
    1.20 +                32767, 65507 ]
    1.21 +
    1.22 +
    1.23 +
    1.24 +from XmTestLib import *
    1.25 +rc = 0
    1.26 +
    1.27 +Net = XmNetwork()
    1.28 +
    1.29 +try:
    1.30 +    # read an IP address from the config
    1.31 +    ip     = Net.ip("dom1", "eth0")
    1.32 +    mask   = Net.mask("dom1", "eth0")
    1.33 +except NetworkError, e:
    1.34 +        FAIL(str(e))
    1.35 +
    1.36 +# Fire up a guest domain w/1 nic
    1.37 +domain = XmTestDomain(extraOpts={ 'nics' : 1 })
    1.38 +try:
    1.39 +    domain.configSetVar('vif', " [ 'ip=" + ip + "' ]")
    1.40 +    domain.start()
    1.41 +except DomainError, e:
    1.42 +    if verbose:
    1.43 +        print "Failed to create test domain because:"
    1.44 +        print e.extra
    1.45 +    FAIL(str(e))
    1.46 +
    1.47 +
    1.48 +# Attach a console
    1.49 +try:
    1.50 +    console = XmConsole(domain.getName(), historySaveCmds=True)
    1.51 +    # Activate the console
    1.52 +    console.sendInput("bhs")
    1.53 +except ConsoleError, e:
    1.54 +    FAIL(str(e))
    1.55 +
    1.56 +try:
    1.57 +    # Add a suitable dom0 IP address 
    1.58 +    dom0ip = Net.ip("dom0", "eth0", todomname=domain.getName(), toeth="eth0")
    1.59 +except NetworkError, e:
    1.60 +        FAIL(str(e))
    1.61 +
    1.62 +try:
    1.63 +    console.runCmd("ifconfig eth0 inet "+ip+" netmask "+mask+" up")
    1.64 +
    1.65 +    # Ping dom0
    1.66 +    fails=""
    1.67 +    for size in pingsizes:
    1.68 +        out = console.runCmd("ping -q -c 1 -s " + str(size) + " " + dom0ip)
    1.69 +        if out["return"]:
    1.70 +            fails += " " + str(size) 
    1.71 +except ConsoleError, e:
    1.72 +        FAIL(str(e))
    1.73 +
    1.74 +if len(fails):
    1.75 +    FAIL("Ping to dom0 failed for size" + fails + ".")
    1.76 +