forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[router-advertiser] Add templated script to wait for pertinent interf…
…aces to be ready before starting radvd (sonic-net#2558)
- Loading branch information
1 parent
47088e5
commit 50a23a9
Showing
4 changed files
with
41 additions
and
1 deletion.
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
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,32 @@ | ||
#!/usr/bin/env bash | ||
|
||
STATE_DB_IDX="6" | ||
|
||
VLAN_TABLE_PREFIX="VLAN_TABLE" | ||
|
||
function wait_until_iface_ready | ||
{ | ||
TABLE_PREFIX=$1 | ||
IFACE=$2 | ||
|
||
echo "Waiting until interface $IFACE is ready..." | ||
|
||
# Wait for the interface to come up | ||
# (i.e., interface is present in STATE_DB and state is "ok") | ||
while true; do | ||
RESULT=$(redis-cli -n ${STATE_DB_IDX} HGET "${TABLE_PREFIX}|${IFACE}" "state" 2> /dev/null) | ||
if [ x"$RESULT" == x"ok" ]; then | ||
break | ||
fi | ||
|
||
sleep 1 | ||
done | ||
|
||
echo "Interface ${IFACE} is ready!" | ||
} | ||
|
||
|
||
# Wait for all interfaces to be up and ready | ||
{% for (name, prefix) in VLAN_INTERFACE %} | ||
wait_until_iface_ready ${VLAN_TABLE_PREFIX} {{ name }} | ||
{% endfor %} |
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