Skip to content

Commit 51a7661

Browse files
zhenggen-xulguohan
authored andcommitted
Restore neighbor table to kernel during system warm-reboot (#2213)
* Restore neighbor table to kernel during system warm-reboot Added a service: "restore_neighbors" to restore neighbor table into kernel during system warm reboot. The service is started by supervisord in swss docker when the docker is started. In case system warm reboot is enabled, it will try to restore the neighbor table from appDB into kernel through netlink API calls and update the neighbor table by sending arp/ns requests to all neighbor entries, then it sets the stateDB flag for neighsyncd to continue the reconciliation process. -- Added tcpdump python-scapy debian package into orchagent and vs dockers. -- Added python module: pyroute2 netifaces into orchagent and vc dockers. -- Workarounded tcpdump issue in the vs docker Signed-off-by: Zhenggen Xu <[email protected]> * Move the restore_neighbors.py to sonic-swss submodule Made changes to makefiles accordingly Make dockerfile.j2 changes and supervisord config changes Add python monotonic lib for time access Signed-off-by: Zhenggen Xu <[email protected]> * Added PYTHON_SWSSCOMMON as swss runtime dependency Signed-off-by: Zhenggen Xu <[email protected]>
1 parent 61fe8fd commit 51a7661

File tree

9 files changed

+41
-7
lines changed

9 files changed

+41
-7
lines changed

dockers/docker-fpm-frr/Dockerfile.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ENV DEBIAN_FRONTEND=noninteractive
1010
RUN apt-get update
1111

1212
# Install required packages
13-
RUN apt-get install -y libdbus-1-3 libdaemon0 libjansson4 libc-ares2 iproute
13+
RUN apt-get install -y libdbus-1-3 libdaemon0 libjansson4 libc-ares2 iproute libpython2.7
1414

1515
{% if docker_fpm_frr_debs.strip() -%}
1616
# Copy locally-built Debian package dependencies

dockers/docker-fpm-quagga/Dockerfile.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ENV DEBIAN_FRONTEND=noninteractive
1010
RUN apt-get update
1111

1212
# Install required packages
13-
RUN apt-get install -y libdbus-1-3 libdaemon0 libjansson4
13+
RUN apt-get install -y libdbus-1-3 libdaemon0 libjansson4 libpython2.7
1414

1515
{% if docker_fpm_quagga_debs.strip() -%}
1616
# Copy locally-built Debian package dependencies

dockers/docker-orchagent/Dockerfile.j2

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,19 @@ ENV DEBIAN_FRONTEND=noninteractive
88

99
RUN apt-get update
1010

11-
RUN apt-get install -f -y ifupdown arping libdbus-1-3 libdaemon0 libjansson4
11+
RUN apt-get install -f -y ifupdown arping libdbus-1-3 libdaemon0 libjansson4 libpython2.7
1212

13-
RUN apt-get install -f -y ndisc6
13+
RUN apt-get install -f -y ndisc6 tcpdump python-scapy
1414
## Install redis-tools dependencies
1515
## TODO: implicitly install dependencies
1616
RUN apt-get -y install libjemalloc1
1717

1818
RUN apt-get install -y libelf1 libmnl0
1919

20+
RUN pip install setuptools
21+
RUN pip install pyroute2==0.5.3 netifaces==0.10.7
22+
RUN pip install monotonic==1.5
23+
2024
COPY \
2125
{% for deb in docker_orchagent_debs.split(' ') -%}
2226
debs/{{ deb }}{{' '}}

dockers/docker-orchagent/start.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ supervisorctl start rsyslogd
1919

2020
supervisorctl start orchagent
2121

22+
supervisorctl start restore_neighbors
23+
2224
supervisorctl start portsyncd
2325

2426
supervisorctl start intfsyncd

dockers/docker-orchagent/supervisord.conf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,14 @@ autostart=false
116116
autorestart=false
117117
stdout_logfile=syslog
118118
stderr_logfile=syslog
119+
120+
[program:restore_neighbors]
121+
command=/usr/bin/restore_neighbors.py
122+
priority=15
123+
autostart=false
124+
autorestart=false
125+
startsecs=0
126+
startretries=0
127+
stdout_logfile=syslog
128+
stderr_logfile=syslog
129+

dockers/docker-teamd/Dockerfile.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ENV DEBIAN_FRONTEND=noninteractive
88

99
RUN apt-get update
1010

11-
RUN apt-get install -f -y libdbus-1-3 libdaemon0 libjansson4
11+
RUN apt-get install -f -y libdbus-1-3 libdaemon0 libjansson4 libpython2.7
1212

1313
## Install redis-tools dependencies
1414
## TODO: implicitly install dependencies

platform/vs/docker-sonic-vs/Dockerfile.j2

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,15 @@ RUN apt-get install -y net-tools \
4545
libmnl0 \
4646
logrotate \
4747
apt-utils \
48-
psmisc
48+
psmisc \
49+
tcpdump \
50+
python-scapy
4951

5052
RUN pip install setuptools
5153
RUN pip install py2_ipaddress
5254
RUN pip install six
55+
RUN pip install pyroute2==0.5.3 netifaces==0.10.7
56+
RUN pip install monotonic==1.5
5357

5458
{% if docker_sonic_vs_debs.strip() -%}
5559
# Copy locally-built Debian package dependencies
@@ -87,6 +91,9 @@ COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
8791
COPY ["files/configdb-load.sh", "/usr/bin/"]
8892
COPY ["files/arp_update", "/usr/bin"]
8993

94+
# Workaround the tcpdump issue
95+
RUN mv /usr/sbin/tcpdump /usr/bin/tcpdump
96+
9097
RUN echo "docker-sonic-vs" > /etc/hostname
9198
RUN touch /etc/quagga/zebra.conf
9299

platform/vs/docker-sonic-vs/supervisord.conf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,13 @@ autostart=false
154154
autorestart=false
155155
stdout_logfile=syslog
156156
stderr_logfile=syslog
157+
158+
[program:restore_neighbors]
159+
command=/usr/bin/restore_neighbors.py
160+
priority=19
161+
autostart=false
162+
autorestart=false
163+
startsecs=0
164+
startretries=0
165+
stdout_logfile=syslog
166+
stderr_logfile=syslog

rules/swss.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ SWSS = swss_1.0.0_amd64.deb
44
$(SWSS)_SRC_PATH = $(SRC_PATH)/sonic-swss
55
$(SWSS)_DEPENDS += $(LIBSAIREDIS_DEV) $(LIBSAIMETADATA_DEV) $(LIBTEAM_DEV) \
66
$(LIBTEAMDCT) $(LIBTEAM_UTILS) $(LIBSWSSCOMMON_DEV)
7-
$(SWSS)_RDEPENDS += $(LIBSAIREDIS) $(LIBSAIMETADATA) $(LIBTEAM) $(LIBSWSSCOMMON)
7+
$(SWSS)_RDEPENDS += $(LIBSAIREDIS) $(LIBSAIMETADATA) $(LIBTEAM) $(LIBSWSSCOMMON) $(PYTHON_SWSSCOMMON)
88
SONIC_DPKG_DEBS += $(SWSS)
99

1010
SWSS_DBG = swss-dbg_1.0.0_amd64.deb

0 commit comments

Comments
 (0)