5057ac3122
* [MultiDB] (./dockers dirs): replace redis-cli with sonic-db-cli and use new DBConnector * remove unnecessary quota * update typo
41 lines
1.0 KiB
Django/Jinja
41 lines
1.0 KiB
Django/Jinja
#!/usr/bin/env bash
|
|
|
|
function wait_until_iface_ready
|
|
{
|
|
IFACE_NAME=$1
|
|
IFACE_CIDR=$2
|
|
|
|
echo "Waiting until interface ${IFACE_NAME} 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=$(sonic-db-cli STATE_DB HGET "INTERFACE_TABLE|${IFACE_NAME}|${IFACE_CIDR}" "state" 2> /dev/null)
|
|
if [ x"$RESULT" == x"ok" ]; then
|
|
break
|
|
fi
|
|
|
|
sleep 1
|
|
done
|
|
|
|
echo "Interface ${IFACE_NAME} is ready!"
|
|
}
|
|
|
|
|
|
# Wait for all interfaces with IPv4 addresses to be up and ready
|
|
{% for (name, prefix) in INTERFACE|pfx_filter %}
|
|
{% if prefix | ipv4 %}
|
|
wait_until_iface_ready {{ name }} {{ prefix }}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% for (name, prefix) in VLAN_INTERFACE|pfx_filter %}
|
|
{% if prefix | ipv4 %}
|
|
wait_until_iface_ready {{ name }} {{ prefix }}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% for (name, prefix) in PORTCHANNEL_INTERFACE|pfx_filter %}
|
|
{% if prefix | ipv4 %}
|
|
wait_until_iface_ready {{ name }} {{ prefix }}
|
|
{% endif %}
|
|
{% endfor %}
|