Skip to content
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 enable #21804

Merged
merged 1 commit into from
Mar 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions dockers/docker-stp/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %}
FROM docker-config-engine-bookworm-{{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 \
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"]
5 changes: 5 additions & 0 deletions dockers/docker-stp/base_image_files/stpctl
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 "$@"
2 changes: 2 additions & 0 deletions dockers/docker-stp/critical_processes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
program:stpd
program:stpmgrd
11 changes: 11 additions & 0 deletions dockers/docker-stp/start.sh
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
36 changes: 36 additions & 0 deletions dockers/docker-stp/supervisord.conf
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
34 changes: 34 additions & 0 deletions files/build/versions/dockers/docker-stp/versions-deb-bookworm
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
gdb==13.1-3
gdbserver==13.1-3
libbabeltrace1==1.5.11-1+b2
libboost-regex1.74.0==1.74.0+ds1-21
libcbor0.8==0.8.0-2+b1
libcurl3-gnutls==7.88.1-10+deb12u6
libdebuginfod-common==0.188-2.1
libdebuginfod1==0.188-2.1
libdw1==0.188-2.1
libedit2==3.1-20221030-2
libevent-2.1-7==2.1.12-stable-8
libexplain51==1.4.D001-12+b1
libfido2-1==1.12.0-2+b1
libglib2.0-0==2.74.6-2+deb12u3
libgpm2==1.20.7-10+b1
libicu72==72.1-3
libipt2==2.0.5-1
liblua5.1-0==5.1.5-9
libmpfr6==4.2.0-1
libsource-highlight-common==3.1.9-4.2
libsource-highlight4v5==3.1.9-4.2+b3
libssl-dev==3.0.13-1~deb12u1
libssl3==3.0.13-1~deb12u1
libswsscommon-dbgsym==1.0.0
libunwind8==1.6.2-3
lsof==4.95.0-1
openssh-client==1:9.2p1-2+deb12u3
openssl==3.0.13-1~deb12u1
sensible-utils==0.0.17+nmu1
sshpass==1.09-1+b1
strace==6.1-0.1
ucf==3.0043+nmu1
vim==2:9.0.1378-2
vim-runtime==2:9.0.1378-2
19 changes: 19 additions & 0 deletions files/build_templates/stp.service.j2
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
1 change: 1 addition & 0 deletions files/image_config/logrotate/rsyslog.j2
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
/var/log/syslog
/var/log/teamd.log
/var/log/telemetry.log
/var/log/stpd.log
/var/log/gnmi.log
/var/log/frr/bgpd.log
/var/log/frr/zebra.log
Expand Down
8 changes: 8 additions & 0 deletions files/image_config/rsyslog/rsyslog.d/00-sonic.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,11 @@ if $msg startswith " telemetry" or ($msg startswith " dialout" )then {
/var/log/telemetry.log
stop
}

## stpd rules
if $programname contains "stp" then {
if not ($msg contains "STP_SYSLOG") then {
/var/log/stpd.log
stop
}
}
31 changes: 31 additions & 0 deletions rules/docker-stp.mk
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_BOOKWORM)_DBG_DEPENDS)
$(DOCKER_STP)_DBG_DEPENDS += $(STP) $(SWSS) $(SONIC_RSYSLOG_PLUGIN)

$(DOCKER_STP)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BOOKWORM)_DBG_IMAGE_PACKAGES)

$(DOCKER_STP)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_BOOKWORM)

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_BOOKWORM)

$(DOCKER_STP)_CONTAINER_NAME = stp
$(DOCKER_STP)_RUN_OPT += -t --cap-add=NET_ADMIN --cap-add=SYS_ADMIN
$(DOCKER_STP)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro

$(DOCKER_STP)_BASE_IMAGE_FILES += stpctl:/usr/bin/stpctl
11 changes: 11 additions & 0 deletions rules/sonic-stp.dep
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

SPATH := $($(SONIC-STP)_SRC_PATH)
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/sonic-stp.mk rules/sonic-stp.dep
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files))

$(SONIC-STP)_CACHE_MODE := GIT_CONTENT_SHA
$(SONIC-STP)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
$(SONIC-STP)_DEP_FILES := $(DEP_FILES)
$(SONIC-STP)_SMDEP_FILES := $(SMDEP_FILES)
$(SONIC-STP)_SMDEP_PATHS := $(SPATH)
17 changes: 17 additions & 0 deletions rules/sonic-stp.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# STP package
#
STP_VERSION = 1.0.0
export STP_VERSION

STP = stp_$(STP_VERSION)_$(CONFIGURED_ARCH).deb
$(STP)_SRC_PATH = $(SRC_PATH)/sonic-stp
$(STP)_DEPENDS += $(LIBSWSSCOMMON_DEV)
$(STP)_RDEPENDS += $(LIBSWSSCOMMON)
SONIC_DPKG_DEBS += $(STP)

STP_DBG = stp-dbg_$(STP_VERSION)_$(CONFIGURED_ARCH).deb
$(STP_DBG)_DEPENDS += $(STP)
$(STP_DBG)_RDEPENDS += $(STP)
$(eval $(call add_derived_package,$(STP),$(STP_DBG)))

export STP
2 changes: 1 addition & 1 deletion rules/swss.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SWSS = swss_1.0.0_$(CONFIGURED_ARCH).deb
$(SWSS)_SRC_PATH = $(SRC_PATH)/sonic-swss
$(SWSS)_DEPENDS += $(LIBSAIREDIS_DEV) $(LIBSAIMETADATA_DEV) $(LIBTEAM_DEV) \
$(LIBTEAMDCTL) $(LIBTEAM_UTILS) $(LIBSWSSCOMMON_DEV) \
$(LIBSAIVS) $(LIBSAIVS_DEV) \
$(LIBSAIVS) $(LIBSAIVS_DEV) $(STP)\
$(PROTOBUF) $(PROTOBUF_LITE) $(PROTOBUF_DEV) $(LIB_SONIC_DASH_API)
$(SWSS)_UNINSTALLS = $(LIBSAIVS_DEV)

Expand Down
2 changes: 2 additions & 0 deletions slave.mk
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ $(info "BLDENV" : "$(BLDENV)")
$(info "VS_PREPARE_MEM" : "$(VS_PREPARE_MEM)")
$(info "INCLUDE_MGMT_FRAMEWORK" : "$(INCLUDE_MGMT_FRAMEWORK)")
$(info "INCLUDE_ICCPD" : "$(INCLUDE_ICCPD)")
$(info "INCLUDE_STP" : "$(INCLUDE_STP)")
$(info "INCLUDE_SYSTEM_TELEMETRY" : "$(INCLUDE_SYSTEM_TELEMETRY)")
$(info "INCLUDE_SYSTEM_GNMI" : "$(INCLUDE_SYSTEM_GNMI)")
$(info "INCLUDE_SYSTEM_BMP" : "$(INCLUDE_SYSTEM_BMP)")
Expand Down Expand Up @@ -1451,6 +1452,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \
export include_dhcp_server="$(INCLUDE_DHCP_SERVER)"
export include_mgmt_framework="$(INCLUDE_MGMT_FRAMEWORK)"
export include_iccpd="$(INCLUDE_ICCPD)"
export include_stpd="$(INCLUDE_STP)"
export pddf_support="$(PDDF_SUPPORT)"
export include_pde="$(INCLUDE_PDE)"
export shutdown_bgp_on_start="$(SHUTDOWN_BGP_ON_START)"
Expand Down
Loading