conman:  Wait for provisioning properly.

Adds a Ratchet class that allows us to track, and optionally time out,
each step of the process (DHCP lease, ACS session started, ACS session
completed), and call 'cwmp wakeup' after receiving a DHCP lease to
trigger an ACS session.  This subsumes the existing wait-for-DHCP
code.

The Ratchet class may seem overengineered at first glance, but I
started writing the alternative and it was leading to spaghetti code
that was hard to test (and would be hard to maintain).  Now the serial
timeout logic is separate and can be tested cleanly.

Other minor fixes/refactors:

- Clear gateway_ip and subnet before all 'wifi setclient' calls,
  in particular WLANConfiguration calls (this was already done for
  provisioning calls).

- Create a ConnectionManager.interfaces() method to replace multiple
  references to "[self.bridge] + self.wifi".

- Remove some spurious variables in connection_manager_test.

- Each interface now has its own Status, and there is a composite
  Status that takes the disjunction of each interface's status. In
  practice, this should not cause problems (and was necessary to
  resolve some), but it does mean that the contents of
  /tmp/conman/status may not provide the same coherent summary as
  originally intended. Any future /bin/ledmonitor changes will have to
  take this into account (or the composite status will have to be made
  smarter).  There may be some edge cases for two-radio devices which
  will need to be resolved before we launch any which run conman (e.g.
  as written, ledmonitor will flash fast blue if CONNECTED_TO_OPEN is
  present, even if CONNECTED_TO_WLAN is also present, which could
  happen with a two-radio device).

Change-Id: I8e44babba431f70dcc7a3320c33415b292c05271
8 files changed