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

[platform]: turn on/off four leds for breakout-able front panel ports #723

Merged
merged 1 commit into from
Jun 20, 2017
Merged
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
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