Created
May 6, 2020 18:01
-
-
Save rodolfovalentim/aa6ec5acd8be622e4db98567e35b3598 to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
while [ 1 ]; do | |
echo "Starting loop" | |
PKTLOSS1=$(ip netns exec qrouter ping -c 1 8.8.8.8 -q | grep loss | awk '{print $7}') | |
PKTLOSS2=$(ip netns exec qrouter ping -c 1 8.8.4.4 -q | grep loss | awk '{print $7}') | |
if [ $PKTLOSS1 = '0%' -a $PKTLOSS2 = '0%' ]; then | |
echo "# Duas saidas" | |
ovs-ofctl -O OpenFlow13 mod-group br-ex group_id=1,type=select,bucket=bucket_id:1,actions=bucket=bucket_id:1,actions="resubmit(,1)",weight=1,bucket=bucket_id:2,actions="resubmit(,2)",weight=1 | |
fi | |
if [ $PKTLOSS1 = '0%' -a $PKTLOSS2 = '100%' ]; then | |
echo "# Saida pela Wan1 eth0.3" | |
ovs-ofctl -O OpenFlow13 mod-group br-ex group_id=1,type=select,bucket=bucket_id:1,actions='resubmit(,1)' | |
fi | |
if [ $PKTLOSS1 = '100%' -a $PKTLOSS2 = '0%' ]; then | |
echo "# Saida pela wan2 eth0.4" | |
ovs-ofctl -O OpenFlow13 mod-group br-ex group_id=1,type=select,bucket=bucket_id:1,actions='resubmit(,2)' | |
fi | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment