Skip to content

[bgpcfgd]: Split one bgp mega-template to chunks. #4143

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

Merged
merged 34 commits into from
Apr 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
7b109d3
New bgpcfgd
pavel-shirshov Dec 28, 2019
d10ff63
Disable unit tests for frr.
pavel-shirshov Feb 13, 2020
5beb656
Another full rewrite
pavel-shirshov Mar 25, 2020
cd06c31
Use correct path
pavel-shirshov Apr 14, 2020
af9fbfb
Remove fixme
pavel-shirshov Apr 14, 2020
e9dbfa3
Add specification to exception handlers
pavel-shirshov Apr 14, 2020
fc51718
Fix typo
pavel-shirshov Apr 15, 2020
c6d375d
Add comments
PksStudent Apr 16, 2020
212d23d
Improve wait_for_*
pavel-shirshov Apr 16, 2020
935abcc
Remove one excessive fixme
pavel-shirshov Apr 16, 2020
a333c82
Rename runner and inverse the dependency
pavel-shirshov Apr 16, 2020
d9b664e
Add log_* functions
pavel-shirshov Apr 16, 2020
b138bdc
Remove fixme
pavel-shirshov Apr 16, 2020
2d1104b
Partially restore support for PR#3888
pavel-shirshov Apr 16, 2020
c3f9bfe
Add db name for BGPPeerMgr
pavel-shirshov Apr 16, 2020
d0a183b
Porting PR#4260. EVPN support
pavel-shirshov Apr 16, 2020
40f16c9
Full support of PR#3888
pavel-shirshov Apr 17, 2020
a47389a
Restore frr.conf configuration
pavel-shirshov Apr 17, 2020
235e1c3
Implement 'set src' for zebra
PksStudent Apr 17, 2020
3d09126
Rename db_id into db_name
pavel-shirshov Apr 18, 2020
04129f6
Refactor list of managers
pavel-shirshov Apr 18, 2020
726c883
Enhancements
PksStudent Apr 18, 2020
dc01af7
Fixes after pylint report
pavel-shirshov Apr 19, 2020
9935885
Change debug mode parameters
PksStudent Apr 19, 2020
9debc26
Small changes
pavel-shirshov Apr 19, 2020
8f78750
Disable debug
PksStudent Apr 19, 2020
0bb4cd6
Restored tests
PksStudent Apr 21, 2020
5edd39e
Return set ipv6 next-hop prefer-global clause
PksStudent Apr 21, 2020
ea88cfd
Don't render parts related to Loopback0 ipv6 addresses if we don't ha…
PksStudent Apr 21, 2020
d44926e
Fixed typos
PksStudent Apr 22, 2020
1b9def0
Fix issues in bgp templates for general peers
pavel-shirshov Apr 22, 2020
d7e1d76
It's normal to have the 'local_addr' missing for the dynamic bgp sess…
PksStudent Apr 22, 2020
1272cd4
Don't announce anything to bgp monitors
PksStudent Apr 22, 2020
73b8266
Fix typo
lguohan Apr 23, 2020
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
2 changes: 1 addition & 1 deletion dockers/docker-fpm-frr/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ RUN apt-get clean -y && \
apt-get autoremove -y && \
rm -rf /debs ~/.cache

COPY ["frr", "/usr/share/sonic/templates"]
COPY ["bgpcfgd", "start.sh", "/usr/bin/"]
COPY ["*.j2", "/usr/share/sonic/templates/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["snmp.conf", "/etc/snmp/frr.conf"]
COPY ["TSA", "/usr/bin/TSA"]
Expand Down
44 changes: 30 additions & 14 deletions dockers/docker-fpm-frr/TSA
Original file line number Diff line number Diff line change
@@ -1,22 +1,38 @@
#!/bin/bash

c=0
config=$(vtysh -c "show run")
echo "$config" | grep -q "route-map TO_BGP_PEER_V4 permit 2"
c=$((c+$?))
echo "$config" | grep -q "route-map TO_BGP_PEER_V4 deny 3"
c=$((c+$?))
echo "$config" | grep -q "route-map TO_BGP_PEER_V6 permit 2"
c=$((c+$?))
echo "$config" | grep -q "route-map TO_BGP_PEER_V6 deny 3"
c=$((c+$?))
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');
do
echo "$config" | grep -q "route-map $route_map_name permit 2"
c=$((c+$?))
echo "$config" | grep -q "route-map $route_map_name deny 3"
c=$((c+$?))
done
return $c
}

if [[ $c -eq 4 ]];
check_not_installed
not_installed=$?
if [[ $not_installed -ne 0 ]];
then
TSA_FILE=$(mktemp)
sonic-cfggen -d -y /etc/sonic/constants.yml -t /usr/share/sonic/templates/bgpd.tsa.isolate.conf.j2 > "$TSA_FILE"
vtysh -f "$TSA_FILE"
rm -f "$TSA_FILE"
for route_map_name in $(echo "$config" | sed -ne 's/ neighbor \S* route-map \(\S*\) out/\1/p');
do
case "$route_map_name" in
*V4*)
ip_version=V4
;;
*V6*)
ip_version=V6
;;
esac
sonic-cfggen -d -a "{\"route_map_name\":\"$route_map_name\", \"ip_version\": \"$ip_version\"}" -y /etc/sonic/constants.yml -t /usr/share/sonic/templates/bgpd/tsa/bgpd.tsa.isolate.conf.j2 > "$TSA_FILE"
vtysh -f "$TSA_FILE"
rm -f "$TSA_FILE"
done
echo "System Mode: Normal -> Maintenance"
else
echo "System is already in Maintenance mode"
Expand Down
39 changes: 25 additions & 14 deletions dockers/docker-fpm-frr/TSB
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
#!/bin/bash

c=0
config=$(vtysh -c "show run")
echo "$config" | grep -q "route-map TO_BGP_PEER_V4 permit 2"
c=$((c+$?))
echo "$config" | grep -q "route-map TO_BGP_PEER_V4 deny 3"
c=$((c+$?))
echo "$config" | grep -q "route-map TO_BGP_PEER_V6 permit 2"
c=$((c+$?))
echo "$config" | grep -q "route-map TO_BGP_PEER_V6 deny 3"
c=$((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');
do
echo "$config" | grep -q "route-map $route_map_name permit 2"
c=$((c+$?))
e=$((e+1))
echo "$config" | grep -q "route-map $route_map_name deny 3"
c=$((c+$?))
e=$((e+1))
done
return $((e-c))
}

if [[ $c -eq 0 ]];
check_installed
installed=$?
if [[ $installed -ne 0 ]];
then
TSB_FILE=$(mktemp)
sonic-cfggen -d -y /etc/sonic/constants.yml -t /usr/share/sonic/templates/bgpd.tsa.unisolate.conf.j2 > "$TSB_FILE"
vtysh -f "$TSB_FILE"
rm -f "$TSB_FILE"
for route_map_name in $(echo "$config" | sed -ne 's/ neighbor \S* route-map \(\S*\) out/\1/p');
do
sonic-cfggen -d -a "{\"route_map_name\":\"$route_map_name\"}" -t /usr/share/sonic/templates/bgpd/tsa/bgpd.tsa.unisolate.conf.j2 > "$TSB_FILE"
vtysh -f "$TSB_FILE"
rm -f "$TSB_FILE"
done
echo "System Mode: Maintenance -> Normal"
else
echo "System is already in Normal mode"
Expand Down
51 changes: 39 additions & 12 deletions dockers/docker-fpm-frr/TSC
Original file line number Diff line number Diff line change
@@ -1,21 +1,48 @@
#!/bin/bash

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');
do
echo "$config" | grep -q "route-map $route_map_name permit 2"
c=$((c+$?))
echo "$config" | grep -q "route-map $route_map_name deny 3"
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');
do
echo "$config" | grep -q "route-map $route_map_name permit 2"
c=$((c+$?))
e=$((e+1))
echo "$config" | grep -q "route-map $route_map_name deny 3"
c=$((c+$?))
e=$((e+1))
done
return $((e-c))
}

echo "Traffic Shift Check:"
c=0
config=$(vtysh -c "show run")
echo "$config" | grep -q "route-map TO_BGP_PEER_V4 permit 2"
c=$((c+$?))
echo "$config" | grep -q "route-map TO_BGP_PEER_V4 deny 3"
c=$((c+$?))
echo "$config" | grep -q "route-map TO_BGP_PEER_V6 permit 2"
c=$((c+$?))
echo "$config" | grep -q "route-map TO_BGP_PEER_V6 deny 3"
c=$((c+$?))

if [[ $c -eq 4 ]];
check_not_installed
not_installed=$?

check_installed
installed=$?

if [[ $installed -eq 0 ]];
then
echo "System Mode: Normal"
elif [[ $c -eq 0 ]];
elif [[ $not_installed -eq 0 ]];
then
echo "System Mode: Maintenance"
else
Expand Down
Loading