[j-nsp] TEXT->XML, XML examples?
Hannes Gredler
hannes at juniper.net
Mon Nov 6 10:51:39 EST 2006
Pekka Savola wrote:
> Hi,
>
> I'm looking for an example (perl?) script that takes a text JunOS
> config and 1) spits it out in XML, and 2) parses the XML for further
> processing. I've done quite a bit of looking around, but haven't
> found one yet. The examples in 'junoscript-perl-6.4I0' may be able to
> do 2), but I didn't see them do 1).
>
> As a bonus, I'd also like simple examples of scripts that perform some
> configuration checks something like the commit scripts but offline,
> based on text configs. In the past I've done this using grep, perl
> and friends w/ the text config, but using XML natively might be the
> way to go if doing so is simple enough...
>
> Pointers welcome.
>
pekka,
this may be a non-trivial exercise, given that there are meanwhile
app. 4100 JUNOS keywords (as per release 8.1).
--
i don't know what is the problem that you want to solve, but i'd rather start
with XML native configs than going down the hassle of re-engineering the
corresponding XML tags sourced from flat files.
(hint: if you have tons of (perhaps archived) configs then you could
'load override XXX.txt those text config files into a lab router and
write the XML'ized config using 'show | display xml | save YYY.xml')
/hannes
More information about the juniper-nsp
mailing list