Skip to content
Merged
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
16 changes: 14 additions & 2 deletions dockers/docker-fpm-frr/TS
Original file line number Diff line number Diff line change
Expand Up @@ -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$"
Expand All @@ -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$"
Expand All @@ -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
}
10 changes: 8 additions & 2 deletions dockers/docker-fpm-frr/TSA
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions dockers/docker-fpm-frr/TSB
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion dockers/docker-fpm-frr/TSC
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]];
Expand Down