Skip to content

Commit

Permalink
Merge branch 'master' into master-dx010-xcvrd-event-support
Browse files Browse the repository at this point in the history
  • Loading branch information
Wirut Getbamrung authored Nov 27, 2020
2 parents 6470c93 + 7f21c0b commit 6c3d3cd
Show file tree
Hide file tree
Showing 872 changed files with 36,187 additions and 9,034 deletions.
6 changes: 4 additions & 2 deletions Makefile.cache
Original file line number Diff line number Diff line change
Expand Up @@ -558,8 +558,10 @@ ALL_DEP_FILES_LIST += $(foreach pkg,$(2), $($(filter none,$($(1)_CACHE_MODE)), \
$(addsuffix .$(3),$(addprefix $(2)/, $(1))) : $(2)/%.$(3) : \
$(2)/%.flags $$$$($$$$*_DEP_FILES) $$$$(if $$$$($$$$*_SMDEP_FILES), $(2)/%.smdep)
@$$(eval $$*_DEP_FILES_MODIFIED := $$? )
@$$(file >$$@,$$($$*_DEP_FILES))
@cat $$@ |xargs git hash-object >$$@.sha
@$$(file >$$@.tmp,$$($$*_DEP_FILES))
@cat $$@.tmp |xargs git hash-object >$$@.sha.tmp
@if ! cmp -s $$@.sha.tmp $$@.sha; then cp $$@.tmp $$@; cp $$@.sha.tmp $$@.sha; fi
@rm -f $$@.tmp $$@.sha.tmp
@$$(if $$(MDEBUG), $$(info DEP: $$@, MOD:$$?))
endef
$(eval $(call SHA_DEP_RULES, $(SONIC_MAKE_DEBS) $(SONIC_DPKG_DEBS) $(SONIC_ONLINE_DEBS) $(SONIC_COPY_DEBS), $(DEBS_PATH),dep))
Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
[![P4](https://sonic-jenkins.westus2.cloudapp.azure.com/job/p4/job/buildimage-p4-all/badge/icon?subject=P4)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/p4/job/buildimage-p4-all)
[![VS](https://sonic-jenkins.westus2.cloudapp.azure.com/job/vs/job/buildimage-vs-all/badge/icon?subject=VS)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/vs/job/buildimage-vs-all)

*202006 builds*:

[![Barefoot](https://sonic-jenkins.westus2.cloudapp.azure.com/job/barefoot/job/buildimage-bf-202006/badge/icon?subject=Barefoot)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/barefoot/job/buildimage-bf-202006/)

*201911 builds*:

[![Barefoot](https://sonic-jenkins.westus2.cloudapp.azure.com/job/barefoot/job/buildimage-bf-201911/badge/icon?subject=Barefoot)](https://sonic-jenkins.westus2.cloudapp.azure.com/job/barefoot/job/buildimage-bf-201911/)
Expand Down
19 changes: 19 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml

trigger:
- main

pool:
vmImage: 'ubuntu-latest'

steps:
- script: echo Hello, world!
displayName: 'Run a one-line script'

- script: |
echo Add other tasks to build, test, and deploy your project.
echo See https://aka.ms/yaml
displayName: 'Run a multi-line script'
12 changes: 6 additions & 6 deletions build_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,7 @@ set -x -e
CONFIGURED_ARCH=$([ -f .arch ] && cat .arch || echo amd64)

## docker engine version (with platform)
if [[ $CONFIGURED_ARCH == armhf || $CONFIGURED_ARCH == arm64 ]]; then
# Version name differs between ARCH, copying same version as in sonic-slave docker
DOCKER_VERSION=18.06.3~ce~3-0~debian
else
DOCKER_VERSION=5:18.09.8~3-0~debian-$IMAGE_DISTRO
fi
DOCKER_VERSION=5:18.09.8~3-0~debian-$IMAGE_DISTRO
LINUX_KERNEL_VERSION=4.19.0-9-2

## Working directory to prepare the file system
Expand Down Expand Up @@ -202,6 +197,10 @@ sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install apt-transport-https \
curl \
gnupg2 \
software-properties-common
if [[ $CONFIGURED_ARCH == armhf ]]; then
# update ssl ca certificates for secure pem
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT c_rehash
fi
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT curl -o /tmp/docker.gpg -fsSL https://download.docker.com/linux/debian/gpg
sudo LANG=C chroot $FILESYSTEM_ROOT apt-key add /tmp/docker.gpg
sudo LANG=C chroot $FILESYSTEM_ROOT rm /tmp/docker.gpg
Expand Down Expand Up @@ -278,6 +277,7 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in
python \
python-setuptools \
python3-setuptools \
python-jsonschema \
python-apt \
traceroute \
iputils-ping \
Expand Down
11 changes: 6 additions & 5 deletions check_install.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/usr/bin/env python
#!/usr/bin/env python3

import pexpect
import argparse
import pexpect
import sys
import time


def main():

parser = argparse.ArgumentParser(description='test_login cmdline parser')
Expand All @@ -21,16 +22,16 @@ def main():

login_prompt = 'sonic login:'
passwd_prompt = 'Password:'
cmd_prompt = "%s@sonic:~\$ $" % args.u
cmd_prompt = "{}@sonic:~\$ $".format(args.u)
grub_selection = "The highlighted entry will be executed"

i = 0
while True:
try:
p = pexpect.spawn("telnet 127.0.0.1 %s" % args.p, timeout=600, logfile=sys.stdout)
p = pexpect.spawn("telnet 127.0.0.1 {}".format(args.p), timeout=600, logfile=sys.stdout, encoding='utf-8')
break
except Exception as e:
print str(e)
print(str(e))
i += 1
if i == 10:
raise
Expand Down
9 changes: 4 additions & 5 deletions device/accton/x86_64-accton_as4630_54pe-r0/plugins/eeprom.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#!/usr/bin/env python

try:
import exceptions
import binascii
import time
import optparse
Expand All @@ -11,11 +8,13 @@
from sonic_eeprom import eeprom_base
from sonic_eeprom import eeprom_tlvinfo
import subprocess
except ImportError, e:
raise ImportError (str(e) + "- required module not found")
except ImportError as e:
raise ImportError(str(e) + "- required module not found")


class board(eeprom_tlvinfo.TlvInfoDecoder):
_TLV_INFO_MAX_LEN = 256

def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/sys/bus/i2c/devices/1-0057/eeprom"
super(board, self).__init__(self.eeprom_path, 0, '', True)
5 changes: 2 additions & 3 deletions device/accton/x86_64-accton_as4630_54pe-r0/plugins/psuutil.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

#############################################################################
# Accton
#
Expand All @@ -13,7 +11,8 @@
try:
from sonic_psu.psu_base import PsuBase
except ImportError as e:
raise ImportError (str(e) + "- required module not found")
raise ImportError(str(e) + "- required module not found")


class PsuUtil(PsuBase):
"""Platform-specific PSUutil class"""
Expand Down
43 changes: 22 additions & 21 deletions device/accton/x86_64-accton_as4630_54pe-r0/plugins/sfputil.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
SFP_STATUS_INSERTED = '1'
SFP_STATUS_REMOVED = '0'


class SfpUtil(SfpUtilBase):
"""Platform-specific SfpUtil class"""

Expand All @@ -31,13 +32,13 @@ class SfpUtil(SfpUtilBase):

_port_to_eeprom_mapping = {}
_port_to_i2c_mapping = {
49: [18],
50: [19],
51: [20],
52: [21],
53: [22],
54: [23],
}
49: [18],
50: [19],
51: [20],
52: [21],
53: [22],
54: [23],
}

@property
def port_start(self):
Expand All @@ -49,7 +50,7 @@ def port_end(self):

@property
def qsfp_ports(self):
return range(self.PORT_START, self.PORTS_IN_BLOCK + 1)
return list(range(self.PORT_START, self.PORTS_IN_BLOCK + 1))

@property
def port_to_eeprom_mapping(self):
Expand All @@ -70,15 +71,15 @@ def get_presence(self, port_num):
present_path = self.BASE_CPLD_PATH + "module_present_" + str(port_num)
self.__port_to_is_present = present_path

content="0"
content = "0"
try:
val_file = open(self.__port_to_is_present)
content = val_file.readline().rstrip()
val_file.close()
except IOError as e:
print "Error: unable to access file: %s" % str(e)
print("Error: unable to access file: %s" % str(e))
return False

if content == "1":
return True

Expand Down Expand Up @@ -108,7 +109,7 @@ def get_low_power_mode(self, port_num):
return False

except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
finally:
if eeprom is not None:
Expand All @@ -123,7 +124,7 @@ def set_low_power_mode(self, port_num, lpmode):
try:
eeprom = None
if not self.get_presence(port_num):
return False # Port is not present, unable to set the eeprom
return False # Port is not present, unable to set the eeprom

# Fill in write buffer
# 0x3:Low Power Mode, 0x1:High Power Mode
Expand All @@ -138,7 +139,7 @@ def set_low_power_mode(self, port_num, lpmode):
eeprom.write(buffer[0])
return True
except IOError as e:
print "Error: unable to open file: %s" % str(e)
print("Error: unable to open file: %s" % str(e))
return False
finally:
if eeprom is not None:
Expand All @@ -153,21 +154,22 @@ def _get_presence_bitmap(self):

bits = []
for x in range(self.port_start, self.port_end+1):
bits.append(str(int(self.get_presence(x))))
bits.append(str(int(self.get_presence(x))))

rev = "".join(bits[::-1])
return int(rev,2)
return int(rev, 2)

data = {'present': 0}

data = {'present':0}
def get_transceiver_change_event(self, timeout=0):
port_dict = {}

if timeout == 0:
cd_ms = sys.maxint
cd_ms = sys.maxsize
else:
cd_ms = timeout

#poll per second
# poll per second
while cd_ms > 0:
reg_value = self._get_presence_bitmap
changed_ports = self.data['present'] ^ reg_value
Expand All @@ -177,7 +179,7 @@ def get_transceiver_change_event(self, timeout=0):
cd_ms = cd_ms - 1000

if changed_ports != 0:
for port in range (self.port_start, self.port_end+1):
for port in range(self.port_start, self.port_end+1):
# Mask off the bit corresponding to our port
mask = (1 << (port - self.port_start))
if changed_ports & mask:
Expand All @@ -192,4 +194,3 @@ def get_transceiver_change_event(self, timeout=0):
else:
return True, {}
return False, {}

11 changes: 5 additions & 6 deletions device/accton/x86_64-accton_as5712_54x-r0/plugins/eeprom.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#!/usr/bin/env python

try:
import exceptions
import binascii
import time
import optparse
Expand All @@ -11,14 +8,16 @@
from sonic_eeprom import eeprom_base
from sonic_eeprom import eeprom_tlvinfo
import subprocess
except ImportError, e:
raise ImportError (str(e) + "- required module not found")
except ImportError as e:
raise ImportError(str(e) + "- required module not found")


class board(eeprom_tlvinfo.TlvInfoDecoder):
_TLV_INFO_MAX_LEN = 256

def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/sys/bus/i2c/devices/1-0057/eeprom"
#Two i2c buses might get flipped order, check them both.
# Two i2c buses might get flipped order, check them both.
if not os.path.exists(self.eeprom_path):
self.eeprom_path = "/sys/bus/i2c/devices/0-0057/eeprom"
super(board, self).__init__(self.eeprom_path, 0, '', True)
5 changes: 2 additions & 3 deletions device/accton/x86_64-accton_as5712_54x-r0/plugins/psuutil.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

#############################################################################
# Accton
#
Expand All @@ -13,7 +11,8 @@
try:
from sonic_psu.psu_base import PsuBase
except ImportError as e:
raise ImportError (str(e) + "- required module not found")
raise ImportError(str(e) + "- required module not found")


class PsuUtil(PsuBase):
"""Platform-specific PSUutil class"""
Expand Down
Loading

0 comments on commit 6c3d3cd

Please sign in to comment.