Skip to content

Commit

Permalink
Allow TSA on ibgp sessions between linecards on packet chassis (#12589)
Browse files Browse the repository at this point in the history
  • Loading branch information
tjchadaga authored Nov 3, 2022
1 parent 1f88a3e commit 763d3dc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
3 changes: 2 additions & 1 deletion dockers/docker-fpm-frr/TS
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/bin/bash

switch_type=`sonic-cfggen -d -v "DEVICE_METADATA['localhost']['switch_type']"`
# Check whether the routemap is for internal BGP sessions.
function is_internal_route_map()
{
[[ "$1" =~ .*"_INTERNAL_".* ]]
[[ "$1" =~ .*"_INTERNAL_".* && $switch_type != "chassis-packet" ]]
}

function check_not_installed()
Expand Down
14 changes: 13 additions & 1 deletion src/sonic-bgpcfgd/bgpcfgd/managers_device_global.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,30 @@ def __init__(self, common_objs, db, table):
:param db: name of the db
:param table: name of the table in the db
"""
self.switch_type = ""
self.directory = common_objs['directory']
self.cfg_mgr = common_objs['cfg_mgr']
self.constants = common_objs['constants']
self.tsa_template = common_objs['tf'].from_file("bgpd/tsa/bgpd.tsa.isolate.conf.j2")
self.tsb_template = common_objs['tf'].from_file("bgpd/tsa/bgpd.tsa.unisolate.conf.j2")
self.directory.subscribe([("CONFIG_DB", swsscommon.CFG_DEVICE_METADATA_TABLE_NAME, "localhost/switch_type"),], self.on_switch_type_change)
super(DeviceGlobalCfgMgr, self).__init__(
common_objs,
[],
db,
table,
)

def on_switch_type_change(self):
log_debug("DeviceGlobalCfgMgr:: Switch type update handler")
if self.directory.path_exist("CONFIG_DB", swsscommon.CFG_DEVICE_METADATA_TABLE_NAME, "localhost/switch_type"):
self.switch_type = self.directory.get_slot("CONFIG_DB", swsscommon.CFG_DEVICE_METADATA_TABLE_NAME)["localhost"]["switch_type"]
log_debug("DeviceGlobalCfgMgr:: Switch type: %s" % self.switch_type)

def set_handler(self, key, data):
log_debug("DeviceGlobalCfgMgr:: set handler")
if self.switch_type:
log_debug("DeviceGlobalCfgMgr:: Switch type: %s" % self.switch_type)
""" Handle device tsa_enabled state change """
if not data:
log_err("DeviceGlobalCfgMgr:: data is None")
Expand Down Expand Up @@ -78,7 +88,9 @@ def get_ts_routemaps(self, cmds, ts_template):
def __generate_routemaps_from_template(self, route_map_names, template):
cmd = "\n"
for rm in sorted(route_map_names):
if "_INTERNAL_" in rm:
# For packet-based chassis, the bgp session between the linecards are also considered internal sessions
# While isolating a single linecard, these sessions should not be skipped
if "_INTERNAL_" in rm and self.switch_type != "chassis-packet":
continue
if "V4" in rm:
ipv="V4" ; ipp="ip"
Expand Down

0 comments on commit 763d3dc

Please sign in to comment.