@@ -19,8 +19,8 @@ def __init__(self, common_objs, db, table):
19
19
:param common_objs: common object dictionary
20
20
:param db: name of the db
21
21
:param table: name of the table in the db
22
- """
23
- self .switch_type = ""
22
+ """
23
+ self .switch_role = ""
24
24
self .chassis_tsa = ""
25
25
self .directory = common_objs ['directory' ]
26
26
self .cfg_mgr = common_objs ['cfg_mgr' ]
@@ -29,8 +29,8 @@ def __init__(self, common_objs, db, table):
29
29
self .tsb_template = common_objs ['tf' ].from_file ("bgpd/tsa/bgpd.tsa.unisolate.conf.j2" )
30
30
self .wcmp_template = common_objs ['tf' ].from_file ("bgpd/wcmp/bgpd.wcmp.conf.j2" )
31
31
self .idf_isolate_template = common_objs ['tf' ].from_file ("bgpd/idf_isolate/idf_isolate.conf.j2" )
32
- self .idf_unisolate_template = common_objs ['tf' ].from_file ("bgpd/idf_isolate/idf_unisolate.conf.j2" )
33
- self .directory .subscribe ([("CONFIG_DB" , swsscommon .CFG_DEVICE_METADATA_TABLE_NAME , "localhost/switch_type " ),], self .on_switch_type_change )
32
+ self .idf_unisolate_template = common_objs ['tf' ].from_file ("bgpd/idf_isolate/idf_unisolate.conf.j2" )
33
+ self .directory .subscribe ([("CONFIG_DB" , swsscommon .CFG_DEVICE_METADATA_TABLE_NAME , "localhost/type " ),], self .handle_type_update )
34
34
super (DeviceGlobalCfgMgr , self ).__init__ (
35
35
common_objs ,
36
36
[],
@@ -48,18 +48,16 @@ def __init__(self, common_objs, db, table):
48
48
if not self .directory .path_exist (self .db_name , self .table_name , "idf_isolation_state" ):
49
49
self .directory .put (self .db_name , self .table_name , "idf_isolation_state" , self .IDF_DEFAULTS )
50
50
51
- def on_switch_type_change (self ):
52
- log_debug ("DeviceGlobalCfgMgr:: Switch type update handler" )
53
- if self .directory .path_exist ("CONFIG_DB" , swsscommon .CFG_DEVICE_METADATA_TABLE_NAME , "localhost/switch_type " ):
54
- self .switch_type = self .directory .get_slot ("CONFIG_DB" , swsscommon .CFG_DEVICE_METADATA_TABLE_NAME )["localhost" ]["switch_type " ]
55
- log_debug ("DeviceGlobalCfgMgr:: Switch type : %s" % self .switch_type )
51
+ def handle_type_update (self ):
52
+ log_debug ("DeviceGlobalCfgMgr:: Switch role update handler" )
53
+ if self .directory .path_exist ("CONFIG_DB" , swsscommon .CFG_DEVICE_METADATA_TABLE_NAME , "localhost/type " ):
54
+ self .switch_role = self .directory .get_slot ("CONFIG_DB" , swsscommon .CFG_DEVICE_METADATA_TABLE_NAME )["localhost" ]["type " ]
55
+ log_debug ("DeviceGlobalCfgMgr:: Switch role : %s" % self .switch_role )
56
56
57
57
def set_handler (self , key , data ):
58
58
""" Handle device TSA/W-ECMP state change """
59
59
log_debug ("DeviceGlobalCfgMgr:: set handler" )
60
60
61
- if self .switch_type :
62
- log_debug ("DeviceGlobalCfgMgr:: Switch type: %s" % self .switch_type )
63
61
if not data :
64
62
log_err ("DeviceGlobalCfgMgr:: data is None" )
65
63
return False
@@ -259,8 +257,8 @@ def downstream_isolate_unisolate(self, idf_isolation_state):
259
257
log_err ("IDF: invalid value({}) is provided" .format (idf_isolation_state ))
260
258
return False
261
259
262
- if self .switch_type and self .switch_type != "SpineRouter" :
263
- log_debug ("DeviceGlobalCfgMgr:: Skipping IDF isolation configuration on Switch type: %s" % self .switch_type )
260
+ if self .switch_role and self .switch_role != "SpineRouter" :
261
+ log_debug ("DeviceGlobalCfgMgr:: Skipping IDF isolation configuration on %s" % self .switch_role )
264
262
return True
265
263
266
264
cmd = "\n "
0 commit comments