update port configurations in lldpd as soon as port created
This commit is contained in:
parent
73cbf6ccb2
commit
30438bb987
@ -18,5 +18,6 @@ RUN apt-get update && \
|
||||
rm -rf /deps ~/.cache
|
||||
|
||||
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
COPY reconfigure.sh /opt/reconfigure.sh
|
||||
|
||||
ENTRYPOINT ["/usr/bin/supervisord"]
|
||||
|
58
dockers/docker-lldp-sv2/reconfigure.sh
Executable file
58
dockers/docker-lldp-sv2/reconfigure.sh
Executable file
@ -0,0 +1,58 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
num_of_interfaces=32
|
||||
if_step=4
|
||||
last_if_idx=$((num_of_interfaces*if_step - if_step))
|
||||
|
||||
function wait_until_if_exists
|
||||
{
|
||||
while /bin/true ;
|
||||
do
|
||||
if [ -L /sys/class/net/"$if" ];
|
||||
then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
echo interface "$if" is up
|
||||
}
|
||||
|
||||
|
||||
function wait_until_if_not_exists
|
||||
{
|
||||
while /bin/true ;
|
||||
do
|
||||
if [ ! -L /sys/class/net/"$if" ];
|
||||
then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
echo interface "$if" is down
|
||||
}
|
||||
|
||||
|
||||
while /bin/true ;
|
||||
do
|
||||
# wait until all interfaces are up
|
||||
echo Wait until all ifaces are up
|
||||
for i in $(seq 0 $if_step $last_if_idx)
|
||||
do
|
||||
if=Ethernet${i}
|
||||
wait_until_if_exists
|
||||
done
|
||||
|
||||
# apply lldpd configuration
|
||||
echo apply lldpd configuration
|
||||
lldpcli -c /etc/lldpd.conf
|
||||
|
||||
# wait until all interfaces are down
|
||||
echo Wait until all ifaces are down
|
||||
for i in $(seq 0 $if_step $last_if_idx)
|
||||
do
|
||||
if=Ethernet${i}
|
||||
wait_until_if_not_exists
|
||||
done
|
||||
done
|
@ -10,6 +10,10 @@ nodaemon=true
|
||||
command=/usr/sbin/lldpd -d -I Ethernet*,eth*
|
||||
priority=100
|
||||
|
||||
[program:lldpd-conf-reload]
|
||||
command=/opt/reconfigure.sh
|
||||
priority=150
|
||||
|
||||
[program:lldp-syncd]
|
||||
command=/usr/bin/env python2 -m lldp_syncd
|
||||
priority=200
|
||||
|
Loading…
Reference in New Issue
Block a user