-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix FdbUpdater crash when SAI_FDB_ENTRY_ATTR_BRIDGE_PORT_ID attribute…
… missing. (#286) Fix FdbUpdater crash when SAI_FDB_ENTRY_ATTR_BRIDGE_PORT_ID attribute missing. #### Work item tracking Microsoft ADO (number only): 16189251 **- What I did** Fix FdbUpdater crash when SAI_FDB_ENTRY_ATTR_BRIDGE_PORT_ID attribute missing. **- How I did it** Add try-catch block in rfc3463 FdbUpdater **- How to verify it** Manually test. Pass all UT **- Description for the changelog** Fix FdbUpdater crash when SAI_FDB_ENTRY_ATTR_BRIDGE_PORT_ID attribute missing.
- Loading branch information
1 parent
551898e
commit b292c01
Showing
2 changed files
with
41 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import os | ||
import sys | ||
from unittest import TestCase | ||
|
||
if sys.version_info.major == 3: | ||
from unittest import mock | ||
else: | ||
import mock | ||
|
||
modules_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | ||
sys.path.insert(0, os.path.join(modules_path, 'src')) | ||
|
||
from sonic_ax_impl.mibs.ietf.rfc4363 import FdbUpdater | ||
|
||
class TestFdbUpdater(TestCase): | ||
|
||
@mock.patch('sonic_ax_impl.mibs.Namespace.dbs_keys', mock.MagicMock(return_value=(['ASIC_STATE:SAI_OBJECT_TYPE_FDB_ENTRY:{"bvid":"oid:0x26000000000b6c","mac":"60:45:BD:98:6F:48","switch_id":"oid:0x21000000000000"}']))) | ||
@mock.patch('sonic_ax_impl.mibs.Namespace.dbs_get_all', mock.MagicMock(return_value=({"nexthop": "10.0.0.1,10.0.0.3", "ifname": "Ethernet0,Ethernet4"}))) | ||
def test_FdbUpdater_ent_bridge_port_id_attr_missing(self): | ||
updater = FdbUpdater() | ||
|
||
with mock.patch('sonic_ax_impl.mibs.logger.warn') as mocked_warn: | ||
updater.update_data() | ||
|
||
# check warning | ||
mocked_warn.assert_called() | ||
|
||
self.assertTrue(len(updater.vlanmac_ifindex_list) == 0) |