Skip to content

Instantly share code, notes, and snippets.

@nleiva
Last active July 9, 2020 19:05
Show Gist options
  • Save nleiva/b863336ef4eff54d867b43439b4e8b50 to your computer and use it in GitHub Desktop.
Save nleiva/b863336ef4eff54d867b43439b4e8b50 to your computer and use it in GitHub Desktop.
get_acl.py
from capirca.lib import cisco, juniper
def get_acl(inputs):
...
header = header_template.safe_substitute(inputs)
defs = naming.Naming(inputs['def_folder'])
terms = open(inputs['pol_file']).read()
pol = policy.ParsePolicy(header + '\n' + terms, defs, optimize=True)
...
if inputs['platform'] == 'juniper':
result = juniper.Juniper(pol, EXP_INFO)
elif inputs['platform'] == 'cisco':
result = cisco.Cisco(pol, EXP_INFO)
...
return str(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment