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

[xcvrd] Fix swsscommon set port table handle in media_settings parser #562

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions sonic-xcvrd/tests/test_xcvrd.py
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,7 @@ def _check_notify_media_setting(self, index, expected_found=False, expected_valu
} if xcvr_info_dict is None else xcvr_info_dict
app_port_tbl = Table("APPL_DB", 'PORT_TABLE')
xcvr_table_helper.get_app_port_tbl = MagicMock(return_value=app_port_tbl)
xcvr_table_helper.get_app_set_port_tbl = MagicMock(return_value=app_port_tbl)
xcvr_table_helper.is_npu_si_settings_update_required = MagicMock(return_value=True)
port_mapping = PortMapping()
port_change_event = PortChangeEvent('Ethernet0', index, 0, PortChangeEvent.PORT_ADD)
Expand Down
2 changes: 1 addition & 1 deletion sonic-xcvrd/xcvrd/xcvrd_utilities/media_settings_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ def notify_media_setting(logical_port_name, transceiver_dict,
fvs[index] = (str(media_key), str(val_str))
index += 1

xcvr_table_helper.get_app_port_tbl(asic_index).set(port_name, fvs)
xcvr_table_helper.get_app_set_port_tbl(asic_index).set(port_name, fvs)
xcvr_table_helper.get_state_port_tbl(asic_index).set(logical_port_name, [(NPU_SI_SETTINGS_SYNC_STATUS_KEY, NPU_SI_SETTINGS_NOTIFIED_VALUE)])
helper_logger.log_notice("Notify media setting: Published ASIC-side SI setting "
"for lport {} in APP_DB".format(logical_port_name))
5 changes: 5 additions & 0 deletions sonic-xcvrd/xcvrd/xcvrd_utilities/xcvr_table_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(self, namespaces):
self.cfg_port_tbl, self.state_port_tbl, self.pm_tbl, self.firmware_info_tbl = {}, {}, {}, {}, {}, {}, {}, {}, {}
self.state_db = {}
self.cfg_db = {}
self.app_set_port_tbl = {}
for namespace in namespaces:
asic_id = multi_asic.get_asic_index_from_namespace(namespace)
self.state_db[asic_id] = daemon_base.db_connect("STATE_DB", namespace)
Expand All @@ -39,6 +40,7 @@ def __init__(self, namespaces):
self.app_port_tbl[asic_id] = swsscommon.ProducerStateTable(appl_db, swsscommon.APP_PORT_TABLE_NAME)
self.cfg_db[asic_id] = daemon_base.db_connect("CONFIG_DB", namespace)
self.cfg_port_tbl[asic_id] = swsscommon.Table(self.cfg_db[asic_id], swsscommon.CFG_PORT_TABLE_NAME)
self.app_set_port_tbl[asic_id] = swsscommon.Table(appl_db, swsscommon.APP_PORT_TABLE_NAME)

def get_intf_tbl(self, asic_id):
return self.int_tbl[asic_id]
Expand All @@ -61,6 +63,9 @@ def get_firmware_info_tbl(self, asic_id):
def get_app_port_tbl(self, asic_id):
return self.app_port_tbl[asic_id]

def get_app_set_port_tbl(self, asic_id):
return self.app_set_port_tbl[asic_id]

def get_state_db(self, asic_id):
return self.state_db[asic_id]

Expand Down
Loading