Compare commits

...

2 Commits

Author SHA1 Message Date
Daniel Ankers 072d3812bc Add sflow configuration 2024-02-01 14:18:59 +00:00
Daniel Ankers 6ef28c7c95 Try to fix hostname not showing in config 2024-02-01 14:06:49 +00:00
2 changed files with 18 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{% macro systemsection(device) %} {% macro systemsection(device,name) %}
system { system {
host-name {{ device['name'] }}; host-name {{ name }};
root-authentication { root-authentication {
encrypted-password "{{ device['config_context']['root_pw'] }}"; ## Client Higher encrypted-password "{{ device['config_context']['root_pw'] }}"; ## Client Higher
} }
@ -305,6 +305,20 @@ routing-options {
{%- endmacro %} {%- endmacro %}
{% macro sflowsection(device) %}
{% if device['config_context']['sflow'] %}
sflow {
{% for collector in device['config_context']['sflow']['collectors'] %}
collector {{ collector }};
{% endfor %}
{% for interface in device['config_context']['sflow']['interfaces'] %}
interface {{ interface }};
{% endfor %}
}
{% endif %}
{%- endmacro %}
{% macro vlanssection(vlans,device) %} {% macro vlanssection(vlans,device) %}
vlans { vlans {
{# This next line selects all of the VLANs which are configured on this device #} {# This next line selects all of the VLANs which are configured on this device #}

View File

@ -1,6 +1,6 @@
{% set device=({'name':name,'device_role':device_role,'primary_ip4':primary_ip4,'rack':rack,'interfaces':interfaces,'peering_interfaces':peering_interfaces,'config_context':config_context}) %} {% set device=({'name':name,'device_role':device_role,'primary_ip4':primary_ip4,'rack':rack,'interfaces':interfaces,'peering_interfaces':peering_interfaces,'config_context':config_context}) %}
{% import "juniper-macros.j2" as junos %} {% import "juniper-macros.j2" as junos %}
{{ junos.systemsection(device) }} {{ junos.systemsection(device,name) }}
{% if device_role['name'] == 'Leaf' %} {% if device_role['name'] == 'Leaf' %}
{{ junos.chassissection(device) }} {{ junos.chassissection(device) }}
{% endif %} {% endif %}
@ -41,6 +41,7 @@ protocols {
lldp { lldp {
interface all; interface all;
} }
{{ junos.sflowsection(device) }}
} }
{% if device_role['name'] == 'Leaf' %} {% if device_role['name'] == 'Leaf' %}
switch-options { switch-options {