當前位置: 首頁>>代碼示例>>Python>>正文


Python CShowParser.CShowParser類代碼示例

本文整理匯總了Python中CShowParser.CShowParser的典型用法代碼示例。如果您正苦於以下問題:Python CShowParser類的具體用法?Python CShowParser怎麽用?Python CShowParser使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了CShowParser類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get_drop_stats

    def get_drop_stats (self):

        response    = self.cmd_link.run_single_command('show platform hardware qfp active interface all statistics', flush_first = True)
        # print response
        # response    = self.cmd_link.run_single_command('show platform hardware qfp active interface all statistics')
        # print response
        if_list_by_name = [x.get_name() for x in self.if_mngr.get_if_list()]
        return CShowParser.parse_drop_stats(response, if_list_by_name )
開發者ID:cisco-system-traffic-generator,項目名稱:trex-core,代碼行數:8,代碼來源:CPlatform.py

示例2: get_running_image_details

    def get_running_image_details (self):
        """ get_running_image_details() -> dict

        Check for the currently running image file on the platform.
        Returns a dictionary, where 'drive' key is the drive in which the image is installed,
        and 'image' key is the actual image file used.
        """
        response = self.cmd_link.run_single_command('show version | include System image')
        parsed_info = CShowParser.parse_show_image_version(response)
        self.running_image = parsed_info
        return parsed_info
開發者ID:cisco-system-traffic-generator,項目名稱:trex-core,代碼行數:11,代碼來源:CPlatform.py

示例3: get_nbar_stats

 def get_nbar_stats(self):
     per_intf_stats = {}
     for intf in self.if_mngr.get_if_list(if_type=IFType.Client):
         response = self.cmd_link.run_single_command(
             "show ip nbar protocol-discovery interface {interface} stats packet-count protocol".format(
                 interface=intf.get_name()
             ),
             flush_first=True,
         )
         per_intf_stats[intf.get_name()] = CShowParser.parse_nbar_stats(response)
     return per_intf_stats
開發者ID:chetangaonker,項目名稱:trex-core,代碼行數:11,代碼來源:CPlatform.py

示例4: load_platform_image

    def load_platform_image(self, img_filename, external_tftp_config=None):
        """ load_platform_image(self, img_filename, external_tftp_config) -> None

        Parameters
        ----------
        external_tftp_config : dict
            A path to external tftp config file other than using the one defined in the instance.
        img_filename : str
            image name to be saved into the platforms drive.

        This method loads the configured image into the platform's harddisk (unless it is already loaded),
        and sets that image to be the boot_image of the platform.
        """
        if not self.check_image_existence(img_filename):  # check if this image isn't already saved in platform
            # tmp_tftp_config = external_tftp_config if external_tftp_config is not None else self.tftp_cfg

            if self.config_history["tftp_server_config"]:  # make sure a TFTP configuration has been loaded
                cache = CCommandCache()
                if self.running_image is None:
                    self.get_running_image_details()

                command = "copy tftp://{tftp_ip}/{img_path}/{image} harddisk:".format(
                    tftp_ip=self.tftp_cfg["ip_address"], img_path=self.tftp_cfg["images_path"], image=img_filename
                )
                cache.add("EXEC", [command, "\r", "\r"])

                progress_thread = CProgressDisp.ProgressThread(
                    notifyMessage="Copying image via tftp, this may take a while...\n"
                )
                progress_thread.start()

                response = self.cmd_link.run_single_command(cache, timeout=900, read_until=["\?", "\#"])
                print("RESPONSE:")
                print(response)
                progress_thread.join()
                copy_ok = CShowParser.parse_file_copy(response)

                if not copy_ok:
                    raise UserWarning(
                        "Image file loading failed. Please make sure the accessed image exists and has read privileges"
                    )
            else:
                raise UserWarning(
                    "TFTP configuration is not available. Please make sure a valid TFTP configuration has been provided"
                )
開發者ID:chetangaonker,項目名稱:trex-core,代碼行數:45,代碼來源:CPlatform.py

示例5: check_image_existence

    def check_image_existence (self, img_name):
        """ check_image_existence(self, img_name) -> boolean

        Parameters
        ----------
        img_name : str
            a string represents the image name.

        Check if the image file defined in the platform_config already loaded into the platform.
        """
        search_drives = ['bootflash', 'harddisk', self.running_image['drive']]
        for search_drive in search_drives:
            command = "dir {drive}: | include {image}".format(drive = search_drive, image = img_name)
            response = self.cmd_link.run_single_command(command, timeout = 10)
            if CShowParser.parse_image_existence(response, img_name):
                self.needed_image_path = '%s:/%s' % (search_drive, img_name)
                print('Found image in platform:', self.needed_image_path)
                return True
        return False
開發者ID:cisco-system-traffic-generator,項目名稱:trex-core,代碼行數:19,代碼來源:CPlatform.py

示例6: get_cvla_memory_usage

 def get_cvla_memory_usage(self):
     response    = self.cmd_link.run_single_command('show platform hardware qfp active infrastructure cvla client handles')
     # (res, res2) = CShowParser.parse_cvla_memory_usage(response)
     return CShowParser.parse_cvla_memory_usage(response)
開發者ID:cisco-system-traffic-generator,項目名稱:trex-core,代碼行數:4,代碼來源:CPlatform.py

示例7: get_nat_stats

 def get_nat_stats (self):
     response    = self.cmd_link.run_single_command('show ip nat statistics')
     return CShowParser.parse_nat_stats(response)
開發者ID:cisco-system-traffic-generator,項目名稱:trex-core,代碼行數:3,代碼來源:CPlatform.py

示例8: get_nbar_profiling_stats

 def get_nbar_profiling_stats (self):
     response = self.cmd_link.run_single_command("show platform hardware qfp active feature nbar profiling")
     return CShowParser.parse_nbar_profiling_stats(response)
開發者ID:cisco-system-traffic-generator,項目名稱:trex-core,代碼行數:3,代碼來源:CPlatform.py

示例9: get_cft_stats

 def get_cft_stats (self):
     response    = self.cmd_link.run_single_command('test platform hardware qfp active infrastructure cft datapath function cft-cpp-show-all-instances')
     return CShowParser.parse_cft_stats(response)
開發者ID:cisco-system-traffic-generator,項目名稱:trex-core,代碼行數:3,代碼來源:CPlatform.py

示例10: get_cpu_util

 def get_cpu_util (self):
     response    = self.cmd_link.run_single_command('show platform hardware qfp active datapath utilization | inc Load')
     return CShowParser.parse_cpu_util_stats(response)
開發者ID:cisco-system-traffic-generator,項目名稱:trex-core,代碼行數:3,代碼來源:CPlatform.py


注:本文中的CShowParser.CShowParser類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。