Skip to content

Instantly share code, notes, and snippets.

@tylerkerr
Created April 25, 2016 23:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tylerkerr/f6c99e83e94b13b02af0911ba7bfb9e3 to your computer and use it in GitHub Desktop.
Save tylerkerr/f6c99e83e94b13b02af0911ba7bfb9e3 to your computer and use it in GitHub Desktop.
programmatic Junos set command generation, to eliminate tedious/manual repetitive policy creation
#!/usr/bin/env python3
basecommand = input('Enter base command, with "%" in place of iterables: ')
start = int(input('Enter range start (inclusive): '))
end = int(input('Enter range end (inclusive): '))
print("\n")
for i in range(start,end+1):
print(basecommand.replace("%", str(i)))
# print("\n%s" % basecommand)
print("\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment