Skip to content

Commit

Permalink
add comments to describe the usage of functions to judge the port type
Browse files Browse the repository at this point in the history
Signed-off-by: Kebo Liu <kebol@nvidia.com>
  • Loading branch information
keboliu committed Jun 22, 2022
1 parent 8e11f59 commit 09a891a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sfputil/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,11 @@ def is_sfp_present(port_name):
return bool(presence)


# Determine whether it is a RJ45 port
# Below defined two flavors of functions to determin whether a port is a RJ45 port.
# They serve different types of SFP utilities. One type of SFP utility consume the
# info stored in the STATE_DB, these utilities shall call 'is_rj45_port_from_db'
# to judge the port type. Another type of utilities will call the platform API
# directly to access SFP, for them shall use 'is_rj45_port_from_api'.
def is_rj45_port_from_db(port_name, db):
intf_type = db.get(db.STATE_DB, 'TRANSCEIVER_INFO|{}'.format(port_name), 'type')
return intf_type == RJ45_PORT_TYPE
Expand Down

0 comments on commit 09a891a

Please sign in to comment.