Skip to content

Commit 6e2be95

Browse files
PVST feature enable (#21804)
1 parent e800902 commit 6e2be95

File tree

14 files changed

+214
-1
lines changed

14 files changed

+214
-1
lines changed

dockers/docker-stp/Dockerfile.j2

Lines changed: 36 additions & 0 deletions
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"]
Lines changed: 5 additions & 0 deletions
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 "$@"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
program:stpd
2+
program:stpmgrd

dockers/docker-stp/start.sh

Lines changed: 11 additions & 0 deletions
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
Lines changed: 36 additions & 0 deletions
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
Lines changed: 34 additions & 0 deletions
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
Lines changed: 19 additions & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 8 additions & 0 deletions
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

Lines changed: 31 additions & 0 deletions
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

0 commit comments

Comments
 (0)