[j-nsp] JUNO OP Script function

Phil Shafer phil at juniper.net
Mon Nov 5 11:01:43 EST 2007


"Chon, Peter" writes:
>OP Script works but  www.stg.brown.edu tell me error (1102): tag uses GI
>for an undeclared element: argument.

Had to see without the whole file.  What version are you running?

The XSL header is:

<?xml version="1.0" standalone="yes"?>
<!-- modification of intf.xsl -->
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:junos="http://xml.juniper.net/junos/*/junos"
  xmlns:xnm="http://xml.juniper.net/xnm/1.1/xnm"
  xmlns:jcs="http://xml.juniper.net/junos/commit-scripts/1.0">

  <xsl:import href="../import/junos.xsl"/>

The arguments declaration is something like:

  <xsl:variable name="arguments">
    <argument>
      <name>interface</name>
      <description>Name of interface to display</description>
    </argument>
  </xsl:variable>

  <xsl:param name="interface"/>

Remember that you need to declare arguments with xsl:param.

If you can use SLAX, your file looks like:

version 1.0;

ns junos = "http://xml.juniper.net/junos/*/junos";
ns xnm = "http://xml.juniper.net/xnm/1.1/xnm";
ns jcs = "http://xml.juniper.net/junos/commit-scripts/1.0";

import "../import/junos.xsl";

var $arguments = {
    <argument> {
        <name> "instance";
        <description> "Instance name";
    }
}

param $instance;
param $mode = "SparseDense";

match / {
    <op-script-results> {
        var $rpc = <get-pim-neighbors-information> {
            <detail>;
            if ($instance) {
                <instance> $instance;
            }
        }
        var $pim = jcs:invoke($rpc);
        <pim-neighbors-information junos:style="detail"> {
            for-each ($pim/pim-interface/pim-neighbor[pim-interface-mode == $mode]) {
                <pim-interface> {
                    <pim-interface-name> ../pim-interface-name;
                    <copy-of .;
                }
            }
        }
    }
}

Untested, but well worth the price ;^)

Thanks,
 Phil


More information about the juniper-nsp mailing list