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