Skip to content
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
41 changes: 41 additions & 0 deletions device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/sfputil.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ def __init__(self):
x + self.EEPROM_OFFSET)
SfpUtilBase.__init__(self)

def _do_write_file(self, file_handle, offset, value):
file_handle.seek(offset)
file_handle.write(hex(value))
file_handle.close()

def get_presence(self, port_num):

# Check for invalid port_num
Expand Down Expand Up @@ -203,3 +208,39 @@ def tx_disable(self, port_num, disable):
return False

return True

def reset_all(self):
result = True
port_sysfs_path = []
for port in range(self.port_start, self.port_end+1):
if port not in self.qsfp_ports:
continue

presence = self.get_presence(port)
if not presence:
continue

try:
port_name = self.get_port_name(port)
sysfs_path = "/".join([self.PORT_INFO_PATH,
port_name, "qsfp_reset"])
reg_file = open(sysfs_path, "w")
port_sysfs_path.append(sysfs_path)
except IOError as e:
result = False
continue

self._do_write_file(reg_file, 0, 0)

time.sleep(1)

for sysfs_path in port_sysfs_path:
try:
reg_file = open(sysfs_path, "w")
except IOError as e:
result = False
continue

self._do_write_file(reg_file, 0, 1)

return result
41 changes: 41 additions & 0 deletions device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/sfputil.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ def __init__(self):
x + self.EEPROM_OFFSET)
SfpUtilBase.__init__(self)

def _do_write_file(self, file_handle, offset, value):
file_handle.seek(offset)
file_handle.write(hex(value))
file_handle.close()

def get_presence(self, port_num):

# Check for invalid port_num
Expand Down Expand Up @@ -203,3 +208,39 @@ def tx_disable(self, port_num, disable):
return False

return True

def reset_all(self):
result = True
port_sysfs_path = []
for port in range(self.port_start, self.port_end+1):
if port not in self.qsfp_ports:
continue

presence = self.get_presence(port)
if not presence:
continue

try:
port_name = self.get_port_name(port)
sysfs_path = "/".join([self.PORT_INFO_PATH,
port_name, "qsfp_reset"])
reg_file = open(sysfs_path, "w")
port_sysfs_path.append(sysfs_path)
except IOError as e:
result = False
continue

self._do_write_file(reg_file, 0, 0)

time.sleep(1)

for sysfs_path in port_sysfs_path:
try:
reg_file = open(sysfs_path, "w")
except IOError as e:
result = False
continue

self._do_write_file(reg_file, 0, 1)

return result
42 changes: 42 additions & 0 deletions device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/sfputil.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ def __init__(self):
x + self.EEPROM_OFFSET)
SfpUtilBase.__init__(self)

def _do_write_file(self, file_handle, offset, value):
file_handle.seek(offset)
file_handle.write(hex(value))
file_handle.close()

def get_presence(self, port_num):

# Check for invalid port_num
Expand Down Expand Up @@ -203,3 +208,40 @@ def tx_disable(self, port_num, disable):
return False

return True

def reset_all(self):
result = True
port_sysfs_path = []
for port in range(self.port_start, self.port_end+1):
if port not in self.qsfp_ports:
continue

presence = self.get_presence(port)
if not presence:
continue

try:
port_name = self.get_port_name(port)
sysfs_path = "/".join([self.PORT_INFO_PATH,
port_name, "qsfp_reset"])
print(sysfs_path)
reg_file = open(sysfs_path, "w")
port_sysfs_path.append(sysfs_path)
except IOError as e:
result = False
continue

self._do_write_file(reg_file, 0, 0)

time.sleep(1)

for sysfs_path in port_sysfs_path:
try:
reg_file = open(sysfs_path, "w")
except IOError as e:
result = False
continue

self._do_write_file(reg_file, 0, 1)

return result
2 changes: 1 addition & 1 deletion files/image_config/interfaces/interfaces.j2
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ iface eth0 {{ 'inet' if prefix | ipv4 else 'inet6' }} static
{# TODO: COPP policy type rules #}
{% endfor %}
{% else %}
iface eth0 inet static
iface eth0 inet manual
{% endif %}
#
{% endblock mgmt_interface %}
26 changes: 26 additions & 0 deletions files/image_config/platform/rc.local
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,33 @@ update_mgmt_interface_macaddr() {
sed -i "/eth0/ s/ATTR{address}==\"$old_mac\"/ATTR{address}==\"$new_mac\"/g" /etc/udev/rules.d/70-persistent-net.rules
}

diag_install() {
echo "Diag install start ..."
sleep 200
dpkg -i /home/Ali_Diag_V2.0.4.deb
}

boot_action() {
#cleanos
CLEAN_OS_FILE="/etc/sonic/cleanos"
if [ -f $CLEAN_OS_FILE ]; then
echo "clean up os"
sonic_installer cleanup -y
rm -f $CLEAN_OS_FILE
fi

decode-syseeprom --init

#diag install
if [ ! -d /usr/local/CPU_Diag ];then
echo "Diag install"
diag_install > /var/log/diagInstallLog &
fi
}

firsttime_exit() {
rm -rf $FIRST_BOOT_FILE
boot_action
exit 0
}

Expand Down Expand Up @@ -354,4 +379,5 @@ if [ -f $FIRST_BOOT_FILE ]; then
firsttime_exit
fi

boot_action
exit 0
7 changes: 6 additions & 1 deletion files/image_config/updategraph/updategraph
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ check_system_warm_boot
copy_list="minigraph.xml snmp.yml acl.json config_db.json frr"
if [ -f /tmp/pending_config_migration ]; then
copy_config_files_and_directories $copy_list
PLATFORM=`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform`
cp /usr/share/sonic/device/$PLATFORM/minigraph.xml /etc/sonic/minigraph.xml
sonic-cfggen -H -m /etc/sonic/minigraph.xml -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json
if [ x"${WARM_BOOT}" == x"true" ]; then
echo "Warm reboot detected..."
elif [ "$enabled" = "true" ]; then
Expand All @@ -74,7 +77,9 @@ if [ -f /tmp/pending_config_initialization ]; then
if [ "$enabled" != "true" ]; then
PLATFORM=`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform`
PRESET=(`head -n 1 /usr/share/sonic/device/$PLATFORM/default_sku`)
sonic-cfggen -H -k ${PRESET[0]} --preset ${PRESET[1]} > /etc/sonic/config_db.json
#sonic-cfggen -H -k ${PRESET[0]} --preset ${PRESET[1]} > /etc/sonic/config_db.json
cp /usr/share/sonic/device/$PLATFORM/minigraph.xml /etc/sonic/minigraph.xml
sonic-cfggen -H -m /etc/sonic/minigraph.xml -j /etc/sonic/init_cfg.json --print-data > /etc/sonic/config_db.json
redis-cli -n $CONFIG_DB_INDEX FLUSHDB
sonic-cfggen -j /etc/sonic/config_db.json --write-to-db
redis-cli -n $CONFIG_DB_INDEX SET "CONFIG_DB_INITIALIZED" "1"
Expand Down