5.9. _cap_summary module
- class capture_it._cap_summary.LogSummary(c, print=False, write_to=None, append_to=None)
Bases:
object
class generating summary report for the commands log/raw capture
- Parameters:
c (conn) – connection object
print (bool, optional) – display result summary on screen. Defaults to False.
write_to (str, optional) – filename, writes result summary to file. Defaults to None(i.e. off).
- add_trailing_space_to_cmd()
adds trailing spaces to commands to make all same length. stores them in new trailing_cmd_dict dictionary
- add_trailing_space_to_host_result()
adds trailing spaces to host results to make all same length. stores them in new trailing_host_dict dictionary
- concate_cmd_host_data()
concatenates comands and hosts data to generate string summary
- Returns:
summary report in text format
- Return type:
str
- convert_device_type_wise_hosts()
distribute hosts as per device type i.e. cisco_ios, juniper_junos etc.. and stores them in a new dictionary dev_type_hn_dict dictionary.
- Returns:
device type wise dictionary {device_type: [hosts,]}
- Return type:
dict
- get_all_raw_logs()
get raw logs for all devices
- Returns:
dictionary of {device_hostname: raw_log_entries}
- Return type:
dict
- get_ip(hostname, d)
returns ip address of asked hostname from provided dictionary d
- Parameters:
hostname (str) – hostname of device
d (dict) – dictionary of all raw logs
- Returns:
ip address for given hostname
- Return type:
str
- get_max_cmd_length(cmd_list)
returns maximum command length from provided cmd_list
- Parameters:
cmd_list (list) – list of commands
- Returns:
length of maximum length command
- Return type:
int
- get_raw_log(host_cmd_exec_log, cmd)
get raw log of given command from provided host command execution log list.
- Parameters:
host_cmd_exec_log (list) – command execution log list of a host
cmd (str) – command for which raw log requires to be returned
- Returns:
returns success if raw log was successful else failed. returns undefined if undetected or else.
- Return type:
str
- get_raw_logs(hostname)
get all commands raw logs for given device(hostname)
- Parameters:
hostname (str) – hostname for which raw logs to be retuned
- Returns:
list of raw log entries
- Return type:
list
- print()
prints report summary on screen
- set_cmd_listd_dict(c)
set command list dictionary for all commands executed for a given connection
- Parameters:
c (conn) – connection object
- property summary
report summary
- Returns:
Multiline report summary
- Return type:
str
- write(file, wa='w')
writes result summary to file
- Parameters:
file (str) – filename to write to output result summary