Last active
February 1, 2019 02:08
-
-
Save amulheirn/47d7f2545992a38ca9687e84cc7c8eb8 to your computer and use it in GitHub Desktop.
Python script to create 8,000 policies in Junos for use in VRFs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__author__ = 'amulheirn' | |
# Create 8,000 export policies for use on 8,000 VRFs in Junos | |
# Used for type-approval-testing of customer MX960 | |
interface = '0/0/0' # Local source interface | |
startvrf = 1 # Start of the vrf range | |
endvrf = 8001 # End of the vrf range | |
for i in range (startvrf, endvrf): | |
print "set policy-options policy-statement VRF-%s-redistribute-bgp term export-direct from protocol direct" % i | |
print "set policy-options policy-statement VRF-%s-redistribute-bgp term export-direct from policy IMS-VOICE-VPN-LP" % i | |
print "set policy-options policy-statement VRF-%s-redistribute-bgp term export-direct then accept" % i | |
print "set policy-options policy-statement VRF-%s-redistribute-bgp term reject-others then reject" % i | |
print "set policy-options policy-statement VRF-%s-export-to-PEs term add-communities then community add VRF-%s-%s" % (i, i, i) | |
print "set policy-options policy-statement VRF-%s-export-to-PEs term redist-to-bgp from policy VRF-%s-redistribute-bgp" % (i, i) | |
print "set policy-options policy-statement VRF-%s-export-to-PEs term redist-to-bgp then accept" % i | |
print "set policy-options policy-statement VRF-%s-export-to-PEs term reject-others then reject" % i | |
print "======[END]=====" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment