eos_poller
eos_poller.py
Uses asyncio.to_thread and gather functions to poll multiple switches concurrently
Functions
|
Run synchronously; provide entry-point for module; manage the asyncio eventloop; |
|
Connect to switches and get the data that we want from them. Use asyncio |
|
Connect to a switch and gets the data that we want from it |
Module Contents
- eos_poller.invoker(switchlist_in, uname_in, passwd_in, runtype_in)[source]
Run synchronously; provide entry-point for module; manage the asyncio eventloop; invoke async/threaded functions to do the real work.
- Parameters:
switchlist_in (list) – List of Arista switches to be interrogated
uname_in (str) – The username credential for authenticating to the switch
passwd_in (str) – The password credential for authenticating to the switch
runtype_in (str)
- Returns:
svsout (list) – Values of the switch that we’re interested in
lldpsout (list) – List of connections inferred from LLDP tables on the switches
cfgsout (list) –
- List-of-lists holding all of the switch’s configurations
’all_configs_out[0]’ is the configuration of the first item in switchlist ‘all_configs_out[0][0] is the 1st line of the 1st switch’s configuration
- Return type:
tuple[list, list, list]
- async eos_poller.main(switchlist_in2, uname_in2, passwd_in2, runtype_in2)[source]
Connect to switches and get the data that we want from them. Use asyncio to_thread function to enable concurrent processing of multiple switches.
- Parameters:
switchlist_in2 (list) – List of Arista switches to be interrogated
uname_in2 (str) – The username credential for authenticating to the switch
passw_in2 (str) – The password credential for authenticating to the switch
passwd_in2 (str)
runtype_in2 (str)
- Returns:
sw_vals_out2 (list) – Values of the switch that we’re interested in
lldpngbrs_out2 (list) – List of connections inferred from LLDP tables on the switches
all_configs_out2 (list) –
- List-of-lists holding all of the switch’s configurations
’all_configs_out2[0]’ is the configuration of the first item in switchlist ‘all_configs_out2[0][0] is the 1st line of the 1st switch’s configuration
- Return type:
tuple[list, list, list]
- eos_poller.get_sw_data(switch3, uname_in3, passwd_in3, sw_cntr3_in)[source]
Connect to a switch and gets the data that we want from it
- Parameters:
switch3 (str) – The network switch to be interrogated
uname_in3 (str) – The username credential for authenticating to the switch
passwd_in3 (str) – The password credential for authenticating to the switch
sw_cntr3_in (int)
- Returns:
this_sw_vals (list) – Values of the switch that we’re interested in
this_sw_lldp_nbrs (list) – The switch’s LLDP neighbors table (local/remote device-name and port-I)
this_sw_cfg (list) – The switch’s startup configuration
- Return type:
tuple[list, list, list]