From 237c4f2286ccd677f7dfebd27820a9b96c0b1e0f Mon Sep 17 00:00:00 2001 From: Michel Moriniaux Date: Wed, 19 Jun 2019 01:24:42 -0700 Subject: [PATCH] [FRR] Enable SNMP support (#2981) Merge to 201811 with FRR 4.0 --- dockers/docker-fpm-frr/Dockerfile.j2 | 1 + dockers/docker-fpm-frr/daemons.conf | 4 ++-- dockers/docker-fpm-frr/frr.conf.j2 | 1 + dockers/docker-fpm-frr/snmp.conf | 7 +++++++ dockers/docker-snmp-sv2/snmpd.conf.j2 | 8 ++++++++ rules/docker-fpm-frr.mk | 2 +- rules/frr.mk | 14 ++++++++++++++ .../tests/sample_output/frr.conf | 1 + src/sonic-frr/Makefile | 3 ++- 9 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 dockers/docker-fpm-frr/snmp.conf diff --git a/dockers/docker-fpm-frr/Dockerfile.j2 b/dockers/docker-fpm-frr/Dockerfile.j2 index 6f046af6cf27..4da8bf640d3a 100644 --- a/dockers/docker-fpm-frr/Dockerfile.j2 +++ b/dockers/docker-fpm-frr/Dockerfile.j2 @@ -41,6 +41,7 @@ COPY ["start.sh", "config.sh", "/usr/bin/"] COPY ["daemons", "/etc/frr/"] COPY ["daemons.conf", "/etc/frr/"] COPY ["vtysh.conf", "/etc/frr/"] +COPY ["snmp.conf", "/etc/snmp/frr.conf"] ENTRYPOINT /usr/bin/config.sh \ && /usr/bin/start.sh \ diff --git a/dockers/docker-fpm-frr/daemons.conf b/dockers/docker-fpm-frr/daemons.conf index 33f4acd0ae88..22d5eba80b5a 100644 --- a/dockers/docker-fpm-frr/daemons.conf +++ b/dockers/docker-fpm-frr/daemons.conf @@ -4,8 +4,8 @@ # Check /etc/pam.d/frr if you intend to use "vtysh"! # vtysh_enable=yes -zebra_options=" -s 90000000 --daemon -A 127.0.0.1 -M fpm" -bgpd_options=" --daemon -A 127.0.0.1" +zebra_options=" -s 90000000 --daemon -A 127.0.0.1 -M fpm -M snmp" +bgpd_options=" --daemon -A 127.0.0.1 -M snmp" ospfd_options=" --daemon -A 127.0.0.1" ospf6d_options=" --daemon -A ::1" ripd_options=" --daemon -A 127.0.0.1" diff --git a/dockers/docker-fpm-frr/frr.conf.j2 b/dockers/docker-fpm-frr/frr.conf.j2 index d4fdec897da2..1dc4fc6715af 100644 --- a/dockers/docker-fpm-frr/frr.conf.j2 +++ b/dockers/docker-fpm-frr/frr.conf.j2 @@ -11,6 +11,7 @@ hostname {{ DEVICE_METADATA['localhost']['hostname'] }} password zebra log syslog informational log facility local4 +agentx ! enable password {# {{ en_passwd }} TODO: param needed #} {% endblock system_init %} ! diff --git a/dockers/docker-fpm-frr/snmp.conf b/dockers/docker-fpm-frr/snmp.conf new file mode 100644 index 000000000000..0d875a61fe87 --- /dev/null +++ b/dockers/docker-fpm-frr/snmp.conf @@ -0,0 +1,7 @@ +# This line allows the FRR docker to speak with the snmp container +# Make sure this line matches the one in the snmp docker +# snmp:/etc/snmp/snmpd.conf +# To verify this works you need to have a valid bgp daemon running and configured +# Check that a snmpwalk to 1.3.6.1.2.1.15 gives an output +# Further verification: 1.3.6.1.2.1.15.2.0 = INTEGER: 65000 the returned value should be the confiugred ASN +agentXSocket tcp:localhost:3161 diff --git a/dockers/docker-snmp-sv2/snmpd.conf.j2 b/dockers/docker-snmp-sv2/snmpd.conf.j2 index 6353246acb08..68d08318cb98 100644 --- a/dockers/docker-snmp-sv2/snmpd.conf.j2 +++ b/dockers/docker-snmp-sv2/snmpd.conf.j2 @@ -118,6 +118,14 @@ load 12 10 5 # # Run as an AgentX master agent master agentx +# internal socket to allow extension to other docker containers +# Currently the other container using this is docker-fpm-frr +# make sure this line matches bgp:/etc/snmp/frr.conf +# please see testing procedure in the same file to verify this works +# to verify the SNMP docker side look for the following string in the log file: +# INFO snmp-subagent [ax_interface] INFO: Using agentx socket type tcp with path tcp:localhost:3161 +# INFO supervisord snmp-subagent INFO:ax_interface:Using agentx socket type tcp with path tcp:localhost:3161 +agentxsocket tcp:localhost:3161 # # SysDescription pass-through diff --git a/rules/docker-fpm-frr.mk b/rules/docker-fpm-frr.mk index f9a858611fa1..6ddf8353d06b 100644 --- a/rules/docker-fpm-frr.mk +++ b/rules/docker-fpm-frr.mk @@ -2,7 +2,7 @@ DOCKER_FPM_FRR = docker-fpm-frr.gz $(DOCKER_FPM_FRR)_PATH = $(DOCKERS_PATH)/docker-fpm-frr -$(DOCKER_FPM_FRR)_DEPENDS += $(FRR) $(SWSS) +$(DOCKER_FPM_FRR)_DEPENDS += $(FRR) $(FRR_SNMP) $(SWSS) $(DOCKER_FPM_FRR)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE) SONIC_DOCKER_IMAGES += $(DOCKER_FPM_FRR) diff --git a/rules/frr.mk b/rules/frr.mk index 2b7cc1fa14e4..691967673b03 100644 --- a/rules/frr.mk +++ b/rules/frr.mk @@ -7,3 +7,17 @@ FRR = frr_$(FRR_VERSION)-1~sonic.debian8+1_amd64.deb $(FRR)_DEPENDS += $(LIBSNMP_DEV) $(FRR)_SRC_PATH = $(SRC_PATH)/sonic-frr SONIC_MAKE_DEBS += $(FRR) + +FRR_PYTHONTOOLS = frr-pythontools_$(FRR_VERSION)-sonic-$(FRR_SUBVERSION)_all.deb +$(eval $(call add_derived_package,$(FRR),$(FRR_PYTHONTOOLS))) + +FRR_DBG = frr-dbgsym_$(FRR_VERSION)-sonic-$(FRR_SUBVERSION)_amd64.deb +$(eval $(call add_derived_package,$(FRR),$(FRR_DBG))) + +FRR_SNMP = frr-snmp_$(FRR_VERSION)-sonic-$(FRR_SUBVERSION)_amd64.deb +$(eval $(call add_derived_package,$(FRR),$(FRR_SNMP))) + +FRR_SNMP_DBG = frr-snmp-dbgsym_$(FRR_VERSION)-sonic-$(FRR_SUBVERSION)_amd64.deb +$(eval $(call add_derived_package,$(FRR),$(FRR_SNMP_DBG))) + +export FRR FRR_PYTHONTOOLS FRR_DBG FRR_SNMP FRR_SNMP_DBG diff --git a/src/sonic-config-engine/tests/sample_output/frr.conf b/src/sonic-config-engine/tests/sample_output/frr.conf index 7ea45508f236..56d7122186b2 100644 --- a/src/sonic-config-engine/tests/sample_output/frr.conf +++ b/src/sonic-config-engine/tests/sample_output/frr.conf @@ -8,6 +8,7 @@ hostname switch-t0 password zebra log syslog informational log facility local4 +agentx ! enable password ! ! Enable link-detect (default disabled) interface PortChannel01 diff --git a/src/sonic-frr/Makefile b/src/sonic-frr/Makefile index d2b9bf4bd142..2adf93afff75 100644 --- a/src/sonic-frr/Makefile +++ b/src/sonic-frr/Makefile @@ -2,7 +2,8 @@ SHELL = /bin/bash .SHELLFLAGS += -e -MAIN_TARGET = frr_$(FRR_VERSION)-1~sonic.debian8+1_amd64.deb +MAIN_TARGET = $(FRR) +DERIVED_TARGET = $(FRR_PYTHONTOOLS) $(FRR_DBG) $(FRR_SNMP) $(FRR_SNMP_DBG) $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :