- Update of libraries:
sshtunnel==0.4.0
netmiko==4.5.0
pandas>=1.5.2,<=2.0.3
pyyaml==6.0.2
python-docx==0.8.11
- The following functions have be cleaned-up/reordered:
fncWriteToConnection(self, inText, connInfo)
: this function now applies try/except per each sent command to the router. If ok, among others, returnsSendingOk
._getData(inText,connInfo)
: if it receives aSendingOk
, breaks.fncSshServer(self, connInfo, sftp=False)
: better code, avoiding unnecesary try/excepts.routerLogin(self, connInfo)
: better code, avoiding unnecesary try/excepts. Also, if a router cannot be logged-in, returnsCannotLog
(before it would returnLoggedOk
even if it was not true).routerRunRoutine(self, connInfo)
: an unused paramaterrunStatus
has been removed
- Getting the Python version, operating system and the library versions. Saving to
00_reports.json
file - Update
README.md
- Create img/ and uploading images for
README.md
- Updating License
- The HwType is now added to the json file per router as a new key.
- Update of libraries:
pandas >= 1.5.2,<=2.0.3
netmiko == 4.3.0
- The Timos version is now added to the json file per router as a new key.
- The default hostname is now
NA_#
, where # is the threadnumber. This changes if the hostname is detected later on.
- Update to have taskAutom support access to SRLinux devices. A new device type
nokia_srl
has been included under theDICT_VENDOR
general dictionary. - Netmiko, by default, disables pagination either by using
environment no more
orenvironment more false
. TheFIRST_LINE=""
from now on for device typenokia_sros
.- The device_type
md_nokia_sros
has been removed from the-dt
option.
- The device_type
00_report.json
now includes timing information.
- The function
fncPrintResults()
now created a new data file,00_faildeDataFile
, which is a subset of the original data file. Thisincludes only the devices which have presented errors during exectuion.ssh-tunnels. - The function
checkCredentials()
has been refactored to better guide users when dealing with jobTypes.
- The method
fncSshServer()
has been refactored. Better detection of problematic connections over ssh-tunnels.
- The method
fncUploadFile()
decides between SCP or SFTP depending on the Timos version. If taskAutom cannot detect the Timos version, SCP will be selected. - The method
fncUploadFile()
will assumecf3:/
for the remote file, if no CF is specified in theftpRemoteFilename
.
- The method
routerRunRoutine()
will search for the string#FINSCRIPT
after checking for correctness of execution (ie,majorFailed
). If further the execution is incomplete, then the total result will be, following the example, labeled asmajorFailed:Incomplete
.
- The profile for the device type
nokia_sros
andnokia_sros_telnet
include now as a last line, aFIN_SCRIPT
string#FINSCRIPT
. The idea is that the methodrouterRunRoutine()
will check for that string. If not detected, taskAutom will assume that the execution of the script is incomplete, either because the command was not correctly sent over to the router; or because the output received from the router was cut somehow.
- Using latest version of netmiko, 4.2.0
- Update of the method
routerLogin()
, to use the new method from netmiko,ConnLogOnly()
. IfsshDebug
is True, then a debug file will be created underlogsDirectory
with per-thread information.
- Update function
renderCliLine()
- The global dictionary
dictParam
has been updated with new default keywords. - New function
buildScripts(dictParam)
, which can be used when importing taskAutom:from src.taskAutom import taskAutom as ta
.dictParam['pluginFilename'] = 'myPlugin.py'
dictParam['dataFile'] = 'myData.xlsx'
dictParam['xlsSheetName'] = 'tabName'
d = ta.buildScripts(dictParam)
- This will allow to use the same plugins and data files when using taskAutom at the console, but within a python code.
- Parameter
-j/--jobType
is now 0 by default. - Parameter
-pt/--pluginType
is nowshow
by default. - The json report file now includes the version of taskAutom.
- Better inventory file checkinng.
- The class
myConnection
now receives fewer arguments, namely dictonariesrouterInfo
anddictParam
.routerInfo
holds all the necesary arguments to establish the connection towards the router, ie, username and password. But also, now, thepluginScript
which is the script to be executed on the router.dictParam
holds all the global parameters such as log folder name, logTime, dataFileName, pluginName, sshServers, etc.- This change follows this idea: even if an inventory is defined, the
pluginScript
is created before being sent over to the class by the combination of thedataFilename
and thepluginFilename
. The idea here is that in the near future, the inventory could establish per-router plugins and/or data files. So in one run of taskAutom, different routers will be executing different scripts.
- The method
fncUploadFile()
has been modified so that jobTypes 2 and 3 have better control over the sent files via SCP/SFTP. - The method
logData()
is better now. Log data is a pandas DataFrame being built from a dictionary, which varies depending on the jobType. The functionfncPrintResults()
now performs apd.concat(LOG_GLOBAL)
. - The function
getListOfRouters()
no longer provides, only, a list of routers, but also a list of dictionaries which conform the real inventory. Thekey
in that dictionary is the IP of each and every router with a predefined set of subkeys: username, password, deviceType, useSSHTunnel, readtimeout, jumphost and systemIP.- If the the jobType is 2, an extra subkey
pluginScript
will be added. If jobType 3, a list of tuples with[(locaFile,remoteFile)]
will be added. These are the files to be uploaded via SCP/SFTP. - If there is an external inventroy file, ie
-inv inv.csv
, thedictParam['inventory']
will be updated with the information contained insideinv.csv
.
- If the the jobType is 2, an extra subkey
- The function
verifyInventory()
has been modified to return a dictionary which is compatible with the one required by the functiongetListOfRouters()
. - New global dictionary
DICT_PARAM
which can be used when using taskAutom as an import inside a python code. - Basic MD-CLI support under Nokia, when using
deviceType = md_nokia_sros
.
- Better inventory file checking.
- The regex for timos and hostname have been changed
- New paramter to control log file names
-fn/--logFileName
. - Retrieving aux values now tries
auxRetry
times.
- Variables obtained through
argparse
are set toTrue/False
depending on the input beingyes/no
. So now the treatment is hanlde as a boolen when needed. - New functionality to bulk updload files through SCP/SFTP.
- For this a new
dataFile
structure is needed with the following minimum columns:ip|ftpLocalFilename|ftpRemoteFilename
.
- For this a new
- Code reordering.
- CRON config update.
- CRON config now applies different configuration if
timosMajor
> 8.
- Better detection of individual connections' status, for logging purposes.
-tbr/--timeBetweenRouters
now in milliseconds.- tweaking the number of threads and the time between routers, will allow to maximize the number of connections, specially when using at jump-server.
- Better support for CRON, either
oneshot
orperiodic
.
- Better help description when invoking the
-h
paramter on the CLI.
- the functions
fncConnectToRouter()
,routerRunRoutine()
,routerLogin()
andfncSshServer()
, now returnconnInfo
instead of separate variables - the variables
controlPlaneAccess
andaluLogged
are now booleans with default False - the variables
sshServer
andconn2rtr
default toNone
and only change if the connections come up.
- new parameter
hwType
obtained fromshow chassis
- the
hostname
is no longer obtained fromfind_prompt()
but fromshow chassis
.
- update
- update
- New function
getDictParam()
that returns thedictParam
dictionary with all the required parameters for the connections. - The function
fncRun()
returns the updated version ofdictParam
.
- When the execution is finished, a
json
version of the configuration parameters oftaskAutom
is saved under the folder-l/--logInfo
.
- Update of libraries:
python-docx==0.8.11
pandas==1.5.2
.openpyxl==3.0.10
xlrd
removed
- When using
strictOrder=no
the default value is passing data row by row to the plugin. The data is filtered by thegroupColumn
parameter. When using the parameterpbr/passByRow=no
the complete Excel tab is passed over to the plugin. Once in the plugin, the data can be analyzed by Pandas methoditerutples()
. - Update of libraries:
python-docx==0.8.11
pandas
.scp
removed becase installed by netmikoparamiko
removed becase installed by netmiko
- New parameter
-pf/passwordFile
. This allows to store the password in a local file sotaskAutom
will read the password from it. This allows to usetaskAutom
from the crontab.- Becareful: the password is stored in plain text format.
- From this version on,
taskAutom
needs to be installed by usingpip
, ie,pip install taskAutom
.
- Change of
START_SCRIPT
andEND_SCRIPT
defined inDICT_VENDOR
fornokia_sros
andnokia_sros_telnet
. - In function
routerRunRoutine()
no more looking for stringEND_SCRIPT
. - New parameter
timeBetweenRouters
. A delay in seconds to wait before executing scripts on a router. Works both for threaded connections or with strict order. - In function
fncSshServer()
better handling of connection errors with sshtunnel.
- Change of
START_SCRIPT
andEND_SCRIPT
defined inDICT_VENDOR
fornokia_sros
andnokia_sros_telnet
.
- Upgrade of
netmiko
library to version 4.1.0delayFactor
andmaxLoops
are no longer used;- New parameter
readTimeOut
is used insted. In seconds, sets the amount of timetaskAutom
waits for output from router. Default to 10 seconds. - This change also affects the building of the inventory file, if used.
- Upgrade of
paramiko
library to version 2.11.0 - Upgrade of
pandas
library to version 1.4.1 - Better detection of ssh-tunnels under the function
fncSshServer()
. - Final report shows times in minutes if greater than 120s.
- In the definition of the dictionary
DICT_VENDOR
- the
expect_string
was changed tor'#\s$'
. - the start and end scripts are now
"echo SCRIPT_NONO_START\n"
and"echo SCRIPT_NONO_FIN\n"
.
- the
- The output in json format now includes a new key, with the IP of the router.
- Data file and Plugin can now reside on a different folder other than the root of taskAutom.
- When using option
-pt show
ajson
file is created where output is stored. Eachshow
command is used as a key inside the json file. This will help for output checking.
- Comments in the code
- Show CRON, inventory only if configured.
- Remove parameter
clientType
in favor ofdeviceType
.- Using Netmiko's
nokia_sros_telnet
as device type when a Telnet Connection is needed. If ssh, usenokia_sros
.
- Using Netmiko's
- Rename parameter
sshMaxLoops
in favor ofmaxLoops
. - Remove paramter
telnetTimeout
.- all timinig is now controlled by
delayFactor
and/ormaxLoops
.
- all timinig is now controlled by
- Function
connectToRouter()
is simpler now:- New function
routerLogin()
which direclty callsConnectHandler()
with the appropiatedeviceType
. - Functions
routerLoginSSH()
androuterLoginTelnet()
no longer needed.
- New function
- Function
fncWriteToConnection()
is simpler now as the connection handler is always Netmiko'sConnectHandler()
. - Function
fncAuxGetVal()
is simpler now. - Function
routerLogout()
no longer needed. - PluginType is now a mandatory parameter and no longer optional.
- If
cron
is enabled, thenstrictOrder=no
andpluginType=config
. - Function
fncSshServer(self, strConn, connInfo, sftp=False)
now has an sftp parameter which becomes True when invoked from withinfncUploadFile()
. - Function
runCron()
updated so that all commands are compatible with Nokia's echo (and as such detectable by Netmiko'scmd_verify
).
- In function
renderCliLine()
bug corrected whenlen(aluCliLine)=0
.
- In function
renderCliLine()
better error message when the plugin cannot be rendered correctly with data.
00_log.cvs
report includes now the Timos of the device.fncWriteToConnection()
implements now a set oftry|expect
for every possible writing option and returnsrunStatus,logReason,output
. This will allow for every method in the class to write appropriately and hence detect if something happened.- Both functions
routerRunRoutine()
andfncAuxGetVal()
use now the new version offncWriteToConnection()
which detectes better connection problems when writing. This will also help in detecting nodes with connection problems and log them into00_log.csv
- In the function
fncConnectToRouter()
the logins either using SSH or Telnet, have been changed to better detect login problems. This will be notified underaluLogReason
. - In
fncPrintResults()
, accomodate results better when printing the table. - Added
openpyxl==3.0.6
andxlrd==2.0.1
torequirements.txt
.
- If detection of
hostname
fails, append number of connection to avoid mixing logs in the same log filenot-matched_rx.txt
.
- Name of
ip
column customizable on datafile.
- Length of Data now as input parameter inside plugin.
- Better error detection.
- New option
sshDebug
- Info Error Detection
SEND_CMD_REGEX = "#"
for show commands.- Excel format supported.
- Default is still
csv
.
- Default is still
- Header supported in input data;
- If header is to be used, there must be a column called
ip
for the IP addresses of the routers. - If header is not used, then the first column of the data file will be assumed to hold the IP addresses of the routers (default behavior).
- If header is to be used, there must be a column called
- New option
cmdVerify
with defaultyes
.- This is enabled by default and should be used, especially, whenever dealing with config-like commands. See here
- Inside
fncWriteToConnection(self, inText, connInfo)
distinguish betweenshow
andconfig
commands so as to usesend_command()
orsend_config_set()
respetively.- This will help in the future to obatin show output data as JSON format.
- New parameter
pluginType
, eithershow
orconfig
according Netmiko's documentation- Default set to
config
.
- Default set to
- New parameter
max_loops
: in conjuntion withdelay_factor
andpluginType
helps in obtaining long output data.- Default set to
5000
. timeOut = max_loops * 0.2 * delay_factor
. See this for explanation.
- Default set to
- Using
connInfo
as input paramter for all the internal methods of the connect class. - Inside
routerLoginSsh()
usingfast_cli=False
inside the connection handler. - Change of default cient type to
ssh
.
logData
- time was being reported as string; now as float.
logData
- Better handling of logData.
- Better support for vendors other than Nokia (nokia_sros)
Inventory File
- Posibility of implementing per router connection parameters.
- If inventory file is being used, default connection values overridden by those in the inventory file.
- If a router exists in data CSV, but not in the inventory file, default values are used.
Implement strict Order
- Implement the StrictOrder possibility, following the order of lines inside the CSV;
- Implement the HaltOnError possibility, only available if StrictOrder enabled. If result is neither
SendSuccess
norReadTimeout
, then halts. - Function
renderCliLine
. - Use of
dictParam
as dictionary to pass parameters over functions
Improvement on connection handling
- SSHTunnelForwarder
allow_agent = False
- Generation of MOP now based on new CLI parameter
-gm
- Better handling of connection states based on Exceptions in function
routerRunRoutine()
- New versions in
requirements.txt
- Function
verifyConfigFile()
to check for scpecial chars in config file.