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 17 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 41 additions & 12 deletions dockers/docker-fpm-frr/docker_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,46 @@
mkdir -p /etc/frr
mkdir -p /etc/supervisor/conf.d

CFGGEN_PARAMS=" \
-d \
-y /etc/sonic/constants.yml \
-t /usr/share/sonic/templates/supervisord/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/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 \
"
MGMT_FRAMEWORK_CONFIG=`sonic-cfggen -d -v 'DEVICE_METADATA["localhost"]["frr_mgmt_framework_config"]'`
zhaozhenhong marked this conversation as resolved.
Show resolved Hide resolved
CRIT_PROC_BACKUP="/usr/local/frr/supervisord/critical_processes.bak"
zhaozhenhong marked this conversation as resolved.
Show resolved Hide resolved
if [ -n "$MGMT_FRAMEWORK_CONFIG" ] && [ "$MGMT_FRAMEWORK_CONFIG" == "true" ]; then
CFGGEN_PARAMS=" \
-d \
-y /etc/sonic/constants.yml \
-t /usr/share/sonic/templates/frr_vars.j2 \
-t /usr/local/frr/supervisord/supervisord.conf.j2,/etc/supervisor/conf.d/supervisord.conf \
-t /usr/local/frr/bgpd/bgpd.conf.j2,/etc/frr/bgpd.conf \
-t /usr/share/sonic/templates/zebra/zebra.conf.j2,/etc/frr/zebra.conf \
-t /usr/local/frr/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 \
-t /usr/local/frr/bfdd/bfdd.conf.j2,/etc/frr/bfdd.conf \
-t /usr/local/frr/ospfd/ospfd.conf.j2,/etc/frr/ospfd.conf \
"
if [ ! -f $CRIT_PROC_BACKUP ]; then
mv /etc/supervisor/critical_processes $CRIT_PROC_BACKUP
fi
# change critical process list with those of enterprise release
cp /usr/local/frr/supervisord/critical_processes /etc/supervisor
else
CFGGEN_PARAMS=" \
-d \
-y /etc/sonic/constants.yml \
-t /usr/share/sonic/templates/supervisord/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/zebra/zebra.conf.j2,/etc/frr/zebra.conf \
-t /usr/share/sonic/templates/staticd/staticd.conf.j2,/etc/frr/staticd.conf \
zhaozhenhong marked this conversation as resolved.
Show resolved Hide resolved
-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 [ -f $CRIT_PROC_BACKUP ]; then
# restore original critical process list for community release
mv -f $CRIT_PROC_BACKUP /etc/supervisor/critical_processes
fi
fi
CONFIG_TYPE=$(sonic-cfggen $CFGGEN_PARAMS)

update_default_gw()
Expand Down Expand Up @@ -53,6 +81,7 @@ if [ -z "$CONFIG_TYPE" ] || [ "$CONFIG_TYPE" == "separated" ]; then
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/bfdd.conf /etc/frr/ospfd.conf /etc/frr/pimd.conf
zhaozhenhong marked this conversation as resolved.
Show resolved Hide resolved
fi

chown -R frr:frr /etc/frr/
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) $(LIBYANG)
$(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.
Loading