nanog mailing list archives

Re: A perl script to convert Cisco IOS/Nexus/ASA configurations to HTML for easier comprehension


From: Lee <ler762 () gmail com>
Date: Thu, 6 Oct 2016 17:33:28 -0400

On 10/6/16, Jesse McGraw <jlmcgraw () gmail com> wrote:
Nanog,

     (This is me scratching an itch of my own and hoping that sharing it
might be useful to others on this list.  Apologies if it isn't)

   When I'm trying to comprehend a new or complicated Cisco router,
switch or firewall configuration an old pet-peeve of mine is how
needlessly difficult it is to follow deeply nested logic in route-maps,
ACLs, QoS policy-maps etc etc

To make this a bit simpler I’ve been working on a perl script to convert
these text-based configuration files into HTML with links between the
different elements (e.g. To an access-list from the interface where it’s
applied, from policy-maps to class-maps etc), hopefully making it easier
to to follow the chain of logic via clicking links and using the forward
and back buttons in your browser to go back and forth between command
and referenced list.


I've put the script itself up here
<https://github.com/jlmcgraw/network_configuration_navigator>:
https://github.com/jlmcgraw/network_configuration_navigator

See here
<ttp://htmlpreview.github.com/?https://github.com/jlmcgraw/network_configuration_navigator/blob/master/examples/html_test_case_1.cfg.html>

for output examples
http://htmlpreview.github.com/?https://github.com/jlmcgraw/network_configuration_navigator/blob/master/examples/html_test_case_1.cfg.html

Here's a quick web demo <https://hidden-waters-8218.herokuapp.com/> on
Heroku
https://hidden-waters-8218.herokuapp.com/
     (This is just a simple web front-end to the script.  I'm not a
web-savvy guy so I'm sure it's poorly coded and terribly insecure.
     Please don't upload anything sensitive to this, it's just for
testing!)

I know there is a lot of stuff that could be done better so let me know
if you think of anything new or notice something I’ve done wrong.

One unexpected thing that has come out of this script is the ability to
catch items that are defined but never actually used, whether it's due
to a fat-finger or just being leftover cruft. This has proven very
valuable in catching mistakes that are otherwise hard to spot.
Unfortunately the script can't currently catch the inverse (things that
are called but never defined) due to the way the regexes are constructed

Surely this has all been done before but I couldn't find anything in a
few brief moments of searching so here we are.

dunno about creating web pages, but
https://www.nanog.org/meetings/abstract?id=785
has a section on showing filters that are defined but not referenced &
referenced but not defined

Regards,
Lee


Current thread: