TLDR: This repo will help you to make use of syntax highlighting on Live Network devices. (Juniper/Cisco/Arista)
If you have ever used the CLI on network devices, you probably have ended up frustrated trying to make sense of the long lines of configuration. Although nowadays the use of editors like vim/Sublime/Vscode/Atom
can provide some really useful syntax highlighting, you still can find yourself struggling to read the config files or outputs while you are on live devices.
Here we have a Juniper SRX firewall policy. This rule is comprised by source/destination/application/actions
, if you need to read one of them it's alright but if your output has you reading over 10 rules you can see how difficult is to differentiate each component.
Wouldn't be nice to have some live syntax highlight to differentiate each component and quickly find what you are looking for? Something like...
If you are like me, fascinated by the concept of marginal gains, this guide will help you to work more efficiently in the CLI.
The purpose of this repo is to give you an idea of the power of having syntax highlighting while working on live devices. This is not by any means a full-blown syntax highlighting solution but a way to show you how you can take advantage of it and adapt it to your needs.
Note: The default color code has been tested using a Dark terminal Background as you can see in the images above
Reading Firewall Rules (JunOS)
Reading show ip bgp summary (Cisco / Arista)
Reading show interfaces (Cisco / Arista / JunOS)
Reading route-maps (Cisco / Arista)
Reading Prefix lists (Cisco / Arista)
Quicker troubleshooting as you can easily identify missconfigurations or issues like interfaces down.
Color codes can be totally customised to your liking. To see the available HTML color codes go HERE
Regex can be adapted to your particular Network OS (NOS) and version.
git clone git@github.com:danielmacuare/netcli-highlight.git
cd netcli-highlight/
pip3 install chromaterm
cp .chromaterm.yml ~/.chromaterm.yml
echo 'ssh() { /usr/bin/ssh "$@" | ct; }' >> ~/.bash_profile
echo 'ssh() { /usr/bin/ssh "$@" | ct; }' >> ~/.zshrc
cat tests/arista_pref_list.txt | ct
Juniper|Arista|Cisco
via ssh and issue a show interfaces
chromaterm
config file options go HEREThanks to hSaria for creating Chromaterm which is used as a based for this tool.