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

[pull] master from Azure:master #871

Merged
merged 4 commits into from
Jul 15, 2020
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,14 @@
import time
import os.path
import sfputil as jnpr_sfp
from sonic_daemon_base.daemon_base import Logger
from pprint import pprint

SYSLOG_IDENTIFIER = "sfputil"

# Global logger class instance
logger = Logger(SYSLOG_IDENTIFIER)

DEBUG = False

def i2c_eeprom_dev_update(port, create_eeprom):
Expand Down Expand Up @@ -69,23 +75,16 @@ def gpio_sfp_init():

#Reset all ports
for port in range(jnpr_sfp.GPIO_PORT_START, jnpr_sfp.GPIO_PORT_END + 1):
port_inited = False
if jnpr_sfp.gpio_sfp_presence_get(port):
port_inited = jnpr_sfp.gpio_sfp_reset_set(port, 0)
logger.log_debug("GPIO SFP port {}".format(port))

if port_inited:
i2c_eeprom_dev_update(port, True)
else:
i2c_eeprom_dev_update(port, False)
jnpr_sfp.gpio_sfp_reset_set(port, 0)
i2c_eeprom_dev_update(port, True)

time.sleep(2)
time.sleep(1)

#Enable optics for all ports which have XCVRs present
for port in range(jnpr_sfp.GPIO_PORT_START, jnpr_sfp.GPIO_PORT_END + 1):
if jnpr_sfp.gpio_sfp_presence_get(port):
jnpr_sfp.gpio_sfp_lpmode_set(port, 1)

time.sleep(2)
jnpr_sfp.gpio_sfp_lpmode_set(port, 1)


if __name__ == '__main__':
Expand Down
Loading