Skip to content

Commit

Permalink
Merge branch 'Azure:main' into pr-baby-hero-test1
Browse files Browse the repository at this point in the history
  • Loading branch information
desaimg1 authored Jan 10, 2023
2 parents 138c8f4 + 5d8744c commit a95638a
Show file tree
Hide file tree
Showing 27 changed files with 1,592 additions and 125 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
[submodule "test/SAI-Challenger"]
path = test/SAI-Challenger
url = https://github.com/opencomputeproject/SAI-Challenger
branch = multiple-api-support
branch = main
1 change: 1 addition & 0 deletions .wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,7 @@ Unpair
untracked
upcasting
upstreaming
utils
vcpus
veth
VFP
Expand Down
30 changes: 20 additions & 10 deletions dash-pipeline/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ run-saithrift-ptftests: disable-ipv6
$(DOCKER_RUN_SAITHRIFT_CLIENT) \
-w /tests/ \
$(DOCKER_SAITHRIFT_CLIENT_IMG) \
./run-functional-tests.sh
./functional/ptf/run-tests.sh

# Run "dev" PTF tests mounted from host
# Note - if add ixia-c usage to PTF tests, add dependency deploy-ixiac
Expand All @@ -438,7 +438,7 @@ run-saithrift-dev-ptftests: disable-ipv6
-v $(PWD)/../test/test-cases/:/tests-dev/ \
-w /tests-dev/ \
$(DOCKER_SAITHRIFT_CLIENT_IMG) \
./run-functional-tests.sh
./functional/ptf/run-tests.sh

run-saithrift-client-bash:
$(DOCKER_RUN_SAITHRIFT_CLIENT) \
Expand Down Expand Up @@ -584,15 +584,15 @@ SAI_CHALLENGER_SETUP_FILE := sai_dpu_client_server_snappi.json
endif
# If test's name isn't passed, set it to the default.
ifeq ($(SAI_CHALLENGER_TEST),)
SAI_CHALLENGER_TEST := test_sai_vnet_*.py
SAI_CHALLENGER_TEST := .
endif

DOCKER_SAI_CHALLENGER_CLIENT_BLDR_IMG_TAG = $(shell cat dockerfiles/Dockerfile.saichallenger-client-bldr | sha1sum | awk '{print substr($$1,0,11);}')
DOCKER_SAI_CHALLENGER_CLIENT_BLDR_IMG = $(DOCKER_SAI_CHALLENGER_CLIENT_BLDR_IMG_NAME):$(DOCKER_SAI_CHALLENGER_CLIENT_BLDR_IMG_TAG)

docker-saichallenger-client-bldr:
{ [ x$(ENABLE_DOCKER_PULL) == xy ] && docker pull $(DOCKER_SAI_CHALLENGER_CLIENT_BLDR_IMG); } || \
{ pushd $(SAI_CHALLENGER_PATH) && ./build.sh -i client && popd; \
{ pushd $(SAI_CHALLENGER_PATH) && git submodule update --init && ./build.sh -i client && popd; \
docker build \
-f dockerfiles/Dockerfile.saichallenger-client-bldr \
-t $(DOCKER_SAI_CHALLENGER_CLIENT_BLDR_IMG) \
Expand All @@ -609,16 +609,17 @@ docker-publish-saichallenger-client-bldr:
docker-pull-saichallenger-client-bldr:
docker pull $(DOCKER_SAI_CHALLENGER_CLIENT_BLDR_IMG)

docker-saichallenger-client:
cd $(SAI_CHALLENGER_PATH) && ./build.sh -i client
docker-saichallenger-client: docker-saichallenger-client-bldr
docker build \
-f dockerfiles/Dockerfile.saichallenger-client \
-t $(DOCKER_SAI_CHALLENGER_CLIENT_IMG) \
.

DOCKER_RUN_SAI_CHALLENGER_CLIENT=docker run \
-v $(SAI_CHALLENGER_PATH):/sai-challenger \
-v $(SAI_CHALLENGER_PATH)/../test-cases/scale/saic/:/sai-challenger/dash_tests \
-v $(SAI_CHALLENGER_PATH)/../test-cases/scale/saic/:/sai-challenger/dash_tests/scale \
-v $(SAI_CHALLENGER_PATH)/../test-cases/functional/saic/:/sai-challenger/dash_tests/functional \
-v $(SAI_CHALLENGER_PATH)/../test-cases/utils/:/sai-challenger/dash_tests/utils \
-v $(PWD)/../:/dash \
--cap-add=NET_ADMIN \
--device /dev/net/tun:/dev/net/tun \
Expand All @@ -642,12 +643,21 @@ run-saichallenger-client-bash: deploy-ixiac
kill-saichallenger-client:
-docker kill $(CONTAINER_SAI_CHALLENGER_CLIENT_NAME)

run-saichallenger-tests: deploy-ixiac
run-saichallenger-tests: run-saichallenger-functional-tests run-saichallenger-scale-tests

run-saichallenger-functional-tests: deploy-ixiac
$(DOCKER_RUN_SAI_CHALLENGER_CLIENT) \
-w /sai-challenger/dash_tests \
-w /sai-challenger/dash_tests/functional \
$(DOCKER_FLAGS) \
$(DOCKER_SAI_CHALLENGER_CLIENT_IMG) \
./run-tests.sh --setup=$(SAI_CHALLENGER_SETUP_FILE) $(SAI_CHALLENGER_TEST)

run-saichallenger-scale-tests: deploy-ixiac
$(DOCKER_RUN_SAI_CHALLENGER_CLIENT) \
-w /sai-challenger/dash_tests/scale \
$(DOCKER_FLAGS) \
$(DOCKER_SAI_CHALLENGER_CLIENT_IMG) \
./run_vnet_tests.sh --setup=$(SAI_CHALLENGER_SETUP_FILE) $(SAI_CHALLENGER_TEST)
./run-tests.sh --setup=$(SAI_CHALLENGER_SETUP_FILE) $(SAI_CHALLENGER_TEST)

###############################
# ENVIRONMENT SETUP TARGETS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Changing this will cause build/publish to occur in CI actions
export DASH_ACR_REGISTRY=sonicdash.azurecr.io
export DOCKER_SAI_CHALLENGER_CLIENT_BLDR_IMG_NAME=${DASH_ACR_REGISTRY}/dash-saichallenger-client-bldr
export DOCKER_SAI_CHALLENGER_CLIENT_BLDR_IMG_CTAG?=221209
export DOCKER_SAI_CHALLENGER_CLIENT_BLDR_IMG_CTAG?=221228
3 changes: 1 addition & 2 deletions dash-pipeline/dockerfiles/Dockerfile.saichallenger-client
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM sonicdash.azurecr.io/dash-saichallenger-client-bldr:221109
FROM sonicdash.azurecr.io/dash-saichallenger-client-bldr:221228

ENV SAI_CHALLENGER_PATH /sai-challenger
ENV DASH_PATH /dash
Expand All @@ -20,7 +20,6 @@ RUN cd /saithrift-0.9 && \
rm -rf thrift-0.11.0 && \
cd /SAI/test/ptf && \
python3 setup.py install && \
ln -s ${SAI_CHALLENGER_PATH} /usr/local/lib/python3.7/dist-packages/saichallenger && \
ln -s ${DASH_PATH}/test/test-cases/scale/saic ${SAI_CHALLENGER_PATH}/dash_tests

CMD ["/usr/bin/supervisord"]
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Requires <url of sai-challenger branch> <commit sha> or something
FROM sc-client

ADD tests/ /tests/
Expand Down
2 changes: 1 addition & 1 deletion test/SAI-Challenger
Submodule SAI-Challenger updated 111 files
4 changes: 2 additions & 2 deletions test/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
| [High-Level Description (HLD) Test Specification](dash-test-HLD.md) | High-level design for the testing of devices which conform to the SONiC-DASH requirements.|
| [Dash Test Maturity Stages](dash-test-maturity-stages.md) | Describes a progressive approach to DASH testing.|
| [DASH SAI-Thrift Test Workflow](dash-test-workflow-saithrift.md) | DASH test workflow with SAI-thrift. |
| [SAI PTF Design](https://github.com/reshmaintel/SAI/blob/dash-ptf/doc/SAI-Proposal-SAI-PTF.md) | SAI Thrift auto-generated Python based testing framework doc. |
| [SAI PTF User Guide](https://github.com/opencomputeproject/SAI/blob/master/ptf/SAI_PTF_user-guide.md) | SAI Thrift Server User Guide to autogenerate test frame work. |
| [SAI PTF Design](https://github.com/opencomputeproject/SAI/blob/master/doc/SAI-Proposal-SAI-PTF.md) | SAI Thrift auto-generated Python based testing framework doc. |
| [SAI PTF User Guides](https://github.com/opencomputeproject/SAI/tree/master/ptf/docs) | SAI Thrift Server User Guide to autogenerate test frame work. |
| [DASH P4 SAI-Thrift Test Workflow](dash-test-workflow-p4-saithrift.md) | Use of P4-based simulators or SW data planes to verify DASH behavior, using saithrift API. |
| [Testbed](testbed/README.md) | Describes the setup and configuration of a DASH testbed.|
| [snappi and SAI-Challenger based tests](dash-test-sai-challenger.md) | How to run scalable tests using SAI-Challenger and snappi. The scalability is achieved with additional DASH/SAI abstraction level in test code to simplify high scale DUT configuration. |
Expand Down
85 changes: 85 additions & 0 deletions test/docs/testplans/eni.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Table of content

1. [Objectives](#objectives)
2. [Requirements](#requirements)
3. [Automation](#automation)
4. [Test Suites](#test-suites)
- [ENI creation](#eni-creation)
- [ENI removal](#eni-removal)
- [ENI scale](#eni-scale)

---

# Objectives

Verify proper CRUD API operations and scaling for Elastic Network Interface (ENI).

# Requirements

| Item | Expected value |
|-----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ENI per card | 64 |
| Bulk operations | Yes |
| Admin state | When the ENI is admin-state down, the packets destined to this ENI shall be dropped. |
| Remove | - During ENI delete, implementation must support ability to delete all mappings or routes in a single API call.<br>- Deleting an object that doesn't exists shall not return an error and shall not perform any force-deletions or delete dependencies implicitly. Sonic implementation shall validate the entire API as pre-checks before applying and return accordingly |
| Memory | Flexible memory allocation for ENI and not reserve max scale during initial create. (To allow oversubscription) |
| Error handling | Implementation must not have silent failures for APIs. |

# Automation

Test cases are automated using SAI PTF test framework.

# Test suites

## ENI creation

Verifies create operations, an association with VNI, MAC.

| # | Test case | Test Class.Method |
|-----|---------------------------------------------------------------|---------------------------------------------------------------------------------------------------|
| 1 | create inbound/outbound DASH ACL groups entries | `CreateDeleteEniTest.createInOutAclGroupsTest` |
| 2 | create VNET entry | `CreateDeleteEniTest.createVnetTest` |
| 3 | create Direction lookup entry | `CreateDeleteEniTest.createDirectionLookupTest` |
| 4 | create ENI entry | `CreateDeleteEniTest.createEniTest` |
| 5 | create ENI Ether address map entry | `CreateDeleteEniTest.createEniEtherAddressMapTest` |
| 6 | create Inbound routing entry | `CreateDeleteEniTest.createInboundRoutingEntryTest` |
| 7 | create PA validation entry | `CreateDeleteEniTest.createPaValidationTest` |
| 8 | create Outbound routing entry | `CreateDeleteEniTest.createOutboundRoutingEntryTest` |
| 9 | create Outbound CA to PA entry | `CreateDeleteEniTest.createCa2PaEntryTest` |
| 10 | verify DASH ACL Group entry attributes getting/setting | `CreateDeleteEniTest.dashAclGroupAttributesTest` |
| 11 | verify VNET entry attributes getting/setting | `CreateDeleteEniTest.vnetAttributesTest` |
| 12 | verify Direction lookup entry attributes getting/setting | `CreateDeleteEniTest.directionLookupAttributesTest` |
| 13 | verify Inbound routing entry attributes getting/setting | `CreateDeleteEniTest.inboundRoutingEntryAttributesTest` |
| 14 | verify ENI attributes getting/setting | `CreateDeleteEniTest.eniGetAttributesTest`<br/> `CreateDeleteEniTest.eniSetAndGetAttributesTest` |
| 15 | verify ENI Ether address map entry attributes getting/setting | `CreateDeleteEniTest.eniEtherAddressMapAttributesTest` |
| 16 | verify PA validation entry attributes getting/setting | `CreateDeleteEniTest.paValidationEntryAttributesTest` |
| 17 | verify Outbound routing entry attributes getting/setting | `CreateDeleteEniTest.outboundRoutingEntryAttributesTest` |
| 18 | verify Outbound CA to PA entry attributes getting/setting | `CreateDeleteEniTest.outboundCa2PaEntryAttributesTest` |

## ENI removal

Verifies remove operations.

| # | Test case | Test Class.Method |
|-----|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------|
| 1 | normal delete:<br>verify deletion of: inbound/outbound DASH ACL groups, VNET, ENI, ENI Ether address map entry, PA validation entry, inbound/outbound routing entry | Is a part of `CreateDeleteEniTest.destroy_teardown_obj` |
| 2 | error if mapped rules exist:<br>verify VNET cannot be deleted when map exist | `CreateDeleteEniTest.deleteVnetWhenMapExistTest` |
| 3 | duplicated deletion<br>no errors expected | Is a part of `CreateDeleteEniTest.destroy_teardown_obj` |
| 4 | ENI deletion when map exists: no errors, related entries also deleted(To clarify: list of entries that must be deleted) | `CreateDeleteEniTest.deleteEniWhenMapExistTest` |
| 5 | normal bulk delete | - |
| 6 | bulk delete does not remove any if there is a mapping for some ENI | - |

## ENI scale.

Verifies basic ENI scale, create/remove/recreate maximum number of ENIs .

| # | Test case | Test Class.Method |
|-----|------------------------------------------------------------------|-----------------------------|
| 1 | Create/remove a max number of ENI entries | `EniScaleTest.eniScaleTest` |
| 2 | Recreate (repeated creation/removal a max number of ENI entries) | `EniScaleTest.eniScaleTest` |

## ENI negative

| # | Test case purpose | Test Class.Method | Test description |
|:---:|:---------------------------------------------------------------|:---------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------|
| 1 | Verifies failure in case of creation the same ENIs in one VNET | `CreateTwoSameEnisNegativeTest`.<br/> `enisCreationTest` | Create two same ENIs in the single VNET and verify creation failure.<br/> **To clarify:** exact step to expect failure |
87 changes: 87 additions & 0 deletions test/test-cases/functional/ptf/run-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/bin/bash
# To be run inside saithrift-client container, assumes SAI repo portions exist under /SAI directory

SCRIPT=$0
BMV2="True"
TEST_DIR="functional/ptf"
EXTRA_PARAMETERS=""
INTERFACES="veth1,veth3"
TIMEOUT=1800
TEST_PARAMS=""

function show_help_and_exit()
{
echo "Usage ${SCRIPT} [options]"
echo " options with (*) must be provided"
echo " -h -? : get this help"
echo " -s <server ip> : specify thrift server IP address (e.g. -s 192.168.1.1)"
echo " -p <port map file path> : specify path to port map file (e.g. -p /tests-dev/config/front-map.ini)"
echo " -c <port config path> : specify path to port config file (e.g. -c /tests-dev/config/port-map.ini)"
echo " -U : specify to run PTF underlay test cases. (default: run PTF overlay test cases)"
echo " -I <interfaces> : specify comma-separated DUT 2 interfaces names (default: veth1,veth3)"
echo " -H : specify if tests are run on real hardware"
echo " -e <parameters> : specify extra parameter(s) (default: none)"
echo -e " -t <timeout> : specify timeout for test case execution\n"

exit $1
}

function validate_parameters()
{
RET=0

if [[ ${#iface_array[@]} < 2 ]] || [[ ${#iface_array[@]} > 2 ]]; then
echo -e "\nTwo interfaces names must be specified (e.g. -I iface1, iface2)."
echo -e "Instead received - ${#iface_array[@]}: $INTERFACES\n"
RET=1
fi

if [[ ${RET} != 0 ]]; then
show_help_and_exit ${RET}
fi
}

while getopts "h?UHI:s:p:c:e:t:" opt; do
case ${opt} in
h|\? )
show_help_and_exit 0
;;
U )
TEST_DIR="/SAI/ptf"
;;
H )
BMV2="False"
;;
I )
INTERFACES=${OPTARG}
;;
s )
TEST_PARAMS="${TEST_PARAMS}thrift_server='${OPTARG}';"
;;
p )
TEST_PARAMS="${TEST_PARAMS}port_map_file='${OPTARG}';"
;;
c )
TEST_PARAMS="${TEST_PARAMS}port_config_ini='${OPTARG}';"
;;
e )
EXTRA_PARAMETERS="${EXTRA_PARAMETERS} ${OPTARG}"
;;
t )
TIMEOUT=${OPTARG}
esac
done

IFS="," read -a iface_array <<< $INTERFACES

validate_parameters

set -x
ptf \
--test-dir ${TEST_DIR}\
--pypath /SAI/ptf \
--interface 0@${iface_array[0]} \
--interface 1@${iface_array[1]} \
--test-case-timeout=${TIMEOUT} \
--test-params="bmv2=${BMV2};${TEST_PARAMS}" \
${EXTRA_PARAMETERS}
Loading

0 comments on commit a95638a

Please sign in to comment.