sonic-buildimage/dockers/docker-fpm-frr/TSA

24 lines
841 B
Plaintext
Raw Normal View History

#!/bin/bash
c=0
config=$(vtysh -c "show run")
echo "$config" | grep -q "route-map TO_BGP_PEER_V4 permit 2"
c=$(($c+$?))
echo "$config" | grep -q "route-map TO_BGP_PEER_V4 deny 3"
c=$(($c+$?))
echo "$config" | grep -q "route-map TO_BGP_PEER_V6 permit 2"
c=$(($c+$?))
echo "$config" | grep -q "route-map TO_BGP_PEER_V6 deny 3"
c=$(($c+$?))
if [[ $c -eq 4 ]];
then
vtysh -c "configure terminal" -c "route-map TO_BGP_PEER_V4 permit 2" -c "match ip address prefix-list PL_LoopbackV4"
vtysh -c "configure terminal" -c "route-map TO_BGP_PEER_V4 deny 3"
vtysh -c "configure terminal" -c "route-map TO_BGP_PEER_V6 permit 2" -c "match ipv6 address prefix-list PL_LoopbackV6"
vtysh -c "configure terminal" -c "route-map TO_BGP_PEER_V6 deny 3"
echo "System Mode: Normal -> Maintenance"
else
echo "System is already in Maintenance mode"
fi