Skip to content

Commit

Permalink
[bgpcfgd]: make a package for bgpcfgd (#4813)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-shirshov authored and abdosi committed Jul 5, 2020
1 parent 96ef32a commit 1930b3a
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 7 deletions.
12 changes: 10 additions & 2 deletions dockers/docker-fpm-frr/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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(' ')) }}
{%- 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", "start.sh", "/usr/bin/"]
COPY ["start.sh", "/usr/bin/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["snmp.conf", "/etc/snmp/frr.conf"]
COPY ["TSA", "/usr/bin/TSA"]
Expand Down
2 changes: 1 addition & 1 deletion dockers/docker-fpm-frr/base_image_files/monit_bgp
Original file line number Diff line number Diff line change
Expand Up @@ -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
17 changes: 13 additions & 4 deletions dockers/docker-fpm-frr/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,26 @@ startsecs=0
stdout_logfile=syslog
stderr_logfile=syslog

[program:vtysh_b]
command=/usr/bin/vtysh -b
[program:fpmsyncd]
command=fpmsyncd
priority=6
autostart=false
autorestart=false
startsecs=0
stdout_logfile=syslog
stderr_logfile=syslog

[program:fpmsyncd]
command=fpmsyncd
[program:bgpcfgd]
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
autostart=false
autorestart=false
Expand Down
1 change: 1 addition & 0 deletions rules/docker-fpm-frr.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 10 additions & 0 deletions rules/sonic_bgpcfgd.dep
Original file line number Diff line number Diff line change
@@ -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 changes: 7 additions & 0 deletions rules/sonic_bgpcfgd.mk
Original file line number Diff line number Diff line change
@@ -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 changes: 6 additions & 0 deletions src/sonic-bgpcfgd/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.eggs/
build/
dist/
*.egg-info/
tests/*.pyc
tests/__pycache__/
File renamed without changes.
5 changes: 5 additions & 0 deletions src/sonic-bgpcfgd/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[aliases]
test=pytest
[tool:pytest]
addopts = --verbose
python_files = tests/*.py
14 changes: 14 additions & 0 deletions src/sonic-bgpcfgd/setup.py
Original file line number Diff line number Diff line change
@@ -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'],
)
Empty file.
4 changes: 4 additions & 0 deletions src/sonic-bgpcfgd/tests/test_sample.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import pytest

def test_sample():
assert True

0 comments on commit 1930b3a

Please sign in to comment.