5.7. _exec_device module

class capture_it._exec_device.Execute_Device(ip, auth, cmds, path, cumulative, forced_login, parsed_output, visual_progress, logger, CustomClass, fg)

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.

  • 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.

  • visual_progress (int) – scale 0 to 10. 0 being no output, 10 all.

  • logger (list) – device logging messages list

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

  • fg (bool) – facts generation

add_cmds_to_self(cmds)

add additional commands to cmds list

Parameters:

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

check_facts_finder_requirements(c)

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

check_ping(ip)

check device reachability

Parameters:

ip (str) – device ip

Returns:

delay factor if device reachable, else False

Return type:

int

command_capture(c)

start command captures on connection object

Parameters:

c (conn) – connection object

execute(ip)

login to given device(ip) using authentication parameters from uservar (u). if success start command captuers

Parameters:

ip (str) – device ip

get_device_type(ip)

detect device type (cisco, juniper)

Parameters:

ip (str) – device ip

Returns:

device type if detected, else None

Return type:

str

is_any_ff_cmds_missed(c)

checks and returns missed mandatory capture commands

Parameters:

c (conn) – connection object

Returns:

missed mandatory commands

Return type:

set

is_connected(c, ip)

check if connection is successful

Parameters:
  • c (conn) – connection object

  • ip (str) – ip address of connection

Returns:

connection object if successful, otherwise None

Return type:

conn

missed_commands_capture(c, cc, missed_cmds, x='')

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

retry_missed_cmds(c, cc, missed_cmds)

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