File tree 12 files changed +46
-29
lines changed
12 files changed +46
-29
lines changed Original file line number Diff line number Diff line change 3
3
c=0
4
4
config=$( vtysh -c " show run" )
5
5
echo " $config " | grep -q " route-map TO_BGP_PEER_V4 permit 2"
6
- c=$(( $ c+ $? ))
6
+ c=$(( c+ $? ))
7
7
echo " $config " | grep -q " route-map TO_BGP_PEER_V4 deny 3"
8
- c=$(( $ c+ $? ))
8
+ c=$(( c+ $? ))
9
9
echo " $config " | grep -q " route-map TO_BGP_PEER_V6 permit 2"
10
- c=$(( $ c+ $? ))
10
+ c=$(( c+ $? ))
11
11
echo " $config " | grep -q " route-map TO_BGP_PEER_V6 deny 3"
12
- c=$(( $ c+ $? ))
12
+ c=$(( c+ $? ))
13
13
14
14
if [[ $c -eq 4 ]];
15
15
then
16
- vtysh -c " configure terminal " -c " route-map TO_BGP_PEER_V4 permit 2 " -c " match ip address prefix-list PL_LoopbackV4 "
17
- vtysh -c " configure terminal " -c " route-map TO_BGP_PEER_V4 deny 3 "
18
- vtysh -c " configure terminal " -c " route-map TO_BGP_PEER_V6 permit 2 " -c " match ipv6 address prefix-list PL_LoopbackV6 "
19
- vtysh -c " configure terminal " -c " route-map TO_BGP_PEER_V6 deny 3 "
16
+ TSA_FILE= $( mktemp )
17
+ sonic-cfggen -d -y /etc/sonic/constants.yml -t /usr/share/sonic/templates/bgpd.tsa.isolate.conf.j2 > " $TSA_FILE "
18
+ vtysh -f " $TSA_FILE "
19
+ rm -f " $TSA_FILE "
20
20
echo " System Mode: Normal -> Maintenance"
21
21
else
22
22
echo " System is already in Maintenance mode"
Original file line number Diff line number Diff line change 3
3
c=0
4
4
config=$( vtysh -c " show run" )
5
5
echo " $config " | grep -q " route-map TO_BGP_PEER_V4 permit 2"
6
- c=$(( $ c+ $? ))
6
+ c=$(( c+ $? ))
7
7
echo " $config " | grep -q " route-map TO_BGP_PEER_V4 deny 3"
8
- c=$(( $ c+ $? ))
8
+ c=$(( c+ $? ))
9
9
echo " $config " | grep -q " route-map TO_BGP_PEER_V6 permit 2"
10
- c=$(( $ c+ $? ))
10
+ c=$(( c+ $? ))
11
11
echo " $config " | grep -q " route-map TO_BGP_PEER_V6 deny 3"
12
- c=$(( $ c+ $? ))
12
+ c=$(( c+ $? ))
13
13
14
14
if [[ $c -eq 0 ]];
15
15
then
16
- vtysh -c " configure terminal" -c " no route-map TO_BGP_PEER_V4 deny 3"
17
- vtysh -c " configure terminal" -c " no route-map TO_BGP_PEER_V4 permit 2"
18
- vtysh -c " configure terminal" -c " no route-map TO_BGP_PEER_V6 deny 3"
19
- vtysh -c " configure terminal" -c " no route-map TO_BGP_PEER_V6 permit 2"
20
-
16
+ TSB_FILE=$( mktemp)
17
+ sonic-cfggen -d -y /etc/sonic/constants.yml -t /usr/share/sonic/templates/bgpd.tsa.unisolate.conf.j2 > " $TSB_FILE "
18
+ vtysh -f " $TSB_FILE "
19
+ rm -f " $TSB_FILE "
21
20
echo " System Mode: Maintenance -> Normal"
22
21
else
23
22
echo " System is already in Normal mode"
Original file line number Diff line number Diff line change @@ -4,13 +4,13 @@ echo "Traffic Shift Check:"
4
4
c=0
5
5
config=$( vtysh -c " show run" )
6
6
echo " $config " | grep -q " route-map TO_BGP_PEER_V4 permit 2"
7
- c=$(( $ c+ $? ))
7
+ c=$(( c+ $? ))
8
8
echo " $config " | grep -q " route-map TO_BGP_PEER_V4 deny 3"
9
- c=$(( $ c+ $? ))
9
+ c=$(( c+ $? ))
10
10
echo " $config " | grep -q " route-map TO_BGP_PEER_V6 permit 2"
11
- c=$(( $ c+ $? ))
11
+ c=$(( c+ $? ))
12
12
echo " $config " | grep -q " route-map TO_BGP_PEER_V6 deny 3"
13
- c=$(( $ c+ $? ))
13
+ c=$(( c+ $? ))
14
14
15
15
if [[ $c -eq 4 ]];
16
16
then
Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
107
107
{% if bgp_peer ['peer_asn' ] is defined %}
108
108
neighbor {{ bgp_peer['name'] }} remote-as {{ bgp_peer['peer_asn'] }}
109
109
{% else %}
110
- neighbor {{ bgp_peer['name'] }} remote-as {{ deployment_id_asn_map[DEVICE_METADATA['localhost'] ['deployment_id']] }}
110
+ neighbor {{ bgp_peer['name'] }} remote-as {{ constants. deployment_id_asn_map[DEVICE_METADATA['localhost'] ['deployment_id']] }}
111
111
{% endif %}
112
112
neighbor {{ bgp_peer['name'] }} ebgp-multihop 255
113
113
neighbor {{ bgp_peer['name'] }} soft-reconfiguration inbound
Original file line number Diff line number Diff line change
1
+ route-map TO_BGP_PEER_V4 permit 2
2
+ match ip address prefix-list PL_LoopbackV4
3
+ set community {{ constants.traffic_shift_community }}
4
+ route-map TO_BGP_PEER_V4 deny 3
5
+ !
6
+ route-map TO_BGP_PEER_V6 permit 2
7
+ match ipv6 address prefix-list PL_LoopbackV6
8
+ set community {{ constants.traffic_shift_community }}
9
+ route-map TO_BGP_PEER_V6 deny 3
10
+ !
Original file line number Diff line number Diff line change
1
+ no route-map TO_BGP_PEER_V4 permit 2
2
+ no route-map TO_BGP_PEER_V4 deny 3
3
+ !
4
+ no route-map TO_BGP_PEER_V6 permit 2
5
+ no route-map TO_BGP_PEER_V6 deny 3
6
+ !
Original file line number Diff line number Diff line change @@ -5,13 +5,13 @@ mkdir -p /etc/frr
5
5
CONFIG_TYPE=` sonic-cfggen -d -v ' DEVICE_METADATA["localhost"]["docker_routing_config_mode"]' `
6
6
7
7
if [ -z " $CONFIG_TYPE " ] || [ " $CONFIG_TYPE " == " separated" ]; then
8
- sonic-cfggen -d -y /etc/sonic/deployment_id_asn_map .yml -t /usr/share/sonic/templates/bgpd.conf.j2 > /etc/frr/bgpd.conf
8
+ sonic-cfggen -d -y /etc/sonic/constants .yml -t /usr/share/sonic/templates/bgpd.conf.j2 > /etc/frr/bgpd.conf
9
9
sonic-cfggen -d -t /usr/share/sonic/templates/zebra.conf.j2 > /etc/frr/zebra.conf
10
10
sonic-cfggen -d -t /usr/share/sonic/templates/staticd.conf.j2 > /etc/frr/staticd.conf
11
11
echo " no service integrated-vtysh-config" > /etc/frr/vtysh.conf
12
12
rm -f /etc/frr/frr.conf
13
13
elif [ " $CONFIG_TYPE " == " unified" ]; then
14
- sonic-cfggen -d -y /etc/sonic/deployment_id_asn_map .yml -t /usr/share/sonic/templates/frr.conf.j2 > /etc/frr/frr.conf
14
+ sonic-cfggen -d -y /etc/sonic/constants .yml -t /usr/share/sonic/templates/frr.conf.j2 > /etc/frr/frr.conf
15
15
echo " service integrated-vtysh-config" > /etc/frr/vtysh.conf
16
16
rm -f /etc/frr/bgpd.conf /etc/frr/zebra.conf /etc/frr/staticd.conf
17
17
fi
Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
101
101
{% if bgp_peer ['peer_asn' ] is defined %}
102
102
neighbor {{ bgp_peer['name'] }} remote-as {{ bgp_peer['peer_asn'] }}
103
103
{% else %}
104
- neighbor {{ bgp_peer['name'] }} remote-as {{ deployment_id_asn_map[DEVICE_METADATA['localhost'] ['deployment_id']] }}
104
+ neighbor {{ bgp_peer['name'] }} remote-as {{ constants. deployment_id_asn_map[DEVICE_METADATA['localhost'] ['deployment_id']] }}
105
105
{% endif %}
106
106
neighbor {{ bgp_peer['name'] }} ebgp-multihop 255
107
107
neighbor {{ bgp_peer['name'] }} soft-reconfiguration inbound
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
3
mkdir -p /etc/quagga
4
- sonic-cfggen -d -y /etc/sonic/deployment_id_asn_map .yml -t /usr/share/sonic/templates/bgpd.conf.j2 > /etc/quagga/bgpd.conf
4
+ sonic-cfggen -d -y /etc/sonic/constants .yml -t /usr/share/sonic/templates/bgpd.conf.j2 > /etc/quagga/bgpd.conf
5
5
6
6
sonic-cfggen -d -t /usr/share/sonic/templates/zebra.conf.j2 > /etc/quagga/zebra.conf
7
7
Original file line number Diff line number Diff line change @@ -235,7 +235,7 @@ sudo bash -c "echo '{ \"DEVICE_METADATA\": { \"localhost\": { \"default_bgp_stat
235
235
sudo cp $IMAGE_CONFIGS /snmp/snmp.yml $FILESYSTEM_ROOT /etc/sonic/
236
236
237
237
# Copy ASN configuration files
238
- sudo cp $IMAGE_CONFIGS /asn/deployment_id_asn_map .yml $FILESYSTEM_ROOT /etc/sonic/
238
+ sudo cp $IMAGE_CONFIGS /constants/constants .yml $FILESYSTEM_ROOT /etc/sonic/
239
239
240
240
# Copy sudoers configuration file
241
241
sudo cp $IMAGE_CONFIGS /sudoers/sudoers $FILESYSTEM_ROOT /etc/
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ constants :
2
+ deployment_id_asn_map :
3
+ " 1" : 65432
4
+ traffic_shift_community : 12345:12345
You can’t perform that action at this time.
0 commit comments