I’ve been doing a lot of work with Juniper SRX firewalls recently; JunOS allows administrators to build scripts using either XSLT or SLAX.

This is a little SLAX script variant of “show interfaces terse”. I wrote this because I wanted to be able to display interface IP addresses, descriptions and routing instances in one table.

The script is fairly simple, it executes two commands:

  • show interfaces
  • show interfaces routing-instance all

The script loops through the results, using an XPATH expression to find any defined routing instances, effectively linking output from the two commands.

The code below makes use of the request tag elements which tends to make command construction simpler (considering that variables in SLAX are immutable). These elements are documented in the XML API reference.

Leave a Reply

Your email address will not be published. Required fields are marked *