Skip to content

Commit

Permalink
Merge branch 'master' of http://github.com/azure/sonic-buildimage
Browse files Browse the repository at this point in the history
  • Loading branch information
sonic-build committed Nov 30, 2022
2 parents 9d58835 + d22cf46 commit b1903f2
Show file tree
Hide file tree
Showing 39 changed files with 3,028 additions and 91 deletions.
6 changes: 3 additions & 3 deletions .azure-pipelines/run-test-scheduler-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ parameters:
default: 36000

- name: MIN_WORKER
type: number
type: string
default: 1

- name: MAX_WORKER
type: number
default: 2
type: string
default: 1

- name: TEST_SET
type: string
Expand Down
59 changes: 59 additions & 0 deletions .github/workflows/automerge_scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: AutoMergeScan
on:
schedule:
- cron: '31 */2 * * *'
workflow_dispatch:

jobs:
automerge_scan:
runs-on: ubuntu-latest
steps:
- name: Debug
env:
TOKEN: ${{ secrets.TOKEN }}
run: |
set -e
echo ${TOKEN} | gh auth login --with-token
gh pr list -R sonic-net/sonic-buildimage -A mssonicbld --json additions,assignees,author,baseRefName,body,changedFiles,closed,closedAt,comments,commits,createdAt,deletions,files,headRefName,headRepository,headRepositoryOwner,id,isCrossRepository,isDraft,labels,latestReviews,maintainerCanModify,mergeCommit,mergeStateStatus,mergeable,mergedAt,mergedBy,milestone,number,potentialMergeCommit,projectCards,reactionGroups,reviewDecision,reviewRequests,reviews,state,statusCheckRollup,title,updatedAt,url > prs.log
cat prs.log | jq
- name: Main
run: |
set -e
count=$(cat prs.log | jq 'length')
for ((i=0;i<$count;i++))
do
url=$(cat prs.log | jq -r ".[$i].url")
created_at=$(cat prs.log | jq -r ".[$i].createdAt")
echo PR: $(($i+1))/$count, URL: $url, createdAt: $created_at, now: $(date -u +"%FT%TZ")
[[ "$url" == "" ]] && continue
[[ $created_at > $(date --date "1 hour ago" -u +"%FT%TZ") ]] && continue
checks=$(cat prs.log | jq ".[$i].statusCheckRollup")
checks_count=$(echo $checks | jq 'length')
echo Checks count: $checks_count
for ((j=0;j<$checks_count;j++))
do
check=$(echo $checks | jq ".[$j]")
state=$(echo $check | jq -r '.state')
conclusion=$(echo $check | jq -r '.conclusion')
# EasyCLA success flag: state=SUCCESS
# Others success flag: conclusion in SUCCESS,NEUTRAL
if [[ "$state" == "SUCCESS" ]];then
# check pass
continue
elif [[ "$conclusion" == "SUCCESS" ]] || [[ "$conclusion" == "NEUTRAL" ]];then
# check pass
continue
else
echo "$url Check failed!!!"
echo $check | jq
continue 2
fi
done
# merge the PR
echo ========Merging PR========
gh pr merge --rebase --admin -R sonic-net/sonic-buildimage $url || true
echo ========Finished PR========
done
27 changes: 14 additions & 13 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ stages:
- template: .azure-pipelines/run-test-scheduler-template.yml
parameters:
TOPOLOGY: t0
MIN_WORKER: 2
MAX_WORKER: 3
MIN_WORKER: $(T0_INSTANCE_NUM)
MAX_WORKER: $(T0_INSTANCE_NUM)

- job: t0_2vlans_testbedv2
pool:
Expand All @@ -199,7 +199,8 @@ stages:
parameters:
TOPOLOGY: t0
TEST_SET: t0-2vlans
MAX_WORKER: 1
MIN_WORKER: $(T0_2VLANS_INSTANCE_NUM)
MAX_WORKER: $(T0_2VLANS_INSTANCE_NUM)
DEPLOY_MG_EXTRA_PARAMS: "-e vlan_config=two_vlan_a"

- job:
Expand Down Expand Up @@ -261,8 +262,8 @@ stages:
- template: .azure-pipelines/run-test-scheduler-template.yml
parameters:
TOPOLOGY: t1-lag
MIN_WORKER: 2
MAX_WORKER: 3
MIN_WORKER: $(T1_LAG_INSTANCE_NUM)
MAX_WORKER: $(T1_LAG_INSTANCE_NUM)

- job:
pool:
Expand Down Expand Up @@ -328,8 +329,8 @@ stages:
parameters:
TOPOLOGY: t1-8-lag
TEST_SET: multi-asic-t1-lag
MIN_WORKER: 1
MAX_WORKER: 1
MIN_WORKER: $(MULTI_ASIC_INSTANCE_NUM)
MAX_WORKER: $(MULTI_ASIC_INSTANCE_NUM)
NUM_ASIC: 4

- job: dualtor_testbedv2
Expand All @@ -343,8 +344,8 @@ stages:
- template: .azure-pipelines/run-test-scheduler-template.yml
parameters:
TOPOLOGY: dualtor
MIN_WORKER: 1
MAX_WORKER: 1
MIN_WORKER: $(T0_DUALTOR_INSTANCE_NUM)
MAX_WORKER: $(T0_DUALTOR_INSTANCE_NUM)
COMMON_EXTRA_PARAMS: "--disable_loganalyzer "

- job: sonic_t0_testbedv2
Expand All @@ -358,8 +359,8 @@ stages:
- template: .azure-pipelines/run-test-scheduler-template.yml
parameters:
TOPOLOGY: t0-64-32
MIN_WORKER: 1
MAX_WORKER: 2
MIN_WORKER: $(T0_SONIC_INSTANCE_NUM)
MAX_WORKER: $(T0_SONIC_INSTANCE_NUM)
TEST_SET: t0-sonic
COMMON_EXTRA_PARAMS: "--neighbor_type=sonic --enable_macsec --macsec_profile=128_SCI,256_XPN_SCI"
VM_TYPE: vsonic
Expand All @@ -376,6 +377,6 @@ stages:
- template: .azure-pipelines/run-test-scheduler-template.yml
parameters:
TOPOLOGY: wan-pub
MIN_WORKER: 1
MAX_WORKER: 1
MIN_WORKER: $(WAN_INSTANCE_NUM)
MAX_WORKER: $(WAN_INSTANCE_NUM)
COMMON_EXTRA_PARAMS: "--skip_sanity "
21 changes: 9 additions & 12 deletions device/marvell/arm64-marvell_db98cx8580_16cd-r0/plugins/sfputil.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
try:
import os
import time
import sys
import re
import subprocess
from sonic_sfp.sfputilbase import SfpUtilBase
from sonic_py_common.general import getstatusoutput_noshell
except ImportError as e:
raise ImportError(str(e) + "- required module not found")

if sys.version_info[0] < 3:
import commands
else:
import subprocess as commands

smbus_present = 1

try:
Expand All @@ -31,9 +27,10 @@ class SfpUtil(SfpUtilBase):
_qsfp_ports = list(range(_port_start, ports_in_block + 1))

def __init__(self):
os.system("modprobe i2c-dev")
subprocess.call(["modprobe", "i2c-dev"])
if not os.path.exists("/sys/bus/i2c/devices/0-0050"):
os.system("echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-0/new_device")
with open("/sys/bus/i2c/devices/i2c-0/new_device", 'w') as file:
file.write("optoe2 0x50")

eeprom_path = '/sys/bus/i2c/devices/0-0050/eeprom'
# for x in range(self.port _start, self.port_end +1):
Expand Down Expand Up @@ -74,8 +71,8 @@ def get_low_power_mode(self, port_num):
def i2c_get(self, device_addr, offset):
status = 0
if smbus_present == 0:
x = "i2cget -y 0 " + hex(device_addr) + " " + hex(offset)
cmdstatus, status = commands.getstatusoutput(x)
x = ["i2cget", "-y", "0", hex(device_addr), hex(offset)]
cmdstatus, status = getstatusoutput_noshell(x)
if cmdstatus != 0:
return cmdstatus
status = int(status, 16)
Expand All @@ -86,8 +83,8 @@ def i2c_get(self, device_addr, offset):

def i2c_set(self, device_addr, offset, value):
if smbus_present == 0:
cmd = "i2cset -y 0 " + hex(device_addr) + " " + hex(offset) + " " + hex(value)
os.system(cmd)
cmd = ["i2cset", "-y", "0", hex(device_addr), hex(offset), hex(value)]
subprocess.call(cmd)
else:
bus = smbus.SMBus(0)
bus.write_byte_data(device_addr, offset, value)
Expand Down
21 changes: 9 additions & 12 deletions device/marvell/arm64-marvell_db98cx8580_32cd-r0/plugins/sfputil.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
try:
import os
import time
import sys
import re
import subprocess
from sonic_sfp.sfputilbase import SfpUtilBase
from sonic_py_common.general import getstatusoutput_noshell
except ImportError as e:
raise ImportError(str(e) + "- required module not found")

if sys.version_info[0] < 3:
import commands
else:
import subprocess as commands

smbus_present = 1

try:
Expand All @@ -31,9 +27,10 @@ class SfpUtil(SfpUtilBase):
_qsfp_ports = list(range(_port_start, ports_in_block + 1))

def __init__(self):
os.system("modprobe i2c-dev")
subprocess.call(["modprobe", "i2c-dev"])
if not os.path.exists("/sys/bus/i2c/devices/0-0050"):
os.system("echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-0/new_device")
with open("/sys/bus/i2c/devices/i2c-0/new_device", 'w') as file:
file.write("optoe2 0x50")

eeprom_path = '/sys/bus/i2c/devices/0-0050/eeprom'
# for x in range(self.port _start, self.port_end +1):
Expand Down Expand Up @@ -74,8 +71,8 @@ def get_low_power_mode(self, port_num):
def i2c_get(self, device_addr, offset):
status = 0
if smbus_present == 0:
x = "i2cget -y 0 " + hex(device_addr) + " " + hex(offset)
cmdstatus, status = commands.getstatusoutput(x)
x = ["i2cget", "-y", "0", hex(device_addr), hex(offset)]
cmdstatus, status = getstatusoutput_noshell(x)
if cmdstatus != 0:
return cmdstatus
status = int(status, 16)
Expand All @@ -86,8 +83,8 @@ def i2c_get(self, device_addr, offset):

def i2c_set(self, device_addr, offset, value):
if smbus_present == 0:
cmd = "i2cset -y 0 " + hex(device_addr) + " " + hex(offset) + " " + hex(value)
os.system(cmd)
cmd = ["i2cset", "-y", "0", hex(device_addr), hex(offset), hex(value)]
subprocess.call(cmd)
else:
bus = smbus.SMBus(0)
bus.write_byte_data(device_addr, offset, value)
Expand Down
13 changes: 3 additions & 10 deletions device/marvell/armhf-marvell_et6448m_52x-r0/plugins/psuutil.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import sys
import os.path
if sys.version_info[0] < 3:
import commands
else:
import subprocess as commands
from sonic_py_common.general import getstatusoutput_noshell

smbus_present = 1
try:
Expand Down Expand Up @@ -32,8 +27,7 @@ def get_psu_status(self, index):
if index is None:
return False
if smbus_present == 0:
cmdstatus, psustatus = commands.getstatusoutput(
'i2cget -y 0 0x41 0xa') # need to verify the cpld register logic
cmdstatus, psustatus = getstatusoutput_noshell(["i2cget", "-y", "0", "0x41", "0xa"])
psustatus = int(psustatus, 16)
else:
bus = smbus.SMBus(0)
Expand All @@ -56,8 +50,7 @@ def get_psu_presence(self, index):
return False

if smbus_present == 0:
cmdstatus, psustatus = commands.getstatusoutput(
'i2cget -y 0 0x41 0xa') # need to verify the cpld register logic
cmdstatus, psustatus = getstatusoutput_noshell(["i2cget", "-y", "0", "0x41", "0xa"])
psustatus = int(psustatus, 16)
else:
bus = smbus.SMBus(0)
Expand Down
18 changes: 7 additions & 11 deletions device/marvell/armhf-marvell_et6448m_52x-r0/plugins/sfputil.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,13 @@
import os
import time
import re
import sys
import glob
import subprocess
from sonic_sfp.sfputilbase import SfpUtilBase
from sonic_py_common.general import getstatusoutput_noshell
except ImportError as e:
raise ImportError(str(e) + "- required module not found")

if sys.version_info[0] < 3:
import commands
else:
import subprocess as commands

smbus_present = 1

try:
Expand Down Expand Up @@ -43,7 +39,7 @@ def __init__(self):

# Enable optical SFP Tx
if smbus_present == 0:
os.system("i2cset -y -m 0x0f 0 0x41 0x5 0x00")
subprocess.call(["i2cset", "-y", "-m", "0x0f", "0", "0x41", "0x5", "0x00"])
else:
bus = smbus.SMBus(0)
DEVICE_ADDRESS = 0x41
Expand All @@ -66,8 +62,9 @@ def __init__(self):
port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x])
#print port_eeprom_path
if not os.path.exists(port_eeprom_path):
bus_dev_path = bus_path.format(self.port_to_i2c_mapping[x])
os.system("echo optoe2 0x50 > " + bus_dev_path + "/new_device")
bus_dev_path = bus_path.format(self.port_to_i2c_mapping[x]) + "/new_device"
with open(bus_dev_path, 'w') as f:
f.write("optoe2 0x50")
self.port_to_eeprom_mapping[x] = port_eeprom_path
self._port_to_eeprom_mapping[x] = port_eeprom_path
SfpUtilBase.__init__(self)
Expand Down Expand Up @@ -113,8 +110,7 @@ def get_presence(self, port_num):
pos = [1, 2, 4, 8]
bit_pos = pos[prt]
if smbus_present == 0:
cmdstatus, sfpstatus = commands.getstatusoutput(
'i2cget -y 0 0x41 0x3') # need to verify the cpld register logic
cmdstatus, sfpstatus = getstatusoutput_noshell(['i2cget', '-y', '0', '0x41', '0x3'])
sfpstatus = int(sfpstatus, 16)
else:
bus = smbus.SMBus(0)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
try:
import os
import time
import sys
import re
import subprocess
from sonic_sfp.sfputilbase import SfpUtilBase
from sonic_py_common.general import getstatusoutput_noshell
except ImportError as e:
raise ImportError(str(e) + "- required module not found")

if sys.version_info[0] < 3:
import commands
else:
import subprocess as commands

smbus_present = 1

try:
Expand All @@ -31,9 +27,10 @@ class SfpUtil(SfpUtilBase):
_qsfp_ports = list(range(_port_start, ports_in_block + 1))

def __init__(self):
os.system("modprobe i2c-dev")
subprocess.call(["modprobe", "i2c-dev"])
if not os.path.exists("/sys/bus/i2c/devices/0-0050"):
os.system("echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-0/new_device")
with open("/sys/bus/i2c/devices/i2c-0/new_device", 'w') as file:
file.write("optoe2 0x50")

eeprom_path = '/sys/bus/i2c/devices/0-0050/eeprom'
# for x in range(self.port _start, self.port_end +1):
Expand Down Expand Up @@ -74,8 +71,8 @@ def get_low_power_mode(self, port_num):
def i2c_get(self, device_addr, offset):
status = 0
if smbus_present == 0:
x = "i2cget -y 0 " + hex(device_addr) + " " + hex(offset)
cmdstatus, status = commands.getstatusoutput(x)
x = ["i2cget", "-y", "0", hex(device_addr), hex(offset)]
cmdstatus, status = getstatusoutput_noshell(x)
if cmdstatus != 0:
return cmdstatus
status = int(status, 16)
Expand All @@ -86,8 +83,8 @@ def i2c_get(self, device_addr, offset):

def i2c_set(self, device_addr, offset, value):
if smbus_present == 0:
cmd = "i2cset -y 0 " + hex(device_addr) + " " + hex(offset) + " " + hex(value)
os.system(cmd)
cmd = ["i2cset", "-y", "0", hex(device_addr), hex(offset), hex(value)]
subprocess.call(cmd)
else:
bus = smbus.SMBus(0)
bus.write_byte_data(device_addr, offset, value)
Expand Down
Loading

0 comments on commit b1903f2

Please sign in to comment.