[bgpcfgd]: make a package for bgpcfgd (#4813)

This commit is contained in:
pavel-shirshov 2020-06-20 21:01:24 -07:00 committed by Abhishek Dosi
parent 96ef32a202
commit 1930b3ac89
12 changed files with 71 additions and 7 deletions

View File

@ -35,16 +35,24 @@ RUN useradd -u ${frr_user_uid} -g ${frr_user_gid} -M -s /bin/false frr
{{ install_debian_packages(docker_fpm_frr_debs.split(' ')) }} {{ install_debian_packages(docker_fpm_frr_debs.split(' ')) }}
{%- endif %} {%- endif %}
{% if docker_fpm_frr_whls.strip() %}
# Copy locally-built Python wheel dependencies
{{ copy_files("python-wheels/", docker_fpm_frr_whls.split(' '), "/python-wheels/") }}
# Install locally-built Python wheel dependencies
{{ install_python_wheels(docker_fpm_frr_whls.split(' ')) }}
{% endif %}
RUN chown -R ${frr_user_uid}:${frr_user_gid} /etc/frr/ RUN chown -R ${frr_user_uid}:${frr_user_gid} /etc/frr/
# Clean up # Clean up
RUN apt-get clean -y && \ RUN apt-get clean -y && \
apt-get autoclean -y && \ apt-get autoclean -y && \
apt-get autoremove -y && \ apt-get autoremove -y && \
rm -rf /debs ~/.cache rm -rf /debs ~/.cache /python-wheels
COPY ["frr", "/usr/share/sonic/templates"] COPY ["frr", "/usr/share/sonic/templates"]
COPY ["bgpcfgd", "start.sh", "/usr/bin/"] COPY ["start.sh", "/usr/bin/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["snmp.conf", "/etc/snmp/frr.conf"] COPY ["snmp.conf", "/etc/snmp/frr.conf"]
COPY ["TSA", "/usr/bin/TSA"] COPY ["TSA", "/usr/bin/TSA"]

View File

@ -19,5 +19,5 @@ check process bgpd matching "/usr/lib/frr/bgpd"
check process staticd matching "/usr/lib/frr/staticd" check process staticd matching "/usr/lib/frr/staticd"
if does not exist for 5 times within 5 cycles then alert if does not exist for 5 times within 5 cycles then alert
check process bgpcfgd matching "python /usr/bin/bgpcfgd" check process bgpcfgd matching "python /usr/local/bin/bgpcfgd"
if does not exist for 5 times within 5 cycles then alert if does not exist for 5 times within 5 cycles then alert

View File

@ -64,8 +64,8 @@ startsecs=0
stdout_logfile=syslog stdout_logfile=syslog
stderr_logfile=syslog stderr_logfile=syslog
[program:vtysh_b] [program:fpmsyncd]
command=/usr/bin/vtysh -b command=fpmsyncd
priority=6 priority=6
autostart=false autostart=false
autorestart=false autorestart=false
@ -73,8 +73,17 @@ startsecs=0
stdout_logfile=syslog stdout_logfile=syslog
stderr_logfile=syslog stderr_logfile=syslog
[program:fpmsyncd] [program:bgpcfgd]
command=fpmsyncd command=/usr/local/bin/bgpcfgd
priority=6
autostart=false
autorestart=false
startsecs=0
stdout_logfile=syslog
stderr_logfile=syslog
[program:vtysh_b]
command=/usr/bin/vtysh -b
priority=6 priority=6
autostart=false autostart=false
autorestart=false autorestart=false

View File

@ -5,6 +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_DBG = $(DOCKER_FPM_FRR_STEM)-$(DBG_IMAGE_MARK).gz
$(DOCKER_FPM_FRR)_PATH = $(DOCKERS_PATH)/$(DOCKER_FPM_FRR_STEM) $(DOCKER_FPM_FRR)_PATH = $(DOCKERS_PATH)/$(DOCKER_FPM_FRR_STEM)
$(DOCKER_FPM_FRR)_PYTHON_WHEELS += $(SONIC_BGPCFGD)
$(DOCKER_FPM_FRR)_DEPENDS += $(FRR) $(FRR_SNMP) $(SWSS) $(LIBYANG) $(DOCKER_FPM_FRR)_DEPENDS += $(FRR) $(FRR_SNMP) $(SWSS) $(LIBYANG)
$(DOCKER_FPM_FRR)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_DEPENDS) $(DOCKER_FPM_FRR)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_DEPENDS)

10
rules/sonic_bgpcfgd.dep Normal file
View File

@ -0,0 +1,10 @@
SPATH := $($(SONIC_BGPCFGD)_SRC_PATH)
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/sonic_bgpcfgd.mk rules/sonic_bgpcfgd.dep
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
DEP_FILES += $(shell git ls-files $(SPATH))
$(SONIC_BGPCFGD)_CACHE_MODE := GIT_CONTENT_SHA
$(SONIC_BGPCFGD)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
$(SONIC_BGPCFGD)_DEP_FILES := $(DEP_FILES)

7
rules/sonic_bgpcfgd.mk Normal file
View File

@ -0,0 +1,7 @@
# sonic-bgpcfgd package
SONIC_BGPCFGD = sonic_bgpcfgd-1.0-py2-none-any.whl
$(SONIC_BGPCFGD)_SRC_PATH = $(SRC_PATH)/sonic-bgpcfgd
$(SONIC_BGPCFGD)_DEPENDS += $(SWSSSDK_PY2)
$(SONIC_BGPCFGD)_PYTHON_VERSION = 2
SONIC_PYTHON_WHEELS += $(SONIC_BGPCFGD)

6
src/sonic-bgpcfgd/.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
.eggs/
build/
dist/
*.egg-info/
tests/*.pyc
tests/__pycache__/

View File

@ -0,0 +1,5 @@
[aliases]
test=pytest
[tool:pytest]
addopts = --verbose
python_files = tests/*.py

14
src/sonic-bgpcfgd/setup.py Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env python
from setuptools import setup
setup(name='sonic-bgpcfgd',
version='1.0',
description='Utility to dynamically generate BGP configuration for FRR',
author='Pavel Shirshov',
author_email='pavelsh@microsoft.com',
url='https://github.com/Azure/sonic-buildimage',
scripts=['bgpcfgd'],
install_requires=['jinja2>=2.10', 'netaddr', 'pyyaml'],
setup_requires=['pytest-runner', 'pytest'],
)

View File

View File

@ -0,0 +1,4 @@
import pytest
def test_sample():
assert True