b9f8348a5d
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.
53 lines
1.3 KiB
Bash
Executable File
53 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Check whether the routemap is for internal BGP sessions.
|
|
function is_internal_route_map()
|
|
{
|
|
[[ "$1" =~ .*"_INTERNAL_".* ]]
|
|
}
|
|
|
|
function check_not_installed()
|
|
{
|
|
c=0
|
|
config=$(vtysh -c "show run")
|
|
for route_map_name in $(echo "$config" | sed -ne 's/ neighbor \S* route-map \(\S*\) out/\1/p' | egrep 'V4|V6' | uniq);
|
|
do
|
|
is_internal_route_map $route_map_name && continue
|
|
echo "$config" | egrep -q "^route-map $route_map_name permit 20$"
|
|
c=$((c+$?))
|
|
echo "$config" | egrep -q "^route-map $route_map_name deny 30$"
|
|
c=$((c+$?))
|
|
done
|
|
return $c
|
|
}
|
|
|
|
function check_installed()
|
|
{
|
|
c=0
|
|
e=0
|
|
config=$(vtysh -c "show run")
|
|
for route_map_name in $(echo "$config" | sed -ne 's/ neighbor \S* route-map \(\S*\) out/\1/p' | egrep 'V4|V6' | uniq);
|
|
do
|
|
is_internal_route_map $route_map_name && continue
|
|
echo "$config" | egrep -q "^route-map $route_map_name permit 20$"
|
|
c=$((c+$?))
|
|
e=$((e+1))
|
|
echo "$config" | egrep -q "^route-map $route_map_name deny 30$"
|
|
c=$((c+$?))
|
|
e=$((e+1))
|
|
done
|
|
return $((e-c))
|
|
}
|
|
|
|
function find_num_routemap()
|
|
{
|
|
c=0
|
|
config=$(vtysh -c "show run")
|
|
for route_map_name in $(echo "$config" | sed -ne 's/ neighbor \S* route-map \(\S*\) out/\1/p' | egrep 'V4|V6' | uniq);
|
|
do
|
|
is_internal_route_map $route_map_name && continue
|
|
c=$((c+1))
|
|
done
|
|
return $c
|
|
}
|