| 1 | #!/usr/bin/python |
|---|
| 2 | |
|---|
| 3 | # Copyright (C) International Business Machines Corp., 2005 |
|---|
| 4 | # Author: <dykman@us.ibm.com> |
|---|
| 5 | |
|---|
| 6 | # Ping tests to dom0 interface |
|---|
| 7 | # - determines dom0 network |
|---|
| 8 | # - creates a single guest domain |
|---|
| 9 | # - sets up a single NIC on same subnet as dom0 |
|---|
| 10 | # - conducts ping tests to the dom0 IP address. |
|---|
| 11 | |
|---|
| 12 | # ping -c 1 -s $size $dom0_IP |
|---|
| 13 | # where $size = 1, 48, 64, 512, 1440, 1500, 1505, |
|---|
| 14 | # 4096, 4192, 32767, 65507, 65508 |
|---|
| 15 | |
|---|
| 16 | pingsizes = [ 1, 48, 64, 512, 1440, 1500, 1505, 4096, 4192, |
|---|
| 17 | 32767, 65507 ] |
|---|
| 18 | |
|---|
| 19 | from XmTestLib import * |
|---|
| 20 | rc = 0 |
|---|
| 21 | |
|---|
| 22 | # Test creates 1 domain, which requires 2 ips: 1 for the domains and 1 for |
|---|
| 23 | # aliases on dom0 |
|---|
| 24 | if xmtest_netconf.canRunNetTest(2) == False: |
|---|
| 25 | SKIP("Don't have enough free configured IPs to run this test") |
|---|
| 26 | |
|---|
| 27 | # Fire up a guest domain w/1 nic |
|---|
| 28 | domain = XmTestDomain() |
|---|
| 29 | domain.newDevice(XenNetDevice, "eth0") |
|---|
| 30 | |
|---|
| 31 | try: |
|---|
| 32 | console = domain.start() |
|---|
| 33 | except DomainError, e: |
|---|
| 34 | if verbose: |
|---|
| 35 | print "Failed to create test domain because:" |
|---|
| 36 | print e.extra |
|---|
| 37 | FAIL(str(e)) |
|---|
| 38 | |
|---|
| 39 | try: |
|---|
| 40 | # Ping dom0 |
|---|
| 41 | fails="" |
|---|
| 42 | netdev = domain.getDevice("eth0") |
|---|
| 43 | dom0ip = netdev.getDom0AliasIP() |
|---|
| 44 | for size in pingsizes: |
|---|
| 45 | out = console.runCmd("ping -q -c 1 -s " + str(size) + " " + dom0ip) |
|---|
| 46 | if out["return"]: |
|---|
| 47 | fails += " " + str(size) |
|---|
| 48 | except ConsoleError, e: |
|---|
| 49 | FAIL(str(e)) |
|---|
| 50 | |
|---|
| 51 | domain.stop() |
|---|
| 52 | |
|---|
| 53 | if len(fails): |
|---|
| 54 | FAIL("Ping to dom0 failed for size" + fails + ".") |
|---|