コード例 #1
0
ファイル: docsis.py プロジェクト: lgirdk/boardfarm-docsis
    def is_erouter_honouring_config(self, method="snmp"):
        """Checks if the ErouterInitModeControl is set to honour what is stated
        in the boot file. This check can be performed via snmp or dmcli.

        :param method: one of "snmp"(default) or "dmcli"
        :type method: string

        :return: True if ErouterInitModeControl is set to follow the bootfile,
        False otherwise
        :rtype: bool
        """
        if "snmp" == method:
            ip = self.dev.cmts.get_cmip(self.cm_mac)
            if ip == "None":
                raise CodeError("Failed to get cm ip")
            out = SnmpHelper.snmp_v2(self.dev.wan, ip,
                                     "esafeErouterInitModeControl")
            return "5" == out
        elif "dmcli" == method:
            param = "Device.X_LGI-COM_Gateway.ErouterModeControl"
            out = self.dmcli.GPV(param)
            return "honoreRouterInitMode" == out.rval
        else:
            raise CodeError(
                f"Failed to get esafeErouterInitModeControl via {method}")
コード例 #2
0
ファイル: mitm.py プロジェクト: nickberry17/boardfarm
    def start_capture(self, devices: List[str]) -> None:
        """Add iptables rules if not done yet.
        Rewrite DNS for each provided device if not rewritten yet.
        Start capturing traffic in background to log file if not started yet.
        """
        if type(devices) is not list:
            raise TypeError(
                f"Expected devices parameter to be list, got {type(devices)} instead"
            )

        if not self.is_configured:
            self.configure_mitm()

        for device in set(devices) - set(self.mitm_dns_active):
            self._set_dns_to_mitm(device)

        if not self.mitm_pid:
            cmd = f"{MITM.base_exec_cmd} -w /root/{self.log_name} -q &"
            try:
                self.sendline(cmd)
                self.expect_prompt()
                self.mitm_pid = re.findall(r"\[\d+\]\s(\d+)", self.before).pop()
                self.expect(pexpect.TIMEOUT, timeout=1)

                # wait 1 second to check if process didn't get killed.
                running = self.check_output("")
                if "Exit" in running:
                    raise CodeError(
                        f"MITM pid:{self.pid} got killed.\nReason:\n{running}"
                    )
            except pexpect.TIMEOUT:
                raise CodeError()
        else:
            logger.info(f"MITM is already running with pid {self.mitm_pid}")
コード例 #3
0
    def execute(self):
        """Define Test step execute and Verifying test steps."""
        # enforce not to call execute without using with clause.
        if not self.called_with:
            raise CodeError(
                "{} - need to execute step using 'with' clause".format(
                    self.msg))

        # enforce not to call execute without adding an action
        if not self.actions:
            raise CodeError(
                "{} - no actions added before calling execute".format(
                    self.msg))

        self.execute_flag = True

        for _a_id, action in enumerate(self.actions):
            func_name = action.action.func.__name__
            prefix = "[{}]:[{} Step {}.{}]::[{}]".format(
                self.parent_test.__class__.__name__,
                self.prefix,
                self.step_id,
                self.action_id,
                func_name,
            )
            tr = None

            try:
                output = action.execute()
                tr = TestResult(prefix, "OK", "", (func_name, output))
                self.log_msg("{} : DONE".format(prefix))
            except Exception as e:
                tr = TestResult(prefix, "FAIL", str(e), (func_name, str(e)))
                self.log_msg("{} : FAIL :: {}:{}".format(
                    prefix, e.__class__.__name__, str(e)))
                raise (e)
            finally:
                self.result.append(tr)
                self.action_id += 1
                self.actions = []
        if self.verify_f:
            try:
                cond = self.verify_f()
            except Exception as e:
                raise CodeError("{}::[Verification] :\n{}".format(
                    self.msg, str(e)))
            self.verify(cond, self.v_msg)

        self.actions = []
コード例 #4
0
 def reload_sw_object(self, sw):
     sw_class = get_device_mapping_class(sw)
     if sw_class:
         self.sw = sw_class(self.hw)
     else:
         raise CodeError(f"class for {sw} not found")
     self.sw.version = self.sw.get_sw_version()
コード例 #5
0
ファイル: base_cmts.py プロジェクト: lgirdk/boardfarm-docsis
    def wait_for_cm_online(
        self,
        ignore_bpi=False,
        ignore_partial=False,
        ignore_cpe=False,
        time_to_sleep=10,
        iterations=20,
    ):
        """Waits for a CM to come online in an iterate-check-sleep loop. A CM
        is online when the its status is OPERATIONAL.
        The total timeout is 200s ca. (10s * 20 iterations). An ideal timeout
        for a CM to come online should be around 90s max, but currently this is
        not the case in our setup.

        :param ignore_bpi: (optional) considers the CM online even when BPI is disabled
        :type ignore_bpi: bool
        :param ignore_partial: (optional) considers the CM online even when CM is oin
        :type ignore_partial: bool
        :param ignore_cpe: (optional) considers tje CM online even when LAN<->WAN forwarding is disabled
        :type ignore_cpe: bool
        :param :
        :raises Execption: boardfarm.exception.CodeError on online failure
        """
        for _ in range(iterations):
            if self.dev.cmts.is_cm_online(ignore_bpi, ignore_partial,
                                          ignore_cpe):
                return
            time.sleep(time_to_sleep)
        raise CodeError(f"CM {self.board_wan_mac} is not online!!")
コード例 #6
0
ファイル: booting.py プロジェクト: lgirdk/boardfarm-docsis
def pre_boot_wan_clients(config, env_helper, devices):

    if env_helper.get_dns_dict():
        # to get reachable and unreachable ips for ACS DNS
        devices.wan.auth_dns = True
        dns_acs_config(devices, env_helper.get_dns_dict())

    tftp_device, tftp_servers = boardfarm.lib.booting.get_tftp(config)
    if not tftp_servers:
        logger.error(
            colored("No tftp server found", color="red", attrs=["bold"]))
        # currently we must have at least 1 tftp server configured
        raise NoTFTPServer
    if len(tftp_servers) > 1:
        msg = f"Found more than 1 tftp server: {tftp_servers}, using {tftp_device.name}"
        logger.error(colored(msg, color="red", attrs=["bold"]))
        raise CodeError(msg)

    # should we run configure for all the wan devices? or just wan?
    for x in devices:
        # if isinstance(x, DebianWAN): # does not work for mitm
        if hasattr(x, "name") and "wan" in x.name:
            logger.info(f"Configuring {x.name}")
            x.configure(config=config)
    # if more than 1 tftp server should we start them all?
    # currently starting the 1 being used
    logger.info(f"Starting TFTP server on {tftp_device.name}")
    tftp_device.start_tftp_server()
    devices.board.tftp_device = tftp_device
コード例 #7
0
    def get_cfgs(self, board_config):
        """Try to get the cfg out of the dhcpd.conf for the station in question."""
        try:
            mta_cfg = self.get_attr_from_dhcp("filename", '".*?"', "mta",
                                              board_config.get_station())
            mta_cfg_srv = self.get_attr_from_dhcp("next-server",
                                                  ValidIpv4AddressRegex, "mta",
                                                  board_config.get_station())

            cm_cfg = self.get_attr_from_dhcp("filename", '".*?"', "cm",
                                             board_config.get_station())
            cm_cfg_srv = self.get_attr_from_dhcp("next-server",
                                                 ValidIpv4AddressRegex, "cm",
                                                 board_config.get_station())
            if (mta_cfg is None or mta_cfg_srv is None or cm_cfg is None
                    or cm_cfg_srv is None):
                raise CodeError("One of the Config File is not found")
            return [
                [mta_cfg.replace('"', ""), mta_cfg_srv],
                [cm_cfg.replace('"', ""), cm_cfg_srv],
            ]
        except Exception:
            pass

        return None
コード例 #8
0
    def register(self, wlan_options: dict):
        dev = None

        # try 1: get device via band
        if "band" in wlan_options:
            band = wlan_options["band"]
            if self.__available[band]:
                dev = self.__available[band].pop(0)
                self.__used[band].append(dev)

        # try 2: select first available device from in-built list
        else:
            for dev in self.data:
                if self.is_available(dev):
                    band = dev.band
                    self.__available[band].pop(dev)
                    self.__used[band].append(dev)
                    break

        # if dev is still None, raise CodeError
        if not dev:
            raise CodeError(
                f"No Wi-Fi Device available for below JSON: \n{json.dumps(wlan_options, indent=4)}"
            )

        # WLAN_OPTIONS must specify network type
        nw_bucket = getattr(self, wlan_options["network"].lower())
        nw_bucket.append(dev)

        # set authentication type, by default NONE
        if "authentication" in wlan_options:
            dev.set_authentication(wlan_options["authentication"])
コード例 #9
0
    def __init__(self, *args, **kwargs):
        """Instance initialization."""
        self.args = args
        self.kwargs = kwargs
        self.own_number = self.kwargs.pop("number")
        self.tcid = self.kwargs.pop("tcid")
        self.line = self.kwargs.pop("line")

        # pexpect session handled by a parent method
        self.parse_device_options(*args, **kwargs)
        if "dev_array" not in kwargs:
            self.legacy_add = True
            self.dev_array = "FXS"

        # verify tty lines
        if not self._tty_line_exists():
            raise CodeError("Device does not have a TTY line to speak to!")

        # NOTE: this will go away with custom Dockerfiles for serial phones
        # moving this out from phone_start method.
        self.sendline("pip3 show pyserial")
        self.expect(self.prompt)
        if "Package(s) not found" in self.before:
            self.sendline("pip install pyserial")
            self.expect(self.prompt)
コード例 #10
0
ファイル: docsis.py プロジェクト: lgirdk/boardfarm-docsis
    def reset_defaults_via_console(self):
        if self.env_helper.has_image():
            cm_fm = self.env_helper.get_image(mirror=False)
            if "nosh" in cm_fm.lower():
                raise CodeError(
                    "Failed FactoryReset via CONSOLE on NOSH Image is not possible"
                )

        return self.reset_defaults_via_os()
コード例 #11
0
 def append(self, dev: object):
     # add any new device into respective avaiable bucket
     try:
         band = dev.band
         self.__available[band].append(dev)
         super().append(dev)
     except BaseException as e:
         # this should not happen, only allow Wi-Fi clients to be appended.
         raise CodeError(str(e))
コード例 #12
0
ファイル: orchestration.py プロジェクト: rajjnish/boardfarm
    def __init__(self, ts, exc, *args, **kwargs):
        self.called_with = False
        if not isinstance(exc, Iterable):
            self.exc_list = [exc]
        else:
            self.exc_list = exc
        self.ts = ts
        self.exception = None

        if args:
            if not callable(args[0]):
                raise CodeError("{} is not a function".format(args[0]))
            if not self.called_with:
                self.execute_callable(*args, **kwargs)
            else:
                raise CodeError(
                    "Invalid Syntax - Context Management doesn't work when"
                    " callable-{} is passed as an arg.".format(args[0]))
コード例 #13
0
 def execute(self):
     """Define action execute function calling here and return result."""
     try:
         output = self.action()
         return output
     except Exception as e:
         if e.__class__.__name__ == "AssertionError":
             raise CodeError(e)
         else:
             raise
コード例 #14
0
ファイル: base_cmts.py プロジェクト: lgirdk/boardfarm-docsis
 def is_cm_online(self,
                  ignore_bpi=False,
                  ignore_partial=False,
                  ignore_cpe=False):
     """Returns True if the CM status is operational
     ignore_bpi returns True even when BPI is disabled
     ignore_partial returns True even when the CM is in partial service
     ignore_cpe returns True even when LAN<->WAN forwarding is disabled
     """
     raise CodeError("Not implemented!")
コード例 #15
0
 def _get_current_time(self, fmt="%Y-%m-%dT%H:%M:%S%z"):
     """used for unittests"""
     output = self.check_output("show sys-date")
     # TO DO: get tiem timezone as well
     pattern = r"\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2]\d|3[0-1]) (?:[0-1]\d|2[0-3]):[0-5]\d:[0-5]\d"
     time_now = re.search(pattern, output)
     if time_now:
         return datetime.strptime(time_now.group(0),
                                  "%Y-%m-%d %H:%M:%S").strftime(fmt)
     else:
         raise CodeError("Failed to get CMTS current time")
コード例 #16
0
    def run_traffic_gen(cls, traffic_profile="TCP", duration=10):
        client_args = cls.get_traffic_gen_client()
        client = client_args.device

        server_args = cls.get_traffic_gen_server()
        server = server_args.device
        port = server_args.port

        print("Run Traffic Generation Parameters:\n"
              f"Profile: {traffic_profile}\n"
              f"Server: {server.name}:{port}\n"
              f"Client: {client.name}\n")
        raise CodeError("Not Implemented !!")
コード例 #17
0
    def filter(self, network: str = None, band: float = None):
        """Return list of wlan_devices based on filter."""
        if not network and not band:
            raise CodeError("Invalid filter!!")

        result = []
        if network:
            network_type_bucket = getattr(self, network.lower())
            result.append(network_type_bucket)
        if band:
            result.append(self.__used[band])

        return list(set.intersection(*map(set, result)))
コード例 #18
0
ファイル: base_cmts.py プロジェクト: lgirdk/boardfarm-docsis
    def get_current_time(self, fmt="%Y-%m-%dT%H:%M:%S%z"):
        """Returns the current time on the CMTS
        the derived class only needs to set the "current_time_cmd" and
        "dateformat" strings (both specific to the cmts vendor) amd then call
        super.

        :return: the current time as a string formatted as "YYYY-MM-DD hh:mm:ss"
        :raises ValueError: if the conversion failed for whatever reason
        :raises CodeError: if there is no timestamp
        """
        if not self.current_time_cmd or not self.dateformat:
            raise NotImplementedError

        output = self.check_output(self.current_time_cmd)
        if output != "":
            return datetime.strptime(output, self.dateformat).strftime(fmt)
        else:
            raise CodeError("Failed to get CMTS current time")
コード例 #19
0
    def register(self, wlan_options: dict):
        dev = None

        # try 1: get device via band
        if "band" in wlan_options:
            band = wlan_options["band"]
            if self.__available[band]:
                dev = self.__available[band].pop(0)
                self.__used[band].append(dev)
            # try 2: grab dual-band device if available
            elif self.__available["dual"]:
                dev = self.__available["dual"].pop(0)
                logger.warning(
                    colored(
                        f"{band} GHz single-band device was not found. Registering dual-band {dev.name} as {band} GHz",
                        color="yellow",
                        attrs=["bold"],
                    ))
                self.__used[band].append(dev)

        # try 3: select first available device from in-built list
        else:
            for dev in self.data:
                if self.is_available(dev):
                    band = dev.band
                    self.__available[band].pop(dev)
                    self.__used[band].append(dev)
                    break

        # if dev is still None, raise CodeError
        if not dev:
            raise CodeError(
                f"No Wi-Fi Device available for below JSON: \n{json.dumps(wlan_options, indent=4)}"
            )

        # WLAN_OPTIONS must specify network type
        network_type_bucket = getattr(self, wlan_options["network"].lower())
        network_type_bucket.append(dev)

        # set authentication type, by default NONE
        if "authentication" in wlan_options:
            dev.set_authentication(wlan_options["authentication"])
コード例 #20
0
ファイル: axiros_acs.py プロジェクト: rajjnish/boardfarm
    def _build_input_structs(self, cpeid, param, action):
        """Helper function to create the get structs used in the get/set param values
        NOTE: The command option is set as Syncronous

        :param cpeid: the serial number of the modem through which ACS communication
        happens.
        :type cpeid: string
        :param param: parameter to used
        :type param: string or list of strings for get, dict or list of dict for set
        :param action: one of GPV/SPV (AO/DO-To be implemented)

        :raises: NA
        :returns: param_data, cmd_data, cpeid_data
        """
        if type(param) is not list:
            param = [param]

        if action == 'SPV':
            l = []
            # this is a list of single k,v pairs
            for d in param:
                k = next(iter(d))
                l.append({'key': k, 'value': d[k]})
            p_arr_type = 'ns0:SetParameterValuesParametersClassArray'
            param = l
        elif action == 'GPV':
            p_arr_type = 'ns0:GetParameterValuesParametersClassArray'
        else:
            raise CodeError('Invalid action: ' + action)
        ParValsClassArray_type = self.client.get_type(p_arr_type)
        ParValsParsClassArray_data = ParValsClassArray_type(param)

        CmdOptTypeStruct_data = self._get_cmd_data(
            Sync=True, Lifetime=AxirosACS.CPE_wait_time)

        CPEIdClassStruct_data = self._get_class_data(cpeid=cpeid)

        return ParValsParsClassArray_data,\
            CmdOptTypeStruct_data,\
            CPEIdClassStruct_data
コード例 #21
0
ファイル: orchestration.py プロジェクト: rajjnish/boardfarm
 def __exit__(self, ex_type, ex_value, tb):
     setattr(self.ts, 'add', self.old_add)
     if not self.ts.execute_flag:
         raise CodeError(
             "TestSteps added but not executed. Cannot capture exceptions!!"
         )
     self.called_with = False
     self.ts.execute_flag = False
     for i in self.ts.result:
         if isinstance(i.result, Exception):
             if type(i.result) in self.exc_list:
                 self.exception = i.result
                 break
             else:
                 print(i.result)
                 raise AssertionError(
                     "Expected Exceptions - {} Caught - {}".format(
                         self.exc_list, type(i.result)))
     if not self.exception:
         raise AssertionError(
             "No exception caught!!\nExpected exceptions - {}".format(
                 self.exc_list))
コード例 #22
0
 def __exit__(self, ex_type, ex_value, tb):
     """If test step not able to capture exception and raise the message."""
     self.ts.add = self.old_add
     if not self.ts.execute_flag:
         raise CodeError(
             "TestSteps added but not executed. Cannot capture exceptions!!"
         )
     self.called_with = False
     self.ts.execute_flag = False
     for i in self.ts.result:
         if isinstance(i.result, Exception):
             if type(i.result) in self.exc_list:
                 self.exception = i.result
                 break
             else:
                 logger.debug(i.result)
                 raise AssertionError(
                     "Expected Exceptions - {} Caught - {}".format(
                         self.exc_list, type(i.result)))
     if not self.exception:
         raise AssertionError(
             "No exception caught!!\nExpected exceptions - {}".format(
                 self.exc_list))
コード例 #23
0
 def test_main(self):
     logger.info("This test always fails, but pytest overall does NOT!")
     """We have to use CodeError instead the more appropriate TestError as
     the latter is intercepted by pytest (due to the Test prefix) which
     generates a warning."""
     raise CodeError()
コード例 #24
0
ファイル: orchestration.py プロジェクト: rajjnish/boardfarm
 def execute(self):
     try:
         output = self.action()
         return output
     except AssertionError as e:
         raise CodeError(e)
コード例 #25
0
ファイル: axiros_acs.py プロジェクト: unknown1234/boardfarm-1
    def _build_input_structs(self,
                             cpeid,
                             param,
                             action,
                             next_level=None,
                             **kwargs):
        """Helper function to create the get structs used in the get/set param values

        NOTE: The command option is set as Syncronous
        :param cpeid: the serial number of the modem through which ACS communication
        happens.
        :type cpeid: string
        :param param: parameter to used
        :type param: string or list of strings for get, dict or list of dict for set
        :param action: one of GPV/SPV/GPN/AO/DO/SI/REBOOT/DOWNLOAD
        :type action: string
        :param next_level: defaults to null takes True/False
        :type next_level: boolean
        :raises: NA
        :returns: param_data, cmd_data, cpeid_data
        """
        if action == 'SPV':
            if type(param) is not list:
                param = [param]
            list_kv = []
            # this is a list of single k,v pairs
            for d in param:
                k = next(iter(d))
                list_kv.append({'key': k, 'value': d[k]})
            p_arr_type = 'ns0:SetParameterValuesParametersClassArray'
            ParValsParsClassArray_data = self._get_pars_val_data(
                p_arr_type, list_kv)

        elif action == 'GPV':
            if type(param) is not list:
                param = [param]
            p_arr_type = 'ns0:GetParameterValuesParametersClassArray'
            ParValsParsClassArray_data = self._get_pars_val_data(
                p_arr_type, param)

        elif action == 'SPA':
            if type(param) is not list:
                param = [param]
            list_kv = []
            for d in param:
                k = next(iter(d))
                list_kv.append({
                    'Name':
                    k,
                    'Notification':
                    d[k],
                    'AccessListChange':
                    kwargs.get("access_param", '0'),
                    'AccessList': {
                        'item': 'Subscriber'
                    },
                    'NotificationChange':
                    kwargs.get("notification_param", '1')
                })
            p_arr_type = 'ns0:SetParameterAttributesParametersClassArray'
            ParValsParsClassArray_data = self._get_pars_val_data(
                p_arr_type, list_kv)

        elif action == 'GPN':

            p_arr_type = 'ns0:GetParameterNamesArgumentsStruct'
            ParValsParsClassArray_data = self._get_pars_val_data(
                p_arr_type, NextLevel=next_level, ParameterPath=param)

        elif action == 'GPA':
            if type(param) is not list:
                param = [param]
            p_arr_type = 'ns0:GetParameterAttributesParametersClassArray'
            ParValsParsClassArray_data = self._get_pars_val_data(
                p_arr_type, param)

        elif action == "SI":
            if type(param) is not list:
                param = [param]
            p_arr_type = 'ns0:ScheduleInformArgumentsStruct'
            ParValsParsClassArray_data = self._get_pars_val_data(
                p_arr_type, *param)

        elif action in ['AO', 'DO']:
            p_arr_type = 'ns0:AddDelObjectArgumentsStruct'
            ParValsParsClassArray_data = self._get_pars_val_data(
                p_arr_type, param, '')

        elif action == "REBOOT":
            p_arr_type = 'xsd:string'
            ParValsParsClassArray_data = self._get_pars_val_data(
                p_arr_type, param)

        elif action == "DOWNLOAD":
            p_arr_type = 'ns0:DownloadArgumentsStruct'
            ParValsParsClassArray_data = self._get_pars_val_data(
                p_arr_type, *param)

        else:
            raise CodeError('Invalid action: ' + action)

        CmdOptTypeStruct_data = self._get_cmd_data(
            Sync=True, Lifetime=AxirosACS.CPE_wait_time)

        CPEIdClassStruct_data = self._get_class_data(cpeid=cpeid)

        return ParValsParsClassArray_data,\
            CmdOptTypeStruct_data,\
            CPEIdClassStruct_data
コード例 #26
0
ファイル: docsis.py プロジェクト: lgirdk/boardfarm-docsis
def factoryreset(s, board, method="SNMP"):
    """Reset board to Factory Default

    :param s : object with log_to_file attribute for logging
    :type s : TestStep Obj with attribute log_to_file
    :param board : board DUT device class
    :type board : device_type.DUT
    :param method : ("SNMP", "ACS", "CONSOLE") Default to "SNMP"
    :type method : String value with values("SNMP","ACS","CONSOLE")
    :rtype: Bool
    :raise Assertion: Asserts when FactoryReset failed or arg error
    :return: returns bool True if FactoryReset successful
    """
    logger.debug("=======Begin FactoryReset via {}=======".format(method))

    try:
        wan = board.dev.by_type(device_type.wan)
        wan_ip = board.get_interface_ipaddr(board.wan_iface)

        if method == "SNMP":
            if not hasattr(s, "cm_wan_ip"):
                s.cm_wan_ip = wan_ip

            # TODO Need to remove dependency on self
            board.reset_defaults_via_snmp(s, wan)
            board.reboot_modem_os_via_snmp(s, wan)

        elif method == "ACS":
            try:
                board.dev.acs_server.FactoryReset()
            except Exception as e:
                logger.error(
                    "Failed: FactoryReset through ACS '{}'"
                    "\n Restarting tr069 and retry Factory Reset again..".format(str(e))
                )
                board.restart_tr069(wan, wan_ip)
                board.dev.acs_server.FactoryReset()

        elif method == "CONSOLE":
            if board.env_helper.has_image():
                cm_fm = board.env_helper.get_image(mirror=False)
                if "nosh" in cm_fm.lower():
                    logger.error(
                        "Failed FactoryReset via CONSOLE on NOSH Image is not possible"
                    )
                    raise CodeError(
                        "Failed FactoryReset via CONSOLE on NOSH Image is not possible"
                    )

            # TODO Need to remove dependency on self
            board.reset_defaults_via_os(s)

        else:
            raise Exception(
                """WrongValue: Pass any value ['SNMP', 'ACS', 'CONSOLE'] for method arg"""
            )
        # Verify CM status and board ip address
        assert "INTEGER: 12" == board.get_cmStatus(
            wan, wan_ip, "INTEGER: 12"
        ), "board cmstatus is down"

        board.check_valid_docsis_ip_networking()

        logger.debug("=======End FactoryReset via {}=======".format(method))
        return True

    except Exception as e:
        logger.error(
            "Failed Board FactoryReset using '{}' \n {}".format(method, str(e))
        )
        raise BootFail("Failed Board FactoryReset: {}".format(str(e)))
コード例 #27
0
 def wrapper(*args, **kwargs):
     instance = args[0]
     if hasattr(instance, "py"):
         return func(*args, **kwargs)
     raise CodeError("Function was called without opening python console!")