Blog Viewer

Scripting How-To: Study the complete policy chain of a BGP peer

By Erdem posted 08-07-2015 17:22


Study the Complete Policy Chain of a BGP Peer


You can use the show-bgp-policy script to display all routing-policies in sequential order for a selected BGP peer. The 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, you can easily read the complete policy chain from start to finish.


There are three command-line arguments:


  • neighbor - Specify which BGP peer to view
  • direction - Select the import or export direction
  • database - View the policies from either the committed database (the default) or the candidate database

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


See the document show-bgp-policy