Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[frrcfgd] Support for FRR configuration based on config DB events #5142

Merged
merged 33 commits into from
Jan 25, 2021
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
47f5736
Initial commit for adding non-template bgpcfgd script
zhaozhenhong Aug 10, 2020
154ec12
Reomved not needed config file
zhaozhenhong Aug 10, 2020
288986c
Added update on setup.py
zhaozhenhong Aug 14, 2020
2a5c58e
Merge branch 'master' of https://github.com/Azure/sonic-buildimage in…
zhaozhenhong Aug 24, 2020
e942575
Fixed for erasing LGTM alert and other minor issues
zhaozhenhong Aug 25, 2020
9c94d03
Changed to erase new lgtm alerts
zhaozhenhong Aug 25, 2020
b12cde3
Merge branch 'master' of https://github.com/zhaozhenhong/sonic-buildi…
Dec 18, 2020
d86c52d
Merge branch 'master' of https://github.com/Azure/sonic-buildimage in…
Dec 24, 2020
b0fdaf2
Merge branch 'master' of https://github.com/Azure/sonic-buildimage in…
Dec 26, 2020
792268a
Merge branch 'master' of https://github.com/Azure/sonic-buildimage in…
Dec 27, 2020
2637566
Added new package for FRR configuration daemon
Dec 28, 2020
a41d8dd
Put template files into frrcfgd package
Dec 29, 2020
609bcb7
Removed not needed and temporary files
Dec 29, 2020
64561d6
Fixed setup.py not copying un-needed template file
Dec 29, 2020
0299bf3
Added critical process list switch and fix issue related to python3 m…
Dec 30, 2020
a38469a
Replaced python3 un-compatible function
Dec 30, 2020
0227421
Added UT scripts and fixed minor issues in frrcfgd
Dec 31, 2020
ecd1e2e
Changed according to code review comment
Jan 5, 2021
30b68c9
Added jinja template to generate critical_processes list based on dev…
Jan 7, 2021
0160efb
Fixed minor issue of indentation
Jan 7, 2021
73354aa
Added UT cases to test FRR command mapping
Jan 8, 2021
d674c82
Merge branch 'master' of https://github.com/Azure/sonic-buildimage in…
Jan 8, 2021
3abb609
Used new bash command substitution format to replace outdated one
Jan 8, 2021
fa86ed0
Merge branch 'master' of https://github.com/Azure/sonic-buildimage in…
Jan 12, 2021
cf341e9
Changed to avoid calling sonic-cfggen twice
Jan 13, 2021
da9a9a1
Added frr.conf generation with frr_mgmt_framework_config set to suppo…
Jan 13, 2021
e5874c1
Added comment to FRR conf template
Jan 13, 2021
e92997c
Changed according code review comment
Jan 14, 2021
3b49d23
Fixed include template file issue
Jan 15, 2021
ee973b5
Fixed inlcuded template not found issue
Jan 15, 2021
99629bb
Merge branch 'master' of https://github.com/Azure/sonic-buildimage in…
Jan 19, 2021
6a693f4
Merge branch 'master' of https://github.com/Azure/sonic-buildimage in…
Jan 22, 2021
6e6dde5
Changed the target folder name of frrcfgd template files
Jan 22, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion dockers/docker-fpm-frr/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ COPY ["TSA", "/usr/bin/TSA"]
COPY ["TSB", "/usr/bin/TSB"]
COPY ["TSC", "/usr/bin/TSC"]
COPY ["files/supervisor-proc-exit-listener", "/usr/bin"]
COPY ["critical_processes", "/etc/supervisor"]
RUN chmod a+x /usr/bin/TSA && \
chmod a+x /usr/bin/TSB && \
chmod a+x /usr/bin/TSC
Expand Down
5 changes: 0 additions & 5 deletions dockers/docker-fpm-frr/critical_processes

This file was deleted.

22 changes: 18 additions & 4 deletions dockers/docker-fpm-frr/docker_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,31 @@
mkdir -p /etc/frr
mkdir -p /etc/supervisor/conf.d

MGMT_FRAMEWORK_CONFIG=`sonic-cfggen -d -v 'DEVICE_METADATA["localhost"]["frr_mgmt_framework_config"]'`
zhaozhenhong marked this conversation as resolved.
Show resolved Hide resolved
CFGGEN_PARAMS=" \
-d \
-y /etc/sonic/constants.yml \
-t /usr/share/sonic/templates/supervisord/frr_vars.j2 \
-t /usr/share/sonic/templates/frr_vars.j2 \
-t /usr/share/sonic/templates/supervisord/supervisord.conf.j2,/etc/supervisor/conf.d/supervisord.conf \
-t /usr/share/sonic/templates/bgpd/bgpd.conf.j2,/etc/frr/bgpd.conf \
-t /usr/share/sonic/templates/supervisord/critical_processes.j2,/etc/supervisor/critical_processes \
-t /usr/share/sonic/templates/zebra/zebra.conf.j2,/etc/frr/zebra.conf \
-t /usr/share/sonic/templates/staticd/staticd.conf.j2,/etc/frr/staticd.conf \
-t /usr/share/sonic/templates/frr.conf.j2,/etc/frr/frr.conf \
-t /usr/share/sonic/templates/isolate.j2,/usr/sbin/bgp-isolate \
-t /usr/share/sonic/templates/unisolate.j2,/usr/sbin/bgp-unisolate \
"
if [ -n "$MGMT_FRAMEWORK_CONFIG" ] && [ "$MGMT_FRAMEWORK_CONFIG" == "true" ]; then
CFGGEN_PARAMS+=" \
-t /usr/local/frr/staticd/staticd.conf.j2,/etc/frr/staticd.conf \
-t /usr/local/frr/bgpd/bgpd.conf.j2,/etc/frr/bgpd.conf \
-t /usr/local/frr/bfdd/bfdd.conf.j2,/etc/frr/bfdd.conf \
-t /usr/local/frr/ospfd/ospfd.conf.j2,/etc/frr/ospfd.conf \
"
else
CFGGEN_PARAMS+=" \
-t /usr/share/sonic/templates/bgpd/bgpd.conf.j2,/etc/frr/bgpd.conf \
-t /usr/share/sonic/templates/staticd/staticd.conf.j2,/etc/frr/staticd.conf \
zhaozhenhong marked this conversation as resolved.
Show resolved Hide resolved
"
fi
CONFIG_TYPE=$(sonic-cfggen $CFGGEN_PARAMS)

update_default_gw()
Expand Down Expand Up @@ -52,7 +65,8 @@ if [ -z "$CONFIG_TYPE" ] || [ "$CONFIG_TYPE" == "separated" ]; then
rm -f /etc/frr/frr.conf
elif [ "$CONFIG_TYPE" == "unified" ]; then
echo "service integrated-vtysh-config" > /etc/frr/vtysh.conf
rm -f /etc/frr/bgpd.conf /etc/frr/zebra.conf /etc/frr/staticd.conf
rm -f /etc/frr/bgpd.conf /etc/frr/zebra.conf /etc/frr/staticd.conf \
/etc/frr/bfdd.conf /etc/frr/ospfd.conf /etc/frr/pimd.conf
fi

chown -R frr:frr /etc/frr/
Expand Down
12 changes: 12 additions & 0 deletions dockers/docker-fpm-frr/frr/supervisord/critical_processes.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
program:zebra
program:staticd
program:bgpd
program:fpmsyncd
{% if DEVICE_METADATA.localhost.frr_mgmt_framework_config is defined and DEVICE_METADATA.localhost.frr_mgmt_framework_config == "true" %}
program:bfdd
program:ospfd
program:pimd
program:frrcfgd
{% else %}
program:bgpcfgd
{% endif %}
45 changes: 45 additions & 0 deletions dockers/docker-fpm-frr/frr/supervisord/supervisord.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,20 @@ stderr_logfile=syslog
dependent_startup=true
dependent_startup_wait_for=zebra:running

{% if DEVICE_METADATA.localhost.frr_mgmt_framework_config is defined and DEVICE_METADATA.localhost.frr_mgmt_framework_config == "true" %}
[program:bfdd]
command=/usr/lib/frr/bfdd -A 127.0.0.1
priority=4
stopsignal=KILL
autostart=false
autorestart=false
startsecs=0
stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true
dependent_startup_wait_for=zebra:running
{% endif %}

[program:bgpd]
command=/usr/lib/frr/bgpd -A 127.0.0.1 -M snmp
priority=5
Expand All @@ -62,6 +76,32 @@ stderr_logfile=syslog
dependent_startup=true
dependent_startup_wait_for=zebra:running

{% if DEVICE_METADATA.localhost.frr_mgmt_framework_config is defined and DEVICE_METADATA.localhost.frr_mgmt_framework_config == "true" %}
[program:ospfd]
command=/usr/lib/frr/ospfd -A 127.0.0.1 -M snmp
priority=5
stopsignal=KILL
autostart=false
autorestart=false
startsecs=0
stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true
dependent_startup_wait_for=zebra:running

[program:pimd]
command=/usr/lib/frr/pimd -A 127.0.0.1
priority=5
stopsignal=KILL
autostart=false
autorestart=false
startsecs=0
stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true
dependent_startup_wait_for=zebra:running
{% endif %}

[program:fpmsyncd]
command=fpmsyncd
priority=6
Expand All @@ -73,8 +113,13 @@ stderr_logfile=syslog
dependent_startup=true
dependent_startup_wait_for=bgpd:running

{% if DEVICE_METADATA.localhost.frr_mgmt_framework_config is defined and DEVICE_METADATA.localhost.frr_mgmt_framework_config == "true" %}
[program:frrcfgd]
command=/usr/local/bin/frrcfgd
{% else %}
[program:bgpcfgd]
command=/usr/local/bin/bgpcfgd
{% endif %}
priority=6
autostart=false
autorestart=false
Expand Down
2 changes: 1 addition & 1 deletion rules/docker-fpm-frr.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DOCKER_FPM_FRR = $(DOCKER_FPM_FRR_STEM).gz
DOCKER_FPM_FRR_DBG = $(DOCKER_FPM_FRR_STEM)-$(DBG_IMAGE_MARK).gz

$(DOCKER_FPM_FRR)_PATH = $(DOCKERS_PATH)/$(DOCKER_FPM_FRR_STEM)
$(DOCKER_FPM_FRR)_PYTHON_WHEELS += $(SONIC_BGPCFGD)
$(DOCKER_FPM_FRR)_PYTHON_WHEELS += $(SONIC_BGPCFGD) $(SONIC_FRR_MGMT_FRAMEWORK)

$(DOCKER_FPM_FRR)_DEPENDS += $(FRR) $(FRR_SNMP) $(SWSS) $(LIBYANG1)
$(DOCKER_FPM_FRR)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS)
Expand Down
8 changes: 8 additions & 0 deletions rules/sonic-frr-mgmt-framework.dep
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
SPATH := $($(SONIC_FRR_MGMT_FRAMEWORK)_SRC_PATH)
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/sonic-frr-mgmt-framework.mk rules/sonic-frr-mgmt-framework.dep
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
DEP_FILES += $(shell git ls-files $(SPATH))

$(SONIC_FRR_MGMT_FRAMEWORK)_CACHE_MODE := GIT_CONTENT_SHA
$(SONIC_FRR_MGMT_FRAMEWORK)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
$(SONIC_FRR_MGMT_FRAMEWORK)_DEP_FILES := $(DEP_FILES)
13 changes: 13 additions & 0 deletions rules/sonic-frr-mgmt-framework.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# sonic-frr-mgmt-framework package

SONIC_FRR_MGMT_FRAMEWORK = sonic_frr_mgmt_framework-1.0-py3-none-any.whl
$(SONIC_FRR_MGMT_FRAMEWORK)_SRC_PATH = $(SRC_PATH)/sonic-frr-mgmt-framework
# These dependencies are only needed because they are dependencies
# of sonic-config-engine and frrcfgd explicitly calls sonic-cfggen
# as part of its unit tests.
# TODO: Refactor unit tests so that these dependencies are not needed

$(SONIC_FRR_MGMT_FRAMEWORK)_DEPENDS += $(SONIC_CONFIG_ENGINE_PY3)
$(SONIC_FRR_MGMT_FRAMEWORK)_DEBS_DEPENDS += $(PYTHON_SWSSCOMMON)
$(SONIC_FRR_MGMT_FRAMEWORK)_PYTHON_VERSION = 3
SONIC_PYTHON_WHEELS += $(SONIC_FRR_MGMT_FRAMEWORK)
12 changes: 12 additions & 0 deletions src/sonic-frr-mgmt-framework/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.eggs/
build/
dist/
*.egg-info/
frrcfgd/*.pyc
tests/*.pyc
tests/__pycache__/
.idea
.coverage
frrcfgd/__pycache__/
venv
tests/.coverage*
Empty file.