[docker-frr]: Use egrep with regexp to match correct TSA rules (#6403)
**- Why I did it** Earlier today we found a bug in the SONiC TSA implementation. TSC shows incorrect output (see below) in case we have a route-map which contains TSA route-map as a prefix. ``` admin@str-s6100-acs-1:~$ TSC Traffic Shift Check: System Mode: Not consistent ``` The reason is that TSC implementation has too loose regexps in TSA utilities, which match wrong route-map entries: For example, current TSC matches following ``` route-map TO_BGP_PEER_V4 permit 200 route-map TO_BGP_PEER_V6 permit 200 ``` But it should match only ``` route-map TO_BGP_PEER_V4 permit 20 route-map TO_BGP_PEER_V4 deny 30 route-map TO_BGP_PEER_V6 permit 20 route-map TO_BGP_PEER_V6 deny 30 ``` **- How I did it** I fixed it by using egrep with `^` and `$` regexp markers which match begin and end of the line. **- How to verify it** 1. Add follwing entry to FRR config: ``` str-s6100-acs-1# str-s6100-acs-1# conf t str-s6100-acs-1(config)# route-map TO_BGP_PEER_V4 permit 200 str-s6100-acs-1(config-route-map)# end ``` 2. Use the TSC command and check output. It should show normal. ``` admin@str-s6100-acs-1:~$ TSC Traffic Shift Check: System Mode: Normal```
This commit is contained in:
parent
419c10bf97
commit
16e54340b7
@ -6,9 +6,9 @@ function check_not_installed()
|
||||
config=$(vtysh -c "show run")
|
||||
for route_map_name in $(echo "$config" | sed -ne 's/ neighbor \S* route-map \(\S*\) out/\1/p');
|
||||
do
|
||||
echo "$config" | grep -q "route-map $route_map_name permit 20"
|
||||
echo "$config" | egrep -q "^route-map $route_map_name permit 20$"
|
||||
c=$((c+$?))
|
||||
echo "$config" | grep -q "route-map $route_map_name deny 30"
|
||||
echo "$config" | egrep -q "^route-map $route_map_name deny 30$"
|
||||
c=$((c+$?))
|
||||
done
|
||||
return $c
|
||||
|
@ -7,10 +7,10 @@ function check_installed()
|
||||
config=$(vtysh -c "show run")
|
||||
for route_map_name in $(echo "$config" | sed -ne 's/ neighbor \S* route-map \(\S*\) out/\1/p');
|
||||
do
|
||||
echo "$config" | grep -q "route-map $route_map_name permit 20"
|
||||
echo "$config" | egrep -q "^route-map $route_map_name permit 20$"
|
||||
c=$((c+$?))
|
||||
e=$((e+1))
|
||||
echo "$config" | grep -q "route-map $route_map_name deny 30"
|
||||
echo "$config" | egrep -q "^route-map $route_map_name deny 30$"
|
||||
c=$((c+$?))
|
||||
e=$((e+1))
|
||||
done
|
||||
|
@ -6,9 +6,9 @@ function check_not_installed()
|
||||
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');
|
||||
do
|
||||
echo "$config" | grep -q "route-map $route_map_name permit 20"
|
||||
echo "$config" | egrep -q "^route-map $route_map_name permit 20$"
|
||||
c=$((c+$?))
|
||||
echo "$config" | grep -q "route-map $route_map_name deny 30"
|
||||
echo "$config" | egrep -q "^route-map $route_map_name deny 30$"
|
||||
c=$((c+$?))
|
||||
done
|
||||
return $c
|
||||
@ -21,10 +21,10 @@ function check_installed()
|
||||
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');
|
||||
do
|
||||
echo "$config" | grep -q "route-map $route_map_name permit 20"
|
||||
echo "$config" | egrep -q "^route-map $route_map_name permit 20$"
|
||||
c=$((c+$?))
|
||||
e=$((e+1))
|
||||
echo "$config" | grep -q "route-map $route_map_name deny 30"
|
||||
echo "$config" | egrep -q "^route-map $route_map_name deny 30$"
|
||||
c=$((c+$?))
|
||||
e=$((e+1))
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user