Auto-tools/Projects/Lifeguard

From MozillaWiki
Jump to: navigation, search

Goals

Lifeguard is a library that provides the ability to query the state of mobile devices, generally via SUTAgent, and to attempt to recover devices that experience problems, such as bad SD cards. It will be an important part of Mozpool. Ideally it will function in a standalone environment as well, though it will probably still require a local MozPool.

Non-Goals

  • As with MozPool, ideally it will work on all major platforms, though Linux will be targetted initially. Lifeguard will target Python 2.7 but may work with earlier versions.

Links

Design

TBD, but AutoPhone provides some of this already, so probably is a good place to start. There's also a bunch of code in sut_tools that's currently used to verify device state; we could potentially re-use some of this.

Requirements

  1. Once a device is registered with Lifeguard, it should track its state (via MozPool), and should periodically ping the device to verify that it's still alive.
    1. If the ping fails, Lifeguard should attempt to recover the device by resetting its power up to N times.
    2. If resetting the device fails, Lifeguard should mark the device (in MozPool) as offline.
  2. Lifeguard should provide an API with which remote components can interact with it (via TCP sockets or HTTP), and should include the following:
    1. an API to flash a given B2G build on a device (do we need to be able to flash fennec boards as well?).
    2. an API to reboot a device, given its identifier.
    3. an API to reset the power on a device, given its identifier.
  3. Lifeguard should have unit tests, that we can run before committing changes.
  4. Lifeguard should maintain a detailed log including, among other things, errors and all API requests.
  5. Lifeguard should be well-documented.

Open Questions

  • How should Lifeguard verify a device is online? Is a simple ping enough?
  • How does Lifeguard fit in with BlackMobileMagic?