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

This commit is contained in:
pavel-shirshov 2020-06-20 21:01:24 -07:00 committed by GitHub
parent 211d1e7e2e
commit 0d863c39ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 59 additions and 4 deletions

View File

@ -31,16 +31,24 @@ RUN useradd -u ${frr_user_uid} -g ${frr_user_gid} -M -s /bin/false frr
{{ install_debian_packages(docker_fpm_frr_debs.split(' ')) }}
{%- 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/
# Clean up
RUN apt-get clean -y && \
apt-get autoclean -y && \
apt-get autoremove -y && \
rm -rf /debs ~/.cache
rm -rf /debs ~/.cache /python-wheels
COPY ["frr", "/usr/share/sonic/templates"]
COPY ["bgpcfgd", "docker_init.sh", "/usr/bin/"]
COPY ["docker_init.sh", "/usr/bin/"]
COPY ["snmp.conf", "/etc/snmp/frr.conf"]
COPY ["TSA", "/usr/bin/TSA"]
COPY ["TSB", "/usr/bin/TSB"]

View File

@ -19,5 +19,5 @@ check process bgpd matching "/usr/lib/frr/bgpd"
check process staticd matching "/usr/lib/frr/staticd"
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

View File

@ -73,7 +73,7 @@ dependent_startup=true
dependent_startup_wait_for=bgpd:running
[program:bgpcfgd]
command=/usr/bin/bgpcfgd
command=/usr/local/bin/bgpcfgd
priority=6
autostart=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)_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)_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