Compare commits
3 Commits
2433808124
...
bf76881611
| Author | SHA1 | Date | |
|---|---|---|---|
| bf76881611 | |||
| 4729dbf1ea | |||
| c7ec274171 |
+35
-19
@@ -1,6 +1,7 @@
|
|||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
import pprint
|
import pprint
|
||||||
import os
|
import os
|
||||||
|
import json
|
||||||
|
|
||||||
from yaml import safe_load
|
from yaml import safe_load
|
||||||
try:
|
try:
|
||||||
@@ -8,10 +9,22 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
from yaml import Loader
|
from yaml import Loader
|
||||||
|
|
||||||
def main(template_filepath,yaml_filepath,output_filepath):
|
def main(template_filepath,input_filepath,output_filepath):
|
||||||
|
|
||||||
|
with open(input_filepath, 'r') as file:
|
||||||
|
input_devices = file.read()
|
||||||
|
|
||||||
|
device_info = dict()
|
||||||
|
|
||||||
|
if os.path.splitext(input_filepath)[1] == ".json":
|
||||||
|
device_info = json.loads(input_devices)
|
||||||
|
# elif os.path.splitext(input_filepath) == ".yaml":
|
||||||
|
# devices = safe_load(input_devices)
|
||||||
|
else:
|
||||||
|
print(os.path.splitext(input_filepath))
|
||||||
|
print('{} is not a valid JSON format!\n'.format(input_filepath))
|
||||||
|
return 406
|
||||||
|
|
||||||
with open(yaml_filepath, 'r') as file:
|
|
||||||
devices = safe_load(file)
|
|
||||||
|
|
||||||
template_path = os.path.dirname(os.path.abspath(template_filepath))
|
template_path = os.path.dirname(os.path.abspath(template_filepath))
|
||||||
template_filename = os.path.basename(template_filepath)
|
template_filename = os.path.basename(template_filepath)
|
||||||
@@ -28,21 +41,24 @@ def main(template_filepath,yaml_filepath,output_filepath):
|
|||||||
#output = open(filename, mode="w", encoding="utf-8")
|
#output = open(filename, mode="w", encoding="utf-8")
|
||||||
output = open(output_filepath, mode="w", encoding="utf-8")
|
output = open(output_filepath, mode="w", encoding="utf-8")
|
||||||
|
|
||||||
|
content = template.render(device_info)
|
||||||
|
|
||||||
for host, keys in devices.items():
|
|
||||||
device = "{"
|
|
||||||
for key, value in keys.items():
|
|
||||||
device += "'{}':'{}', ".format(key,value)
|
|
||||||
device += "'Hostname':'{}' }}".format(host)
|
|
||||||
#pprint.pprint(device)
|
|
||||||
|
|
||||||
device_dict = eval(device)
|
|
||||||
#pprint.pprint(device_dict)
|
|
||||||
content = template.render( device_dict )
|
|
||||||
|
|
||||||
print('{}\n'.format(content))
|
|
||||||
output.write('{}\n'.format(content))
|
output.write('{}\n'.format(content))
|
||||||
|
|
||||||
|
# for host, keys in devices.items():
|
||||||
|
# device = "{"
|
||||||
|
# for key, value in keys.items():
|
||||||
|
# device += "'{}':'{}', ".format(key,value)
|
||||||
|
# device += "'Hostname':'{}' }}".format(host)
|
||||||
|
# #pprint.pprint(device)
|
||||||
|
|
||||||
|
# device_dict = eval(device)
|
||||||
|
# #pprint.pprint(device_dict)
|
||||||
|
# content = template.render( device_dict )
|
||||||
|
|
||||||
|
# print('{}\n'.format(content))
|
||||||
|
# output.write('{}\n'.format(content))
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
@@ -56,8 +72,8 @@ if __name__ == "__main__":
|
|||||||
required=True
|
required=True
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument('-yaml',
|
parser.add_argument('-input',
|
||||||
help='YAML file with devices and config variables',
|
help='Input file with devices and config variables',
|
||||||
required=True
|
required=True
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -69,8 +85,8 @@ if __name__ == "__main__":
|
|||||||
custom_args = parser.parse_known_args()[0]
|
custom_args = parser.parse_known_args()[0]
|
||||||
|
|
||||||
template = custom_args.template
|
template = custom_args.template
|
||||||
yaml = custom_args.yaml
|
input = custom_args.input
|
||||||
output = custom_args.output
|
output = custom_args.output
|
||||||
|
|
||||||
main(template,yaml,output)
|
main(template,input,output)
|
||||||
|
|
||||||
+179
-61
@@ -1,69 +1,187 @@
|
|||||||
{#
|
{#-
|
||||||
Declare Lo0.0 and all common protocols for a Core router
|
Declare Lo0.0 and all common protocols for a Core router
|
||||||
Lo0.0 must be declared and created before protocols can be applied
|
Lo0.0 must be declared and created before protocols can be applied
|
||||||
Protocols for the Lo0.0 are automatically handled by the common packages
|
Protocols for the Lo0.0 are automatically handled by the common packages
|
||||||
#}
|
#}
|
||||||
|
{%- for loopback, unit in interfaces["loopback-interface"]["lo0"]["units"].items() %}
|
||||||
|
set services infra-crt {{device}} interface loopback-interface lo0 {{unit["name"]}} skip-loopback-check true
|
||||||
|
{%- if unit["description"] is not none %}
|
||||||
|
set services infra-crt {{device}} interface loopback-interface lo0 {{unit["name"]}} description {{unit["description"]}}
|
||||||
|
{%- else %}
|
||||||
|
ERROR: Missing Description for Lo0 unit {{unit["name"]}}!!!
|
||||||
|
set services infra-crt {{device}} interface loopback-interface lo0 {{unit["name"]}} description "FIX_ME"
|
||||||
|
{%- endif %}
|
||||||
|
{%- if unit["inet4"] is not none %}
|
||||||
|
set services infra-crt {{device}} interface loopback-interface lo0 {{unit["name"]}} ipv4 {{unit["inet4"]}}
|
||||||
|
{%- endif %}
|
||||||
|
{%- if unit["inet6"] is not none %}
|
||||||
|
set services infra-crt {{device}} interface loopback-interface lo0 {{unit["name"]}} ipv6 {{unit["inet6"]}}
|
||||||
|
{%- endif %}
|
||||||
|
{%- if unit["inet4"] == none and unit["inet6"] == none %}
|
||||||
|
ERROR: ERROR: IP Addressing Missing for Lo0 unit {{unit["name"]}}!!!
|
||||||
|
set services infra-crt {{device}} interface loopback-interface lo0 {{unit["name"]}} [ipv4|ipv6] FIX_ME
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
||||||
|
|
||||||
{% for loopback_unit in device_info["interface"]["loopback-interface"]["lo0"]["units"] %}
|
set services infra-crt {{device}} isis
|
||||||
set services infra-crt {{device_info["device"]}} interface loopback-interface lo0 {{loopback_unit["name"]}} skip-loopback-check true
|
set services infra-crt {{device}} ldp
|
||||||
{% if loopback_unit["description"] not None %}
|
set services infra-crt {{device}} rsvp
|
||||||
set services infra-crt {{device_info["device"]}} interface loopback-interface lo0 {{loopback_unit["name"]}} description {{loopback_unit["description"]}}
|
set services infra-crt {{device}} mpls-te
|
||||||
{% if loopback_unit["inet4"] not None %}
|
set services infra-crt {{device}} service-policy
|
||||||
set services infra-crt {{device_info["device"]}} interface loopback-interface lo0 {{loopback_unit["name"]}} ipv4 {{loopback_unit["inet4"]}}
|
|
||||||
{% if loopback_unit["inet6"] not None %}
|
|
||||||
set services infra-crt {{device_info["device"]}} interface loopback-interface lo0 {{loopback_unit["name"]}} ipv6 {{loopback_unit["inet6"]}}
|
|
||||||
|
|
||||||
set services infra-crt {{device_info["device"]}} isis
|
|
||||||
set services infra-crt {{device_info["device"]}} ldp
|
|
||||||
set services infra-crt {{device_info["device"]}} rsvp
|
|
||||||
set services infra-crt {{device_info["device"]}} mpls-te
|
|
||||||
set services infra-crt {{device_info["device"]}} service-policy
|
|
||||||
|
|
||||||
{# Aggregate-interface declaration - protocol declaration for AEs is same as standard core-interfaces #}
|
{# Aggregate-interface declaration - protocol declaration for AEs is same as standard core-interfaces #}
|
||||||
{% for aggregate_interface in device_info["interface"]["aggregate-interface"] %}
|
{%- for key,aggregate_interface in interfaces["aggregate-interface"].items() %}
|
||||||
{% set ae_num = aggregate_interface["name"] | replace('ae', '') %}
|
{%- if aggregate_interface["disabled"] == False %}
|
||||||
{% for aggregate_unit in aggregate_interface["units"] %}
|
{%- set ae_num = key | replace('ae', '') %}
|
||||||
{% if aggregate_unit["mtu"] not None %}
|
{%- for key,aggregate_unit in aggregate_interface["units"].items() %}
|
||||||
set services infra-crt {{device_info["device"]}} interface aggregate-interface {{ae_num}} {{aggregate_unit["name"]}} mtu {{aggregate_unit["mtu"]}}
|
{%- if aggregate_unit["disabled"] == False %}
|
||||||
{% if aggregate_unit["inet4"] not None %}
|
{%- if aggregate_interface["mtu"] is not none %}
|
||||||
set services infra-crt {{device_info["device"]}} interface aggregate-interface {{ae_num}} {{aggregate_unit["name"]}} ipv4 {{aggregate_unit["inet4"]}}
|
set services infra-crt {{device}} interface aggregate-interface {{ae_num}} {{aggregate_unit["name"]}} mtu {{aggregate_interface["mtu"]}}
|
||||||
{% if aggregate_unit["description"] not None %}
|
{%- endif %}
|
||||||
set services infra-crt {{device_info["device"]}} interface aggregate-interface {{ae_num}} {{aggregate_unit["name"]}} description {{aggregate_unit["description"]}}
|
{%- if aggregate_unit["inet4"] is not none %}
|
||||||
{% for core_interface in aggregate_interface["units"] %}
|
set services infra-crt {{device}} interface aggregate-interface {{ae_num}} {{aggregate_unit["name"]}} ipv4 {{aggregate_unit["inet4"]}}
|
||||||
{% if core_interface["description"] not None %}
|
{%- else %}
|
||||||
set services infra-crt {{device_info["device"]}} interface aggregate-interface {{ae_num}} {{aggregate_unit["name"]}} core-interface {{core_interface["name"]}} description {{aggregate_unit["description"]}}
|
ERROR: IP Addressing Missing for {{aggregate_interface["name"]}} unit {{aggregate_unit["name"]}}!!!
|
||||||
{% else %}
|
set services infra-crt {{device}} interface aggregate-interface {{ae_num}} {{aggregate_unit["name"]}} ipv4 FIX_ME
|
||||||
set services infra-crt {{device_info["device"]}} interface aggregate-interface {{ae_num}} {{aggregate_unit["name"]}} core-interface {{core_interface["name"]}}
|
{%- endif %}
|
||||||
|
{%- if aggregate_interface["description"] is not none %}
|
||||||
|
set services infra-crt {{device}} interface aggregate-interface {{ae_num}} {{aggregate_unit["name"]}} description {{aggregate_interface["description"]}}
|
||||||
|
{%- else %}
|
||||||
|
ERROR: Missing Description for {{aggregate_interface["name"]}} unit {{aggregate_unit["name"]}}!!!
|
||||||
|
set services infra-crt {{device}} interface aggregate-interface {{ae_num}} {{aggregate_unit["name"]}} description FIX_ME
|
||||||
|
{%- endif %}
|
||||||
|
{#- Find Protocols for AE #}
|
||||||
|
{#- ISIS#}
|
||||||
|
{%- if aggregate_unit["isis-passive"] == True %}
|
||||||
|
set services infra-crt {{device}} isis passive-interface name {{aggregate_interface["name"]}} {{aggregate_unit["name"]}}
|
||||||
|
{%- else %}
|
||||||
|
set services infra-crt {{device}} isis core-interface name {{aggregate_interface["name"]}} {{aggregate_unit["name"]}} metric {{aggregate_unit["isis-l2-metric"]}}
|
||||||
|
{%- if aggregate_unit["isis-inet-enable-bfd"] == True %}
|
||||||
|
set services infra-crt {{device}} isis core-interface name {{aggregate_interface["name"]}} {{aggregate_unit["name"]}} enable-bfd true
|
||||||
|
set services infra-crt {{device}} isis core-interface name {{aggregate_interface["name"]}} {{aggregate_unit["name"]}} bfd-min-interval {{aggregate_unit["isis-inet-bfd-interval"]}}
|
||||||
|
set services infra-crt {{device}} isis core-interface name {{aggregate_interface["name"]}} {{aggregate_unit["name"]}} bfd-multiplier {{aggregate_unit["isis-inet-bfd-multiplier"]}}
|
||||||
|
{%- else %}
|
||||||
|
set services infra-crt {{device}} isis core-interface name {{aggregate_interface["name"]}} {{aggregate_unit["name"]}} enable-bfd false
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
{#- LDP #}
|
||||||
|
{%- if aggregate_unit["ldp"] == True %}
|
||||||
|
set services infra-crt {{device}} ldp core-interface name {{aggregate_interface["name"]}} {{aggregate_unit["name"]}}
|
||||||
|
{%- endif %}
|
||||||
|
{#- MPLS-TE #}
|
||||||
|
{%- if aggregate_unit["mpls"] == True %}
|
||||||
|
{%- if aggregate_unit["mpls-te-att-names"] is not none %}
|
||||||
|
set services infra-crt {{device}} mpls-te core-interface name {{aggregate_interface["name"]}} {{aggregate_unit["name"]}} mpls-te-att-names {{aggregate_unit["mpls-te-att-names"]}}
|
||||||
|
{%- else %}
|
||||||
|
set services infra-crt {{device}} mpls-te core-interface name {{aggregate_interface["name"]}} {{aggregate_unit["name"]}}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
{#- MPLS-TE-FRR #}
|
||||||
|
{%- if aggregate_unit["mpls-te-frr-backup-bandwidth"] is not none %}
|
||||||
|
set services infra-crt {{device}} mpls-te-frr junos-core-interface {{aggregate_interface["name"]}} {{aggregate_unit["name"]}} backup-bandwidth {{aggregate_unit["mpls-te-frr-backup-bandwidth"]}}
|
||||||
|
{%- endif %}
|
||||||
|
{#- RSVP #}
|
||||||
|
{%- if aggregate_unit["rsvp"] == True %}
|
||||||
|
set services infra-crt {{device}} rsvp core-interface name {{aggregate_interface["name"]}} {{aggregate_unit["name"]}} core-intf-bandwidth {{aggregate_unit["rsvp-bandwidth"]}}
|
||||||
|
set services infra-crt {{device}} rsvp core-interface name {{aggregate_interface["name"]}} {{aggregate_unit["name"]}} core-intf-subscription {{aggregate_unit["rsvp-subscription"]}}
|
||||||
|
{%- endif %}
|
||||||
|
{#- Service-Policy #}
|
||||||
|
{%- if aggregate_unit["service-policy"] == True %}
|
||||||
|
set services infra-crt {{device}} service-policy core-interface name {{aggregate_interface["name"]}} {{aggregate_unit["name"]}}
|
||||||
|
{%- if aggregate_interface["service-map"] is not none %}
|
||||||
|
set services infra-crt {{device}} service-policy core-interface name {{aggregate_interface["name"]}} {{aggregate_unit["name"]}} service-map {{aggregate_interface["service-map"]}}
|
||||||
|
{%- endif %}
|
||||||
|
{%- if aggregate_interface["shaper-rate"] is not none %}
|
||||||
|
set services infra-crt {{device}} service-policy core-interface name {{aggregate_interface["name"]}} {{aggregate_unit["name"]}} shaper-rate {{aggregate_interface["shaper-rate"]}}
|
||||||
|
{%- endif %}
|
||||||
|
{%- else %}
|
||||||
|
ERROR: Missing Service-Policy for {{aggregate_interface["name"]}} unit {{aggregate_unit["name"]}}!!!
|
||||||
|
set services infra-crt {{device}} service-policy core-interface name {{aggregate_interface["name"]}} {{aggregate_unit["name"]}}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
||||||
|
{%- for key,member_interface in aggregate_interface["member-interface"].items() %}
|
||||||
|
{%- if member_interface["description"] is not none %}
|
||||||
|
set services infra-crt {{device}} interface aggregate-interface {{ae_num}} 0 core-interface {{member_interface["name"]}} description {{member_interface["description"]}}
|
||||||
|
{%- else %}
|
||||||
|
ERROR: Missing Description for {{aggregate_interface["name"]}} Member-interface {{member_interface["name"]}}!!!
|
||||||
|
set services infra-crt {{device}} interface aggregate-interface {{ae_num}} 0 core-interface {{member_interface["name"]}} description FIX_ME
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
||||||
|
|
||||||
{# Standard core-interface declaration #}
|
{#- Standard core-interface declaration #}
|
||||||
set services infra-crt {{device_info["device"]}} interface core-interface name {{iface_name}} {{unit_num}} ipv4 {{inet4-cidr}}
|
{%- for key,core_interface in interfaces["core-interface"].items() %}
|
||||||
set services infra-crt {{device_info["device"]}} interface core-interface name {{iface_name}} {{unit_num}} mtu {{mtu}}
|
{%- if core_interface["disabled"] == False %}
|
||||||
set services infra-crt {{device_info["device"]}} interface core-interface name {{iface_name}} {{unit_num}} description {{description}}
|
{% for key,core_unit in core_interface["units"].items() %}
|
||||||
|
{%- if core_unit["disabled"] == False %}
|
||||||
|
{%- if core_interface["description"] is not none %}
|
||||||
{# Below protocol delcarations should only be made if the interface was declared #}
|
set services infra-crt {{device}} interface core-interface name {{core_interface["name"]}} {{core_unit["name"]}} description {{core_interface["description"]}}
|
||||||
|
{%- endif %}
|
||||||
{# Declare protocol LDP per participating interface #}
|
{%- if core_interface["description"] is none %}
|
||||||
set services infra-crt {{device_info["device"]}} ldp core-interface name {{iface_name}} {{unit_num}}
|
set services infra-crt {{device}} interface core-interface name {{core_interface["name"]}} {{core_unit["name"]}} description FIX_ME
|
||||||
|
{%- endif %}
|
||||||
{# Declare protocol ISIS per participating interface - BFD settings only needed if enable-bfd == true #}
|
{%- if core_interface["mtu"] is not none%}
|
||||||
set services infra-crt {{device_info["device"]}} isis core-interface name {{iface_name}} {{unit_num}} metric {{metric}}
|
set services infra-crt {{device}} interface core-interface name {{core_interface["name"]}} {{core_unit["name"]}} mtu {{core_interface["mtu"]}}
|
||||||
set services infra-crt {{device_info["device"]}} isis core-interface name {{iface_name}} {{unit_num}} enable-bfd {{enable-bfd}}
|
{%- endif %}
|
||||||
set services infra-crt {{device_info["device"]}} isis core-interface name {{iface_name}} {{unit_num}} bfd-min-interval {{bfd-interval}}
|
{%- if core_unit["inet4"] is not none%}
|
||||||
set services infra-crt {{device_info["device"]}} isis core-interface name {{iface_name}} {{unit_num}} bfd-multiplier {{bfd-multiplier}}
|
set services infra-crt {{device}} interface core-interface name {{core_interface["name"]}} {{core_unit["name"]}} ipv4 {{core_unit["inet4"]}}
|
||||||
|
{%- endif %}
|
||||||
{# Declare protocol RSVP per participating interface #}
|
{%- if core_unit["inet4"] is none%}
|
||||||
set services infra-crt {{device_info["device"]}} rsvp core-interface name {{iface_name}} {{unit_num}} core-intf-bandwidth {{core-intf-bandwidth}}
|
set services infra-crt {{device}} interface core-interface name {{core_interface["name"]}} {{core_unit["name"]}} ipv4 FIX_ME
|
||||||
set services infra-crt {{device_info["device"]}} rsvp core-interface name {{iface_name}} {{unit_num}} core-intf-subscription {{core-intf-subscription}}
|
{%- endif %}
|
||||||
|
{#- Find Protocols for AE #}
|
||||||
{# Declare Service-Policy per interface -- truncate service-map and shaper-rate if values are null ?? #}
|
{#- ISIS#}
|
||||||
set services infra-crt {{device_info["device"]}} service-policy core-interface name {{iface_name}} {{unit_num}}
|
{%- if core_unit["isis"] == True %}
|
||||||
set services infra-crt {{device_info["device"]}} service-policy core-interface name {{iface_name}} {{unit_num}} service-map {{service-map}}
|
{%- if core_unit["isis-passive"] == True %}
|
||||||
set services infra-crt {{device_info["device"]}} service-policy core-interface name {{iface_name}} {{unit_num}} shaper-rate {{shaper-rate}}
|
set services infra-crt {{device}} isis passive-interface name {{core_interface["name"]}} {{core_unit["name"]}}
|
||||||
|
{%- else %}
|
||||||
{# Declare MPLS-TE per participating Interface - Truncate line if mpls-te-att-names is null #}
|
set services infra-crt {{device}} isis core-interface name {{core_interface["name"]}} {{core_unit["name"]}} metric {{core_unit["isis-l2-metric"]}}
|
||||||
set services infra-crt {{device_info["device"]}} mpls-te core-interface name {{iface_name}} {{unit_num}}
|
{%- if core_unit["isis-inet-enable-bfd"] == True %}
|
||||||
set services infra-crt {{device_info["device"]}} mpls-te core-interface name {{iface_name}} {{unit_num}} mpls-te-att-names [ {{mpls-te-att-names}} ]
|
set services infra-crt {{device}} isis core-interface name {{core_interface["name"]}} {{core_unit["name"]}} enable-bfd true
|
||||||
|
set services infra-crt {{device}} isis core-interface name {{core_interface["name"]}} {{core_unit["name"]}} bfd-min-interval {{core_unit["isis-inet-bfd-interval"]}}
|
||||||
{# Declare MPLS-TE-FRR per participating interface #}
|
set services infra-crt {{device}} isis core-interface name {{core_interface["name"]}} {{core_unit["name"]}} bfd-multiplier {{core_unit["isis-inet-bfd-multiplier"]}}
|
||||||
set services infra-crt {{device_info["device"]}} mpls-te-frr junos-core-interface {{iface_name}} {{unit_num}} backup-bandwidth {{backup-bandwidth}}
|
{%- else %}
|
||||||
|
set services infra-crt {{device}} isis core-interface name {{core_interface["name"]}} {{core_unit["name"]}} enable-bfd false
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
{#- LDP #}
|
||||||
|
{%- if core_unit["ldp"] == True %}
|
||||||
|
set services infra-crt {{device}} ldp core-interface name {{core_interface["name"]}} {{core_unit["name"]}}
|
||||||
|
{%- endif %}
|
||||||
|
{#- MPLS-TE #}
|
||||||
|
{%- if core_unit["mpls"] == True %}
|
||||||
|
{%- if none not in core_unit["mpls-te-att-names"] %}
|
||||||
|
set services infra-crt {{device}} mpls-te core-interface name {{core_interface["name"]}} {{core_unit["name"]}} mpls-te-att-names {{core_unit["mpls-te-att-names"]}}
|
||||||
|
{%- else %}
|
||||||
|
set services infra-crt {{device}} mpls-te core-interface name {{core_interface["name"]}} {{core_unit["name"]}}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
{#- MPLS-TE-FRR #}
|
||||||
|
{%- if core_unit["mpls-te-frr-backup-bandwidth"] is not none %}
|
||||||
|
set services infra-crt {{device}} mpls-te-frr junos-core-interface {{core_interface["name"]}} {{core_unit["name"]}} backup-bandwidth {{core_unit["mpls-te-frr-backup-bandwidth"]}}
|
||||||
|
{%- endif %}
|
||||||
|
{#- RSVP #}
|
||||||
|
{%- if core_unit["rsvp"] == True %}
|
||||||
|
set services infra-crt {{device}} rsvp core-interface name {{core_interface["name"]}} {{core_unit["name"]}} core-intf-bandwidth {{core_unit["rsvp-bandwidth"]}}
|
||||||
|
set services infra-crt {{device}} rsvp core-interface name {{core_interface["name"]}} {{core_unit["name"]}} core-intf-subscription {{core_unit["rsvp-subscription"]}}
|
||||||
|
{%- endif %}
|
||||||
|
{#- Service-Policy #}
|
||||||
|
{%- if core_unit["service-policy"] == True %}
|
||||||
|
set services infra-crt {{device}} service-policy core-interface name {{core_interface["name"]}} {{core_unit["name"]}}
|
||||||
|
{%- if core_interface["service-map"] is not none %}
|
||||||
|
set services infra-crt {{device}} service-policy core-interface name {{core_interface["name"]}} {{core_unit["name"]}} service-map {{core_interface["service-map"]}}
|
||||||
|
{%- endif %}
|
||||||
|
{%- if core_interface["shaper-rate"] is not none %}
|
||||||
|
set services infra-crt {{device}} service-policy core-interface name {{core_interface["name"]}} {{core_unit["name"]}} shaper-rate {{core_interface["shaper-rate"]}}
|
||||||
|
{%- endif %}
|
||||||
|
{%- else %}
|
||||||
|
ERROR: Missing Service-Policy for {{core_interface["name"]}} unit {{core_unit["name"]}}!!!
|
||||||
|
set services infra-crt {{device}} service-policy core-interface name {{core_interface["name"]}} {{core_unit["name"]}}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
||||||
|
|||||||
Reference in New Issue
Block a user