forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TSA] Reliable TSA: Addressing pizza box issues (sonic-net#19217)
* [TSA] Reliable TSA: Addressing pizza box issues - Why I did it Implement HLD https://github.com/skeesara-nokia/SONiC/blob/master/doc/voq/Reliable_TSA.md OB- How I did it A new attribute "tsa_enabled" has been added in CHASSIS_APP_DB the value of which changes whenever TSA/TSB is issued in the supervisor (default value is false). bgpcfgd subscribes to CHASSIS_APP_DB to receive updates on the newly added "tsa_enabled" attribute and in conjunction with the CONFIG_DB "tsa_enabled" attribute value, determine the BGP operational state is determined to be in TSA or TSB. Signed-off-by: fountzou <ioannis.fountzoulas@nokia.com>
- Loading branch information
Showing
11 changed files
with
365 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from .manager import Manager | ||
from .managers_device_global import DeviceGlobalCfgMgr | ||
from .log import log_err, log_debug, log_notice | ||
import re | ||
from swsscommon import swsscommon | ||
|
||
class ChassisAppDbMgr(Manager): | ||
"""This class responds to change in tsa_enabled state of the supervisor""" | ||
|
||
def __init__(self, common_objs, db, table): | ||
""" | ||
Initialize the object | ||
:param common_objs: common object dictionary | ||
:param db: name of the db | ||
:param table: name of the table in the db | ||
""" | ||
self.lc_tsa = "" | ||
self.directory = common_objs['directory'] | ||
self.dev_cfg_mgr = DeviceGlobalCfgMgr(common_objs, "CONFIG_DB", swsscommon.CFG_BGP_DEVICE_GLOBAL_TABLE_NAME) | ||
self.directory.subscribe([("CONFIG_DB", swsscommon.CFG_BGP_DEVICE_GLOBAL_TABLE_NAME, "tsa_enabled"),], self.on_lc_tsa_status_change) | ||
super(ChassisAppDbMgr, self).__init__( | ||
common_objs, | ||
[], | ||
db, | ||
table, | ||
) | ||
|
||
def on_lc_tsa_status_change(self): | ||
if self.directory.path_exist("CONFIG_DB", swsscommon.CFG_BGP_DEVICE_GLOBAL_TABLE_NAME, "tsa_enabled"): | ||
self.lc_tsa = self.directory.get_slot("CONFIG_DB", swsscommon.CFG_BGP_DEVICE_GLOBAL_TABLE_NAME)["tsa_enabled"] | ||
log_debug("ChassisAppDbMgr:: LC TSA update handler status %s" % self.lc_tsa) | ||
|
||
def set_handler(self, key, data): | ||
log_debug("ChassisAppDbMgr:: set handler") | ||
|
||
if not data: | ||
log_err("ChassisAppDbMgr:: data is None") | ||
return False | ||
|
||
if "tsa_enabled" in data: | ||
if self.lc_tsa == "false": | ||
self.dev_cfg_mgr.cfg_mgr.commit() | ||
self.dev_cfg_mgr.cfg_mgr.update() | ||
self.dev_cfg_mgr.isolate_unisolate_device(data["tsa_enabled"]) | ||
return True | ||
return False | ||
|
||
def del_handler(self, key): | ||
log_debug("ChassisAppDbMgr:: del handler") | ||
return True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.