From ac64c1c29b86c6068377078d5033d070ddee9c5a Mon Sep 17 00:00:00 2001 From: Pavel Shirshov Date: Mon, 31 Oct 2016 13:56:45 -0700 Subject: [PATCH] Address CR suggestions --- dockers/docker-lldp-sv2/reconfigure.sh | 34 ++++++++++---------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/dockers/docker-lldp-sv2/reconfigure.sh b/dockers/docker-lldp-sv2/reconfigure.sh index 11c83bad079f..9f42a33a24b4 100755 --- a/dockers/docker-lldp-sv2/reconfigure.sh +++ b/dockers/docker-lldp-sv2/reconfigure.sh @@ -8,54 +8,46 @@ last_if_idx=$((num_of_interfaces*if_step - if_step)) function wait_until_if_exists { - while /bin/true ; + if=$1 + while [ ! -L /sys/class/net/"$if" ] ; do - if [ -L /sys/class/net/"$if" ]; - then - break - fi sleep 1 done - echo interface "$if" is up + echo interface "$if" is created } function wait_until_if_not_exists { - while /bin/true ; + if=$1 + while [ -L /sys/class/net/"$if" ] ; do - if [ ! -L /sys/class/net/"$if" ]; - then - break - fi sleep 1 done - echo interface "$if" is down + echo interface "$if" is destroyed } while /bin/true ; do - # wait until all interfaces are up - echo Wait until all ifaces are up + # wait until all interfaces are created + echo Wait until all ifaces are created for i in $(seq 0 $if_step $last_if_idx) do - if=Ethernet${i} - wait_until_if_exists + wait_until_if_exists "Ethernet$i" done - echo Wait 10 seconds + echo Wait 10 seconds while lldpd finds new interfaces sleep 10 # 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 + # wait until all interfaces are destroyed + echo Wait until all ifaces are destroyed for i in $(seq 0 $if_step $last_if_idx) do - if=Ethernet${i} - wait_until_if_not_exists + wait_until_if_not_exists "Ethernet$i" done done