Skip to content

Commit 1854453

Browse files
MichelMoriniauxlguohan
authored andcommitted
[FRR] Enable SNMP support (#2981)
This is a follow-up of sonic-snmpagent PR 92 Now that licensing issues have been solved FRR is distributed with SNMP support compiled-in. This PR adds the last bits of configuration to get the frr-snmp debian packages added to the docker container and the config bits to enable the snmp module in FRR This PR brings the functionality of being able to poll bgpd for routes and peer status. Signed-off-by: Michel Moriniaux <[email protected]>
1 parent c67c29f commit 1854453

File tree

10 files changed

+30
-5
lines changed

10 files changed

+30
-5
lines changed

dockers/docker-fpm-frr/Dockerfile.j2

+1
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,6 @@ RUN rm -rf /debs ~/.cache
4141
COPY ["bgpcfgd", "start.sh", "/usr/bin/"]
4242
COPY ["*.j2", "/usr/share/sonic/templates/"]
4343
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
44+
COPY ["snmp.conf", "/etc/snmp/frr.conf"]
4445

4546
ENTRYPOINT ["/usr/bin/supervisord"]

dockers/docker-fpm-frr/bgpd.conf.j2

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ hostname {{ DEVICE_METADATA['localhost']['hostname'] }}
1111
password zebra
1212
log syslog informational
1313
log facility local4
14+
agentx
1415
! enable password {# {{ en_passwd }} TODO: param needed #}
1516
{% endblock system_init %}
1617
!

dockers/docker-fpm-frr/frr.conf.j2

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ hostname {{ DEVICE_METADATA['localhost']['hostname'] }}
1111
password zebra
1212
log syslog informational
1313
log facility local4
14+
agentx
1415
! enable password {# {{ en_passwd }} TODO: param needed #}
1516
{% endblock system_init %}
1617
!

dockers/docker-fpm-frr/snmp.conf

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This line allows the FRR docker to speak with the snmp container
2+
# Make sure this line matches the one in the snmp docker
3+
# snmp:/etc/snmp/snmpd.conf
4+
# To verify this works you need to have a valid bgp daemon running and configured
5+
# Check that a snmpwalk to 1.3.6.1.2.1.15 gives an output
6+
# Further verification: 1.3.6.1.2.1.15.2.0 = INTEGER: 65000 the returned value should be the confiugred ASN
7+
agentXSocket tcp:localhost:3161

dockers/docker-fpm-frr/supervisord.conf

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ stdout_logfile=syslog
3131
stderr_logfile=syslog
3232

3333
[program:zebra]
34-
command=/usr/lib/frr/zebra -A 127.0.0.1 -s 90000000 -M fpm
34+
command=/usr/lib/frr/zebra -A 127.0.0.1 -s 90000000 -M fpm -M snmp
3535
priority=4
3636
autostart=false
3737
autorestart=false
@@ -49,7 +49,7 @@ stdout_logfile=syslog
4949
stderr_logfile=syslog
5050

5151
[program:bgpd]
52-
command=/usr/lib/frr/bgpd -A 127.0.0.1
52+
command=/usr/lib/frr/bgpd -A 127.0.0.1 -M snmp
5353
priority=5
5454
stopsignal=KILL
5555
autostart=false

dockers/docker-snmp-sv2/snmpd.conf.j2

+8
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,14 @@ load 12 10 5
118118
#
119119
# Run as an AgentX master agent
120120
master agentx
121+
# internal socket to allow extension to other docker containers
122+
# Currently the other container using this is docker-fpm-frr
123+
# make sure this line matches bgp:/etc/snmp/frr.conf
124+
# please see testing procedure in the same file to verify this works
125+
# to verify the SNMP docker side look for the following string in the log file:
126+
# INFO snmp-subagent [ax_interface] INFO: Using agentx socket type tcp with path tcp:localhost:3161
127+
# INFO supervisord snmp-subagent INFO:ax_interface:Using agentx socket type tcp with path tcp:localhost:3161
128+
agentxsocket tcp:localhost:3161
121129

122130
#
123131
# SysDescription pass-through

rules/docker-fpm-frr.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
DOCKER_FPM_FRR = docker-fpm-frr.gz
44
$(DOCKER_FPM_FRR)_PATH = $(DOCKERS_PATH)/docker-fpm-frr
5-
$(DOCKER_FPM_FRR)_DEPENDS += $(FRR) $(SWSS) $(LIBYANG)
5+
$(DOCKER_FPM_FRR)_DEPENDS += $(FRR) $(FRR_SNMP) $(SWSS) $(LIBYANG)
66
$(DOCKER_FPM_FRR)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_STRETCH)
77
SONIC_DOCKER_IMAGES += $(DOCKER_FPM_FRR)
88

rules/frr.mk

+7-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,10 @@ $(eval $(call add_derived_package,$(FRR),$(FRR_PYTHONTOOLS)))
1818
FRR_DBG = frr-dbgsym_$(FRR_VERSION)-sonic-$(FRR_SUBVERSION)_amd64.deb
1919
$(eval $(call add_derived_package,$(FRR),$(FRR_DBG)))
2020

21-
export FRR FRR_PYTHONTOOLS FRR_DBG
21+
FRR_SNMP = frr-snmp_$(FRR_VERSION)-sonic-$(FRR_SUBVERSION)_amd64.deb
22+
$(eval $(call add_derived_package,$(FRR),$(FRR_SNMP)))
23+
24+
FRR_SNMP_DBG = frr-snmp-dbgsym_$(FRR_VERSION)-sonic-$(FRR_SUBVERSION)_amd64.deb
25+
$(eval $(call add_derived_package,$(FRR),$(FRR_SNMP_DBG)))
26+
27+
export FRR FRR_PYTHONTOOLS FRR_DBG FRR_SNMP FRR_SNMP_DBG

src/sonic-config-engine/tests/sample_output/frr.conf

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ hostname switch-t0
88
password zebra
99
log syslog informational
1010
log facility local4
11+
agentx
1112
! enable password !
1213
! Enable link-detect (default disabled)
1314
interface PortChannel01

src/sonic-frr/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ SHELL = /bin/bash
33
.SHELLFLAGS += -e
44

55
MAIN_TARGET = $(FRR)
6-
DERIVED_TARGET = $(FRR_PYTHONTOOLS) $(FRR_DBG)
6+
DERIVED_TARGET = $(FRR_PYTHONTOOLS) $(FRR_DBG) $(FRR_SNMP) $(FRR_SNMP_DBG)
77

88
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
99
# Build the package

0 commit comments

Comments
 (0)