Welcome to weblogs.com.pk Sign in | Join | Help

Scripting and Customization in JUNOS

JUNOS software (Juniper's) is a highly useful nework operating system for any network engineer to achieve goals. In JUNOS, there are times when you can enter all the individual lines of a configuration correctly, and the configuration can still be wrong.  That is, the combination of commands do not work correctly together or there's something missing among the lines.

In the following example, I set up a very simple BGP configuration. First, I move from the top of the hierarchy to a BGP peering group that I’ve named External_Peer. I didn't have to use the set command to create this group; just by moving to that level, the group is created for me. Next, I specify a neighbor at 172.16.1.5. Then I specify that the neighboring autonomous system for the group is 65500. Finally, I specify that an export policy named External_Peer_Policy is used to modify or filter routes sent (exported) to the neighbor. When I’m done, I return to the top of the configuration hierarchy.

At each configuration line JUNOS accepts the entries, indicating that I have not made any mistakes (extraordinary for me) :)

jahil@junos# edit protocols bgp group External_Peer

[edit protocols bgp group External_Peer]
jahil@junos# set neighbor 172.16.1.5

[edit protocols bgp group External_Peer]
jahil@junos# set peer-as 65502

[edit protocols bgp group External_Peer]
jahil@junos# set export External_Peer_Policy

[edit protocols bgp group External_Peer]
jahil@junos# top

[edit]
jahil@junos#

But then when I try to commit the configuration, JUNOS objects:

jahil@junos# commit             
error: Policy error: Policy External_Peer_Policy referenced but not defined

[edit protocols bgp group External_Peer]
'export'
BGP: export list not applied
error: configuration check-out failed

[edit]
jahil@junos#

It’s telling me that the export policy I referenced in my BGP configuration does not exist anywhere in the configuration. (It should be found somewhere under the [edit policy-options] level).

When the commit command is invoked, JUNOS runs a set of scripts that examine the candidate configuration. If some situation is found, like the one I just showed you, in which the various lines of the configuration do not work together, the commit fails and an error message is displayed explaining why the commit failed.

By the way, you can use the  commit check command to tell JUNOS to run the scripts against the candidate configuration without attempting a commit. That’s very useful if you’re adding a bunch of new statements to the configuration and want the scripts to occasionally check your work as you go.

Published Monday, September 08, 2008 1:47 PM by jahil
Filed under: ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

No Comments

Leave a Comment

(required) 
required 
(required)