コード例 #1
0
 def _get_ip_addr():
     """ Wait until open node is booted and get its ip address"""
     with SerialExpectForSocket(logger=LOGGER) as a8_expect:
         a8_expect.send('root')
         a8_expect.expect('# ')
         a8_expect.send(IP_CMD)
         ip_addr = a8_expect.expect(r'\d+\.\d+\.\d+.\d+', timeout=10)
         a8_expect.send('exit')
         if not ip_addr:  # pragma: no cover
             raise A8ConnectionError("Invalid Ip address", ip_addr)
     return ip_addr
コード例 #2
0
ファイル: node_rpi3.py プロジェクト: iot-lab/iot-lab-gateway
    def wait_booted(self, timeout):
        """ Monitor RPi3 tty to check if node booted """
        t_start = time.time()
        try:
            LOGGER.debug("Time before boot %s", datetime.datetime.now())
            self._rpi3_expect = SerialExpectForSocket(logger=LOGGER)
            match = self._rpi3_expect.expect(' login: '******'wait_tty' and serial creation (fast start/stop)
            match = ''
        finally:
            delta_t = time.time() - t_start
            self._debug_boot_stop()

        if match != '':
            LOGGER.info("Boot RPi3 succeeded in time: %ds", delta_t)
        else:
            LOGGER.error("Boot RPi3 failed in time: %ds", delta_t)
        return match