-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update port configurations in lldpd as soon as port created
- Loading branch information
1 parent
73cbf6c
commit 30438bb
Showing
3 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters