Skip to content
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

Allow TSA on ibgp sessions between linecards on packet chassis #12589

Merged
merged 4 commits into from
Nov 3, 2022
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
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