From 24338081242366c3bb74242c74fb1835a36dc1b5 Mon Sep 17 00:00:00 2001 From: Jonathan Dale Date: Thu, 27 Mar 2025 19:42:26 -0400 Subject: [PATCH] Add templates to repo --- .gitignore | 2 +- templates/BDR-telemetry_and_NAT_logger.config | 24 +++++++ templates/infra-crt-NSO.config | 69 +++++++++++++++++++ 3 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 templates/BDR-telemetry_and_NAT_logger.config create mode 100644 templates/infra-crt-NSO.config diff --git a/.gitignore b/.gitignore index e22d43a..4fd6ddb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ # Project Specific output/* input/* -templates/* +#templates/* # testing files test-* diff --git a/templates/BDR-telemetry_and_NAT_logger.config b/templates/BDR-telemetry_and_NAT_logger.config new file mode 100644 index 0000000..0c189a8 --- /dev/null +++ b/templates/BDR-telemetry_and_NAT_logger.config @@ -0,0 +1,24 @@ +!!!!!!!! +!! {{Hostname}} +!!!!!!!! +! +vrf definition iONE_MGT + rd {{Lo0_IPv4}}:300 + route-target export 22351:300 + route-target import 22351:300 + ! + address-family ipv4 + exit-address-family +! +interface Loopback300 + description {{Hostname}}_lo300 - NetFlow telemetry source + vrf forwarding iONE_MGT + ip address {{Lo300_IPv4}} 255.255.255.255 +! +router bgp 22351 + address-family ipv4 vrf iONE_MGT + network {{Lo300_IPv4}} mask 255.255.255.255 + exit-address-family +! +ip nat log translations flow-export v9 udp destination {{Collector}} 2056 vrf iONE_MGT source Loopback300 +! diff --git a/templates/infra-crt-NSO.config b/templates/infra-crt-NSO.config new file mode 100644 index 0000000..9d35121 --- /dev/null +++ b/templates/infra-crt-NSO.config @@ -0,0 +1,69 @@ +{# +Declare Lo0.0 and all common protocols for a Core router +Lo0.0 must be declared and created before protocols can be applied +Protocols for the Lo0.0 are automatically handled by the common packages + #} + +{% for loopback_unit in device_info["interface"]["loopback-interface"]["lo0"]["units"] %} + set services infra-crt {{device_info["device"]}} interface loopback-interface lo0 {{loopback_unit["name"]}} skip-loopback-check true + {% if loopback_unit["description"] not None %} + set services infra-crt {{device_info["device"]}} interface loopback-interface lo0 {{loopback_unit["name"]}} description {{loopback_unit["description"]}} + {% if loopback_unit["inet4"] not None %} + 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 #} +{% for aggregate_interface in device_info["interface"]["aggregate-interface"] %} + {% set ae_num = aggregate_interface["name"] | replace('ae', '') %} + {% for aggregate_unit in aggregate_interface["units"] %} + {% if aggregate_unit["mtu"] not None %} + set services infra-crt {{device_info["device"]}} interface aggregate-interface {{ae_num}} {{aggregate_unit["name"]}} mtu {{aggregate_unit["mtu"]}} + {% if aggregate_unit["inet4"] not None %} + set services infra-crt {{device_info["device"]}} interface aggregate-interface {{ae_num}} {{aggregate_unit["name"]}} ipv4 {{aggregate_unit["inet4"]}} + {% if aggregate_unit["description"] not None %} + set services infra-crt {{device_info["device"]}} interface aggregate-interface {{ae_num}} {{aggregate_unit["name"]}} description {{aggregate_unit["description"]}} + {% for core_interface in aggregate_interface["units"] %} + {% if core_interface["description"] not None %} + set services infra-crt {{device_info["device"]}} interface aggregate-interface {{ae_num}} {{aggregate_unit["name"]}} core-interface {{core_interface["name"]}} description {{aggregate_unit["description"]}} + {% else %} + set services infra-crt {{device_info["device"]}} interface aggregate-interface {{ae_num}} {{aggregate_unit["name"]}} core-interface {{core_interface["name"]}} + +{# Standard core-interface declaration #} +set services infra-crt {{device_info["device"]}} interface core-interface name {{iface_name}} {{unit_num}} ipv4 {{inet4-cidr}} +set services infra-crt {{device_info["device"]}} interface core-interface name {{iface_name}} {{unit_num}} mtu {{mtu}} +set services infra-crt {{device_info["device"]}} interface core-interface name {{iface_name}} {{unit_num}} description {{description}} + + +{# Below protocol delcarations should only be made if the interface was declared #} + +{# Declare protocol LDP per participating interface #} +set services infra-crt {{device_info["device"]}} ldp core-interface name {{iface_name}} {{unit_num}} + +{# Declare protocol ISIS per participating interface - BFD settings only needed if enable-bfd == true #} +set services infra-crt {{device_info["device"]}} isis core-interface name {{iface_name}} {{unit_num}} metric {{metric}} +set services infra-crt {{device_info["device"]}} isis core-interface name {{iface_name}} {{unit_num}} enable-bfd {{enable-bfd}} +set services infra-crt {{device_info["device"]}} isis core-interface name {{iface_name}} {{unit_num}} bfd-min-interval {{bfd-interval}} +set services infra-crt {{device_info["device"]}} isis core-interface name {{iface_name}} {{unit_num}} bfd-multiplier {{bfd-multiplier}} + +{# Declare protocol RSVP per participating interface #} +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_info["device"]}} rsvp core-interface name {{iface_name}} {{unit_num}} core-intf-subscription {{core-intf-subscription}} + +{# Declare Service-Policy per interface -- truncate service-map and shaper-rate if values are null ?? #} +set services infra-crt {{device_info["device"]}} service-policy core-interface name {{iface_name}} {{unit_num}} +set services infra-crt {{device_info["device"]}} service-policy core-interface name {{iface_name}} {{unit_num}} service-map {{service-map}} +set services infra-crt {{device_info["device"]}} service-policy core-interface name {{iface_name}} {{unit_num}} shaper-rate {{shaper-rate}} + +{# Declare MPLS-TE per participating Interface - Truncate line if mpls-te-att-names is null #} +set services infra-crt {{device_info["device"]}} mpls-te core-interface name {{iface_name}} {{unit_num}} +set services infra-crt {{device_info["device"]}} mpls-te core-interface name {{iface_name}} {{unit_num}} mpls-te-att-names [ {{mpls-te-att-names}} ] + +{# Declare MPLS-TE-FRR per participating interface #} +set services infra-crt {{device_info["device"]}} mpls-te-frr junos-core-interface {{iface_name}} {{unit_num}} backup-bandwidth {{backup-bandwidth}}