Making custom show commands
In this recipe, we'll create a new SLAX op script, show-bgp.slax
, in order to create a slightly more readable and visible show bgp summary
command. We'll do this by executing the normal RPC associated with the show bgp neighbor
command, extracting the pertinent information, tabulating, and formatting it for output.
Getting ready
In order to complete this recipe, you'll need access to a JUNOS router running Border Gateway Protocol (BGP) with a number of peers.
How to do it...
We're going to create a SLAX script to call the necessary RPC to get the BGP information, then iterate through the returned structure, printing only a small but hopefully relevant subset of the information. The steps for the recipe are as follows:
- Start with the mandatory SLAX boilerplate as recommended by Juniper. This typically defines version numbers for compatibility and declares namespaces.
version 1.0; ns junos = "http://xml.juniper.net/junos/*/junos"; ns xnm = "http:...