[j-nsp] junoscripts output format question

Phil Shafer phil at juniper.net
Wed Oct 21 13:48:59 EDT 2009


>I have a problem with output xml from op script.
>If I output configuration from op script as xml, I see it if use
>"| display xml" but see nothing if no pipe.
>Where am I wrong?

The JUNOS UI consists of two parts, the CLI and MGD.  In general,
the CLI handles rendering XML content into text, but rendering
configuration is an exception.

For configuration, MGD writes the config in text form for the CLI
unless the "display xml" pipe is given.  Formatting is done as the
data is pulled from the database (where is it not stored in XML).

So the CLI has no clue how to render config XML into text.

You should be able to use the 'format="text"' attribute on
the <get-configuration> RPC to get the real text data, if
that's what you want.

Or you can put lib-util.slax on your box, import it, and
then use the "jcs:dump" template to dump XML content
(in slax-ish syntax) if that's what you want:

http://junoscriptorium.googlecode.com/svn/trunk/library/juniper/import/lib/lib-util/lib-util.slax

    call jcs:dump($name = "title", $out = $my-xml);

Thanks,
 Phil


More information about the juniper-nsp mailing list