| OLD | NEW |
| 1 import logging | 1 import logging |
| 2 from autotest_lib.client.common_lib import error | 2 from autotest_lib.client.common_lib import error |
| 3 import kvm_subprocess | 3 from autotest_lib.client.virt import aexpect |
| 4 | |
| 5 | 4 |
| 6 def run_pxe(test, params, env): | 5 def run_pxe(test, params, env): |
| 7 """ | 6 """ |
| 8 PXE test: | 7 PXE test: |
| 9 | 8 |
| 10 1) Snoop the tftp packet in the tap device. | 9 1) Snoop the tftp packet in the tap device. |
| 11 2) Wait for some seconds. | 10 2) Wait for some seconds. |
| 12 3) Check whether we could capture TFTP packets. | 11 3) Check whether we could capture TFTP packets. |
| 13 | 12 |
| 14 @param test: KVM test object. | 13 @param test: KVM test object. |
| 15 @param params: Dictionary with the test parameters. | 14 @param params: Dictionary with the test parameters. |
| 16 @param env: Dictionary with test environment. | 15 @param env: Dictionary with test environment. |
| 17 """ | 16 """ |
| 18 vm = env.get_vm(params["main_vm"]) | 17 vm = env.get_vm(params["main_vm"]) |
| 19 vm.verify_alive() | 18 vm.verify_alive() |
| 20 timeout = int(params.get("pxe_timeout", 60)) | 19 timeout = int(params.get("pxe_timeout", 60)) |
| 21 | 20 |
| 22 logging.info("Try to boot from PXE") | 21 logging.info("Try to boot from PXE") |
| 23 output = kvm_subprocess.run_fg("tcpdump -nli %s" % vm.get_ifname(), | 22 output = aexpect.run_fg("tcpdump -nli %s" % vm.get_ifname(), |
| 24 logging.debug, "(pxe capture) ", timeout)[1] | 23 logging.debug, "(pxe capture) ", timeout)[1] |
| 25 | 24 |
| 26 logging.info("Analyzing the tcpdump result...") | 25 logging.info("Analyzing the tcpdump result...") |
| 27 if not "tftp" in output: | 26 if not "tftp" in output: |
| 28 raise error.TestFail("Couldn't find any TFTP packets after %s seconds" % | 27 raise error.TestFail("Couldn't find any TFTP packets after %s seconds" % |
| 29 timeout) | 28 timeout) |
| 30 logging.info("Found TFTP packet") | 29 logging.info("Found TFTP packet") |
| OLD | NEW |