diff options
author | Tom Wilkie <tom.wilkie@gmail.com> | 2007-04-26 16:15:08 +0100 |
---|---|---|
committer | Tom Wilkie <tom.wilkie@gmail.com> | 2007-04-26 16:15:08 +0100 |
commit | fc0ab3e65a0f0018a607cea183cd1145f2e27a67 (patch) | |
tree | dcc4d0164d8443153aea5bf80fadc02840fc6937 /tools/xm-test | |
parent | 21cdf90f7acb1303742e6e5249a7d317c2f4bcfe (diff) | |
download | xen-fc0ab3e65a0f0018a607cea183cd1145f2e27a67.tar.gz xen-fc0ab3e65a0f0018a607cea183cd1145f2e27a67.tar.bz2 xen-fc0ab3e65a0f0018a607cea183cd1145f2e27a67.zip |
[XM-TEST] Add test for new network functions
signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
Diffstat (limited to 'tools/xm-test')
-rw-r--r-- | tools/xm-test/tests/xapi/03_xapi-network_pos.py | 71 | ||||
-rw-r--r-- | tools/xm-test/tests/xapi/Makefile.am | 3 |
2 files changed, 73 insertions, 1 deletions
diff --git a/tools/xm-test/tests/xapi/03_xapi-network_pos.py b/tools/xm-test/tests/xapi/03_xapi-network_pos.py new file mode 100644 index 0000000000..43ea82691d --- /dev/null +++ b/tools/xm-test/tests/xapi/03_xapi-network_pos.py @@ -0,0 +1,71 @@ +#!/usr/bin/python + +# Try and create two VMs and a private network betwene the two + +import sys + +from XmTestLib import * +from XmTestLib.network_utils import * + +# Create two domains (default XmTestDomain, with our ramdisk) +try: + domain1 = XmTestDomain() + console1 = domain1.start() + domain2 = XmTestDomain() + console2 = domain2.start() +except DomainError, e: + if verbose: + print "Failed to create test domain because:" + print e.extra + FAIL(str(e)) + +# Create a network + +status, ouptut = traceCommand("xm network-new xapi-network") +if status: + FAIL(output) + +# Attach two domains to it +status, msg = network_attach(domain1.getName(), + console1, bridge='xapi-network') +if status: + FAIL(msg) + +status, msg = network_attach(domain2.getName(), + console2, bridge='xapi-network') +if status: + FAIL(msg) + +# Configure IP addresses on two domains +try: + # Run 'ls' + run = console1.runCmd("ifconfig eth0 192.168.0.1 netmask 255.255.255.0 up") + run = console2.runCmd("ifconfig eth0 192.168.0.2 netmask 255.255.255.0 up") +except ConsoleError, e: + saveLog(console.getHistory()) + FAIL(str(e)) + +# Now ping... +try: + run = console1.runCmd("ping -c 4 192.168.0.2") + if run['return'] > 0: + FAIL("Could not ping other host") + run = console2.runCmd("ping -c 4 192.168.0.1") + if run['return'] > 0: + FAIL("Could not pint other host") +except ConsoleError, e: + saveLog(console.getHistory()) + FAIL(str(e)) + +status, msg = network_detach(domain1.getName(), console1) +status, msg = network_detach(domain2.getName(), console2) + +# Clean up +domain1.closeConsole() +domain1.stop() +domain2.closeConsole() +domain2.stop() + +status, ouptut = traceCommand("xm network-del xapi-network") +if status: + FAIL(output) diff --git a/tools/xm-test/tests/xapi/Makefile.am b/tools/xm-test/tests/xapi/Makefile.am index 2a815efe47..3ae8afffb0 100644 --- a/tools/xm-test/tests/xapi/Makefile.am +++ b/tools/xm-test/tests/xapi/Makefile.am @@ -1,7 +1,8 @@ SUBDIRS = TESTS = 01_xapi-vm_basic.test \ - 02_xapi-vbd_basic.test + 02_xapi-vbd_basic.test \ + 03_xapi-network_pos.test XFAIL_TESTS = |