[bgpcfgd] improve the log when delete a loopback interface (#11152)
Why I did it The bgpcfgd doesn't support deletion of 'zebra set src', if an interface is deleted, the bgpcfgd will drop a warning message. In current implementation, we only care about the loopback0 interface but not others. To improve the log print to have the key info, which will give the name of the deleted interface. We can ignore it if it is not the loopback0 interface. The application layer should be aware of that update and deletion is not supported, delete or update with a new address of loopback0 could cause issue, this log can give enough info to root cause the issue. How I did it How to verify it
This commit is contained in:
parent
526cd92f53
commit
8d37dd7f5e
@ -64,4 +64,4 @@ class ZebraSetSrc(Manager):
|
||||
def del_handler(self, key):
|
||||
""" Implementation of 'DEL' command for this class """
|
||||
self.directory.remove(self.db_name, self.table_name, key)
|
||||
log_warn("Delete command is not supported for 'zebra set src' templates")
|
||||
log_warn("Delete key '%s' is not supported for 'zebra set src' templates" % str(key))
|
@ -58,5 +58,6 @@ def test_set_handler_invalid_ip(mocked_log_err):
|
||||
@patch('bgpcfgd.managers_setsrc.log_warn')
|
||||
def test_del_handler(mocked_log_warn):
|
||||
m = constructor()
|
||||
m.del_handler("Loopback0|10.1.0.32/32")
|
||||
mocked_log_warn.assert_called_with("Delete command is not supported for 'zebra set src' templates")
|
||||
del_key = "Loopback0|10.1.0.32/32"
|
||||
m.del_handler(del_key)
|
||||
mocked_log_warn.assert_called_with("Delete key '%s' is not supported for 'zebra set src' templates" % del_key)
|
||||
|
Reference in New Issue
Block a user