Blog Viewer

Scripting How-To: Use show-bgp-policy to display all routing-policies in sequential order for a selected BGP peer

By Erdem posted 08-14-2015 15:42

  

Overview

Display all routing-policies in sequential order for a selected BGP peer. This applies to SLAX version 1.0 and higher.

Description

This script provides an easy way to study the complete policy chain of a BGP peer. With multiple BGP policies in an import or export policy chain, it can become troublesome to determine what action will be taken for a particular prefix because the policies will usually not appear in the desired order within the policy-options hierarchy in the configuration.

The configuration text for each policy in the policy chain for the selected peer is extracted by the script and then displayed to the console in the correct sequential order. Through use of this op script, a user can easily read the complete policy chain from start to finish.

Three are three command-line arguments:

  • neighbor - Specificy which BGP peer to view
  • direction - Choose the import or export direction
  • database - The policies can be viewed from either the committed database (the default), or the candidate database.

 

Minimum Junos Version: 8.2
Latest Script Version: 1.0
MD5 Checksum: 4b830f1cc024657d621d0668e4af092f
SHA-256 Checksum: 963dd0f98f7f15d8728343b77d37e07b202362a7c8f682c464600fefeec86787

Source Code

 

GitHub Links

 

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

 

Example Output

01 [edit protocols bgp group test]
02 user@cli