BGP Router Manager templates for Voneus core and aggregation infrastructure
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

186 lines
5.6 KiB

/* generated by bgprtrmgr using junos-v21-core-router.j2 at XXX */
{% import "macros.j2" as macros %}
version 21.3R1.9;
groups {
{%- set re_groups = [] %}
{%- set lag_interfaces = [] %}
{%- for interface, subinterfaces in device|get_interfaces|subinterfaces(".") %}
{%- if interface.type.value == 'lag' %}{%- do lag_interfaces.append(interface) %}{%- endif %}
{%- if '@' in interface.name %}
{%- set re = interface.name.split("@")[1] %}
{%- do re_groups.append( re ) %}
{%- set interface_name = interface.name.split("@")[0] %}
{%- set interface_context = interface.tags|get_netbox_tags_contexts|contexts_merge_last %}
{{ re }} {
system {
host-name {{ re }}.{{ device.name }};
services {
ssh;
}
}
interfaces {
{{ interface_name}} {
unit 0 {
family inet {
{%- for address in interface|get_addresses %}{% if address|ipv4 %}
address {{ address.address }};
{%- endif %}{%- endfor %}
}
}
}
}
}
{%- endif %}
{%- endfor %}
}
apply-groups [ {% for re in re_groups %}{{ re }}{% if not loop.last %} {% endif %}{% endfor %} ];
system {
root-authentication {
encrypted-password "$6$uC87jp7U$04FIKNRT3VcUzqDiaxKVRVqnQM2c48Q2NpIARsSuKVVK7gezNX92B7261QV.kRHg.yswiDhUY.SF4e/qgRNdL0"; ## SECRET-DATA
}
commit synchronize;
login {
user marek.faelix {
full-name "Marek Isalski";
uid 2000;
class super-user;
authentication {
encrypted-password "$6$4sVD2r4y$PjAIeLZ/tJcDhsQekJI9wU2l4xYf8k6mHuzvLivK2tcFXdcHMjP23Up/oUzMRWiVtEW99foiEWuXG40tL5cHy0";
ssh-ed25519 "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM05RD1X1njHcJvPTGbaCkO7rssp6T8uTCH3b6Sk4MA9 maz@lifting-shadows";
}
}
}
services {
ssh;
}
authentication-order [ password radius ];
syslog {
file interactive-commands {
interactive-commands any;
}
file messages {
any notice;
authorization info;
}
}
processes {
dhcp-service {
traceoptions {
file dhcp_logfile size 10m;
level all;
flag packet;
}
}
}
}
chassis {
redundancy {
routing-engine 0 master;
routing-engine 1 backup;
}
aggregated-devices {
ethernet {
device-count {{ lag_interfaces|length }};
}
}
fpc 0 {
pic 0 {
number-of-ports 0;
}
pic 1 {
pic-mode 100G;
}
}
}
interfaces {
{%- for interface, subinterfaces in device|get_interfaces|subinterfaces(".") %}
{%- set interface_context = interface.tags|get_netbox_tags_contexts|contexts_merge_last %}
{%- set interface_tags = [] %}
{%- for tag in interface.tags %}
{%- do interface_tags.append(tag.slug) %}
{%- endfor %}
{%- if '@' in interface.name %}
/* groups interface: {{ interface.name }} */
{%- elif interface.mgmt_only %}
/* management interface: {{ interface.name }} */
{%- elif 'no-automation' in interface_tags %}
/* do not configure: {{ interface.name }} */
{% elif interface.lag %}
{{ interface.name }} {
{{ macros.interface_description(interface, interface_context) }}
gigether-options {
802.3ad {{ interface.lag.name }};
}
{%- elif interface.name.startswith( 'lo' ) %}
{{ interface.name }} {
{{ macros.interface_description(interface, interface_context) }}
{%- elif interface.type.value == 'lag' %}
{{ interface.name }} {
vlan-tagging;
aggregated-ether-options {
minimum-links 1;
link-speed 100g;
}
{{ macros.interface_description(interface, interface_context) }}
{# interface_common(interface, interface_context) #}
{%- elif interface.type.value != 'virtual' %}
{{ interface.name }} {
{{ macros.interface_description(interface) }}
{%- if interface.mode.value == 'access' %}
unit 0 {
{# interface_vrf(interface, interface_context) #}
{# interface_common(interface, interface_context) #}
{{ macros.interface_addresses(interface, interface_context) }}
}
{%- elif interface.mode.value == 'tagged' %}
vlan-tagging;
{%- endif %}
{%- endif %}
{%- if ( not interface.mgmt_only ) and ( 'no-automation' not in interface_tags ) and ( '@' not in interface.name ) %}
{%- for tagged_vlan in interface.tagged_vlans %}{%- endfor %}
{%- if interface.mode.value == 'tagged' %}
{%- for unit, subinterface in subinterfaces %}
unit {{ unit }} {
{%- if subinterface.untagged_vlan %}
vlan-id {{ subinterface.untagged_vlan.vid }};
{%- elif unit|int %}
vlan-id {{ unit }};
{%- endif %}
{%- set subinterface_context = subinterface.tags|get_netbox_tags_contexts|contexts_merge_last %}
{# interface_vrf(subinterface, subinterface_context) #}
{# interface_common(subinterface, subinterface_context) #}
{{ macros.interface_addresses(subinterface, subinterface_context) }}
}
{%- endfor %}
{%- endif %}
}
{%- endif %}
{%- endfor %}
fxp0 {
unit 0;
}
}
routing-options {
static {
{%- for (route, route_data) in device.config_context.get('routes',{}).items() %}
route {{ route }} next-hop {{ route_data.get('next-hop', None) }};
{%- endfor %}
}
}