A simple perl script to convert Cisco IOS configuration to HTML with internal links for easier comprehension
All, (This is me scratching an itch of my own and hoping that it might be useful to others on this list. Apologies if it isn't) When trying to comprehend a new or complicated Cisco router configuration an old pet-peeve of mine is how needlessly difficult it is to search for a list referenced by a command, figure out what it does, then find my way back to the original command (by which time I’ve forgotten the details of the list) and figure out what it's doing with that list. So I’ve been working on a small perl script to add links within IOS configuration files, e.g. link to an access-list from the interface where it’s applied, making it easier to to follow the chain of logic with stuff like route maps or nested service policies via clicking links and using the forward and back buttons in your browser to go back and forth between command and referenced list. I know there is a lot of stuff I could add in to this (e.g. more VRF-related commands, PIX/ASA, Juniper etc). Let me know if you think of anything new or notice something I’ve done wrong , there's plenty of room for improvement and expansion to other configuration formats. Notes: Anything referenced (or potentially referenced) by something else is in bold. It makes it very easy to see where ACLs etc. start and end There's also an option in there to reformat some numbers that are hard to read (e.g. traffic shaping criteria) into more human-readable ones. Pure fluff. Surely this has been done before but I couldn't find anything in a few brief moments of searching so here we are. Files are here: https://github.com/jlmcgraw/networkUtilities At the very least you'll need iosToHtml.pl, pointers.pl, pointees.pl, and human_readable.pl and several CPAN modules (see setup.sh for easy ways to install them under Debian-derived Linux. I haven't tested this at all under Windows or OS X) -Jesse
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Jesse, thats awesome ! thanks for sharing especially when this alligns with what I am currently involved with in the network that I am refurbishing with some high end cisco equipment. Talk about great timing ! Thank you again. s On Aug 6, 2015, at 07:59, Jesse McGraw <jlmcgraw@gmail.com> wrote: All, (This is me scratching an itch of my own and hoping that it might be useful to others on this list. Apologies if it isn't) When trying to comprehend a new or complicated Cisco router configuration an old pet-peeve of mine is how needlessly difficult it is to search for a list referenced by a command, figure out what it does, then find my way back to the original command (by which time I’ve forgotten the details of the list) and figure out what it's doing with that list. So I’ve been working on a small perl script to add links within IOS configuration files, e.g. link to an access-list from the interface where it’s applied, making it easier to to follow the chain of logic with stuff like route maps or nested service policies via clicking links and using the forward and back buttons in your browser to go back and forth between command and referenced list. I know there is a lot of stuff I could add in to this (e.g. more VRF-related commands, PIX/ASA, Juniper etc). Let me know if you think of anything new or notice something I’ve done wrong , there's plenty of room for improvement and expansion to other configuration formats. Notes: Anything referenced (or potentially referenced) by something else is in bold. It makes it very easy to see where ACLs etc. start and end There's also an option in there to reformat some numbers that are hard to read (e.g. traffic shaping criteria) into more human-readable ones. Pure fluff. Surely this has been done before but I couldn't find anything in a few brief moments of searching so here we are. Files are here: https://github.com/jlmcgraw/networkUtilities At the very least you'll need iosToHtml.pl, pointers.pl, pointees.pl, and human_readable.pl and several CPAN modules (see setup.sh for easy ways to install them under Debian-derived Linux. I haven't tested this at all under Windows or OS X) - -Jesse - -- Jason Hellenthal JJH48-ARIN -----BEGIN PGP SIGNATURE----- iQEcBAEBCAAGBQJVw18eAAoJEDLu+wRc4KcIfxcIAKTRy92Uz2QbHOtfW0zaNb2F J7xWFisDmGd4lhoXO6I09u3JLaQS59v48JXAuyawt0k0mEoQ708rIAN6mKaFKZ0i OBGGfbVcP+IzCdbSgBlbkzMk3rnqpUGljmAulwGZQpgbfqzHaT8SoXouuoq06vqF MtsxX0cdbedGCKqORmgJgqvhEFXlcmoOaejHj5wLIsS0yhjZhPyECM2P6Fo3I6jX Iq8Oc1IgIRncNCuCZrUk7x58x5Dtr1GfJZTDmk+O5ixbtuhbUnLJs4rpmf0H4GeL Rj0yrPe4EL3G1aAvInBS+dqiqTUMwt9WPssyGYlEnIUSPmR0Loa6y6bx8Fy1tCU= =ANU6 -----END PGP SIGNATURE-----
Hi, very nice.... but I now have an urge to getting this integrated with RANCID and I just dont have the time, frustrating! ;-) alan
I was going to look at this because it sounded interesting. Maybe some extra things it could do would be to set div/classes in some parts of the config to denote what it is so that the user could apply css to style it. That would allow user-defined color syntax highlighting of a sort. Another nice thing would be collapsible sections so if you're only interested in BGP you can skip interfaces, or if you want to look at route-maps, access-lists, etc. The project looks a bit disorganized, but I only took a quick glance at it so perhaps it does everything exactly as you intend. Are you thinking of making any of it into modules, or defining tests? I like the idea of running this as part of a post-rancid process, but it might also be nice if it was a module that could be run in real-time on a config. Then I could have a mojo wrapper daemon that called it when users accessed /configs/*-confg, or whatever and returned the parsed version. Anyway, I don't want to create any more work for you, I just wanted to kick out some ideas. If I have time I will contribute what I can, but I'm already neck deep in some random projects. I don't mind starting another one, but I don't want to say I'm doing something and then never deliver. :)
CSS? Tests? Ha ha ha ha ha This is quick and dirty. That being said, I'd love to see some tests for it, more advanced HTML output, and also make it a module suitable for using as the back-end of a web page. I just wanted to get something basic working for my original purposes. As for disorganized: what you're seeing in that repository is a bunch of separate small utilities, it's not all for this one script. This particular script was split out into 4 separate files so the regexes are separate from the actual code, otherwise it was a bit too much. Check it out on your configs and let me know what you think -Jesse On 08/07/2015 12:15 PM, Robert Drake wrote:
All, I've started adding the ability to link between files (e.g. BGP neighbor statements, assuming you have both configuration files) I'd be very interested to hear anyone's feedback if they've gotten the script to work or have some ideas for improvements like Robert suggested Thanks, -Jesse On 08/06/2015 08:59 AM, Jesse McGraw wrote:
participants (4)
-
A.L.M.Buxey@lboro.ac.uk
-
Jason Hellenthal
-
Jesse McGraw
-
Robert Drake