Skip to content

Commit

Permalink
Merge pull request #16 from Azure/master
Browse files Browse the repository at this point in the history
Master to Vadym master
  • Loading branch information
VadymYashchenko authored Mar 31, 2022
2 parents 14d301c + 106fac5 commit 9eede4c
Show file tree
Hide file tree
Showing 56 changed files with 967 additions and 97 deletions.
12 changes: 10 additions & 2 deletions .azure-pipelines/azure-pipelines-UpgrateVersion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ schedules:
- 202006
always: true

resources:
repositories:
- repository: buildimage
type: github
name: Azure/sonic-buildimage
ref: master
endpoint: build

pool: sonicbld

parameters:
Expand All @@ -43,9 +51,9 @@ stages:
- template: azure-pipelines-build.yml
parameters:
jobFilters: ${{ parameters.jobFilters }}
buildOptions: '${{ variables.VERSION_CONTROL_OPTIONS }} SONIC_BUILD_JOBS=$(nproc) ENABLE_IMAGE_SIGNATURE=y'
buildOptions: '${{ variables.VERSION_CONTROL_OPTIONS }} ENABLE_DOCKER_BASE_PULL=n SONIC_BUILD_JOBS=$(nproc) ENABLE_IMAGE_SIGNATURE=y'
preSteps:
- template: template-clean-sonic-slave.yml
- template: .azure-pipelines/template-clean-sonic-slave.yml@buildimage
- stage: UpgradeVersions
jobs:
- job: UpgradeVersions
Expand Down
19 changes: 19 additions & 0 deletions .azure-pipelines/build-commonlib.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
pr: none
trigger: none
schedules:
- cron: "0 0 * * *"
displayName: Daily build
branches:
include:
- master
- 202???
resources:
repositories:
- repository: buildimage
type: github
name: Azure/sonic-buildimage
ref: master
endpoint: build

jobs:
- template: .azure-pipelines/template-commonlib.yml@buildimage
1 change: 1 addition & 0 deletions .azure-pipelines/docker-sonic-slave-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pr:
- sonic-slave-stretch
- sonic-slave-buster
- sonic-slave-bullseye
- .azure-pipelines

parameters:
- name: 'dists'
Expand Down
1 change: 1 addition & 0 deletions .azure-pipelines/docker-sonic-slave-armhf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pr:
- sonic-slave-stretch
- sonic-slave-buster
- sonic-slave-bullseye
- .azure-pipelines

parameters:
- name: 'dists'
Expand Down
24 changes: 23 additions & 1 deletion .azure-pipelines/docker-sonic-slave-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
# Build and push sonic-slave-[buster|jessie|stretch] images for amd64/armhf/arm64
resources:
repositories:
- repository: buildimage
type: github
name: Azure/sonic-buildimage
ref: master
endpoint: build

parameters:
- name: arch
Expand Down Expand Up @@ -38,7 +45,7 @@ jobs:
pool: ${{ parameters.pool }}
steps:
- template: cleanup.yml
- template: template-clean-sonic-slave.yml
- template: .azure-pipelines/template-clean-sonic-slave.yml@buildimage
- checkout: self
clean: true
submodules: recursive
Expand Down Expand Up @@ -81,6 +88,10 @@ jobs:
docker tag $SLAVE_BASE_IMAGE:$SLAVE_BASE_TAG $REGISTRY_SERVER/$SLAVE_BASE_IMAGE_UPLOAD:latest
docker tag $SLAVE_BASE_IMAGE:$SLAVE_BASE_TAG $REGISTRY_SERVER/$SLAVE_BASE_IMAGE_UPLOAD:$SLAVE_BASE_TAG
if [ "$SLAVE_BASE_IMAGE_UPLOAD" != "$SLAVE_DIR" ]; then
docker tag $SLAVE_BASE_IMAGE:$SLAVE_BASE_TAG $REGISTRY_SERVER/$SLAVE_DIR:latest-${{ parameters.arch }}
docker tag $SLAVE_BASE_IMAGE:$SLAVE_BASE_TAG $REGISTRY_SERVER/$SLAVE_DIR:$SLAVE_BASE_TAG
fi
set +x
echo "##vso[task.setvariable variable=VARIABLE_SLAVE_BASE_IMAGE]$SLAVE_BASE_IMAGE_UPLOAD"
echo "##vso[task.setvariable variable=VARIABLE_SLAVE_BASE_TAG]$SLAVE_BASE_TAG"
Expand All @@ -89,6 +100,7 @@ jobs:
displayName: Build sonic-slave-${{ parameters.dist }}-${{ parameters.arch }}
- task: Docker@2
condition: ne(variables['Build.Reason'], 'PullRequest')
displayName: Upload image
inputs:
containerRegistry: ${{ parameters.registry_conn }}
Expand All @@ -97,3 +109,13 @@ jobs:
tags: |
$(VARIABLE_SLAVE_BASE_TAG)
latest
- ${{ if ne(parameters.arch, 'amd64') }}:
- task: Docker@2
condition: ne(variables['Build.Reason'], 'PullRequest')
displayName: Upload image ${{ parameters.dist }}
inputs:
containerRegistry: ${{ parameters.registry_conn }}
repository: "sonic-slave-${{ parameters.dist }}"
command: push
tags: |
$(VARIABLE_SLAVE_BASE_TAG)
1 change: 1 addition & 0 deletions .azure-pipelines/docker-sonic-slave.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pr:
- sonic-slave-buster
- sonic-slave-bullseye
- src/sonic-build-hooks
- .azure-pipelines

parameters:
- name: 'arches'
Expand Down
34 changes: 34 additions & 0 deletions .azure-pipelines/template-commonlib.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
jobs:
- job: Build
timeoutInMinutes: 120
pool: sonicbld
steps:
- checkout: self
clean: true
submodules: recursive
- script: |
set -ex
case $(Build.SourceBranchName) in
202012 | 202106)
bldenv=buster
;;
*)
bldenv=bullseye
;;
esac
BLDENV=$bldenv make -f Makefile.work configure PLATFORM=vs ENABLE_DOCKER_BASE_PULL=y
echo "##vso[task.setvariable variable=bldenv;]$bldenv"
displayName: Make configure
- script: |
set -ex
LIBNL3_VERSION_BASE=$(grep "LIBNL3_VERSION_BASE =" rules/libnl3.mk | awk '{print$3}')
LIBNL3_VERSION=$(grep "LIBNL3_VERSION =" rules/libnl3.mk | awk '{print$3}' | sed -e "s/(//" -e "s/)//" -e "s/\\$//" -e "s/LIBNL3_VERSION_BASE/$LIBNL3_VERSION_BASE/")
BLDENV=$(bldenv) make -f Makefile.work target/debs/$(bldenv)/libnl-3-200_${LIBNL3_VERSION}_amd64.deb ENABLE_DOCKER_BASE_PULL=y
LIBYANG_VERSION_BASE=$(grep "LIBYANG_VERSION_BASE =" rules/libyang.mk | awk '{print$3}')
LIBYANG_VERSION=$(grep "LIBYANG_VERSION =" rules/libyang.mk | awk '{print$3}' | sed -e "s/\\$//" -e "s/(//" -e "s/)//" -e "s/LIBYANG_VERSION_BASE/$LIBYANG_VERSION_BASE/")
BLDENV=$(bldenv) make -f Makefile.work target/debs/$(bldenv)/libyang_${LIBYANG_VERSION}_amd64.deb
find target -name *.deb | xargs -i cp {} $(Build.ArtifactStagingDirectory)
displayName: Make common lib packages
- publish: $(Build.ArtifactStagingDirectory)
artifact: common-lib
1 change: 1 addition & 0 deletions build_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ export build_version="${SONIC_IMAGE_VERSION}"
export debian_version="$(cat $FILESYSTEM_ROOT/etc/debian_version)"
export kernel_version="${kversion}"
export asic_type="${sonic_asic_platform}"
export asic_subtype="${TARGET_MACHINE}"
export commit_id="$(git rev-parse --short HEAD)"
export branch="$(git rev-parse --abbrev-ref HEAD)"
export release="$(if [ -f $FILESYSTEM_ROOT/etc/sonic/sonic_release ]; then cat $FILESYSTEM_ROOT/etc/sonic/sonic_release; fi)"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"skip_ledd": true,
"skip_thermalctld": true
"skip_pcied": true
}

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"skip_ledd": true,
"skip_thermalctld": true,
"skip_pcied": true
}

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"skip_ledd": true,
"skip_pcied": true,
"skip_thermalctld": true
"skip_pcied": true
}

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"skip_ledd": true,
"skip_thermalctld": true
"skip_pcied": true
}

22 changes: 12 additions & 10 deletions dockers/docker-orchagent/enable_counters.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,18 @@ def enable_rates():
def enable_counters():
db = swsssdk.ConfigDBConnector()
db.connect()
enable_counter_group(db, 'PORT')
enable_counter_group(db, 'RIF')
enable_counter_group(db, 'QUEUE')
enable_counter_group(db, 'PFCWD')
enable_counter_group(db, 'PG_WATERMARK')
enable_counter_group(db, 'PG_DROP')
enable_counter_group(db, 'QUEUE_WATERMARK')
enable_counter_group(db, 'BUFFER_POOL_WATERMARK')
enable_counter_group(db, 'PORT_BUFFER_DROP')
enable_counter_group(db, 'ACL')
default_enabled_counters = ['PORT', 'RIF', 'QUEUE', 'PFCWD', 'PG_WATERMARK', 'PG_DROP',
'QUEUE_WATERMARK', 'BUFFER_POOL_WATERMARK', 'PORT_BUFFER_DROP', 'ACL']

# Enable those default counters
for key in default_enabled_counters:
enable_counter_group(db, key)

# Set FLEX_COUNTER_DELAY_STATUS to false for those non-default counters
keys = db.get_keys('FLEX_COUNTER_TABLE')
for key in keys:
if key not in default_enabled_counters:
enable_counter_group(db, key)
enable_rates()


Expand Down
1 change: 1 addition & 0 deletions dockers/docker-orchagent/orchagent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ SWSS_VARS_FILE=/usr/share/sonic/templates/swss_vars.j2
# Retrieve SWSS vars from sonic-cfggen
SWSS_VARS=$(sonic-cfggen -d -y /etc/sonic/sonic_version.yml -t $SWSS_VARS_FILE) || exit 1
export platform=$(echo $SWSS_VARS | jq -r '.asic_type')
export sub_platform=$(echo $SWSS_VARS | jq -r '.asic_subtype')

MAC_ADDRESS=$(echo $SWSS_VARS | jq -r '.mac')
if [ "$MAC_ADDRESS" == "None" ] || [ -z "$MAC_ADDRESS" ]; then
Expand Down
86 changes: 46 additions & 40 deletions dockers/docker-orchagent/tunnel_packet_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ def __init__(self):
self._portchannel_intfs = None
self.up_portchannels = None
self.netlink_api = IPRoute()
self.sniffer = None
self.self_ip = ''
self.packet_filter = ''
self.sniff_intfs = []

@property
def portchannel_intfs(self):
Expand Down Expand Up @@ -270,66 +274,68 @@ def sniffer_restart_required(self, messages):
return True
return False

def start_sniffer(self):
"""
Starts an AsyncSniffer and waits for it to inititalize fully
"""
self.sniffer = AsyncSniffer(
iface=self.sniff_intfs,
filter=self.packet_filter,
prn=self.ping_inner_dst,
store=0
)
self.sniffer.start()

while not hasattr(self.sniffer, 'stop_cb'):
time.sleep(0.1)

def ping_inner_dst(self, packet):
"""
Pings the inner destination IP for an encapsulated packet
Args:
packet: The encapsulated packet received
"""
inner_packet_type = self.get_inner_pkt_type(packet)
if inner_packet_type and packet[IP].dst == self.self_ip:
cmds = ['timeout', '0.2', 'ping', '-c1',
'-W1', '-i0', '-n', '-q']
if inner_packet_type == IPv6:
cmds.append('-6')
dst_ip = packet[IP].payload[inner_packet_type].dst
cmds.append(dst_ip)
logger.log_info("Running command '{}'".format(' '.join(cmds)))
subprocess.run(cmds, stdout=subprocess.DEVNULL)

def listen_for_tunnel_pkts(self):
"""
Listens for tunnel packets that are trapped to CPU
These packets may be trapped if there is no neighbor info for the
inner packet destination IP in the hardware.
"""

def _ping_inner_dst(packet):
"""
Pings the inner destination IP for an encapsulated packet
Args:
packet: The encapsulated packet received
"""
inner_packet_type = self.get_inner_pkt_type(packet)
if inner_packet_type and packet[IP].dst == self_ip:
cmds = ['timeout', '0.2', 'ping', '-c1',
'-W1', '-i0', '-n', '-q']
if inner_packet_type == IPv6:
cmds.append('-6')
dst_ip = packet[IP].payload[inner_packet_type].dst
cmds.append(dst_ip)
logger.log_info("Running command '{}'".format(' '.join(cmds)))
subprocess.run(cmds, stdout=subprocess.DEVNULL)

self_ip, peer_ip = self.get_ipinip_tunnel_addrs()
if self_ip is None or peer_ip is None:
self.self_ip, peer_ip = self.get_ipinip_tunnel_addrs()
if self.self_ip is None or peer_ip is None:
logger.log_notice('Could not get tunnel addresses from '
'config DB, exiting...')
return None

packet_filter = 'host {} and host {}'.format(self_ip, peer_ip)
self.packet_filter = 'host {} and host {}'.format(self.self_ip, peer_ip)
logger.log_notice('Starting tunnel packet handler for {}'
.format(packet_filter))
.format(self.packet_filter))

sniff_intfs = self.get_up_portchannels()
logger.log_info("Listening on interfaces {}".format(sniff_intfs))
self.sniff_intfs = self.get_up_portchannels()
logger.log_info("Listening on interfaces {}".format(self.sniff_intfs))

sniffer = AsyncSniffer(
iface=sniff_intfs,
filter=packet_filter,
prn=_ping_inner_dst,
store=0
)
sniffer.start()
self.start_sniffer()
while True:
msgs = self.wait_for_netlink_msgs()
if self.sniffer_restart_required(msgs):
sniffer.stop()
self.sniffer.stop()
sniff_intfs = self.get_up_portchannels()
logger.log_notice('Restarting tunnel packet handler on '
'interfaces {}'.format(sniff_intfs))
sniffer = AsyncSniffer(
iface=sniff_intfs,
filter=packet_filter,
prn=_ping_inner_dst,
store=0
)
sniffer.start()
self.start_sniffer()

def run(self):
"""
Expand Down
3 changes: 3 additions & 0 deletions files/build_templates/sonic_version.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ debian_version: '{{ debian_version }}'
kernel_version: '{{ kernel_version }}'
{% endif -%}
asic_type: {{ asic_type }}
{% if asic_subtype is defined and asic_subtype != '' -%}
asic_subtype: '{{ asic_subtype }}'
{% endif -%}
commit_id: '{{ commit_id }}'
branch: '{{ branch }}'
{% if release is defined and release != '' -%}
Expand Down
3 changes: 3 additions & 0 deletions files/build_templates/swss_vars.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"asic_type": "{{ asic_type }}",
{% if asic_subtype is defined and asic_subtype != '' -%}
"asic_subtype": "{{ asic_subtype }}",
{% endif -%}
"asic_id": "{{ DEVICE_METADATA.localhost.asic_id }}",
"mac": "{{ DEVICE_METADATA.localhost.mac }}",
"resource_type": "{{ DEVICE_METADATA.localhost.resource_type }}",
Expand Down
4 changes: 2 additions & 2 deletions platform/broadcom/sai-modules.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Broadcom SAI modules

BRCM_OPENNSL_KERNEL_VERSION = 6.0.0.13
BRCM_OPENNSL_KERNEL_VERSION = 6.1.0.3

BRCM_OPENNSL_KERNEL = opennsl-modules_$(BRCM_OPENNSL_KERNEL_VERSION)_amd64.deb
$(BRCM_OPENNSL_KERNEL)_SRC_PATH = $(PLATFORM_PATH)/saibcm-modules
Expand All @@ -10,7 +10,7 @@ $(BRCM_OPENNSL_KERNEL)_MACHINE = broadcom
SONIC_DPKG_DEBS += $(BRCM_OPENNSL_KERNEL)

# SAI bcm modules for DNX family ASIC
BRCM_DNX_OPENNSL_KERNEL_VERSION = 6.0.0.13
BRCM_DNX_OPENNSL_KERNEL_VERSION = 6.1.0.3

BRCM_DNX_OPENNSL_KERNEL = opennsl-modules-dnx_$(BRCM_DNX_OPENNSL_KERNEL_VERSION)_amd64.deb
$(BRCM_DNX_OPENNSL_KERNEL)_SRC_PATH = $(PLATFORM_PATH)/saibcm-modules-dnx
Expand Down
4 changes: 2 additions & 2 deletions platform/broadcom/sai.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
LIBSAIBCM_VERSION = 6.0.0.13-3
LIBSAIBCM_BRANCH_NAME = REL_6.0
LIBSAIBCM_VERSION = 6.1.0.3
LIBSAIBCM_BRANCH_NAME = REL_6.1
LIBSAIBCM_URL_PREFIX = "https://sonicstorage.blob.core.windows.net/public/sai/bcmsai/$(LIBSAIBCM_BRANCH_NAME)/$(LIBSAIBCM_VERSION)"

BRCM_SAI = libsaibcm_$(LIBSAIBCM_VERSION)_amd64.deb
Expand Down
Loading

0 comments on commit 9eede4c

Please sign in to comment.