From 072d3812bc2db8fedc27ae110575683dc87dcaf1 Mon Sep 17 00:00:00 2001 From: Daniel Ankers Date: Thu, 1 Feb 2024 14:18:59 +0000 Subject: [PATCH] Add sflow configuration --- juniper-macros.j2 | 14 ++++++++++++++ juniper-vxlan.j2 | 1 + 2 files changed, 15 insertions(+) diff --git a/juniper-macros.j2 b/juniper-macros.j2 index b84bd7b..37952d7 100644 --- a/juniper-macros.j2 +++ b/juniper-macros.j2 @@ -305,6 +305,20 @@ routing-options { {%- 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) %} vlans { {# This next line selects all of the VLANs which are configured on this device #} diff --git a/juniper-vxlan.j2 b/juniper-vxlan.j2 index b742e91..4106ef8 100644 --- a/juniper-vxlan.j2 +++ b/juniper-vxlan.j2 @@ -41,6 +41,7 @@ protocols { lldp { interface all; } +{{ junos.sflowsection(device) }} } {% if device_role['name'] == 'Leaf' %} switch-options {