当前位置: 首页>>代码示例>>Python>>正文


Python LoggerSetup.get_log_deep方法代码示例

本文整理汇总了Python中log.loggersetup.LoggerSetup.get_log_deep方法的典型用法代码示例。如果您正苦于以下问题:Python LoggerSetup.get_log_deep方法的具体用法?Python LoggerSetup.get_log_deep怎么用?Python LoggerSetup.get_log_deep使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在log.loggersetup.LoggerSetup的用法示例。


在下文中一共展示了LoggerSetup.get_log_deep方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: import_firmwares

# 需要导入模块: from log.loggersetup import LoggerSetup [as 别名]
# 或者: from log.loggersetup.LoggerSetup import get_log_deep [as 别名]
    def import_firmwares(self, release_model: str):
        """
        Imports the stored Firmwares, so the firmware_handler can use them.
        :param release_model: stable, beta, experimental
        """
        path = FIRMWARE_PATH + '/' + release_model + '/' + self.UPDATE_TYPE + '/'
        logging.debug("%sImport Firmwares from '" + path + "'", LoggerSetup.get_log_deep(2))
        count = 0

        try:
            files = os.listdir(path)
        except Exception:
            logging.debug("%sNo Firmwares available for import at path '" + path + "'", LoggerSetup.get_log_deep(3))
            return

        for firmware_name in files:
            try:
                freifunk_verein = firmware_name.split('-')[1]
                firmware_version = firmware_name.split('-')[2]
                file = path + firmware_name
                url = self.url + '/' + release_model + '/' + self.UPDATE_TYPE + '/' + firmware_name
                self.firmwares.append(Firmware(firmware_name, firmware_version, freifunk_verein,
                                               release_model, file, url))
                count += 1
            except Exception:
                logging.warning("%s[-] Couldn't import " + firmware_name, LoggerSetup.get_log_deep(3))
                continue
        logging.debug("%s" + str(count) + " Firmwares imported", LoggerSetup.get_log_deep(3))
开发者ID:haggi,项目名称:TestFramework,代码行数:30,代码来源:firmware_handler.py

示例2: run

# 需要导入模块: from log.loggersetup import LoggerSetup [as 别名]
# 或者: from log.loggersetup.LoggerSetup import get_log_deep [as 别名]
    def run(self):
        """
        Runs new thread and gets the information from the Router via ssh.
        """
        logging.info("%sUpdate the Infos of the Router(" + str(self.router.id) + ") ...", LoggerSetup.get_log_deep(1))
        try:
            self.network_ctrl.connect_with_remote_system()

            # Model
            self.router.model = self._get_router_model()
            # MAC
            self.router.mac = self._get_router_mac()
            # NetworkInterfaces
            self.router.network_interfaces = self._get_router_network_interfaces()
            # CPUProcesses
            self.router.cpu_processes = self._get_router_cpu_process()
            # RAM
            self.router.ram = self._get_router_mem_ram()
            # Sockets
            self.router.sockets = self._get_router_sockets()
            # UCI
            self.router.uci = self._get_router_uci()
            # Bat Originators
            self.router.bat_originators = self._get_bat_originator()
            logging.info("%s[+] Infos updated", LoggerSetup.get_log_deep(2))
        except Exception as e:
            logging.error("%s[-] Couldn't update all Infos", LoggerSetup.get_log_deep(2))
            logging.error(str(e))
            for tb in traceback.format_tb(sys.exc_info()[2]):
                logging.error("%s" + tb, LoggerSetup.get_log_deep(3))
        finally:
            self.network_ctrl.exit()
开发者ID:PumucklOnTheAir,项目名称:TestFramework,代码行数:34,代码来源:router_info.py

示例3: delete_interface

# 需要导入模块: from log.loggersetup import LoggerSetup [as 别名]
# 或者: from log.loggersetup.LoggerSetup import get_log_deep [as 别名]
    def delete_interface(self, close_ipdb: bool = False):
        """
        Removes the virtual interface.

        :param close_ipdb: If also the IPDB should be closed
        """
        logging.debug("%sDelete VLAN Interface ...", LoggerSetup.get_log_deep(2))
        try:
            self.ipdb.interfaces[self.vlan_iface_name].remove().commit()
            if close_ipdb:
                self.ipdb.release()
            logging.debug(
                "%s[+] Interface(" + self.vlan_iface_name + ") successfully deleted", LoggerSetup.get_log_deep(3)
            )
        except KeyError:
            logging.debug(
                "%s[+] Interface(" + self.vlan_iface_name + ") is already deleted", LoggerSetup.get_log_deep(3)
            )
            return
        except Exception as e:
            logging.error(
                "%s[-] Interface(" + self.vlan_iface_name + ") couldn't be deleted. Try 'ip link delete <vlan_name>'",
                LoggerSetup.get_log_deep(3),
            )
            logging.error("%s" + str(e), LoggerSetup.get_log_deep(3))
开发者ID:PumucklOnTheAir,项目名称:TestFramework,代码行数:27,代码来源:vlan.py

示例4: create_interface

# 需要导入模块: from log.loggersetup import LoggerSetup [as 别名]
# 或者: from log.loggersetup.LoggerSetup import get_log_deep [as 别名]
    def create_interface(self):
        """
         Creates a virtual interface on a existing interface (like eth0)
        """
        logging.debug("%sCreate VLAN Interface ...", LoggerSetup.get_log_deep(2))
        try:
            # Get the real link interface
            link_iface = self.ipdb.interfaces[self.link_iface_name]

            # Create a Vlan
            iface = self.ipdb.create(kind="vlan", ifname=self.vlan_iface_name, link=link_iface,
                                     vlan_id=self.vlan_iface_id).commit()
            # Try to assign an IP via dhclient
            # IP 169.254.235.157/16 is returned when static is expected
            if (not self._wait_for_ip_assignment()) or (self.ipdb_get_ip("169.254.235.157") == ""):
                # Otherwise add a static IP
                iface.add_ip(self._get_matching_ip(str(self.remote_system.ip)), self.remote_system.ip_mask).commit()
            iface.mtu = 1400

            logging.debug("%s[+] " + self.vlan_iface_name + " created with: Link=" + self.link_iface_name +
                          ", VLAN_ID=" + str(self.vlan_iface_id) + ", IP=" + self.ipdb_get_ip(),
                          LoggerSetup.get_log_deep(3))
        except Exception as e:
            logging.debug("%s[-] " + self.vlan_iface_name + " couldn't be created", LoggerSetup.get_log_deep(3))
            logging.error("%s" + str(e), LoggerSetup.get_log_deep(3))
开发者ID:haggi,项目名称:TestFramework,代码行数:27,代码来源:vlan.py

示例5: test_meshing

# 需要导入模块: from log.loggersetup import LoggerSetup [as 别名]
# 或者: from log.loggersetup.LoggerSetup import get_log_deep [as 别名]
    def test_meshing(self):
        """
        Test:
            1. Router is in normal-mode
            2. Mesh-connections exist
            3. All known Routers that are in normal-mode are connected with the tested Router
        """
        logging.debug("%sTest: Correctness of the Mesh-Connections", LoggerSetup.get_log_deep(1))
        assert self.remote_system.mode == Mode.normal
        logging.debug("%s[" + u"\u2714" + "] Correct Mode", LoggerSetup.get_log_deep(2))
        bat_originators = self.remote_system.bat_originators
        self.assertTrue(len(bat_originators) > 0, "No connected Mesh-Nodes exist")
        logging.debug("%s[" + u"\u2714" + "] Connected Mesh-Nodes exist", LoggerSetup.get_log_deep(2))

        my_bat__originators = self.remote_system.bat_originators
        my_bat__originators_macs = [originator.mac for originator in my_bat__originators]

        for router in self.all_routers:
            if router.id == self.remote_system.id or router.mode == Mode.configuration:
                continue
            known_router_mac = router.network_interfaces["mesh0"].mac
            cnt = my_bat__originators_macs.count(known_router_mac)
            self.assertTrue(cnt >= 1, "Not connected with  known Router(" + str(router.id) + ")")
            logging.debug("%s[" + u"\u2713" + "] Connected with known Router(" + str(router.id) + ")",
                          LoggerSetup.get_log_deep(2))
开发者ID:PumucklOnTheAir,项目名称:TestFramework,代码行数:27,代码来源:test_N_correct_mesh_connections.py

示例6: run

# 需要导入模块: from log.loggersetup import LoggerSetup [as 别名]
# 或者: from log.loggersetup.LoggerSetup import get_log_deep [as 别名]
 def run(self):
     """
     Copies the firmware image onto the Router, proves if the firmware is in the right file(/tmp/<firmware_name>.bin)
     and does a Sysupgrade.
     :return:
     """
     network_ctrl = NetworkCtrl(self.router)
     try:
         network_ctrl.connect_with_remote_system()
     except Exception as e:
         logging.warning("[-] Couldn't sysupgrade the Router(" + str(self.router.id) + ")")
         logging.warning(str(e))
         return
     network_ctrl.remote_system_wget(self.router.firmware.file, '/tmp/', self.web_server_ip)
     # sysupgrade -n <firmware_name> // -n verwirft die letzte firmware
     arg = '-n' if self.n else ''
     if not self.debug:
         logging.debug("sysupgrade ...")
         try:
             network_ctrl.send_command('sysupgrade ' + arg + ' ' + '/tmp/' + self.router.firmware.name)
         except TimeoutError:
             logging.info("%s[+] Router was set into normal mode", LoggerSetup.get_log_deep(2))
             self.router.mode = Mode.configuration
             if Dhclient.update_ip(self.router.vlan_iface_name) == 1:
                 self.router.mode = Mode.unknown
                 logging.error("%s[-] Something went wrong. Use command 'online -r " + str(self.router.id) + "'",
                               LoggerSetup.get_log_deep(2))
         except Exception as e:
             self.router.mode = Mode.unknown
             logging.error("[-] Something went wrong. Use command 'online -r " + str(self.router.id) + "'")
             logging.error(str(e))
     network_ctrl.exit()
开发者ID:haggi,项目名称:TestFramework,代码行数:34,代码来源:router_flash_firmware.py

示例7: _wait_for_job_done

# 需要导入模块: from log.loggersetup import LoggerSetup [as 别名]
# 或者: from log.loggersetup.LoggerSetup import get_log_deep [as 别名]
    def _wait_for_job_done(cls, job: RemoteSystemJob, remote_sys: RemoteSystem, done_event: DoneEvent) -> None:
        """
        Wait 2 minutes until the job is done.
        Handles the result from the job with the job.prepare(data) method.
        Triggers the next job/test.

        :param job: job to execute
        :param remote_sys: the RemoteSystem
        :param done_event: event which will be triggered when the task is finished
        """
        async_result = cls._task_pool.apply_async(func=cls._execute_job, args=(job, remote_sys, cls._routers))
        try:
            result = async_result.get(120)  # wait 2 minutes or raise an TimeoutError
            logging.debug("%sJob done " + str(job), LoggerSetup.get_log_deep(1))
            logging.debug("%sAt Router(" + str(remote_sys.id) + ")", LoggerSetup.get_log_deep(2))
            job.post_process(result, cls)

        except Exception as e:
                logging.error("%sTask raised an exception: " + str(e), LoggerSetup.get_log_deep(1))
                cls._task_errors.append((remote_sys.id, sys.exc_info()))
        finally:
            cls.set_running_task(remote_sys, None)
            # start next test in the queue
            done_event.set()
            cls.__start_task(remote_sys, None)
开发者ID:PumucklOnTheAir,项目名称:TestFramework,代码行数:27,代码来源:server.py

示例8: _wca_setup_wizard

# 需要导入模块: from log.loggersetup import LoggerSetup [as 别名]
# 或者: from log.loggersetup.LoggerSetup import get_log_deep [as 别名]
    def _wca_setup_wizard(self, config):
        """
        Starts the WebConfigurationAssist and
        sets the values provided by the wizard-mode (in the WebConfiguration).

        :param config: {node_name, mesh_vpn, limit_bandwidth, show_location, latitude, longitude, altitude, contact,...}
        """
        try:
            # remote_sytem has to be a router object
            wca = WebConfigurationAssist(config, self.router)
            wca.setup_wizard()
            wca.exit()
        except Exception as e:
            logging.error("%s" + str(e), LoggerSetup.get_log_deep(2))
            raise e
        # The Router should reboot
        logging.info("%sWait until Router rebooted (90sec) ...", LoggerSetup.get_log_deep(2))
        time.sleep(90)

        try:
            Dhclient.update_ip(self.router.vlan_iface_name)
            self._success_handling()
        except FileExistsError:
            self._success_handling()
        except Exception:
            self._exception_handling()
开发者ID:PumucklOnTheAir,项目名称:TestFramework,代码行数:28,代码来源:router_setup_web_configuration.py

示例9: _execute_test

# 需要导入模块: from log.loggersetup import LoggerSetup [as 别名]
# 或者: from log.loggersetup.LoggerSetup import get_log_deep [as 别名]
    def _execute_test(cls, test: FirmwareTestClass, router: Router, routers: List[Router]) -> TestResult:
        if not isinstance(router, Router):
            raise ValueError("Chosen Router is not a real Router...")
        # proofed: this method runs in other process as the server
        setproctitle(str(router.id) + " - " + str(test))
        logging.debug("%sExecute test " + str(test) + " on Router(" + str(router.id) + ")", LoggerSetup.get_log_deep(2))

        test_suite = defaultTestLoader.loadTestsFromTestCase(test)

        # prepare all test cases
        for test_case in test_suite:
            logging.debug("%sTestCase " + str(test_case), LoggerSetup.get_log_deep(4))
            test_case.prepare(router, routers)

        result = TestResult()

        cls.__setns(router)
        try:

            result = test_suite.run(result)
        except Exception as e:
            logging.error("%sTestCase execution raised an exception", LoggerSetup.get_log_deep(3))
            logging.error("%s" + str(e), LoggerSetup.get_log_deep(3))

            test_obj = test()
            result.addError(test_obj, sys.exc_info())  # add the reason of the exception
        finally:

            # I'm sry for this dirty hack, but if you don't do this you get an
            # "TypeError: cannot serialize '_io.TextIOWrapper' object" because sys.stdout is not serializeable...
            result._original_stdout = None
            result._original_stderr = None

            logging.debug("%sResult from test " + str(result), LoggerSetup.get_log_deep(3))
            return result
开发者ID:PumucklOnTheAir,项目名称:TestFramework,代码行数:37,代码来源:server.py

示例10: run

# 需要导入模块: from log.loggersetup import LoggerSetup [as 别名]
# 或者: from log.loggersetup.LoggerSetup import get_log_deep [as 别名]
 def run(self):
     """
     Copies the firmware image onto the Router, proves if the firmware is in the right file(/tmp/<firmware_name>.bin)
     and does a Sysupgrade.
     """
     network_ctrl = NetworkCtrl(self.router)
     try:
         network_ctrl.connect_with_remote_system()
     except Exception as e:
         logging.warning("%s[-] Couldn't sysupgrade the Router(" + str(self.router.id) + ")",
                         LoggerSetup.get_log_deep(2))
         logging.warning(str(e))
         return
     network_ctrl.remote_system_wget(self.router.firmware.file, '/tmp/', self.web_server_ip)
     # sysupgrade -n <firmware_name> // -n verwirft die letzte firmware
     arg = '-n' if self.n else ''
     if not self.debug:
         logging.debug("%sSysupgrade (this will force a TimeoutError)...", LoggerSetup.get_log_deep(2))
         try:
             network_ctrl.send_command('sysupgrade ' + arg + ' ' + '/tmp/' + self.router.firmware.name)
         except TimeoutError:
             try:
                 Dhclient.update_ip(self.router.vlan_iface_name)
                 self._success_handling()
             except FileExistsError:
                 self._success_handling()
                 pass
             except Exception:
                 self._execption_hanling()
         except Exception:
             self._execption_hanling()
     network_ctrl.exit()
开发者ID:PumucklOnTheAir,项目名称:TestFramework,代码行数:34,代码来源:router_flash_firmware.py

示例11: send_data

# 需要导入模块: from log.loggersetup import LoggerSetup [as 别名]
# 或者: from log.loggersetup.LoggerSetup import get_log_deep [as 别名]
    def send_data(self, local_file: str, remote_file: str):
        """
        Sends Data via sftp to the RemoteSystem

        :param local_file: Path to the local file
        :param remote_file: Path on the Router, where the file should be saved
        """
        try:
            # TODO: If sftp is installed on the Router
            '''
            sftp = self.ssh.open_sftp()
            sftp.put(local_file, remote_file)
            sftp.close()
            '''
            command = 'sshpass  -p' + str(self.remote_system.usr_password) + ' scp ' + local_file + ' ' + \
                      str(self.remote_system.usr_name) + '@' + str(self.remote_system.ip) + ':' + remote_file
            os.system(command)

            # TODO: Paramiko_scp have to installed
            '''
            scp = SCPClient(self.ssh.get_transport())
            scp.put(local_file, remote_file)
            '''
            logging.debug("%s[+] Sent data '" + local_file + "' to RemoteSystem '" +
                          str(self.remote_system.usr_name) + "@" + str(self.remote_system.ip) +
                          ":" + remote_file + "'", LoggerSetup.get_log_deep(2))
        except Exception as e:
            logging.error("%s[-] Couldn't send '" + local_file + "' to RemoteSystem '" +
                          str(self.remote_system.usr_name) + "@" + str(self.remote_system.ip) + ":" + remote_file + "'",
                          LoggerSetup.get_log_deep(2))
            logging.error("%s" + str(e), LoggerSetup.get_log_deep(2))
开发者ID:haggi,项目名称:TestFramework,代码行数:33,代码来源:network_ctrl.py

示例12: join

# 需要导入模块: from log.loggersetup import LoggerSetup [as 别名]
# 或者: from log.loggersetup.LoggerSetup import get_log_deep [as 别名]
 def join(self):
     logging.info("%sStop WebServer ...", LoggerSetup.get_log_deep(1))
     time.sleep(2)
     try:
         self.httpd.shutdown()
         logging.debug("%s[+] WebServer successfully stoped", LoggerSetup.get_log_deep(2))
     except Exception as e:
         logging.debug("%s[-] WebServer couldn't stoped", LoggerSetup.get_log_deep(2))
         logging.error("%s" + str(e), LoggerSetup.get_log_deep(1))
开发者ID:haggi,项目名称:TestFramework,代码行数:11,代码来源:webserver.py

示例13: _success_handling

# 需要导入模块: from log.loggersetup import LoggerSetup [as 别名]
# 或者: from log.loggersetup.LoggerSetup import get_log_deep [as 别名]
 def _success_handling(self):
     """
     Sets the Router in config-mode.
     """
     if self.n:
         logging.info("%s[+]Router was set into config mode", LoggerSetup.get_log_deep(2))
         self.router.mode = Mode.configuration
     else:
         logging.info("%s[+]Router was set into normal mode", LoggerSetup.get_log_deep(2))
         self.router.mode = Mode.normal
开发者ID:PumucklOnTheAir,项目名称:TestFramework,代码行数:12,代码来源:router_flash_firmware.py

示例14: test_meshing

# 需要导入模块: from log.loggersetup import LoggerSetup [as 别名]
# 或者: from log.loggersetup.LoggerSetup import get_log_deep [as 别名]
 def test_meshing(self):
     """
     Test:
         1. Router is in normal-mode
         2. Mesh-connections exist
     """
     logging.debug("%sTest: Existence of Mesh-Connections", LoggerSetup.get_log_deep(1))
     assert self.remote_system.mode == Mode.normal
     logging.debug("%s[" + u"\u2714" + "] Correct Mode", LoggerSetup.get_log_deep(2))
     bat_originators = self.remote_system.bat_originators
     self.assertTrue(len(bat_originators) > 0, "No connected Mesh-Nodes exist")
     logging.debug("%s[" + u"\u2714" + "] Connected Mesh-Nodes exist", LoggerSetup.get_log_deep(2))
开发者ID:PumucklOnTheAir,项目名称:TestFramework,代码行数:14,代码来源:test_N_mesh_connections.py

示例15: run

# 需要导入模块: from log.loggersetup import LoggerSetup [as 别名]
# 或者: from log.loggersetup.LoggerSetup import get_log_deep [as 别名]
 def run(self):
     """
     Uses the Dhlcient to get an IP from a given Router and tries to connect to.
     """
     logging.info("%sCheck if Router is online ...", LoggerSetup.get_log_deep(1))
     try:
         Dhclient.update_ip(self.router.vlan_iface_name)
         self._test_connection()
     except FileExistsError:
         self._test_connection()
     except Exception:
         logging.debug("%s[*] Try again in a minute", LoggerSetup.get_log_deep(2))
     return
开发者ID:PumucklOnTheAir,项目名称:TestFramework,代码行数:15,代码来源:router_online.py


注:本文中的log.loggersetup.LoggerSetup.get_log_deep方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。