Skip to content

Commit

Permalink
Merge branch 'opencomputeproject:main' into pr_phase3_create_remove
Browse files Browse the repository at this point in the history
  • Loading branch information
selldinesh authored Oct 3, 2023
2 parents 18c36c4 + 9fbc878 commit 29b1508
Show file tree
Hide file tree
Showing 34 changed files with 2,009 additions and 216 deletions.
58 changes: 37 additions & 21 deletions .github/workflows/sc-client-server-deb10.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
paths:
- '.github/workflows/sc-client-server-deb10.yml'
- 'dockerfiles/buster/Dockerfile.client'
- 'dockerfiles/buster/Dockerfile.saithrift-client'
- 'dockerfiles/buster/Dockerfile.server'
- 'npu/broadcom/BCM56850/saivs/Dockerfile.server'
- 'common/**'
Expand All @@ -23,11 +22,14 @@ on:
- 'sai.env'

env:
DOCKER_BASE: 'dockerfiles/buster/Dockerfile'
DOCKER_REDIS: 'npu/broadcom/BCM56850/saivs/Dockerfile'
DOCKER_THRIFT: 'npu/broadcom/BCM56850/saivs/Dockerfile.saithrift'
REDIS_RPC: 0
THRIFT_RPC: 0
DOCKER_CLIENT: 'dockerfiles/buster/Dockerfile.client'
DOCKER_SERVER_BASE: 'dockerfiles/buster/Dockerfile.server'
DOCKER_SERVER: 'npu/broadcom/BCM56850/saivs/Dockerfile.server'
DOCKER_THRIFT_SERVER: 'dockerfiles/buster/Dockerfile.saithrift-server'
REDIS_CLIENT: 0
REDIS_SERVER: 0
THRIFT_SERVER: 0


jobs:
build-sc-server:
Expand All @@ -43,23 +45,30 @@ jobs:
- name: Check what files were updated
id: check_changes
run: |
echo 'changed_files=$(git diff --name-only origin/HEAD | xargs)' >> $GITHUB_OUTPUT
echo 'changed_files<<EOF' >> $GITHUB_OUTPUT
echo "$(git diff --name-only HEAD~1)" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: Check what Docker images have to be rebuild
run: |
for file in "$DOCKER_BASE" "$DOCKER_REDIS" "sai.env"; do
for file in "$DOCKER_SERVER_BASE" "$DOCKER_SERVER" "sai.env"; do
if [[ "${{ steps.check_changes.outputs.changed_files }}" == *"$file"* ]]; then
echo "REDIS_SERVER=1" >> $GITHUB_ENV
fi
done
for file in "$DOCKER_THRIFT_SERVER" "sai.env"; do
if [[ "${{ steps.check_changes.outputs.changed_files }}" == *"$file"* ]]; then
echo "REDIS_RPC=1" >> $GITHUB_ENV
echo "THRIFT_SERVER=1" >> $GITHUB_ENV
fi
done
- name: Build server Docker image
run: ./build.sh -i server -o deb10
if: ${{ env.REDIS_RPC == '1' }}
if: ${{ env.REDIS_SERVER == '1' }}

- name: Pull SAI-C server
run: ./run.sh -i server -o deb10
if: ${{ env.REDIS_RPC == '0' }}
if: ${{ env.REDIS_SERVER == '0' }}

- name: Save server Docker image
run: docker save sc-server-trident2-saivs > sc-server.tar
Expand All @@ -68,6 +77,10 @@ jobs:
with:
name: Server Image
path: sc-server.tar

- name: Build Thrift server Docker image
run: ./build.sh -i server -o deb10 -s thrift
if: ${{ env.THRIFT_SERVER == '1' }}

build-sc-client:
name: Build SAI Challenger client image
Expand All @@ -82,24 +95,25 @@ jobs:
- name: Check what files were updated
id: check_changes
run: |
echo 'changed_files=$(git diff --name-only origin/HEAD | xargs)' >> $GITHUB_OUTPUT
echo 'changed_files<<EOF' >> $GITHUB_OUTPUT
echo "$(git diff --name-only HEAD~1)" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: Check what Docker images have to be rebuild
run: |
changed_files=$(git diff --name-only origin/HEAD | xargs)
for file in "$DOCKER_BASE" "$DOCKER_REDIS" "sai.env"; do
if [[ "$changed_files" == *"$file"* ]]; then
echo "REDIS_RPC=1"
for file in "$DOCKER_CLIENT" "sai.env"; do
if [[ "${{ steps.check_changes.outputs.changed_files }}" == *"$file"* ]]; then
echo "REDIS_CLIENT=1" >> $GITHUB_ENV
fi
done
- name: Build client Docker image
run: ./build.sh -i client -o deb10 --nosnappi
if: ${{ env.REDIS_RPC == '1' }}
if: ${{ env.REDIS_CLIENT == '1' }}

- name: Pull SAI-C client
run: ./run.sh -i client -o deb10
if: ${{ env.REDIS_RPC == '0' }}
if: ${{ env.REDIS_CLIENT == '0' }}

- name: Save client Docker image
run: docker save sc-client > sc-client.tar
Expand Down Expand Up @@ -147,17 +161,19 @@ jobs:
run: ./run.sh -i server -o deb10
- name: Update SAI-C server package
run: ./exec.sh -i server --no-tty pip3 install /sai-challenger/common /sai-challenger
if: ${{ env.REDIS_RPC == '0' }}
if: ${{ env.REDIS_SERVER == '0' }}
- name: Update SAI-C client package
run: ./exec.sh -i client --no-tty pip3 install /sai-challenger/common /sai-challenger
if: ${{ env.REDIS_RPC == '0' }}
if: ${{ env.REDIS_CLIENT == '0' }}
- name: Create veth links between client and server dockers
run: sudo ./veth-create-host.sh sc-server-trident2-saivs-run sc-client-run

- name: Run functional test cases
run: ./exec.sh --no-tty -i client pytest --testbed=saivs_client_server -v -k "test_l2_basic"
- name: Run unit tests
run: ./exec.sh --no-tty -i client pytest --testbed=saivs_client_server -v ut/test_acl_ut.py ut/test_bridge_ut.py ut/test_vrf_ut.py ut/test_port_ut.py ut/test_fdb_ut.py ut/test_lag_ut.py
- name: Run unit tests
run: ./exec.sh --no-tty -i client pytest --testbed=saivs_client_server -v -k \
"test_acl_ut or test_bridge_ut or (test_switch_ut and not sai_map_list_t) or test_vrf_ut or test_port_ut.py"
"test_switch_ut and not sai_map_list_t"
- name: Run thift data-driven tests
run: ./exec.sh --no-tty -i client pytest --testbed=saivs_client_server -v test_l2_basic_dd.py
54 changes: 35 additions & 19 deletions .github/workflows/sc-client-server-deb11.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
paths:
- '.github/workflows/sc-client-server-deb11.yml'
- 'dockerfiles/bullseye/Dockerfile.client'
- 'dockerfiles/bullseye/Dockerfile.saithrift-client'
- 'dockerfiles/bullseye/Dockerfile.server'
- 'npu/broadcom/BCM56850/saivs/Dockerfile.server'
- 'common/**'
Expand All @@ -23,11 +22,13 @@ on:
- 'sai.env'

env:
DOCKER_BASE: 'dockerfiles/bullseye/Dockerfile'
DOCKER_REDIS: 'npu/broadcom/BCM56850/saivs/Dockerfile'
DOCKER_THRIFT: 'npu/broadcom/BCM56850/saivs/Dockerfile.saithrift'
REDIS_RPC: 0
THRIFT_RPC: 0
DOCKER_CLIENT: 'dockerfiles/bullseye/Dockerfile.client'
DOCKER_SERVER_BASE: 'dockerfiles/bullseye/Dockerfile.server'
DOCKER_SERVER: 'npu/broadcom/BCM56850/saivs/Dockerfile.server'
DOCKER_THRIFT_SERVER: 'dockerfiles/buster/Dockerfile.saithrift-server'
REDIS_CLIENT: 0
REDIS_SERVER: 0
THRIFT_SERVER: 0

jobs:
build-sc-server:
Expand All @@ -43,23 +44,30 @@ jobs:
- name: Check what files were updated
id: check_changes
run: |
echo 'changed_files=$(git diff --name-only origin/HEAD | xargs)' >> $GITHUB_OUTPUT
echo 'changed_files<<EOF' >> $GITHUB_OUTPUT
echo "$(git diff --name-only HEAD~1)" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: Check what Docker images have to be rebuild
run: |
for file in "$DOCKER_BASE" "$DOCKER_REDIS" "sai.env"; do
for file in "$DOCKER_SERVER_BASE" "$DOCKER_SERVER" "sai.env"; do
if [[ "${{ steps.check_changes.outputs.changed_files }}" == *"$file"* ]]; then
echo "REDIS_RPC=1" >> $GITHUB_ENV
echo "REDIS_SERVER=1" >> $GITHUB_ENV
fi
done
for file in "$DOCKER_THRIFT_SERVER" "sai.env"; do
if [[ "${{ steps.check_changes.outputs.changed_files }}" == *"$file"* ]]; then
echo "THRIFT_SERVER=1" >> $GITHUB_ENV
fi
done
- name: Build server Docker image
run: ./build.sh -i server -o deb11
if: ${{ env.REDIS_RPC == '1' }}
if: ${{ env.REDIS_SERVER == '1' }}

- name: Pull SAI-C server
run: ./run.sh -i server -o deb11
if: ${{ env.REDIS_RPC == '0' }}
if: ${{ env.REDIS_SERVER == '0' }}

- name: Save server Docker image
run: docker save sc-server-trident2-saivs > sc-server.tar
Expand All @@ -69,6 +77,10 @@ jobs:
name: Server Image
path: sc-server.tar

- name: Build Thrift server Docker image
run: ./build.sh -i server -o deb11 -s thrift
if: ${{ env.THRIFT_SERVER == '1' }}

build-sc-client:
name: Build SAI Challenger client image
runs-on: ubuntu-20.04
Expand All @@ -82,23 +94,25 @@ jobs:
- name: Check what files were updated
id: check_changes
run: |
echo 'changed_files=$(git diff --name-only origin/HEAD | xargs)' >> $GITHUB_OUTPUT
echo 'changed_files<<EOF' >> $GITHUB_OUTPUT
echo "$(git diff --name-only HEAD~1)" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: Check what Docker images have to be rebuild
run: |
for file in "$DOCKER_BASE" "$DOCKER_REDIS" "sai.env"; do
for file in "$DOCKER_CLIENT" "sai.env"; do
if [[ "${{ steps.check_changes.outputs.changed_files }}" == *"$file"* ]]; then
echo "REDIS_RPC=1" >> $GITHUB_ENV
echo "REDIS_CLIENT=1" >> $GITHUB_ENV
fi
done
- name: Build client Docker image
run: ./build.sh -i client -o deb11 --nosnappi
if: ${{ env.REDIS_RPC == '1' }}
if: ${{ env.REDIS_CLIENT == '1' }}

- name: Pull SAI-C client
run: ./run.sh -i client -o deb11
if: ${{ env.REDIS_RPC == '0' }}
if: ${{ env.REDIS_CLIENT == '0' }}

- name: Save client Docker image
run: docker save sc-client > sc-client.tar
Expand Down Expand Up @@ -146,17 +160,19 @@ jobs:
run: ./run.sh -i server -o deb11
- name: Update SAI-C server package
run: ./exec.sh -i server --no-tty pip3 install /sai-challenger/common /sai-challenger
if: ${{ env.REDIS_RPC == '0' }}
if: ${{ env.REDIS_SERVER == '0' }}
- name: Update SAI-C client package
run: ./exec.sh -i client --no-tty pip3 install /sai-challenger/common /sai-challenger
if: ${{ env.REDIS_RPC == '0' }}
if: ${{ env.REDIS_CLIENT == '0' }}
- name: Create veth links between client and server dockers
run: sudo ./veth-create-host.sh sc-server-trident2-saivs-run sc-client-run

- name: Run functional test cases
run: ./exec.sh --no-tty -i client pytest --testbed=saivs_client_server -v -k "test_l2_basic"
- name: Run unit tests
run: ./exec.sh --no-tty -i client pytest --testbed=saivs_client_server -v ut/test_acl_ut.py ut/test_bridge_ut.py ut/test_vrf_ut.py ut/test_port_ut.py ut/test_fdb_ut.py ut/test_lag_ut.py
- name: Run unit tests
run: ./exec.sh --no-tty -i client pytest --testbed=saivs_client_server -v -k \
"test_acl_ut or test_bridge_ut or (test_switch_ut and not sai_map_list_t) or test_vrf_ut or test_port_ut.py"
"test_switch_ut and not sai_map_list_t"
- name: Run thift data-driven tests
run: ./exec.sh --no-tty -i client pytest --testbed=saivs_client_server -v test_l2_basic_dd.py
19 changes: 15 additions & 4 deletions .github/workflows/sc-standalone-deb10.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ jobs:
- name: Check what files were updated
id: check_changes
run: |
echo 'changed_files=$(git diff --name-only origin/HEAD | xargs)' >> $GITHUB_OUTPUT
echo 'changed_files<<EOF' >> $GITHUB_OUTPUT
echo "$(git diff --name-only HEAD~1)" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: Check what Docker images have to be rebuild
run: |
Expand Down Expand Up @@ -72,8 +74,9 @@ jobs:
- name: Run sairedis tests
run: ./exec.sh --no-tty pytest --testbed=saivs_standalone -v -k "test_sairec"
- name: Run unit tests
run: ./exec.sh --no-tty pytest --testbed=saivs_standalone -v -k \
"test_acl_ut or test_bridge_ut or (test_switch_ut and not sai_map_list_t) or test_vrf_ut or test_port_ut.py"
run: ./exec.sh --no-tty pytest --testbed=saivs_standalone -v ut/test_acl_ut.py ut/test_bridge_ut.py ut/test_vrf_ut.py ut/test_port_ut.py ut/test_fdb_ut.py ut/test_lag_ut.py
- name: Run unit tests
run: ./exec.sh --no-tty pytest --testbed=saivs_standalone -v -k "test_switch_ut and not sai_map_list_t"
- name: Run data-driven tests
run: ./exec.sh --no-tty pytest --testbed=saivs_standalone -v test_l2_basic_dd.py
- name: Run API tests
Expand All @@ -94,6 +97,14 @@ jobs:
- name: Run thift data-driven tests
run: ./exec.sh --no-tty -s thrift pytest --testbed=saivs_thrift_standalone -v test_l2_basic_dd.py
- name: Run thrift unit tests
run: ./exec.sh --no-tty -s thrift pytest --testbed=saivs_thrift_standalone -v ut/test_vrf_ut.py ut/test_bridge_ut.py ut/test_acl_ut.py
run: ./exec.sh --no-tty -s thrift pytest --testbed=saivs_thrift_standalone -v ut/test_vrf_ut.py ut/test_bridge_ut.py ut/test_acl_ut.py ut/test_fdb_ut.py ut/test_lag_ut.py
- name: Run thrift unit tests
run: ./exec.sh --no-tty -s thrift pytest --testbed=saivs_thrift_standalone -v -k \
"(test_switch_ut and not sai_map_list_t and not sai_system_port_config_list_t) or (test_port_ut and not sai_map_list_t)"
- name: Run thrift sairedis tests
run: ./exec.sh --no-tty -s thrift pytest --testbed=saivs_thrift_standalone -v -k "test_sairec"
- name: Run thrift API tests
run: ./exec.sh --no-tty -s thrift pytest --testbed=saivs_thrift_standalone -v -k "api/test"

- name: Run PTF tests
run: ./exec.sh --no-tty -s thrift pytest --testbed=saivs_thrift_standalone -v ../usecases/sai-ptf/SAI/ptf/saifdb.py -k FdbAttributeTest
19 changes: 15 additions & 4 deletions .github/workflows/sc-standalone-deb11.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ jobs:
- name: Check what files were updated
id: check_changes
run: |
echo 'changed_files=$(git diff --name-only origin/HEAD | xargs)' >> $GITHUB_OUTPUT
echo 'changed_files<<EOF' >> $GITHUB_OUTPUT
echo "$(git diff --name-only HEAD~1)" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: Check what Docker images have to be rebuild
run: |
Expand Down Expand Up @@ -72,8 +74,9 @@ jobs:
- name: Run sairedis tests
run: ./exec.sh --no-tty pytest --testbed=saivs_standalone -v -k "test_sairec"
- name: Run unit tests
run: ./exec.sh --no-tty pytest --testbed=saivs_standalone -v -k \
"test_acl_ut or test_bridge_ut or (test_switch_ut and not sai_map_list_t) or test_vrf_ut or test_port_ut.py"
run: ./exec.sh --no-tty pytest --testbed=saivs_standalone -v ut/test_acl_ut.py ut/test_bridge_ut.py ut/test_vrf_ut.py ut/test_port_ut.py ut/test_fdb_ut.py ut/test_lag_ut.py
- name: Run unit tests
run: ./exec.sh --no-tty pytest --testbed=saivs_standalone -v -k "test_switch_ut and not sai_map_list_t"
- name: Run data-driven tests
run: ./exec.sh --no-tty pytest --testbed=saivs_standalone -v test_l2_basic_dd.py
- name: Run API tests
Expand All @@ -94,6 +97,14 @@ jobs:
- name: Run thift data-driven tests
run: ./exec.sh --no-tty -s thrift pytest --testbed=saivs_thrift_standalone -v test_l2_basic_dd.py
- name: Run thrift unit tests
run: ./exec.sh --no-tty -s thrift pytest --testbed=saivs_thrift_standalone -v ut/test_vrf_ut.py ut/test_bridge_ut.py ut/test_acl_ut.py
run: ./exec.sh --no-tty -s thrift pytest --testbed=saivs_thrift_standalone -v ut/test_vrf_ut.py ut/test_bridge_ut.py ut/test_acl_ut.py ut/test_fdb_ut.py ut/test_lag_ut.py
- name: Run thrift unit tests
run: ./exec.sh --no-tty -s thrift pytest --testbed=saivs_thrift_standalone -v -k \
"(test_switch_ut and not sai_map_list_t and not sai_system_port_config_list_t) or (test_port_ut and not sai_map_list_t)"
- name: Run thrift sairedis tests
run: ./exec.sh --no-tty -s thrift pytest --testbed=saivs_thrift_standalone -v -k "test_sairec"
- name: Run thrift API tests
run: ./exec.sh --no-tty -s thrift pytest --testbed=saivs_thrift_standalone -v -k "api/test"

- name: Run PTF tests
run: ./exec.sh --no-tty -s thrift pytest --testbed=saivs_thrift_standalone -v ../usecases/sai-ptf/SAI/ptf/saifdb.py -k FdbAttributeTest
13 changes: 11 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,18 @@ if [ "${IMAGE_TYPE}" = "standalone" ]; then
elif [ "${IMAGE_TYPE}" = "server" ]; then
find ${ASIC_PATH}/../ -type f -name \*.py -exec install -D {} .build/{} \;
find ${ASIC_PATH}/../ -type f -name \*.json -exec install -D {} .build/{} \;
docker build -f dockerfiles/${BASE_OS}/Dockerfile.server -t sc-server-base:${BASE_OS} .
if [ "${SAI_INTERFACE}" = "thrift" ]; then
docker build -f dockerfiles/${BASE_OS}/Dockerfile.saithrift-server -t sc-thrift-server-base:${BASE_OS} .
else
docker build -f dockerfiles/${BASE_OS}/Dockerfile.server -t sc-server-base:${BASE_OS} .
fi
rm -rf .build/
else
docker build -f dockerfiles/${BASE_OS}/Dockerfile.client --build-arg NOSNAPPI=${NOSNAPPI} -t sc-client:${BASE_OS} .
if [ "${SAI_INTERFACE}" = "thrift" ]; then
docker build -f dockerfiles/${BASE_OS}/Dockerfile.saithrift-client -t sc-thrift-client:${BASE_OS} .
fi
exit 0
fi

# Build target Docker image
Expand All @@ -168,6 +173,10 @@ if [ "${IMAGE_TYPE}" = "standalone" ]; then
docker build -f Dockerfile --build-arg BASE_OS=${BASE_OS} -t sc-${IMG_NAME}:${BASE_OS} .
fi
elif [ "${IMAGE_TYPE}" = "server" ]; then
docker build -f Dockerfile.server --build-arg BASE_OS=${BASE_OS} -t sc-server-${IMG_NAME}:${BASE_OS} .
if [ "${SAI_INTERFACE}" = "thrift" ]; then
docker build -f Dockerfile.saithrift-server --build-arg BASE_OS=${BASE_OS} -t sc-thrift-server-${IMG_NAME}:${BASE_OS} .
else
docker build -f Dockerfile.server --build-arg BASE_OS=${BASE_OS} -t sc-server-${IMG_NAME}:${BASE_OS} .
fi
fi
popd
Loading

0 comments on commit 29b1508

Please sign in to comment.