'wait for each switch to connect to a controller,
up to 5 seconds
timeout: time to wait, or None to wait indefinitely
delay: seconds to sleep per iteration
returns: True if all switches are connected'

def waitConnected(self, timeout=None, delay=0.5):

    info('***    Waiting    for    switches    to    connect\n')
    time = 0
    remaining = list(self.switches)
    while True:
        for switch in tuple(remaining):
            if switch.connected():
                info(('%s    ' % switch))
                remaining.remove(switch)
        if (not remaining):
            info('\n')
            return True
        if ((time > timeout) and (timeout is not None)):
            break
        sleep(delay)
        time += delay
    warn(('Timed    out    after    %d    seconds\n' % time))
    for switch in remaining:
        if (not switch.connected()):
            warn(('Warning:    %s    is    not    connected    to    a    controller\n' % switch.name))
        else:
            remaining.remove(switch)
    return (not remaining)
