Blog Viewer

Scripting How-To: Add descriptions and protocol filtering to the normal "show interfaces terse" command

By Erdem posted 08-14-2015 15:50

  

Overview

Show interfaces terse with descriptions. This applies to SLAX version 1.0 and higher.

 

Description

This script adds descriptions and protocol filtering to the normal "show interfaces terse" command. Two arguments (interface and protocol) provide additional filtering.

Source Code

 

GitHub Links

 
The source code below is also available from GitHub at the following locations:
 
 

Example Configuration

1 system {
2     scripts {
3         op {
4             file show-interfaces.slax {
5                 description "show interfaces terse w/ descriptions";
6             }
7         }
8     }
9 }

Example Output

01 phil@dent> op show-interfaces? 
02 Possible completions:
03   <script>             Name of script to run
04   show-interfaces      show interfaces terse w/ descriptions
05 phil@dent> op show-interfaces ? 
06 Possible completions:
07   <[Enter]>            Execute this command
08   <name>               Argument name
09   detail               Display detailed output
10   interface            Name of interface to display
11   protocol             Protocol to display (inet, inet6)
12   |                    Pipe through a command
13 phil@dent> op show-interfaces protocol inet
14 Interface               Admin Link Proto    Local                 Remote
15 fe-0/0/0.0              RLab Mgmt interface
16                                    inet     10.0.0.7/24    
17 fe-0/0/1.0              Hub link to SJC (10.5.10.2)
18                                    inet     10.5.10.1/24   
19 fe-0/0/2.0              Hub link to LAX (10.5.13.2)
20