Thomas Eichhorn writes: >Is there any possibility to get only one specific entry or must I filter >within my application? This is quite unperformant, because some of the >ARP-tables >on my router are VERY big...
Most of the pipe operations are not available in the API, since they are implemented in the CLI (the terminal-handling half of the UI) instead of MGD (the management daemon, all-knowing, all-seeing half). In particular the CLI is doing the rendering from XML to text, so any post-rendering (text-based) pipes don't make sense on the pre-rendered data. Matching on an IP address on the XML will only get you something like: <ip-address>10.0.0.2</ip-address> Please ask your account team to open a PR asking for some arguments to filter based on mac/ip/interface. We don't have a generic XPath-based filtering scheme for the API, but you can make an "op script" that will perform your filtering so that at least the filtering is performed on the box instead of sending it to your app to filter. Something like the script below (attached): r...@dent> op test ip-address 10.0.0.8 MAC Address Address Interface Flags 00:a0:a5:5e:77:cb 10.0.0.8 fe-0/0/0.0 none r...@dent> Thanks, Phil ----- 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> "ip-address"; <description> "IP address to filter on"; } <argument> { <name> "mac-address"; <description> "MAC address to filter on"; } <argument> { <name> "interface"; <description> "Interface to filter on"; } } param $ip-address; param $mac-address; param $interface; match / { <op-script-output> { <arp-table-information junos:style="no-resolve"> { var $rpc = <get-arp-table-information> { <no-resolve>; } var $arp = jcs:invoke($rpc); if ($ip-address) { copy-of $arp/arp-table-entry[$ip-address == ip-address]; } else if ($mac-address) { copy-of $arp/arp-table-entry[$mac-address == mac-address]; } else if ($interface) { copy-of $arp/arp-table-entry[$interface == interface-name]; } else { copy-of $arp; } } } } _______________________________________________ juniper-nsp mailing list juniper-nsp@puck.nether.net https://puck.nether.net/mailman/listinfo/juniper-nsp