[mlnx] fix incorrect attr assignment in mlnx-sfpd (#2913)

* [mlnx] fix incorrect attr assignment in mlnx-sfpd

Signed-off-by: Stepan Blyschak <stepanb@mellanox.com>

* [mlnx] on_pmpe returns bool and not SX_STATUS_SUCCESS

Signed-off-by: Stepan Blyschak <stepanb@mellanox.com>

* [mlnx] fix typo

Signed-off-by: Stepan Blyschak <stepanb@mellanox.com>
This commit is contained in:
Stepan Blyshchak 2019-05-18 04:53:57 +03:00 committed by lguohan
parent 939b6254e7
commit f3d2d37e43

View File

@ -120,7 +120,7 @@ class MlnxSfpd:
raise RuntimeError("sx_api_host_ifc_open exited with error, rc {}".format(rc)) raise RuntimeError("sx_api_host_ifc_open exited with error, rc {}".format(rc))
self.user_channel_p.type = SX_USER_CHANNEL_TYPE_FD self.user_channel_p.type = SX_USER_CHANNEL_TYPE_FD
self.user_channel_p.fd = self.rx_fd_p self.user_channel_p.channel.fd = self.rx_fd_p
rc = sx_api_host_ifc_trap_id_register_set(self.handle, rc = sx_api_host_ifc_trap_id_register_set(self.handle,
SX_ACCESS_CMD_REGISTER, SX_ACCESS_CMD_REGISTER,
@ -170,8 +170,8 @@ class MlnxSfpd:
for fd in read: for fd in read:
if fd == self.rx_fd_p.fd: if fd == self.rx_fd_p.fd:
rc, port_list, module_state = self.on_pmpe(self.rx_fd_p) success, port_list, module_state = self.on_pmpe(self.rx_fd_p)
if rc != SX_STATUS_SUCCESS: if not success:
raise RuntimeError("failed to read from {}".format(fd)) raise RuntimeError("failed to read from {}".format(fd))
sfp_state = sfp_value_status_dict.get(module_state, STATUS_UNKNOWN) sfp_state = sfp_value_status_dict.get(module_state, STATUS_UNKNOWN)
@ -187,7 +187,7 @@ class MlnxSfpd:
def send_sfp_notification(self, port, state): def send_sfp_notification(self, port, state):
sfp_notify = [port, state] sfp_notify = [port, state]
msg = json.dumps(sfp_notify, seperators=(',', ':')) msg = json.dumps(sfp_notify, separators=(',', ':'))
self.state_db.publish('STATE_DB', 'TRANSCEIVER_NOTIFY', msg) self.state_db.publish('STATE_DB', 'TRANSCEIVER_NOTIFY', msg)
def update_sfpd_liveness_key(self, timeout_secs): def update_sfpd_liveness_key(self, timeout_secs):