History log of /external/autotest/client/cros/dhcp_test_server.py
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
e1d4fcb22f2f3f505a18e5078a73045872fb03ff 16-Jul-2014 Paul Stewart <pstew@chromium.org> Add DHCP tests where both an ACK and NAK are received

In order to allow this to happen, modify DHCP handling
rules to support responding with multiple packets at a
time.

CQ-DEPEND=CL:208207
BUG=chromium:384897
TEST=Run this test

Change-Id: Ib8487f71aa4f774ea091433eaa8e354fb7ab9f0f
Reviewed-on: https://chromium-review.googlesource.com/208214
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/external/autotest/client/cros/dhcp_test_server.py
f56f7fde778822d17965bcd73c67dac1bb422829 15-Apr-2014 mukesh agrawal <quiche@chromium.org> autotest (dhcp): improve debuggability

This CL makes two changes to make it easier to debug DHCP
test failures:

1. When a test fails, report a) the class of the current
DhcpHandlingRule, and b) the most recent warning from that
rule (if any).

2. If the DhcpTestServer encounters an exception inside
the _loop_body, a) stash the exception, b) end the test,
and c) re-raise it when the main thread calls the
wait_for_test_to_finish method.

This is useful, e.g., when you write a new DhcpHandlingRule.
Previously, when a rule raised an exception, the test
would hang indefinitely. That's because the main thread would
wait for the server thread to finish, but the server thread
wouldn't finish cleanly, since it encountered an exception.

While there: demote an IPConfig-related log message from
error to info. The condition it reports does not seem to be
an error.

BUG=None
TEST=manual

Manual test: wrote a new DhcpHandlingRule that raised an
exception. Verified that the test ended in a reasonable time,
and that it reported the exception from the DhcpHandlingRule.

Change-Id: I31486e04bb77254896bab2ecc2cc2c50dbe7fa87
Reviewed-on: https://chromium-review.googlesource.com/194943
Tested-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>
/external/autotest/client/cros/dhcp_test_server.py
7d36aac2e68c1189b9c502cd095ed0edcef152c1 19-Sep-2012 Christopher Wiley <wiley@chromium.org> autotest: Change DHCP handling rules to optionally send responses

Add an optional argument to DhcpHandlingRule implementations to skip
sending response packets. This turns out to be handy when testing
things like dhcpcd behavior on lease timeouts. Simplify the logic to
return the response from DhcpHandlingRule.handle() by turning the
response into a bitfield, rather than a tuple of enums.

BUG=chromium-os:33764
TEST=New autotest: https://gerrit.chromium.org/gerrit/#/c/33633/

Change-Id: I20d42f3f5e81623d9c0ea308b9e3c8b896000559
Reviewed-on: https://gerrit.chromium.org/gerrit/33621
Tested-by: Christopher Wiley <wiley@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Ready: Christopher Wiley <wiley@chromium.org>
/external/autotest/client/cros/dhcp_test_server.py
a5f16dba60b7d501de2e9f8e345f992b0000bcec 13-Sep-2012 Christopher Wiley <wiley@chromium.org> autotest: Change DHCP Field and Option to namedtuple

This lets us use these objects as fields in a dictionary without
implementing a lot of very tedious operation methods. This in turn
fixes this nonsense where we use the names of Options in some places and
the Option numbers in others.

BUG=chromium-os:34417
TEST=unittests pass, autotest tests pass

Change-Id: I971b98505d0a1e95fd40e6ea3557a7dee63dfa62
Reviewed-on: https://gerrit.chromium.org/gerrit/33151
Commit-Ready: Christopher Wiley <wiley@chromium.org>
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Tested-by: Christopher Wiley <wiley@chromium.org>
/external/autotest/client/cros/dhcp_test_server.py
1964458a980b17c71ea10f9c00c59fe15bb83a96 17-Aug-2012 Christopher Wiley <wiley@chromium.org> autotest: Add tools for writing DHCP tests

Add dhcp_test_server, dhcp_packet, and dhcp_handling_rule.

dhcp_test_server starts up a thread to watch a given port for DHCP
packets, and can be programmed with instances of DhcpHandlingRule to
expect certain packets and report errors. dhcp_packet defines utility
logic to create and parse DHCP packets. There are much more elaborate
comments and example usages at the top of all three files.

Because this is a fairly elaborate piece of logic, I wrote some simple
sanity tests for both DhcpPacket and DhcpTestServer that may be run with

$ python dhcp_packet && echo Test passed.
$ python dhcp_test_server && echo Test passed.

The tests in dhcp_packet.py make sure that packet and serialization
works for discovery packets. Tests in dhcp_test_server.py walk through
a simple test case where the server expects a DISCOVERY packet, and the
client expects a valid response.

For debugging and sanity checking, I've taken packet logs of a
conversation between dhclient and dhcpd negotiating a ip lease. These
logs are in dhcp_test_data/*. I use these logs in the test for
DhcpPacket, but they could conceviably be useful in future testing.

BUG=chromium-os:32809
TEST=as described above

Change-Id: I04c6806e8b02446b0758e507c14ba85f6d10e30f
Reviewed-on: https://gerrit.chromium.org/gerrit/31134
Tested-by: Christopher Wiley <wiley@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Christopher Wiley <wiley@chromium.org>
/external/autotest/client/cros/dhcp_test_server.py