Skip to content

Commit

Permalink
Fix for LLDP portname issue (sonic-net#2886)
Browse files Browse the repository at this point in the history
* Fix for LLDP portname issue
First check for operstate and if its not present then check for ifindex

* Addressing review comments
  • Loading branch information
Sumukha Tumkur Vani authored and yxieca committed May 14, 2019
1 parent 99de97c commit c183614
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions dockers/docker-lldp-sv2/lldpmgrd
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,14 @@ def signal_handler(sig, frame):
# ========================== Helpers ==================================

def is_port_exist(port_name):
filename = "/sys/class/net/%s/ifindex" % port_name
if not os.path.exists(filename):
return False

return True
filename = "/sys/class/net/%s/operstate" % port_name
if os.path.exists(filename):
with open(filename) as fp:
state = fp.read()
return "up" in state
else:
filename = "/sys/class/net/%s/ifindex" % port_name
return os.path.exists(filename)

# ============================== Classes ==============================

Expand Down

0 comments on commit c183614

Please sign in to comment.