diff --git a/templates/infra-crt-NSO.config b/templates/infra-crt-NSO.config index 968fbd6..6520865 100644 --- a/templates/infra-crt-NSO.config +++ b/templates/infra-crt-NSO.config @@ -31,9 +31,10 @@ set services infra-crt {{device}} service-policy {# Aggregate-interface declaration - protocol declaration for AEs is same as standard core-interfaces #} {%- for key,aggregate_interface in interfaces["aggregate-interface"].items() %} +{%- if aggregate_interface["disabled"] == False %} {%- set ae_num = key | replace('ae', '') %} {%- for key,aggregate_unit in aggregate_interface["units"].items() %} -{%- set protocol_int_name = aggregate_interface["name"] ~ '.' ~ aggregate_unit["name"] %} +{%- if aggregate_unit["disabled"] == False %} {%- if aggregate_interface["mtu"] is not none %} set services infra-crt {{device}} interface aggregate-interface {{ae_num}} {{aggregate_unit["name"]}} mtu {{aggregate_interface["mtu"]}} {%- endif %} @@ -51,54 +52,53 @@ set services infra-crt {{device}} interface aggregate-interface {{ae_num}} {{agg {%- endif %} {#- Find Protocols for AE #} {#- ISIS#} -{%- if protocol_int_name in isis["interface"] %} -{%- if isis["interface"][protocol_int_name]["passive"] == True %} +{%- 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 {{isis["interface"][protocol_int_name]["metric"]}} -{%- if isis["interface"][protocol_int_name]["enable-bfd"] == True %} +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 {{isis["interface"][protocol_int_name]["bfd-interval"]}} -set services infra-crt {{device}} isis core-interface name {{aggregate_interface["name"]}} {{aggregate_unit["name"]}} bfd-multiplier {{isis["interface"][protocol_int_name]["bfd-multiplier"]}} +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 %} -{%- endif %} {#- LDP #} -{%- if protocol_int_name in ldp["interface"] %} +{%- if aggregate_unit["ldp"] == True %} set services infra-crt {{device}} ldp core-interface name {{aggregate_interface["name"]}} {{aggregate_unit["name"]}} {%- endif %} {#- MPLS-TE #} -{%- if protocol_int_name in mpls_te["interface"] %} -{%- if mpls_te["interface"][protocol_int_name]["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 {{mpls_te["interface"][protocol_int_name]["mpls-te-att-names"]}} +{%- 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 protocol_int_name in mpls_te_frr["interface"] %} -set services infra-crt {{device}} mpls-te-frr junos-core-interface {{aggregate_interface["name"]}} {{aggregate_unit["name"]}} backup-bandwidth {{mpls_te_frr["interface"][protocol_int_name]["backup-bandwidth"]}} +{%- 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 protocol_int_name in rsvp["interface"] %} -set services infra-crt {{device}} rsvp core-interface name {{aggregate_interface["name"]}} {{aggregate_unit["name"]}} core-intf-bandwidth {{rsvp["interface"][protocol_int_name]["core-intf-bandwidth"]}} -set services infra-crt {{device}} rsvp core-interface name {{aggregate_interface["name"]}} {{aggregate_unit["name"]}} core-intf-subscription {{rsvp["interface"][protocol_int_name]["core-intf-subscription"]}} +{%- 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["name"] in service_policy["interface"][aggregate_interface["name"]]["units"] %} +{%- if aggregate_unit["service-policy"] == True %} set services infra-crt {{device}} service-policy core-interface name {{aggregate_interface["name"]}} {{aggregate_unit["name"]}} -{%- if service_policy["interface"][aggregate_interface["name"]]["service-map"] is not none %} -set services infra-crt {{device}} service-policy core-interface name {{aggregate_interface["name"]}} {{aggregate_unit["name"]}} service-map {{service_policy["interface"][aggregate_interface["name"]]["service-map"]}} +{%- 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 service_policy["interface"][aggregate_interface["name"]]["shaper-rate"] is not none %} -set services infra-crt {{device}} service-policy core-interface name {{aggregate_interface["name"]}} {{aggregate_unit["name"]}} shaper-rate {{service_policy["interface"][aggregate_interface["name"]]["shaper-rate"]}} +{%- 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 %} @@ -108,12 +108,14 @@ ERROR: Missing Description for {{aggregate_interface["name"]}} Member-interface 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 #} {%- for key,core_interface in interfaces["core-interface"].items() %} +{%- if core_interface["disabled"] == False %} {% for key,core_unit in core_interface["units"].items() %} -{%- set protocol_int_name = core_interface["name"] ~ '.' ~ core_unit["name"] %} +{%- if core_unit["disabled"] == False %} {%- if core_interface["description"] is not none %} set services infra-crt {{device}} interface core-interface name {{core_interface["name"]}} {{core_unit["name"]}} description {{core_interface["description"]}} {%- endif %} @@ -131,53 +133,55 @@ set services infra-crt {{device}} interface core-interface name {{core_interface {%- endif %} {#- Find Protocols for AE #} {#- ISIS#} -{%- if protocol_int_name in isis["interface"] %} -{%- if isis["interface"][protocol_int_name]["passive"] == True %} +{%- if core_unit["isis"] == True %} +{%- if core_unit["isis-passive"] == True %} set services infra-crt {{device}} isis passive-interface name {{core_interface["name"]}} {{core_unit["name"]}} {%- else %} -set services infra-crt {{device}} isis core-interface name {{core_interface["name"]}} {{core_unit["name"]}} metric {{isis["interface"][protocol_int_name]["metric"]}} -{%- if isis["interface"][protocol_int_name]["enable-bfd"] == True %} +set services infra-crt {{device}} isis core-interface name {{core_interface["name"]}} {{core_unit["name"]}} metric {{core_unit["isis-l2-metric"]}} +{%- if core_unit["isis-inet-enable-bfd"] == True %} 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 {{isis["interface"][protocol_int_name]["bfd-interval"]}} -set services infra-crt {{device}} isis core-interface name {{core_interface["name"]}} {{core_unit["name"]}} bfd-multiplier {{isis["interface"][protocol_int_name]["bfd-multiplier"]}} +set services infra-crt {{device}} isis core-interface name {{core_interface["name"]}} {{core_unit["name"]}} bfd-min-interval {{core_unit["isis-inet-bfd-interval"]}} +set services infra-crt {{device}} isis core-interface name {{core_interface["name"]}} {{core_unit["name"]}} bfd-multiplier {{core_unit["isis-inet-bfd-multiplier"]}} {%- else %} set services infra-crt {{device}} isis core-interface name {{core_interface["name"]}} {{core_unit["name"]}} enable-bfd false {%- endif %} {%- endif %} {%- endif %} {#- LDP #} -{%- if protocol_int_name in ldp["interface"] %} +{%- if core_unit["ldp"] == True %} set services infra-crt {{device}} ldp core-interface name {{core_interface["name"]}} {{core_unit["name"]}} {%- endif %} {#- MPLS-TE #} -{%- if protocol_int_name in mpls_te["interface"] %} -{%- if mpls_te["interface"][protocol_int_name]["mpls-te-att-names"] is not none %} -set services infra-crt {{device}} mpls-te core-interface name {{core_interface["name"]}} {{core_unit["name"]}} mpls-te-att-names {{mpls_te["interface"][protocol_int_name]["mpls-te-att-names"]}} +{%- 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 protocol_int_name in mpls_te_frr["interface"] %} -set services infra-crt {{device}} mpls-te-frr junos-core-interface {{core_interface["name"]}} {{core_unit["name"]}} backup-bandwidth {{mpls_te_frr["interface"][protocol_int_name]["backup-bandwidth"]}} +{%- 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 protocol_int_name in rsvp["interface"] %} -set services infra-crt {{device}} rsvp core-interface name {{core_interface["name"]}} {{core_unit["name"]}} core-intf-bandwidth {{rsvp["interface"][protocol_int_name]["core-intf-bandwidth"]}} -set services infra-crt {{device}} rsvp core-interface name {{core_interface["name"]}} {{core_unit["name"]}} core-intf-subscription {{rsvp["interface"][protocol_int_name]["core-intf-subscription"]}} +{%- 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["name"] in service_policy["interface"][core_interface["name"]]["units"] %} +{%- if core_unit["service-policy"] == True %} set services infra-crt {{device}} service-policy core-interface name {{core_interface["name"]}} {{core_unit["name"]}} -{%- if service_policy["interface"][core_interface["name"]]["service-map"] is not none %} -set services infra-crt {{device}} service-policy core-interface name {{core_interface["name"]}} {{core_unit["name"]}} service-map {{service_policy["interface"][core_interface["name"]]["service-map"]}} +{%- 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 service_policy["interface"][core_interface["name"]]["shaper-rate"] is not none %} -set services infra-crt {{device}} service-policy core-interface name {{core_interface["name"]}} {{core_unit["name"]}} shaper-rate {{service_policy["interface"][core_interface["name"]]["shaper-rate"]}} +{%- 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 %}