Wait for correct IP subnet changes during roaming

This allows roaming tests to pass when run against drivers
that do roaming without involving userspace.  In these situations
we're briefly associated with the roaming target before we detect
that our DHCP lease is invalid and re-negotiate the lease.  Tolerate
that window by also waiting for the IP address on the WiFi interface
to move to the correct subnet.

Add a library to make common netblock->mask/subnet/broadcast address
calculations.  Pull duplicate logic to do this out of interface.py
and site_linux_router.py.

BUG=chromium:352847
TEST=wifi_matfunc continues to pass with this change.

Change-Id: I2e6786514aee533e36eb84e1329f19891d3744ba
Reviewed-on: https://chromium-review.googlesource.com/190173
Tested-by: Christopher Wiley <wiley@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Christopher Wiley <wiley@chromium.org>
6 files changed