Skip to content

Commit 6be166a

Browse files
Merge branch 'Azure-master' into storm_control
2 parents 46a0f9a + c5385d5 commit 6be166a

File tree

902 files changed

+750040
-9093
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

902 files changed

+750040
-9093
lines changed

.artifactignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
**/*
2+
!dist/*.whl
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
parameters:
2+
- name: timeout
3+
type: number
4+
default: 60
5+
6+
- name: artifact_name
7+
type: string
8+
9+
jobs:
10+
- job:
11+
displayName: "docker-sonic-vs"
12+
timeoutInMinutes: ${{ parameters.timeout }}
13+
14+
pool:
15+
vmImage: 'ubuntu-20.04'
16+
17+
steps:
18+
- task: DownloadPipelineArtifact@2
19+
inputs:
20+
artifact: wheels
21+
displayName: "Download sonic utilities artifact"
22+
23+
- task: DownloadPipelineArtifact@2
24+
inputs:
25+
source: specific
26+
project: build
27+
pipeline: 15
28+
artifact: ${{ parameters.artifact_name }}
29+
runVersion: 'latestFromBranch'
30+
runBranch: 'refs/heads/master'
31+
displayName: "Download docker-sonic-vs artifact"
32+
33+
- script: |
34+
set -ex
35+
36+
echo $(Build.DefinitionName).$(Build.BuildNumber)
37+
38+
docker load < ../docker-sonic-vs.gz
39+
40+
docker images "docker-sonic-vs"
41+
42+
image_id=$(docker images "docker-sonic-vs:Azure.sonic-swss*" -q)
43+
44+
docker tag ${image_id} docker-sonic-vs:latest
45+
46+
docker images "docker-sonic-vs"
47+
48+
mkdir -p .azure-pipelines/docker-sonic-vs/wheels
49+
50+
cp -v ../*.whl .azure-pipelines/docker-sonic-vs/wheels
51+
52+
pushd .azure-pipelines
53+
54+
docker build --no-cache -t docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber) docker-sonic-vs
55+
56+
popd
57+
58+
docker save docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber) | gzip -c > $(Build.ArtifactStagingDirectory)/docker-sonic-vs.gz
59+
displayName: "Build docker-sonic-vs image"
60+
61+
- publish: $(Build.ArtifactStagingDirectory)/
62+
artifact: ${{ parameters.artifact_name }}
63+
displayName: "Archive sonic docker vs image"
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
#!/bin/bash
2+
#
3+
# build and install team/vrf driver
4+
#
5+
6+
set -e
7+
8+
source /etc/os-release
9+
10+
function build_and_install_kmodule()
11+
{
12+
if sudo modprobe team 2>/dev/null && sudo modprobe vrf 2>/dev/null && sudo modprobe macsec 2>/dev/null; then
13+
echo "The module team, vrf and macsec exist."
14+
return
15+
fi
16+
17+
[ -z "$WORKDIR" ] && WORKDIR=$(mktemp -d)
18+
cd $WORKDIR
19+
20+
KERNEL_RELEASE=$(uname -r)
21+
KERNEL_MAINVERSION=$(echo $KERNEL_RELEASE | cut -d- -f1)
22+
EXTRAVERSION=$(echo $KERNEL_RELEASE | cut -d- -f2)
23+
LOCALVERSION=$(echo $KERNEL_RELEASE | cut -d- -f3)
24+
VERSION=$(echo $KERNEL_MAINVERSION | cut -d. -f1)
25+
PATCHLEVEL=$(echo $KERNEL_MAINVERSION | cut -d. -f2)
26+
SUBLEVEL=$(echo $KERNEL_MAINVERSION | cut -d. -f3)
27+
28+
# Install the required debian packages to build the kernel modules
29+
apt-get install -y build-essential linux-headers-${KERNEL_RELEASE} autoconf pkg-config fakeroot
30+
apt-get install -y flex bison libssl-dev libelf-dev
31+
apt-get install -y libnl-route-3-200 libnl-route-3-dev libnl-cli-3-200 libnl-cli-3-dev libnl-3-dev
32+
33+
# Add the apt source mirrors and download the linux image source code
34+
cp /etc/apt/sources.list /etc/apt/sources.list.bk
35+
sed -i "s/^# deb-src/deb-src/g" /etc/apt/sources.list
36+
apt-get update
37+
apt-get source linux-image-unsigned-$(uname -r) > source.log
38+
39+
# Recover the original apt sources list
40+
cp /etc/apt/sources.list.bk /etc/apt/sources.list
41+
apt-get update
42+
43+
# Build the Linux kernel module drivers/net/team and vrf
44+
cd $(find . -maxdepth 1 -type d | grep -v "^.$")
45+
make allmodconfig
46+
mv .config .config.bk
47+
cp /boot/config-$(uname -r) .config
48+
grep NET_TEAM .config.bk >> .config
49+
echo CONFIG_NET_VRF=m >> .config
50+
echo CONFIG_MACSEC=m >> .config
51+
echo CONFIG_NET_VENDOR_MICROSOFT=y >> .config
52+
echo CONFIG_MICROSOFT_MANA=m >> .config
53+
echo CONFIG_SYSTEM_REVOCATION_LIST=n >> .config
54+
make VERSION=$VERSION PATCHLEVEL=$PATCHLEVEL SUBLEVEL=$SUBLEVEL EXTRAVERSION=-${EXTRAVERSION} LOCALVERSION=-${LOCALVERSION} modules_prepare
55+
make M=drivers/net/team
56+
mv drivers/net/Makefile drivers/net/Makefile.bak
57+
echo 'obj-$(CONFIG_NET_VRF) += vrf.o' > drivers/net/Makefile
58+
echo 'obj-$(CONFIG_MACSEC) += macsec.o' >> drivers/net/Makefile
59+
make M=drivers/net
60+
61+
# Install the module
62+
TEAM_DIR=$(echo /lib/modules/$(uname -r)/kernel/net/team)
63+
NET_DIR=$(echo /lib/modules/$(uname -r)/kernel/net)
64+
if [ ! -e "$TEAM_DIR/team.ko" ]; then
65+
mkdir -p $TEAM_DIR
66+
cp drivers/net/team/*.ko $TEAM_DIR/
67+
modinfo $TEAM_DIR/team.ko
68+
depmod
69+
modprobe team
70+
fi
71+
if [ ! -e "$NET_DIR/vrf.ko" ]; then
72+
mkdir -p $NET_DIR
73+
cp drivers/net/vrf.ko $NET_DIR/
74+
modinfo $NET_DIR/vrf.ko
75+
depmod
76+
modprobe vrf
77+
fi
78+
if [ ! -e "$NET_DIR/macsec.ko" ]; then
79+
mkdir -p $NET_DIR
80+
cp drivers/net/macsec.ko $NET_DIR/
81+
modinfo $NET_DIR/macsec.ko
82+
depmod
83+
modprobe macsec
84+
fi
85+
86+
cd /tmp
87+
rm -rf $WORKDIR
88+
}
89+
90+
build_and_install_kmodule
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM docker-sonic-vs
2+
3+
ARG docker_container_name
4+
5+
ADD ["wheels", "/wheels"]
6+
7+
# Uninstalls only sonic-utilities and does not impact its dependencies
8+
RUN pip3 uninstall -y sonic-utilities
9+
10+
# Installs sonic-utilities, adds missing dependencies, upgrades out-dated depndencies
11+
RUN pip3 install /wheels/sonic_utilities-1.2-py3-none-any.whl
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
parameters:
2+
- name: timeout
3+
type: number
4+
default: 180
5+
6+
- name: log_artifact_name
7+
type: string
8+
9+
jobs:
10+
- job:
11+
displayName: vstest
12+
timeoutInMinutes: ${{ parameters.timeout }}
13+
14+
pool:
15+
vmImage: 'ubuntu-20.04'
16+
17+
steps:
18+
- task: DownloadPipelineArtifact@2
19+
inputs:
20+
artifact: docker-sonic-vs
21+
displayName: "Download docker sonic vs image"
22+
23+
- task: DownloadPipelineArtifact@2
24+
inputs:
25+
source: specific
26+
project: build
27+
pipeline: 9
28+
artifact: sonic-swss-common.amd64.ubuntu20_04
29+
runVersion: 'latestFromBranch'
30+
runBranch: 'refs/heads/master'
31+
displayName: "Download sonic swss common deb packages"
32+
33+
- task: DownloadPipelineArtifact@2
34+
inputs:
35+
source: specific
36+
project: build
37+
pipeline: 15
38+
artifact: sonic-swss-pytests
39+
runVersion: 'latestFromBranch'
40+
runBranch: 'refs/heads/master'
41+
displayName: "Download sonic swss pytests"
42+
43+
- checkout: self
44+
displayName: "Checkout sonic-utilities"
45+
46+
- script: |
47+
set -x
48+
sudo .azure-pipelines/build_and_install_module.sh
49+
50+
sudo apt-get install -y libhiredis0.14
51+
sudo dpkg -i --force-confask,confnew ../libswsscommon_1.0.0_amd64.deb || apt-get install -f
52+
sudo dpkg -i ../python3-swsscommon_1.0.0_amd64.deb
53+
54+
# install packages for vs test
55+
sudo apt-get install -y net-tools bridge-utils vlan
56+
sudo apt-get install -y python3-pip
57+
sudo pip3 install pytest==4.6.2 attrs==19.1.0 exabgp==4.0.10 distro==1.5.0 docker==4.4.1 redis==3.3.4 flaky==3.7.0
58+
displayName: "Install dependencies"
59+
60+
- script: |
61+
set -x
62+
sudo docker load -i ../docker-sonic-vs.gz
63+
docker ps
64+
ip netns list
65+
cd ../
66+
mkdir -p sonic-swss
67+
pushd sonic-swss
68+
tar xf ../pytest.tgz
69+
pushd tests
70+
sudo py.test -v --force-flaky --junitxml=tr.xml --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber)
71+
displayName: "Run vs tests"
72+
73+
- task: PublishTestResults@2
74+
inputs:
75+
testResultsFiles: '**/tr.xml'
76+
testRunTitle: vstest
77+
condition: always()
78+
79+
- script: |
80+
cp -r ../sonic-swss/tests/log $(Build.ArtifactStagingDirectory)/
81+
displayName: "Collect logs"
82+
condition: always()
83+
84+
- publish: $(Build.ArtifactStagingDirectory)/
85+
artifact: ${{ parameters.log_artifact_name }}@$(System.JobAttempt)
86+
displayName: "Publish logs"
87+
condition: always()

.coveragerc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[run]
2+
branch = True
3+
source = .
4+
omit =
5+
.eggs/*
6+
tests/*

.github/ISSUE_TEMPLATE.md

Lines changed: 0 additions & 60 deletions
This file was deleted.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)