[j-nsp] Simple Script Running

Ebben Aries earies at juniper.net
Thu Feb 3 14:57:49 EST 2011


That is because you are most likely attempting to <output> your 
rpc-reply directly causing the cli formatting to only display the raw 
xml leaf nodes.

If you are looking to just output commands as normal cli rendered 
output, you will want to copy your rpc-reply directly to the result-tree 
using "copy-of".  This will pass back the entire XML rpc output to the 
cli for proper formatting.

ie.

match / {
<op-script-results> {
         var $conn = jcs:open();

         var $rpc-users = <get-system-users-information>;
         var $output-users = jcs:execute($conn, $rpc-users);

<output> "##################################################";
<output> "(show system users)";
<output> "##################################################";
         copy-of $output-users;

         var $rpc-bgp-summary = <get-bgp-summary-information>;
         var $output-bgp-summary = jcs:execute($conn, $rpc-bgp-summary);

<output> "##################################################";
<output> "(show bgp summary)";
<output> "##################################################";
         copy-of $output-bgp-summary;

         var $rpc-chassis-re = <get-route-engine-information>;
         var $output-chassis-re = jcs:execute($conn, $rpc-chassis-re);

<output> "##################################################";
<output> "(show chassis routing-engine)";
<output> "##################################################";
         copy-of $output-chassis-re;


         expr jcs:close($conn);
     }
}

/ebben

On 02/03/2011 07:59 AM, ben b wrote:
> All,
>
> I'm trying to get a feel for op scripts in JUNOS and I can invoke commands,
> but I'm not seeing the output I thought I'd see (it looks like raw data).
>
> What I'd like to do is run a list of show commands with a script alias.
>
> Could someone point me in the right direction to be able to run like 5
> 'show' commands (with normal output) in a row with one simple command like
> 'op status'
>
>
> Thanks in advance,
> Ben
> _______________________________________________
> juniper-nsp mailing list juniper-nsp at puck.nether.net
> https://puck.nether.net/mailman/listinfo/juniper-nsp


More information about the juniper-nsp mailing list