-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
PVST Feature commit #20417
Open
divyachandralekha
wants to merge
4
commits into
sonic-net:master
Choose a base branch
from
divyachandralekha:pvst_co_pr
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
PVST Feature commit #20417
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} | ||
FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} | ||
|
||
ARG docker_container_name | ||
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf | ||
|
||
## Make apt-get non-interactive | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get update && \ | ||
apt-get install -f -y \ | ||
libdbus-1-3 \ | ||
libdaemon0 \ | ||
libjansson4 \ | ||
libpython2.7 \ | ||
# Install redis-tools dependencies | ||
# TODO: implicitly install dependencies | ||
libjemalloc2 \ | ||
ebtables | ||
|
||
{% if docker_stp_debs.strip() -%} | ||
# Copy locally-built Debian package dependencies | ||
{{ copy_files("debs/", docker_stp_debs.split(' '), "/debs/") }} | ||
|
||
# Install locally-built Debian packages and implicitly install their dependencies | ||
{{ install_debian_packages(docker_stp_debs.split(' ')) }} | ||
{%- endif %} | ||
|
||
RUN apt-get clean -y && \ | ||
apt-get autoclean -y && \ | ||
apt-get autoremove -y && \ | ||
rm -rf /debs | ||
|
||
COPY ["start.sh", "/usr/bin/"] | ||
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] | ||
COPY ["critical_processes", "/etc/supervisor"] | ||
|
||
ENTRYPOINT ["/usr/local/bin/supervisord"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
# -t option needed only for shell, not for commands | ||
|
||
docker exec -i stp stpctl "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
program:stpd | ||
program:stpmgrd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env bash | ||
|
||
rm -f /var/run/rsyslogd.pid | ||
rm -f /var/run/stpd/* | ||
rm -f /var/run/stpmgrd/* | ||
|
||
supervisorctl start rsyslogd | ||
|
||
supervisorctl start stpd | ||
|
||
supervisorctl start stpmgrd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
[supervisord] | ||
logfile_maxbytes=1MB | ||
logfile_backups=2 | ||
nodaemon=true | ||
|
||
[program:start.sh] | ||
command=/usr/bin/start.sh | ||
priority=1 | ||
autostart=true | ||
autorestart=false | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
|
||
[program:rsyslogd] | ||
command=/usr/sbin/rsyslogd -n | ||
priority=2 | ||
autostart=false | ||
autorestart=false | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
|
||
[program:stpd] | ||
command=/usr/bin/stpd | ||
priority=3 | ||
autostart=false | ||
autorestart=false | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
|
||
[program:stpmgrd] | ||
command=/usr/bin/stpmgrd | ||
priority=3 | ||
autostart=false | ||
autorestart=false | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[Unit] | ||
Description=STP container | ||
Requires=updategraph.service swss.service | ||
After=updategraph.service swss.service syncd.service | ||
Before=ntp-config.service | ||
BindsTo=sonic.target | ||
After=sonic.target | ||
StartLimitIntervalSec=1200 | ||
StartLimitBurst=3 | ||
|
||
[Service] | ||
User={{ sonicadmin_user }} | ||
ExecStartPre=/usr/bin/{{docker_container_name}}.sh start | ||
ExecStart=/usr/bin/{{docker_container_name}}.sh wait | ||
ExecStop=/usr/bin/{{docker_container_name}}.sh stop | ||
RestartSec=30 | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Docker image for STP | ||
|
||
DOCKER_STP_STEM = docker-stp | ||
DOCKER_STP = $(DOCKER_STP_STEM).gz | ||
DOCKER_STP_DBG = $(DOCKER_STP_STEM)-$(DBG_IMAGE_MARK).gz | ||
|
||
$(DOCKER_STP)_PATH = $(DOCKERS_PATH)/$(DOCKER_STP_STEM) | ||
|
||
$(DOCKER_STP)_DEPENDS += $(STP) $(SWSS) $(SONIC_RSYSLOG_PLUGIN) | ||
$(DOCKER_STP)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_DEPENDS) | ||
$(DOCKER_STP)_DBG_DEPENDS += $(STP) $(SWSS) $(SONIC_RSYSLOG_PLUGIN) | ||
|
||
$(DOCKER_STP)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_IMAGE_PACKAGES) | ||
|
||
$(DOCKER_STP)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_BULLSEYE) | ||
|
||
ifeq ($(INCLUDE_STP), y) | ||
SONIC_DOCKER_IMAGES += $(DOCKER_STP) | ||
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_STP) | ||
|
||
SONIC_DOCKER_DBG_IMAGES += $(DOCKER_STP_DBG) | ||
SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_STP_DBG) | ||
endif | ||
|
||
$(DOCKER_STP)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_BULLSEYE) | ||
|
||
$(DOCKER_STP)_CONTAINER_NAME = stp | ||
$(DOCKER_STP)_RUN_OPT += --privileged -t | ||
$(DOCKER_STP)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro | ||
|
||
$(DOCKER_STP)_BASE_IMAGE_FILES += stpctl:/usr/bin/stpctl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# libevent | ||
|
||
LIBEVENT_VERSION = 2.1.8 | ||
|
||
export LIBEVENT_VERSION | ||
|
||
LIBEVENT = libevent_$(LIBEVENT_VERSION)_amd64.deb | ||
$(LIBEVENT)_DPKGFLAGS += --force-all | ||
$(LIBEVENT)_SRC_PATH = $(SRC_PATH)/libevent | ||
SONIC_MAKE_DEBS += $(LIBEVENT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# STP package | ||
# | ||
STP_VERSION = 1.0.0 | ||
export STP_VERSION | ||
|
||
STP = stp_$(STP_VERSION)_amd64.deb | ||
$(STP)_SRC_PATH = $(SRC_PATH)/sonic-stp | ||
$(STP)_DEPENDS += $(LIBEVENT) | ||
$(STP)_DEPENDS += $(LIBSWSSCOMMON_DEV) | ||
$(STP)_RDEPENDS += $(LIBSWSSCOMMON) | ||
SONIC_DPKG_DEBS += $(STP) | ||
|
||
STP_DBG = stp-dbg_$(STP_VERSION)_amd64.deb | ||
$(STP_DBG)_DEPENDS += $(STP) | ||
$(STP_DBG)_RDEPENDS += $(STP) | ||
$(eval $(call add_derived_package,$(STP),$(STP_DBG))) | ||
|
||
export STP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
.ONESHELL: | ||
SHELL = /bin/bash | ||
.SHELLFLAGS += -e | ||
|
||
MAIN_TARGET = libevent_$(LIBEVENT_VERSION)_amd64.deb | ||
|
||
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : | ||
# Obtaining the libevent | ||
rm -rf ./libevent-$(LIBEVENT_VERSION)-stable | ||
wget -N "https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz" | ||
tar -xzf libevent-$(LIBEVENT_VERSION)-stable.tar.gz | ||
rm -rf libevent-$(LIBEVENT_VERSION)-stable.tar.gz | ||
cp debian libevent-$(LIBEVENT_VERSION)-stable -r | ||
|
||
pushd ./libevent-$(LIBEVENT_VERSION)-stable | ||
dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) | ||
popd | ||
mv $(MAIN_TARGET) $(DEST)/ | ||
|
||
#$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
sonic (2.1.8) stable; urgency=medium | ||
|
||
* libevent 2.1.8 stable version pulled github | ||
-- LIBEVENT <@broadcom.com> Fri, 26 Apr 2019 12:00:00 -0800 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Source: sonic | ||
Maintainer: Broadcom | ||
Section: net | ||
Priority: optional | ||
Build-Depends: dh-exec (>=0.3), debhelper (>= 9), autotools-dev | ||
Standards-Version: 1.0.0 | ||
|
||
Package: libevent | ||
Architecture: any | ||
Depends: ${shlibs:Depends} | ||
Description: This package contains Libevent2.1.8 for SONiC project. | ||
|
||
Package: libevent-dbg | ||
Architecture: any | ||
Section: debug | ||
Priority: extra | ||
Depends: libevent (=${binary:Version}) | ||
Description: debugging symbols for libevent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/make -f | ||
|
||
DPKG_EXPORT_BUILDFLAGS = 1 | ||
include /usr/share/dpkg/default.mk | ||
|
||
%: | ||
dh $@ --with autotools-dev | ||
|
||
override_dh_auto_configure: | ||
dh_auto_configure -- --disable-samples --disable-libevent-regress | ||
|
||
override_dh_auto_install: | ||
dh_auto_install --destdir=debian/libevent | ||
|
||
override_dh_strip: | ||
dh_strip --dbg-package=libevent-dbg |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally giving host system privileges to docker is not a good idea due to security reasons,
Is it possible to check if access needed by stp daemon are met by doing selective capability additions, something like below,
$(DOCKER_STP)_RUN_OPT += -t --cap-add=NET_ADMIN --cap-add=SYS_ADMIN --cap-add=NET_BROADCAST