[169528] in North American Network Operators' Group
Re: Managing IOS Configuration Snippets
daemon@ATHENA.MIT.EDU (Dale W. Carder)
Fri Feb 28 21:22:52 2014
Date: Fri, 28 Feb 2014 20:19:40 -0600
From: "Dale W. Carder" <dwcarder@wisc.edu>
To: Ryan Shea <ryanshea@google.com>
In-reply-to: <CAGWL9Q31uBVVk57pn6Xmg9K-b_zFPX1N+KBCAzCV9VhQ7mMcQQ@mail.gmail.com>
Cc: nanog list <nanog@nanog.org>
Errors-To: nanog-bounces+nanog.discuss=bloom-picayune.mit.edu@nanog.org
Thus spake Ryan Shea (ryanshea@google.com) on Thu, Feb 27, 2014 at 09:38:33AM -0500:
>
> Now, I hand you the 'show run' output and ask you if version 77 of the vty
> config is on this device. Can you answer the question? Now I hand you the
> 'show run' from 10,000 more device configs - and 100 more configuration
> chunks from revision control. Can you still answer the question? Assume a
> magical revision-history-aware configuration cross reference parser (while
> a noble and lovely goal) is not available.
Hi Ryan,
If I'm understanding what you're trying to do, you could script around
our rather unsophisticated 'sgrep' (stanza grep) tool combined with
scripting around rancid & rcs to do what I think you are looking for.
http://net.doit.wisc.edu/~dwcarder/scripts/sgrep
sgrep can dump out a "stanza" of ios-like config, then you can rcsdiff
that to your master, per 'chunk' of config.
ex:
> sgrep -s "vty" r-cssc-b280c-1-core.conf
Found stanza in r-cssc-b280c-1-core.conf size:9
line vty 0 4
access-class G-A-AdminAccess in
exec-timeout 30 0
ipv6 access-class G-A-v6AdminAccess in
line vty 5 24
access-class G-A-AdminAccess in
exec-timeout 30 0
ipv6 access-class G-A-v6AdminAccess in
!
See the -s and -e options for our sgrep.
Add 'xargs -P' around your glue, and I think you'd be in luck. If you
were building configs around this model, you could use m4.
Dale