ia64/xen-unstable

changeset 14958:ac203df11e50

[XM-TEST] Add test for new network functions

signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
author Tom Wilkie <tom.wilkie@gmail.com>
date Thu Apr 26 16:15:08 2007 +0100 (2007-04-26)
parents aeb1931eab36
children 5754173c3d81
files tools/xm-test/tests/xapi/03_xapi-network_pos.py tools/xm-test/tests/xapi/Makefile.am
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tools/xm-test/tests/xapi/03_xapi-network_pos.py	Thu Apr 26 16:15:08 2007 +0100
     1.3 @@ -0,0 +1,71 @@
     1.4 +#!/usr/bin/python
     1.5 +
     1.6 +# Try and create two VMs and a private network betwene the two
     1.7 +
     1.8 +import sys
     1.9 +
    1.10 +from XmTestLib import *
    1.11 +from XmTestLib.network_utils import *
    1.12 +
    1.13 +# Create two domains (default XmTestDomain, with our ramdisk)
    1.14 +try:
    1.15 +    domain1 = XmTestDomain()
    1.16 +    console1 = domain1.start()
    1.17 +    domain2 = XmTestDomain()
    1.18 +    console2 = domain2.start()
    1.19 +except DomainError, e:
    1.20 +    if verbose:
    1.21 +        print "Failed to create test domain because:"
    1.22 +        print e.extra
    1.23 +    FAIL(str(e))
    1.24 +
    1.25 +# Create a network
    1.26 +
    1.27 +status, ouptut = traceCommand("xm network-new xapi-network")
    1.28 +if status:
    1.29 +    FAIL(output)
    1.30 +
    1.31 +# Attach two domains to it
    1.32 +status, msg = network_attach(domain1.getName(),
    1.33 +                             console1, bridge='xapi-network')
    1.34 +if status:
    1.35 +    FAIL(msg)
    1.36 +
    1.37 +status, msg = network_attach(domain2.getName(),
    1.38 +                             console2, bridge='xapi-network')
    1.39 +if status:
    1.40 +    FAIL(msg)
    1.41 +
    1.42 +# Configure IP addresses on two domains
    1.43 +try:
    1.44 +    # Run 'ls'
    1.45 +    run = console1.runCmd("ifconfig eth0 192.168.0.1 netmask 255.255.255.0 up")
    1.46 +    run = console2.runCmd("ifconfig eth0 192.168.0.2 netmask 255.255.255.0 up")
    1.47 +except ConsoleError, e:
    1.48 +    saveLog(console.getHistory())
    1.49 +    FAIL(str(e))
    1.50 +
    1.51 +# Now ping...
    1.52 +try:
    1.53 +    run = console1.runCmd("ping -c 4 192.168.0.2")
    1.54 +    if run['return'] > 0:
    1.55 +        FAIL("Could not ping other host")
    1.56 +    run = console2.runCmd("ping -c 4 192.168.0.1")
    1.57 +    if run['return'] > 0:
    1.58 +        FAIL("Could not pint other host")
    1.59 +except ConsoleError, e:
    1.60 +    saveLog(console.getHistory())
    1.61 +    FAIL(str(e))
    1.62 +
    1.63 +status, msg = network_detach(domain1.getName(), console1)
    1.64 +status, msg = network_detach(domain2.getName(), console2)
    1.65 +
    1.66 +# Clean up
    1.67 +domain1.closeConsole()
    1.68 +domain1.stop()
    1.69 +domain2.closeConsole()
    1.70 +domain2.stop()
    1.71 +
    1.72 +status, ouptut = traceCommand("xm network-del xapi-network")
    1.73 +if status:
    1.74 +    FAIL(output)
     2.1 --- a/tools/xm-test/tests/xapi/Makefile.am	Thu Apr 26 15:48:09 2007 +0100
     2.2 +++ b/tools/xm-test/tests/xapi/Makefile.am	Thu Apr 26 16:15:08 2007 +0100
     2.3 @@ -1,7 +1,8 @@
     2.4  SUBDIRS =
     2.5  
     2.6  TESTS = 01_xapi-vm_basic.test \
     2.7 -	02_xapi-vbd_basic.test
     2.8 +	02_xapi-vbd_basic.test \
     2.9 +	03_xapi-network_pos.test
    2.10  
    2.11  XFAIL_TESTS =
    2.12