diff --git a/dockers/docker-fpm-frr/TS b/dockers/docker-fpm-frr/TS index 78ba24d5db63..5057802c7661 100755 --- a/dockers/docker-fpm-frr/TS +++ b/dockers/docker-fpm-frr/TS @@ -10,7 +10,7 @@ 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'); + 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$" @@ -26,7 +26,7 @@ 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'); + 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$" @@ -38,3 +38,15 @@ function check_installed() 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 +} diff --git a/dockers/docker-fpm-frr/TSA b/dockers/docker-fpm-frr/TSA index 6312bf0ba5e6..f45d3bf0bcb3 100755 --- a/dockers/docker-fpm-frr/TSA +++ b/dockers/docker-fpm-frr/TSA @@ -3,12 +3,18 @@ # Load the common functions source /usr/bin/TS +find_num_routemap +routemap_count=$? check_not_installed not_installed=$? -if [[ $not_installed -ne 0 ]]; + +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'); + 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 diff --git a/dockers/docker-fpm-frr/TSB b/dockers/docker-fpm-frr/TSB index 44f9b15aea27..50f1ebc3ce8b 100755 --- a/dockers/docker-fpm-frr/TSB +++ b/dockers/docker-fpm-frr/TSB @@ -3,12 +3,18 @@ # Load the common functions source /usr/bin/TS +find_num_routemap +routemap_count=$? check_installed installed=$? -if [[ $installed -ne 0 ]]; + +if [[ $routemap_count -eq 0 ]]; +then + echo "System Mode: No external neighbors" +elif [[ $installed -ne 0 ]]; then TSB_FILE=$(mktemp) - for route_map_name in $(echo "$config" | sed -ne 's/ neighbor \S* route-map \(\S*\) out/\1/p'); + 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 diff --git a/dockers/docker-fpm-frr/TSC b/dockers/docker-fpm-frr/TSC index a0e908439e41..45d22bdf55c1 100755 --- a/dockers/docker-fpm-frr/TSC +++ b/dockers/docker-fpm-frr/TSC @@ -3,13 +3,18 @@ # Load the common functions source /usr/bin/TS +find_num_routemap +routemap_count=$? check_not_installed not_installed=$? check_installed installed=$? -if [[ $installed -eq 0 ]]; +if [[ $routemap_count -eq 0 ]]; +then + echo "System Mode: No external neighbors" +elif [[ $installed -eq 0 ]]; then echo "System Mode: Normal" elif [[ $not_installed -eq 0 ]];