Set of tools to convert raw CLI output from Cisco devices to human readable Excel spreadsheets.
Parse raw CLI output from network devices to structured JSON, using the NTC-Templates library.
Convert JSON files to Excel spreadsheets.
Relies on the two aforementionned scripts to convert CLI output directly to Excel.
Parses a group of text files into a single Excel spreadsheet (works best for a single command output from all devices)
$ pip3 install -t requirements.txt
If you need to write custom parsing templates, you can also fork the ntc-templates repository from Github and install the module from there:
$ git clone https://github.com/networktocode/ntc-templates.git
$ pip install -e ntc-templates/[dev]
$ python cli2xls.py --infile network-device_show-cdp-nei.txt --outfile NetworkDevice.xlsx
Use --help
to display usage and options.
- '-' can be used in place of the filename to read from STDIN
- If no
--outfile
is specified, the script will create a new file based on thedevice_name
, or simply print to STDOUT - If no parser is specified, the parser/template will be infered from the filename using Regexes
- If the Excel file/workbook exists, the new spreadsheet will be added at the end, if not a new Excel file will be created
- The title of the new spreadsheet is the name of the parser/template
--verbose
prints some additional information to STDERR
To process batches of files, use something like:
$ find ./*.txt -exec sh -c "python cli2xls.py --infile {}" \;
Copyright (C) 2020 David Paneels
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.