[AusNOG] Wiki for network ops

Andrew Fort afort at choqolat.org
Mon Oct 10 04:34:06 EST 2011


On Sun, Oct 9, 2011 at 1:13 AM, Ben Buxton <bb.ausnog at bb.cactii.net> wrote:
>
> +1 here for the Notch architecture. Really simplifies network
> automation....although..
>
> On Sat, Oct 8, 2011 at 4:23 AM, Andrew Fort <afort at choqolat.org> wrote:
>>
>> http://code.google.com/p/netmunge/ to have Mr. CLI parse the router
>> output into structured data)
>>
>
> I'll put a plug in for http://code.google.com/p/textfsm for parsing router
> output. It was written at and used within
> Google and has really simple regex based templates, so you dont have to
> spend all your coding time
> writing complex logic to parse stuff. This just works.
> Ben

I agree; TextFSM is really a neat library, and I encourage everyone to
check it out.

If someone would like support for it in Mr. CLI, I'd be happy to
accept such a merge. To plug it in, one would need to write a module
which mapped the vendor name and command entered (from Mr. CLI) to the
TextFSM parser template.  If you use the same API netmunge does (see
http://code.google.com/p/netmunge/source/browse/netmunge/__init__.py),
it'll plug right in.

Netmunge is more "raw" in that you're not hidden from the fact you're
writing Yapps2 parser definitions. That said, it didn't take me longer
to write netmunge parsers than it did TextFSM ones. It's true that the
edge cases require writing helper methods, and the inline emit style
takes getting used to. Sometimes this freedom can be useful, say for
converting MAC address text formats as I do in the cisco_show_arp
grammar.

As a comparison, here's a similar type of output parser definition
from each library.  TextFSM is simpler and more consistent.  The
netmunge one is heavy:

textfsm:
http://code.google.com/p/textfsm/source/browse/trunk/examples/juniper_version_template

netmunge:
http://code.google.com/p/netmunge/source/browse/netmunge/grammars/source/netscreen_get_system.g

My only reason for not using TextFSM is my dislike of Google's
Contributor License Agreement. (to wit: "please sign here to
contribute open source code" ;-). So I couldn't give my contributions
back to TextFSM users in a way that agreed with me. I suspect we all
lose in this case :/.  A final irony: Yapps2, the parser used by
netmunge, was written by a Googler.

-a



More information about the AusNOG mailing list