Skip to content

Test submit OTSS and Syncd-ot code #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
0540f20
support ot-vs platform and device
sonic-otn Sep 22, 2023
5a5683e
update otairedis submodule
sonic-otn Oct 7, 2023
796c940
support optical transport state service(otss)
sonic-otn Oct 19, 2023
54c33eb
Create sonic-otn-ot-vs-build.yml
Weitang-Zheng Oct 24, 2023
e915fb1
update sonic-swss-common submodule
sonic-otn Oct 25, 2023
f66b4ed
update otairedis and otss submodule
sonic-otn Oct 25, 2023
964350f
update sonic-otss submodule
sonic-otn Oct 25, 2023
d64fbae
add otss and syncd-ot service
sonic-otn Oct 26, 2023
5f63586
update build workflows
sonic-otn Oct 26, 2023
1940ed3
Update sonic-otn-ot-pre-202411-vs-build.yml
Weitang-Zheng Oct 26, 2023
8d6a2f9
update build flow
sonic-otn Oct 26, 2023
f89a046
update build flow
sonic-otn Oct 26, 2023
463b889
fix build flow error
sonic-otn Oct 26, 2023
c50af7e
change jobs workspace
sonic-otn Oct 26, 2023
ca94d9e
test change workspce
sonic-otn Oct 27, 2023
dc684b4
test change workspce and build
sonic-otn Oct 27, 2023
4f3d383
upload artifact in github actions
sonic-otn Oct 31, 2023
b2c2de4
support make multiple asic kvm image
sonic-otn Nov 1, 2023
bec6c5d
Update sonic-otn-ot-pre-202411-vs-build.yml
sonic-otn Nov 2, 2023
38d604a
run otss and syncd-ot services on otn platform
sonic-otn Nov 8, 2023
cf683ad
support otss and syncd-ot services
sonic-otn Nov 15, 2023
2eb6be8
submit the otss and syncd-ot service shell
sonic-otn Nov 20, 2023
779c517
update device-data and otn config_setup
sonic-otn Nov 21, 2023
c6de161
udate otss and syncd-ot script
sonic-otn Nov 22, 2023
edabf27
disable swss and syncd servce, and run one lldp and bgp instance
sonic-otn Nov 22, 2023
6643576
update swss-common and otairedis submodule; add orchagent script
sonic-otn Dec 21, 2023
8fc8d7a
update otn device configuration and otairedis submodule
sonic-otn Jan 2, 2024
4228759
update openssh to 8.4p1-5+deb11u3
sonic-otn Jan 2, 2024
6ccba2b
disable caclmgrd and enable bgp service
sonic-otn Jan 3, 2024
0ce1a5f
bgp start after otss in otn device; no localhost table in metadata on…
sonic-otn Jan 4, 2024
f9c078f
generate otn linecards configuration at boot time and set bgp service…
sonic-otn Jan 11, 2024
3741d2d
move otn device and platform into native sonic device and platform fo…
sonic-otn Jan 16, 2024
4a20965
change the ot-orchagent name to orchagent-ot
sonic-otn Jan 16, 2024
82af0b3
supports otss and syncd-ot services
sonic-otn Jan 16, 2024
e45910b
Update sonic-otn-ot-pre-202411-vs-build.yml
sonic-otn Jan 17, 2024
ae7946a
Update sonic-otn-ot-pre-202411-vs-build.yml
sonic-otn Jan 17, 2024
0b5ee46
add ot_kvm onie and update platform configuration
sonic-otn Jan 25, 2024
bca0fc3
fix merge conflict
sonic-otn Jan 25, 2024
6f0cd69
Create sync_upstream_otn.yml
sonic-otn Jan 30, 2024
52d0ff3
Update sync_upstream_otn.yml
sonic-otn Jan 30, 2024
4aa15a1
Update sync_upstream_otn.yml
sonic-otn Jan 30, 2024
4251d2b
Update sync_upstream_otn.yml
sonic-otn Jan 31, 2024
970d527
Update sync_upstream_otn.yml
sonic-otn Jan 31, 2024
120450d
Update sync_upstream_otn.yml
sonic-otn Jan 31, 2024
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
36 changes: 36 additions & 0 deletions .github/workflows/sonic-otn-ot-pre-202411-vs-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: ot-pre-202411-vs-build

on:
push:
branches: [ "otn_pre_202411" ]
pull_request:
branches: [ "otn_pre_202411" ]
workflow_dispatch:

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: sonic-otn-server

steps:
- uses: actions/checkout@v3
with:
path: 202411_${{github.run_number}}

- name: build
run: |
cd 202411_${{github.run_number}}
make init
make configure PLATFORM=ot-vs
make target/sonic-ot-vs.img.gz

- name: 'Upload Artifact'
uses: actions/upload-artifact@v3
with:
name: otn-202411-artifact
path: |
202411_${{github.run_number}}/sonic-installer.img
202411_${{github.run_number}}/target/*.img.gz
8 changes: 7 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "sonic-swss-common"]
path = src/sonic-swss-common
url = https://github.com/sonic-otn/sonic-swss-common
url = https://github.com/Weitang-Zheng/sonic-swss-common
[submodule "sonic-linux-kernel"]
path = src/sonic-linux-kernel
url = https://github.com/sonic-net/sonic-linux-kernel
Expand Down Expand Up @@ -115,3 +115,9 @@
[submodule "src/sonic-dash-api/sonic-dash-api"]
path = src/sonic-dash-api/sonic-dash-api
url = https://github.com/sonic-net/sonic-dash-api.git
[submodule "src/sonic-otairedis"]
path = src/sonic-otairedis
url = https://github.com/Weitang-Zheng/sonic-otairedis.git
[submodule "src/sonic-otss"]
path = src/sonic-otss
url = https://github.com/Weitang-Zheng/sonic-otss.git
5 changes: 3 additions & 2 deletions Makefile
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all platforms (total 9) in sonic are under 'platform' directory. ot-platform folder diverges from existing directory structure? I don't see any technical reason for that.

Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ ifeq ($(NOBULLSEYE),0)
BUILD_BULLSEYE=1
endif

PLATFORM_PATH := platform/$(if $(PLATFORM),$(PLATFORM),$(CONFIGURED_PLATFORM))
PLATFORM_CHECKOUT := platform/checkout
PLATFORM_ROOT := $(if $(shell echo $(PLATFORM) | grep 'ot-'),ot-platform,platform)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

grep 'ot-' will pick up all the platform name include the substring "ot-", such as "slot-", "hot-"

PLATFORM_PATH := $(PLATFORM_ROOT)/$(if $(PLATFORM),$(PLATFORM),$(CONFIGURED_PLATFORM))
PLATFORM_CHECKOUT := $(PLATFORM_ROOT)/checkout
PLATFORM_CHECKOUT_FILE := $(PLATFORM_CHECKOUT)/$(PLATFORM).ini
PLATFORM_CHECKOUT_CMD := $(shell if [ -f $(PLATFORM_CHECKOUT_FILE) ]; then PLATFORM_PATH=$(PLATFORM_PATH) j2 $(PLATFORM_CHECKOUT)/template.j2 $(PLATFORM_CHECKOUT_FILE); fi)
MAKE_WITH_RETRY := ./scripts/run_with_retry $(MAKE)
Expand Down
6 changes: 6 additions & 0 deletions Makefile.work
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,13 @@ endif
rules/config.user:
$(Q)echo -n ""

#include different configurations based on target platform
ifneq ($(shell echo $(CONFIGURED_PLATFORM) | grep 'ot-'),)
include rules/config-ot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rule/config is meant for each vendor to edit to fit their device features. We can always add more nobs, No need to introduce a new file config-ot. I don't see rules/config-ot file in this PR.

else
include rules/config
endif

-include rules/config.user

ifneq ($(DEFAULT_CONTAINER_REGISTRY),)
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ The supported ASIC vendors are:
* PLATFORM=innovium
* PLATFORM=vs

The supported OTN vendors are:
* PLATFORM=ot-vs
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vs stands for virtual switch. suggest to use ot-kvm as platform name. see comments in onie.mk file on how to do it.


## Usage for ARM Architecture

ARM build has dependency in docker version 18.
Expand Down
21 changes: 15 additions & 6 deletions build_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ fi

IMAGE_VERSION="${SONIC_IMAGE_VERSION}"

if [[ $TARGET_MACHINE = ot-* ]]
then
DEVICE_ROOT=ot-device
PLATFORM_ROOT=ot-platform
else
DEVICE_ROOT=device
PLATFORM_ROOT=platform
fi

generate_kvm_image()
{
NUM_ASIC=$1
Expand Down Expand Up @@ -73,10 +82,10 @@ generate_onie_installer_image()
# Copy platform-specific ONIE installer config files where onie-mk-demo.sh expects them
rm -rf ./installer/platforms/
mkdir -p ./installer/platforms/
for VENDOR in `ls ./device`; do
for PLATFORM in `ls ./device/$VENDOR | grep ^${TARGET_PLATFORM}`; do
if [ -f ./device/$VENDOR/$PLATFORM/installer.conf ]; then
cp ./device/$VENDOR/$PLATFORM/installer.conf ./installer/platforms/$PLATFORM
for VENDOR in `ls ./$DEVICE_ROOT`; do
for PLATFORM in `ls ./$DEVICE_ROOT/$VENDOR | grep ^${TARGET_PLATFORM}`; do
if [ -f ./$DEVICE_ROOT/$VENDOR/$PLATFORM/installer.conf ]; then
cp ./$DEVICE_ROOT/$VENDOR/$PLATFORM/installer.conf ./installer/platforms/$PLATFORM
fi

done
Expand All @@ -85,7 +94,7 @@ generate_onie_installer_image()
## Generate an ONIE installer image
## Note: Don't leave blank between lines. It is single line command.
./onie-mk-demo.sh $CONFIGURED_ARCH $TARGET_MACHINE $TARGET_PLATFORM-$TARGET_MACHINE-$ONIEIMAGE_VERSION \
installer platform/$TARGET_MACHINE/platform.conf $output_file OS $IMAGE_VERSION $ONIE_IMAGE_PART_SIZE \
installer $PALTFORM_ROOT/$TARGET_MACHINE/platform.conf $output_file OS $IMAGE_VERSION $ONIE_IMAGE_PART_SIZE \
$ONIE_INSTALLER_PAYLOAD $SECURE_UPGRADE_SIGNING_CERT $SECURE_UPGRADE_DEV_SIGNING_KEY
}

Expand All @@ -97,7 +106,7 @@ generate_device_list()
# Create an empty function, and later append to it
echo -n > $platforms_asic

for d in `find -L ./device -maxdepth 2 -mindepth 2 -type d`; do
for d in `find -L ./$DEVICE_ROOT -maxdepth 2 -mindepth 2 -type d`; do
if [ -f $d/platform_asic ]; then
if [ "$TARGET_MACHINE" = "generic" ] || grep -Fxq "$TARGET_MACHINE" $d/platform_asic; then
echo "${d##*/}" >> "$platforms_asic";
Expand Down
11 changes: 11 additions & 0 deletions dockers/docker-ot-orchagent/Dockerfile.cleanup
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Base docker build
FROM docker-ot-orchagent-sonic:latest

# Copy the cache data to host
From scratch as output
COPY --from=docker-ot-orchagent-sonic:latest /cache.tgz cache.tgz

# Clean up the cache data
FROM docker-ot-orchagent-sonic:latest as final
RUN rm /cache.tgz

70 changes: 70 additions & 0 deletions dockers/docker-ot-orchagent/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %}
FROM docker-config-engine-bullseye

ARG docker_container_name

# Make apt-get non-interactive
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
apt-get install -f -y \
# Needed for installing netifaces Python package
build-essential \
python3-dev

{% if ( CONFIGURED_ARCH == "armhf" or CONFIGURED_ARCH == "arm64" ) %}
# Fix for gcc/python/iputils-ping not found in arm docker
RUN apt-get install -y \
gcc
{% endif %}

{% if ( CONFIGURED_ARCH == "armhf" or CONFIGURED_ARCH == "arm64" ) %}
# Remove installed gcc
RUN apt-get remove -y gcc
{% endif %}

{% if docker_ot_orchagent_debs.strip() -%}
# Copy locally-built Debian package dependencies
{{ copy_files("debs/", docker_ot_orchagent_debs.split(' '), "/debs/") }}

# Install locally-built Debian packages and implicitly install their dependencies
{{ install_debian_packages(docker_ot_orchagent_debs.split(' ')) }}
{%- endif %}

{% if docker_ot_orchagent_whls.strip() -%}
# Copy locally-built Python wheel dependencies
{{ copy_files("python-wheels/", docker_ot_orchagent_whls.split(' '), "/python-wheels/") }}

# Install locally-built Python wheel dependencies
{{ install_python_wheels(docker_ot_orchagent_whls.split(' ')) }}
{% endif %}

# Clean up
RUN apt-get purge -y \
build-essential \
python3-dev && \
apt-get clean -y && \
apt-get autoclean -y && \
apt-get autoremove -y && \
rm -rf /debs ~/.cache

COPY ["files/supervisor-proc-exit-listener", "/usr/bin"]
COPY ["orchagent.sh", "/usr/bin/"]

# Copy all Jinja2 template files into the templates folder
COPY ["*.j2", "/usr/share/sonic/templates/"]

# Copy all regex json files and rsyslog_plugin.conf to rsyslog.d
COPY ["*.json", "/etc/rsyslog.d/"]
COPY ["files/rsyslog_plugin.conf.j2", "/etc/rsyslog.d/"]

RUN sonic-cfggen -t /usr/share/sonic/templates/docker-init.j2 > /usr/bin/docker-init.sh
RUN rm -f /usr/share/sonic/templates/docker-init.j2
RUN chmod 755 /usr/bin/docker-init.sh

# Create swss rsyslog_plugin conf file
RUN j2 -f json /etc/rsyslog.d/rsyslog_plugin.conf.j2 /etc/rsyslog.d/events_info.json > /etc/rsyslog.d/swss_events.conf
RUN rm -f /etc/rsyslog.d/rsyslog_plugin.conf.j2
RUN rm -f /etc/rsyslog.d/events_info.json

ENTRYPOINT ["/usr/bin/docker-init.sh"]
44 changes: 44 additions & 0 deletions dockers/docker-ot-orchagent/base_image_files/swssloglevel
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

# read SONiC immutable variables
[ -f /etc/sonic/sonic-environment ] && . /etc/sonic/sonic-environment

function help()
{
echo -e "Usage: $0 -n [0 to $(($NUM_ASIC-1))] [OPTION]... " 1>&2; exit 1;
}

DOCKER_EXEC_FLAGS="i"

# Determine whether stdout is on a terminal
if [ -t 1 ] ; then
DOCKER_EXEC_FLAGS+="t"
fi

DEV=""
PLATFORM=${PLATFORM:-`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform`}

# Parse the device specific asic conf file, if it exists
ASIC_CONF=/usr/share/sonic/device/$PLATFORM/asic.conf
[ -f $ASIC_CONF ] && . $ASIC_CONF

if [[ ($NUM_ASIC -gt 1) ]]; then
while getopts ":n:h:" opt; do
case "${opt}" in
h) help
;;
n) DEV=${OPTARG}
[ $DEV -lt $NUM_ASIC -a $DEV -ge 0 ] || help
;;
esac
done

if [ -z "${DEV}" ]; then
help
fi

# Skip the arguments -n <inst> while passing to docker command
shift 2
fi

docker exec -$DOCKER_EXEC_FLAGS swss$DEV swssloglevel "$@"
18 changes: 18 additions & 0 deletions dockers/docker-ot-orchagent/buffermgrd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

BUFFER_CALCULATION_MODE=$(redis-cli -n 4 hget "DEVICE_METADATA|localhost" buffer_model)

if [ "$BUFFER_CALCULATION_MODE" == "dynamic" ]; then
BUFFERMGRD_ARGS="-a /etc/sonic/asic_table.json"
if [ -f /etc/sonic/peripheral_table.json ]; then
BUFFERMGRD_PERIPHERIAL_ARGS=" -p /etc/sonic/peripheral_table.json"
fi
if [ -f /etc/sonic/zero_profiles.json ]; then
BUFFERMGRD_ZERO_PROFILE_ARGS=" -z /etc/sonic/zero_profiles.json"
fi
else
# Should we use the fallback MAC in case it is not found in Device.Metadata
BUFFERMGRD_ARGS="-l /usr/share/sonic/hwsku/pg_profile_lookup.ini"
fi

exec /usr/bin/buffermgrd ${BUFFERMGRD_ARGS} ${BUFFERMGRD_PERIPHERIAL_ARGS} ${BUFFERMGRD_ZERO_PROFILE_ARGS}
3 changes: 3 additions & 0 deletions dockers/docker-ot-orchagent/critical_processes.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
program:orchagent
program:linecardmgrd
program:configsyncd
32 changes: 32 additions & 0 deletions dockers/docker-ot-orchagent/docker-init.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

mkdir -p /etc/swss/config.d/
mkdir -p /etc/supervisor/
mkdir -p /etc/supervisor/conf.d/


CFGGEN_PARAMS=" \
-d \
-y /etc/sonic/constants.yml \
-t /usr/share/sonic/templates/critical_processes.j2,/etc/supervisor/critical_processes \
-t /usr/share/sonic/templates/watchdog_processes.j2,/etc/supervisor/watchdog_processes \
-t /usr/share/sonic/templates/supervisord.conf.j2,/etc/supervisor/conf.d/supervisord.conf
"

sonic-cfggen $CFGGEN_PARAMS

# Executed platform specific initialization tasks.
if [ -x /usr/share/sonic/platform/platform-init ]; then
/usr/share/sonic/platform/platform-init
fi

# Executed HWSKU specific initialization tasks.
if [ -x /usr/share/sonic/hwsku/hwsku-init ]; then
/usr/share/sonic/hwsku/hwsku-init
fi

TZ=$(cat /etc/timezone)
rm -rf /etc/localtime
ln -sf /usr/share/zoneinfo/$TZ /etc/localtime

exec /usr/local/bin/supervisord
9 changes: 9 additions & 0 deletions dockers/docker-ot-orchagent/events_info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"yang_module": "sonic-events-swss",
"proclist": [
{
"name": "swss",
"parse_json": "swss_regex.json"
}
]
}
50 changes: 50 additions & 0 deletions dockers/docker-ot-orchagent/orchagent.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env bash

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')

# Create a folder for SwSS record files
mkdir -p /var/log/swss
ORCHAGENT_ARGS="-d /var/log/swss "

# Set orchagent pop batch size to 8192
ORCHAGENT_ARGS+="-b 8192 "

# Set synchronous mode if it is enabled in CONFIG_DB
SYNC_MODE=$(echo $SWSS_VARS | jq -r '.synchronous_mode')
if [ "$SYNC_MODE" == "enable" ]; then
ORCHAGENT_ARGS+="-s "
fi

# Check if there is an "asic_id field" in the DEVICE_METADATA in configDB.
#"DEVICE_METADATA": {
# "localhost": {
# ....
# "asic_id": "0",
# }
#},
# ID field could be integers just to denote the asic instance like 0,1,2...
# OR could be PCI device ID's which will be strings like "03:00.0"
# depending on what the SAI/SDK expects.
asic_id=$(echo $SWSS_VARS | jq -r '.asic_id')
if [ -n "$asic_id" ]
then
ORCHAGENT_ARGS+="-i $asic_id "
fi

# for multi asic platforms add the asic name to the record file names
if [[ "$NAMESPACE_ID" ]]; then
ORCHAGENT_ARGS+="-f swss.asic$NAMESPACE_ID.rec -j otairedis.asic$NAMESPACE_ID.rec "
fi

hwsku=`sonic-cfggen -d -v "DEVICE_METADATA['localhost']['hwsku']"`
if [ -n "$hwsku" ]
then
ORCHAGENT_ARGS+="-c /etc/sonic/linecards/$hwsku/flexcounter.json "
fi

exec /usr/bin/orchagent ${ORCHAGENT_ARGS}
Loading