6.1. configuration on device(s) module
- class nettoolkit.configure.configure.ConfigEnvironmentals(auth, log_folder, config_log, exec_log, exec_display)[source]
Bases:
Multi_ExecutionConfiguration Object environmental properties. Inherits Multi_Execution
- class nettoolkit.configure.configure.Config_common[source]
Bases:
objectCommon Methods and properties for Configuration classes
- get_device_type(ip, auth)[source]
detecting device type (cisco, juniper)
- Parameters:
ip (str) – device ip
auth (dict) – authentication dicationary with ‘un’, ‘pw’. ‘en’ keys.
- Returns:
device type if detected, else None
- Return type:
str
- send_configuration(conf_list)[source]
sends provided list of configuration to self device connection
- Parameters:
conf_list (list) – configuration change list
- Returns:
success/fail
- Return type:
bool
- class nettoolkit.configure.configure.Configure(ip, auth, conf_list=None, conf_file=None, log_folder=None, config_log=True, exec_log=True, exec_display=True)[source]
Bases:
Config_commonConfigure class to do configuration on a Cisco IOS or Juniper Junos device Inherits Config_common
- Parameters:
ip (str) – device ip address or FQDN
auth (dict) – authentication dicationary with ‘un’, ‘pw’. ‘en’ keys.
conf_list (list, optional) – configuration change list. Defaults to None. Either
conf_file (str, optional) – configuration change file. Defaults to None. Or
log_folder (str, optional) – folder where logs to be stored. Defaults to None.
config_log (bool, optional) – generate configuration log. Defaults to True.
exec_log (bool, optional) – generate execution log. Defaults to True.
exec_display (bool, optional) – on screen display execution log. Defaults to True.
- cisco_push()[source]
method defining configuration push for Cisco devices
- Returns:
False if unable to connect, None after connection terminate
- Return type:
bool/None
- cisco_verify_push_op(op)[source]
verifications on cisco configuration push output
- Parameters:
op (multiline str) – configuaration log output
- Returns:
success or syntex error
- Return type:
bool
- juniper_commit()[source]
commiting the pushed juniper configurations.
- Returns:
success or fail
- Return type:
bool
- juniper_push()[source]
method defining configuration push for Juniper devices
- Returns:
False if unable to connect, None after connection terminate
- Return type:
bool/None
- class nettoolkit.configure.configure.ConfigureByExcel(auth, files=[], tab_sort_order=[], log_folder=None, config_log=True, exec_log=True, exec_display=True, configure=False, sleep_time_between_group=0)[source]
Bases:
ConfigEnvironmentalsclass to do configuration based on configuration changes provided in excel. All listed devices in a single Excel tab will be executed at once (simultaneously). Multiple Excel tabs/files can be provided to execute those in sequence.
Inherits ConfigEnvironmentals
- Parameters:
auth (dict) – authentication dicationary with ‘un’, ‘pw’. ‘en’ keys.
files (list, optional) – list of excel files, will be executed in provided sequence. Defaults to [].
tab_sort_order (list, optional) – Excel tabs execution order. Defaults to []. ( options: privide in list manually, ascending, reversed)
log_folder (str, optional) – folder where logs to be stored. Defaults to None.
config_log (bool, optional) – generate configuration log. Defaults to True.
exec_log (bool, optional) – generate execution log. Defaults to True.
exec_display (bool, optional) – on screen display execution log. Defaults to True.
configure (bool, optional) – configure or it is for test only. Defaults to False.
sleep_time_between_group (int, optional) – sleep time between execution of two groups of executions. Defaults to 0.
- run(**kwargs)
- class nettoolkit.configure.configure.GroupsConfigure(auth, devices_config_dict={}, config_by_order=True, order_list=[], dev_apply_at_dict={}, log_folder=None, config_log=True, exec_log=True, exec_display=True, configure=False)[source]
Bases:
Multi_ExecutionConfigure class to do configuration on a multiple group of devices at a time. Inherits Multi_Execution
- Parameters:
auth (dict) – authentication dicationary with ‘un’, ‘pw’. ‘en’ keys.
devices_config_dict (dict, optional) – {device:[list of config], } . Defaults to {}.
config_by_order (bool, optional) – if True follows execution in provided order_list entries. Defaults to True.
order_list (list, optional) – order list in which execution to be done. Defaults to [].
dev_apply_at_dict (dict, optional) – time to apply config at (under implementation). Defaults to {}.
log_folder (str, optional) – folder where logs to be stored. Defaults to None.
config_log (bool, optional) – generate configuration log. Defaults to True.
exec_log (bool, optional) – generate execution log. Defaults to True.
exec_display (bool, optional) – on screen display execution log. Defaults to True.
configure (bool, optional) – configure or it is for test only. Defaults to False.
- configure_by_orderlist(**kwargs)