Skip to content

Commit

Permalink
[platform]: turn on/off four leds for breakout-able front panel ports (
Browse files Browse the repository at this point in the history
…#723)

turn on/off four leds for breakout-able front panel ports on arista 7050 qx32 platform
  • Loading branch information
lguohan authored Jun 20, 2017
1 parent fe56389 commit 894976e
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions device/arista/x86_64-arista_7050_qx32/plugins/led_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,23 @@ def port_link_state_change(self, port, state):
if qsfp_index <= 0:
return

# QSFP indices 1-24 are breakout-capable and have four LEDs,
# QSFP indices 1-24 are breakout-capable and have four LEDs, and each LED indicate one lane.
# whereas indices 25-32 are not breakout-capable, and only have one
if qsfp_index <= self.QSFP_BREAKOUT_END_IDX:
led_sysfs_path = self.LED_SYSFS_PATH_BREAKOUT_CAPABLE.format(qsfp_index, 1)
# assuming 40G, then we need to control four lanes
led_sysfs_paths = [ self.LED_SYSFS_PATH_BREAKOUT_CAPABLE.format(qsfp_index, i) for i in range(1, 5) ]
else:
led_sysfs_path = self.LED_SYSFS_PATH_NO_BREAKOUT.format(qsfp_index)
led_sysfs_paths = [ self.LED_SYSFS_PATH_NO_BREAKOUT.format(qsfp_index) ]

led_file = open(led_sysfs_path, "w")
for led_sysfs_path in led_sysfs_paths:
led_file = open(led_sysfs_path, "w")

if state == "up":
led_file.write("%d" % self.LED_COLOR_GREEN)
else:
led_file.write("%d" % self.LED_COLOR_OFF)
if state == "up":
led_file.write("%d" % self.LED_COLOR_GREEN)
else:
led_file.write("%d" % self.LED_COLOR_OFF)

led_file.close()
led_file.close()

# Constructor
def __init__(self):
Expand Down

0 comments on commit 894976e

Please sign in to comment.