Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TS/TSA/B/C]: Update traffic-shift scripts with bgp neighbor check enhancement #8990

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions dockers/docker-fpm-frr/TS
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,18 @@ function find_num_routemap()
done
return $c
}

function find_num_ebgp_neighbors()
{
count=0
summary=$(vtysh -c "show bgp summary json")
local_as=$(echo "$summary" | sed -n 's/ *"as":\(\S*\),/\1/p' | uniq)
for remote_as in $(echo "$summary" | sed -n 's/ *"remoteAs":\(\S*\),/\1/p');
do
if [[ $remote_as -ne $local_as ]];
then
count=$((count+1))
fi
done
return $count
}
6 changes: 3 additions & 3 deletions dockers/docker-fpm-frr/TSA
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
# Load the common functions
source /usr/bin/TS

find_num_routemap
routemap_count=$?
find_num_ebgp_neighbors
neighbor_count=$?
check_not_installed
not_installed=$?

if [[ $routemap_count -eq 0 ]];
if [[ $neighbor_count -eq 0 ]];
then
echo "System Mode: No external neighbors"
elif [[ $not_installed -ne 0 ]];
Expand Down
6 changes: 3 additions & 3 deletions dockers/docker-fpm-frr/TSB
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
# Load the common functions
source /usr/bin/TS

find_num_routemap
routemap_count=$?
find_num_ebgp_neighbors
neighbor_count=$?
check_installed
installed=$?

if [[ $routemap_count -eq 0 ]];
if [[ $neighbor_count -eq 0 ]];
then
echo "System Mode: No external neighbors"
elif [[ $installed -ne 0 ]];
Expand Down
6 changes: 3 additions & 3 deletions dockers/docker-fpm-frr/TSC
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
# Load the common functions
source /usr/bin/TS

find_num_routemap
routemap_count=$?
find_num_ebgp_neighbors
neighbor_count=$?
check_not_installed
not_installed=$?

check_installed
installed=$?

if [[ $routemap_count -eq 0 ]];
if [[ $neighbor_count -eq 0 ]];
then
echo "System Mode: No external neighbors"
elif [[ $installed -eq 0 ]];
Expand Down