本文整理汇总了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 )
示例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
示例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
示例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"
)
示例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
示例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)
示例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)
示例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)
示例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)
示例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)