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

As7712 32x add fancontrol #1270

Merged
merged 7 commits into from
Jan 3, 2018
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
roylee123 committed Dec 22, 2017
commit 87eed235a0bf524bd934f74a1f06c80343bba452
19 changes: 16 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -63,7 +63,7 @@ SONIC_BUILD_INSTRUCTION := make \
USERNAME=$(USERNAME) \
SONIC_BUILD_JOBS=$(SONIC_BUILD_JOBS)

.PHONY: sonic-slave-build sonic-slave-bash init
.PHONY: sonic-slave-build sonic-slave-bash init reset

.DEFAULT_GOAL := all

@@ -98,5 +98,18 @@ sonic-slave-bash :
@$(DOCKER_RUN) -t $(SLAVE_IMAGE):$(SLAVE_TAG) bash

init :
git submodule update --init --recursive
git submodule foreach --recursive '[ -f .git ] && echo "gitdir: $$(realpath --relative-to=. $$(cut -d" " -f2 .git))" > .git'
@git submodule update --init --recursive
@git submodule foreach --recursive '[ -f .git ] && echo "gitdir: $$(realpath --relative-to=. $$(cut -d" " -f2 .git))" > .git'

reset :
@echo && echo -n "Warning! All local changes will be lost. Proceed? [y/N]: "
@read ans && \
if [ $$ans == y ]; then \
git clean -xfdf; \
git reset --hard; \
git submodule foreach --recursive git clean -xfdf; \
git submodule foreach --recursive git reset --hard; \
git submodule update --init --recursive;\
else \
echo "Reset aborted"; \
fi
76 changes: 70 additions & 6 deletions device/accton/x86_64-accton_as5712_54x-r0/plugins/sfputil.py
Original file line number Diff line number Diff line change
@@ -16,12 +16,13 @@ class SfpUtil(SfpUtilBase):
PORT_START = 0
PORT_END = 71
PORTS_IN_BLOCK = 72
QSFP_PORT_START = 72
QSFP_PORT_START = 48
QSFP_PORT_END = 72

BASE_VAL_PATH = "/sys/class/i2c-adapter/i2c-{0}/{1}-0050/"

_port_to_is_present = {}
_port_to_lp_mode = {}

_port_to_eeprom_mapping = {}
_port_to_i2c_mapping = {
@@ -107,6 +108,14 @@ def port_start(self):
def port_end(self):
return self.PORT_END

@property
def qsfp_port_start(self):
return self.QSFP_PORT_START

@property
def qsfp_port_end(self):
return self.QSFP_PORT_END

@property
def qsfp_ports(self):
return range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1)
@@ -148,11 +157,66 @@ def get_presence(self, port_num):

return False

def get_low_power_mode(self, port_num):
raise NotImplementedError
def get_low_power_mode(self, port_num):
if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end:
return False

lp_mode_path = self.BASE_VAL_PATH + "sfp_lp_mode"
self.__port_to_lp_mode = lp_mode_path.format(self._port_to_i2c_mapping[port_num][0], self._port_to_i2c_mapping[port_num][1])

try:
val_file = open(self.__port_to_lp_mode)
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False

content = val_file.readline().rstrip()
val_file.close()

# content is a string, either "0" or "1"
if content == "1":
return True

def set_low_power_mode(self, port_num, lpmode):
raise NotImplementedError
return False

def set_low_power_mode(self, port_num, lpmode):
if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end:
return False

lp_mode_path = self.BASE_VAL_PATH + "sfp_lp_mode"
self.__port_to_lp_mode = lp_mode_path.format(self._port_to_i2c_mapping[port_num][0], self._port_to_i2c_mapping[port_num][1])

try:
reg_file = open(self.__port_to_lp_mode, 'r+')
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False

if lpmode is True:
reg_value = '1'
else:
reg_value = '0'

reg_file.write(reg_value)
reg_file.close()

return True

def reset(self, port_num):
raise NotImplementedError
if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end:
return False

mod_rst_path = self.BASE_VAL_PATH + "sfp_mod_rst"
self.__port_to_mod_rst = mod_rst_path.format(self._port_to_i2c_mapping[port_num][0], self._port_to_i2c_mapping[port_num][1])
try:
reg_file = open(self.__port_to_mod_rst, 'r+')
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False

reg_value = '1'

reg_file.write(reg_value)
reg_file.close()

return True
1 change: 1 addition & 0 deletions files/image_config/sudoers/sudoers
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@ Cmnd_Alias READ_ONLY_CMDS = /usr/bin/decode-syseeprom, \
/usr/bin/docker images *, \
/usr/bin/docker exec -it snmp cat /etc/snmp/snmpd.conf, \
/usr/bin/docker exec -it bgp cat /etc/quagga/bgpd.conf, \
/usr/bin/docker ps, \
/usr/bin/generate_dump, \
/usr/bin/lldpctl, \
/usr/bin/lldpshow, \
You are viewing a condensed version of this merge commit. You can view the full changes here.