Skip to content

Commit 00dfee6

Browse files
divyachandralekhaprabhataravind
authored andcommitted
PVST feature enable (sonic-net#21804)
1 parent 4f10670 commit 00dfee6

File tree

14 files changed

+214
-1
lines changed

14 files changed

+214
-1
lines changed

dockers/docker-stp/Dockerfile.j2

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %}
2+
FROM docker-config-engine-bookworm-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}
3+
4+
ARG docker_container_name
5+
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf
6+
7+
## Make apt-get non-interactive
8+
ENV DEBIAN_FRONTEND=noninteractive
9+
10+
RUN apt-get update && \
11+
apt-get install -f -y \
12+
libdbus-1-3 \
13+
libdaemon0 \
14+
libjansson4 \
15+
libpython2.7 \
16+
libjemalloc2 \
17+
ebtables
18+
19+
{% if docker_stp_debs.strip() -%}
20+
# Copy locally-built Debian package dependencies
21+
{{ copy_files("debs/", docker_stp_debs.split(' '), "/debs/") }}
22+
23+
# Install locally-built Debian packages and implicitly install their dependencies
24+
{{ install_debian_packages(docker_stp_debs.split(' ')) }}
25+
{%- endif %}
26+
27+
RUN apt-get clean -y && \
28+
apt-get autoclean -y && \
29+
apt-get autoremove -y && \
30+
rm -rf /debs
31+
32+
COPY ["start.sh", "/usr/bin/"]
33+
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
34+
COPY ["critical_processes", "/etc/supervisor"]
35+
36+
ENTRYPOINT ["/usr/local/bin/supervisord"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
# -t option needed only for shell, not for commands
4+
5+
docker exec -i stp stpctl "$@"

dockers/docker-stp/critical_processes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
program:stpd
2+
program:stpmgrd

dockers/docker-stp/start.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
3+
rm -f /var/run/rsyslogd.pid
4+
rm -f /var/run/stpd/*
5+
rm -f /var/run/stpmgrd/*
6+
7+
supervisorctl start rsyslogd
8+
9+
supervisorctl start stpd
10+
11+
supervisorctl start stpmgrd

dockers/docker-stp/supervisord.conf

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[supervisord]
2+
logfile_maxbytes=1MB
3+
logfile_backups=2
4+
nodaemon=true
5+
6+
[program:start.sh]
7+
command=/usr/bin/start.sh
8+
priority=1
9+
autostart=true
10+
autorestart=false
11+
stdout_logfile=syslog
12+
stderr_logfile=syslog
13+
14+
[program:rsyslogd]
15+
command=/usr/sbin/rsyslogd -n
16+
priority=2
17+
autostart=false
18+
autorestart=false
19+
stdout_logfile=syslog
20+
stderr_logfile=syslog
21+
22+
[program:stpd]
23+
command=/usr/bin/stpd
24+
priority=3
25+
autostart=false
26+
autorestart=false
27+
stdout_logfile=syslog
28+
stderr_logfile=syslog
29+
30+
[program:stpmgrd]
31+
command=/usr/bin/stpmgrd
32+
priority=3
33+
autostart=false
34+
autorestart=false
35+
stdout_logfile=syslog
36+
stderr_logfile=syslog
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
gdb==13.1-3
2+
gdbserver==13.1-3
3+
libbabeltrace1==1.5.11-1+b2
4+
libboost-regex1.74.0==1.74.0+ds1-21
5+
libcbor0.8==0.8.0-2+b1
6+
libcurl3-gnutls==7.88.1-10+deb12u6
7+
libdebuginfod-common==0.188-2.1
8+
libdebuginfod1==0.188-2.1
9+
libdw1==0.188-2.1
10+
libedit2==3.1-20221030-2
11+
libevent-2.1-7==2.1.12-stable-8
12+
libexplain51==1.4.D001-12+b1
13+
libfido2-1==1.12.0-2+b1
14+
libglib2.0-0==2.74.6-2+deb12u3
15+
libgpm2==1.20.7-10+b1
16+
libicu72==72.1-3
17+
libipt2==2.0.5-1
18+
liblua5.1-0==5.1.5-9
19+
libmpfr6==4.2.0-1
20+
libsource-highlight-common==3.1.9-4.2
21+
libsource-highlight4v5==3.1.9-4.2+b3
22+
libssl-dev==3.0.13-1~deb12u1
23+
libssl3==3.0.13-1~deb12u1
24+
libswsscommon-dbgsym==1.0.0
25+
libunwind8==1.6.2-3
26+
lsof==4.95.0-1
27+
openssh-client==1:9.2p1-2+deb12u3
28+
openssl==3.0.13-1~deb12u1
29+
sensible-utils==0.0.17+nmu1
30+
sshpass==1.09-1+b1
31+
strace==6.1-0.1
32+
ucf==3.0043+nmu1
33+
vim==2:9.0.1378-2
34+
vim-runtime==2:9.0.1378-2

files/build_templates/stp.service.j2

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[Unit]
2+
Description=STP container
3+
Requires=updategraph.service swss.service
4+
After=updategraph.service swss.service syncd.service
5+
Before=ntp-config.service
6+
BindsTo=sonic.target
7+
After=sonic.target
8+
StartLimitIntervalSec=1200
9+
StartLimitBurst=3
10+
11+
[Service]
12+
User={{ sonicadmin_user }}
13+
ExecStartPre=/usr/bin/{{docker_container_name}}.sh start
14+
ExecStart=/usr/bin/{{docker_container_name}}.sh wait
15+
ExecStop=/usr/bin/{{docker_container_name}}.sh stop
16+
RestartSec=30
17+
18+
[Install]
19+
WantedBy=multi-user.target

files/image_config/logrotate/rsyslog.j2

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
/var/log/syslog
3131
/var/log/teamd.log
3232
/var/log/telemetry.log
33+
/var/log/stpd.log
3334
/var/log/gnmi.log
3435
/var/log/frr/bgpd.log
3536
/var/log/frr/zebra.log

files/image_config/rsyslog/rsyslog.d/00-sonic.conf.j2

+8
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,11 @@ if $msg startswith " telemetry" or ($msg startswith " dialout" )then {
4646
/var/log/telemetry.log
4747
stop
4848
}
49+
50+
## stpd rules
51+
if $programname contains "stp" then {
52+
if not ($msg contains "STP_SYSLOG") then {
53+
/var/log/stpd.log
54+
stop
55+
}
56+
}

rules/docker-stp.mk

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Docker image for STP
2+
3+
DOCKER_STP_STEM = docker-stp
4+
DOCKER_STP = $(DOCKER_STP_STEM).gz
5+
DOCKER_STP_DBG = $(DOCKER_STP_STEM)-$(DBG_IMAGE_MARK).gz
6+
7+
$(DOCKER_STP)_PATH = $(DOCKERS_PATH)/$(DOCKER_STP_STEM)
8+
9+
$(DOCKER_STP)_DEPENDS += $(STP) $(SWSS) $(SONIC_RSYSLOG_PLUGIN)
10+
$(DOCKER_STP)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BOOKWORM)_DBG_DEPENDS)
11+
$(DOCKER_STP)_DBG_DEPENDS += $(STP) $(SWSS) $(SONIC_RSYSLOG_PLUGIN)
12+
13+
$(DOCKER_STP)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BOOKWORM)_DBG_IMAGE_PACKAGES)
14+
15+
$(DOCKER_STP)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_BOOKWORM)
16+
17+
ifeq ($(INCLUDE_STP), y)
18+
SONIC_DOCKER_IMAGES += $(DOCKER_STP)
19+
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_STP)
20+
21+
SONIC_DOCKER_DBG_IMAGES += $(DOCKER_STP_DBG)
22+
SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_STP_DBG)
23+
endif
24+
25+
$(DOCKER_STP)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_BOOKWORM)
26+
27+
$(DOCKER_STP)_CONTAINER_NAME = stp
28+
$(DOCKER_STP)_RUN_OPT += -t --cap-add=NET_ADMIN --cap-add=SYS_ADMIN
29+
$(DOCKER_STP)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
30+
31+
$(DOCKER_STP)_BASE_IMAGE_FILES += stpctl:/usr/bin/stpctl

rules/sonic-stp.dep

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
SPATH := $($(SONIC-STP)_SRC_PATH)
3+
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/sonic-stp.mk rules/sonic-stp.dep
4+
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
5+
SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files))
6+
7+
$(SONIC-STP)_CACHE_MODE := GIT_CONTENT_SHA
8+
$(SONIC-STP)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
9+
$(SONIC-STP)_DEP_FILES := $(DEP_FILES)
10+
$(SONIC-STP)_SMDEP_FILES := $(SMDEP_FILES)
11+
$(SONIC-STP)_SMDEP_PATHS := $(SPATH)

rules/sonic-stp.mk

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# STP package
2+
#
3+
STP_VERSION = 1.0.0
4+
export STP_VERSION
5+
6+
STP = stp_$(STP_VERSION)_$(CONFIGURED_ARCH).deb
7+
$(STP)_SRC_PATH = $(SRC_PATH)/sonic-stp
8+
$(STP)_DEPENDS += $(LIBSWSSCOMMON_DEV)
9+
$(STP)_RDEPENDS += $(LIBSWSSCOMMON)
10+
SONIC_DPKG_DEBS += $(STP)
11+
12+
STP_DBG = stp-dbg_$(STP_VERSION)_$(CONFIGURED_ARCH).deb
13+
$(STP_DBG)_DEPENDS += $(STP)
14+
$(STP_DBG)_RDEPENDS += $(STP)
15+
$(eval $(call add_derived_package,$(STP),$(STP_DBG)))
16+
17+
export STP

rules/swss.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ SWSS = swss_1.0.0_$(CONFIGURED_ARCH).deb
44
$(SWSS)_SRC_PATH = $(SRC_PATH)/sonic-swss
55
$(SWSS)_DEPENDS += $(LIBSAIREDIS_DEV) $(LIBSAIMETADATA_DEV) $(LIBTEAM_DEV) \
66
$(LIBTEAMDCTL) $(LIBTEAM_UTILS) $(LIBSWSSCOMMON_DEV) \
7-
$(LIBSAIVS) $(LIBSAIVS_DEV) \
7+
$(LIBSAIVS) $(LIBSAIVS_DEV) $(STP)\
88
$(PROTOBUF) $(PROTOBUF_LITE) $(PROTOBUF_DEV) $(LIB_SONIC_DASH_API)
99
$(SWSS)_UNINSTALLS = $(LIBSAIVS_DEV)
1010

slave.mk

+2
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ $(info "BLDENV" : "$(BLDENV)")
441441
$(info "VS_PREPARE_MEM" : "$(VS_PREPARE_MEM)")
442442
$(info "INCLUDE_MGMT_FRAMEWORK" : "$(INCLUDE_MGMT_FRAMEWORK)")
443443
$(info "INCLUDE_ICCPD" : "$(INCLUDE_ICCPD)")
444+
$(info "INCLUDE_STP" : "$(INCLUDE_STP)")
444445
$(info "INCLUDE_SYSTEM_TELEMETRY" : "$(INCLUDE_SYSTEM_TELEMETRY)")
445446
$(info "INCLUDE_SYSTEM_GNMI" : "$(INCLUDE_SYSTEM_GNMI)")
446447
$(info "INCLUDE_SYSTEM_BMP" : "$(INCLUDE_SYSTEM_BMP)")
@@ -1451,6 +1452,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \
14511452
export include_dhcp_server="$(INCLUDE_DHCP_SERVER)"
14521453
export include_mgmt_framework="$(INCLUDE_MGMT_FRAMEWORK)"
14531454
export include_iccpd="$(INCLUDE_ICCPD)"
1455+
export include_stpd="$(INCLUDE_STP)"
14541456
export pddf_support="$(PDDF_SUPPORT)"
14551457
export include_pde="$(INCLUDE_PDE)"
14561458
export shutdown_bgp_on_start="$(SHUTDOWN_BGP_ON_START)"

0 commit comments

Comments
 (0)