-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apply port configurations after ports are created #49
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/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" ]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Use $1 instead of global variable #Closed |
||
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" ]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The same. #Closed |
||
then | ||
break | ||
fi | ||
sleep 1 | ||
done | ||
echo interface "$if" is down | ||
} | ||
|
||
|
||
while /bin/true ; | ||
do | ||
# wait until all interfaces are up | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
What happens if not waiting? #Closed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lldpd doesn't store a configuration for ports which aren't exist. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it possible that some interface will never be up, then we wait forever here? In reply to: 85829244 [](ancestors = 85829244) |
||
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 | ||
|
||
echo Wait 10 seconds | ||
sleep 10 | ||
|
||
# apply lldpd configuration | ||
echo apply lldpd configuration | ||
lldpcli -c /etc/lldpd.conf | ||
|
||
# wait until all interfaces are down | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Why waiting? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To find the time when we need to check that the interfaces are created. |
||
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while [ -L ... ] ? #Closed