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 Jun 21, 2020
1 parent 211d1e7 commit 0d863c3
Show file tree
Hide file tree
Showing 12 changed files with 59 additions and 4 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 @@ -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"]
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
2 changes: 1 addition & 1 deletion dockers/docker-fpm-frr/frr/supervisord/supervisord.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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
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 0d863c3

Please sign in to comment.