Beispiel #1
0
    def _setup_open_node(self):
        """ Setup open node connection
        * Flash firmware
        * Start serial interface """
        ret_val = 0

        ret = self.g_m.open_node.setup(self.on_class.FW_AUTOTEST)
        ret_val += self._check(ret, 'open_node_setup', ret)

        self.on_serial = OpenNodeConnection()
        ret = self.on_serial.start()
        ret_val += self._check(ret, 'open_node_connection', ret)
        return ret_val
Beispiel #2
0
    def _setup_linux_open_node(self):
        """ Setup Linux open node connection

        * Boot open node
        * Connect through serial and get ip address
        * SSH connect to it
          * get

        """
        assert self.on_class.TYPE in ('a8', 'rpi3')
        # Should be adapted if already booted, so not enabled for cn_no
        assert self.cn_class.TYPE == 'iotlab'

        ret_val = 0
        ret = self.g_m.open_node.setup(None, debug=False)
        self._assert(ret, 'linux_node_setup', ret, 'Linux Node Setup failed')

        match = self.g_m.open_node.wait_booted(timeout=300)
        self._assert(tst_ok(match != ''), 'linux_node_boot_timeout', 300,
                     'Linux Node Boot failed')

        # get ip address using serial
        # run socats commands to access Linux node on gateway
        self.linux_connection = open_linux_interface.OpenLinuxConnection()
        LOGGER.debug("Wait that Linux node starts")
        try:
            self.linux_connection.start()
        except open_linux_interface.LinuxConnectionError as err:
            self._assert(1, f'linux_node_init_error: {err.err_msg}', str(err),
                         'Setup Connection failed')

        # save mac address
        linux_mac_addr = self.linux_connection.get_mac_addr()
        self.ret_dict['mac']['ON'] = linux_mac_addr
        test_ok = (MAC_RE.match(linux_mac_addr) is not None)
        ret_val += self._check(tst_ok(test_ok), 'linux_mac_addr',
                               linux_mac_addr)

        ret = self.linux_connection.flash()
        self._assert(ret, 'linux_node_flash_autotest', ret,
                     'Linux Open Node Flash Failed')

        # Create Linux open node connection through serial redirection
        self.on_serial = OpenNodeConnection(self.linux_connection.ip_addr)
        ret = self.on_serial.start()
        ret_val += self._check(ret, 'linux_open_node_serial', ret)

        return ret_val
Beispiel #3
0
    def _setup_open_node_a8(self):
        """ Setup open node a8-m3 connection

        * Boot open node
        * Connect through serial and get ip address
        * SSH connect to it
          * get

        """
        assert self.on_class.TYPE == 'a8'
        # Should be adapted if already booted, so not enabled for cn_no
        assert self.cn_class.TYPE == 'iotlab'

        ret_val = 0
        ret = self.g_m.open_node.setup(None, debug=False)
        self._assert(ret, 'open_a8_setup', ret, 'Open Node Setup failed')

        match = self.g_m.open_node.wait_booted(timeout=300)
        self._assert(tst_ok(match != ''), 'open_a8_boot_timeout', 300,
                     'Open Node Boot failed')

        # get ip address using serial
        # run socats commands to access a8-m3 open node on gateway
        self.a8_connection = open_a8_interface.OpenA8Connection()
        LOGGER.debug("Wait that open a8 node starts")
        try:
            self.a8_connection.start()
        except open_a8_interface.A8ConnectionError as err:  # pragma: no cover
            self._assert(1, 'open_a8_init_error: %s' % err.err_msg, str(err),
                         'Setup Connection failed')

        # save mac address
        a8_mac_addr = self.a8_connection.get_mac_addr()
        self.ret_dict['mac']['a8'] = a8_mac_addr
        test_ok = (MAC_RE.match(a8_mac_addr) is not None)
        ret_val += self._check(tst_ok(test_ok), 'a8_mac_addr', a8_mac_addr)

        ret = self.a8_connection.flash(self.g_m.open_node.A8_M3_FW_AUTOTEST)
        self._assert(ret, 'flash a8_autotest.elf', ret, 'OpenNodeFlash Failed')

        # Create open node a8-m3 connection through node-a8 serial redirection
        self.on_serial = OpenNodeConnection(self.a8_connection.ip_addr)
        ret = self.on_serial.start()
        ret_val += self._check(ret, 'open_a8_serial', ret)

        return ret_val