Skip to content
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
2 changes: 1 addition & 1 deletion dockers/docker-lldp-sv2/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ RUN pip install /python-wheels/swsssdk-2.0.1-py2-none-any.whl && \

COPY ["start.sh", "/usr/bin/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["reconfigure.sh", "/opt/"]
COPY ["reconfigure.sh", "/usr/bin/"]
COPY ["lldpd.conf.j2", "/usr/share/sonic/templates/"]
COPY ["lldpd", "/etc/default/"]

Expand Down
17 changes: 8 additions & 9 deletions dockers/docker-lldp-sv2/reconfigure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

set -e

num_of_interfaces=32
if_step=4
last_if_idx=$((num_of_interfaces*if_step - if_step))
# TODO: Listen to state database when it is ready
interfaces=$(sonic-cfggen -d -v "PORT.keys() | join(' ')")

function wait_until_if_exists
{
Expand All @@ -31,23 +30,23 @@ function wait_until_if_not_exists
while /bin/true ;
do
# wait until all interfaces are created
echo Wait until all ifaces are created
for i in $(seq 0 $if_step $last_if_idx)
echo Wait until all interfaces are created
for i in $interfaces
do
wait_until_if_exists "Ethernet$i"
wait_until_if_exists $i
done

echo Wait 10 seconds while lldpd finds new interfaces
sleep 10

# apply lldpd configuration
echo apply lldpd configuration
echo Apply lldpd configuration
lldpcli -c /etc/lldpd.conf

# wait until all interfaces are destroyed
echo Wait until all ifaces are destroyed
for i in $(seq 0 $if_step $last_if_idx)
for i in $interfaces
do
wait_until_if_not_exists "Ethernet$i"
wait_until_if_not_exists $i
done
done
2 changes: 1 addition & 1 deletion dockers/docker-lldp-sv2/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ stdout_logfile=syslog
stderr_logfile=syslog

[program:lldpd-conf-reload]
command=/opt/reconfigure.sh
command=/usr/bin/reconfigure.sh
priority=150
autostart=false
autorestart=false
Expand Down