3.8. execution of a device module

class nettoolkit.capture_it.exec_device.Execute_Device(ip: str, auth: dict, cmds: list, capture_path: str, cumulative: bool, forced_login: bool, parsed_output: bool, standard_output: bool, CustomClass: Any, fg: bool, mandatory_cmds_retries: int, append_capture: bool, missing_captures_only: bool)[source]

Bases: object

Execute a device capture

Parameters:
  • ip (str) – device ip

  • auth (dict) – authentication parameters

  • cmds (list, set, tuple) – set of commands to be executed.

  • capture_path (str) – path where output to be stored

  • cumulative (bool, optional) – True,False,both. Defaults to False.

  • forced_login (bool) – True will try login even if device ping fails.

  • parsed_output (bool) – parse output and generate Excel or not.

  • CustomClass (class) – Custom class definition to provide additinal custom variable commands

  • fg (bool) – facts generation

  • mandatory_cmds_retries (int) – number of retries for missing mandatory commands captures

  • append_capture (bool) – append capture to existing file instead of creating new.

  • missing_captures_only (bool) – capture only missing command outputs from existing output

CustomClass: Any
add_cmd_exec_logs(cc)[source]
add_cmd_to_all_cmd_dict(cmds)[source]

add command to all cmd dictionary

Parameters:

cmds (str, list, tuple, set, dict) – commands in any format

add_cmds_to_self(cmds)[source]

add additional commands to cmds list

Parameters:

cmds (list) – list of additinal or missed mandatory cmds to be captured

add_exec_logs(cc)[source]
append_capture: bool
auth: dict
capture_path: str
check_facts_finder_requirements(c)[source]

checks and returns missed mandatory capture commands clone to is_any_ff_cmds_missed

Parameters:

c (conn) – connection object

Returns:

missed mandatory commands

Return type:

set

cmds: list
command_capture(c)[source]

start command captures on connection object

Parameters:

c (conn) – connection object

cumulative: bool
fg: bool
forced_login: bool
get_max_cmd_length(c, cmds)[source]

returns the length of longest command

Parameters:
  • c (conn) – connection object

  • cmds (str,iterable) – commands list

get_missing_commands(c, cmds, purpose)[source]

checks and returns missed capture commands

Parameters:
  • c (conn) – connection object

  • cmds (list) – list of commands to check

Returns:

missed mandatory commands

Return type:

set

ip: str
is_any_ff_cmds_missed(c)[source]

checks and returns missed mandatory capture commands

Parameters:

c (conn) – connection object

Returns:

missed mandatory commands

Return type:

set

mandatory_cmds_retries: int
missed_commands_capture(c, cc, missed_cmds, x='')[source]

recaptures missed commands

Parameters:
  • c (conn) – connection object

  • cc (Captures) – Capture / Command line processing object

  • missed_cmds (set) – list/set of commands for which output to be recapture

  • x (int, optional) – iteration value

missing_captures_only: bool
parsed_output: bool
retry_missed_cmds(c, cc, missed_cmds)[source]

retry missed commands captures

Parameters:
  • c (conn) – connection object instance

  • cc (Captures) – Capture / Command line processing object

  • missed_cmds (set) – missed commands

Returns:

No retuns

Return type:

None

run_cmds(c)[source]
run_custom_commands(c, cc)[source]
run_facts_generation_required_commands(c, cc)[source]
standard_output: bool
update_cmds_for_missing_captures_only(c)[source]
update_obj_properties(c)[source]
verify_connection(c, ip)[source]
write_facts_to_excel(cc)[source]