Address CR suggestions
This commit is contained in:
parent
62af66a1f0
commit
ac64c1c29b
@ -8,54 +8,46 @@ last_if_idx=$((num_of_interfaces*if_step - if_step))
|
|||||||
|
|
||||||
function wait_until_if_exists
|
function wait_until_if_exists
|
||||||
{
|
{
|
||||||
while /bin/true ;
|
if=$1
|
||||||
|
while [ ! -L /sys/class/net/"$if" ] ;
|
||||||
do
|
do
|
||||||
if [ -L /sys/class/net/"$if" ];
|
|
||||||
then
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
echo interface "$if" is up
|
echo interface "$if" is created
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function wait_until_if_not_exists
|
function wait_until_if_not_exists
|
||||||
{
|
{
|
||||||
while /bin/true ;
|
if=$1
|
||||||
|
while [ -L /sys/class/net/"$if" ] ;
|
||||||
do
|
do
|
||||||
if [ ! -L /sys/class/net/"$if" ];
|
|
||||||
then
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
echo interface "$if" is down
|
echo interface "$if" is destroyed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
while /bin/true ;
|
while /bin/true ;
|
||||||
do
|
do
|
||||||
# wait until all interfaces are up
|
# wait until all interfaces are created
|
||||||
echo Wait until all ifaces are up
|
echo Wait until all ifaces are created
|
||||||
for i in $(seq 0 $if_step $last_if_idx)
|
for i in $(seq 0 $if_step $last_if_idx)
|
||||||
do
|
do
|
||||||
if=Ethernet${i}
|
wait_until_if_exists "Ethernet$i"
|
||||||
wait_until_if_exists
|
|
||||||
done
|
done
|
||||||
|
|
||||||
echo Wait 10 seconds
|
echo Wait 10 seconds while lldpd finds new interfaces
|
||||||
sleep 10
|
sleep 10
|
||||||
|
|
||||||
# apply lldpd configuration
|
# apply lldpd configuration
|
||||||
echo apply lldpd configuration
|
echo apply lldpd configuration
|
||||||
lldpcli -c /etc/lldpd.conf
|
lldpcli -c /etc/lldpd.conf
|
||||||
|
|
||||||
# wait until all interfaces are down
|
# wait until all interfaces are destroyed
|
||||||
echo Wait until all ifaces are down
|
echo Wait until all ifaces are destroyed
|
||||||
for i in $(seq 0 $if_step $last_if_idx)
|
for i in $(seq 0 $if_step $last_if_idx)
|
||||||
do
|
do
|
||||||
if=Ethernet${i}
|
wait_until_if_not_exists "Ethernet$i"
|
||||||
wait_until_if_not_exists
|
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
Reference in New Issue
Block a user