sonic-buildimage/dockers/docker-fpm-frr/TSA
judyjoseph 1ad5dbeab6
Fixes for errors seen in staging devices (#7171)
With the latest 201911 image, the following error was seen on staging devices with TSB command ( for both single asic, multi asic ). Though this err message doesn't affect the TSB functionality, it is good to fix.

admin@STG01-0101-0102-01T1:~$ TSB
BGP0 : % Could not find route-map entry TO_TIER0_V4 20
line 1: Failure to communicate[13] to zebra, line: no route-map TO_TIER0_V4 permit 20
% Could not find route-map entry TO_TIER0_V4 30
line 2: Failure to communicate[13] to zebra, line: no route-map TO_TIER0_V4 deny 30

In addition, in this PR I am fixing the message displayed to user when there are no BGP neighbors configured on that BGP instance. In multi-asic device there could be case where there are no BGP neighbors configured on a particular ASIC.
2021-04-08 15:16:43 -07:00

41 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
# Load the common functions
source /usr/bin/TS
find_num_routemap
routemap_count=$?
check_not_installed
not_installed=$?
if [[ $routemap_count -eq 0 ]];
then
echo "System Mode: No external neighbors"
elif [[ $not_installed -ne 0 ]];
then
TSA_FILE=$(mktemp)
for route_map_name in $(echo "$config" | sed -ne 's/ neighbor \S* route-map \(\S*\) out/\1/p' | uniq);
do
is_internal_route_map $route_map_name && continue
case "$route_map_name" in
*V4*)
ip_version=V4
ip_protocol=ip
;;
*V6*)
ip_version=V6
ip_protocol=ipv6
;;
*)
continue
;;
esac
sonic-cfggen -d -a "{\"route_map_name\":\"$route_map_name\", \"ip_version\": \"$ip_version\", \"ip_protocol\": \"$ip_protocol\"}" -y /etc/sonic/constants.yml -t /usr/share/sonic/templates/bgpd/tsa/bgpd.tsa.isolate.conf.j2 > "$TSA_FILE"
vtysh -f "$TSA_FILE"
rm -f "$TSA_FILE"
done
echo "System Mode: Normal -> Maintenance"
else
echo "System is already in Maintenance mode"
fi