From 4f4c6d16f911c5acbcd7c9f0ea81b1fb2f1a9d13 Mon Sep 17 00:00:00 2001 From: Saikrishna Arcot Date: Fri, 12 Jan 2024 10:20:04 -0800 Subject: [PATCH 01/32] Fix code coverage and ASAN not being enabled (#1338) This fixes a breakage from #1194 where code coverage and ASAN were not enabled, due to DEB_CONFIGURE_EXTRA_FLAGS no longer being used in dh_auto_configure. Signed-off-by: Saikrishna Arcot --- debian/rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/rules b/debian/rules index b872e8062..2acdf6e61 100755 --- a/debian/rules +++ b/debian/rules @@ -52,7 +52,7 @@ endif # -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) override_dh_auto_configure: - dh_auto_configure -- ${SWSS_COMMON_CONFIG} $(configure_opts) + dh_auto_configure -- ${SWSS_COMMON_CONFIG} $(configure_opts) $(DEB_CONFIGURE_EXTRA_FLAGS) override_dh_install: ifneq ($(filter rpc,$(DEB_BUILD_PROFILES)),) From b26ce7a35a0203724d87509fa56ee1b7f2c0ffbd Mon Sep 17 00:00:00 2001 From: saksarav-nokia Date: Wed, 17 Jan 2024 20:25:23 -0500 Subject: [PATCH 02/32] Skip FABRIC PORT Attributes from sairedis logging (#1339) Signed-off-by: saksarav --- lib/SkipRecordAttrContainer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/SkipRecordAttrContainer.cpp b/lib/SkipRecordAttrContainer.cpp index 3f04dc40b..074d08316 100644 --- a/lib/SkipRecordAttrContainer.cpp +++ b/lib/SkipRecordAttrContainer.cpp @@ -33,6 +33,10 @@ SkipRecordAttrContainer::SkipRecordAttrContainer() add(SAI_OBJECT_TYPE_ACL_TABLE, SAI_ACL_TABLE_ATTR_AVAILABLE_ACL_ENTRY); add(SAI_OBJECT_TYPE_ACL_TABLE, SAI_ACL_TABLE_ATTR_AVAILABLE_ACL_COUNTER); + + add(SAI_OBJECT_TYPE_PORT, SAI_PORT_ATTR_FABRIC_ATTACHED); + add(SAI_OBJECT_TYPE_PORT, SAI_PORT_ATTR_FABRIC_ATTACHED_SWITCH_ID); + add(SAI_OBJECT_TYPE_PORT, SAI_PORT_ATTR_FABRIC_ATTACHED_PORT_INDEX); } bool SkipRecordAttrContainer::add( From 5b2a517d940d295b56914abc9bb08a349ed80420 Mon Sep 17 00:00:00 2001 From: dbarashinvd <105214075+dbarashinvd@users.noreply.github.com> Date: Mon, 29 Jan 2024 06:54:24 +0200 Subject: [PATCH 03/32] Revert "add if statement for module control mode support" (#1341) Reverts #1305 this logic is not needed. we'll change sai.profile directly --- syncd/scripts/syncd_init_common.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/syncd/scripts/syncd_init_common.sh b/syncd/scripts/syncd_init_common.sh index c538c23e8..7c132c77f 100644 --- a/syncd/scripts/syncd_init_common.sh +++ b/syncd/scripts/syncd_init_common.sh @@ -240,11 +240,6 @@ config_syncd_mlnx() if [[ -f /tmp/sai_extra.profile ]]; then cat /tmp/sai_extra.profile >> /tmp/sai.profile fi - - if [[ -f /$HWSKU_DIR/module_control_support.profile ]]; then - cat /$HWSKU_DIR/module_control_support.profile >> /tmp/sai.profile - fi - } config_syncd_centec() From e5b8d4e567352b96f70a00cb08d60b864b11b9e8 Mon Sep 17 00:00:00 2001 From: Saikrishna Arcot Date: Thu, 1 Feb 2024 23:18:36 -0800 Subject: [PATCH 04/32] Make changes to support compiling on Bookworm (with GCC 12) (#1344) This adds support for sairedis to compile on Debian Bookworm (with GCC 12). This PR also includes a SAI submodule update that brings in other unrelated changes; this is needed because of a change in Doxyfile that would cause warnings/errors in newer versions of Doxygen. --- SAI | 2 +- lib/sai_redis_tam.cpp | 2 ++ syncd/ServiceMethodTable.cpp | 1 + syncd/SwitchNotifications.cpp | 1 + unittest/lib/test_sai_redis_tam.cpp | 5 +++++ unittest/vslib/test_sai_vs_tam.cpp | 5 +++++ vslib/sai_vs_tam.cpp | 2 ++ 7 files changed, 17 insertions(+), 1 deletion(-) diff --git a/SAI b/SAI index 96143eef4..c7a49cce5 160000 --- a/SAI +++ b/SAI @@ -1 +1 @@ -Subproject commit 96143eef4a662b720038a10e68d7d702370dc20a +Subproject commit c7a49cce5646bd6793e36b4cc3418dac4ae81ac9 diff --git a/lib/sai_redis_tam.cpp b/lib/sai_redis_tam.cpp index aa21ced94..9698af33d 100644 --- a/lib/sai_redis_tam.cpp +++ b/lib/sai_redis_tam.cpp @@ -23,6 +23,7 @@ REDIS_GENERIC_QUAD(TAM_TELEMETRY,tam_telemetry); REDIS_GENERIC_QUAD(TAM_COLLECTOR,tam_collector); REDIS_GENERIC_QUAD(TAM_EVENT_ACTION,tam_event_action); REDIS_GENERIC_QUAD(TAM_EVENT,tam_event); +REDIS_GENERIC_QUAD(TAM_COUNTER_SUBSCRIPTION,tam_counter_subscription); const sai_tam_api_t redis_tam_api = { @@ -37,4 +38,5 @@ const sai_tam_api_t redis_tam_api = { REDIS_GENERIC_QUAD_API(tam_collector) REDIS_GENERIC_QUAD_API(tam_event_action) REDIS_GENERIC_QUAD_API(tam_event) + REDIS_GENERIC_QUAD_API(tam_counter_subscription) }; diff --git a/syncd/ServiceMethodTable.cpp b/syncd/ServiceMethodTable.cpp index 38fb9b7c2..f954bbce2 100644 --- a/syncd/ServiceMethodTable.cpp +++ b/syncd/ServiceMethodTable.cpp @@ -2,6 +2,7 @@ #include "swss/logger.h" +#include #include using namespace syncd; diff --git a/syncd/SwitchNotifications.cpp b/syncd/SwitchNotifications.cpp index 1c470a989..5aa120364 100644 --- a/syncd/SwitchNotifications.cpp +++ b/syncd/SwitchNotifications.cpp @@ -1,6 +1,7 @@ #include "SwitchNotifications.h" #include "swss/logger.h" +#include using namespace syncd; diff --git a/unittest/lib/test_sai_redis_tam.cpp b/unittest/lib/test_sai_redis_tam.cpp index 8a8b974bb..f7899b053 100644 --- a/unittest/lib/test_sai_redis_tam.cpp +++ b/unittest/lib/test_sai_redis_tam.cpp @@ -70,6 +70,11 @@ TEST(libsairedis, tam) EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_event(0)); EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_event_attribute(0,0)); EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_event_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_counter_subscription(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_counter_subscription(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_counter_subscription_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_counter_subscription_attribute(0,0,0)); } TEST(libsairedis, sai_tam_telemetry_get_data) diff --git a/unittest/vslib/test_sai_vs_tam.cpp b/unittest/vslib/test_sai_vs_tam.cpp index b67b068b9..f879977f7 100644 --- a/unittest/vslib/test_sai_vs_tam.cpp +++ b/unittest/vslib/test_sai_vs_tam.cpp @@ -70,6 +70,11 @@ TEST(libsaivs, tam) EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_event(0)); EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_event_attribute(0,0)); EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_event_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_counter_subscription(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_counter_subscription(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_counter_subscription_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_counter_subscription_attribute(0,0,0)); } TEST(libsairedis, sai_tam_telemetry_get_data) diff --git a/vslib/sai_vs_tam.cpp b/vslib/sai_vs_tam.cpp index 3376cda91..a1abba1ff 100644 --- a/vslib/sai_vs_tam.cpp +++ b/vslib/sai_vs_tam.cpp @@ -23,6 +23,7 @@ VS_GENERIC_QUAD(TAM_TELEMETRY,tam_telemetry); VS_GENERIC_QUAD(TAM_COLLECTOR,tam_collector); VS_GENERIC_QUAD(TAM_EVENT_ACTION,tam_event_action); VS_GENERIC_QUAD(TAM_EVENT,tam_event); +VS_GENERIC_QUAD(TAM_COUNTER_SUBSCRIPTION,tam_counter_subscription); const sai_tam_api_t vs_tam_api = { @@ -37,5 +38,6 @@ const sai_tam_api_t vs_tam_api = { VS_GENERIC_QUAD_API(tam_collector) VS_GENERIC_QUAD_API(tam_event_action) VS_GENERIC_QUAD_API(tam_event) + VS_GENERIC_QUAD_API(tam_counter_subscription) }; From a5049331b05f52f73eb8ab3f0a87245739180112 Mon Sep 17 00:00:00 2001 From: Kamil Cudnik Date: Wed, 7 Feb 2024 17:04:11 +0100 Subject: [PATCH 05/32] Change dash API pipeline name (#1351) --- .azure-pipelines/build-swss-template.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.azure-pipelines/build-swss-template.yml b/.azure-pipelines/build-swss-template.yml index 59d46ce99..54cd78e2c 100644 --- a/.azure-pipelines/build-swss-template.yml +++ b/.azure-pipelines/build-swss-template.yml @@ -137,8 +137,7 @@ jobs: path: $(Build.ArtifactStagingDirectory)/download patterns: | libdashapi*.deb - displayName: "Download dash api" - + displayName: "Download dash api test" - script: | set -ex # install libyang before install libswsscommon From 46e713d509833f7036dede89ee51368a9a5fb65f Mon Sep 17 00:00:00 2001 From: Kamil Cudnik Date: Thu, 8 Feb 2024 10:42:48 +0100 Subject: [PATCH 06/32] [syncd] Add workaround for SET operation on SAI_HOSTIF_ATTR_QUEUE (#1345) On broadcom platform it may happen on warm boot that new firmware will support query switch capability SET operation for this attribute, but firmware is not actually implementing that operation, OA in this case will add new attribute SAI_HOSTIF_ATTR_QUEUE to create HOSTIF object, and comparison logic will generate SET operation to update existing object. If set is not supported, then this will cause syncd to crash because operation will be not successfull. We are adding this workaround for time being until this will be supported, then this needs to be removed. --- syncd/Workaround.cpp | 15 +++++++++++++++ unittest/syncd/Makefile.am | 1 + unittest/syncd/TestWorkaround.cpp | 21 +++++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 unittest/syncd/TestWorkaround.cpp diff --git a/syncd/Workaround.cpp b/syncd/Workaround.cpp index bcbc9d89b..a7dbae5e4 100644 --- a/syncd/Workaround.cpp +++ b/syncd/Workaround.cpp @@ -12,6 +12,11 @@ using namespace syncd; * Some attributes are not supported on SET API on different platforms. * For example SAI_SWITCH_ATTR_SRC_MAC_ADDRESS. * + * Some attributes like SAI_HOSTIF_ATTR_QUEUE may not be supported on BRCM + * platform until vendor will implement them, but it will return success on + * querySwitchCapability on OA. Support for query switch capability can show up + * on warm boot when booting new SAI firmware. + * * @param[in] objectType Object type. * @param[in] attrId Attribute Id. * @param[in] status Status from SET API. @@ -40,5 +45,15 @@ bool Workaround::isSetAttributeWorkaround( return true; } + if (objectType == SAI_OBJECT_TYPE_HOSTIF && + attrId == SAI_HOSTIF_ATTR_QUEUE) + { + SWSS_LOG_WARN("setting %s failed: %s, not all platforms support this attribute", + sai_metadata_get_attr_metadata(objectType, attrId)->attridname, + sai_serialize_status(status).c_str()); + + return true; + } + return false; } diff --git a/unittest/syncd/Makefile.am b/unittest/syncd/Makefile.am index 27c301e25..4c75d3672 100644 --- a/unittest/syncd/Makefile.am +++ b/unittest/syncd/Makefile.am @@ -17,6 +17,7 @@ tests_SOURCES = main.cpp \ TestNotificationHandler.cpp \ TestMdioIpcServer.cpp \ TestPortStateChangeHandler.cpp \ + TestWorkaround.cpp \ TestVendorSai.cpp tests_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) diff --git a/unittest/syncd/TestWorkaround.cpp b/unittest/syncd/TestWorkaround.cpp new file mode 100644 index 000000000..36dd822e6 --- /dev/null +++ b/unittest/syncd/TestWorkaround.cpp @@ -0,0 +1,21 @@ +#include + +#include +#include +#include + +#include +#include "Workaround.h" +#include "swss/logger.h" + +#include + +using namespace syncd; + +TEST(Workaround, isSetAttributeWorkaround) +{ + ASSERT_EQ(Workaround::isSetAttributeWorkaround(SAI_OBJECT_TYPE_HOSTIF, SAI_HOSTIF_ATTR_QUEUE, SAI_STATUS_FAILURE), true); + ASSERT_EQ(Workaround::isSetAttributeWorkaround(SAI_OBJECT_TYPE_SWITCH, SAI_SWITCH_ATTR_SRC_MAC_ADDRESS, SAI_STATUS_FAILURE), true); + ASSERT_EQ(Workaround::isSetAttributeWorkaround(SAI_OBJECT_TYPE_PORT, SAI_PORT_ATTR_TYPE, SAI_STATUS_FAILURE), false); + ASSERT_EQ(Workaround::isSetAttributeWorkaround(SAI_OBJECT_TYPE_PORT, SAI_PORT_ATTR_TYPE, SAI_STATUS_SUCCESS), false); +} From ea8767c2d33c5b8160d73838cced302bbdef01b1 Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Thu, 8 Feb 2024 23:37:12 -0800 Subject: [PATCH 07/32] [nvidia] Update syncd start to cover changes in SDK initialization process. (#1343) Create a folder for SDK dumps based on the SDK_DUMP_PATH variable from the SAI profile file. Update the number of huge pages required to run SDK. Customise interfaces configuration based on SKU --- syncd/scripts/syncd_init_common.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/syncd/scripts/syncd_init_common.sh b/syncd/scripts/syncd_init_common.sh index 7c132c77f..95a85ae56 100644 --- a/syncd/scripts/syncd_init_common.sh +++ b/syncd/scripts/syncd_init_common.sh @@ -335,6 +335,7 @@ config_syncd_nvidia_bluefield() { # Read MAC addresses base_mac="$(echo $SYNCD_VARS | jq -r '.mac')" + hwsku=$(sonic-cfggen -d -v 'DEVICE_METADATA["localhost"]["hwsku"]') eth0_mac=$(cat /sys/class/net/Ethernet0/address) eth4_mac=$(cat /sys/class/net/Ethernet4/address) @@ -347,7 +348,12 @@ config_syncd_nvidia_bluefield() CMD_ARGS+=" -l -p /tmp/sai.profile -w 180000000" - echo 4096 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages + SDK_DUMP_PATH=$(cat /tmp/sai.profile | grep "SAI_DUMP_STORE_PATH" | cut -d = -f2) + if [ ! -d "$SDK_DUMP_PATH" ]; then + mkdir -p "$SDK_DUMP_PATH" + fi + + echo 9216 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages mkdir -p /mnt/huge mount -t hugetlbfs pagesize=1GB /mnt/huge @@ -355,13 +361,14 @@ config_syncd_nvidia_bluefield() devlink dev eswitch set pci/0000:03:00.1 mode legacy devlink dev eswitch set pci/0000:03:00.0 mode switchdev devlink dev eswitch set pci/0000:03:00.1 mode switchdev - devlink dev param set pci/0000:03:00.0 name esw_multiport value 1 cmode runtime - devlink dev param set pci/0000:03:00.1 name esw_multiport value 1 cmode runtime + + if [[ $hwsku != *"-C1" ]]; then + devlink dev param set pci/0000:03:00.0 name esw_multiport value 1 cmode runtime + devlink dev param set pci/0000:03:00.1 name esw_multiport value 1 cmode runtime + fi ethtool -A Ethernet0 rx off tx off ethtool -A Ethernet4 rx off tx off - - mlnx-sf --device 0000:03:00.0 --action create --sfnum 1 --hwaddr ${base_mac} -t } config_syncd_xsight() From a91d51d8feefdd883c72bc11af79d12e95a7d105 Mon Sep 17 00:00:00 2001 From: Deepak Singhal <115033986+deepak-singhal0408@users.noreply.github.com> Date: Wed, 14 Feb 2024 18:08:26 -0800 Subject: [PATCH 08/32] Enable 8 Lanes Support in vslib (#1355) Enable 8 lanes support in vslib. This is needed to emulate HW SKUs which contains 8 lanes in their port_config.ini. Tested bring up of vs image with HWSKU containing 8 lanes in their port_config.ini/lanemap.ini files. --- vslib/LaneMapFileParser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vslib/LaneMapFileParser.cpp b/vslib/LaneMapFileParser.cpp index 1d32719e9..6c9d03576 100644 --- a/vslib/LaneMapFileParser.cpp +++ b/vslib/LaneMapFileParser.cpp @@ -64,7 +64,7 @@ void LaneMapFileParser::parse( size_t n = tokens.size(); - if (n != 1 && n != 2 && n != 4) + if (n != 1 && n != 2 && n != 4 && n != 8) { SWSS_LOG_ERROR("invalid number of lanes (%zu) assigned to interface %s", n, ifname.c_str()); return; From 09cd7f68d7c36f436653f46964718a25f8ee1dc1 Mon Sep 17 00:00:00 2001 From: noaOrMlnx <58519608+noaOrMlnx@users.noreply.github.com> Date: Mon, 26 Feb 2024 11:47:05 +0200 Subject: [PATCH 09/32] Add new functionality to syncd_init_common.sh, to use common sai.profile (#1352) Changed config_mlnx_syncd() functionality to use common sai.profile for all SKUs, then apply the specific SKU sai.profile on top of it, and remove duplications. Why I did it To have the ability to add common parameters to only 1 file instead of all SKUs. --- syncd/scripts/syncd_init_common.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/syncd/scripts/syncd_init_common.sh b/syncd/scripts/syncd_init_common.sh index 95a85ae56..b85819852 100644 --- a/syncd/scripts/syncd_init_common.sh +++ b/syncd/scripts/syncd_init_common.sh @@ -211,14 +211,23 @@ config_syncd_mlnx() DUAL_TOR="$(echo $SYNCD_VARS | jq -r '.dual_tor')" DSCP_REMAPPING="$(echo $SYNCD_VARS | jq -r '.dscp_remapping')" - # Make default sai.profile + SAI_COMMON_FILE_PATH=/etc/mlnx/sai-common.profile + if [[ -f $HWSKU_DIR/sai.profile.j2 ]]; then export RESOURCE_TYPE="$(echo $SYNCD_VARS | jq -r '.resource_type')" - j2 -e RESOURCE_TYPE $HWSKU_DIR/sai.profile.j2 -o /tmp/sai.profile + j2 -e RESOURCE_TYPE $HWSKU_DIR/sai.profile.j2 -o /tmp/sai-temp.profile else - cat $HWSKU_DIR/sai.profile > /tmp/sai.profile + cat $HWSKU_DIR/sai.profile > /tmp/sai-temp.profile + fi + + if [[ -f $SAI_COMMON_FILE_PATH ]]; then + cat $SAI_COMMON_FILE_PATH >> /tmp/sai-temp.profile fi + # keep only the first occurence of each prefix with '=' sign, and remove the others. + awk -F= '!seen[$1]++' /tmp/sai-temp.profile > /tmp/sai.profile + rm -f /tmp/sai-temp.profile + # Update sai.profile with MAC_ADDRESS and WARM_BOOT settings echo "DEVICE_MAC_ADDRESS=$MAC_ADDRESS" >> /tmp/sai.profile echo "SAI_WARM_BOOT_WRITE_FILE=/var/warmboot/" >> /tmp/sai.profile From d7703706917bcc0ea60edd78be9359ed87954cbc Mon Sep 17 00:00:00 2001 From: Oleksandr Ivantsiv Date: Wed, 28 Feb 2024 13:15:04 -0800 Subject: [PATCH 10/32] [asan] Disable the "maybe-uninitialized" warning when compiled with ASAN enabled. (#1360) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit What I did Fix compilation with ASAN enabled for the Debian Bookworm with GCC version 12.2.0 (Debian 12.2.0-14). Why I did it The compilation fails due to the issue in GGC compiler: GCC Bugzilla – Bug 105562 The suggested fix is suppressing the maybe-uninitialized warning to overcome the problem and may be removed when the GCC version is upgraded to the one that includes the fix. How I verified it Compile SWSS package with ASAN enabled. Details if related Related to: sonic-net/sonic-swss#3062 --- configure.ac | 1 + 1 file changed, 1 insertion(+) diff --git a/configure.ac b/configure.ac index 6f5854b93..51c269d3e 100644 --- a/configure.ac +++ b/configure.ac @@ -113,6 +113,7 @@ if test "x$asan_enabled" = "xtrue"; then CFLAGS_ASAN+=" -fsanitize=address" CFLAGS_ASAN+=" -DASAN_ENABLED" CFLAGS_ASAN+=" -ggdb -fno-omit-frame-pointer -U_FORTIFY_SOURCE" + CFLAGS_ASAN+=" -Wno-maybe-uninitialized" AC_SUBST(CFLAGS_ASAN) LDFLAGS_ASAN+=" -lasan" From bb948f632bed2bec2eaa34085a8cbed92069bf83 Mon Sep 17 00:00:00 2001 From: Jiahua Wang Date: Thu, 7 Mar 2024 01:08:17 -0800 Subject: [PATCH 11/32] Check MDIO server thread joinable before join the thread (#1342) This PR is to address the issue syncd crash observed during sonic-mgmt reboot tests #17346 Signed-off-by: Jiahua Wang --- syncd/MdioIpcServer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/syncd/MdioIpcServer.cpp b/syncd/MdioIpcServer.cpp index 7194332fb..1d827efa9 100644 --- a/syncd/MdioIpcServer.cpp +++ b/syncd/MdioIpcServer.cpp @@ -465,7 +465,10 @@ void MdioIpcServer::stopMdioThread(void) } m_taskAlive = 0; - m_taskThread.join(); + if(m_taskThread.joinable()) + { + m_taskThread.join(); + } SWSS_LOG_NOTICE("IPC task thread is stopped\n"); } From 594944dbe4414f135fc6366a30118afa10c135eb Mon Sep 17 00:00:00 2001 From: Stephen Sun <5379172+stephenxs@users.noreply.github.com> Date: Tue, 26 Mar 2024 22:26:01 +0800 Subject: [PATCH 12/32] Fix flow counter out-of-order issue by notifying counter operations using SelectableChannel (#1362) What I did Fix flow counter out-of-order issue by notifying counter operations using SelectableChannel Signed-off-by: Stephen Sun stephens@nvidia.com Why I did it Currently, the operations of SAI objects and their counters (if any) are triggered by different channels, which introduces racing conditions: the creation and destruction of the objects are notified using the SelectableChannel, the operations of counters, including starting and stopping polling the counters, are notified by listening to the FLEX_COUNTER and FLEX_COUNTER_GROUP tables in the FLEX_COUNTER_DB The orchagent always respects the order when starting/stopping counter-polling (which means to start counter-polling after creating the object and to stop counter-polling before destroying the object) but syncd can receive events in a wrong order, eg. it receives destroying an object first and then stopping counter polling on the object, it can poll counter for a non-exist object, which causes errors in vendor SAI. The new solution is to extend SAI redis attributes on the SAI_SWITCH_OBJECT to notify counter polling. As a result, all the objects and their counters are notified using a unified channel, which is the SelectableChannel. How I verified it Unit test Manual test Regressions test Details if related There are two SAI Redis attributes introduced as below. There are some fields with const char * type for each attribute. Passing a field as nullptr means not to change it. SAI_REDIS_SWITCH_ATTR_FLEX_COUNTER_GROUP for counters represented by FLEX_COUNTER_GROUP table in the FLEX_COUNTER_DB, including the following fields counter_group_name, which is the key of the table, representing the group name. poll_interval, which is the field POLL_INTERVAL of an entry, representing the polling interval of the group. operation, which is the field FLEX_COUNTER_STATUS of an entry, representing whether the counter polling is enabled for the group stats_mode, which is the field STATS_MODE of an entry, either STATS_MODE_READ or STATS_MODE_READ_AND_CLEAR plugins, which represents the Lua plugin related to the group plugin_name, which is the name of the plugins field. It differs among different groups SAI_REDIS_SWITCH_ATTR_FLEX_COUNTER for counter groups represented by the FLEX_COUNTER table in the FLEX_COUNTER_DB, including the following fields counter_key, which is the key of the table, with the name convention of :oid: counter_ids, which is a list of counter IDs to be polled for the object counter_field_name, which is the name of the counter ID field. It differs among different groups stats_mode, which is the field STATS_MODE of an entry, either STATS_MODE_READ or STATS_MODE_READ_AND_CLEAR Both SAI attributes are terminated by the RedisRemoteSaiInterface object in the swss context, which serializes the SAI API call into the selectable channel. REDIS_FLEX_COUNTER_COMMAND_SET_COUNTER_GROUP: represents the SET operation in the FLEX_COUNTER_GROUP table REDIS_FLEX_COUNTER_COMMAND_DEL_COUNTER_GROUP: represents the DEL operation in the FLEX_COUNTER_GROUP table REDIS_FLEX_COUNTER_COMMAND_START_POLL: represents the SET operation in the FLEX_COUNTER table REDIS_FLEX_COUNTER_COMMAND_STOP_POLL: represents the DEL operation in the FLEX_COUNTER table The Syncd will call flex counter functions to handle them on receiving the above-extended commands (representing both SAI extended attributes). Gearbox flex counter database Pass the Phy OID, an OID of a SAI switch object in syntax, when calling the SAI set API to set the extended attributes. By doing so, the SAI redis objects can choose in which context the SAI API call should be invoked and the corresponding gearbox syncd docker container will handle it. (ps: THE ORIGINAL GEARBOX FLEX COUNTER IMPLEMENTATION IS BUGGY) Context and critical section analysis It does not change the critical section hierarchy Performance analysis The counter operations are handled in the same thread in both the new and old solutions. In swss, the counter operation was asynchronous in the old solution and is synchronous now, which can introduce a bit more latency. However, as the number of counter operations is small, no performance degradation is observed. --- lib/RedisRemoteSaiInterface.cpp | 128 ++++++++++++++++++++++++++++++++ lib/RedisRemoteSaiInterface.h | 21 ++++++ lib/sairedis.h | 101 +++++++++++++++++++++++++ lib/sairediscommon.h | 5 ++ syncd/Syncd.cpp | 97 +++++++++++++++++++++--- syncd/Syncd.h | 14 ++++ syncd/tests/TestSyncdLib.cpp | 19 ++++- syncd/tests/TestSyncdLib.h | 1 + syncd/tests/TestSyncdMlnx.cpp | 107 ++++++++++++++++++++++++++ tests/aspell.en.pws | 1 + 10 files changed, 482 insertions(+), 12 deletions(-) diff --git a/lib/RedisRemoteSaiInterface.cpp b/lib/RedisRemoteSaiInterface.cpp index a789235e4..12bcba7d9 100644 --- a/lib/RedisRemoteSaiInterface.cpp +++ b/lib/RedisRemoteSaiInterface.cpp @@ -476,6 +476,14 @@ sai_status_t RedisRemoteSaiInterface::setRedisExtensionAttribute( return SAI_STATUS_SUCCESS; + case SAI_REDIS_SWITCH_ATTR_FLEX_COUNTER_GROUP: + return notifyCounterGroupOperations(objectId, + reinterpret_cast(attr->value.ptr)); + + case SAI_REDIS_SWITCH_ATTR_FLEX_COUNTER: + return notifyCounterOperations(objectId, + reinterpret_cast(attr->value.ptr)); + default: break; } @@ -485,6 +493,126 @@ sai_status_t RedisRemoteSaiInterface::setRedisExtensionAttribute( return SAI_STATUS_FAILURE; } +bool RedisRemoteSaiInterface::isSaiS8ListValidString( + _In_ const sai_s8_list_t &s8list) +{ + SWSS_LOG_ENTER(); + + if (s8list.list != nullptr && s8list.count > 0) + { + size_t len = strnlen((const char *)s8list.list, s8list.count); + + if (len == (size_t)s8list.count) + { + return true; + } + else + { + SWSS_LOG_ERROR("Count (%u) is different than strnlen (%zu)", s8list.count, len); + } + } + + return false; +} + +bool RedisRemoteSaiInterface::emplaceStrings( + _In_ const sai_s8_list_t &field, + _In_ const sai_s8_list_t &value, + _Out_ std::vector &entries) +{ + SWSS_LOG_ENTER(); + + bool result = false; + + if (isSaiS8ListValidString(field) && isSaiS8ListValidString(value)) + { + entries.emplace_back(std::string((const char*)field.list, field.count), std::string((const char*)value.list, value.count)); + result = true; + } + + return result; +} + +bool RedisRemoteSaiInterface::emplaceStrings( + _In_ const char *field, + _In_ const sai_s8_list_t &value, + _Out_ std::vector &entries) +{ + SWSS_LOG_ENTER(); + + bool result = false; + + if (isSaiS8ListValidString(value)) + { + entries.emplace_back(field, std::string((const char*)value.list, value.count)); + result = true; + } + + return result; +} + +sai_status_t RedisRemoteSaiInterface::notifyCounterGroupOperations( + _In_ sai_object_id_t objectId, + _In_ const sai_redis_flex_counter_group_parameter_t *flexCounterGroupParam) +{ + SWSS_LOG_ENTER(); + + std::vector entries; + + if (flexCounterGroupParam == nullptr || !isSaiS8ListValidString(flexCounterGroupParam->counter_group_name)) + { + SWSS_LOG_ERROR("Invalid parameters when handling counter group operation"); + return SAI_STATUS_FAILURE; + } + + std::string key((const char*)flexCounterGroupParam->counter_group_name.list, flexCounterGroupParam->counter_group_name.count); + + emplaceStrings(POLL_INTERVAL_FIELD, flexCounterGroupParam->poll_interval, entries); + emplaceStrings(STATS_MODE_FIELD, flexCounterGroupParam->stats_mode, entries); + emplaceStrings(flexCounterGroupParam->plugin_name, flexCounterGroupParam->plugins, entries); + emplaceStrings(FLEX_COUNTER_STATUS_FIELD, flexCounterGroupParam->operation, entries); + + m_recorder->recordGenericSet(key, entries); + + m_communicationChannel->set(key, + entries, + (entries.size() != 0) ? REDIS_FLEX_COUNTER_COMMAND_SET_GROUP : REDIS_FLEX_COUNTER_COMMAND_DEL_GROUP); + + return waitForResponse(SAI_COMMON_API_SET); +} + +sai_status_t RedisRemoteSaiInterface::notifyCounterOperations( + _In_ sai_object_id_t objectId, + _In_ const sai_redis_flex_counter_parameter_t *flexCounterParam) +{ + SWSS_LOG_ENTER(); + + if (flexCounterParam == nullptr || !isSaiS8ListValidString(flexCounterParam->counter_key)) + { + SWSS_LOG_ERROR("Invalid parameters when handling counter operation"); + return SAI_STATUS_FAILURE; + } + + std::vector entries; + std::string key((const char*)flexCounterParam->counter_key.list, flexCounterParam->counter_key.count); + std::string command; + + if (emplaceStrings(flexCounterParam->counter_field_name, flexCounterParam->counter_ids, entries)) + { + command = REDIS_FLEX_COUNTER_COMMAND_START_POLL; + emplaceStrings(STATS_MODE_FIELD, flexCounterParam->stats_mode, entries); + } + else + { + command = REDIS_FLEX_COUNTER_COMMAND_STOP_POLL; + } + + m_recorder->recordGenericSet(key, entries); + m_communicationChannel->set(key, entries, command); + + return waitForResponse(SAI_COMMON_API_SET); +} + sai_status_t RedisRemoteSaiInterface::set( _In_ sai_object_type_t objectType, _In_ sai_object_id_t objectId, diff --git a/lib/RedisRemoteSaiInterface.h b/lib/RedisRemoteSaiInterface.h index 8d5b01c1f..4f19f9faa 100644 --- a/lib/RedisRemoteSaiInterface.h +++ b/lib/RedisRemoteSaiInterface.h @@ -343,6 +343,27 @@ namespace sairedis _In_ sai_object_id_t objectId, _In_ const sai_attribute_t *attr); + bool isSaiS8ListValidString( + _In_ const sai_s8_list_t &s8list); + + bool emplaceStrings( + _In_ const sai_s8_list_t &field, + _In_ const sai_s8_list_t &value, + _Out_ std::vector &entries); + + bool emplaceStrings( + _In_ const char *field, + _In_ const sai_s8_list_t &value, + _Out_ std::vector &entries); + + sai_status_t notifyCounterGroupOperations( + _In_ sai_object_id_t objectId, + _In_ const sai_redis_flex_counter_group_parameter_t *flexCounterGroupParam); + + sai_status_t notifyCounterOperations( + _In_ sai_object_id_t objectId, + _In_ const sai_redis_flex_counter_parameter_t *flexCounterParam); + private: sai_status_t sai_redis_notify_syncd( diff --git a/lib/sairedis.h b/lib/sairedis.h index 68e9436d5..56a21bd4d 100644 --- a/lib/sairedis.h +++ b/lib/sairedis.h @@ -86,6 +86,88 @@ typedef enum _sai_redis_communication_mode_t } sai_redis_communication_mode_t; +/** + * @brief Use Redis communication channel to handle counters. + * + * Originally, there are out-of-order issue between the objects and their counters. + * This is because the counters are handled on receiving flex counter database update. + * However, the objects are handled on receiving update from the redis communication channel. + * + * To resolve the issue, we use the redis communication channel to handle the counter updates. + * + * The struct sai_redis_flex_counter_group_parameter_t represents the counter group operations. + * The caller (usually orchagent) can change some or all the options of a counter group. + * The counter_group_name represents the counter group name which must be a valid list. + * For the rest fields, it means not changing it to pass an empty list. + */ +typedef struct _sai_redis_flex_counter_group_parameter_t +{ + /** + * @brief The flex counter group name. + * + * It is the key of FLEX_COUNTER_TABLE and FLEX_COUNTER_GROUP_TABLE table. + */ + sai_s8_list_t counter_group_name; + + /** + * @brief The polling interval of the counter group + * + * It should be a number representing the polling interval in seconds. + */ + sai_s8_list_t poll_interval; + + /** + * @brief The operation of the counter group + * + * It should be either "enable" or "disable" + */ + sai_s8_list_t operation; + + /** + * @brief The counter fetching mode. + * + * It should be either "STATS_MODE_READ" or "STATS_MODE_READ_AND_CLEAR" + */ + sai_s8_list_t stats_mode; + + /** + * @brief The name of the filed that represents the Lua plugin + */ + sai_s8_list_t plugin_name; + + /** + * @brief The SHA code of the Lua plugin + */ + sai_s8_list_t plugins; + +} sai_redis_flex_counter_group_parameter_t; + +typedef struct _sai_redis_flex_counter_parameter_t +{ + /** + * @brief The key in the flex counter table + * + * It should be the serialized OID eg. "oid:0x15000000000001" + */ + sai_s8_list_t counter_key; + + /** + * @brief The list of counters' IDs that should be fetched. + */ + sai_s8_list_t counter_ids; + + /** + * @brief The name of the filed that represents the counters' IDs. + */ + sai_s8_list_t counter_field_name; + + /** + * @brief The counter fetch mode of the object. + */ + sai_s8_list_t stats_mode; + +} sai_redis_flex_counter_parameter_t; + typedef enum _sai_redis_switch_attr_t { /** @@ -249,6 +331,25 @@ typedef enum _sai_redis_switch_attr_t * @default 60000 */ SAI_REDIS_SWITCH_ATTR_SYNC_OPERATION_RESPONSE_TIMEOUT, + + /** + * @brief Flex counter group operations + * + * @type sai_redis_flex_counter_group_parameter_t + * @flags CREATE_AND_SET + * @default 0 + */ + SAI_REDIS_SWITCH_ATTR_FLEX_COUNTER_GROUP, + + /** + * @brief Flex counter operations + * + * @type sai_redis_counter_parameter_t + * @flags CREATE_AND_SET + * @default 0 + */ + SAI_REDIS_SWITCH_ATTR_FLEX_COUNTER, + } sai_redis_switch_attr_t; /** diff --git a/lib/sairediscommon.h b/lib/sairediscommon.h index 7a6a997d9..d09ddc0ab 100644 --- a/lib/sairediscommon.h +++ b/lib/sairediscommon.h @@ -52,6 +52,11 @@ #define REDIS_ASIC_STATE_COMMAND_OBJECT_TYPE_GET_AVAILABILITY_QUERY "object_type_get_availability_query" #define REDIS_ASIC_STATE_COMMAND_OBJECT_TYPE_GET_AVAILABILITY_RESPONSE "object_type_get_availability_response" +#define REDIS_FLEX_COUNTER_COMMAND_START_POLL "start_poll" +#define REDIS_FLEX_COUNTER_COMMAND_STOP_POLL "stop_poll" +#define REDIS_FLEX_COUNTER_COMMAND_SET_GROUP "set_counter_group" +#define REDIS_FLEX_COUNTER_COMMAND_DEL_GROUP "del_counter_group" +#define REDIS_FLEX_COUNTER_COMMAND_RESPONSE "counter_response" /** * @brief Redis virtual object id counter key name. * diff --git a/syncd/Syncd.cpp b/syncd/Syncd.cpp index 1dd2366eb..2eada41c8 100644 --- a/syncd/Syncd.cpp +++ b/syncd/Syncd.cpp @@ -169,6 +169,8 @@ Syncd::Syncd( m_dbFlexCounter = std::make_shared(m_contextConfig->m_dbFlex, 0); m_flexCounter = std::make_shared(m_dbFlexCounter.get(), FLEX_COUNTER_TABLE); m_flexCounterGroup = std::make_shared(m_dbFlexCounter.get(), FLEX_COUNTER_GROUP_TABLE); + m_flexCounterTable = std::make_shared(m_dbFlexCounter.get(), FLEX_COUNTER_TABLE); + m_flexCounterGroupTable = std::make_shared(m_dbFlexCounter.get(), FLEX_COUNTER_GROUP_TABLE); m_switchConfigContainer = std::make_shared(); m_redisVidIndexGenerator = std::make_shared(m_dbAsic, REDIS_KEY_VIDCOUNTER); @@ -380,6 +382,18 @@ sai_status_t Syncd::processSingleEvent( if (op == REDIS_ASIC_STATE_COMMAND_OBJECT_TYPE_GET_AVAILABILITY_QUERY) return processObjectTypeGetAvailabilityQuery(kco); + if (op == REDIS_FLEX_COUNTER_COMMAND_START_POLL) + return processFlexCounterEvent(key, SET_COMMAND, kfvFieldsValues(kco)); + + if (op == REDIS_FLEX_COUNTER_COMMAND_STOP_POLL) + return processFlexCounterEvent(key, DEL_COMMAND, kfvFieldsValues(kco)); + + if (op == REDIS_FLEX_COUNTER_COMMAND_SET_GROUP) + return processFlexCounterGroupEvent(key, SET_COMMAND, kfvFieldsValues(kco)); + + if (op == REDIS_FLEX_COUNTER_COMMAND_DEL_GROUP) + return processFlexCounterGroupEvent(key, DEL_COMMAND, kfvFieldsValues(kco)); + SWSS_LOG_THROW("event op '%s' is not implemented, FIXME", op.c_str()); } @@ -2442,18 +2456,44 @@ void Syncd::processFlexCounterGroupEvent( // TODO must be moved to go via ASIC c WatchdogScope ws(m_timerWatchdog, op + ":" + groupName, &kco); + processFlexCounterGroupEvent(groupName, op, values, false); +} + +sai_status_t Syncd::processFlexCounterGroupEvent( + _In_ const std::string &groupName, + _In_ const std::string &op, + _In_ const std::vector &values, + _In_ bool fromAsicChannel) +{ + SWSS_LOG_ENTER(); + if (op == SET_COMMAND) { m_manager->addCounterPlugin(groupName, values); + if (fromAsicChannel) + { + m_flexCounterGroupTable->set(groupName, values); + } } else if (op == DEL_COMMAND) { + if (fromAsicChannel) + { + m_flexCounterGroupTable->del(groupName); + } m_manager->removeCounterPlugins(groupName); } else { SWSS_LOG_ERROR("unknown command: %s", op.c_str()); } + + if (fromAsicChannel) + { + sendApiResponse(SAI_COMMON_API_SET, SAI_STATUS_SUCCESS); + } + + return SAI_STATUS_SUCCESS; } void Syncd::processFlexCounterEvent( // TODO must be moved to go via ASIC channel queue @@ -2469,21 +2509,40 @@ void Syncd::processFlexCounterEvent( // TODO must be moved to go via ASIC channe auto& key = kfvKey(kco); auto& op = kfvOp(kco); + auto& values = kfvFieldsValues(kco); WatchdogScope ws(m_timerWatchdog, op + ":" + key, &kco); + processFlexCounterEvent(key, op, values, false); +} + +sai_status_t Syncd::processFlexCounterEvent( + _In_ const std::string &key, + _In_ const std::string &op, + _In_ const std::vector &values, + _In_ bool fromAsicChannel) +{ + SWSS_LOG_ENTER(); + auto delimiter = key.find_first_of(":"); if (delimiter == std::string::npos) { SWSS_LOG_ERROR("Failed to parse the key %s", key.c_str()); - return; // if key is invalid there is no need to process this event again + if (fromAsicChannel) + { + sendApiResponse(SAI_COMMON_API_SET, SAI_STATUS_FAILURE); + } + + return SAI_STATUS_FAILURE; // if key is invalid there is no need to process this event again } auto groupName = key.substr(0, delimiter); auto strVid = key.substr(delimiter + 1); + auto effective_op = op; + sai_object_id_t vid; sai_deserialize_object_id(strVid, vid); @@ -2491,26 +2550,46 @@ void Syncd::processFlexCounterEvent( // TODO must be moved to go via ASIC channe if (!m_translator->tryTranslateVidToRid(vid, rid)) { - SWSS_LOG_WARN("port VID %s, was not found (probably port was removed/splitted) and will remove from counters now", - sai_serialize_object_id(vid).c_str()); - - op = DEL_COMMAND; + if (fromAsicChannel) + { + SWSS_LOG_ERROR("port VID %s, was not found (probably port was removed/splitted) and will remove from counters now", + sai_serialize_object_id(vid).c_str()); + } + else + { + SWSS_LOG_WARN("port VID %s, was not found (probably port was removed/splitted) and will remove from counters now", + sai_serialize_object_id(vid).c_str()); + } + effective_op = DEL_COMMAND; } - const auto values = kfvFieldsValues(kco); - - if (op == SET_COMMAND) + if (effective_op == SET_COMMAND) { m_manager->addCounter(vid, rid, groupName, values); + if (fromAsicChannel) + { + m_flexCounterTable->set(key, values); + } } - else if (op == DEL_COMMAND) + else if (effective_op == DEL_COMMAND) { + if (fromAsicChannel) + { + m_flexCounterTable->del(key); + } m_manager->removeCounter(vid, groupName); } else { SWSS_LOG_ERROR("unknown command: %s", op.c_str()); } + + if (fromAsicChannel) + { + sendApiResponse(SAI_COMMON_API_SET, SAI_STATUS_SUCCESS); + } + + return SAI_STATUS_SUCCESS; } void Syncd::syncUpdateRedisQuadEvent( diff --git a/syncd/Syncd.h b/syncd/Syncd.h index a19fcd972..06eb84a62 100644 --- a/syncd/Syncd.h +++ b/syncd/Syncd.h @@ -198,6 +198,18 @@ namespace syncd _In_ uint32_t attr_count, _In_ sai_attribute_t *attr_list); + sai_status_t processFlexCounterGroupEvent( + _In_ const std::string &key, + _In_ const std::string &op, + _In_ const std::vector &values, + _In_ bool fromAsicChannel=true); + + sai_status_t processFlexCounterEvent( + _In_ const std::string &key, + _In_ const std::string &op, + _In_ const std::vector &values, + _In_ bool fromAsicChannel=true); + private: // process quad oid sai_status_t processOidCreate( @@ -485,6 +497,8 @@ namespace syncd std::shared_ptr m_dbFlexCounter; std::shared_ptr m_flexCounter; std::shared_ptr m_flexCounterGroup; + std::shared_ptr m_flexCounterTable; + std::shared_ptr m_flexCounterGroupTable; std::shared_ptr m_notifications; diff --git a/syncd/tests/TestSyncdLib.cpp b/syncd/tests/TestSyncdLib.cpp index 241a307e2..e22bdbeb7 100644 --- a/syncd/tests/TestSyncdLib.cpp +++ b/syncd/tests/TestSyncdLib.cpp @@ -8,18 +8,31 @@ #include "TestSyncdLib.h" -void flushAsicDb() +void flushDb(std::string name) { SWSS_LOG_ENTER(); - auto db = std::make_shared("ASIC_DB", 0, true); + auto db = std::make_shared(name, 0, true); auto reply = std::make_shared(db.get(), "FLUSHALL", REDIS_REPLY_STATUS); reply->checkStatusOK(); - SWSS_LOG_NOTICE("Flushed ASIC DB"); + SWSS_LOG_NOTICE("Flushed %s", name.c_str()); } +void flushAsicDb() +{ + SWSS_LOG_ENTER(); + + flushDb("ASIC_DB"); +} + +void flushFlexCounterDb() +{ + SWSS_LOG_ENTER(); + + flushDb("FLEX_COUNTER_DB"); +} void sendSyncdShutdownNotification() { SWSS_LOG_ENTER(); diff --git a/syncd/tests/TestSyncdLib.h b/syncd/tests/TestSyncdLib.h index 99d27a8b4..edf142eee 100644 --- a/syncd/tests/TestSyncdLib.h +++ b/syncd/tests/TestSyncdLib.h @@ -1,4 +1,5 @@ #pragma once void flushAsicDb(); +void flushFlexCounterDb(); void sendSyncdShutdownNotification(); diff --git a/syncd/tests/TestSyncdMlnx.cpp b/syncd/tests/TestSyncdMlnx.cpp index 457f621a9..b2f625518 100644 --- a/syncd/tests/TestSyncdMlnx.cpp +++ b/syncd/tests/TestSyncdMlnx.cpp @@ -11,7 +11,9 @@ #include #include +#include +#include "meta/sai_serialize.h" #include "Sai.h" #include "Syncd.h" #include "MetadataLogger.h" @@ -102,6 +104,9 @@ class SyncdMlnxTest : public ::testing::Test flushAsicDb(); + // flush FLEX COUNTER DB + flushFlexCounterDb(); + // start syncd worker m_worker = std::make_shared(syncdMlnxWorkerThread); @@ -138,6 +143,10 @@ class SyncdMlnxTest : public ::testing::Test status = m_sairedis->create(SAI_OBJECT_TYPE_SWITCH, &m_switchId, SAI_NULL_OBJECT_ID, 1, &attr); ASSERT_EQ(status, SAI_STATUS_SUCCESS); + + auto db = std::make_shared("FLEX_COUNTER_DB", 0); + m_flexCounterGroupTable = std::make_shared(db.get(), "FLEX_COUNTER_GROUP_TABLE"); + m_flexCounterTable = std::make_shared(db.get(), "FLEX_COUNTER_TABLE"); } virtual void TearDown() override @@ -158,6 +167,8 @@ class SyncdMlnxTest : public ::testing::Test protected: std::shared_ptr m_worker; std::shared_ptr m_sairedis; + std::shared_ptr m_flexCounterGroupTable; + std::shared_ptr m_flexCounterTable; sai_object_id_t m_switchId = SAI_NULL_OBJECT_ID; }; @@ -248,6 +259,102 @@ TEST_F(SyncdMlnxTest, portBulkAddRemove) ASSERT_EQ(statusList.at(i), SAI_STATUS_SUCCESS); } + // Counter operations based on the created port + // 1. Enable counter polling for port stat counter group + sai_redis_flex_counter_group_parameter_t flexCounterGroupParam; + + std::string group("PORT_STAT_COUNTER"); + std::string poll_interval = "10000"; + std::string stats_mode = "STATS_MODE_READ"; + std::string operation = "enable"; + + flexCounterGroupParam.counter_group_name.list = (int8_t*)const_cast(group.c_str()); + flexCounterGroupParam.counter_group_name.count = (uint32_t)group.length(); + flexCounterGroupParam.poll_interval.list = (int8_t*)const_cast(poll_interval.c_str()); + flexCounterGroupParam.poll_interval.count = (uint32_t)poll_interval.length(); + flexCounterGroupParam.plugin_name.list = nullptr; + flexCounterGroupParam.plugin_name.count = 0; + flexCounterGroupParam.plugins.list = nullptr; + flexCounterGroupParam.plugins.count = 0; + flexCounterGroupParam.stats_mode.list = (int8_t*)const_cast(stats_mode.c_str()); + flexCounterGroupParam.stats_mode.count = (uint32_t)stats_mode.length(); + flexCounterGroupParam.operation.list = (int8_t*)const_cast(operation.c_str());; + flexCounterGroupParam.operation.count = (uint32_t)operation.length(); + + attr.id = SAI_REDIS_SWITCH_ATTR_FLEX_COUNTER_GROUP; + attr.value.ptr = (void*)&flexCounterGroupParam; + + status = m_sairedis->set(SAI_OBJECT_TYPE_SWITCH, SAI_NULL_OBJECT_ID, &attr); + ASSERT_EQ(status, SAI_STATUS_SUCCESS); + + std::vector fvVector, fvVectorExpected; + ASSERT_TRUE(m_flexCounterGroupTable->get("PORT_STAT_COUNTER", fvVector)); + fvVectorExpected.emplace_back(POLL_INTERVAL_FIELD, poll_interval); + fvVectorExpected.emplace_back(STATS_MODE_FIELD, stats_mode); + fvVectorExpected.emplace_back(FLEX_COUNTER_STATUS_FIELD, operation); + ASSERT_EQ(fvVectorExpected, fvVector); + fvVectorExpected.clear(); + fvVector.clear(); + + // 2. Start counter polling for the port just created + // Try with a bad key first + sai_redis_flex_counter_parameter_t flexCounterParam; + std::string key = "PORT_STAT_COUNTER"; + std::string counters = "SAI_PORT_STAT_IF_IN_OCTETS"; + std::string counter_field_name = "PORT_COUNTER_ID_LIST"; + + flexCounterParam.counter_key.list = (int8_t*)const_cast(key.c_str()); + flexCounterParam.counter_key.count = (uint32_t)key.length(); + flexCounterParam.counter_ids.list = (int8_t*)const_cast(counters.c_str()); + flexCounterParam.counter_ids.count = (uint32_t)counters.length(); + flexCounterParam.counter_field_name.list = (int8_t*)const_cast(counter_field_name.c_str()); + flexCounterParam.counter_field_name.count = (uint32_t)counter_field_name.length(); + flexCounterParam.stats_mode.list = nullptr; + flexCounterParam.stats_mode.count = 0; + + attr.id = SAI_REDIS_SWITCH_ATTR_FLEX_COUNTER; + attr.value.ptr = (void*)&flexCounterParam; + + status = m_sairedis->set(SAI_OBJECT_TYPE_SWITCH, SAI_NULL_OBJECT_ID, &attr); + ASSERT_EQ(status, SAI_STATUS_FAILURE); + ASSERT_FALSE(m_flexCounterTable->get(key, fvVector)); + + // Try with a good key + key = "PORT_STAT_COUNTER:" + sai_serialize_object_id(oidList[0]); + flexCounterParam.counter_key.list = (int8_t*)const_cast(key.c_str()); + flexCounterParam.counter_key.count = (uint32_t)key.length(); + status = m_sairedis->set(SAI_OBJECT_TYPE_SWITCH, SAI_NULL_OBJECT_ID, &attr); + ASSERT_EQ(status, SAI_STATUS_SUCCESS); + + ASSERT_TRUE(m_flexCounterTable->get(key, fvVector)); + fvVectorExpected.emplace_back(counter_field_name, counters); + ASSERT_EQ(fvVectorExpected, fvVector); + + flexCounterParam.counter_ids.list = nullptr; + flexCounterParam.counter_ids.count = 0; + flexCounterParam.counter_field_name.list = nullptr; + flexCounterParam.counter_field_name.count = 0; + + // 3. Stop counter polling for the port + status = m_sairedis->set(SAI_OBJECT_TYPE_SWITCH, SAI_NULL_OBJECT_ID, &attr); + ASSERT_EQ(status, SAI_STATUS_SUCCESS); + ASSERT_FALSE(m_flexCounterTable->get(key, fvVector)); + + // 4. Disable counter polling for the group + flexCounterGroupParam.poll_interval.list = nullptr; + flexCounterGroupParam.poll_interval.count = 0; + flexCounterGroupParam.stats_mode.list = nullptr; + flexCounterGroupParam.stats_mode.count = 0; + flexCounterGroupParam.operation.list = nullptr; + flexCounterGroupParam.operation.count = 0; + + attr.id = SAI_REDIS_SWITCH_ATTR_FLEX_COUNTER_GROUP; + attr.value.ptr = (void*)&flexCounterGroupParam; + + status = m_sairedis->set(SAI_OBJECT_TYPE_SWITCH, SAI_NULL_OBJECT_ID, &attr); + ASSERT_EQ(status, SAI_STATUS_SUCCESS); + ASSERT_FALSE(m_flexCounterTable->get(key, fvVector)); + // Validate port bulk remove status = m_sairedis->bulkRemove( SAI_OBJECT_TYPE_PORT, portCount, oidList.data(), diff --git a/tests/aspell.en.pws b/tests/aspell.en.pws index 256c8ae9d..b801d57e5 100644 --- a/tests/aspell.en.pws +++ b/tests/aspell.en.pws @@ -82,6 +82,7 @@ SAs SCs SDK SGs +SHA SONiC SRC STP From a1b89c3c37b2fe1568974cd76fd62ce7f29d548f Mon Sep 17 00:00:00 2001 From: Ze Gan Date: Wed, 3 Apr 2024 20:46:56 +0800 Subject: [PATCH 13/32] DASH SAI support for build chain of syncd (#1366) Add an option to link the dash SAI for syncd. Signed-off-by: Ze Gan --- configure.ac | 5 +++++ debian/rules | 3 +++ syncd/Makefile.am | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/configure.ac b/configure.ac index 51c269d3e..4c601e0fe 100644 --- a/configure.ac +++ b/configure.ac @@ -41,6 +41,11 @@ AC_ARG_WITH(sai, esac]) AM_CONDITIONAL(SAIVS, test x$sai = xvs) +AC_ARG_WITH(dashsai, + [ --with-dashsai compiling against DASH SAI], + [AM_CONDITIONAL(DASHSAI, true)], + [AM_CONDITIONAL(DASHSAI, false)]) + AC_ARG_WITH(swss-common-inc, [ --with-swss-common-inc=DIR prefix where swss-common includes are installed], diff --git a/debian/rules b/debian/rules index 2acdf6e61..f8df60575 100755 --- a/debian/rules +++ b/debian/rules @@ -37,6 +37,9 @@ endif ifneq ($(filter syncd,$(DEB_BUILD_PROFILES)),) ifneq ($(filter vs,$(DEB_BUILD_PROFILES)),) configure_opts += --with-sai=vs +ifneq ($(filter dashsai,$(DEB_BUILD_PROFILES)),) +configure_opts += --with-dashsai +endif endif else configure_opts += --disable-syncd diff --git a/syncd/Makefile.am b/syncd/Makefile.am index 4982ea16c..155b2f19c 100644 --- a/syncd/Makefile.am +++ b/syncd/Makefile.am @@ -3,7 +3,12 @@ SUBDIRS = . tests AM_CXXFLAGS = $(SAIINC) -I$(top_srcdir)/lib -I$(top_srcdir)/vslib if SAIVS +if DASHSAI +SAILIB = -lsai +EXTRA_LIBSAI_LDFLAGS += -lprotobuf -lpiprotobuf -lpiprotogrpc -lgrpc++ +else SAILIB=-L$(top_srcdir)/vslib/.libs -lsaivs +endif else SAILIB=-lsai endif From d9ba01b52392849013d5b99a99d60580702d527b Mon Sep 17 00:00:00 2001 From: Saikrishna Arcot Date: Thu, 4 Apr 2024 11:43:50 -0700 Subject: [PATCH 14/32] Update ip commands for MACsec for Bookworm (#1368) * Update ip commands for MACsec for Bookworm Bookworm's iproute2 has built-in support for configuring MACsec with XPN ciphers. Unfortunately, the syntax is slightly different, which means changes are needed for this to work on Bookworm. Update the iproute2 commands run for Bookworm. This does mean compatibility with Bullseye will break. Signed-off-by: Saikrishna Arcot * Add more test Signed-off-by: Ze Gan --------- Signed-off-by: Saikrishna Arcot Signed-off-by: Ze Gan Co-authored-by: Ze Gan --- unittest/vslib/TestMACsecManager.cpp | 21 +++++++++++++++++++++ vslib/MACsecManager.cpp | 6 +++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/unittest/vslib/TestMACsecManager.cpp b/unittest/vslib/TestMACsecManager.cpp index bc1468b45..13135f145 100644 --- a/unittest/vslib/TestMACsecManager.cpp +++ b/unittest/vslib/TestMACsecManager.cpp @@ -30,6 +30,27 @@ TEST(MACsecManager, create_macsec_ingress_sa) manager.create_macsec_ingress_sa(attr); } +TEST(MACsecManager, create_macsec_egress_sa) +{ + // This is a system call that may not be valid in the test environment, + // So, this case is just for the testing coverage checking. + + MACsecManager manager; + + MACsecAttr attr; + attr.m_vethName = "eth0"; + attr.m_macsecName = "macsec_eth0"; + attr.m_sci = "02:42:ac:11:00:03"; + attr.m_an = 0; + attr.m_pn = 1; + attr.m_cipher = MACsecAttr::CIPHER_NAME_GCM_AES_XPN_128; + attr.m_ssci = 0x1; + attr.m_salt = ""; + attr.m_authKey = ""; + attr.m_sak = ""; + manager.create_macsec_egress_sa(attr); +} + TEST(MACsecManager, update_macsec_sa_pn) { // This is a system call that may not be valid in the test environment, diff --git a/vslib/MACsecManager.cpp b/vslib/MACsecManager.cpp index d6ff15637..b776c1c68 100644 --- a/vslib/MACsecManager.cpp +++ b/vslib/MACsecManager.cpp @@ -319,7 +319,7 @@ bool MACsecManager::update_macsec_sa_pn( ostream << " ssci " << attr.m_ssci; } - ostream << " pn " << pn; + ostream << ( attr.is_xpn() ? " xpn " : " pn " ) << pn; SWSS_LOG_NOTICE("%s", ostream.str().c_str()); @@ -447,7 +447,7 @@ bool MACsecManager::create_macsec_egress_sa( << shellquote(attr.m_macsecName) << " tx sa " << attr.m_an - << " pn " + << ( attr.is_xpn() ? " xpn " : " pn ") << attr.m_pn << ( attr.is_xpn() ? " ssci " : "" ) << ( attr.is_xpn() ? std::to_string(attr.m_ssci) : "" ) @@ -484,7 +484,7 @@ bool MACsecManager::create_macsec_ingress_sa( << attr.m_sci << " sa " << attr.m_an - << " pn " + << ( attr.is_xpn() ? " xpn " : " pn " ) << attr.m_pn << ( attr.is_xpn() ? " ssci " : "" ) << ( attr.is_xpn() ? std::to_string(attr.m_ssci) : "" ) From be47489f66371b861e393d25f57f3ef26bddb0df Mon Sep 17 00:00:00 2001 From: Saikrishna Arcot Date: Fri, 12 Apr 2024 10:15:03 -0500 Subject: [PATCH 15/32] Add Bookworm build to PR checks (#1371) * Add Bookworm build to PR checks Add a step to verify the build for Bookworm for amd64, armhf, and arm64. Signed-off-by: Saikrishna Arcot * Enable unit tests Signed-off-by: Saikrishna Arcot * Manually start and stop rsyslogd For Bookworm, the init.d service file for rsyslogd is removed, and the only script to start and stop rsyslogd is the systemd service file. However, that can only be used if systemd is being used as the init manager, which isn't the case for our docker containers. As an alternative, manually start and stop rsyslogd ourselves. Signed-off-by: Saikrishna Arcot --------- Signed-off-by: Saikrishna Arcot --- .azure-pipelines/build-template.yml | 5 ++-- azure-pipelines.yml | 36 +++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/build-template.yml b/.azure-pipelines/build-template.yml index 3e5a1417a..9ba2d9531 100644 --- a/.azure-pipelines/build-template.yml +++ b/.azure-pipelines/build-template.yml @@ -98,7 +98,7 @@ jobs: sudo mkdir -m 755 /var/run/sswsyncd sudo apt-get install -y rsyslog - sudo service rsyslog start + sudo rsyslogd cat /etc/apt/sources.list dpkg --list | grep libnl @@ -167,7 +167,8 @@ jobs: displayName: "Compile sonic sairedis with coverage enabled" - script: | sudo cp azsyslog.conf /etc/rsyslog.conf - sudo service rsyslog restart + sudo killall rsyslogd + sudo rsyslogd displayName: "Update rsyslog.conf" - ${{ if eq(parameters.run_unit_test, true) }}: - script: | diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0a7bf62d5..79f3989ae 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -101,6 +101,42 @@ stages: syslog_artifact_name: sonic-sairedis.syslog.arm64 debian_version: ${{ parameters.debian_version }} +- stage: BuildBookworm + dependsOn: BuildArm + condition: succeeded('BuildArm') + jobs: + - template: .azure-pipelines/build-template.yml + parameters: + arch: amd64 + sonic_slave: sonic-slave-bookworm + swss_common_artifact_name: sonic-swss-common-bookworm + artifact_name: sonic-sairedis-bookworm + syslog_artifact_name: sonic-sairedis-bookworm.syslog + run_unit_test: true + debian_version: ${{ parameters.debian_version }} + + - template: .azure-pipelines/build-template.yml + parameters: + arch: armhf + timeout: 180 + pool: sonicbld-armhf + sonic_slave: sonic-slave-bookworm-armhf + swss_common_artifact_name: sonic-swss-common-bookworm.armhf + artifact_name: sonic-sairedis-bookworm.armhf + syslog_artifact_name: sonic-sairedis-bookworm.syslog.armhf + debian_version: ${{ parameters.debian_version }} + + - template: .azure-pipelines/build-template.yml + parameters: + arch: arm64 + timeout: 180 + pool: sonicbld-arm64 + sonic_slave: sonic-slave-bookworm-arm64 + swss_common_artifact_name: sonic-swss-common-bookworm.arm64 + artifact_name: sonic-sairedis-bookworm.arm64 + syslog_artifact_name: sonic-sairedis-bookworm.syslog.arm64 + debian_version: ${{ parameters.debian_version }} + - stage: BuildSwss dependsOn: Build condition: succeeded('Build') From c41a0cb96d474bea3328200b407471c497aac1a7 Mon Sep 17 00:00:00 2001 From: Keshav Gupta Date: Mon, 15 Apr 2024 22:25:38 +0530 Subject: [PATCH 16/32] SAI submodule update to bring saithrift changes for syncd bookworm (#1370) * SAI submodule update to bring saithrift changes for bookworm syncd Signed-off-by: Keshav Gupta * Fix build issues Signed-off-by: Keshav Gupta * Add tests for code coverage Signed-off-by: Keshav Gupta --------- Signed-off-by: Keshav Gupta Co-authored-by: Saikrishna Arcot --- SAI | 2 +- lib/sai_redis_dash_eni.cpp | 2 ++ unittest/lib/test_sai_redis_dash_eni.cpp | 3 +++ unittest/vslib/test_sai_vs_dash_eni.cpp | 3 +++ vslib/sai_vs_dash_eni.cpp | 2 ++ 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/SAI b/SAI index c7a49cce5..bc1d6ec90 160000 --- a/SAI +++ b/SAI @@ -1 +1 @@ -Subproject commit c7a49cce5646bd6793e36b4cc3418dac4ae81ac9 +Subproject commit bc1d6ec90fb462c5171dbaa1aedcab1aac890ce9 diff --git a/lib/sai_redis_dash_eni.cpp b/lib/sai_redis_dash_eni.cpp index 9f21bda71..54a3a8fc3 100644 --- a/lib/sai_redis_dash_eni.cpp +++ b/lib/sai_redis_dash_eni.cpp @@ -5,6 +5,7 @@ REDIS_BULK_CREATE_ENTRY_EX(ENI_ETHER_ADDRESS_MAP_ENTRY, eni_ether_address_map_en REDIS_BULK_REMOVE_ENTRY_EX(ENI_ETHER_ADDRESS_MAP_ENTRY, eni_ether_address_map_entry, eni_ether_address_map_entries); REDIS_GENERIC_QUAD(ENI, eni); +REDIS_GENERIC_STATS(ENI, eni); REDIS_BULK_CREATE(ENI, enis); REDIS_BULK_REMOVE(ENI, enis); @@ -14,6 +15,7 @@ const sai_dash_eni_api_t redis_dash_eni_api = { redis_bulk_remove_eni_ether_address_map_entries, REDIS_GENERIC_QUAD_API(eni) + REDIS_GENERIC_STATS_API(eni) redis_bulk_create_enis, redis_bulk_remove_enis, }; diff --git a/unittest/lib/test_sai_redis_dash_eni.cpp b/unittest/lib/test_sai_redis_dash_eni.cpp index 5949762c6..4dcac45a4 100644 --- a/unittest/lib/test_sai_redis_dash_eni.cpp +++ b/unittest/lib/test_sai_redis_dash_eni.cpp @@ -28,6 +28,9 @@ TEST(libsairedis, dash_eni) EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_eni(0)); EXPECT_NE(SAI_STATUS_SUCCESS, api->set_eni_attribute(0,0)); EXPECT_NE(SAI_STATUS_SUCCESS, api->get_eni_attribute(0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_eni_stats(0,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_eni_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_eni_stats(0,0,0)); EXPECT_NE(SAI_STATUS_SUCCESS, api->create_enis(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_enis(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); } diff --git a/unittest/vslib/test_sai_vs_dash_eni.cpp b/unittest/vslib/test_sai_vs_dash_eni.cpp index c40c7d724..4b2dd061f 100644 --- a/unittest/vslib/test_sai_vs_dash_eni.cpp +++ b/unittest/vslib/test_sai_vs_dash_eni.cpp @@ -28,6 +28,9 @@ TEST(libsaivs, dash_eni) EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_eni(0)); EXPECT_NE(SAI_STATUS_SUCCESS, api->set_eni_attribute(0,0)); EXPECT_NE(SAI_STATUS_SUCCESS, api->get_eni_attribute(0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_eni_stats(0,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_eni_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_eni_stats(0,0,0)); EXPECT_NE(SAI_STATUS_SUCCESS, api->create_enis(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_enis(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); } diff --git a/vslib/sai_vs_dash_eni.cpp b/vslib/sai_vs_dash_eni.cpp index e79dad959..0971bbff3 100644 --- a/vslib/sai_vs_dash_eni.cpp +++ b/vslib/sai_vs_dash_eni.cpp @@ -5,6 +5,7 @@ VS_BULK_CREATE_ENTRY_EX(ENI_ETHER_ADDRESS_MAP_ENTRY, eni_ether_address_map_entry VS_BULK_REMOVE_ENTRY_EX(ENI_ETHER_ADDRESS_MAP_ENTRY, eni_ether_address_map_entry, eni_ether_address_map_entries); VS_GENERIC_QUAD(ENI, eni); +VS_GENERIC_STATS(ENI, eni); VS_BULK_CREATE(ENI, enis); VS_BULK_REMOVE(ENI, enis); @@ -14,6 +15,7 @@ const sai_dash_eni_api_t vs_dash_eni_api = { vs_bulk_remove_eni_ether_address_map_entries, VS_GENERIC_QUAD_API(eni) + VS_GENERIC_STATS_API(eni) vs_bulk_create_enis, vs_bulk_remove_enis, }; From 73ada8d57281e700336ce70fb893cec005466fcd Mon Sep 17 00:00:00 2001 From: Saikrishna Arcot Date: Wed, 17 Apr 2024 10:24:01 -0500 Subject: [PATCH 17/32] Fix SSCI parameter when creating MACsec tunnels on Bookworm (#1372) * Fix SSCI parameter when creating MACsec tunnels on Bookworm While Bookworm's iproute2 has built-in support for the MACsec XPN protocols, the SSCI argument is passed in in a different way compared to the patch that we had. Instead of taking in a number, a hex string is taken in instead. Update the code in sairedis to pass in a hex string for SSCI instead of a number. Signed-off-by: Saikrishna Arcot * Don't create a variable, since it won't be needed. Signed-off-by: Saikrishna Arcot * Add iproute to aspell Signed-off-by: Saikrishna Arcot * Add more tests for loadMACsecAttrFromMACsecSA The tests are not that great, but they at least make sure it goes through most of the function. Signed-off-by: Saikrishna Arcot --------- Signed-off-by: Saikrishna Arcot --- tests/aspell.en.pws | 1 + unittest/vslib/TestSwitchStateBaseMACsec.cpp | 97 +++++++++++++++++++- vslib/MACsecAttr.h | 4 +- vslib/MACsecManager.cpp | 4 +- vslib/SwitchStateBaseMACsec.cpp | 18 ++-- 5 files changed, 110 insertions(+), 14 deletions(-) diff --git a/tests/aspell.en.pws b/tests/aspell.en.pws index b801d57e5..d81392265 100644 --- a/tests/aspell.en.pws +++ b/tests/aspell.en.pws @@ -249,6 +249,7 @@ IPG ipgs IPGs ipmc +iproute IPv isobjectid isoidattribute diff --git a/unittest/vslib/TestSwitchStateBaseMACsec.cpp b/unittest/vslib/TestSwitchStateBaseMACsec.cpp index 5a55bc3d7..9ab4849ce 100644 --- a/unittest/vslib/TestSwitchStateBaseMACsec.cpp +++ b/unittest/vslib/TestSwitchStateBaseMACsec.cpp @@ -20,8 +20,11 @@ TEST(SwitchStateBase, loadMACsecAttrFromMACsecSA) sai_attribute_t attr; std::vector attrs; MACsecAttr macsecAttr; + sai_attribute_t attrList[6]; + sai_attribute_t attrListXpn[8]; attr.id = SAI_MACSEC_SC_ATTR_FLOW_ID; + attr.value.oid = 0; attrs.push_back(attr); attr.id = SAI_MACSEC_SC_ATTR_MACSEC_SCI; attrs.push_back(attr); @@ -41,11 +44,101 @@ TEST(SwitchStateBase, loadMACsecAttrFromMACsecSA) static_cast(attrs.size()), attrs.data())); - attr.id = SAI_MACSEC_SA_ATTR_SC_ID; + attr.id = SAI_MACSEC_SC_ATTR_FLOW_ID; attr.value.oid = 0; - ss.loadMACsecAttrFromMACsecSA(0, 1 , &attr, macsecAttr); + attrs.push_back(attr); + attr.id = SAI_MACSEC_SC_ATTR_MACSEC_SCI; + attrs.push_back(attr); + attr.id = SAI_MACSEC_SC_ATTR_ENCRYPTION_ENABLE; + attrs.push_back(attr); + attr.id = SAI_MACSEC_SC_ATTR_MACSEC_CIPHER_SUITE; + attr.value.s32 = sai_macsec_cipher_suite_t::SAI_MACSEC_CIPHER_SUITE_GCM_AES_XPN_256; + attrs.push_back(attr); + attr.id = SAI_MACSEC_SC_ATTR_MACSEC_EXPLICIT_SCI_ENABLE; + attrs.push_back(attr); + EXPECT_EQ( + SAI_STATUS_SUCCESS, + ss.create_internal( + SAI_OBJECT_TYPE_MACSEC_SC, + "oid:0x1", + 0, + static_cast(attrs.size()), + attrs.data())); + + ss.m_macsecFlowPortMap[0] = 0; + auto eq = std::make_shared(std::make_shared()); + int s = socket(AF_INET, SOCK_DGRAM, 0); + int fd = socket(AF_INET, SOCK_DGRAM, 0); + auto hii = std::make_shared(0, s, fd, "tap", 0, eq); + ss.m_hostif_info_map["tap"] = hii; + + memset(attrList, 0, sizeof(attrList)); + attrList[0].id = SAI_MACSEC_SA_ATTR_SC_ID; + attrList[0].value.oid = 0; + attrList[1].id = SAI_MACSEC_SA_ATTR_MACSEC_DIRECTION; + attrList[1].value.s32 = sai_macsec_direction_t::SAI_MACSEC_DIRECTION_INGRESS; + attrList[2].id = SAI_MACSEC_SA_ATTR_AN; + attrList[2].value.s32 = 0; + attrList[3].id = SAI_MACSEC_SA_ATTR_SAK; + attrList[4].id = SAI_MACSEC_SA_ATTR_AUTH_KEY; + attrList[5].id = SAI_MACSEC_SA_ATTR_MINIMUM_INGRESS_XPN; + EXPECT_EQ(SAI_STATUS_SUCCESS, ss.loadMACsecAttrFromMACsecSA(0, sizeof(attrList)/sizeof(attrList[0]), attrList, macsecAttr)); + + EXPECT_EQ(macsecAttr.m_cipher, MACsecAttr::CIPHER_NAME_GCM_AES_128); + EXPECT_EQ(macsecAttr.m_direction, sai_macsec_direction_t::SAI_MACSEC_DIRECTION_INGRESS); + + memset(attrList, 0, sizeof(attrList)); + attrList[0].id = SAI_MACSEC_SA_ATTR_SC_ID; + attrList[0].value.oid = 0; + attrList[1].id = SAI_MACSEC_SA_ATTR_MACSEC_DIRECTION; + attrList[1].value.s32 = sai_macsec_direction_t::SAI_MACSEC_DIRECTION_EGRESS; + attrList[2].id = SAI_MACSEC_SA_ATTR_AN; + attrList[2].value.s32 = 0; + attrList[3].id = SAI_MACSEC_SA_ATTR_SAK; + attrList[4].id = SAI_MACSEC_SA_ATTR_AUTH_KEY; + attrList[5].id = SAI_MACSEC_SA_ATTR_CONFIGURED_EGRESS_XPN; + EXPECT_EQ(SAI_STATUS_SUCCESS, ss.loadMACsecAttrFromMACsecSA(0, sizeof(attrList)/sizeof(attrList[0]), attrList, macsecAttr)); EXPECT_EQ(macsecAttr.m_cipher, MACsecAttr::CIPHER_NAME_GCM_AES_128); + EXPECT_EQ(macsecAttr.m_direction, sai_macsec_direction_t::SAI_MACSEC_DIRECTION_EGRESS); + + memset(attrListXpn, 0, sizeof(attrListXpn)); + attrListXpn[0].id = SAI_MACSEC_SA_ATTR_SC_ID; + attrListXpn[0].value.oid = 1; + attrListXpn[1].id = SAI_MACSEC_SA_ATTR_MACSEC_DIRECTION; + attrListXpn[1].value.s32 = sai_macsec_direction_t::SAI_MACSEC_DIRECTION_INGRESS; + attrListXpn[2].id = SAI_MACSEC_SA_ATTR_AN; + attrListXpn[2].value.s32 = 0; + attrListXpn[3].id = SAI_MACSEC_SA_ATTR_SAK; + attrListXpn[4].id = SAI_MACSEC_SA_ATTR_AUTH_KEY; + attrListXpn[5].id = SAI_MACSEC_SA_ATTR_MINIMUM_INGRESS_XPN; + attrListXpn[6].id = SAI_MACSEC_SA_ATTR_MACSEC_SSCI; + attrListXpn[6].value.u32 = 0x23456789; + attrListXpn[7].id = SAI_MACSEC_SA_ATTR_SALT; + EXPECT_EQ(SAI_STATUS_SUCCESS, ss.loadMACsecAttrFromMACsecSA(0, sizeof(attrListXpn)/sizeof(attrListXpn[0]), attrListXpn, macsecAttr)); + + EXPECT_EQ(macsecAttr.m_cipher, MACsecAttr::CIPHER_NAME_GCM_AES_XPN_256); + EXPECT_EQ(macsecAttr.m_direction, sai_macsec_direction_t::SAI_MACSEC_DIRECTION_INGRESS); + EXPECT_EQ(macsecAttr.m_ssci, "23456789"); + + memset(attrListXpn, 0, sizeof(attrListXpn)); + attrListXpn[0].id = SAI_MACSEC_SA_ATTR_SC_ID; + attrListXpn[0].value.oid = 1; + attrListXpn[1].id = SAI_MACSEC_SA_ATTR_MACSEC_DIRECTION; + attrListXpn[1].value.s32 = sai_macsec_direction_t::SAI_MACSEC_DIRECTION_EGRESS; + attrListXpn[2].id = SAI_MACSEC_SA_ATTR_AN; + attrListXpn[2].value.s32 = 0; + attrListXpn[3].id = SAI_MACSEC_SA_ATTR_SAK; + attrListXpn[4].id = SAI_MACSEC_SA_ATTR_AUTH_KEY; + attrListXpn[5].id = SAI_MACSEC_SA_ATTR_CONFIGURED_EGRESS_XPN; + attrListXpn[6].id = SAI_MACSEC_SA_ATTR_MACSEC_SSCI; + attrListXpn[6].value.u32 = 0x23456789; + attrListXpn[7].id = SAI_MACSEC_SA_ATTR_SALT; + EXPECT_EQ(SAI_STATUS_SUCCESS, ss.loadMACsecAttrFromMACsecSA(0, sizeof(attrListXpn)/sizeof(attrListXpn[0]), attrListXpn, macsecAttr)); + + EXPECT_EQ(macsecAttr.m_cipher, MACsecAttr::CIPHER_NAME_GCM_AES_XPN_256); + EXPECT_EQ(macsecAttr.m_direction, sai_macsec_direction_t::SAI_MACSEC_DIRECTION_EGRESS); + EXPECT_EQ(macsecAttr.m_ssci, "23456789"); } TEST(SwitchStateBase, retryCreateIngressMaCsecSAs) diff --git a/vslib/MACsecAttr.h b/vslib/MACsecAttr.h index 37f6493c9..106b7b07b 100644 --- a/vslib/MACsecAttr.h +++ b/vslib/MACsecAttr.h @@ -7,10 +7,8 @@ namespace saivs { - using macsec_sci_t = std::string; using macsec_an_t = std::uint16_t; using macsec_pn_t = std::uint64_t; - using macsec_ssci_t = std::uint32_t; struct MACsecAttr { @@ -52,11 +50,11 @@ namespace saivs std::string m_authKey; std::string m_sak; std::string m_sci; + std::string m_ssci; std::string m_salt; macsec_an_t m_an; macsec_pn_t m_pn; - macsec_ssci_t m_ssci; bool m_sendSci; bool m_encryptionEnable; diff --git a/vslib/MACsecManager.cpp b/vslib/MACsecManager.cpp index b776c1c68..6688bad41 100644 --- a/vslib/MACsecManager.cpp +++ b/vslib/MACsecManager.cpp @@ -450,7 +450,7 @@ bool MACsecManager::create_macsec_egress_sa( << ( attr.is_xpn() ? " xpn " : " pn ") << attr.m_pn << ( attr.is_xpn() ? " ssci " : "" ) - << ( attr.is_xpn() ? std::to_string(attr.m_ssci) : "" ) + << ( attr.is_xpn() ? attr.m_ssci : "" ) << ( attr.is_xpn() ? " salt " : "" ) << ( attr.is_xpn() ? attr.m_salt : "" ) << " on key " @@ -487,7 +487,7 @@ bool MACsecManager::create_macsec_ingress_sa( << ( attr.is_xpn() ? " xpn " : " pn " ) << attr.m_pn << ( attr.is_xpn() ? " ssci " : "" ) - << ( attr.is_xpn() ? std::to_string(attr.m_ssci) : "" ) + << ( attr.is_xpn() ? attr.m_ssci : "" ) << ( attr.is_xpn() ? " salt " : "" ) << ( attr.is_xpn() ? attr.m_salt : "" ) << " on key " diff --git a/vslib/SwitchStateBaseMACsec.cpp b/vslib/SwitchStateBaseMACsec.cpp index bdc433951..e08f3f30a 100644 --- a/vslib/SwitchStateBaseMACsec.cpp +++ b/vslib/SwitchStateBaseMACsec.cpp @@ -13,6 +13,7 @@ #include #include #include +#include using namespace saivs; @@ -554,12 +555,7 @@ sai_status_t SwitchStateBase::loadMACsecAttrFromMACsecSC( std::stringstream sciHexStr; sciHexStr << std::setw(MACSEC_SCI_LENGTH) << std::setfill('0'); - -#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ - sciHexStr << std::hex << bswap_64(sci); -#else - sciHexStr << std::hex << sci; -#endif + sciHexStr << std::hex << htobe64(sci); macsecAttr.m_sci = sciHexStr.str(); @@ -708,7 +704,15 @@ sai_status_t SwitchStateBase::loadMACsecAttrFromMACsecSA( // The Linux kernel directly uses ssci to XOR with the salt that is network order, // So, this conversion is useful to convert SSCI from the host order to network order. - macsecAttr.m_ssci = htonl(attr->value.u32); + // + // Starting with Debian Bookworm (iproute2 6.1), ssci is interpreted as a hex string, + // so this needs to convert the ssci integer to a hex string, and doesn't need to change + // the encoding at this point. + std::stringstream ssciHexStr; + + ssciHexStr << std::hex << attr->value.u32; + + macsecAttr.m_ssci = ssciHexStr.str(); SAI_METADATA_GET_ATTR_BY_ID(attr, SAI_MACSEC_SA_ATTR_SALT, attrCount, attrList); From c3395e5d75933d961d6aaafb695753ae7ca3fe07 Mon Sep 17 00:00:00 2001 From: Shantanu Shrivastava <81131723+shanshri@users.noreply.github.com> Date: Thu, 25 Apr 2024 14:04:27 +0530 Subject: [PATCH 18/32] Add support for AMD-Pensando elba DSS (#1367) Signed-off-by: Shantanu Shrivastava Co-authored-by: Kamil Cudnik --- syncd/scripts/syncd_init_common.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/syncd/scripts/syncd_init_common.sh b/syncd/scripts/syncd_init_common.sh index b85819852..b67983300 100644 --- a/syncd/scripts/syncd_init_common.sh +++ b/syncd/scripts/syncd_init_common.sh @@ -99,6 +99,11 @@ function set_start_type() fi } +config_syncd_pensando() +{ + CMD_ARGS+=" -l" +} + config_syncd_cisco_8000() { export BASE_OUTPUT_DIR=/opt/cisco/silicon-one @@ -460,6 +465,8 @@ config_syncd() config_syncd_nvidia_bluefield elif [ "$SONIC_ASIC_TYPE" == "xsight" ]; then config_syncd_xsight + elif [ "$SONIC_ASIC_TYPE" == "pensando" ]; then + config_syncd_pensando else echo "Unknown ASIC type $SONIC_ASIC_TYPE" exit 1 From 8a0cc25989fb5bd005bde493190faac6bc84a86d Mon Sep 17 00:00:00 2001 From: Stephen Sun <5379172+stephenxs@users.noreply.github.com> Date: Fri, 3 May 2024 06:44:28 +0800 Subject: [PATCH 19/32] Support ASIC/SDK health event (#1340) * ASIC/SDK health event Signed-off-by: Stephen Sun * Fix check error Signed-off-by: Stephen Sun * Fix UT error Signed-off-by: Stephen Sun * Improve coverage Signed-off-by: Stephen Sun * Fix review comments Signed-off-by: Stephen Sun --------- Signed-off-by: Stephen Sun --- lib/Switch.cpp | 5 + meta/Makefile.am | 1 + meta/Meta.cpp | 48 +++++++++ meta/Meta.h | 8 ++ meta/NotificationFactory.cpp | 4 + meta/NotificationSwitchAsicSdkHealthEvent.cpp | 74 ++++++++++++++ meta/NotificationSwitchAsicSdkHealthEvent.h | 38 ++++++++ meta/SaiSerialize.cpp | 97 ++++++++++++++++++- meta/sai_serialize.h | 33 +++++++ saiplayer/SaiPlayer.cpp | 14 +++ saiplayer/SaiPlayer.h | 8 ++ syncd/NotificationHandler.cpp | 19 ++++ syncd/NotificationHandler.h | 8 ++ syncd/NotificationProcessor.cpp | 51 ++++++++++ syncd/NotificationProcessor.h | 11 +++ syncd/SwitchNotifications.cpp | 13 +++ syncd/SwitchNotifications.h | 36 ++++++- syncd/Syncd.cpp | 1 + unittest/lib/TestSwitch.cpp | 9 +- unittest/meta/Makefile.am | 1 + unittest/meta/TestNotificationFactory.cpp | 19 ++++ ...stNotificationSwitchAsicSdkHealthEvent.cpp | 78 +++++++++++++++ unittest/syncd/TestNotificationHandler.cpp | 37 +++++++ unittest/syncd/TestNotificationProcessor.cpp | 18 ++++ vslib/Switch.cpp | 5 + 25 files changed, 631 insertions(+), 5 deletions(-) create mode 100644 meta/NotificationSwitchAsicSdkHealthEvent.cpp create mode 100644 meta/NotificationSwitchAsicSdkHealthEvent.h create mode 100644 unittest/meta/TestNotificationSwitchAsicSdkHealthEvent.cpp diff --git a/lib/Switch.cpp b/lib/Switch.cpp index 8c198e2f0..6777e747c 100644 --- a/lib/Switch.cpp +++ b/lib/Switch.cpp @@ -83,6 +83,11 @@ void Switch::updateNotifications( (sai_switch_state_change_notification_fn)attr.value.ptr; break; + case SAI_SWITCH_ATTR_SWITCH_ASIC_SDK_HEALTH_EVENT_NOTIFY: + m_switchNotifications.on_switch_asic_sdk_health_event = + (sai_switch_asic_sdk_health_event_notification_fn)attr.value.ptr; + break; + case SAI_SWITCH_ATTR_SHUTDOWN_REQUEST_NOTIFY: m_switchNotifications.on_switch_shutdown_request = (sai_switch_shutdown_request_notification_fn)attr.value.ptr; diff --git a/meta/Makefile.am b/meta/Makefile.am index 8947603ca..0a6ac1887 100644 --- a/meta/Makefile.am +++ b/meta/Makefile.am @@ -32,6 +32,7 @@ libsaimeta_la_SOURCES = \ NotificationNatEvent.cpp \ NotificationPortStateChange.cpp \ NotificationQueuePfcDeadlock.cpp \ + NotificationSwitchAsicSdkHealthEvent.cpp \ NotificationSwitchShutdownRequest.cpp \ NotificationSwitchStateChange.cpp \ NotificationBfdSessionStateChange.cpp \ diff --git a/meta/Meta.cpp b/meta/Meta.cpp index db9e6854e..29cfe771d 100644 --- a/meta/Meta.cpp +++ b/meta/Meta.cpp @@ -6513,6 +6513,54 @@ void Meta::meta_sai_on_switch_state_change( // we should not snoop switch_id, since switch id should be created directly by user } +void Meta::meta_sai_on_switch_asic_sdk_health_event( + _In_ sai_object_id_t switch_id, + _In_ sai_switch_asic_sdk_health_severity_t severity, + _In_ sai_timespec_t timestamp, + _In_ sai_switch_asic_sdk_health_category_t category, + _In_ sai_switch_health_data_t data, + _In_ const sai_u8_list_t description) +{ + SWSS_LOG_ENTER(); + + if (!sai_metadata_get_enum_value_name( + &sai_metadata_enum_sai_switch_asic_sdk_health_severity_t, + severity)) + { + SWSS_LOG_WARN("Switch ASIC/SDK health event severity value (%d) not found in sai_switch_asic_sdk_health_severity_t", + severity); + } + + if (!sai_metadata_get_enum_value_name( + &sai_metadata_enum_sai_switch_asic_sdk_health_category_t, + category)) + { + SWSS_LOG_WARN("Switch ASIC/SDK health event category value (%d) not found in sai_switch_asic_sdk_health_severity_t", + category); + } + + auto ot = objectTypeQuery(switch_id); + + if (ot != SAI_OBJECT_TYPE_SWITCH) + { + SWSS_LOG_WARN("switch_id %s is of type %s, but expected SAI_OBJECT_TYPE_SWITCH", + sai_serialize_object_id(switch_id).c_str(), + sai_serialize_object_type(ot).c_str()); + + return; + } + + sai_object_meta_key_t switch_meta_key = { .objecttype = ot , .objectkey = { .key = { .object_id = switch_id } } }; + + if (!m_saiObjectCollection.objectExists(switch_meta_key)) + { + SWSS_LOG_ERROR("switch_id %s don't exists in local database", + sai_serialize_object_id(switch_id).c_str()); + } + + // we should not snoop switch_id, since switch id should be created directly by user +} + void Meta::meta_sai_on_switch_shutdown_request( _In_ sai_object_id_t switch_id) { diff --git a/meta/Meta.h b/meta/Meta.h index a30fc53ff..f0dd36142 100644 --- a/meta/Meta.h +++ b/meta/Meta.h @@ -205,6 +205,14 @@ namespace saimeta _In_ sai_object_id_t switch_id, _In_ sai_switch_oper_status_t switch_oper_status); + void meta_sai_on_switch_asic_sdk_health_event( + _In_ sai_object_id_t switch_id, + _In_ sai_switch_asic_sdk_health_severity_t severity, + _In_ sai_timespec_t timestamp, + _In_ sai_switch_asic_sdk_health_category_t category, + _In_ sai_switch_health_data_t data, + _In_ const sai_u8_list_t description); + void meta_sai_on_switch_shutdown_request( _In_ sai_object_id_t switch_id); diff --git a/meta/NotificationFactory.cpp b/meta/NotificationFactory.cpp index 6381bd16b..0c9f95721 100644 --- a/meta/NotificationFactory.cpp +++ b/meta/NotificationFactory.cpp @@ -5,6 +5,7 @@ #include "NotificationQueuePfcDeadlock.h" #include "NotificationSwitchShutdownRequest.h" #include "NotificationSwitchStateChange.h" +#include "NotificationSwitchAsicSdkHealthEvent.h" #include "NotificationBfdSessionStateChange.h" #include "NotificationTwampSessionEvent.h" #include "NotificationPortHostTxReadyEvent.h" @@ -38,6 +39,9 @@ std::shared_ptr NotificationFactory::deserialize( if (name == SAI_SWITCH_NOTIFICATION_NAME_SWITCH_SHUTDOWN_REQUEST) return std::make_shared(serializedNotification); + if (name == SAI_SWITCH_NOTIFICATION_NAME_SWITCH_ASIC_SDK_HEALTH_EVENT) + return std::make_shared(serializedNotification); + if (name == SAI_SWITCH_NOTIFICATION_NAME_SWITCH_STATE_CHANGE) return std::make_shared(serializedNotification); diff --git a/meta/NotificationSwitchAsicSdkHealthEvent.cpp b/meta/NotificationSwitchAsicSdkHealthEvent.cpp new file mode 100644 index 000000000..ed6129052 --- /dev/null +++ b/meta/NotificationSwitchAsicSdkHealthEvent.cpp @@ -0,0 +1,74 @@ +#include "NotificationSwitchAsicSdkHealthEvent.h" + +#include "swss/logger.h" + +#include "sai_serialize.h" + +using namespace sairedis; + +NotificationSwitchAsicSdkHealthEvent::NotificationSwitchAsicSdkHealthEvent( + _In_ const std::string& serializedNotification): + Notification( + SAI_SWITCH_NOTIFICATION_TYPE_SWITCH_ASIC_SDK_HEALTH_EVENT, + serializedNotification) +{ + SWSS_LOG_ENTER(); + + sai_deserialize_switch_asic_sdk_health_event(serializedNotification, + m_switchId, + m_severity, + m_timestamp, + m_category, + m_healthData, + m_description); +} + +NotificationSwitchAsicSdkHealthEvent::~NotificationSwitchAsicSdkHealthEvent() +{ + SWSS_LOG_ENTER(); + + sai_deserialize_free_switch_asic_sdk_health_event(m_description); +} + +sai_object_id_t NotificationSwitchAsicSdkHealthEvent::getSwitchId() const +{ + SWSS_LOG_ENTER(); + + return m_switchId; +} + +sai_object_id_t NotificationSwitchAsicSdkHealthEvent::getAnyObjectId() const +{ + SWSS_LOG_ENTER(); + + return m_switchId; +} + +void NotificationSwitchAsicSdkHealthEvent::processMetadata( + _In_ std::shared_ptr meta) const +{ + SWSS_LOG_ENTER(); + + meta->meta_sai_on_switch_asic_sdk_health_event(m_switchId, + m_severity, + m_timestamp, + m_category, + m_healthData, + m_description); +} + +void NotificationSwitchAsicSdkHealthEvent::executeCallback( + _In_ const sai_switch_notifications_t& switchNotifications) const +{ + SWSS_LOG_ENTER(); + + if (switchNotifications.on_switch_asic_sdk_health_event) + { + switchNotifications.on_switch_asic_sdk_health_event(m_switchId, + m_severity, + m_timestamp, + m_category, + m_healthData, + m_description); + } +} diff --git a/meta/NotificationSwitchAsicSdkHealthEvent.h b/meta/NotificationSwitchAsicSdkHealthEvent.h new file mode 100644 index 000000000..c1330f7fc --- /dev/null +++ b/meta/NotificationSwitchAsicSdkHealthEvent.h @@ -0,0 +1,38 @@ +#pragma once + +#include "Notification.h" + +namespace sairedis +{ + class NotificationSwitchAsicSdkHealthEvent: + public Notification + { + public: + + NotificationSwitchAsicSdkHealthEvent( + _In_ const std::string& serializedNotification); + + virtual ~NotificationSwitchAsicSdkHealthEvent(); + + public: + + virtual sai_object_id_t getSwitchId() const override; + + virtual sai_object_id_t getAnyObjectId() const override; + + virtual void processMetadata( + _In_ std::shared_ptr meta) const override; + + virtual void executeCallback( + _In_ const sai_switch_notifications_t& switchNotifications) const override; + + private: + + sai_object_id_t m_switchId; + sai_switch_asic_sdk_health_severity_t m_severity; + sai_switch_asic_sdk_health_category_t m_category; + sai_timespec_t m_timestamp; + sai_switch_health_data_t m_healthData; + sai_u8_list_t m_description; + }; +} diff --git a/meta/SaiSerialize.cpp b/meta/SaiSerialize.cpp index a35c21fc7..67570a406 100644 --- a/meta/SaiSerialize.cpp +++ b/meta/SaiSerialize.cpp @@ -1131,6 +1131,41 @@ std::string sai_serialize_egress_drop_reason( return sai_serialize_enum(reason, &sai_metadata_enum_sai_out_drop_reason_t); } +std::string sai_serialize_timespec( + _In_ const sai_timespec_t ×pec) +{ + SWSS_LOG_ENTER(); + + json j; + + j["tv_sec"] = sai_serialize_number(timespec.tv_sec); + j["tv_nsec"] = sai_serialize_number(timespec.tv_nsec); + + return j.dump(); +} + +std::string sai_serialize_switch_asic_sdk_health_event( + _In_ sai_object_id_t switch_id, + _In_ sai_switch_asic_sdk_health_severity_t severity, + _In_ const sai_timespec_t ×tamp, + _In_ sai_switch_asic_sdk_health_category_t category, + _In_ const sai_switch_health_data_t &data, + _In_ const sai_u8_list_t &description) +{ + SWSS_LOG_ENTER(); + + json j; + + j["switch_id"] = sai_serialize_object_id(switch_id); + j["severity"] = sai_serialize_enum(severity, &sai_metadata_enum_sai_switch_asic_sdk_health_severity_t); + j["timestamp"] = sai_serialize_timespec(timestamp); + j["category"] = sai_serialize_enum(category, &sai_metadata_enum_sai_switch_asic_sdk_health_category_t); + j["data.data_type"] = sai_serialize_enum(data.data_type, &sai_metadata_enum_sai_health_data_type_t); + j["description"] = sai_serialize_number_list(description, false); + + return j.dump(); +} + std::string sai_serialize_switch_shutdown_request( _In_ sai_object_id_t switch_id) { @@ -1299,7 +1334,7 @@ template std::string sai_serialize_number_list( _In_ const T& list, _In_ bool countOnly, - _In_ bool hex = false) + _In_ bool hex) { SWSS_LOG_ENTER(); @@ -4147,6 +4182,66 @@ void sai_deserialize_switch_oper_status( sai_deserialize_enum(j["status"], &sai_metadata_enum_sai_switch_oper_status_t, (int32_t&)status); } +void sai_deserialize_timespec( + _In_ const std::string& s, + _Out_ sai_timespec_t ×tamp) +{ + SWSS_LOG_ENTER(); + + json j; + try + { + j = json::parse(s); + } + catch (const std::exception&) + { + SWSS_LOG_THROW("Received an exception after trying to parse timespec_t from %s", s.c_str()); + } + + sai_deserialize_number(j["tv_sec"], timestamp.tv_sec); + sai_deserialize_number(j["tv_nsec"], timestamp.tv_nsec); +} + +void sai_deserialize_switch_asic_sdk_health_event( + _In_ const std::string& s, + _Out_ sai_object_id_t &switch_id, + _Out_ sai_switch_asic_sdk_health_severity_t &severity, + _Out_ sai_timespec_t ×tamp, + _Out_ sai_switch_asic_sdk_health_category_t &category, + _Out_ sai_switch_health_data_t &data, + _Out_ sai_u8_list_t &description) +{ + SWSS_LOG_ENTER(); + + json j; + try + { + j = json::parse(s); + } + catch (const std::exception&) + { + SWSS_LOG_THROW("Received an exception after trying to parse switch_asic_sdk_health_event from %s", s.c_str()); + } + + sai_deserialize_object_id(j["switch_id"], switch_id); + sai_deserialize_enum(j["severity"], &sai_metadata_enum_sai_switch_asic_sdk_health_severity_t, (int32_t&)severity); + sai_deserialize_timespec(j["timestamp"], timestamp); + sai_deserialize_enum(j["category"], &sai_metadata_enum_sai_switch_asic_sdk_health_category_t, (int32_t&)category); + int32_t data_type; + sai_deserialize_enum(j["data.data_type"], &sai_metadata_enum_sai_health_data_type_t, data_type); + data.data_type = (sai_health_data_type_t)data_type; + data.data_type = SAI_HEALTH_DATA_TYPE_GENERAL; + sai_deserialize_number_list(j["description"], description, false, false); +} + +void sai_deserialize_free_switch_asic_sdk_health_event( + _In_ sai_u8_list_t &description) +{ + SWSS_LOG_ENTER(); + + sai_free_list(description); +} + void sai_deserialize_switch_shutdown_request( _In_ const std::string& s, _Out_ sai_object_id_t &switch_id) diff --git a/meta/sai_serialize.h b/meta/sai_serialize.h index f0ebc0960..5a7e24424 100644 --- a/meta/sai_serialize.h +++ b/meta/sai_serialize.h @@ -204,6 +204,17 @@ std::string sai_serialize_switch_oper_status( _In_ sai_object_id_t switch_id, _In_ sai_switch_oper_status_t status); +std::string sai_serialize_timespec( + _In_ const sai_timespec_t ×pec); + +std::string sai_serialize_switch_asic_sdk_health_event( + _In_ sai_object_id_t switch_id, + _In_ sai_switch_asic_sdk_health_severity_t severity, + _In_ const sai_timespec_t ×tamp, + _In_ sai_switch_asic_sdk_health_category_t category, + _In_ const sai_switch_health_data_t &data, + _In_ const sai_u8_list_t &description); + std::string sai_serialize_switch_shutdown_request( _In_ sai_object_id_t switch_id); @@ -220,6 +231,12 @@ std::string sai_serialize_number( _In_ uint32_t number, _In_ bool hex = false); +template +std::string sai_serialize_number_list( + _In_ const T& list, + _In_ bool countOnly, + _In_ bool hex = false); + std::string sai_serialize_attr_id( _In_ const sai_attr_metadata_t& meta); @@ -327,6 +344,19 @@ void sai_deserialize_switch_oper_status( _Out_ sai_object_id_t &switch_id, _Out_ sai_switch_oper_status_t& status); +void sai_deserialize_timespec( + _In_ const std::string& s, + _Out_ sai_timespec_t ×tamp); + +void sai_deserialize_switch_asic_sdk_health_event( + _In_ const std::string& s, + _Out_ sai_object_id_t &switch_id, + _Out_ sai_switch_asic_sdk_health_severity_t &severity, + _Out_ sai_timespec_t ×tamp, + _Out_ sai_switch_asic_sdk_health_category_t &category, + _Out_ sai_switch_health_data_t &data, + _Out_ sai_u8_list_t &description); + void sai_deserialize_switch_shutdown_request( _In_ const std::string& s, _Out_ sai_object_id_t &switch_id); @@ -536,6 +566,9 @@ void sai_deserialize_free_bfd_session_state_ntf( _In_ uint32_t count, _In_ sai_bfd_session_state_notification_t* bfdsessionstate); +void sai_deserialize_free_switch_asic_sdk_health_event( + _In_ sai_u8_list_t &description); + void sai_deserialize_ingress_priority_group_attr( _In_ const std::string& s, _Out_ sai_ingress_priority_group_attr_t& attr); diff --git a/saiplayer/SaiPlayer.cpp b/saiplayer/SaiPlayer.cpp index 7649008f0..29723edc4 100644 --- a/saiplayer/SaiPlayer.cpp +++ b/saiplayer/SaiPlayer.cpp @@ -87,6 +87,7 @@ SaiPlayer::SaiPlayer( m_sn.onFdbEvent = std::bind(&SaiPlayer::onFdbEvent, this, _1, _2); m_sn.onPortStateChange = std::bind(&SaiPlayer::onPortStateChange, this, _1, _2); m_sn.onQueuePfcDeadlock = std::bind(&SaiPlayer::onQueuePfcDeadlock, this, _1, _2); + m_sn.onSwitchAsicSdkHealthEvent = std::bind(&SaiPlayer::onSwitchAsicSdkHealthEvent, this, _1, _2, _3, _4, _5, _6); m_sn.onSwitchShutdownRequest = std::bind(&SaiPlayer::onSwitchShutdownRequest, this, _1); m_sn.onSwitchStateChange = std::bind(&SaiPlayer::onSwitchStateChange, this, _1, _2); m_sn.onBfdSessionStateChange = std::bind(&SaiPlayer::onBfdSessionStateChange, this, _1, _2); @@ -195,6 +196,19 @@ void SaiPlayer::onQueuePfcDeadlock( // empty } +void SaiPlayer::onSwitchAsicSdkHealthEvent( + _In_ sai_object_id_t switch_id, + _In_ sai_switch_asic_sdk_health_severity_t severity, + _In_ sai_timespec_t timestamp, + _In_ sai_switch_asic_sdk_health_category_t category, + _In_ sai_switch_health_data_t data, + _In_ const sai_u8_list_t description) +{ + SWSS_LOG_ENTER(); + + // empty +} + void SaiPlayer::onSwitchShutdownRequest( _In_ sai_object_id_t switch_id) { diff --git a/saiplayer/SaiPlayer.h b/saiplayer/SaiPlayer.h index 10efad7f9..b8adc10f0 100644 --- a/saiplayer/SaiPlayer.h +++ b/saiplayer/SaiPlayer.h @@ -229,6 +229,14 @@ namespace saiplayer _In_ uint32_t count, _In_ const sai_queue_deadlock_notification_data_t *data); + void onSwitchAsicSdkHealthEvent( + _In_ sai_object_id_t switch_id, + _In_ sai_switch_asic_sdk_health_severity_t severity, + _In_ sai_timespec_t timestamp, + _In_ sai_switch_asic_sdk_health_category_t category, + _In_ sai_switch_health_data_t data, + _In_ const sai_u8_list_t description); + void onSwitchShutdownRequest( _In_ sai_object_id_t switch_id) __attribute__ ((noreturn)); diff --git a/syncd/NotificationHandler.cpp b/syncd/NotificationHandler.cpp index 9e535aa20..06bcb7bd8 100644 --- a/syncd/NotificationHandler.cpp +++ b/syncd/NotificationHandler.cpp @@ -96,6 +96,10 @@ void NotificationHandler::updateNotificationsPointers( attr.value.ptr = (void*)m_switchNotifications.on_switch_shutdown_request; break; + case SAI_SWITCH_ATTR_SWITCH_ASIC_SDK_HEALTH_EVENT_NOTIFY: + attr.value.ptr = (void*)m_switchNotifications.on_switch_asic_sdk_health_event; + break; + case SAI_SWITCH_ATTR_FDB_EVENT_NOTIFY: attr.value.ptr = (void*)m_switchNotifications.on_fdb_event; break; @@ -205,6 +209,21 @@ void NotificationHandler::onSwitchShutdownRequest( enqueueNotification(SAI_SWITCH_NOTIFICATION_NAME_SWITCH_SHUTDOWN_REQUEST, s); } +void NotificationHandler::onSwitchAsicSdkHealthEvent( + _In_ sai_object_id_t switch_id, + _In_ sai_switch_asic_sdk_health_severity_t severity, + _In_ sai_timespec_t timestamp, + _In_ sai_switch_asic_sdk_health_category_t category, + _In_ sai_switch_health_data_t data, + _In_ const sai_u8_list_t description) +{ + SWSS_LOG_ENTER(); + + std::string s = sai_serialize_switch_asic_sdk_health_event(switch_id, severity, timestamp, category, data, description); + + enqueueNotification(SAI_SWITCH_NOTIFICATION_NAME_SWITCH_ASIC_SDK_HEALTH_EVENT, s); +} + void NotificationHandler::onSwitchStateChange( _In_ sai_object_id_t switch_id, _In_ sai_switch_oper_status_t switch_oper_status) diff --git a/syncd/NotificationHandler.h b/syncd/NotificationHandler.h index a7909b4df..1ca355e58 100644 --- a/syncd/NotificationHandler.h +++ b/syncd/NotificationHandler.h @@ -58,6 +58,14 @@ namespace syncd _In_ uint32_t count, _In_ const sai_queue_deadlock_notification_data_t *data); + void onSwitchAsicSdkHealthEvent( + _In_ sai_object_id_t switch_id, + _In_ sai_switch_asic_sdk_health_severity_t severity, + _In_ sai_timespec_t timestamp, + _In_ sai_switch_asic_sdk_health_category_t category, + _In_ sai_switch_health_data_t data, + _In_ const sai_u8_list_t description); + void onSwitchShutdownRequest( _In_ sai_object_id_t switch_id); diff --git a/syncd/NotificationProcessor.cpp b/syncd/NotificationProcessor.cpp index 4fbd56750..f9b9be396 100644 --- a/syncd/NotificationProcessor.cpp +++ b/syncd/NotificationProcessor.cpp @@ -558,6 +558,24 @@ void NotificationProcessor::process_on_bfd_session_state_change( sendNotification(SAI_SWITCH_NOTIFICATION_NAME_BFD_SESSION_STATE_CHANGE, s); } + +void NotificationProcessor::process_on_switch_asic_sdk_health_event( + _In_ sai_object_id_t switch_rid, + _In_ sai_switch_asic_sdk_health_severity_t severity, + _In_ sai_timespec_t timestamp, + _In_ sai_switch_asic_sdk_health_category_t category, + _In_ sai_switch_health_data_t data, + _In_ const sai_u8_list_t description) +{ + SWSS_LOG_ENTER(); + + sai_object_id_t switch_vid = m_translator->translateRidToVid(switch_rid, SAI_NULL_OBJECT_ID); + + std::string s = sai_serialize_switch_asic_sdk_health_event(switch_vid, severity, timestamp, category, data, description); + + sendNotification(SAI_SWITCH_NOTIFICATION_NAME_SWITCH_ASIC_SDK_HEALTH_EVENT, s); +} + void NotificationProcessor::process_on_switch_shutdown_request( _In_ sai_object_id_t switch_rid) { @@ -707,6 +725,35 @@ void NotificationProcessor::handle_bfd_session_state_change( sai_deserialize_free_bfd_session_state_ntf(count, bfdsessionstate); } +void NotificationProcessor::handle_switch_asic_sdk_health_event( + _In_ const std::string &data) +{ + SWSS_LOG_ENTER(); + + sai_object_id_t switch_id; + sai_switch_asic_sdk_health_severity_t severity; + sai_timespec_t timestamp; + sai_switch_asic_sdk_health_category_t category; + sai_switch_health_data_t health_data; + sai_u8_list_t description; + + sai_deserialize_switch_asic_sdk_health_event(data, + switch_id, + severity, + timestamp, + category, + health_data, + description); + + process_on_switch_asic_sdk_health_event(switch_id, + severity, + timestamp, + category, + health_data, + description); + + sai_deserialize_free_switch_asic_sdk_health_event(description); +} void NotificationProcessor::handle_switch_shutdown_request( _In_ const std::string &data) { @@ -774,6 +821,10 @@ void NotificationProcessor::syncProcessNotification( { handle_switch_shutdown_request(data); } + else if (notification == SAI_SWITCH_NOTIFICATION_NAME_SWITCH_ASIC_SDK_HEALTH_EVENT) + { + handle_switch_asic_sdk_health_event(data); + } else if (notification == SAI_SWITCH_NOTIFICATION_NAME_QUEUE_PFC_DEADLOCK) { handle_queue_deadlock(data); diff --git a/syncd/NotificationProcessor.h b/syncd/NotificationProcessor.h index 15d44daaa..0c89260a0 100644 --- a/syncd/NotificationProcessor.h +++ b/syncd/NotificationProcessor.h @@ -97,6 +97,14 @@ namespace syncd _In_ sai_object_id_t port_id, _In_ sai_port_host_tx_ready_status_t *host_tx_ready_status); + void process_on_switch_asic_sdk_health_event( + _In_ sai_object_id_t switch_id, + _In_ sai_switch_asic_sdk_health_severity_t severity, + _In_ sai_timespec_t timestamp, + _In_ sai_switch_asic_sdk_health_category_t category, + _In_ sai_switch_health_data_t data, + _In_ const sai_u8_list_t description); + void process_on_switch_shutdown_request( _In_ sai_object_id_t switch_rid); @@ -124,6 +132,9 @@ namespace syncd void handle_bfd_session_state_change( _In_ const std::string &data); + void handle_switch_asic_sdk_health_event( + _In_ const std::string &data); + void handle_switch_shutdown_request( _In_ const std::string &data); diff --git a/syncd/SwitchNotifications.cpp b/syncd/SwitchNotifications.cpp index 5aa120364..9204825f5 100644 --- a/syncd/SwitchNotifications.cpp +++ b/syncd/SwitchNotifications.cpp @@ -98,6 +98,19 @@ void SwitchNotifications::SlotBase::onQueuePfcDeadlock( return m_slots[context]->m_handler->onQueuePfcDeadlock(count, data); } +void SwitchNotifications::SlotBase::onSwitchAsicSdkHealthEvent( + _In_ int context, + _In_ sai_object_id_t switch_id, + _In_ sai_switch_asic_sdk_health_severity_t severity, + _In_ sai_timespec_t timestamp, + _In_ sai_switch_asic_sdk_health_category_t category, + _In_ sai_switch_health_data_t data, + _In_ const sai_u8_list_t description) +{ + SWSS_LOG_ENTER(); + + return m_slots.at(context)->m_handler->onSwitchAsicSdkHealthEvent(switch_id, severity, timestamp, category, data, description); +} void SwitchNotifications::SlotBase::onSwitchShutdownRequest( _In_ int context, diff --git a/syncd/SwitchNotifications.h b/syncd/SwitchNotifications.h index 8cc606145..be0f1438e 100644 --- a/syncd/SwitchNotifications.h +++ b/syncd/SwitchNotifications.h @@ -62,6 +62,15 @@ namespace syncd _In_ uint32_t count, _In_ const sai_queue_deadlock_notification_data_t *data); + static void onSwitchAsicSdkHealthEvent( + _In_ int context, + _In_ sai_object_id_t switch_id, + _In_ sai_switch_asic_sdk_health_severity_t severity, + _In_ sai_timespec_t timestamp, + _In_ sai_switch_asic_sdk_health_category_t category, + _In_ sai_switch_health_data_t data, + _In_ const sai_u8_list_t description); + static void onSwitchShutdownRequest( _In_ int context, _In_ sai_object_id_t switch_id); @@ -106,7 +115,7 @@ namespace syncd .on_tam_event = nullptr, .on_ipsec_sa_status_change = nullptr, .on_nat_event = &Slot::onNatEvent, - .on_switch_asic_sdk_health_event = nullptr, + .on_switch_asic_sdk_health_event = &Slot::onSwitchAsicSdkHealthEvent, .on_port_host_tx_ready = &Slot::onPortHostTxReady, .on_twamp_session_event = &Slot::onTwampSessionEvent, }) { } @@ -170,6 +179,25 @@ namespace syncd return SlotBase::onQueuePfcDeadlock(context, count, data); } + static void onSwitchAsicSdkHealthEvent( + _In_ sai_object_id_t switch_id, + _In_ sai_switch_asic_sdk_health_severity_t severity, + _In_ sai_timespec_t timestamp, + _In_ sai_switch_asic_sdk_health_category_t category, + _In_ sai_switch_health_data_t data, + _In_ const sai_u8_list_t description) + { + SWSS_LOG_ENTER(); + + return SlotBase::onSwitchAsicSdkHealthEvent(context, + switch_id, + severity, + timestamp, + category, + data, + description); + } + static void onSwitchShutdownRequest( _In_ sai_object_id_t switch_id) { @@ -216,6 +244,12 @@ namespace syncd std::function onPortStateChange; std::function onPortHostTxReady; std::function onQueuePfcDeadlock; + std::function onSwitchAsicSdkHealthEvent; std::function onSwitchShutdownRequest; std::function onSwitchStateChange; std::function onBfdSessionStateChange; diff --git a/syncd/Syncd.cpp b/syncd/Syncd.cpp index 2eada41c8..e29481c60 100644 --- a/syncd/Syncd.cpp +++ b/syncd/Syncd.cpp @@ -155,6 +155,7 @@ Syncd::Syncd( m_sn.onNatEvent = std::bind(&NotificationHandler::onNatEvent, m_handler.get(), _1, _2); m_sn.onPortStateChange = std::bind(&NotificationHandler::onPortStateChange, m_handler.get(), _1, _2); m_sn.onQueuePfcDeadlock = std::bind(&NotificationHandler::onQueuePfcDeadlock, m_handler.get(), _1, _2); + m_sn.onSwitchAsicSdkHealthEvent = std::bind(&NotificationHandler::onSwitchAsicSdkHealthEvent, m_handler.get(), _1, _2, _3, _4, _5, _6); m_sn.onSwitchShutdownRequest = std::bind(&NotificationHandler::onSwitchShutdownRequest, m_handler.get(), _1); m_sn.onSwitchStateChange = std::bind(&NotificationHandler::onSwitchStateChange, m_handler.get(), _1, _2); m_sn.onBfdSessionStateChange = std::bind(&NotificationHandler::onBfdSessionStateChange, m_handler.get(), _1, _2); diff --git a/unittest/lib/TestSwitch.cpp b/unittest/lib/TestSwitch.cpp index 8cb25f7bc..58a635b0a 100644 --- a/unittest/lib/TestSwitch.cpp +++ b/unittest/lib/TestSwitch.cpp @@ -22,7 +22,7 @@ TEST(Switch, updateNotifications) { auto s = std::make_shared(7); - sai_attribute_t attrs[10]; + sai_attribute_t attrs[11]; attrs[0].id = 10000; @@ -38,6 +38,7 @@ TEST(Switch, updateNotifications) attrs[7].value.ptr = (void*)1; attrs[8].value.ptr = (void*)1; attrs[9].value.ptr = (void*)1; + attrs[10].value.ptr = (void*)1; attrs[0].id = SAI_SWITCH_ATTR_SWITCH_STATE_CHANGE_NOTIFY; attrs[1].id = SAI_SWITCH_ATTR_SHUTDOWN_REQUEST_NOTIFY; @@ -48,9 +49,10 @@ TEST(Switch, updateNotifications) attrs[6].id = SAI_SWITCH_ATTR_BFD_SESSION_STATE_CHANGE_NOTIFY; attrs[7].id = SAI_SWITCH_ATTR_NAT_EVENT_NOTIFY; attrs[8].id = SAI_SWITCH_ATTR_PORT_HOST_TX_READY_NOTIFY; - attrs[9].id = SAI_SWITCH_ATTR_INIT_SWITCH; + attrs[9].id = SAI_SWITCH_ATTR_SWITCH_ASIC_SDK_HEALTH_EVENT_NOTIFY; + attrs[10].id = SAI_SWITCH_ATTR_INIT_SWITCH; - s->updateNotifications(9, attrs); + s->updateNotifications(10, attrs); auto sn = s->getSwitchNotifications(); @@ -63,4 +65,5 @@ TEST(Switch, updateNotifications) EXPECT_EQ((void*)1, sn.on_switch_state_change); EXPECT_EQ((void*)1, sn.on_nat_event); EXPECT_EQ((void*)1, sn.on_port_host_tx_ready); + EXPECT_EQ((void*)1, sn.on_switch_asic_sdk_health_event); } diff --git a/unittest/meta/Makefile.am b/unittest/meta/Makefile.am index 3b51294d3..4a53dac50 100644 --- a/unittest/meta/Makefile.am +++ b/unittest/meta/Makefile.am @@ -23,6 +23,7 @@ tests_SOURCES = \ TestNotificationPortStateChange.cpp \ TestNotificationQueuePfcDeadlock.cpp \ TestNotificationSwitchShutdownRequest.cpp \ + TestNotificationSwitchAsicSdkHealthEvent.cpp \ TestNotificationSwitchStateChange.cpp \ TestNotificationBfdSessionStateChange.cpp \ TestOidRefCounter.cpp \ diff --git a/unittest/meta/TestNotificationFactory.cpp b/unittest/meta/TestNotificationFactory.cpp index 66d5938b5..f8f9541e8 100644 --- a/unittest/meta/TestNotificationFactory.cpp +++ b/unittest/meta/TestNotificationFactory.cpp @@ -68,6 +68,25 @@ TEST(NotificationFactory, deserialize_queue_pfc_deadlock) EXPECT_EQ(str, ntf->getSerializedNotification()); } +TEST(NotificationFactory, deserialize_switch_asic_sdk_health_event) +{ + auto ntf = NotificationFactory::deserialize( + SAI_SWITCH_NOTIFICATION_NAME_SWITCH_ASIC_SDK_HEALTH_EVENT, + "{" + "\"category\":\"SAI_SWITCH_ASIC_SDK_HEALTH_CATEGORY_FW\"," + "\"data.data_type\":\"SAI_HEALTH_DATA_TYPE_GENERAL\"," + "\"description\":\"2:30,30\"," + "\"severity\":\"SAI_SWITCH_ASIC_SDK_HEALTH_SEVERITY_FATAL\"," + "\"switch_id\":\"oid:0x21000000000000\"," + "\"timestamp\":\"{" + "\\\"tv_nsec\\\":\\\"28715881\\\"," + "\\\"tv_sec\\\":\\\"1700042919\\\"" + "}\"" + "}"); + + EXPECT_EQ(ntf->getNotificationType(), SAI_SWITCH_NOTIFICATION_TYPE_SWITCH_ASIC_SDK_HEALTH_EVENT); +} + TEST(NotificationFactory, deserialize_shutdown_request) { auto ntf = NotificationFactory::deserialize( diff --git a/unittest/meta/TestNotificationSwitchAsicSdkHealthEvent.cpp b/unittest/meta/TestNotificationSwitchAsicSdkHealthEvent.cpp new file mode 100644 index 000000000..3f62ef8b8 --- /dev/null +++ b/unittest/meta/TestNotificationSwitchAsicSdkHealthEvent.cpp @@ -0,0 +1,78 @@ +#include "NotificationSwitchAsicSdkHealthEvent.h" +#include "Meta.h" +#include "MetaTestSaiInterface.h" + +#include "sairediscommon.h" +#include "sai_serialize.h" + +#include +#include + +using namespace sairedis; +using namespace saimeta; + +//static std::string s = "[{\"host_tx_ready_status\":\"SAI_PORT_HOST_TX_READY_STATUS_READY\",\"port_id\":\"oid:0x100000000001a\",\"switch_id\":\"oid:0x2100000000\"}]"; +static std::string s = "{" + "\"category\":\"SAI_SWITCH_ASIC_SDK_HEALTH_CATEGORY_FW\"," + "\"data.data_type\":\"SAI_HEALTH_DATA_TYPE_GENERAL\"," + "\"description\":\"2:30,30\"," + "\"severity\":\"SAI_SWITCH_ASIC_SDK_HEALTH_SEVERITY_FATAL\"," + "\"switch_id\":\"oid:0x21000000000000\"," + "\"timestamp\":\"{" + "\\\"tv_nsec\\\":\\\"28715881\\\"," + "\\\"tv_sec\\\":\\\"1700042919\\\"" + "}\"" + "}"; +static std::string null = "[{\"host_tx_ready_status\":\"SAI_PORT_HOST_TX_READY_STATUS_READY\",\"port_id\":\"oid:0x0\",\"switch_id\":\"oid:0x0\"}]"; +static std::string fullnull = "[]"; + +TEST(NotificationSwitchAsicSdkHealthEvent, ctr) +{ + NotificationSwitchAsicSdkHealthEvent n(s); +} + +TEST(NotificationSwitchAsicSdkHealthEvent, getSwitchId) +{ + NotificationSwitchAsicSdkHealthEvent n(s); + + EXPECT_EQ(n.getSwitchId(), 0x21000000000000); +} + +TEST(NotificationSwitchAsicSdkHealthEvent, getAnyObjectId) +{ + NotificationSwitchAsicSdkHealthEvent n(s); + + EXPECT_EQ(n.getAnyObjectId(), 0x21000000000000); +} + +TEST(NotificationSwitchAsicSdkHealthEvent, processMetadata) +{ + NotificationSwitchAsicSdkHealthEvent n(s); + + auto sai = std::make_shared(); + auto meta = std::make_shared(sai); + + n.processMetadata(meta); +} + +static void on_switch_asic_sdk_health_event( + _In_ sai_object_id_t switch_id, + _In_ sai_switch_asic_sdk_health_severity_t severity, + _In_ sai_timespec_t timestamp, + _In_ sai_switch_asic_sdk_health_category_t category, + _In_ sai_switch_health_data_t data, + _In_ const sai_u8_list_t description) +{ + SWSS_LOG_ENTER(); +} + +TEST(NotificationSwitchAsicSdkHealthEvent, executeCallback) +{ + NotificationSwitchAsicSdkHealthEvent n(s); + + sai_switch_notifications_t ntfs; + + ntfs.on_switch_asic_sdk_health_event = &on_switch_asic_sdk_health_event; + + n.executeCallback(ntfs); +} diff --git a/unittest/syncd/TestNotificationHandler.cpp b/unittest/syncd/TestNotificationHandler.cpp index 9891dfebf..59566676c 100644 --- a/unittest/syncd/TestNotificationHandler.cpp +++ b/unittest/syncd/TestNotificationHandler.cpp @@ -9,6 +9,20 @@ using namespace syncd; static std::string natData = "[{\"nat_entry\":\"{\\\"nat_data\\\":{\\\"key\\\":{\\\"dst_ip\\\":\\\"10.10.10.10\\\",\\\"l4_dst_port\\\":\\\"20006\\\",\\\"l4_src_port\\\":\\\"0\\\",\\\"proto\\\":\\\"6\\\",\\\"src_ip\\\":\\\"0.0.0.0\\\"},\\\"mask\\\":{\\\"dst_ip\\\":\\\"255.255.255.255\\\",\\\"l4_dst_port\\\":\\\"65535\\\",\\\"l4_src_port\\\":\\\"0\\\",\\\"proto\\\":\\\"255\\\",\\\"src_ip\\\":\\\"0.0.0.0\\\"}},\\\"nat_type\\\":\\\"SAI_NAT_TYPE_DESTINATION_NAT\\\",\\\"switch_id\\\":\\\"oid:0x21000000000000\\\",\\\"vr\\\":\\\"oid:0x3000000000048\\\"}\",\"nat_event\":\"SAI_NAT_EVENT_AGED\"}]"; +// Test ASIC/SDK health event +std::string asheData = "{" + "\"category\":\"SAI_SWITCH_ASIC_SDK_HEALTH_CATEGORY_FW\"," + "\"data.data_type\":\"SAI_HEALTH_DATA_TYPE_GENERAL\"," + "\"description\":\"2:30,30\"," + "\"severity\":\"SAI_SWITCH_ASIC_SDK_HEALTH_SEVERITY_FATAL\"," + "\"switch_id\":\"oid:0x21000000000000\"," + "\"timestamp\":\"{" + "\\\"tv_nsec\\\":\\\"28715881\\\"," + "\\\"tv_sec\\\":\\\"1700042919\\\"" + "}\"" +"}"; + + TEST(NotificationHandler, NotificationHandlerTest) { std::vector attrs; @@ -29,4 +43,27 @@ TEST(NotificationHandler, NotificationHandlerTest) sai_deserialize_nat_event_ntf(natData, count, &natevent); notificationHandler->onNatEvent(count, natevent); + + sai_object_id_t switch_id; + sai_switch_asic_sdk_health_severity_t severity; + sai_timespec_t timestamp; + sai_switch_asic_sdk_health_category_t category; + sai_switch_health_data_t data; + sai_u8_list_t description; + sai_deserialize_switch_asic_sdk_health_event(asheData, + switch_id, + severity, + timestamp, + category, + data, + description); + assert(switch_id == 0x21000000000000); + assert(severity == SAI_SWITCH_ASIC_SDK_HEALTH_SEVERITY_FATAL); + assert(category == SAI_SWITCH_ASIC_SDK_HEALTH_CATEGORY_FW); + notificationHandler->onSwitchAsicSdkHealthEvent(switch_id, + severity, + timestamp, + category, + data, + description); } diff --git a/unittest/syncd/TestNotificationProcessor.cpp b/unittest/syncd/TestNotificationProcessor.cpp index 0c955d7cc..d683f105d 100644 --- a/unittest/syncd/TestNotificationProcessor.cpp +++ b/unittest/syncd/TestNotificationProcessor.cpp @@ -73,4 +73,22 @@ TEST(NotificationProcessor, NotificationProcessorTest) EXPECT_NE(bridgeport, nullptr); EXPECT_EQ(*bridgeport, "oid:0x3a000000000a99"); EXPECT_EQ(ip, nullptr); + + // Test ASIC/SDK health event + std::string asheString = "{" + "\"category\":\"SAI_SWITCH_ASIC_SDK_HEALTH_CATEGORY_FW\"," + "\"data.data_type\":\"SAI_HEALTH_DATA_TYPE_GENERAL\"," + "\"description\":\"2:30,30\"," + "\"severity\":\"SAI_SWITCH_ASIC_SDK_HEALTH_SEVERITY_FATAL\"," + "\"switch_id\":\"oid:0x21000000000000\"," + "\"timestamp\":\"{" + "\\\"tv_nsec\\\":\\\"28715881\\\"," + "\\\"tv_sec\\\":\\\"1700042919\\\"" + "}\"" + "}"; + std::vector asheEntry; + swss::KeyOpFieldsValuesTuple asheItem(SAI_SWITCH_NOTIFICATION_NAME_SWITCH_ASIC_SDK_HEALTH_EVENT, asheString, asheEntry); + translator->insertRidAndVid(0x21000000000000,0x210000000000); + notificationProcessor->syncProcessNotification(asheItem); + translator->eraseRidAndVid(0x21000000000000,0x210000000000); } diff --git a/vslib/Switch.cpp b/vslib/Switch.cpp index 4c24bc015..dc5165902 100644 --- a/vslib/Switch.cpp +++ b/vslib/Switch.cpp @@ -80,6 +80,11 @@ void Switch::updateNotifications( (sai_switch_state_change_notification_fn)attr.value.ptr; break; + case SAI_SWITCH_ATTR_SWITCH_ASIC_SDK_HEALTH_EVENT_NOTIFY: + m_switchNotifications.on_switch_asic_sdk_health_event = + (sai_switch_asic_sdk_health_event_notification_fn)attr.value.ptr; + break; + case SAI_SWITCH_ATTR_SHUTDOWN_REQUEST_NOTIFY: m_switchNotifications.on_switch_shutdown_request = (sai_switch_shutdown_request_notification_fn)attr.value.ptr; From 256ce7dc546e99dbeeb43404c4157ed7136e2932 Mon Sep 17 00:00:00 2001 From: Ze Gan Date: Fri, 10 May 2024 08:32:01 +0800 Subject: [PATCH 20/32] [syncd]: Generate syncd_dash (#1377) Make original syncd-vs and syncd-dash co-exist. Signed-off-by: Ze Gan --- syncd/Makefile.am | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/syncd/Makefile.am b/syncd/Makefile.am index 155b2f19c..3c546fb74 100644 --- a/syncd/Makefile.am +++ b/syncd/Makefile.am @@ -3,12 +3,7 @@ SUBDIRS = . tests AM_CXXFLAGS = $(SAIINC) -I$(top_srcdir)/lib -I$(top_srcdir)/vslib if SAIVS -if DASHSAI -SAILIB = -lsai -EXTRA_LIBSAI_LDFLAGS += -lprotobuf -lpiprotobuf -lpiprotogrpc -lgrpc++ -else SAILIB=-L$(top_srcdir)/vslib/.libs -lsaivs -endif else SAILIB=-lsai endif @@ -118,3 +113,15 @@ syncd_tests_LDADD = libSyncd.a -lhiredis -lswsscommon -lpthread -L$(top_srcdir)/ -L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta -lzmq $(CODE_COVERAGE_LIBS) TESTS = syncd_tests + +if SAIVS +if DASHSAI +bin_PROGRAMS += syncd_dash +syncd_dash_SOURCES = $(syncd_SOURCES) +syncd_dash_CPPFLAGS = $(syncd_CPPFLAGS) +syncd_dash_CXXFLAGS = $(syncd_CXXFLAGS) +syncd_dash_LDADD = libSyncd.a $(top_srcdir)/lib/libSaiRedis.a -L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta \ + -ldl -lhiredis -lswsscommon -lsai -lprotobuf -lpiprotobuf -lpiprotogrpc -lgrpc++ -lpthread -lzmq $(CODE_COVERAGE_LIBS) $(EXTRA_LIBSAI_LDFLAGS) +syncd_dash_LDFLAGS = $(syncd_LDFLAGS) +endif +endif From a83b083a6e1cb71127bf09c0778673b2934d4891 Mon Sep 17 00:00:00 2001 From: Kamil Cudnik Date: Thu, 23 May 2024 13:31:34 +0200 Subject: [PATCH 21/32] Update pipeline (#1382) Use requests 2.31.0 instead of latest 2.32.0, requests 2.32.0 breaks Test stage. Issue related to https://github.com/docker/docker-py/issues/3256 --- .azure-pipelines/test-docker-sonic-vs-template.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/test-docker-sonic-vs-template.yml b/.azure-pipelines/test-docker-sonic-vs-template.yml index e4939d3db..8b2292962 100644 --- a/.azure-pipelines/test-docker-sonic-vs-template.yml +++ b/.azure-pipelines/test-docker-sonic-vs-template.yml @@ -81,7 +81,7 @@ jobs: # install packages for vs test sudo apt-get install -y net-tools bridge-utils vlan sudo apt-get install -y python3-pip - 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 + 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 requests==2.31.0 displayName: "Install dependencies" - script: | From 0adbe2558b4d2d35fa97f3232abf88a909e68a41 Mon Sep 17 00:00:00 2001 From: Kamil Cudnik Date: Fri, 24 May 2024 06:06:40 +0200 Subject: [PATCH 22/32] [submodule] Update SAI submodule to v1.14 (#1381) Will include adding new POE api --- SAI | 2 +- lib/Makefile.am | 1 + lib/sai_redis.h | 1 + lib/sai_redis_interfacequery.cpp | 1 + lib/sai_redis_poe.cpp | 12 +++ meta/SaiSerialize.cpp | 122 ++++++++++++++++++++++++++-- meta/sai_serialize.h | 7 ++ unittest/lib/Makefile.am | 1 + unittest/lib/test_sai_redis_poe.cpp | 33 ++++++++ unittest/vslib/Makefile.am | 1 + unittest/vslib/test_sai_vs_poe.cpp | 33 ++++++++ vslib/Makefile.am | 1 + vslib/sai_vs.h | 1 + vslib/sai_vs_interfacequery.cpp | 1 + vslib/sai_vs_poe.cpp | 12 +++ 15 files changed, 220 insertions(+), 9 deletions(-) create mode 100644 lib/sai_redis_poe.cpp create mode 100644 unittest/lib/test_sai_redis_poe.cpp create mode 100644 unittest/vslib/test_sai_vs_poe.cpp create mode 100644 vslib/sai_vs_poe.cpp diff --git a/SAI b/SAI index bc1d6ec90..2587c3b89 160000 --- a/SAI +++ b/SAI @@ -1 +1 @@ -Subproject commit bc1d6ec90fb462c5171dbaa1aedcab1aac890ce9 +Subproject commit 2587c3b89241022bb0eef3ef82ab764eda7a183c diff --git a/lib/Makefile.am b/lib/Makefile.am index 46471b89b..a441b519b 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -90,6 +90,7 @@ libsairedis_la_SOURCES = \ sai_redis_ars.cpp \ sai_redis_ars_profile.cpp \ sai_redis_twamp.cpp \ + sai_redis_poe.cpp \ sai_redis_dash_meter.cpp libSaiRedis_a_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS) diff --git a/lib/sai_redis.h b/lib/sai_redis.h index 061ef280b..c0d93c304 100644 --- a/lib/sai_redis.h +++ b/lib/sai_redis.h @@ -74,6 +74,7 @@ PRIVATE extern const sai_my_mac_api_t redis_my_mac_api; PRIVATE extern const sai_ipsec_api_t redis_ipsec_api; PRIVATE extern const sai_twamp_api_t redis_twamp_api; PRIVATE extern const sai_dash_meter_api_t redis_dash_meter_api; +PRIVATE extern const sai_poe_api_t redis_poe_api; PRIVATE extern std::shared_ptr redis_sai; diff --git a/lib/sai_redis_interfacequery.cpp b/lib/sai_redis_interfacequery.cpp index e18c084e0..41b3c950e 100644 --- a/lib/sai_redis_interfacequery.cpp +++ b/lib/sai_redis_interfacequery.cpp @@ -83,6 +83,7 @@ static sai_apis_t redis_apis = { API(ars), API(ars_profile), API(twamp), + API(poe), API(bmtor), API(dash_acl), API(dash_direction_lookup), diff --git a/lib/sai_redis_poe.cpp b/lib/sai_redis_poe.cpp new file mode 100644 index 000000000..9bede47fc --- /dev/null +++ b/lib/sai_redis_poe.cpp @@ -0,0 +1,12 @@ +#include "sai_redis.h" + +REDIS_GENERIC_QUAD(POE_DEVICE,poe_device); +REDIS_GENERIC_QUAD(POE_PSE,poe_pse); +REDIS_GENERIC_QUAD(POE_PORT,poe_port); + +const sai_poe_api_t redis_poe_api = { + + REDIS_GENERIC_QUAD_API(poe_device) + REDIS_GENERIC_QUAD_API(poe_pse) + REDIS_GENERIC_QUAD_API(poe_port) +}; diff --git a/meta/SaiSerialize.cpp b/meta/SaiSerialize.cpp index 67570a406..3d9605ad5 100644 --- a/meta/SaiSerialize.cpp +++ b/meta/SaiSerialize.cpp @@ -163,9 +163,9 @@ sai_status_t transfer_attribute( transfer_primitive(src_attr.value.u16, dst_attr.value.u16); break; -// case SAI_ATTR_VALUE_TYPE_INT16: -// transfer_primitive(src_attr.value.s16, dst_attr.value.s16); -// break; + case SAI_ATTR_VALUE_TYPE_INT16: + transfer_primitive(src_attr.value.s16, dst_attr.value.s16); + break; case SAI_ATTR_VALUE_TYPE_UINT32: transfer_primitive(src_attr.value.u32, dst_attr.value.u32); @@ -510,6 +510,10 @@ sai_status_t transfer_attribute( RETURN_ON_ERROR(transfer_list(src_attr.value.aclchainlist, dst_attr.value.aclchainlist, countOnly)); break; + case SAI_ATTR_VALUE_TYPE_POE_PORT_POWER_CONSUMPTION: + transfer_primitive(src_attr.value.portpowerconsumption, dst_attr.value.portpowerconsumption); + break; + default: SWSS_LOG_THROW("sai attr value %s is not implemented, FIXME", sai_serialize_attr_value_type(serialization_type).c_str()); } @@ -1977,8 +1981,8 @@ std::string sai_serialize_attr_value( case SAI_ATTR_VALUE_TYPE_JSON: return sai_serialize_json(attr.value.json); -// case SAI_ATTR_VALUE_TYPE_INT16: -// return sai_serialize_number(attr.value.s16); + case SAI_ATTR_VALUE_TYPE_INT16: + return sai_serialize_number(attr.value.s16); case SAI_ATTR_VALUE_TYPE_UINT32: return sai_serialize_number(attr.value.u32); @@ -2131,6 +2135,9 @@ std::string sai_serialize_attr_value( case SAI_ATTR_VALUE_TYPE_IP_PREFIX_LIST: return sai_serialize_ip_prefix_list(attr.value.ipprefixlist, countOnly); + case SAI_ATTR_VALUE_TYPE_POE_PORT_POWER_CONSUMPTION: + return sai_serialize_poe_port_power_consumption(attr.value.portpowerconsumption); + default: SWSS_LOG_THROW("sai attr value type %s is not implemented, FIXME", sai_serialize_attr_value_type(meta.attrvaluetype).c_str()); } @@ -2779,6 +2786,51 @@ std::string sai_serialize_redis_link_event_damping_aied_config( return j.dump(); } +std::string sai_serialize_poe_port_active_channel_type( + _In_ const sai_poe_port_active_channel_type_t value) +{ + SWSS_LOG_ENTER(); + + return sai_serialize_enum(value, &sai_metadata_enum_sai_poe_port_active_channel_type_t); +} + +std::string sai_serialize_poe_port_class_method_type( + _In_ const sai_poe_port_class_method_type_t value) +{ + SWSS_LOG_ENTER(); + + return sai_serialize_enum(value, &sai_metadata_enum_sai_poe_port_class_method_type_t); +} + +std::string sai_serialzie_poe_port_signature_type( + _In_ const sai_poe_port_signature_type_t value) +{ + SWSS_LOG_ENTER(); + + return sai_serialize_enum(value, &sai_metadata_enum_sai_poe_port_signature_type_t); +} + +std::string sai_serialize_poe_port_power_consumption( + _In_ const sai_poe_port_power_consumption_t& value) +{ + SWSS_LOG_ENTER(); + + json j; + + j["active_channel"] = sai_serialize_poe_port_active_channel_type(value.active_channel); + j["voltage"] = sai_serialize_number(value.voltage, false); + j["current"] = sai_serialize_number(value.current, false); + j["consumption"] = sai_serialize_number(value.consumption, false); + j["signature_type"] = sai_serialzie_poe_port_signature_type(value.signature_type); + j["class_method"] = sai_serialize_poe_port_class_method_type(value.class_method); + j["measured_class_a"] = sai_serialize_number(value.measured_class_a, false); + j["assigned_class_a"] = sai_serialize_number(value.assigned_class_a, false); + j["measured_class_b"] = sai_serialize_number(value.measured_class_b, false); + j["assigned_class_b"] = sai_serialize_number(value.assigned_class_b, false); + + return j.dump(); +} + // deserialize void sai_deserialize_bool( @@ -3913,8 +3965,8 @@ void sai_deserialize_attr_value( case SAI_ATTR_VALUE_TYPE_JSON: return sai_deserialize_json(s, attr.value.json); -// case SAI_ATTR_VALUE_TYPE_INT16: -// return sai_deserialize_number(s, attr.value.s16); + case SAI_ATTR_VALUE_TYPE_INT16: + return sai_deserialize_number(s, attr.value.s16); case SAI_ATTR_VALUE_TYPE_UINT32: return sai_deserialize_number(s, attr.value.u32); @@ -4065,8 +4117,12 @@ void sai_deserialize_attr_value( case SAI_ATTR_VALUE_TYPE_IP_PREFIX_LIST: return sai_deserialize_ip_prefix_list(s, attr.value.ipprefixlist, countOnly); + case SAI_ATTR_VALUE_TYPE_POE_PORT_POWER_CONSUMPTION: + return sai_deserialize_poe_port_power_consumption(s, attr.value.portpowerconsumption); + default: - SWSS_LOG_THROW("deserialize type %d is not supported yet FIXME", meta.attrvaluetype); + SWSS_LOG_THROW("deserialize type %s is not supported yet FIXME", + sai_serialize_attr_value_type(meta.attrvaluetype).c_str()); } } @@ -5183,11 +5239,61 @@ void sai_deserialize_free_attribute_value( sai_free_list(attr.value.ipprefixlist); break; + case SAI_ATTR_VALUE_TYPE_POE_PORT_POWER_CONSUMPTION: + break; + default: SWSS_LOG_THROW("sai attr value %s is not implemented, FIXME", sai_serialize_attr_value_type(type).c_str()); } } +void sai_deserialize_poe_port_active_channel_type( + _In_ const std::string& s, + _Out_ sai_poe_port_active_channel_type_t& value) +{ + SWSS_LOG_ENTER(); + + sai_deserialize_enum(s, &sai_metadata_enum_sai_poe_port_active_channel_type_t, (int32_t&)value); +} + +void sai_deserialize_poe_port_class_method_type( + _In_ const std::string& s, + _Out_ sai_poe_port_class_method_type_t& value) +{ + SWSS_LOG_ENTER(); + + sai_deserialize_enum(s, &sai_metadata_enum_sai_poe_port_class_method_type_t, (int32_t&)value); +} + +void sai_deserialzie_poe_port_signature_type( + _In_ const std::string& s, + _Out_ sai_poe_port_signature_type_t& value) +{ + SWSS_LOG_ENTER(); + + sai_deserialize_enum(s, &sai_metadata_enum_sai_poe_port_signature_type_t, (int32_t&)value); +} + +void sai_deserialize_poe_port_power_consumption( + _In_ const std::string& s, + _Out_ sai_poe_port_power_consumption_t& value) +{ + SWSS_LOG_ENTER(); + + json j = json::parse(s); + + sai_deserialize_poe_port_active_channel_type(j["active_channel"], value.active_channel); + sai_deserialize_number(j["voltage"], value.voltage); + sai_deserialize_number(j["current"], value.current); + sai_deserialize_number(j["consumption"], value.consumption); + sai_deserialize_poe_port_class_method_type(j["class_method"], value.class_method); + sai_deserialzie_poe_port_signature_type(j["signature_type"],value.signature_type); + sai_deserialize_number(j["measured_class_a"], value.measured_class_a); + sai_deserialize_number(j["assigned_class_a"], value.assigned_class_a); + sai_deserialize_number(j["measured_class_b"], value.measured_class_b); + sai_deserialize_number(j["assigned_class_b"], value.assigned_class_b); +} + // deserialize free notifications void sai_deserialize_free_fdb_event( diff --git a/meta/sai_serialize.h b/meta/sai_serialize.h index 5a7e24424..5e149c409 100644 --- a/meta/sai_serialize.h +++ b/meta/sai_serialize.h @@ -273,6 +273,9 @@ std::string sai_serialize_qos_map_item( std::string sai_serialize_twamp_session_stat( _In_ const sai_twamp_session_stat_t counter); +std::string sai_serialize_poe_port_power_consumption( + _In_ const sai_poe_port_power_consumption_t& pppc); + // serialize notifications std::string sai_serialize_fdb_event_ntf( @@ -499,6 +502,10 @@ void sai_deserialize_chardata( _In_ const std::string& s, _Out_ char chardata[32]); +void sai_deserialize_poe_port_power_consumption( + _In_ const std::string& s, + _Out_ sai_poe_port_power_consumption_t& pppc); + // deserialize notifications void sai_deserialize_fdb_event_ntf( diff --git a/unittest/lib/Makefile.am b/unittest/lib/Makefile.am index 11384eee0..1b6face4f 100644 --- a/unittest/lib/Makefile.am +++ b/unittest/lib/Makefile.am @@ -85,6 +85,7 @@ testslibsairedis_SOURCES = main_libsairedis.cpp \ test_sai_redis_hostif.cpp \ test_sai_redis_wred.cpp \ test_sai_redis_ars.cpp \ + test_sai_redis_poe.cpp \ test_sai_redis_ars_profile.cpp testslibsairedis_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) diff --git a/unittest/lib/test_sai_redis_poe.cpp b/unittest/lib/test_sai_redis_poe.cpp new file mode 100644 index 000000000..a79deaa27 --- /dev/null +++ b/unittest/lib/test_sai_redis_poe.cpp @@ -0,0 +1,33 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsairedis, poe) +{ + sai_poe_api_t *api = nullptr; + + sai_api_query(SAI_API_POE, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_poe_device(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_poe_device(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_poe_device_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_poe_device_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_poe_pse(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_poe_pse(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_poe_pse_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_poe_pse_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_poe_port(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_poe_port(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_poe_port_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_poe_port_attribute(0,0,0)); +} diff --git a/unittest/vslib/Makefile.am b/unittest/vslib/Makefile.am index af3983260..6ba06de4f 100644 --- a/unittest/vslib/Makefile.am +++ b/unittest/vslib/Makefile.am @@ -109,6 +109,7 @@ testslibsaivs_SOURCES = main_libsaivs.cpp \ test_sai_vs_hostif.cpp \ test_sai_vs_wred.cpp \ test_sai_vs_ars.cpp \ + test_sai_vs_poe.cpp \ test_sai_vs_ars_profile.cpp testslibsaivs_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) diff --git a/unittest/vslib/test_sai_vs_poe.cpp b/unittest/vslib/test_sai_vs_poe.cpp new file mode 100644 index 000000000..a79deaa27 --- /dev/null +++ b/unittest/vslib/test_sai_vs_poe.cpp @@ -0,0 +1,33 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsairedis, poe) +{ + sai_poe_api_t *api = nullptr; + + sai_api_query(SAI_API_POE, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_poe_device(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_poe_device(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_poe_device_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_poe_device_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_poe_pse(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_poe_pse(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_poe_pse_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_poe_pse_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_poe_port(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_poe_port(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_poe_port_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_poe_port_attribute(0,0,0)); +} diff --git a/vslib/Makefile.am b/vslib/Makefile.am index c498acad2..00ca24ffe 100644 --- a/vslib/Makefile.am +++ b/vslib/Makefile.am @@ -123,6 +123,7 @@ libsaivs_la_SOURCES = \ sai_vs_ars.cpp \ sai_vs_ars_profile.cpp \ sai_vs_twamp.cpp \ + sai_vs_poe.cpp \ sai_vs_dash_meter.cpp libSaiVS_a_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS) diff --git a/vslib/sai_vs.h b/vslib/sai_vs.h index 485f9a559..74ecd68db 100644 --- a/vslib/sai_vs.h +++ b/vslib/sai_vs.h @@ -74,6 +74,7 @@ PRIVATE extern const sai_my_mac_api_t vs_my_mac_api; PRIVATE extern const sai_ipsec_api_t vs_ipsec_api; PRIVATE extern const sai_twamp_api_t vs_twamp_api; PRIVATE extern const sai_dash_meter_api_t vs_dash_meter_api; +PRIVATE extern const sai_poe_api_t vs_poe_api; PRIVATE extern std::shared_ptr vs_sai; diff --git a/vslib/sai_vs_interfacequery.cpp b/vslib/sai_vs_interfacequery.cpp index 338e0298c..f78d790f9 100644 --- a/vslib/sai_vs_interfacequery.cpp +++ b/vslib/sai_vs_interfacequery.cpp @@ -81,6 +81,7 @@ static sai_apis_t vs_apis = { API(ars), API(ars_profile), API(twamp), + API(poe), API(bmtor), API(dash_acl), API(dash_direction_lookup), diff --git a/vslib/sai_vs_poe.cpp b/vslib/sai_vs_poe.cpp new file mode 100644 index 000000000..b4b9aa9c0 --- /dev/null +++ b/vslib/sai_vs_poe.cpp @@ -0,0 +1,12 @@ +#include "sai_vs.h" + +VS_GENERIC_QUAD(POE_DEVICE,poe_device); +VS_GENERIC_QUAD(POE_PSE,poe_pse); +VS_GENERIC_QUAD(POE_PORT,poe_port); + +const sai_poe_api_t vs_poe_api = { + + VS_GENERIC_QUAD_API(poe_device) + VS_GENERIC_QUAD_API(poe_pse) + VS_GENERIC_QUAD_API(poe_port) +}; From 79b27c0e436544fe8c5bb9f3a2a0298b7dcec229 Mon Sep 17 00:00:00 2001 From: Kamil Cudnik Date: Fri, 24 May 2024 23:17:19 +0200 Subject: [PATCH 23/32] Add check for global SAI api used (#1379) This test will make sure only SAI global api are used in expected places --- tests/Makefile.am | 2 +- tests/checksaiapi.sh | 45 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100755 tests/checksaiapi.sh diff --git a/tests/Makefile.am b/tests/Makefile.am index 7405bab0d..b86eb095b 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -33,4 +33,4 @@ testdash_gtest_LDADD = -lgtest -lhiredis -lswsscommon -lpthread \ $(top_srcdir)/lib/libsairedis.la $(top_srcdir)/syncd/libSyncd.a \ -L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta -lzmq $(CODE_COVERAGE_LIBS) -TESTS = aspellcheck.pl conflictnames.pl swsslogentercheck.sh checkwhitespace.sh tests BCM56850.pl MLNX2700.pl BCM56971B0.pl NVDAMBF2H536C.pl testdash_gtest +TESTS = checksaiapi.sh aspellcheck.pl conflictnames.pl swsslogentercheck.sh checkwhitespace.sh tests BCM56850.pl MLNX2700.pl BCM56971B0.pl NVDAMBF2H536C.pl testdash_gtest diff --git a/tests/checksaiapi.sh b/tests/checksaiapi.sh new file mode 100755 index 000000000..6353fbcd6 --- /dev/null +++ b/tests/checksaiapi.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +# this script checks if only allowed files are using global sai apis + +# in entire project we only allow VendorSai.cpp and saisdkdump.cpp to use global SAI API, + +# PLEASE DO NOT ADD ANY MORE EXCEPTIONS + +# we want to keep track of usage global apis to minimize scope of usage for +# possible future mistakes that we will be using dynmically loaded libsai.so +# and by mistake someone will be calling global api that was linked with syncd, +# this will be hard error to locate + +set -e + +cd .. + +find -name "*.o" | +grep -v pyext | +grep -v tests | +while read all; +do + echo -n $all; + nm $all | + grep "U sai_" | + grep -vP "sai_metadata|sai_serialize|sai_deserialize" | + perl -npe 'chomp' + echo +done | +grep "U sai_" | +awk '{print $1}' | +perl -ne 'chomp; die "file $_ is using global sai_xxx API, please correct your code" if not /VendorSai.o|saisdkdump/' + +REGEX=`cat SAI/meta/saimetadata.c|grep dlsym|grep handle|perl -ne 'print "$1|" if /(sai_\w+)/'|perl -pe 'chop'|perl -ne 'print "\\\\b($_)\\\\b"'` + +set +e +find -name "*.cpp" -o -name "*.c" | +xargs grep -P "$REGEX" | +grep -vP "/unittest/|/tests/|/SAI/|/pyext/|tests.cpp|sai_vs_interfacequery|sai_redis_interfacequery|saisdkdump|SWSS_LOG|.cpp:\s+\*|.cpp:\s+//|sai_status_t\s+sai_|VendorSai.cpp:.+=\s*&sai_" + +if [ $? == 0 ]; then + echo not allowed files are using global sai_xxx API, please correct your code, only VendorSai.cpp and saisdkdump are allowed to use global SAI apis + exit 1 +fi + From 456780e458fceacf0cb6876d61a198e0f038a782 Mon Sep 17 00:00:00 2001 From: Yakiv Huryk <62013282+Yakiv-Huryk@users.noreply.github.com> Date: Sat, 25 May 2024 08:22:04 +0300 Subject: [PATCH 24/32] [nvidia] update config_syncd_nvidia_bluefield() (#1380) Signed-off-by: Yakiv Huryk --- syncd/scripts/syncd_init_common.sh | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/syncd/scripts/syncd_init_common.sh b/syncd/scripts/syncd_init_common.sh index b67983300..e2b56229b 100644 --- a/syncd/scripts/syncd_init_common.sh +++ b/syncd/scripts/syncd_init_common.sh @@ -350,15 +350,15 @@ config_syncd_nvidia_bluefield() # Read MAC addresses base_mac="$(echo $SYNCD_VARS | jq -r '.mac')" hwsku=$(sonic-cfggen -d -v 'DEVICE_METADATA["localhost"]["hwsku"]') + single_port=$([[ $hwsku == *"-com-dpu" ]] && echo true || echo false) + eth0_mac=$(cat /sys/class/net/Ethernet0/address) - eth4_mac=$(cat /sys/class/net/Ethernet4/address) cp $HWSKU_DIR/sai.profile /tmp/sai.profile # Update sai.profile with MAC_ADDRESS echo "DEVICE_MAC_ADDRESS=$base_mac" >> /tmp/sai.profile echo "PORT_1_MAC_ADDRESS=$eth0_mac" >> /tmp/sai.profile - echo "PORT_2_MAC_ADDRESS=$eth4_mac" >> /tmp/sai.profile CMD_ARGS+=" -l -p /tmp/sai.profile -w 180000000" @@ -372,17 +372,24 @@ config_syncd_nvidia_bluefield() mount -t hugetlbfs pagesize=1GB /mnt/huge devlink dev eswitch set pci/0000:03:00.0 mode legacy - devlink dev eswitch set pci/0000:03:00.1 mode legacy devlink dev eswitch set pci/0000:03:00.0 mode switchdev - devlink dev eswitch set pci/0000:03:00.1 mode switchdev - if [[ $hwsku != *"-C1" ]]; then + if [[ $hwsku != *"-C1" ]] && [[ $single_port == false ]]; then devlink dev param set pci/0000:03:00.0 name esw_multiport value 1 cmode runtime devlink dev param set pci/0000:03:00.1 name esw_multiport value 1 cmode runtime fi ethtool -A Ethernet0 rx off tx off - ethtool -A Ethernet4 rx off tx off + + if [[ $single_port == false ]]; then + eth4_mac=$(cat /sys/class/net/Ethernet4/address) + echo "PORT_2_MAC_ADDRESS=$eth4_mac" >> /tmp/sai.profile + + devlink dev eswitch set pci/0000:03:00.1 mode legacy + devlink dev eswitch set pci/0000:03:00.1 mode switchdev + + ethtool -A Ethernet4 rx off tx off + fi } config_syncd_xsight() From d4a085f64323fa17406aa4edc6a12fac28299def Mon Sep 17 00:00:00 2001 From: saksarav-nokia Date: Sat, 25 May 2024 04:28:48 -0400 Subject: [PATCH 25/32] Skip ASIC_TEMPERATURE attributes from sairedis recording (#1375) Skip SAI_SWITCH_ATTR_TEMP_LIST, SAI_SWITCH_ATTR_MAX_TEMP and SAI_SWITCH_ATTR_AVERAGE_TEMP attributes from sairedis recording since they are polled in every polling interval --- lib/SkipRecordAttrContainer.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/SkipRecordAttrContainer.cpp b/lib/SkipRecordAttrContainer.cpp index 074d08316..cdda07ba1 100644 --- a/lib/SkipRecordAttrContainer.cpp +++ b/lib/SkipRecordAttrContainer.cpp @@ -30,6 +30,9 @@ SkipRecordAttrContainer::SkipRecordAttrContainer() add(SAI_OBJECT_TYPE_SWITCH, SAI_SWITCH_ATTR_AVAILABLE_DOUBLE_NAT_ENTRY); add(SAI_OBJECT_TYPE_SWITCH, SAI_SWITCH_ATTR_AVAILABLE_ACL_TABLE); add(SAI_OBJECT_TYPE_SWITCH, SAI_SWITCH_ATTR_AVAILABLE_ACL_TABLE_GROUP); + add(SAI_OBJECT_TYPE_SWITCH, SAI_SWITCH_ATTR_TEMP_LIST); + add(SAI_OBJECT_TYPE_SWITCH, SAI_SWITCH_ATTR_MAX_TEMP); + add(SAI_OBJECT_TYPE_SWITCH, SAI_SWITCH_ATTR_AVERAGE_TEMP); add(SAI_OBJECT_TYPE_ACL_TABLE, SAI_ACL_TABLE_ATTR_AVAILABLE_ACL_ENTRY); add(SAI_OBJECT_TYPE_ACL_TABLE, SAI_ACL_TABLE_ATTR_AVAILABLE_ACL_COUNTER); From c3ad5ce62e48fd6afcc19672c57258388fd6fedb Mon Sep 17 00:00:00 2001 From: Kamil Cudnik Date: Sat, 25 May 2024 18:56:24 +0200 Subject: [PATCH 26/32] [saiproxy] Add SAI proxy library (#1363) Will be needed for DASH application SAI proxy will forward every SAI api call to server --- .gitignore | 3 + Makefile.am | 2 +- configure.ac | 2 + proxylib/Makefile.am | 83 +++ proxylib/Sai.cpp | 594 ++++++++++++++++++ proxylib/Sai.h | 194 ++++++ proxylib/SaiInternal.h | 4 + proxylib/sai_proxy.h | 450 +++++++++++++ proxylib/sai_proxy_acl.cpp | 20 + proxylib/sai_proxy_ars.cpp | 7 + proxylib/sai_proxy_ars_profile.cpp | 8 + proxylib/sai_proxy_bfd.cpp | 10 + proxylib/sai_proxy_bmtor.cpp | 18 + proxylib/sai_proxy_bridge.cpp | 14 + proxylib/sai_proxy_buffer.cpp | 16 + proxylib/sai_proxy_counter.cpp | 10 + proxylib/sai_proxy_dash_acl.cpp | 19 + proxylib/sai_proxy_dash_direction_lookup.cpp | 11 + proxylib/sai_proxy_dash_eni.cpp | 21 + proxylib/sai_proxy_dash_inbound_routing.cpp | 11 + proxylib/sai_proxy_dash_meter.cpp | 28 + proxylib/sai_proxy_dash_outbound_ca_to_pa.cpp | 11 + proxylib/sai_proxy_dash_outbound_routing.cpp | 11 + proxylib/sai_proxy_dash_pa_validation.cpp | 11 + proxylib/sai_proxy_dash_vip.cpp | 11 + proxylib/sai_proxy_dash_vnet.cpp | 11 + proxylib/sai_proxy_debug_counter.cpp | 8 + proxylib/sai_proxy_dtel.cpp | 16 + proxylib/sai_proxy_fdb.cpp | 26 + proxylib/sai_proxy_genericprogrammable.cpp | 7 + proxylib/sai_proxy_hash.cpp | 9 + proxylib/sai_proxy_hostif.cpp | 66 ++ proxylib/sai_proxy_interfacequery.cpp | 323 ++++++++++ proxylib/sai_proxy_ipmc.cpp | 8 + proxylib/sai_proxy_ipmc_group.cpp | 10 + proxylib/sai_proxy_ipsec.cpp | 16 + proxylib/sai_proxy_isolation_group.cpp | 10 + proxylib/sai_proxy_l2mc.cpp | 8 + proxylib/sai_proxy_l2mcgroup.cpp | 10 + proxylib/sai_proxy_lag.cpp | 16 + proxylib/sai_proxy_macsec.cpp | 24 + proxylib/sai_proxy_mcastfdb.cpp | 8 + proxylib/sai_proxy_mirror.cpp | 8 + proxylib/sai_proxy_mpls.cpp | 10 + proxylib/sai_proxy_my_mac.cpp | 8 + proxylib/sai_proxy_nat.cpp | 12 + proxylib/sai_proxy_neighbor.cpp | 20 + proxylib/sai_proxy_nexthop.cpp | 10 + proxylib/sai_proxy_nexthopgroup.cpp | 21 + proxylib/sai_proxy_poe.cpp | 12 + proxylib/sai_proxy_policer.cpp | 10 + proxylib/sai_proxy_port.cpp | 33 + proxylib/sai_proxy_qosmap.cpp | 8 + proxylib/sai_proxy_queue.cpp | 10 + proxylib/sai_proxy_route.cpp | 10 + proxylib/sai_proxy_router_interface.cpp | 12 + proxylib/sai_proxy_rpfgroup.cpp | 10 + proxylib/sai_proxy_samplepacket.cpp | 8 + proxylib/sai_proxy_scheduler.cpp | 8 + proxylib/sai_proxy_schedulergroup.cpp | 8 + proxylib/sai_proxy_srv6.cpp | 22 + proxylib/sai_proxy_stp.cpp | 15 + proxylib/sai_proxy_switch.cpp | 84 +++ proxylib/sai_proxy_system_port.cpp | 8 + proxylib/sai_proxy_tam.cpp | 42 ++ proxylib/sai_proxy_tunnel.cpp | 18 + proxylib/sai_proxy_twamp.cpp | 9 + proxylib/sai_proxy_udf.cpp | 12 + proxylib/sai_proxy_virtual_router.cpp | 8 + proxylib/sai_proxy_vlan.cpp | 18 + proxylib/sai_proxy_wred.cpp | 8 + tests/aspell.en.pws | 1 + tests/checksaiapi.sh | 2 +- unittest/Makefile.am | 2 +- unittest/proxylib/Makefile.am | 78 +++ unittest/proxylib/TestSai.cpp | 50 ++ unittest/proxylib/main.cpp | 21 + unittest/proxylib/main_libsaiproxy.cpp | 118 ++++ unittest/proxylib/test_sai_proxy_acl.cpp | 48 ++ unittest/proxylib/test_sai_proxy_ars.cpp | 23 + .../proxylib/test_sai_proxy_ars_profile.cpp | 23 + unittest/proxylib/test_sai_proxy_bfd.cpp | 27 + unittest/proxylib/test_sai_proxy_bmtor.cpp | 46 ++ unittest/proxylib/test_sai_proxy_bridge.cpp | 36 ++ unittest/proxylib/test_sai_proxy_buffer.cpp | 41 ++ unittest/proxylib/test_sai_proxy_counter.cpp | 27 + unittest/proxylib/test_sai_proxy_dash_acl.cpp | 33 + .../test_sai_proxy_dash_direction_lookup.cpp | 24 + unittest/proxylib/test_sai_proxy_dash_eni.cpp | 33 + .../test_sai_proxy_dash_inbound_routing.cpp | 24 + .../test_sai_proxy_dash_outbound_ca_to_pa.cpp | 24 + .../test_sai_proxy_dash_outbound_routing.cpp | 24 + .../test_sai_proxy_dash_pa_validation.cpp | 24 + unittest/proxylib/test_sai_proxy_dash_vip.cpp | 24 + .../proxylib/test_sai_proxy_dash_vnet.cpp | 24 + .../proxylib/test_sai_proxy_debug_counter.cpp | 23 + unittest/proxylib/test_sai_proxy_dtel.cpp | 43 ++ unittest/proxylib/test_sai_proxy_fdb.cpp | 30 + .../test_sai_proxy_generic_programmable.cpp | 23 + unittest/proxylib/test_sai_proxy_hash.cpp | 28 + unittest/proxylib/test_sai_proxy_hostif.cpp | 48 ++ .../test_sai_proxy_interfacequery.cpp | 115 ++++ unittest/proxylib/test_sai_proxy_ipmc.cpp | 23 + .../proxylib/test_sai_proxy_ipmc_group.cpp | 28 + .../test_sai_proxy_isolation_group.cpp | 28 + unittest/proxylib/test_sai_proxy_l2mc.cpp | 23 + .../proxylib/test_sai_proxy_l2mcgroup.cpp | 28 + unittest/proxylib/test_sai_proxy_lag.cpp | 31 + unittest/proxylib/test_sai_proxy_macsec.cpp | 59 ++ unittest/proxylib/test_sai_proxy_mcastfdb.cpp | 23 + unittest/proxylib/test_sai_proxy_mirror.cpp | 23 + unittest/proxylib/test_sai_proxy_mpls.cpp | 28 + unittest/proxylib/test_sai_proxy_nat.cpp | 35 ++ unittest/proxylib/test_sai_proxy_neighbor.cpp | 25 + unittest/proxylib/test_sai_proxy_nexthop.cpp | 23 + .../proxylib/test_sai_proxy_nexthopgroup.cpp | 36 ++ unittest/proxylib/test_sai_proxy_poe.cpp | 33 + unittest/proxylib/test_sai_proxy_policer.cpp | 27 + unittest/proxylib/test_sai_proxy_port.cpp | 48 ++ unittest/proxylib/test_sai_proxy_qosmap.cpp | 23 + unittest/proxylib/test_sai_proxy_queue.cpp | 27 + unittest/proxylib/test_sai_proxy_route.cpp | 28 + .../test_sai_proxy_router_interface.cpp | 27 + .../test_sai_proxy_router_rpfgroup.cpp | 28 + .../test_sai_proxy_router_samplepacket.cpp | 23 + .../proxylib/test_sai_proxy_scheduler.cpp | 23 + .../test_sai_proxy_schedulergroup.cpp | 23 + unittest/proxylib/test_sai_proxy_srv6.cpp | 36 ++ unittest/proxylib/test_sai_proxy_stp.cpp | 31 + unittest/proxylib/test_sai_proxy_switch.cpp | 35 ++ .../proxylib/test_sai_proxy_system_port.cpp | 23 + unittest/proxylib/test_sai_proxy_tam.cpp | 85 +++ unittest/proxylib/test_sai_proxy_tunnel.cpp | 49 ++ unittest/proxylib/test_sai_proxy_udf.cpp | 33 + .../test_sai_proxy_virtual_router.cpp | 23 + unittest/proxylib/test_sai_proxy_vlan.cpp | 35 ++ unittest/proxylib/test_sai_proxy_wred.cpp | 23 + unittest/vslib/test_sai_vs_poe.cpp | 2 +- unittest/vslib/test_sai_vs_tam.cpp | 2 +- 139 files changed, 4789 insertions(+), 5 deletions(-) create mode 100644 proxylib/Makefile.am create mode 100644 proxylib/Sai.cpp create mode 100644 proxylib/Sai.h create mode 100644 proxylib/SaiInternal.h create mode 100644 proxylib/sai_proxy.h create mode 100644 proxylib/sai_proxy_acl.cpp create mode 100644 proxylib/sai_proxy_ars.cpp create mode 100644 proxylib/sai_proxy_ars_profile.cpp create mode 100644 proxylib/sai_proxy_bfd.cpp create mode 100644 proxylib/sai_proxy_bmtor.cpp create mode 100644 proxylib/sai_proxy_bridge.cpp create mode 100644 proxylib/sai_proxy_buffer.cpp create mode 100644 proxylib/sai_proxy_counter.cpp create mode 100644 proxylib/sai_proxy_dash_acl.cpp create mode 100644 proxylib/sai_proxy_dash_direction_lookup.cpp create mode 100644 proxylib/sai_proxy_dash_eni.cpp create mode 100644 proxylib/sai_proxy_dash_inbound_routing.cpp create mode 100644 proxylib/sai_proxy_dash_meter.cpp create mode 100644 proxylib/sai_proxy_dash_outbound_ca_to_pa.cpp create mode 100644 proxylib/sai_proxy_dash_outbound_routing.cpp create mode 100644 proxylib/sai_proxy_dash_pa_validation.cpp create mode 100644 proxylib/sai_proxy_dash_vip.cpp create mode 100644 proxylib/sai_proxy_dash_vnet.cpp create mode 100644 proxylib/sai_proxy_debug_counter.cpp create mode 100644 proxylib/sai_proxy_dtel.cpp create mode 100644 proxylib/sai_proxy_fdb.cpp create mode 100644 proxylib/sai_proxy_genericprogrammable.cpp create mode 100644 proxylib/sai_proxy_hash.cpp create mode 100644 proxylib/sai_proxy_hostif.cpp create mode 100644 proxylib/sai_proxy_interfacequery.cpp create mode 100644 proxylib/sai_proxy_ipmc.cpp create mode 100644 proxylib/sai_proxy_ipmc_group.cpp create mode 100644 proxylib/sai_proxy_ipsec.cpp create mode 100644 proxylib/sai_proxy_isolation_group.cpp create mode 100644 proxylib/sai_proxy_l2mc.cpp create mode 100644 proxylib/sai_proxy_l2mcgroup.cpp create mode 100644 proxylib/sai_proxy_lag.cpp create mode 100644 proxylib/sai_proxy_macsec.cpp create mode 100644 proxylib/sai_proxy_mcastfdb.cpp create mode 100644 proxylib/sai_proxy_mirror.cpp create mode 100644 proxylib/sai_proxy_mpls.cpp create mode 100644 proxylib/sai_proxy_my_mac.cpp create mode 100644 proxylib/sai_proxy_nat.cpp create mode 100644 proxylib/sai_proxy_neighbor.cpp create mode 100644 proxylib/sai_proxy_nexthop.cpp create mode 100644 proxylib/sai_proxy_nexthopgroup.cpp create mode 100644 proxylib/sai_proxy_poe.cpp create mode 100644 proxylib/sai_proxy_policer.cpp create mode 100644 proxylib/sai_proxy_port.cpp create mode 100644 proxylib/sai_proxy_qosmap.cpp create mode 100644 proxylib/sai_proxy_queue.cpp create mode 100644 proxylib/sai_proxy_route.cpp create mode 100644 proxylib/sai_proxy_router_interface.cpp create mode 100644 proxylib/sai_proxy_rpfgroup.cpp create mode 100644 proxylib/sai_proxy_samplepacket.cpp create mode 100644 proxylib/sai_proxy_scheduler.cpp create mode 100644 proxylib/sai_proxy_schedulergroup.cpp create mode 100644 proxylib/sai_proxy_srv6.cpp create mode 100644 proxylib/sai_proxy_stp.cpp create mode 100644 proxylib/sai_proxy_switch.cpp create mode 100644 proxylib/sai_proxy_system_port.cpp create mode 100644 proxylib/sai_proxy_tam.cpp create mode 100644 proxylib/sai_proxy_tunnel.cpp create mode 100644 proxylib/sai_proxy_twamp.cpp create mode 100644 proxylib/sai_proxy_udf.cpp create mode 100644 proxylib/sai_proxy_virtual_router.cpp create mode 100644 proxylib/sai_proxy_vlan.cpp create mode 100644 proxylib/sai_proxy_wred.cpp create mode 100644 unittest/proxylib/Makefile.am create mode 100644 unittest/proxylib/TestSai.cpp create mode 100644 unittest/proxylib/main.cpp create mode 100644 unittest/proxylib/main_libsaiproxy.cpp create mode 100644 unittest/proxylib/test_sai_proxy_acl.cpp create mode 100644 unittest/proxylib/test_sai_proxy_ars.cpp create mode 100644 unittest/proxylib/test_sai_proxy_ars_profile.cpp create mode 100644 unittest/proxylib/test_sai_proxy_bfd.cpp create mode 100644 unittest/proxylib/test_sai_proxy_bmtor.cpp create mode 100644 unittest/proxylib/test_sai_proxy_bridge.cpp create mode 100644 unittest/proxylib/test_sai_proxy_buffer.cpp create mode 100644 unittest/proxylib/test_sai_proxy_counter.cpp create mode 100644 unittest/proxylib/test_sai_proxy_dash_acl.cpp create mode 100644 unittest/proxylib/test_sai_proxy_dash_direction_lookup.cpp create mode 100644 unittest/proxylib/test_sai_proxy_dash_eni.cpp create mode 100644 unittest/proxylib/test_sai_proxy_dash_inbound_routing.cpp create mode 100644 unittest/proxylib/test_sai_proxy_dash_outbound_ca_to_pa.cpp create mode 100644 unittest/proxylib/test_sai_proxy_dash_outbound_routing.cpp create mode 100644 unittest/proxylib/test_sai_proxy_dash_pa_validation.cpp create mode 100644 unittest/proxylib/test_sai_proxy_dash_vip.cpp create mode 100644 unittest/proxylib/test_sai_proxy_dash_vnet.cpp create mode 100644 unittest/proxylib/test_sai_proxy_debug_counter.cpp create mode 100644 unittest/proxylib/test_sai_proxy_dtel.cpp create mode 100644 unittest/proxylib/test_sai_proxy_fdb.cpp create mode 100644 unittest/proxylib/test_sai_proxy_generic_programmable.cpp create mode 100644 unittest/proxylib/test_sai_proxy_hash.cpp create mode 100644 unittest/proxylib/test_sai_proxy_hostif.cpp create mode 100644 unittest/proxylib/test_sai_proxy_interfacequery.cpp create mode 100644 unittest/proxylib/test_sai_proxy_ipmc.cpp create mode 100644 unittest/proxylib/test_sai_proxy_ipmc_group.cpp create mode 100644 unittest/proxylib/test_sai_proxy_isolation_group.cpp create mode 100644 unittest/proxylib/test_sai_proxy_l2mc.cpp create mode 100644 unittest/proxylib/test_sai_proxy_l2mcgroup.cpp create mode 100644 unittest/proxylib/test_sai_proxy_lag.cpp create mode 100644 unittest/proxylib/test_sai_proxy_macsec.cpp create mode 100644 unittest/proxylib/test_sai_proxy_mcastfdb.cpp create mode 100644 unittest/proxylib/test_sai_proxy_mirror.cpp create mode 100644 unittest/proxylib/test_sai_proxy_mpls.cpp create mode 100644 unittest/proxylib/test_sai_proxy_nat.cpp create mode 100644 unittest/proxylib/test_sai_proxy_neighbor.cpp create mode 100644 unittest/proxylib/test_sai_proxy_nexthop.cpp create mode 100644 unittest/proxylib/test_sai_proxy_nexthopgroup.cpp create mode 100644 unittest/proxylib/test_sai_proxy_poe.cpp create mode 100644 unittest/proxylib/test_sai_proxy_policer.cpp create mode 100644 unittest/proxylib/test_sai_proxy_port.cpp create mode 100644 unittest/proxylib/test_sai_proxy_qosmap.cpp create mode 100644 unittest/proxylib/test_sai_proxy_queue.cpp create mode 100644 unittest/proxylib/test_sai_proxy_route.cpp create mode 100644 unittest/proxylib/test_sai_proxy_router_interface.cpp create mode 100644 unittest/proxylib/test_sai_proxy_router_rpfgroup.cpp create mode 100644 unittest/proxylib/test_sai_proxy_router_samplepacket.cpp create mode 100644 unittest/proxylib/test_sai_proxy_scheduler.cpp create mode 100644 unittest/proxylib/test_sai_proxy_schedulergroup.cpp create mode 100644 unittest/proxylib/test_sai_proxy_srv6.cpp create mode 100644 unittest/proxylib/test_sai_proxy_stp.cpp create mode 100644 unittest/proxylib/test_sai_proxy_switch.cpp create mode 100644 unittest/proxylib/test_sai_proxy_system_port.cpp create mode 100644 unittest/proxylib/test_sai_proxy_tam.cpp create mode 100644 unittest/proxylib/test_sai_proxy_tunnel.cpp create mode 100644 unittest/proxylib/test_sai_proxy_udf.cpp create mode 100644 unittest/proxylib/test_sai_proxy_virtual_router.cpp create mode 100644 unittest/proxylib/test_sai_proxy_vlan.cpp create mode 100644 unittest/proxylib/test_sai_proxy_wred.cpp diff --git a/.gitignore b/.gitignore index f2dceea04..8c8bd913d 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ *.so *.pyc *_wrap.cpp +*.bak # Packaging Files # ################### @@ -111,6 +112,8 @@ unittest/meta/tests unittest/syncd/tests unittest/vslib/tests unittest/vslib/testslibsaivs +unittest/proxylib/tests +unittest/proxylib/testslibsaiproxy vslib/tests # Temporary files # diff --git a/Makefile.am b/Makefile.am index efea0003d..618545716 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = meta lib vslib pyext +SUBDIRS = meta lib vslib pyext proxylib if SYNCD SUBDIRS += syncd saiplayer saidump saidiscovery saisdkdump saiasiccmp tests unittest diff --git a/configure.ac b/configure.ac index 4c601e0fe..43fe79fab 100644 --- a/configure.ac +++ b/configure.ac @@ -290,11 +290,13 @@ AC_OUTPUT(Makefile saidiscovery/Makefile saiasiccmp/Makefile tests/Makefile + proxylib/Makefile unittest/Makefile unittest/meta/Makefile unittest/lib/Makefile unittest/vslib/Makefile unittest/syncd/Makefile + unittest/proxylib/Makefile pyext/Makefile pyext/py2/Makefile pyext/py3/Makefile) diff --git a/proxylib/Makefile.am b/proxylib/Makefile.am new file mode 100644 index 000000000..f0aecef41 --- /dev/null +++ b/proxylib/Makefile.am @@ -0,0 +1,83 @@ +AM_CXXFLAGS = $(SAIINC) -I$(top_srcdir)/lib + +lib_LTLIBRARIES = libsaiproxy.la + +noinst_LIBRARIES = libSaiProxy.a + +libSaiProxy_a_SOURCES = \ + Sai.cpp + +libsaiproxy_la_SOURCES = \ + sai_proxy_acl.cpp \ + sai_proxy_bfd.cpp \ + sai_proxy_bmtor.cpp \ + sai_proxy_bridge.cpp \ + sai_proxy_buffer.cpp \ + sai_proxy_counter.cpp \ + sai_proxy_dash_vip.cpp \ + sai_proxy_dash_pa_validation.cpp \ + sai_proxy_dash_vnet.cpp \ + sai_proxy_dash_outbound_routing.cpp \ + sai_proxy_dash_outbound_ca_to_pa.cpp \ + sai_proxy_dash_inbound_routing.cpp \ + sai_proxy_dash_eni.cpp \ + sai_proxy_dash_direction_lookup.cpp \ + sai_proxy_dash_acl.cpp \ + sai_proxy_debug_counter.cpp \ + sai_proxy_dtel.cpp \ + sai_proxy_fdb.cpp \ + sai_proxy_genericprogrammable.cpp \ + sai_proxy_hash.cpp \ + sai_proxy_hostif.cpp \ + sai_proxy_interfacequery.cpp \ + sai_proxy_ipmc.cpp \ + sai_proxy_ipmc_group.cpp \ + sai_proxy_isolation_group.cpp \ + sai_proxy_l2mc.cpp \ + sai_proxy_l2mcgroup.cpp \ + sai_proxy_lag.cpp \ + sai_proxy_macsec.cpp \ + sai_proxy_mcastfdb.cpp \ + sai_proxy_mirror.cpp \ + sai_proxy_mpls.cpp \ + sai_proxy_nat.cpp \ + sai_proxy_neighbor.cpp \ + sai_proxy_nexthop.cpp \ + sai_proxy_nexthopgroup.cpp \ + sai_proxy_policer.cpp \ + sai_proxy_port.cpp \ + sai_proxy_qosmap.cpp \ + sai_proxy_queue.cpp \ + sai_proxy_route.cpp \ + sai_proxy_router_interface.cpp \ + sai_proxy_rpfgroup.cpp \ + sai_proxy_samplepacket.cpp \ + sai_proxy_scheduler.cpp \ + sai_proxy_schedulergroup.cpp \ + sai_proxy_srv6.cpp \ + sai_proxy_stp.cpp \ + sai_proxy_switch.cpp \ + sai_proxy_system_port.cpp \ + sai_proxy_tam.cpp \ + sai_proxy_tunnel.cpp \ + sai_proxy_udf.cpp \ + sai_proxy_virtual_router.cpp \ + sai_proxy_vlan.cpp \ + sai_proxy_wred.cpp \ + sai_proxy_ipsec.cpp \ + sai_proxy_my_mac.cpp \ + sai_proxy_ars.cpp \ + sai_proxy_ars_profile.cpp \ + sai_proxy_twamp.cpp \ + sai_proxy_poe.cpp \ + sai_proxy_dash_meter.cpp + +libSaiProxy_a_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS) +libSaiProxy_a_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) $(CODE_COVERAGE_CXXFLAGS) + +libsaiproxy_la_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS) +libsaiproxy_la_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) $(CODE_COVERAGE_CXXFLAGS) +libsaiproxy_la_LIBADD = -lhiredis -lswsscommon libSaiProxy.a $(CODE_COVERAGE_LIBS) + +# TODO - lib sai proxy server that will accept VendorSai + diff --git a/proxylib/Sai.cpp b/proxylib/Sai.cpp new file mode 100644 index 000000000..a217769a3 --- /dev/null +++ b/proxylib/Sai.cpp @@ -0,0 +1,594 @@ +#include "Sai.h" +#include "SaiInternal.h" + +#include "meta/Meta.h" +#include "meta/sai_serialize.h" + +using namespace saiproxy; +using namespace std::placeholders; + +#define PROXY_CHECK_API_INITIALIZED() \ + if (!m_apiInitialized) { \ + SWSS_LOG_ERROR("%s: api not initialized", __PRETTY_FUNCTION__); \ + return SAI_STATUS_FAILURE; } + +#define PROXY_CHECK_POINTER(pointer) \ + if ((pointer) == nullptr) { \ + SWSS_LOG_ERROR("entry pointer " # pointer " is null"); \ + return SAI_STATUS_INVALID_PARAMETER; } + +Sai::Sai() +{ + SWSS_LOG_ENTER(); + + m_apiInitialized = false; +} + +Sai::~Sai() +{ + SWSS_LOG_ENTER(); + + if (m_apiInitialized) + { + uninitialize(); + } +} + +// INITIALIZE UNINITIALIZE + +sai_status_t Sai::initialize( + _In_ uint64_t flags, + _In_ const sai_service_method_table_t *service_method_table) +{ + MUTEX(); + SWSS_LOG_ENTER(); + + if (m_apiInitialized) + { + SWSS_LOG_ERROR("%s: api already initialized", __PRETTY_FUNCTION__); + + return SAI_STATUS_FAILURE; + } + + if (flags != 0) + { + SWSS_LOG_ERROR("invalid flags passed to SAI API initialize"); + + return SAI_STATUS_INVALID_PARAMETER; + } + + if ((service_method_table == NULL) || + (service_method_table->profile_get_next_value == NULL) || + (service_method_table->profile_get_value == NULL)) + { + SWSS_LOG_ERROR("invalid service_method_table handle passed to SAI API initialize"); + + return SAI_STATUS_INVALID_PARAMETER; + } + + memcpy(&m_service_method_table, service_method_table, sizeof(m_service_method_table)); + + // TODO move to service method table and + // TODO enable for channel to work! +// m_communicationChannel = std::make_shared<_ZeroMQChannel>( +// "/tmp/saiproxy", +// "/tmp/saiproxy_ntf", +// std::bind(&Sai::handleNotification, this, _1, _2, _3)); + + m_apiInitialized = true; + + return SAI_STATUS_SUCCESS; +} + +sai_status_t Sai::uninitialize(void) +{ + SWSS_LOG_ENTER(); + PROXY_CHECK_API_INITIALIZED(); + + SWSS_LOG_NOTICE("begin"); + + m_apiInitialized = false; + + SWSS_LOG_NOTICE("end"); + + return SAI_STATUS_SUCCESS; +} + +// QUAD OID + +sai_status_t Sai::create( + _In_ sai_object_type_t objectType, + _Out_ sai_object_id_t* objectId, + _In_ sai_object_id_t switchId, + _In_ uint32_t attr_count, + _In_ const sai_attribute_t *attr_list) +{ + MUTEX(); + SWSS_LOG_ENTER(); + PROXY_CHECK_API_INITIALIZED(); + + SWSS_LOG_ERROR("not implemented, FIXME"); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +sai_status_t Sai::remove( + _In_ sai_object_type_t objectType, + _In_ sai_object_id_t objectId) +{ + MUTEX(); + SWSS_LOG_ENTER(); + PROXY_CHECK_API_INITIALIZED(); + + SWSS_LOG_ERROR("not implemented, FIXME"); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +sai_status_t Sai::set( + _In_ sai_object_type_t objectType, + _In_ sai_object_id_t objectId, + _In_ const sai_attribute_t *attr) +{ + MUTEX(); + SWSS_LOG_ENTER(); + PROXY_CHECK_API_INITIALIZED(); + + SWSS_LOG_ERROR("not implemented, FIXME"); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +sai_status_t Sai::get( + _In_ sai_object_type_t objectType, + _In_ sai_object_id_t objectId, + _In_ uint32_t attr_count, + _Inout_ sai_attribute_t *attr_list) +{ + MUTEX(); + SWSS_LOG_ENTER(); + PROXY_CHECK_API_INITIALIZED(); + + SWSS_LOG_ERROR("not implemented, FIXME"); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +// QUAD ENTRY + +#define DECLARE_CREATE_ENTRY(OT,ot) \ +sai_status_t Sai::create( \ + _In_ const sai_ ## ot ## _t* entry, \ + _In_ uint32_t attr_count, \ + _In_ const sai_attribute_t *attr_list) \ +{ \ + MUTEX(); \ + SWSS_LOG_ENTER(); \ + PROXY_CHECK_API_INITIALIZED(); \ + PROXY_CHECK_POINTER(entry) \ + SWSS_LOG_ERROR("not implemented, FIXME"); \ + return SAI_STATUS_NOT_IMPLEMENTED; \ +} + +SAIREDIS_DECLARE_EVERY_ENTRY(DECLARE_CREATE_ENTRY); + +#define DECLARE_REMOVE_ENTRY(OT,ot) \ +sai_status_t Sai::remove( \ + _In_ const sai_ ## ot ## _t* entry) \ +{ \ + MUTEX(); \ + SWSS_LOG_ENTER(); \ + PROXY_CHECK_API_INITIALIZED(); \ + PROXY_CHECK_POINTER(entry) \ + SWSS_LOG_ERROR("not implemented, FIXME"); \ + return SAI_STATUS_NOT_IMPLEMENTED; \ +} + +SAIREDIS_DECLARE_EVERY_ENTRY(DECLARE_REMOVE_ENTRY); + +#define DECLARE_SET_ENTRY(OT,ot) \ +sai_status_t Sai::set( \ + _In_ const sai_ ## ot ## _t* entry, \ + _In_ const sai_attribute_t *attr) \ +{ \ + MUTEX(); \ + SWSS_LOG_ENTER(); \ + PROXY_CHECK_API_INITIALIZED(); \ + PROXY_CHECK_POINTER(entry) \ + SWSS_LOG_ERROR("not implemented, FIXME"); \ + return SAI_STATUS_NOT_IMPLEMENTED; \ +} + +SAIREDIS_DECLARE_EVERY_ENTRY(DECLARE_SET_ENTRY); + +#define DECLARE_GET_ENTRY(OT,ot) \ +sai_status_t Sai::get( \ + _In_ const sai_ ## ot ## _t* entry, \ + _In_ uint32_t attr_count, \ + _Inout_ sai_attribute_t *attr_list) \ +{ \ + MUTEX(); \ + SWSS_LOG_ENTER(); \ + PROXY_CHECK_API_INITIALIZED(); \ + PROXY_CHECK_POINTER(entry) \ + SWSS_LOG_ERROR("not implemented, FIXME"); \ + return SAI_STATUS_NOT_IMPLEMENTED; \ +} + +SAIREDIS_DECLARE_EVERY_ENTRY(DECLARE_GET_ENTRY); + +// STATS + +sai_status_t Sai::getStats( + _In_ sai_object_type_t object_type, + _In_ sai_object_id_t object_id, + _In_ uint32_t number_of_counters, + _In_ const sai_stat_id_t *counter_ids, + _Out_ uint64_t *counters) +{ + MUTEX(); + SWSS_LOG_ENTER(); + PROXY_CHECK_API_INITIALIZED(); + + SWSS_LOG_ERROR("not implemented, FIXME"); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +sai_status_t Sai::queryStatsCapability( + _In_ sai_object_id_t switchId, + _In_ sai_object_type_t objectType, + _Inout_ sai_stat_capability_list_t *stats_capability) +{ + SWSS_LOG_ENTER(); + + SWSS_LOG_ERROR("not implemented, FIXME"); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +sai_status_t Sai::getStatsExt( + _In_ sai_object_type_t object_type, + _In_ sai_object_id_t object_id, + _In_ uint32_t number_of_counters, + _In_ const sai_stat_id_t *counter_ids, + _In_ sai_stats_mode_t mode, + _Out_ uint64_t *counters) +{ + MUTEX(); + SWSS_LOG_ENTER(); + PROXY_CHECK_API_INITIALIZED(); + + SWSS_LOG_ERROR("not implemented, FIXME"); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +sai_status_t Sai::clearStats( + _In_ sai_object_type_t object_type, + _In_ sai_object_id_t object_id, + _In_ uint32_t number_of_counters, + _In_ const sai_stat_id_t *counter_ids) +{ + MUTEX(); + SWSS_LOG_ENTER(); + PROXY_CHECK_API_INITIALIZED(); + + SWSS_LOG_ERROR("not implemented, FIXME"); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +sai_status_t Sai::bulkGetStats( + _In_ sai_object_id_t switchId, + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_key_t *object_key, + _In_ uint32_t number_of_counters, + _In_ const sai_stat_id_t *counter_ids, + _In_ sai_stats_mode_t mode, + _Inout_ sai_status_t *object_statuses, + _Out_ uint64_t *counters) +{ + SWSS_LOG_ENTER(); + + SWSS_LOG_ERROR("not implemented, FIXME"); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +sai_status_t Sai::bulkClearStats( + _In_ sai_object_id_t switchId, + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_key_t *object_key, + _In_ uint32_t number_of_counters, + _In_ const sai_stat_id_t *counter_ids, + _In_ sai_stats_mode_t mode, + _Inout_ sai_status_t *object_statuses) +{ + SWSS_LOG_ENTER(); + + SWSS_LOG_ERROR("not implemented, FIXME"); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +// BULK QUAD OID + +sai_status_t Sai::bulkCreate( + _In_ sai_object_type_t object_type, + _In_ sai_object_id_t switch_id, + _In_ uint32_t object_count, + _In_ const uint32_t *attr_count, + _In_ const sai_attribute_t **attr_list, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_object_id_t *object_id, + _Out_ sai_status_t *object_statuses) +{ + MUTEX(); + SWSS_LOG_ENTER(); + PROXY_CHECK_API_INITIALIZED(); + PROXY_CHECK_POINTER(object_id); + PROXY_CHECK_POINTER(object_statuses); + + SWSS_LOG_ERROR("not implemented, FIXME"); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +sai_status_t Sai::bulkRemove( + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_id_t *object_id, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses) +{ + MUTEX(); + SWSS_LOG_ENTER(); + PROXY_CHECK_API_INITIALIZED(); + PROXY_CHECK_POINTER(object_id); + PROXY_CHECK_POINTER(object_statuses); + + SWSS_LOG_ERROR("not implemented, FIXME"); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +sai_status_t Sai::bulkSet( + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_id_t *object_id, + _In_ const sai_attribute_t *attr_list, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses) +{ + MUTEX(); + SWSS_LOG_ENTER(); + PROXY_CHECK_API_INITIALIZED(); + PROXY_CHECK_POINTER(object_statuses); + + SWSS_LOG_ERROR("not implemented, FIXME"); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +// BULK QUAD ENTRY + +#define DECLARE_BULK_CREATE_ENTRY(OT,ot) \ +sai_status_t Sai::bulkCreate( \ + _In_ uint32_t object_count, \ + _In_ const sai_ ## ot ## _t* entries, \ + _In_ const uint32_t *attr_count, \ + _In_ const sai_attribute_t **attr_list, \ + _In_ sai_bulk_op_error_mode_t mode, \ + _Out_ sai_status_t *object_statuses) \ +{ \ + MUTEX(); \ + SWSS_LOG_ENTER(); \ + PROXY_CHECK_API_INITIALIZED(); \ + PROXY_CHECK_POINTER(entries) \ + SWSS_LOG_ERROR("not implemented, FIXME"); \ + return SAI_STATUS_NOT_IMPLEMENTED; \ +} + +SAIREDIS_DECLARE_EVERY_BULK_ENTRY(DECLARE_BULK_CREATE_ENTRY); + +// BULK REMOVE + +#define DECLARE_BULK_REMOVE_ENTRY(OT,ot) \ +sai_status_t Sai::bulkRemove( \ + _In_ uint32_t object_count, \ + _In_ const sai_ ## ot ## _t *entries, \ + _In_ sai_bulk_op_error_mode_t mode, \ + _Out_ sai_status_t *object_statuses) \ +{ \ + MUTEX(); \ + SWSS_LOG_ENTER(); \ + PROXY_CHECK_API_INITIALIZED(); \ + PROXY_CHECK_POINTER(entries) \ + SWSS_LOG_ERROR("not implemented, FIXME"); \ + return SAI_STATUS_NOT_IMPLEMENTED; \ +} + +SAIREDIS_DECLARE_EVERY_BULK_ENTRY(DECLARE_BULK_REMOVE_ENTRY); + +// BULK SET + +#define DECLARE_BULK_SET_ENTRY(OT,ot) \ +sai_status_t Sai::bulkSet( \ + _In_ uint32_t object_count, \ + _In_ const sai_ ## ot ## _t *entries, \ + _In_ const sai_attribute_t *attr_list, \ + _In_ sai_bulk_op_error_mode_t mode, \ + _Out_ sai_status_t *object_statuses) \ +{ \ + MUTEX(); \ + SWSS_LOG_ENTER(); \ + PROXY_CHECK_API_INITIALIZED(); \ + PROXY_CHECK_POINTER(entries) \ + SWSS_LOG_ERROR("not implemented, FIXME"); \ + return SAI_STATUS_NOT_IMPLEMENTED; \ +} + +SAIREDIS_DECLARE_EVERY_BULK_ENTRY(DECLARE_BULK_SET_ENTRY); + +// NON QUAD API + +sai_status_t Sai::flushFdbEntries( + _In_ sai_object_id_t switch_id, + _In_ uint32_t attr_count, + _In_ const sai_attribute_t *attr_list) +{ + MUTEX(); + SWSS_LOG_ENTER(); + PROXY_CHECK_API_INITIALIZED(); + + SWSS_LOG_ERROR("not implemented, FIXME"); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +// SAI API + +sai_status_t Sai::objectTypeGetAvailability( + _In_ sai_object_id_t switchId, + _In_ sai_object_type_t objectType, + _In_ uint32_t attrCount, + _In_ const sai_attribute_t *attrList, + _Out_ uint64_t *count) +{ + MUTEX(); + SWSS_LOG_ENTER(); + PROXY_CHECK_API_INITIALIZED(); + + SWSS_LOG_ERROR("not implemented, FIXME"); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +sai_status_t Sai::queryAttributeCapability( + _In_ sai_object_id_t switch_id, + _In_ sai_object_type_t object_type, + _In_ sai_attr_id_t attr_id, + _Out_ sai_attr_capability_t *capability) +{ + MUTEX(); + SWSS_LOG_ENTER(); + PROXY_CHECK_API_INITIALIZED(); + + SWSS_LOG_ERROR("not implemented, FIXME"); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +sai_status_t Sai::queryAattributeEnumValuesCapability( + _In_ sai_object_id_t switch_id, + _In_ sai_object_type_t object_type, + _In_ sai_attr_id_t attr_id, + _Inout_ sai_s32_list_t *enum_values_capability) +{ + MUTEX(); + SWSS_LOG_ENTER(); + PROXY_CHECK_API_INITIALIZED(); + + SWSS_LOG_ERROR("not implemented, FIXME"); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +sai_object_type_t Sai::objectTypeQuery( + _In_ sai_object_id_t objectId) +{ + MUTEX(); + SWSS_LOG_ENTER(); + + if (!m_apiInitialized) + { + SWSS_LOG_ERROR("%s: SAI API not initialized", __PRETTY_FUNCTION__); + + return SAI_OBJECT_TYPE_NULL; + } + + //json j; + + //j["switch_id"] = sai_serialize_object_id(switch_id); + + //return j.dump(); + + // TODO implement ! + + SWSS_LOG_ERROR("not implemented, FIXME"); + + return SAI_OBJECT_TYPE_NULL; +} + +sai_object_id_t Sai::switchIdQuery( + _In_ sai_object_id_t objectId) +{ + MUTEX(); + SWSS_LOG_ENTER(); + + if (!m_apiInitialized) + { + SWSS_LOG_ERROR("%s: SAI API not initialized", __PRETTY_FUNCTION__); + + return SAI_NULL_OBJECT_ID; + } + + // TODO implement ! + + SWSS_LOG_ERROR("not implemented, FIXME"); + + return SAI_NULL_OBJECT_ID; +} + +sai_status_t Sai::logSet( + _In_ sai_api_t api, + _In_ sai_log_level_t log_level) +{ + MUTEX(); + SWSS_LOG_ENTER(); + PROXY_CHECK_API_INITIALIZED(); + + SWSS_LOG_WARN("log set not implemented for %s:%s", + sai_serialize_api(api).c_str(), + sai_serialize_log_level(log_level).c_str()); + + return SAI_STATUS_SUCCESS; +} + +//sai_switch_notifications_t Sai::handle_notification( +// _In_ std::shared_ptr notification) +//{ +// MUTEX(); +// SWSS_LOG_ENTER(); +// +// if (!m_apiInitialized) +// { +// SWSS_LOG_ERROR("%s: api not initialized", __PRETTY_FUNCTION__); +// +// return { }; +// } +// +// return context->m_redisSai->syncProcessNotification(notification); +//} +// +//void Sai::handleNotification( +// _In_ const std::string &name, +// _In_ const std::string &serializedNotification, +// _In_ const std::vector &values) +//{ +// SWSS_LOG_ENTER(); +// +// auto notification = NotificationFactory::deserialize(name, serializedNotification); +// +// if (notification) +// { +// auto _sn = m_notificationCallback(notification); // will be synchronized to api mutex +// +// // execute callback from notification thread +// +// notification->executeCallback(_sn); +// } +//} diff --git a/proxylib/Sai.h b/proxylib/Sai.h new file mode 100644 index 000000000..b06df2f55 --- /dev/null +++ b/proxylib/Sai.h @@ -0,0 +1,194 @@ +#pragma once + +#include "lib/Channel.h" +#include "meta/Meta.h" +#include "meta/Notification.h" + +#include "swss/logger.h" + +#include +#include +#include +#include +#include + +namespace saiproxy +{ + class Sai: + public sairedis::SaiInterface + { + public: + + Sai(); + + virtual ~Sai(); + + public: + + sai_status_t initialize( + _In_ uint64_t flags, + _In_ const sai_service_method_table_t *service_method_table) override; + + sai_status_t uninitialize(void) override; + + public: // SAI interface overrides + + virtual sai_status_t create( + _In_ sai_object_type_t objectType, + _Out_ sai_object_id_t* objectId, + _In_ sai_object_id_t switchId, + _In_ uint32_t attr_count, + _In_ const sai_attribute_t *attr_list) override; + + virtual sai_status_t remove( + _In_ sai_object_type_t objectType, + _In_ sai_object_id_t objectId) override; + + virtual sai_status_t set( + _In_ sai_object_type_t objectType, + _In_ sai_object_id_t objectId, + _In_ const sai_attribute_t *attr) override; + + virtual sai_status_t get( + _In_ sai_object_type_t objectType, + _In_ sai_object_id_t objectId, + _In_ uint32_t attr_count, + _Inout_ sai_attribute_t *attr_list) override; + + public: // QUAD ENTRY and BULK QUAD ENTRY + + SAIREDIS_DECLARE_EVERY_ENTRY(SAIREDIS_SAIINTERFACE_DECLARE_QUAD_ENTRY_OVERRIDE); + SAIREDIS_DECLARE_EVERY_BULK_ENTRY(SAIREDIS_SAIINTERFACE_DECLARE_BULK_ENTRY_OVERRIDE); + + public: // bulk QUAD oid + + virtual sai_status_t bulkCreate( + _In_ sai_object_type_t object_type, + _In_ sai_object_id_t switch_id, + _In_ uint32_t object_count, + _In_ const uint32_t *attr_count, + _In_ const sai_attribute_t **attr_list, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_object_id_t *object_id, + _Out_ sai_status_t *object_statuses) override; + + virtual sai_status_t bulkRemove( + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_id_t *object_id, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses) override; + + virtual sai_status_t bulkSet( + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_id_t *object_id, + _In_ const sai_attribute_t *attr_list, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses) override; + + public: // stats API + + virtual sai_status_t getStats( + _In_ sai_object_type_t object_type, + _In_ sai_object_id_t object_id, + _In_ uint32_t number_of_counters, + _In_ const sai_stat_id_t *counter_ids, + _Out_ uint64_t *counters) override; + + virtual sai_status_t queryStatsCapability( + _In_ sai_object_id_t switch_id, + _In_ sai_object_type_t object_type, + _Inout_ sai_stat_capability_list_t *stats_capability) override; + + virtual sai_status_t getStatsExt( + _In_ sai_object_type_t object_type, + _In_ sai_object_id_t object_id, + _In_ uint32_t number_of_counters, + _In_ const sai_stat_id_t *counter_ids, + _In_ sai_stats_mode_t mode, + _Out_ uint64_t *counters) override; + + virtual sai_status_t clearStats( + _In_ sai_object_type_t object_type, + _In_ sai_object_id_t object_id, + _In_ uint32_t number_of_counters, + _In_ const sai_stat_id_t *counter_ids) override; + + virtual sai_status_t bulkGetStats( + _In_ sai_object_id_t switchId, + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_key_t *object_key, + _In_ uint32_t number_of_counters, + _In_ const sai_stat_id_t *counter_ids, + _In_ sai_stats_mode_t mode, + _Inout_ sai_status_t *object_statuses, + _Out_ uint64_t *counters) override; + + virtual sai_status_t bulkClearStats( + _In_ sai_object_id_t switchId, + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_key_t *object_key, + _In_ uint32_t number_of_counters, + _In_ const sai_stat_id_t *counter_ids, + _In_ sai_stats_mode_t mode, + _Inout_ sai_status_t *object_statuses) override; + + public: // non QUAD API + + virtual sai_status_t flushFdbEntries( + _In_ sai_object_id_t switchId, + _In_ uint32_t attrCount, + _In_ const sai_attribute_t *attrList) override; + + public: // SAI API + + virtual sai_status_t objectTypeGetAvailability( + _In_ sai_object_id_t switchId, + _In_ sai_object_type_t objectType, + _In_ uint32_t attrCount, + _In_ const sai_attribute_t *attrList, + _Out_ uint64_t *count) override; + + virtual sai_status_t queryAttributeCapability( + _In_ sai_object_id_t switch_id, + _In_ sai_object_type_t object_type, + _In_ sai_attr_id_t attr_id, + _Out_ sai_attr_capability_t *capability) override; + + virtual sai_status_t queryAattributeEnumValuesCapability( + _In_ sai_object_id_t switch_id, + _In_ sai_object_type_t object_type, + _In_ sai_attr_id_t attr_id, + _Inout_ sai_s32_list_t *enum_values_capability) override; + + virtual sai_object_type_t objectTypeQuery( + _In_ sai_object_id_t objectId) override; + + virtual sai_object_id_t switchIdQuery( + _In_ sai_object_id_t objectId) override; + + virtual sai_status_t logSet( + _In_ sai_api_t api, + _In_ sai_log_level_t log_level) override; + + private: + + sai_switch_notifications_t handle_notification( + _In_ std::shared_ptr notification); + + private: + + bool m_apiInitialized; + + std::recursive_mutex m_apimutex; + + sai_service_method_table_t m_service_method_table; + + std::shared_ptr m_communicationChannel; + + std::function)> m_notificationCallback; + }; +} diff --git a/proxylib/SaiInternal.h b/proxylib/SaiInternal.h new file mode 100644 index 000000000..5ab4da121 --- /dev/null +++ b/proxylib/SaiInternal.h @@ -0,0 +1,4 @@ +#pragma once + +#define MUTEX() std::lock_guard _lock(m_apimutex) +#define MUTEX_UNLOCK() m_apimutex.unlock() diff --git a/proxylib/sai_proxy.h b/proxylib/sai_proxy.h new file mode 100644 index 000000000..e9810523e --- /dev/null +++ b/proxylib/sai_proxy.h @@ -0,0 +1,450 @@ +#pragma once + +extern "C" { +#include "sai.h" +#include "saiextensions.h" +} + +#include "meta/SaiInterface.h" + +#include "swss/logger.h" + +#include + +#define PRIVATE __attribute__((visibility("hidden"))) + +PRIVATE extern const sai_acl_api_t proxy_acl_api; +PRIVATE extern const sai_ars_api_t proxy_ars_api; +PRIVATE extern const sai_ars_profile_api_t proxy_ars_profile_api; +PRIVATE extern const sai_bfd_api_t proxy_bfd_api; +PRIVATE extern const sai_bmtor_api_t proxy_bmtor_api; +PRIVATE extern const sai_generic_programmable_api_t proxy_generic_programmable_api; +PRIVATE extern const sai_bridge_api_t proxy_bridge_api; +PRIVATE extern const sai_buffer_api_t proxy_buffer_api; +PRIVATE extern const sai_counter_api_t proxy_counter_api; +PRIVATE extern const sai_dash_vip_api_t proxy_dash_vip_api; +PRIVATE extern const sai_dash_pa_validation_api_t proxy_dash_pa_validation_api; +PRIVATE extern const sai_dash_vnet_api_t proxy_dash_vnet_api; +PRIVATE extern const sai_dash_outbound_routing_api_t proxy_dash_outbound_routing_api; +PRIVATE extern const sai_dash_outbound_ca_to_pa_api_t proxy_dash_outbound_ca_to_pa_api; +PRIVATE extern const sai_dash_inbound_routing_api_t proxy_dash_inbound_routing_api; +PRIVATE extern const sai_dash_eni_api_t proxy_dash_eni_api; +PRIVATE extern const sai_dash_direction_lookup_api_t proxy_dash_direction_lookup_api; +PRIVATE extern const sai_dash_acl_api_t proxy_dash_acl_api; +PRIVATE extern const sai_debug_counter_api_t proxy_debug_counter_api; +PRIVATE extern const sai_dtel_api_t proxy_dtel_api; +PRIVATE extern const sai_fdb_api_t proxy_fdb_api; +PRIVATE extern const sai_hash_api_t proxy_hash_api; +PRIVATE extern const sai_hostif_api_t proxy_hostif_api; +PRIVATE extern const sai_ipmc_api_t proxy_ipmc_api; +PRIVATE extern const sai_ipmc_group_api_t proxy_ipmc_group_api; +PRIVATE extern const sai_isolation_group_api_t proxy_isolation_group_api; +PRIVATE extern const sai_l2mc_api_t proxy_l2mc_api; +PRIVATE extern const sai_l2mc_group_api_t proxy_l2mc_group_api; +PRIVATE extern const sai_lag_api_t proxy_lag_api; +PRIVATE extern const sai_macsec_api_t proxy_macsec_api; +PRIVATE extern const sai_mcast_fdb_api_t proxy_mcast_fdb_api; +PRIVATE extern const sai_mirror_api_t proxy_mirror_api; +PRIVATE extern const sai_mpls_api_t proxy_mpls_api; +PRIVATE extern const sai_nat_api_t proxy_nat_api; +PRIVATE extern const sai_neighbor_api_t proxy_neighbor_api; +PRIVATE extern const sai_next_hop_api_t proxy_next_hop_api; +PRIVATE extern const sai_next_hop_group_api_t proxy_next_hop_group_api; +PRIVATE extern const sai_policer_api_t proxy_policer_api; +PRIVATE extern const sai_port_api_t proxy_port_api; +PRIVATE extern const sai_qos_map_api_t proxy_qos_map_api; +PRIVATE extern const sai_queue_api_t proxy_queue_api; +PRIVATE extern const sai_route_api_t proxy_route_api; +PRIVATE extern const sai_router_interface_api_t proxy_router_interface_api; +PRIVATE extern const sai_rpf_group_api_t proxy_rpf_group_api; +PRIVATE extern const sai_samplepacket_api_t proxy_samplepacket_api; +PRIVATE extern const sai_scheduler_api_t proxy_scheduler_api; +PRIVATE extern const sai_scheduler_group_api_t proxy_scheduler_group_api; +PRIVATE extern const sai_srv6_api_t proxy_srv6_api; +PRIVATE extern const sai_stp_api_t proxy_stp_api; +PRIVATE extern const sai_switch_api_t proxy_switch_api; +PRIVATE extern const sai_system_port_api_t proxy_system_port_api; +PRIVATE extern const sai_tam_api_t proxy_tam_api; +PRIVATE extern const sai_tunnel_api_t proxy_tunnel_api; +PRIVATE extern const sai_udf_api_t proxy_udf_api; +PRIVATE extern const sai_virtual_router_api_t proxy_virtual_router_api; +PRIVATE extern const sai_vlan_api_t proxy_vlan_api; +PRIVATE extern const sai_wred_api_t proxy_wred_api; +PRIVATE extern const sai_my_mac_api_t proxy_my_mac_api; +PRIVATE extern const sai_ipsec_api_t proxy_ipsec_api; +PRIVATE extern const sai_twamp_api_t proxy_twamp_api; +PRIVATE extern const sai_dash_meter_api_t proxy_dash_meter_api; +PRIVATE extern const sai_poe_api_t proxy_poe_api; + +PRIVATE extern std::shared_ptr proxy_sai; + +// QUAD OID + +#define PROXY_CREATE(OT,ot) \ + static sai_status_t proxy_create_ ## ot( \ + _Out_ sai_object_id_t *object_id, \ + _In_ sai_object_id_t switch_id, \ + _In_ uint32_t attr_count, \ + _In_ const sai_attribute_t *attr_list) \ +{ \ + SWSS_LOG_ENTER(); \ + return proxy_sai->create( \ + (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ + object_id, \ + switch_id, \ + attr_count, \ + attr_list); \ +} + +#define PROXY_REMOVE(OT,ot) \ + static sai_status_t proxy_remove_ ## ot( \ + _In_ sai_object_id_t object_id) \ +{ \ + SWSS_LOG_ENTER(); \ + return proxy_sai->remove( \ + (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ + object_id); \ +} + +#define PROXY_SET(OT,ot) \ + static sai_status_t proxy_set_ ## ot ## _attribute( \ + _In_ sai_object_id_t object_id, \ + _In_ const sai_attribute_t *attr) \ +{ \ + SWSS_LOG_ENTER(); \ + return proxy_sai->set( \ + (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ + object_id, \ + attr); \ +} + +#define PROXY_GET(OT,ot) \ + static sai_status_t proxy_get_ ## ot ## _attribute( \ + _In_ sai_object_id_t object_id, \ + _In_ uint32_t attr_count, \ + _Inout_ sai_attribute_t *attr_list) \ +{ \ + SWSS_LOG_ENTER(); \ + return proxy_sai->get( \ + (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ + object_id, \ + attr_count, \ + attr_list); \ +} + +// QUAD DECLARE + +#define PROXY_GENERIC_QUAD(OT,ot) \ + PROXY_CREATE(OT,ot); \ + PROXY_REMOVE(OT,ot); \ + PROXY_SET(OT,ot); \ + PROXY_GET(OT,ot); + +// QUAD ENTRY + +#define PROXY_CREATE_ENTRY(OT,ot) \ + static sai_status_t proxy_create_ ## ot( \ + _In_ const sai_ ## ot ##_t *entry, \ + _In_ uint32_t attr_count, \ + _In_ const sai_attribute_t *attr_list) \ +{ \ + SWSS_LOG_ENTER(); \ + return proxy_sai->create( \ + entry, \ + attr_count, \ + attr_list); \ +} + +#define PROXY_REMOVE_ENTRY(OT,ot) \ + static sai_status_t proxy_remove_ ## ot( \ + _In_ const sai_ ## ot ## _t *entry) \ +{ \ + SWSS_LOG_ENTER(); \ + return proxy_sai->remove( \ + entry); \ +} + +#define PROXY_SET_ENTRY(OT,ot) \ + static sai_status_t proxy_set_ ## ot ## _attribute( \ + _In_ const sai_ ## ot ## _t *entry, \ + _In_ const sai_attribute_t *attr) \ +{ \ + SWSS_LOG_ENTER(); \ + return proxy_sai->set( \ + entry, \ + attr); \ +} + +#define PROXY_GET_ENTRY(OT,ot) \ + static sai_status_t proxy_get_ ## ot ## _attribute( \ + _In_ const sai_ ## ot ## _t *entry, \ + _In_ uint32_t attr_count, \ + _Inout_ sai_attribute_t *attr_list) \ +{ \ + SWSS_LOG_ENTER(); \ + return proxy_sai->get( \ + entry, \ + attr_count, \ + attr_list); \ +} + +// QUAD ENTRY DECLARE + +#define PROXY_GENERIC_QUAD_ENTRY(OT,ot) \ + PROXY_CREATE_ENTRY(OT,ot); \ + PROXY_REMOVE_ENTRY(OT,ot); \ + PROXY_SET_ENTRY(OT,ot); \ + PROXY_GET_ENTRY(OT,ot); + +// QUAD API + +#define PROXY_GENERIC_QUAD_API(ot) \ + proxy_create_ ## ot, \ + proxy_remove_ ## ot, \ + proxy_set_ ## ot ##_attribute, \ + proxy_get_ ## ot ##_attribute, + +// STATS + +#define PROXY_GET_STATS(OT,ot) \ + static sai_status_t proxy_get_ ## ot ## _stats( \ + _In_ sai_object_id_t object_id, \ + _In_ uint32_t number_of_counters, \ + _In_ const sai_stat_id_t *counter_ids, \ + _Out_ uint64_t *counters) \ +{ \ + SWSS_LOG_ENTER(); \ + return proxy_sai->getStats( \ + (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ + object_id, \ + number_of_counters, \ + counter_ids, \ + counters); \ +} + +#define PROXY_GET_STATS_EXT(OT,ot) \ + static sai_status_t proxy_get_ ## ot ## _stats_ext( \ + _In_ sai_object_id_t object_id, \ + _In_ uint32_t number_of_counters, \ + _In_ const sai_stat_id_t *counter_ids, \ + _In_ sai_stats_mode_t mode, \ + _Out_ uint64_t *counters) \ +{ \ + SWSS_LOG_ENTER(); \ + return proxy_sai->getStatsExt( \ + (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ + object_id, \ + number_of_counters, \ + counter_ids, \ + mode, \ + counters); \ +} + +#define PROXY_CLEAR_STATS(OT,ot) \ + static sai_status_t proxy_clear_ ## ot ## _stats( \ + _In_ sai_object_id_t object_id, \ + _In_ uint32_t number_of_counters, \ + _In_ const sai_stat_id_t *counter_ids) \ +{ \ + SWSS_LOG_ENTER(); \ + return proxy_sai->clearStats( \ + (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ + object_id, \ + number_of_counters, \ + counter_ids); \ +} + +// STATS DECLARE + +#define PROXY_GENERIC_STATS(OT, ot) \ + PROXY_GET_STATS(OT,ot); \ + PROXY_GET_STATS_EXT(OT,ot); \ + PROXY_CLEAR_STATS(OT,ot); + +// STATS API + +#define PROXY_GENERIC_STATS_API(ot) \ + proxy_get_ ## ot ## _stats, \ + proxy_get_ ## ot ## _stats_ext, \ + proxy_clear_ ## ot ## _stats, + +// BULK QUAD + +#define PROXY_BULK_CREATE(OT,fname) \ + static sai_status_t proxy_bulk_create_ ## fname( \ + _In_ sai_object_id_t switch_id, \ + _In_ uint32_t object_count, \ + _In_ const uint32_t *attr_count, \ + _In_ const sai_attribute_t **attr_list, \ + _In_ sai_bulk_op_error_mode_t mode, \ + _Out_ sai_object_id_t *object_id, \ + _Out_ sai_status_t *object_statuses) \ +{ \ + SWSS_LOG_ENTER(); \ + return proxy_sai->bulkCreate( \ + (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ + switch_id, \ + object_count, \ + attr_count, \ + attr_list, \ + mode, \ + object_id, \ + object_statuses); \ +} + +#define PROXY_BULK_REMOVE(OT,fname) \ + static sai_status_t proxy_bulk_remove_ ## fname( \ + _In_ uint32_t object_count, \ + _In_ const sai_object_id_t *object_id, \ + _In_ sai_bulk_op_error_mode_t mode, \ + _Out_ sai_status_t *object_statuses) \ +{ \ + SWSS_LOG_ENTER(); \ + return proxy_sai->bulkRemove( \ + (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ + object_count, \ + object_id, \ + mode, \ + object_statuses); \ +} + +#define PROXY_BULK_SET(OT,fname) \ + static sai_status_t proxy_bulk_set_ ## fname( \ + _In_ uint32_t object_count, \ + _In_ const sai_object_id_t *object_id, \ + _In_ const sai_attribute_t *attr_list, \ + _In_ sai_bulk_op_error_mode_t mode, \ + _Out_ sai_status_t *object_statuses) \ +{ \ + SWSS_LOG_ENTER(); \ + return proxy_sai->bulkSet( \ + (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ + object_count, \ + object_id, \ + attr_list, \ + mode, \ + object_statuses); \ +} + +#define PROXY_BULK_GET(OT,fname) \ + static sai_status_t proxy_bulk_get_ ## fname( \ + _In_ uint32_t object_count, \ + _In_ const sai_object_id_t *object_id, \ + _In_ const uint32_t *attr_count, \ + _Inout_ sai_attribute_t **attr_list, \ + _In_ sai_bulk_op_error_mode_t mode, \ + _Out_ sai_status_t *object_statuses) \ +{ \ + SWSS_LOG_ENTER(); \ + SWSS_LOG_ERROR("not implemented"); \ + return SAI_STATUS_NOT_IMPLEMENTED; \ +} + +// BULK QUAD DECLARE + +#define PROXY_BULK_QUAD(OT,ot) \ + PROXY_BULK_CREATE(OT,ot); \ + PROXY_BULK_REMOVE(OT,ot); \ + PROXY_BULK_SET(OT,ot); \ + PROXY_BULK_GET(OT,ot); + +// BULK QUAD ENTRY + +#define PROXY_BULK_CREATE_ENTRY(OT,ot) \ + PROXY_BULK_CREATE_ENTRY_EX(OT, ot, ot) + +#define PROXY_BULK_CREATE_ENTRY_EX(OT,ot,fname) \ + static sai_status_t proxy_bulk_create_ ## fname(\ + _In_ uint32_t object_count, \ + _In_ const sai_ ## ot ## _t *entry, \ + _In_ const uint32_t *attr_count, \ + _In_ const sai_attribute_t **attr_list, \ + _In_ sai_bulk_op_error_mode_t mode, \ + _Out_ sai_status_t *object_statuses) \ +{ \ + SWSS_LOG_ENTER(); \ + return proxy_sai->bulkCreate( \ + object_count, \ + entry, \ + attr_count, \ + attr_list, \ + mode, \ + object_statuses); \ +} + +#define PROXY_BULK_REMOVE_ENTRY(OT,ot) \ + PROXY_BULK_REMOVE_ENTRY_EX(OT, ot, ot) + +#define PROXY_BULK_REMOVE_ENTRY_EX(OT,ot,fname) \ + static sai_status_t proxy_bulk_remove_ ## fname(\ + _In_ uint32_t object_count, \ + _In_ const sai_ ## ot ##_t *entry, \ + _In_ sai_bulk_op_error_mode_t mode, \ + _Out_ sai_status_t *object_statuses) \ +{ \ + SWSS_LOG_ENTER(); \ + return proxy_sai->bulkRemove( \ + object_count, \ + entry, \ + mode, \ + object_statuses); \ +} + +#define PROXY_BULK_SET_ENTRY(OT,ot) \ + static sai_status_t proxy_bulk_set_ ## ot( \ + _In_ uint32_t object_count, \ + _In_ const sai_ ## ot ## _t *entry, \ + _In_ const sai_attribute_t *attr_list, \ + _In_ sai_bulk_op_error_mode_t mode, \ + _Out_ sai_status_t *object_statuses) \ +{ \ + SWSS_LOG_ENTER(); \ + return proxy_sai->bulkSet( \ + object_count, \ + entry, \ + attr_list, \ + mode, \ + object_statuses); \ +} + +#define PROXY_BULK_GET_ENTRY(OT,ot) \ + static sai_status_t proxy_bulk_get_ ## ot( \ + _In_ uint32_t object_count, \ + _In_ const sai_ ## ot ## _t *entry, \ + _In_ const uint32_t *attr_count, \ + _Inout_ sai_attribute_t **attr_list, \ + _In_ sai_bulk_op_error_mode_t mode, \ + _Out_ sai_status_t *object_statuses) \ +{ \ + SWSS_LOG_ENTER(); \ + SWSS_LOG_ERROR("not implemented"); \ + return SAI_STATUS_NOT_IMPLEMENTED; \ +} + +// BULK QUAD ENTRY DECLARE + +#define PROXY_BULK_QUAD_ENTRY(OT,ot) \ + PROXY_BULK_CREATE_ENTRY(OT,ot); \ + PROXY_BULK_REMOVE_ENTRY(OT,ot); \ + PROXY_BULK_SET_ENTRY(OT,ot); \ + PROXY_BULK_GET_ENTRY(OT,ot); + +// BULK QUAD API + +#define PROXY_BULK_QUAD_API(ot) \ + proxy_bulk_create_ ## ot, \ + proxy_bulk_remove_ ## ot, \ + proxy_bulk_set_ ## ot, \ + proxy_bulk_get_ ## ot, + +// BULK get/set DECLARE + +#define PROXY_BULK_GET_SET(OT,ot) \ + PROXY_BULK_GET(OT,ot); \ + PROXY_BULK_SET(OT,ot); + +// BULK get/set API + +#define PROXY_BULK_GET_SET_API(ot) \ + proxy_bulk_get_ ## ot, \ + proxy_bulk_set_ ## ot, diff --git a/proxylib/sai_proxy_acl.cpp b/proxylib/sai_proxy_acl.cpp new file mode 100644 index 000000000..c5f653077 --- /dev/null +++ b/proxylib/sai_proxy_acl.cpp @@ -0,0 +1,20 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(ACL_TABLE,acl_table); +PROXY_GENERIC_QUAD(ACL_ENTRY,acl_entry); +PROXY_GENERIC_QUAD(ACL_COUNTER,acl_counter); +PROXY_GENERIC_QUAD(ACL_RANGE,acl_range); +PROXY_GENERIC_QUAD(ACL_TABLE_GROUP,acl_table_group); +PROXY_GENERIC_QUAD(ACL_TABLE_GROUP_MEMBER,acl_table_group_member); +PROXY_GENERIC_QUAD(ACL_TABLE_CHAIN_GROUP,acl_table_chain_group) + +const sai_acl_api_t proxy_acl_api = { + + PROXY_GENERIC_QUAD_API(acl_table) + PROXY_GENERIC_QUAD_API(acl_entry) + PROXY_GENERIC_QUAD_API(acl_counter) + PROXY_GENERIC_QUAD_API(acl_range) + PROXY_GENERIC_QUAD_API(acl_table_group) + PROXY_GENERIC_QUAD_API(acl_table_group_member) + PROXY_GENERIC_QUAD_API(acl_table_chain_group) +}; diff --git a/proxylib/sai_proxy_ars.cpp b/proxylib/sai_proxy_ars.cpp new file mode 100644 index 000000000..34f49a48d --- /dev/null +++ b/proxylib/sai_proxy_ars.cpp @@ -0,0 +1,7 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(ARS, ars); + +const sai_ars_api_t proxy_ars_api = { + PROXY_GENERIC_QUAD_API(ars) +}; diff --git a/proxylib/sai_proxy_ars_profile.cpp b/proxylib/sai_proxy_ars_profile.cpp new file mode 100644 index 000000000..e707130c5 --- /dev/null +++ b/proxylib/sai_proxy_ars_profile.cpp @@ -0,0 +1,8 @@ +#include "sai_proxy.h" + + +PROXY_GENERIC_QUAD(ARS_PROFILE, ars_profile); + +const sai_ars_profile_api_t proxy_ars_profile_api = { + PROXY_GENERIC_QUAD_API(ars_profile) +}; diff --git a/proxylib/sai_proxy_bfd.cpp b/proxylib/sai_proxy_bfd.cpp new file mode 100644 index 000000000..1d364e1bb --- /dev/null +++ b/proxylib/sai_proxy_bfd.cpp @@ -0,0 +1,10 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(BFD_SESSION,bfd_session); +PROXY_GENERIC_STATS(BFD_SESSION,bfd_session); + +const sai_bfd_api_t proxy_bfd_api = { + + PROXY_GENERIC_QUAD_API(bfd_session) + PROXY_GENERIC_STATS_API(bfd_session) +}; diff --git a/proxylib/sai_proxy_bmtor.cpp b/proxylib/sai_proxy_bmtor.cpp new file mode 100644 index 000000000..87ab996b2 --- /dev/null +++ b/proxylib/sai_proxy_bmtor.cpp @@ -0,0 +1,18 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(TABLE_BITMAP_CLASSIFICATION_ENTRY,table_bitmap_classification_entry); +PROXY_GENERIC_STATS(TABLE_BITMAP_CLASSIFICATION_ENTRY,table_bitmap_classification_entry); +PROXY_GENERIC_QUAD(TABLE_BITMAP_ROUTER_ENTRY,table_bitmap_router_entry); +PROXY_GENERIC_STATS(TABLE_BITMAP_ROUTER_ENTRY,table_bitmap_router_entry); +PROXY_GENERIC_QUAD(TABLE_META_TUNNEL_ENTRY,table_meta_tunnel_entry); +PROXY_GENERIC_STATS(TABLE_META_TUNNEL_ENTRY,table_meta_tunnel_entry); + +const sai_bmtor_api_t proxy_bmtor_api = { + + PROXY_GENERIC_QUAD_API(table_bitmap_classification_entry) + PROXY_GENERIC_STATS_API(table_bitmap_classification_entry) + PROXY_GENERIC_QUAD_API(table_bitmap_router_entry) + PROXY_GENERIC_STATS_API(table_bitmap_router_entry) + PROXY_GENERIC_QUAD_API(table_meta_tunnel_entry) + PROXY_GENERIC_STATS_API(table_meta_tunnel_entry) +}; diff --git a/proxylib/sai_proxy_bridge.cpp b/proxylib/sai_proxy_bridge.cpp new file mode 100644 index 000000000..6fd48a789 --- /dev/null +++ b/proxylib/sai_proxy_bridge.cpp @@ -0,0 +1,14 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(BRIDGE,bridge); +PROXY_GENERIC_QUAD(BRIDGE_PORT,bridge_port); +PROXY_GENERIC_STATS(BRIDGE,bridge); +PROXY_GENERIC_STATS(BRIDGE_PORT,bridge_port); + +const sai_bridge_api_t proxy_bridge_api = { + + PROXY_GENERIC_QUAD_API(bridge) + PROXY_GENERIC_STATS_API(bridge) + PROXY_GENERIC_QUAD_API(bridge_port) + PROXY_GENERIC_STATS_API(bridge_port) +}; diff --git a/proxylib/sai_proxy_buffer.cpp b/proxylib/sai_proxy_buffer.cpp new file mode 100644 index 000000000..593e42532 --- /dev/null +++ b/proxylib/sai_proxy_buffer.cpp @@ -0,0 +1,16 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(BUFFER_POOL,buffer_pool); +PROXY_GENERIC_QUAD(INGRESS_PRIORITY_GROUP,ingress_priority_group); +PROXY_GENERIC_QUAD(BUFFER_PROFILE,buffer_profile); +PROXY_GENERIC_STATS(BUFFER_POOL,buffer_pool); +PROXY_GENERIC_STATS(INGRESS_PRIORITY_GROUP,ingress_priority_group); + +const sai_buffer_api_t proxy_buffer_api = { + + PROXY_GENERIC_QUAD_API(buffer_pool) + PROXY_GENERIC_STATS_API(buffer_pool) + PROXY_GENERIC_QUAD_API(ingress_priority_group) + PROXY_GENERIC_STATS_API(ingress_priority_group) + PROXY_GENERIC_QUAD_API(buffer_profile) +}; diff --git a/proxylib/sai_proxy_counter.cpp b/proxylib/sai_proxy_counter.cpp new file mode 100644 index 000000000..8a300b55c --- /dev/null +++ b/proxylib/sai_proxy_counter.cpp @@ -0,0 +1,10 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(COUNTER,counter); +PROXY_GENERIC_STATS(COUNTER,counter); + +const sai_counter_api_t proxy_counter_api = { + + PROXY_GENERIC_QUAD_API(counter) + PROXY_GENERIC_STATS_API(counter) +}; diff --git a/proxylib/sai_proxy_dash_acl.cpp b/proxylib/sai_proxy_dash_acl.cpp new file mode 100644 index 000000000..465480695 --- /dev/null +++ b/proxylib/sai_proxy_dash_acl.cpp @@ -0,0 +1,19 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(DASH_ACL_GROUP, dash_acl_group); +PROXY_BULK_CREATE(DASH_ACL_GROUP, dash_acl_groups); +PROXY_BULK_REMOVE(DASH_ACL_GROUP, dash_acl_groups); + +PROXY_GENERIC_QUAD(DASH_ACL_RULE, dash_acl_rule); +PROXY_BULK_CREATE(DASH_ACL_RULE, dash_acl_rules); +PROXY_BULK_REMOVE(DASH_ACL_RULE, dash_acl_rules); + +const sai_dash_acl_api_t proxy_dash_acl_api = { + PROXY_GENERIC_QUAD_API(dash_acl_group) + proxy_bulk_create_dash_acl_groups, + proxy_bulk_remove_dash_acl_groups, + + PROXY_GENERIC_QUAD_API(dash_acl_rule) + proxy_bulk_create_dash_acl_rules, + proxy_bulk_remove_dash_acl_rules, +}; diff --git a/proxylib/sai_proxy_dash_direction_lookup.cpp b/proxylib/sai_proxy_dash_direction_lookup.cpp new file mode 100644 index 000000000..cb3a62c92 --- /dev/null +++ b/proxylib/sai_proxy_dash_direction_lookup.cpp @@ -0,0 +1,11 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD_ENTRY(DIRECTION_LOOKUP_ENTRY, direction_lookup_entry); +PROXY_BULK_CREATE_ENTRY_EX(DIRECTION_LOOKUP_ENTRY, direction_lookup_entry, direction_lookup_entries); +PROXY_BULK_REMOVE_ENTRY_EX(DIRECTION_LOOKUP_ENTRY, direction_lookup_entry, direction_lookup_entries); + +const sai_dash_direction_lookup_api_t proxy_dash_direction_lookup_api = { + PROXY_GENERIC_QUAD_API(direction_lookup_entry) + proxy_bulk_create_direction_lookup_entries, + proxy_bulk_remove_direction_lookup_entries, +}; diff --git a/proxylib/sai_proxy_dash_eni.cpp b/proxylib/sai_proxy_dash_eni.cpp new file mode 100644 index 000000000..d6fe985d4 --- /dev/null +++ b/proxylib/sai_proxy_dash_eni.cpp @@ -0,0 +1,21 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD_ENTRY(ENI_ETHER_ADDRESS_MAP_ENTRY, eni_ether_address_map_entry); +PROXY_BULK_CREATE_ENTRY_EX(ENI_ETHER_ADDRESS_MAP_ENTRY, eni_ether_address_map_entry, eni_ether_address_map_entries); +PROXY_BULK_REMOVE_ENTRY_EX(ENI_ETHER_ADDRESS_MAP_ENTRY, eni_ether_address_map_entry, eni_ether_address_map_entries); + +PROXY_GENERIC_QUAD(ENI, eni); +PROXY_GENERIC_STATS(ENI, eni); +PROXY_BULK_CREATE(ENI, enis); +PROXY_BULK_REMOVE(ENI, enis); + +const sai_dash_eni_api_t proxy_dash_eni_api = { + PROXY_GENERIC_QUAD_API(eni_ether_address_map_entry) + proxy_bulk_create_eni_ether_address_map_entries, + proxy_bulk_remove_eni_ether_address_map_entries, + + PROXY_GENERIC_QUAD_API(eni) + PROXY_GENERIC_STATS_API(eni) + proxy_bulk_create_enis, + proxy_bulk_remove_enis, +}; diff --git a/proxylib/sai_proxy_dash_inbound_routing.cpp b/proxylib/sai_proxy_dash_inbound_routing.cpp new file mode 100644 index 000000000..23267623e --- /dev/null +++ b/proxylib/sai_proxy_dash_inbound_routing.cpp @@ -0,0 +1,11 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD_ENTRY(INBOUND_ROUTING_ENTRY, inbound_routing_entry); +PROXY_BULK_CREATE_ENTRY_EX(INBOUND_ROUTING_ENTRY, inbound_routing_entry, inbound_routing_entries); +PROXY_BULK_REMOVE_ENTRY_EX(INBOUND_ROUTING_ENTRY, inbound_routing_entry, inbound_routing_entries); + +const sai_dash_inbound_routing_api_t proxy_dash_inbound_routing_api = { + PROXY_GENERIC_QUAD_API(inbound_routing_entry) + proxy_bulk_create_inbound_routing_entries, + proxy_bulk_remove_inbound_routing_entries, +}; diff --git a/proxylib/sai_proxy_dash_meter.cpp b/proxylib/sai_proxy_dash_meter.cpp new file mode 100644 index 000000000..4a5da148c --- /dev/null +++ b/proxylib/sai_proxy_dash_meter.cpp @@ -0,0 +1,28 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(METER_BUCKET, meter_bucket); +PROXY_BULK_CREATE(METER_BUCKET, meter_buckets); +PROXY_BULK_REMOVE(METER_BUCKET, meter_buckets); + +PROXY_GENERIC_QUAD(METER_BUCKET, meter_policy); +PROXY_BULK_CREATE(METER_BUCKET, meter_policys); +PROXY_BULK_REMOVE(METER_BUCKET, meter_policys); + +PROXY_GENERIC_QUAD(METER_BUCKET, meter_rule); +PROXY_BULK_CREATE(METER_BUCKET, meter_rules); +PROXY_BULK_REMOVE(METER_BUCKET, meter_rules); + +const sai_dash_meter_api_t proxy_dash_meter_api = { + + PROXY_GENERIC_QUAD_API(meter_bucket) + proxy_bulk_create_meter_buckets, + proxy_bulk_remove_meter_buckets, + + PROXY_GENERIC_QUAD_API(meter_policy) + proxy_bulk_create_meter_policys, + proxy_bulk_remove_meter_policys, + + PROXY_GENERIC_QUAD_API(meter_rule) + proxy_bulk_create_meter_rules, + proxy_bulk_remove_meter_rules, +}; diff --git a/proxylib/sai_proxy_dash_outbound_ca_to_pa.cpp b/proxylib/sai_proxy_dash_outbound_ca_to_pa.cpp new file mode 100644 index 000000000..8a6d686d6 --- /dev/null +++ b/proxylib/sai_proxy_dash_outbound_ca_to_pa.cpp @@ -0,0 +1,11 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD_ENTRY(OUTBOUND_CA_TO_PA_ENTRY, outbound_ca_to_pa_entry); +PROXY_BULK_CREATE_ENTRY_EX(OUTBOUND_CA_TO_PA_ENTRY, outbound_ca_to_pa_entry, outbound_ca_to_pa_entries); +PROXY_BULK_REMOVE_ENTRY_EX(OUTBOUND_CA_TO_PA_ENTRY, outbound_ca_to_pa_entry, outbound_ca_to_pa_entries); + +const sai_dash_outbound_ca_to_pa_api_t proxy_dash_outbound_ca_to_pa_api = { + PROXY_GENERIC_QUAD_API(outbound_ca_to_pa_entry) + proxy_bulk_create_outbound_ca_to_pa_entries, + proxy_bulk_remove_outbound_ca_to_pa_entries, +}; diff --git a/proxylib/sai_proxy_dash_outbound_routing.cpp b/proxylib/sai_proxy_dash_outbound_routing.cpp new file mode 100644 index 000000000..fb7c1b93e --- /dev/null +++ b/proxylib/sai_proxy_dash_outbound_routing.cpp @@ -0,0 +1,11 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD_ENTRY(OUTBOUND_ROUTING_ENTRY, outbound_routing_entry); +PROXY_BULK_CREATE_ENTRY_EX(OUTBOUND_ROUTING_ENTRY, outbound_routing_entry, outbound_routing_entries); +PROXY_BULK_REMOVE_ENTRY_EX(OUTBOUND_ROUTING_ENTRY, outbound_routing_entry, outbound_routing_entries); + +const sai_dash_outbound_routing_api_t proxy_dash_outbound_routing_api = { + PROXY_GENERIC_QUAD_API(outbound_routing_entry) + proxy_bulk_create_outbound_routing_entries, + proxy_bulk_remove_outbound_routing_entries, +}; diff --git a/proxylib/sai_proxy_dash_pa_validation.cpp b/proxylib/sai_proxy_dash_pa_validation.cpp new file mode 100644 index 000000000..6a2223172 --- /dev/null +++ b/proxylib/sai_proxy_dash_pa_validation.cpp @@ -0,0 +1,11 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD_ENTRY(PA_VALIDATION_ENTRY, pa_validation_entry); +PROXY_BULK_CREATE_ENTRY_EX(PA_VALIDATION_ENTRY, pa_validation_entry, pa_validation_entries); +PROXY_BULK_REMOVE_ENTRY_EX(PA_VALIDATION_ENTRY, pa_validation_entry, pa_validation_entries); + +const sai_dash_pa_validation_api_t proxy_dash_pa_validation_api = { + PROXY_GENERIC_QUAD_API(pa_validation_entry) + proxy_bulk_create_pa_validation_entries, + proxy_bulk_remove_pa_validation_entries, +}; diff --git a/proxylib/sai_proxy_dash_vip.cpp b/proxylib/sai_proxy_dash_vip.cpp new file mode 100644 index 000000000..e275a09e6 --- /dev/null +++ b/proxylib/sai_proxy_dash_vip.cpp @@ -0,0 +1,11 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD_ENTRY(VIP_ENTRY, vip_entry); +PROXY_BULK_CREATE_ENTRY_EX(VIP_ENTRY, vip_entry, vip_entries); +PROXY_BULK_REMOVE_ENTRY_EX(VIP_ENTRY, vip_entry, vip_entries); + +const sai_dash_vip_api_t proxy_dash_vip_api = { + PROXY_GENERIC_QUAD_API(vip_entry) + proxy_bulk_create_vip_entries, + proxy_bulk_remove_vip_entries, +}; diff --git a/proxylib/sai_proxy_dash_vnet.cpp b/proxylib/sai_proxy_dash_vnet.cpp new file mode 100644 index 000000000..3e1e5a002 --- /dev/null +++ b/proxylib/sai_proxy_dash_vnet.cpp @@ -0,0 +1,11 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(VNET, vnet); +PROXY_BULK_CREATE(VNET, vnets); +PROXY_BULK_REMOVE(VNET, vnets); + +const sai_dash_vnet_api_t proxy_dash_vnet_api = { + PROXY_GENERIC_QUAD_API(vnet) + proxy_bulk_create_vnets, + proxy_bulk_remove_vnets, +}; diff --git a/proxylib/sai_proxy_debug_counter.cpp b/proxylib/sai_proxy_debug_counter.cpp new file mode 100644 index 000000000..099826d75 --- /dev/null +++ b/proxylib/sai_proxy_debug_counter.cpp @@ -0,0 +1,8 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(DEBUG_COUNTER,debug_counter); + +const sai_debug_counter_api_t proxy_debug_counter_api = { + + PROXY_GENERIC_QUAD_API(debug_counter) +}; diff --git a/proxylib/sai_proxy_dtel.cpp b/proxylib/sai_proxy_dtel.cpp new file mode 100644 index 000000000..eb27db418 --- /dev/null +++ b/proxylib/sai_proxy_dtel.cpp @@ -0,0 +1,16 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(DTEL,dtel); +PROXY_GENERIC_QUAD(DTEL_QUEUE_REPORT,dtel_queue_report); +PROXY_GENERIC_QUAD(DTEL_INT_SESSION,dtel_int_session); +PROXY_GENERIC_QUAD(DTEL_REPORT_SESSION,dtel_report_session); +PROXY_GENERIC_QUAD(DTEL_EVENT,dtel_event); + +const sai_dtel_api_t proxy_dtel_api = { + + PROXY_GENERIC_QUAD_API(dtel) + PROXY_GENERIC_QUAD_API(dtel_queue_report) + PROXY_GENERIC_QUAD_API(dtel_int_session) + PROXY_GENERIC_QUAD_API(dtel_report_session) + PROXY_GENERIC_QUAD_API(dtel_event) +}; diff --git a/proxylib/sai_proxy_fdb.cpp b/proxylib/sai_proxy_fdb.cpp new file mode 100644 index 000000000..c4fd20049 --- /dev/null +++ b/proxylib/sai_proxy_fdb.cpp @@ -0,0 +1,26 @@ +#include "sai_proxy.h" + +static sai_status_t proxy_flush_fdb_entries( + _In_ sai_object_id_t switch_id, + _In_ uint32_t attr_count, + _In_ const sai_attribute_t *attr_list) +{ + SWSS_LOG_ENTER(); + + return proxy_sai->flushFdbEntries( + switch_id, + attr_count, + attr_list); +} + +PROXY_GENERIC_QUAD_ENTRY(FDB_ENTRY,fdb_entry); +PROXY_BULK_QUAD_ENTRY(FDB_ENTRY,fdb_entry); + +const sai_fdb_api_t proxy_fdb_api = { + + PROXY_GENERIC_QUAD_API(fdb_entry) + + proxy_flush_fdb_entries, + + PROXY_BULK_QUAD_API(fdb_entry) +}; diff --git a/proxylib/sai_proxy_genericprogrammable.cpp b/proxylib/sai_proxy_genericprogrammable.cpp new file mode 100644 index 000000000..41cad506b --- /dev/null +++ b/proxylib/sai_proxy_genericprogrammable.cpp @@ -0,0 +1,7 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(GENERIC_PROGRAMMABLE,generic_programmable); + +const sai_generic_programmable_api_t proxy_generic_programmable_api = { + PROXY_GENERIC_QUAD_API(generic_programmable) +}; diff --git a/proxylib/sai_proxy_hash.cpp b/proxylib/sai_proxy_hash.cpp new file mode 100644 index 000000000..d25b5bd32 --- /dev/null +++ b/proxylib/sai_proxy_hash.cpp @@ -0,0 +1,9 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(HASH,hash); +PROXY_GENERIC_QUAD(FINE_GRAINED_HASH_FIELD,fine_grained_hash_field); + +const sai_hash_api_t proxy_hash_api = { + PROXY_GENERIC_QUAD_API(hash) + PROXY_GENERIC_QUAD_API(fine_grained_hash_field) +}; diff --git a/proxylib/sai_proxy_hostif.cpp b/proxylib/sai_proxy_hostif.cpp new file mode 100644 index 000000000..c41ba5be0 --- /dev/null +++ b/proxylib/sai_proxy_hostif.cpp @@ -0,0 +1,66 @@ +#include "sai_proxy.h" + +static sai_status_t proxy_recv_hostif_packet( + _In_ sai_object_id_t hostif_id, + _Inout_ sai_size_t *buffer_size, + _Out_ void *buffer, + _Inout_ uint32_t *attr_count, + _Out_ sai_attribute_t *attr_list) +{ + SWSS_LOG_ENTER(); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +static sai_status_t proxy_send_hostif_packet( + _In_ sai_object_id_t hostif_id, + _In_ sai_size_t buffer_size, + _In_ const void *buffer, + _In_ uint32_t attr_count, + _In_ const sai_attribute_t *attr_list) +{ + SWSS_LOG_ENTER(); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +static sai_status_t proxy_allocate_hostif_packet( + _In_ sai_object_id_t hostif_id, + _In_ sai_size_t buffer_size, + _Out_ void **buffer, + _In_ uint32_t attr_count, + _In_ const sai_attribute_t *attr_list) +{ + SWSS_LOG_ENTER(); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +static sai_status_t proxy_free_hostif_packet( + _In_ sai_object_id_t hostif_id, + _Inout_ void *buffer) +{ + SWSS_LOG_ENTER(); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +PROXY_GENERIC_QUAD(HOSTIF,hostif); +PROXY_GENERIC_QUAD(HOSTIF_TABLE_ENTRY,hostif_table_entry); +PROXY_GENERIC_QUAD(HOSTIF_TRAP_GROUP,hostif_trap_group); +PROXY_GENERIC_QUAD(HOSTIF_TRAP,hostif_trap); +PROXY_GENERIC_QUAD(HOSTIF_USER_DEFINED_TRAP,hostif_user_defined_trap); + +const sai_hostif_api_t proxy_hostif_api = { + + PROXY_GENERIC_QUAD_API(hostif) + PROXY_GENERIC_QUAD_API(hostif_table_entry) + PROXY_GENERIC_QUAD_API(hostif_trap_group) + PROXY_GENERIC_QUAD_API(hostif_trap) + PROXY_GENERIC_QUAD_API(hostif_user_defined_trap) + + proxy_recv_hostif_packet, + proxy_send_hostif_packet, + proxy_allocate_hostif_packet, + proxy_free_hostif_packet, +}; diff --git a/proxylib/sai_proxy_interfacequery.cpp b/proxylib/sai_proxy_interfacequery.cpp new file mode 100644 index 000000000..6a8d451d4 --- /dev/null +++ b/proxylib/sai_proxy_interfacequery.cpp @@ -0,0 +1,323 @@ +#include "sai_proxy.h" + +#include "Sai.h" + +using namespace saiproxy; + +std::shared_ptr proxy_sai = std::make_shared(); + +sai_status_t sai_api_initialize( + _In_ uint64_t flags, + _In_ const sai_service_method_table_t* service_method_table) +{ + SWSS_LOG_ENTER(); + + return proxy_sai->initialize(flags, service_method_table); +} + +sai_status_t sai_api_uninitialize(void) +{ + SWSS_LOG_ENTER(); + + return proxy_sai->uninitialize(); +} + +sai_status_t sai_log_set( + _In_ sai_api_t sai_api_id, + _In_ sai_log_level_t log_level) +{ + SWSS_LOG_ENTER(); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +#define API(api) .api ## _api = const_cast(&proxy_ ## api ## _api) + +static sai_apis_t proxy_apis = { + API(switch), + API(port), + API(fdb), + API(vlan), + API(virtual_router), + API(route), + API(next_hop), + API(next_hop_group), + API(router_interface), + API(neighbor), + API(acl), + API(hostif), + API(mirror), + API(samplepacket), + API(stp), + API(lag), + API(policer), + API(wred), + API(qos_map), + API(queue), + API(scheduler), + API(scheduler_group), + API(buffer), + API(hash), + API(udf), + API(tunnel), + API(l2mc), + API(ipmc), + API(rpf_group), + API(l2mc_group), + API(ipmc_group), + API(mcast_fdb), + API(bridge), + API(tam), + API(srv6), + API(mpls), + API(dtel), + API(bfd), + API(isolation_group), + API(nat), + API(counter), + API(debug_counter), + API(macsec), + API(system_port), + API(my_mac), + API(ipsec), + API(generic_programmable), + API(ars), + API(ars_profile), + API(twamp), + API(poe), + API(bmtor), + API(dash_acl), + API(dash_direction_lookup), + API(dash_eni), + API(dash_inbound_routing), + API(dash_meter), + API(dash_outbound_ca_to_pa), + API(dash_outbound_routing), + API(dash_vnet), + API(dash_pa_validation), + API(dash_vip), +}; + +static_assert((sizeof(sai_apis_t)/sizeof(void*)) == (SAI_API_EXTENSIONS_MAX - 1)); + +sai_status_t sai_api_query( + _In_ sai_api_t sai_api_id, + _Out_ void** api_method_table) +{ + SWSS_LOG_ENTER(); + + if (api_method_table == NULL) + { + SWSS_LOG_ERROR("NULL method table passed to SAI API initialize"); + + return SAI_STATUS_INVALID_PARAMETER; + } + + if (sai_api_id == SAI_API_UNSPECIFIED) + { + SWSS_LOG_ERROR("api ID is unspecified api"); + + return SAI_STATUS_INVALID_PARAMETER; + } + + if (sai_metadata_get_enum_value_name(&sai_metadata_enum_sai_api_t, sai_api_id)) + { + *api_method_table = ((void**)&proxy_apis)[sai_api_id - 1]; + return SAI_STATUS_SUCCESS; + } + + SWSS_LOG_ERROR("Invalid API type %d", sai_api_id); + + return SAI_STATUS_INVALID_PARAMETER; +} + +sai_status_t sai_query_attribute_capability( + _In_ sai_object_id_t switch_id, + _In_ sai_object_type_t object_type, + _In_ sai_attr_id_t attr_id, + _Out_ sai_attr_capability_t *capability) +{ + SWSS_LOG_ENTER(); + + return proxy_sai->queryAttributeCapability( + switch_id, + object_type, + attr_id, + capability); +} + +sai_status_t sai_query_attribute_enum_values_capability( + _In_ sai_object_id_t switch_id, + _In_ sai_object_type_t object_type, + _In_ sai_attr_id_t attr_id, + _Inout_ sai_s32_list_t *enum_values_capability) +{ + SWSS_LOG_ENTER(); + + return proxy_sai->queryAattributeEnumValuesCapability( + switch_id, + object_type, + attr_id, + enum_values_capability); +} + +sai_status_t sai_object_type_get_availability( + _In_ sai_object_id_t switch_id, + _In_ sai_object_type_t object_type, + _In_ uint32_t attr_count, + _In_ const sai_attribute_t *attr_list, + _Out_ uint64_t *count) +{ + SWSS_LOG_ENTER(); + + return proxy_sai->objectTypeGetAvailability( + switch_id, + object_type, + attr_count, + attr_list, + count); +} + +sai_object_type_t sai_object_type_query( + _In_ sai_object_id_t objectId) +{ + SWSS_LOG_ENTER(); + + return proxy_sai->objectTypeQuery(objectId); +} + +sai_object_id_t sai_switch_id_query( + _In_ sai_object_id_t objectId) +{ + SWSS_LOG_ENTER(); + + return proxy_sai->switchIdQuery(objectId); +} + +sai_status_t sai_dbg_generate_dump( + _In_ const char *dump_file_name) +{ + SWSS_LOG_ENTER(); + + SWSS_LOG_ERROR("not implemented, FIXME"); + return SAI_STATUS_NOT_IMPLEMENTED; +} + +sai_status_t sai_bulk_get_attribute( + _In_ sai_object_id_t switch_id, + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_key_t *object_key, + _Inout_ uint32_t *attr_count, + _Inout_ sai_attribute_t **attr_list, + _Inout_ sai_status_t *object_statuses) +{ + SWSS_LOG_ENTER(); + + SWSS_LOG_ERROR("not implemented, FIXME"); + return SAI_STATUS_NOT_IMPLEMENTED; +} + +sai_status_t sai_get_maximum_attribute_count( + _In_ sai_object_id_t switch_id, + _In_ sai_object_type_t object_type, + _Out_ uint32_t *count) +{ + SWSS_LOG_ENTER(); + + SWSS_LOG_ERROR("not implemented, FIXME"); + return SAI_STATUS_NOT_IMPLEMENTED; +} + +sai_status_t sai_get_object_count( + _In_ sai_object_id_t switch_id, + _In_ sai_object_type_t object_type, + _Out_ uint32_t *count) +{ + SWSS_LOG_ENTER(); + + SWSS_LOG_ERROR("not implemented, FIXME"); + return SAI_STATUS_NOT_IMPLEMENTED; +} + +sai_status_t sai_get_object_key( + _In_ sai_object_id_t switch_id, + _In_ sai_object_type_t object_type, + _Inout_ uint32_t *object_count, + _Inout_ sai_object_key_t *object_list) +{ + SWSS_LOG_ENTER(); + + SWSS_LOG_ERROR("not implemented, FIXME"); + return SAI_STATUS_NOT_IMPLEMENTED; +} + +sai_status_t sai_query_stats_capability( + _In_ sai_object_id_t switch_id, + _In_ sai_object_type_t object_type, + _Inout_ sai_stat_capability_list_t *stats_capability) +{ + SWSS_LOG_ENTER(); + + SWSS_LOG_ERROR("not implemented, FIXME"); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +sai_status_t sai_query_api_version( + _Out_ sai_api_version_t *version) +{ + SWSS_LOG_ENTER(); + + // TODO this should be forwarded to SaiInterface object + + if (version) + { + *version = SAI_API_VERSION; + + // TODO FIXME implement proper query for syncd, currently this is not an issue since swss is not using this API + + SWSS_LOG_WARN("retruning SAI API version %d with saiproxy compiled SAI headers, not actual libsai.so", SAI_API_VERSION); + + return SAI_STATUS_SUCCESS; + } + + SWSS_LOG_ERROR("version parameter is NULL"); + + return SAI_STATUS_INVALID_PARAMETER; +} + +sai_status_t sai_bulk_object_get_stats( + _In_ sai_object_id_t switch_id, + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_key_t *object_key, + _In_ uint32_t number_of_counters, + _In_ const sai_stat_id_t *counter_ids, + _In_ sai_stats_mode_t mode, + _Inout_ sai_status_t *object_statuses, + _Out_ uint64_t *counters) +{ + SWSS_LOG_ENTER(); + + SWSS_LOG_ERROR("not implemented, FIXME"); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +sai_status_t sai_bulk_object_clear_stats( + _In_ sai_object_id_t switch_id, + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_key_t *object_key, + _In_ uint32_t number_of_counters, + _In_ const sai_stat_id_t *counter_ids, + _In_ sai_stats_mode_t mode, + _Inout_ sai_status_t *object_statuses) +{ + SWSS_LOG_ENTER(); + + SWSS_LOG_ERROR("not implemented, FIXME"); + + return SAI_STATUS_NOT_IMPLEMENTED; +} diff --git a/proxylib/sai_proxy_ipmc.cpp b/proxylib/sai_proxy_ipmc.cpp new file mode 100644 index 000000000..1488a4bb4 --- /dev/null +++ b/proxylib/sai_proxy_ipmc.cpp @@ -0,0 +1,8 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD_ENTRY(IPMC_ENTRY,ipmc_entry); + +const sai_ipmc_api_t proxy_ipmc_api = { + + PROXY_GENERIC_QUAD_API(ipmc_entry) +}; diff --git a/proxylib/sai_proxy_ipmc_group.cpp b/proxylib/sai_proxy_ipmc_group.cpp new file mode 100644 index 000000000..49dad28d1 --- /dev/null +++ b/proxylib/sai_proxy_ipmc_group.cpp @@ -0,0 +1,10 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(IPMC_GROUP,ipmc_group); +PROXY_GENERIC_QUAD(IPMC_GROUP_MEMBER,ipmc_group_member); + +const sai_ipmc_group_api_t proxy_ipmc_group_api = { + + PROXY_GENERIC_QUAD_API(ipmc_group) + PROXY_GENERIC_QUAD_API(ipmc_group_member) +}; diff --git a/proxylib/sai_proxy_ipsec.cpp b/proxylib/sai_proxy_ipsec.cpp new file mode 100644 index 000000000..5e7068426 --- /dev/null +++ b/proxylib/sai_proxy_ipsec.cpp @@ -0,0 +1,16 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(IPSEC,ipsec); +PROXY_GENERIC_QUAD(IPSEC_PORT,ipsec_port); +PROXY_GENERIC_QUAD(IPSEC_SA,ipsec_sa); +PROXY_GENERIC_STATS(IPSEC_PORT,ipsec_port); +PROXY_GENERIC_STATS(IPSEC_SA,ipsec_sa); + +const sai_ipsec_api_t proxy_ipsec_api = { + + PROXY_GENERIC_QUAD_API(ipsec) + PROXY_GENERIC_QUAD_API(ipsec_port) + PROXY_GENERIC_STATS_API(ipsec_port) + PROXY_GENERIC_QUAD_API(ipsec_sa) + PROXY_GENERIC_STATS_API(ipsec_sa) +}; diff --git a/proxylib/sai_proxy_isolation_group.cpp b/proxylib/sai_proxy_isolation_group.cpp new file mode 100644 index 000000000..220b7ebb8 --- /dev/null +++ b/proxylib/sai_proxy_isolation_group.cpp @@ -0,0 +1,10 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(ISOLATION_GROUP,isolation_group); +PROXY_GENERIC_QUAD(ISOLATION_GROUP_MEMBER,isolation_group_member); + +const sai_isolation_group_api_t proxy_isolation_group_api = { + + PROXY_GENERIC_QUAD_API(isolation_group) + PROXY_GENERIC_QUAD_API(isolation_group_member) +}; diff --git a/proxylib/sai_proxy_l2mc.cpp b/proxylib/sai_proxy_l2mc.cpp new file mode 100644 index 000000000..f62e460c8 --- /dev/null +++ b/proxylib/sai_proxy_l2mc.cpp @@ -0,0 +1,8 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD_ENTRY(L2MC_ENTRY,l2mc_entry); + +const sai_l2mc_api_t proxy_l2mc_api = { + + PROXY_GENERIC_QUAD_API(l2mc_entry) +}; diff --git a/proxylib/sai_proxy_l2mcgroup.cpp b/proxylib/sai_proxy_l2mcgroup.cpp new file mode 100644 index 000000000..790ae1bee --- /dev/null +++ b/proxylib/sai_proxy_l2mcgroup.cpp @@ -0,0 +1,10 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(L2MC_GROUP,l2mc_group); +PROXY_GENERIC_QUAD(L2MC_GROUP_MEMBER,l2mc_group_member); + +const sai_l2mc_group_api_t proxy_l2mc_group_api = { + + PROXY_GENERIC_QUAD_API(l2mc_group) + PROXY_GENERIC_QUAD_API(l2mc_group_member) +}; diff --git a/proxylib/sai_proxy_lag.cpp b/proxylib/sai_proxy_lag.cpp new file mode 100644 index 000000000..222912644 --- /dev/null +++ b/proxylib/sai_proxy_lag.cpp @@ -0,0 +1,16 @@ +#include "sai_proxy.h" + +PROXY_BULK_CREATE(LAG_MEMBER,lag_members); +PROXY_BULK_REMOVE(LAG_MEMBER,lag_members); + +PROXY_GENERIC_QUAD(LAG,lag); +PROXY_GENERIC_QUAD(LAG_MEMBER,lag_member); + +const sai_lag_api_t proxy_lag_api = { + + PROXY_GENERIC_QUAD_API(lag) + PROXY_GENERIC_QUAD_API(lag_member) + + proxy_bulk_create_lag_members, + proxy_bulk_remove_lag_members, +}; diff --git a/proxylib/sai_proxy_macsec.cpp b/proxylib/sai_proxy_macsec.cpp new file mode 100644 index 000000000..7bf838b7d --- /dev/null +++ b/proxylib/sai_proxy_macsec.cpp @@ -0,0 +1,24 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(MACSEC,macsec); +PROXY_GENERIC_QUAD(MACSEC_PORT,macsec_port); +PROXY_GENERIC_STATS(MACSEC_PORT,macsec_port); +PROXY_GENERIC_QUAD(MACSEC_FLOW,macsec_flow); +PROXY_GENERIC_STATS(MACSEC_FLOW,macsec_flow); +PROXY_GENERIC_QUAD(MACSEC_SC,macsec_sc); +PROXY_GENERIC_STATS(MACSEC_SC,macsec_sc); +PROXY_GENERIC_QUAD(MACSEC_SA,macsec_sa); +PROXY_GENERIC_STATS(MACSEC_SA,macsec_sa); + +const sai_macsec_api_t proxy_macsec_api = { + + PROXY_GENERIC_QUAD_API(macsec) + PROXY_GENERIC_QUAD_API(macsec_port) + PROXY_GENERIC_STATS_API(macsec_port) + PROXY_GENERIC_QUAD_API(macsec_flow) + PROXY_GENERIC_STATS_API(macsec_flow) + PROXY_GENERIC_QUAD_API(macsec_sc) + PROXY_GENERIC_STATS_API(macsec_sc) + PROXY_GENERIC_QUAD_API(macsec_sa) + PROXY_GENERIC_STATS_API(macsec_sa) +}; diff --git a/proxylib/sai_proxy_mcastfdb.cpp b/proxylib/sai_proxy_mcastfdb.cpp new file mode 100644 index 000000000..1c9322df1 --- /dev/null +++ b/proxylib/sai_proxy_mcastfdb.cpp @@ -0,0 +1,8 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD_ENTRY(MCAST_FDB_ENTRY,mcast_fdb_entry); + +const sai_mcast_fdb_api_t proxy_mcast_fdb_api = { + + PROXY_GENERIC_QUAD_API(mcast_fdb_entry) +}; diff --git a/proxylib/sai_proxy_mirror.cpp b/proxylib/sai_proxy_mirror.cpp new file mode 100644 index 000000000..977226905 --- /dev/null +++ b/proxylib/sai_proxy_mirror.cpp @@ -0,0 +1,8 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(MIRROR_SESSION,mirror_session); + +const sai_mirror_api_t proxy_mirror_api = { + + PROXY_GENERIC_QUAD_API(mirror_session) +}; diff --git a/proxylib/sai_proxy_mpls.cpp b/proxylib/sai_proxy_mpls.cpp new file mode 100644 index 000000000..78b5db280 --- /dev/null +++ b/proxylib/sai_proxy_mpls.cpp @@ -0,0 +1,10 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD_ENTRY(INSEG_ENTRY,inseg_entry); +PROXY_BULK_QUAD_ENTRY(INSEG_ENTRY,inseg_entry); + +const sai_mpls_api_t proxy_mpls_api = { + + PROXY_GENERIC_QUAD_API(inseg_entry) + PROXY_BULK_QUAD_API(inseg_entry) +}; diff --git a/proxylib/sai_proxy_my_mac.cpp b/proxylib/sai_proxy_my_mac.cpp new file mode 100644 index 000000000..ec730b8ab --- /dev/null +++ b/proxylib/sai_proxy_my_mac.cpp @@ -0,0 +1,8 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(MY_MAC,my_mac); + +const sai_my_mac_api_t proxy_my_mac_api = { + + PROXY_GENERIC_QUAD_API(my_mac) +}; diff --git a/proxylib/sai_proxy_nat.cpp b/proxylib/sai_proxy_nat.cpp new file mode 100644 index 000000000..7cfab7fe4 --- /dev/null +++ b/proxylib/sai_proxy_nat.cpp @@ -0,0 +1,12 @@ +#include "sai_proxy.h" + +PROXY_BULK_QUAD_ENTRY(NAT_ENTRY,nat_entry); +PROXY_GENERIC_QUAD_ENTRY(NAT_ENTRY,nat_entry); +PROXY_GENERIC_QUAD(NAT_ZONE_COUNTER,nat_zone_counter); + +const sai_nat_api_t proxy_nat_api = { + + PROXY_GENERIC_QUAD_API(nat_entry) + PROXY_BULK_QUAD_API(nat_entry) + PROXY_GENERIC_QUAD_API(nat_zone_counter) +}; diff --git a/proxylib/sai_proxy_neighbor.cpp b/proxylib/sai_proxy_neighbor.cpp new file mode 100644 index 000000000..0988193cd --- /dev/null +++ b/proxylib/sai_proxy_neighbor.cpp @@ -0,0 +1,20 @@ +#include "sai_proxy.h" + +static sai_status_t proxy_remove_all_neighbor_entries( + _In_ sai_object_id_t switch_id) +{ + SWSS_LOG_ENTER(); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +PROXY_BULK_QUAD_ENTRY(NEIGHBOR_ENTRY,neighbor_entry); +PROXY_GENERIC_QUAD_ENTRY(NEIGHBOR_ENTRY,neighbor_entry); + +const sai_neighbor_api_t proxy_neighbor_api = { + + PROXY_GENERIC_QUAD_API(neighbor_entry) + proxy_remove_all_neighbor_entries, + + PROXY_BULK_QUAD_API(neighbor_entry) +}; diff --git a/proxylib/sai_proxy_nexthop.cpp b/proxylib/sai_proxy_nexthop.cpp new file mode 100644 index 000000000..25af42de8 --- /dev/null +++ b/proxylib/sai_proxy_nexthop.cpp @@ -0,0 +1,10 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(NEXT_HOP,next_hop); +PROXY_BULK_QUAD(NEXT_HOP,next_hop); + +const sai_next_hop_api_t proxy_next_hop_api = { + + PROXY_GENERIC_QUAD_API(next_hop) + PROXY_BULK_QUAD_API(next_hop) +}; diff --git a/proxylib/sai_proxy_nexthopgroup.cpp b/proxylib/sai_proxy_nexthopgroup.cpp new file mode 100644 index 000000000..f151be1cc --- /dev/null +++ b/proxylib/sai_proxy_nexthopgroup.cpp @@ -0,0 +1,21 @@ +#include "sai_proxy.h" + +PROXY_BULK_CREATE(NEXT_HOP_GROUP_MEMBER,next_hop_group_members); +PROXY_BULK_REMOVE(NEXT_HOP_GROUP_MEMBER,next_hop_group_members); +PROXY_BULK_GET(NEXT_HOP_GROUP_MEMBER,next_hop_group_members); +PROXY_BULK_SET(NEXT_HOP_GROUP_MEMBER,next_hop_group_members); +PROXY_GENERIC_QUAD(NEXT_HOP_GROUP,next_hop_group); +PROXY_GENERIC_QUAD(NEXT_HOP_GROUP_MEMBER,next_hop_group_member); +PROXY_GENERIC_QUAD(NEXT_HOP_GROUP_MAP,next_hop_group_map); + +const sai_next_hop_group_api_t proxy_next_hop_group_api = { + + PROXY_GENERIC_QUAD_API(next_hop_group) + PROXY_GENERIC_QUAD_API(next_hop_group_member) + + proxy_bulk_create_next_hop_group_members, + proxy_bulk_remove_next_hop_group_members, + PROXY_GENERIC_QUAD_API(next_hop_group_map) + proxy_bulk_set_next_hop_group_members, + proxy_bulk_get_next_hop_group_members +}; diff --git a/proxylib/sai_proxy_poe.cpp b/proxylib/sai_proxy_poe.cpp new file mode 100644 index 000000000..2f91297af --- /dev/null +++ b/proxylib/sai_proxy_poe.cpp @@ -0,0 +1,12 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(POE_DEVICE,poe_device); +PROXY_GENERIC_QUAD(POE_PSE,poe_pse); +PROXY_GENERIC_QUAD(POE_PORT,poe_port); + +const sai_poe_api_t proxy_poe_api = { + + PROXY_GENERIC_QUAD_API(poe_device) + PROXY_GENERIC_QUAD_API(poe_pse) + PROXY_GENERIC_QUAD_API(poe_port) +}; diff --git a/proxylib/sai_proxy_policer.cpp b/proxylib/sai_proxy_policer.cpp new file mode 100644 index 000000000..f1b6206b3 --- /dev/null +++ b/proxylib/sai_proxy_policer.cpp @@ -0,0 +1,10 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(POLICER,policer); +PROXY_GENERIC_STATS(POLICER,policer); + +const sai_policer_api_t proxy_policer_api = { + + PROXY_GENERIC_QUAD_API(policer) + PROXY_GENERIC_STATS_API(policer) +}; diff --git a/proxylib/sai_proxy_port.cpp b/proxylib/sai_proxy_port.cpp new file mode 100644 index 000000000..e7dcde00d --- /dev/null +++ b/proxylib/sai_proxy_port.cpp @@ -0,0 +1,33 @@ +#include "sai_proxy.h" + +static sai_status_t proxy_clear_port_all_stats( + _In_ sai_object_id_t port_id) +{ + SWSS_LOG_ENTER(); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +PROXY_GENERIC_QUAD(PORT,port); +PROXY_GENERIC_QUAD(PORT_POOL,port_pool); +PROXY_GENERIC_QUAD(PORT_SERDES,port_serdes); +PROXY_GENERIC_QUAD(PORT_CONNECTOR,port_connector); +PROXY_GENERIC_STATS(PORT,port); +PROXY_GENERIC_STATS(PORT_POOL,port_pool); +PROXY_BULK_QUAD(PORT, ports); +PROXY_BULK_QUAD(PORT_SERDES, port_serdeses); + +const sai_port_api_t proxy_port_api = { + + PROXY_GENERIC_QUAD_API(port) + PROXY_GENERIC_STATS_API(port) + + proxy_clear_port_all_stats, + + PROXY_GENERIC_QUAD_API(port_pool) + PROXY_GENERIC_STATS_API(port_pool) + PROXY_GENERIC_QUAD_API(port_connector) + PROXY_GENERIC_QUAD_API(port_serdes) + PROXY_BULK_QUAD_API(ports) + PROXY_BULK_QUAD_API(port_serdeses) +}; diff --git a/proxylib/sai_proxy_qosmap.cpp b/proxylib/sai_proxy_qosmap.cpp new file mode 100644 index 000000000..c67bcc8d9 --- /dev/null +++ b/proxylib/sai_proxy_qosmap.cpp @@ -0,0 +1,8 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(QOS_MAP,qos_map); + +const sai_qos_map_api_t proxy_qos_map_api = { + + PROXY_GENERIC_QUAD_API(qos_map) +}; diff --git a/proxylib/sai_proxy_queue.cpp b/proxylib/sai_proxy_queue.cpp new file mode 100644 index 000000000..8136454ce --- /dev/null +++ b/proxylib/sai_proxy_queue.cpp @@ -0,0 +1,10 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(QUEUE,queue); +PROXY_GENERIC_STATS(QUEUE,queue); + +const sai_queue_api_t proxy_queue_api = { + + PROXY_GENERIC_QUAD_API(queue) + PROXY_GENERIC_STATS_API(queue) +}; diff --git a/proxylib/sai_proxy_route.cpp b/proxylib/sai_proxy_route.cpp new file mode 100644 index 000000000..07007e5e7 --- /dev/null +++ b/proxylib/sai_proxy_route.cpp @@ -0,0 +1,10 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD_ENTRY(ROUTE_ENTRY,route_entry); +PROXY_BULK_QUAD_ENTRY(ROUTE_ENTRY,route_entry); + +const sai_route_api_t proxy_route_api = { + + PROXY_GENERIC_QUAD_API(route_entry) + PROXY_BULK_QUAD_API(route_entry) +}; diff --git a/proxylib/sai_proxy_router_interface.cpp b/proxylib/sai_proxy_router_interface.cpp new file mode 100644 index 000000000..5f65618da --- /dev/null +++ b/proxylib/sai_proxy_router_interface.cpp @@ -0,0 +1,12 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(ROUTER_INTERFACE,router_interface); +PROXY_GENERIC_STATS(ROUTER_INTERFACE,router_interface); +PROXY_BULK_QUAD(ROUTER_INTERFACE,router_interfaces); + +const sai_router_interface_api_t proxy_router_interface_api = { + + PROXY_GENERIC_QUAD_API(router_interface) + PROXY_GENERIC_STATS_API(router_interface) + PROXY_BULK_QUAD_API(router_interfaces) +}; diff --git a/proxylib/sai_proxy_rpfgroup.cpp b/proxylib/sai_proxy_rpfgroup.cpp new file mode 100644 index 000000000..9933f37d5 --- /dev/null +++ b/proxylib/sai_proxy_rpfgroup.cpp @@ -0,0 +1,10 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(RPF_GROUP,rpf_group); +PROXY_GENERIC_QUAD(RPF_GROUP_MEMBER,rpf_group_member); + +const sai_rpf_group_api_t proxy_rpf_group_api = { + + PROXY_GENERIC_QUAD_API(rpf_group) + PROXY_GENERIC_QUAD_API(rpf_group_member) +}; diff --git a/proxylib/sai_proxy_samplepacket.cpp b/proxylib/sai_proxy_samplepacket.cpp new file mode 100644 index 000000000..8e0c2ca3f --- /dev/null +++ b/proxylib/sai_proxy_samplepacket.cpp @@ -0,0 +1,8 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(SAMPLEPACKET,samplepacket); + +const sai_samplepacket_api_t proxy_samplepacket_api = { + + PROXY_GENERIC_QUAD_API(samplepacket) +}; diff --git a/proxylib/sai_proxy_scheduler.cpp b/proxylib/sai_proxy_scheduler.cpp new file mode 100644 index 000000000..b193b71e0 --- /dev/null +++ b/proxylib/sai_proxy_scheduler.cpp @@ -0,0 +1,8 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(SCHEDULER,scheduler); + +const sai_scheduler_api_t proxy_scheduler_api = { + + PROXY_GENERIC_QUAD_API(scheduler) +}; diff --git a/proxylib/sai_proxy_schedulergroup.cpp b/proxylib/sai_proxy_schedulergroup.cpp new file mode 100644 index 000000000..08c79dfa5 --- /dev/null +++ b/proxylib/sai_proxy_schedulergroup.cpp @@ -0,0 +1,8 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(SCHEDULER_GROUP,scheduler_group); + +const sai_scheduler_group_api_t proxy_scheduler_group_api = { + + PROXY_GENERIC_QUAD_API(scheduler_group) +}; diff --git a/proxylib/sai_proxy_srv6.cpp b/proxylib/sai_proxy_srv6.cpp new file mode 100644 index 000000000..eedafd298 --- /dev/null +++ b/proxylib/sai_proxy_srv6.cpp @@ -0,0 +1,22 @@ +#include "sai_proxy.h" + +PROXY_BULK_CREATE(SRV6_SIDLIST, srv6_sidlist); +PROXY_BULK_REMOVE(SRV6_SIDLIST, srv6_sidlist); +PROXY_GENERIC_QUAD(SRV6_SIDLIST,srv6_sidlist); +PROXY_BULK_QUAD_ENTRY(MY_SID_ENTRY,my_sid_entry); +PROXY_GENERIC_QUAD_ENTRY(MY_SID_ENTRY,my_sid_entry); + +const sai_srv6_api_t proxy_srv6_api = { + + PROXY_GENERIC_QUAD_API(srv6_sidlist) + + proxy_bulk_create_srv6_sidlist, + proxy_bulk_remove_srv6_sidlist, + + NULL, + NULL, + NULL, + + PROXY_GENERIC_QUAD_API(my_sid_entry) + PROXY_BULK_QUAD_API(my_sid_entry) +}; diff --git a/proxylib/sai_proxy_stp.cpp b/proxylib/sai_proxy_stp.cpp new file mode 100644 index 000000000..e01a2b0bf --- /dev/null +++ b/proxylib/sai_proxy_stp.cpp @@ -0,0 +1,15 @@ +#include "sai_proxy.h" + +PROXY_BULK_CREATE(STP_PORT,stp_ports); +PROXY_BULK_REMOVE(STP_PORT,stp_ports); +PROXY_GENERIC_QUAD(STP,stp); +PROXY_GENERIC_QUAD(STP_PORT,stp_port); + +const sai_stp_api_t proxy_stp_api = { + + PROXY_GENERIC_QUAD_API(stp) + PROXY_GENERIC_QUAD_API(stp_port) + + proxy_bulk_create_stp_ports, + proxy_bulk_remove_stp_ports, +}; diff --git a/proxylib/sai_proxy_switch.cpp b/proxylib/sai_proxy_switch.cpp new file mode 100644 index 000000000..4cf80bcf0 --- /dev/null +++ b/proxylib/sai_proxy_switch.cpp @@ -0,0 +1,84 @@ +#include "sai_proxy.h" + +static sai_status_t proxy_switch_mdio_read( + _In_ sai_object_id_t switch_id, + _In_ uint32_t device_addr, + _In_ uint32_t start_reg_addr, + _In_ uint32_t number_of_registers, + _Out_ uint32_t *reg_val) +{ + SWSS_LOG_ENTER(); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +static sai_status_t proxy_switch_mdio_write( + _In_ sai_object_id_t switch_id, + _In_ uint32_t device_addr, + _In_ uint32_t start_reg_addr, + _In_ uint32_t number_of_registers, + _In_ const uint32_t *reg_val) +{ + SWSS_LOG_ENTER(); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +static sai_status_t proxy_switch_mdio_cl22_read( + _In_ sai_object_id_t switch_id, + _In_ uint32_t device_addr, + _In_ uint32_t start_reg_addr, + _In_ uint32_t number_of_registers, + _Out_ uint32_t *reg_val) +{ + SWSS_LOG_ENTER(); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +static sai_status_t proxy_switch_mdio_cl22_write( + _In_ sai_object_id_t switch_id, + _In_ uint32_t device_addr, + _In_ uint32_t start_reg_addr, + _In_ uint32_t number_of_registers, + _In_ const uint32_t *reg_val) +{ + SWSS_LOG_ENTER(); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +PROXY_GENERIC_QUAD(SWITCH,switch); +PROXY_GENERIC_STATS(SWITCH,switch); +PROXY_GENERIC_QUAD(SWITCH_TUNNEL,switch_tunnel); + +static sai_status_t proxy_create_switch_uniq( + _Out_ sai_object_id_t *switch_id, + _In_ uint32_t attr_count, + _In_ const sai_attribute_t *attr_list) +{ + SWSS_LOG_ENTER(); + + return proxy_create_switch( + switch_id, + SAI_NULL_OBJECT_ID, // no switch id since we create switch + attr_count, + attr_list); +} + +const sai_switch_api_t proxy_switch_api = { + + proxy_create_switch_uniq, + proxy_remove_switch, + proxy_set_switch_attribute, + proxy_get_switch_attribute, + + PROXY_GENERIC_STATS_API(switch) + + proxy_switch_mdio_read, + proxy_switch_mdio_write, + + PROXY_GENERIC_QUAD_API(switch_tunnel) + proxy_switch_mdio_cl22_read, + proxy_switch_mdio_cl22_write +}; diff --git a/proxylib/sai_proxy_system_port.cpp b/proxylib/sai_proxy_system_port.cpp new file mode 100644 index 000000000..45e9f68a4 --- /dev/null +++ b/proxylib/sai_proxy_system_port.cpp @@ -0,0 +1,8 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(SYSTEM_PORT,system_port); + +const sai_system_port_api_t proxy_system_port_api = { + + PROXY_GENERIC_QUAD_API(system_port) +}; diff --git a/proxylib/sai_proxy_tam.cpp b/proxylib/sai_proxy_tam.cpp new file mode 100644 index 000000000..526bca272 --- /dev/null +++ b/proxylib/sai_proxy_tam.cpp @@ -0,0 +1,42 @@ +#include "sai_proxy.h" + +sai_status_t sai_tam_telemetry_get_data( + _In_ sai_object_id_t switch_id, + _In_ sai_object_list_t obj_list, + _In_ bool clear_on_read, + _Inout_ sai_size_t *buffer_size, + _Out_ void *buffer) +{ + SWSS_LOG_ENTER(); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +PROXY_GENERIC_QUAD(TAM,tam); +PROXY_GENERIC_QUAD(TAM_MATH_FUNC,tam_math_func); +PROXY_GENERIC_QUAD(TAM_REPORT,tam_report); +PROXY_GENERIC_QUAD(TAM_EVENT_THRESHOLD,tam_event_threshold); +PROXY_GENERIC_QUAD(TAM_INT,tam_int); +PROXY_GENERIC_QUAD(TAM_TEL_TYPE,tam_tel_type); +PROXY_GENERIC_QUAD(TAM_TRANSPORT,tam_transport); +PROXY_GENERIC_QUAD(TAM_TELEMETRY,tam_telemetry); +PROXY_GENERIC_QUAD(TAM_COLLECTOR,tam_collector); +PROXY_GENERIC_QUAD(TAM_EVENT_ACTION,tam_event_action); +PROXY_GENERIC_QUAD(TAM_EVENT,tam_event); +PROXY_GENERIC_QUAD(TAM_COUNTER_SUBSCRIPTION,tam_counter_subscription); + +const sai_tam_api_t proxy_tam_api = { + + PROXY_GENERIC_QUAD_API(tam) + PROXY_GENERIC_QUAD_API(tam_math_func) + PROXY_GENERIC_QUAD_API(tam_report) + PROXY_GENERIC_QUAD_API(tam_event_threshold) + PROXY_GENERIC_QUAD_API(tam_int) + PROXY_GENERIC_QUAD_API(tam_tel_type) + PROXY_GENERIC_QUAD_API(tam_transport) + PROXY_GENERIC_QUAD_API(tam_telemetry) + PROXY_GENERIC_QUAD_API(tam_collector) + PROXY_GENERIC_QUAD_API(tam_event_action) + PROXY_GENERIC_QUAD_API(tam_event) + PROXY_GENERIC_QUAD_API(tam_counter_subscription) +}; diff --git a/proxylib/sai_proxy_tunnel.cpp b/proxylib/sai_proxy_tunnel.cpp new file mode 100644 index 000000000..f0dacf515 --- /dev/null +++ b/proxylib/sai_proxy_tunnel.cpp @@ -0,0 +1,18 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(TUNNEL_MAP,tunnel_map); +PROXY_GENERIC_QUAD(TUNNEL,tunnel); +PROXY_GENERIC_QUAD(TUNNEL_TERM_TABLE_ENTRY,tunnel_term_table_entry); +PROXY_GENERIC_QUAD(TUNNEL_MAP_ENTRY,tunnel_map_entry); +PROXY_GENERIC_STATS(TUNNEL,tunnel); +PROXY_BULK_QUAD(TUNNEL,tunnels); + +const sai_tunnel_api_t proxy_tunnel_api = { + + PROXY_GENERIC_QUAD_API(tunnel_map) + PROXY_GENERIC_QUAD_API(tunnel) + PROXY_GENERIC_STATS_API(tunnel) + PROXY_GENERIC_QUAD_API(tunnel_term_table_entry) + PROXY_GENERIC_QUAD_API(tunnel_map_entry) + PROXY_BULK_QUAD_API(tunnels) +}; diff --git a/proxylib/sai_proxy_twamp.cpp b/proxylib/sai_proxy_twamp.cpp new file mode 100644 index 000000000..7abdfc71c --- /dev/null +++ b/proxylib/sai_proxy_twamp.cpp @@ -0,0 +1,9 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(TWAMP_SESSION,twamp_session); +PROXY_GENERIC_STATS(TWAMP_SESSION,twamp_session); + +const sai_twamp_api_t proxy_twamp_api = { + PROXY_GENERIC_QUAD_API(twamp_session) + PROXY_GENERIC_STATS_API(twamp_session) +}; diff --git a/proxylib/sai_proxy_udf.cpp b/proxylib/sai_proxy_udf.cpp new file mode 100644 index 000000000..31f0da664 --- /dev/null +++ b/proxylib/sai_proxy_udf.cpp @@ -0,0 +1,12 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(UDF,udf) +PROXY_GENERIC_QUAD(UDF_MATCH,udf_match) +PROXY_GENERIC_QUAD(UDF_GROUP,udf_group) + +const sai_udf_api_t proxy_udf_api = { + + PROXY_GENERIC_QUAD_API(udf) + PROXY_GENERIC_QUAD_API(udf_match) + PROXY_GENERIC_QUAD_API(udf_group) +}; diff --git a/proxylib/sai_proxy_virtual_router.cpp b/proxylib/sai_proxy_virtual_router.cpp new file mode 100644 index 000000000..f5c775f79 --- /dev/null +++ b/proxylib/sai_proxy_virtual_router.cpp @@ -0,0 +1,8 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(VIRTUAL_ROUTER,virtual_router); + +const sai_virtual_router_api_t proxy_virtual_router_api = { + + PROXY_GENERIC_QUAD_API(virtual_router) +}; diff --git a/proxylib/sai_proxy_vlan.cpp b/proxylib/sai_proxy_vlan.cpp new file mode 100644 index 000000000..89b561a68 --- /dev/null +++ b/proxylib/sai_proxy_vlan.cpp @@ -0,0 +1,18 @@ +#include "sai_proxy.h" + +PROXY_BULK_CREATE(VLAN_MEMBER,vlan_members); +PROXY_BULK_REMOVE(VLAN_MEMBER,vlan_members); +PROXY_GENERIC_QUAD(VLAN,vlan); +PROXY_GENERIC_QUAD(VLAN_MEMBER,vlan_member); +PROXY_GENERIC_STATS(VLAN,vlan); + +const sai_vlan_api_t proxy_vlan_api = { + + PROXY_GENERIC_QUAD_API(vlan) + PROXY_GENERIC_QUAD_API(vlan_member) + + proxy_bulk_create_vlan_members, + proxy_bulk_remove_vlan_members, + + PROXY_GENERIC_STATS_API(vlan) +}; diff --git a/proxylib/sai_proxy_wred.cpp b/proxylib/sai_proxy_wred.cpp new file mode 100644 index 000000000..24dfe0b99 --- /dev/null +++ b/proxylib/sai_proxy_wred.cpp @@ -0,0 +1,8 @@ +#include "sai_proxy.h" + +PROXY_GENERIC_QUAD(WRED,wred); + +const sai_wred_api_t proxy_wred_api = { + + PROXY_GENERIC_QUAD_API(wred) +}; diff --git a/tests/aspell.en.pws b/tests/aspell.en.pws index d81392265..86403451e 100644 --- a/tests/aspell.en.pws +++ b/tests/aspell.en.pws @@ -474,3 +474,4 @@ ZMQ ZMQ uncreated TWAMP +saiproxy diff --git a/tests/checksaiapi.sh b/tests/checksaiapi.sh index 6353fbcd6..03730d8d1 100755 --- a/tests/checksaiapi.sh +++ b/tests/checksaiapi.sh @@ -36,7 +36,7 @@ REGEX=`cat SAI/meta/saimetadata.c|grep dlsym|grep handle|perl -ne 'print "$1|" i set +e find -name "*.cpp" -o -name "*.c" | xargs grep -P "$REGEX" | -grep -vP "/unittest/|/tests/|/SAI/|/pyext/|tests.cpp|sai_vs_interfacequery|sai_redis_interfacequery|saisdkdump|SWSS_LOG|.cpp:\s+\*|.cpp:\s+//|sai_status_t\s+sai_|VendorSai.cpp:.+=\s*&sai_" +grep -vP "/unittest/|/tests/|/SAI/|/pyext/|tests.cpp|sai_vs_interfacequery|sai_proxy_interfacequery|sai_redis_interfacequery|saisdkdump|SWSS_LOG|.cpp:\s+\*|.cpp:\s+//|sai_status_t\s+sai_|VendorSai.cpp:.+=\s*&sai_" if [ $? == 0 ]; then echo not allowed files are using global sai_xxx API, please correct your code, only VendorSai.cpp and saisdkdump are allowed to use global SAI apis diff --git a/unittest/Makefile.am b/unittest/Makefile.am index 9be94ee0a..8cd9711fc 100644 --- a/unittest/Makefile.am +++ b/unittest/Makefile.am @@ -1 +1 @@ -SUBDIRS = meta lib vslib syncd +SUBDIRS = meta lib vslib syncd proxylib diff --git a/unittest/proxylib/Makefile.am b/unittest/proxylib/Makefile.am new file mode 100644 index 000000000..5c7e61134 --- /dev/null +++ b/unittest/proxylib/Makefile.am @@ -0,0 +1,78 @@ +AM_CXXFLAGS = $(SAIINC) -I$(top_srcdir)/meta -I$(top_srcdir)/proxylib -I$(top_srcdir)/lib + +bin_PROGRAMS = tests testslibsaiproxy + +LDADD_GTEST = -L/usr/src/gtest -lgtest -lgtest_main + +tests_SOURCES = \ + main.cpp \ + TestSai.cpp + +tests_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) +tests_LDADD = $(LDADD_GTEST) $(top_srcdir)/proxylib/libSaiProxy.a -lhiredis -lswsscommon -lpthread -L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta -lzmq $(CODE_COVERAGE_LIBS) + +testslibsaiproxy_SOURCES = main_libsaiproxy.cpp \ + test_sai_proxy_acl.cpp \ + test_sai_proxy_bfd.cpp \ + test_sai_proxy_bmtor.cpp \ + test_sai_proxy_bridge.cpp \ + test_sai_proxy_buffer.cpp \ + test_sai_proxy_counter.cpp \ + test_sai_proxy_dash_vip.cpp \ + test_sai_proxy_dash_pa_validation.cpp \ + test_sai_proxy_dash_vnet.cpp \ + test_sai_proxy_dash_outbound_routing.cpp \ + test_sai_proxy_dash_outbound_ca_to_pa.cpp \ + test_sai_proxy_dash_inbound_routing.cpp \ + test_sai_proxy_dash_eni.cpp \ + test_sai_proxy_dash_direction_lookup.cpp \ + test_sai_proxy_dash_acl.cpp \ + test_sai_proxy_debug_counter.cpp \ + test_sai_proxy_dtel.cpp \ + test_sai_proxy_fdb.cpp \ + test_sai_proxy_generic_programmable.cpp \ + test_sai_proxy_ipmc.cpp \ + test_sai_proxy_l2mc.cpp \ + test_sai_proxy_l2mcgroup.cpp \ + test_sai_proxy_lag.cpp \ + test_sai_proxy_ipmc_group.cpp \ + test_sai_proxy_macsec.cpp \ + test_sai_proxy_isolation_group.cpp \ + test_sai_proxy_interfacequery.cpp \ + test_sai_proxy_mcastfdb.cpp \ + test_sai_proxy_mirror.cpp \ + test_sai_proxy_mpls.cpp \ + test_sai_proxy_nat.cpp \ + test_sai_proxy_hash.cpp \ + test_sai_proxy_neighbor.cpp \ + test_sai_proxy_nexthop.cpp \ + test_sai_proxy_nexthopgroup.cpp \ + test_sai_proxy_port.cpp \ + test_sai_proxy_qosmap.cpp \ + test_sai_proxy_policer.cpp \ + test_sai_proxy_queue.cpp \ + test_sai_proxy_route.cpp \ + test_sai_proxy_router_interface.cpp \ + test_sai_proxy_router_rpfgroup.cpp \ + test_sai_proxy_router_samplepacket.cpp \ + test_sai_proxy_schedulergroup.cpp \ + test_sai_proxy_scheduler.cpp \ + test_sai_proxy_srv6.cpp \ + test_sai_proxy_switch.cpp \ + test_sai_proxy_system_port.cpp \ + test_sai_proxy_tam.cpp \ + test_sai_proxy_tunnel.cpp \ + test_sai_proxy_stp.cpp \ + test_sai_proxy_udf.cpp \ + test_sai_proxy_virtual_router.cpp \ + test_sai_proxy_vlan.cpp \ + test_sai_proxy_hostif.cpp \ + test_sai_proxy_wred.cpp \ + test_sai_proxy_ars.cpp \ + test_sai_proxy_poe.cpp \ + test_sai_proxy_ars_profile.cpp + +testslibsaiproxy_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) +testslibsaiproxy_LDADD = $(LDADD_GTEST) -L$(top_srcdir)/proxylib/.libs -lsaiproxy -lhiredis -lswsscommon -lpthread -L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta -lzmq $(CODE_COVERAGE_LIBS) + +TESTS = testslibsaiproxy tests diff --git a/unittest/proxylib/TestSai.cpp b/unittest/proxylib/TestSai.cpp new file mode 100644 index 000000000..3cee8d413 --- /dev/null +++ b/unittest/proxylib/TestSai.cpp @@ -0,0 +1,50 @@ +#include + +#include +#include +#include + +#include + +#include "Sai.h" + +using namespace saiproxy; + +class SaiTest : public ::testing::Test +{ +public: + SaiTest() = default; + virtual ~SaiTest() = default; + +public: + virtual void SetUp() override + { + m_sai = std::make_shared(); + + //sai_attribute_t attr; + //attr.id = SAI_SWITCH_ATTR_INIT_SWITCH; + //attr.value.booldata = true; + + //auto status = m_sai->create(SAI_OBJECT_TYPE_SWITCH, &m_swid, SAI_NULL_OBJECT_ID, 1, &attr); + //ASSERT_EQ(status, SAI_STATUS_SUCCESS); + } + + virtual void TearDown() override + { + //auto status = m_sai->remove(SAI_OBJECT_TYPE_SWITCH, m_swid); + //ASSERT_EQ(status, SAI_STATUS_SUCCESS); + } + +protected: + std::shared_ptr m_sai; + + sai_object_id_t m_swid = SAI_NULL_OBJECT_ID; + + const std::uint32_t m_guid = 0; // default context config id + const std::uint32_t m_scid = 0; // default switch config id +}; + +TEST_F(SaiTest, Ctr) +{ + auto s = std::make_shared(); +} diff --git a/unittest/proxylib/main.cpp b/unittest/proxylib/main.cpp new file mode 100644 index 000000000..61f8cd250 --- /dev/null +++ b/unittest/proxylib/main.cpp @@ -0,0 +1,21 @@ +#include + +#include + +class SwsscommonEnvironment: + public ::testing::Environment +{ + public: + void SetUp() override { } +}; + +int main(int argc, char* argv[]) +{ + testing::InitGoogleTest(&argc, argv); + + const auto env = new SwsscommonEnvironment; + + testing::AddGlobalTestEnvironment(env); + + return RUN_ALL_TESTS(); +} diff --git a/unittest/proxylib/main_libsaiproxy.cpp b/unittest/proxylib/main_libsaiproxy.cpp new file mode 100644 index 000000000..087ec87eb --- /dev/null +++ b/unittest/proxylib/main_libsaiproxy.cpp @@ -0,0 +1,118 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +#include + +static std::map g_profileMap; +static std::map::iterator g_profileIter; + +static const char* profile_get_value( + _In_ sai_switch_profile_id_t profile_id, + _In_ const char* variable) +{ + SWSS_LOG_ENTER(); + + if (variable == NULL) + { + SWSS_LOG_WARN("variable is null"); + return NULL; + } + + auto it = g_profileMap.find(variable); + + if (it == g_profileMap.end()) + { + SWSS_LOG_NOTICE("%s: NULL", variable); + return NULL; + } + + SWSS_LOG_NOTICE("%s: %s", variable, it->second.c_str()); + + return it->second.c_str(); +} + +static int profile_get_next_value( + _In_ sai_switch_profile_id_t profile_id, + _Out_ const char** variable, + _Out_ const char** value) +{ + SWSS_LOG_ENTER(); + + if (value == NULL) + { + SWSS_LOG_INFO("resetting profile map iterator"); + + g_profileIter = g_profileMap.begin(); + return 0; + } + + if (variable == NULL) + { + SWSS_LOG_WARN("variable is null"); + return -1; + } + + if (g_profileIter == g_profileMap.end()) + { + SWSS_LOG_INFO("iterator reached end"); + return -1; + } + + *variable = g_profileIter->first.c_str(); + *value = g_profileIter->second.c_str(); + + SWSS_LOG_INFO("key: %s:%s", *variable, *value); + + g_profileIter++; + + return 0; +} + +static sai_service_method_table_t test_services = { + profile_get_value, + profile_get_next_value +}; + +class SaiProxyEnvironment: + public ::testing::Environment +{ + public: + + virtual void SetUp() override + { + SWSS_LOG_ENTER(); + + //g_profileMap[SAI_KEY_VS_SWITCH_TYPE] = SAI_VALUE_VS_SWITCH_TYPE_BCM56850; + + g_profileIter = g_profileMap.begin(); + + auto status = sai_api_initialize(0, (sai_service_method_table_t*)&test_services); + + EXPECT_EQ(status, SAI_STATUS_SUCCESS); + } + + virtual void TearDown() override + { + SWSS_LOG_ENTER(); + + auto status = sai_api_uninitialize(); + + EXPECT_EQ(status, SAI_STATUS_SUCCESS); + } +}; + +int main(int argc, char* argv[]) +{ + testing::InitGoogleTest(&argc, argv); + + const auto env = new SaiProxyEnvironment(); + + testing::AddGlobalTestEnvironment(env); + + return RUN_ALL_TESTS(); +} diff --git a/unittest/proxylib/test_sai_proxy_acl.cpp b/unittest/proxylib/test_sai_proxy_acl.cpp new file mode 100644 index 000000000..03f3a7c8b --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_acl.cpp @@ -0,0 +1,48 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, acl) +{ + sai_acl_api_t *api = nullptr; + + sai_api_query(SAI_API_ACL, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_acl_table(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_acl_table(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_acl_table_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_acl_table_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_acl_entry(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_acl_entry(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_acl_entry_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_acl_entry_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_acl_counter(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_acl_counter(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_acl_counter_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_acl_counter_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_acl_range(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_acl_range(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_acl_range_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_acl_range_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_acl_table_group(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_acl_table_group(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_acl_table_group_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_acl_table_group_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_acl_table_group_member(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_acl_table_group_member(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_acl_table_group_member_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_acl_table_group_member_attribute(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_ars.cpp b/unittest/proxylib/test_sai_proxy_ars.cpp new file mode 100644 index 000000000..46b321dfa --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_ars.cpp @@ -0,0 +1,23 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, ars) +{ + sai_ars_api_t *api = nullptr; + + sai_api_query(SAI_API_ARS, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_ars(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_ars(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_ars_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_ars_attribute(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_ars_profile.cpp b/unittest/proxylib/test_sai_proxy_ars_profile.cpp new file mode 100644 index 000000000..4dacf0926 --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_ars_profile.cpp @@ -0,0 +1,23 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, ars_profile) +{ + sai_ars_profile_api_t *api = nullptr; + + sai_api_query(SAI_API_ARS_PROFILE, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_ars_profile(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_ars_profile(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_ars_profile_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_ars_profile_attribute(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_bfd.cpp b/unittest/proxylib/test_sai_proxy_bfd.cpp new file mode 100644 index 000000000..375490a0f --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_bfd.cpp @@ -0,0 +1,27 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, bfd) +{ + sai_bfd_api_t *api = nullptr; + + sai_api_query(SAI_API_BFD, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_bfd_session(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_bfd_session(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_bfd_session_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bfd_session_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bfd_session_stats(0,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bfd_session_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_bfd_session_stats(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_bmtor.cpp b/unittest/proxylib/test_sai_proxy_bmtor.cpp new file mode 100644 index 000000000..4cf9309cb --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_bmtor.cpp @@ -0,0 +1,46 @@ +#include + +extern "C" { +#include "sai.h" +#include "saiextensions.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, bmtor) +{ + sai_bmtor_api_t *api = nullptr; + + sai_api_query((sai_api_t)SAI_API_BMTOR, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_table_bitmap_classification_entry(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_table_bitmap_classification_entry(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_table_bitmap_classification_entry_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_bitmap_classification_entry_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_bitmap_classification_entry_stats(0,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_bitmap_classification_entry_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_table_bitmap_classification_entry_stats(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_table_bitmap_router_entry(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_table_bitmap_router_entry(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_table_bitmap_router_entry_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_bitmap_router_entry_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_bitmap_router_entry_stats(0,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_bitmap_router_entry_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_table_bitmap_router_entry_stats(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_table_meta_tunnel_entry(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_table_meta_tunnel_entry(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_table_meta_tunnel_entry_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_meta_tunnel_entry_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_meta_tunnel_entry_stats(0,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_meta_tunnel_entry_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_table_meta_tunnel_entry_stats(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_bridge.cpp b/unittest/proxylib/test_sai_proxy_bridge.cpp new file mode 100644 index 000000000..41b62018c --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_bridge.cpp @@ -0,0 +1,36 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, bridge) +{ + sai_bridge_api_t *api = nullptr; + + sai_api_query(SAI_API_BRIDGE, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_bridge(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_bridge(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_bridge_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bridge_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bridge_stats(0,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bridge_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_bridge_stats(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_bridge_port(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_bridge_port(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_bridge_port_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bridge_port_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bridge_port_stats(0,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bridge_port_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_bridge_port_stats(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_buffer.cpp b/unittest/proxylib/test_sai_proxy_buffer.cpp new file mode 100644 index 000000000..8e94de6b2 --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_buffer.cpp @@ -0,0 +1,41 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, buffer) +{ + sai_buffer_api_t *api = nullptr; + + sai_api_query(SAI_API_BUFFER, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_buffer_pool(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_buffer_pool(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_buffer_pool_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_buffer_pool_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_buffer_pool_stats(0,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_buffer_pool_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_buffer_pool_stats(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_ingress_priority_group(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_ingress_priority_group(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_ingress_priority_group_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_ingress_priority_group_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_ingress_priority_group_stats(0,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_ingress_priority_group_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_ingress_priority_group_stats(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_buffer_profile(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_buffer_profile(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_buffer_profile_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_buffer_profile_attribute(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_counter.cpp b/unittest/proxylib/test_sai_proxy_counter.cpp new file mode 100644 index 000000000..ba9b08a2c --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_counter.cpp @@ -0,0 +1,27 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, counter) +{ + sai_counter_api_t *api = nullptr; + + sai_api_query(SAI_API_COUNTER, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_counter(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_counter(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_counter_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_counter_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_counter_stats(0,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_counter_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_counter_stats(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_dash_acl.cpp b/unittest/proxylib/test_sai_proxy_dash_acl.cpp new file mode 100644 index 000000000..0c01886ac --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_dash_acl.cpp @@ -0,0 +1,33 @@ +#include + +extern "C" { +#include "sai.h" +#include "saiextensions.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, dash_acl) +{ + sai_dash_acl_api_t *api = nullptr; + + sai_api_query((sai_api_t)SAI_API_DASH_ACL, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dash_acl_group(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dash_acl_group(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_dash_acl_group_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_dash_acl_group_attribute(0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dash_acl_groups(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dash_acl_groups(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dash_acl_rule(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dash_acl_rule(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_dash_acl_rule_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_dash_acl_rule_attribute(0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dash_acl_rules(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dash_acl_rules(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_dash_direction_lookup.cpp b/unittest/proxylib/test_sai_proxy_dash_direction_lookup.cpp new file mode 100644 index 000000000..bd6a90c21 --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_dash_direction_lookup.cpp @@ -0,0 +1,24 @@ +#include + +extern "C" { +#include "sai.h" +#include "saiextensions.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, dash_direction_lookup) +{ + sai_dash_direction_lookup_api_t *api = nullptr; + + sai_api_query((sai_api_t)SAI_API_DASH_DIRECTION_LOOKUP, (void**)&api); + + EXPECT_NE(api, nullptr); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_direction_lookup_entry(0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_direction_lookup_entry(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_direction_lookup_entry_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_direction_lookup_entry_attribute(0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_direction_lookup_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_direction_lookup_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_dash_eni.cpp b/unittest/proxylib/test_sai_proxy_dash_eni.cpp new file mode 100644 index 000000000..21d8424fa --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_dash_eni.cpp @@ -0,0 +1,33 @@ +#include + +extern "C" { +#include "sai.h" +#include "saiextensions.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, dash_eni) +{ + sai_dash_eni_api_t *api = nullptr; + + sai_api_query((sai_api_t)SAI_API_DASH_ENI, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_eni_ether_address_map_entry(0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_eni_ether_address_map_entry(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_eni_ether_address_map_entry_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_eni_ether_address_map_entry_attribute(0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_eni_ether_address_map_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_eni_ether_address_map_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_eni(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_eni(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_eni_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_eni_attribute(0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_enis(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_enis(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_dash_inbound_routing.cpp b/unittest/proxylib/test_sai_proxy_dash_inbound_routing.cpp new file mode 100644 index 000000000..4beabbfb0 --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_dash_inbound_routing.cpp @@ -0,0 +1,24 @@ +#include + +extern "C" { +#include "sai.h" +#include "saiextensions.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, dash_inbound_routing) +{ + sai_dash_inbound_routing_api_t *api = nullptr; + + sai_api_query((sai_api_t)SAI_API_DASH_INBOUND_ROUTING, (void**)&api); + + EXPECT_NE(api, nullptr); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_inbound_routing_entry(0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_inbound_routing_entry(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_inbound_routing_entry_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_inbound_routing_entry_attribute(0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_inbound_routing_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_inbound_routing_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_dash_outbound_ca_to_pa.cpp b/unittest/proxylib/test_sai_proxy_dash_outbound_ca_to_pa.cpp new file mode 100644 index 000000000..672af07f8 --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_dash_outbound_ca_to_pa.cpp @@ -0,0 +1,24 @@ +#include + +extern "C" { +#include "sai.h" +#include "saiextensions.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, dash_ca_to_pa) +{ + sai_dash_outbound_ca_to_pa_api_t *api = nullptr; + + sai_api_query((sai_api_t)SAI_API_DASH_OUTBOUND_CA_TO_PA, (void**)&api); + + EXPECT_NE(api, nullptr); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_outbound_ca_to_pa_entry(0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_outbound_ca_to_pa_entry(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_outbound_ca_to_pa_entry_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_outbound_ca_to_pa_entry_attribute(0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_outbound_ca_to_pa_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_outbound_ca_to_pa_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_dash_outbound_routing.cpp b/unittest/proxylib/test_sai_proxy_dash_outbound_routing.cpp new file mode 100644 index 000000000..1f660162e --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_dash_outbound_routing.cpp @@ -0,0 +1,24 @@ +#include + +extern "C" { +#include "sai.h" +#include "saiextensions.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, dash_outbound_routing) +{ + sai_dash_outbound_routing_api_t *api = nullptr; + + sai_api_query((sai_api_t)SAI_API_DASH_OUTBOUND_ROUTING, (void**)&api); + + EXPECT_NE(api, nullptr); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_outbound_routing_entry(0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_outbound_routing_entry(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_outbound_routing_entry_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_outbound_routing_entry_attribute(0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_outbound_routing_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_outbound_routing_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_dash_pa_validation.cpp b/unittest/proxylib/test_sai_proxy_dash_pa_validation.cpp new file mode 100644 index 000000000..4ae287ea9 --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_dash_pa_validation.cpp @@ -0,0 +1,24 @@ +#include + +extern "C" { +#include "sai.h" +#include "saiextensions.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, dash_pa_validation) +{ + sai_dash_pa_validation_api_t *api = nullptr; + + sai_api_query((sai_api_t)SAI_API_DASH_PA_VALIDATION, (void**)&api); + + EXPECT_NE(api, nullptr); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_pa_validation_entry(0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_pa_validation_entry(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_pa_validation_entry_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_pa_validation_entry_attribute(0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_pa_validation_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_pa_validation_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_dash_vip.cpp b/unittest/proxylib/test_sai_proxy_dash_vip.cpp new file mode 100644 index 000000000..cc01068d0 --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_dash_vip.cpp @@ -0,0 +1,24 @@ +#include + +extern "C" { +#include "sai.h" +#include "saiextensions.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, dash_vip) +{ + sai_dash_vip_api_t *api = nullptr; + + sai_api_query((sai_api_t)SAI_API_DASH_VIP, (void**)&api); + + EXPECT_NE(api, nullptr); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_vip_entry(0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_vip_entry(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_vip_entry_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_vip_entry_attribute(0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_vip_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_vip_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_dash_vnet.cpp b/unittest/proxylib/test_sai_proxy_dash_vnet.cpp new file mode 100644 index 000000000..1b1ac4e8f --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_dash_vnet.cpp @@ -0,0 +1,24 @@ +#include + +extern "C" { +#include "sai.h" +#include "saiextensions.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, dash_vnet) +{ + sai_dash_vnet_api_t *api = nullptr; + + sai_api_query((sai_api_t)SAI_API_DASH_VNET, (void**)&api); + + EXPECT_NE(api, nullptr); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_vnet(0,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_vnet(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_vnet_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_vnet_attribute(0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_vnets(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_vnets(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_debug_counter.cpp b/unittest/proxylib/test_sai_proxy_debug_counter.cpp new file mode 100644 index 000000000..d00179740 --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_debug_counter.cpp @@ -0,0 +1,23 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, debug_counter) +{ + sai_debug_counter_api_t *api = nullptr; + + sai_api_query(SAI_API_DEBUG_COUNTER, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_debug_counter(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_debug_counter(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_debug_counter_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_debug_counter_attribute(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_dtel.cpp b/unittest/proxylib/test_sai_proxy_dtel.cpp new file mode 100644 index 000000000..101d14762 --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_dtel.cpp @@ -0,0 +1,43 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, dtel) +{ + sai_dtel_api_t *api = nullptr; + + sai_api_query(SAI_API_DTEL, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dtel(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dtel(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_dtel_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_dtel_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dtel_queue_report(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dtel_queue_report(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_dtel_queue_report_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_dtel_queue_report_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dtel_int_session(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dtel_int_session(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_dtel_int_session_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_dtel_int_session_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dtel_report_session(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dtel_report_session(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_dtel_report_session_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_dtel_report_session_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dtel_event(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dtel_event(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_dtel_event_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_dtel_event_attribute(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_fdb.cpp b/unittest/proxylib/test_sai_proxy_fdb.cpp new file mode 100644 index 000000000..c9f704581 --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_fdb.cpp @@ -0,0 +1,30 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, fdb) +{ + sai_fdb_api_t *api = nullptr; + + sai_api_query(SAI_API_FDB, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_fdb_entry_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_fdb_entry(&id,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_fdb_entry(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_fdb_entry_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_fdb_entry_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->flush_fdb_entries(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_fdb_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_fdb_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_fdb_entries_attribute(0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_fdb_entries_attribute(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_generic_programmable.cpp b/unittest/proxylib/test_sai_proxy_generic_programmable.cpp new file mode 100644 index 000000000..57804b410 --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_generic_programmable.cpp @@ -0,0 +1,23 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, generic_programmable) +{ + sai_generic_programmable_api_t *api = nullptr; + + sai_api_query(SAI_API_GENERIC_PROGRAMMABLE, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t obj_id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_generic_programmable(&obj_id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_generic_programmable(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_generic_programmable_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_generic_programmable_attribute(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_hash.cpp b/unittest/proxylib/test_sai_proxy_hash.cpp new file mode 100644 index 000000000..516cfae26 --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_hash.cpp @@ -0,0 +1,28 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, hash) +{ + sai_hash_api_t *api= nullptr; + + sai_api_query(SAI_API_HASH, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_hash(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_hash(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_hash_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_hash_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_fine_grained_hash_field(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_fine_grained_hash_field(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_fine_grained_hash_field_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_fine_grained_hash_field_attribute(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_hostif.cpp b/unittest/proxylib/test_sai_proxy_hostif.cpp new file mode 100644 index 000000000..e40f686d4 --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_hostif.cpp @@ -0,0 +1,48 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, hostif) +{ + sai_hostif_api_t *api= nullptr; + + sai_api_query(SAI_API_HOSTIF, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_hostif(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_hostif(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_hostif_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_hostif_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_hostif_table_entry(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_hostif_table_entry(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_hostif_table_entry_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_hostif_table_entry_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_hostif_trap_group(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_hostif_trap_group(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_hostif_trap_group_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_hostif_trap_group_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_hostif_trap(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_hostif_trap(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_hostif_trap_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_hostif_trap_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_hostif_user_defined_trap(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_hostif_user_defined_trap(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_hostif_user_defined_trap_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_hostif_user_defined_trap_attribute(0,0,0)); + + EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->recv_hostif_packet(0,0,0,0,0)); + EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->send_hostif_packet(0,0,0,0,0)); + EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->allocate_hostif_packet(0,0,0,0,0)); + EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->free_hostif_packet(0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_interfacequery.cpp b/unittest/proxylib/test_sai_proxy_interfacequery.cpp new file mode 100644 index 000000000..56dfff7b2 --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_interfacequery.cpp @@ -0,0 +1,115 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, sai_log_set) +{ + EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_log_set(SAI_API_VLAN, SAI_LOG_LEVEL_NOTICE)); +} + +TEST(libsaiproxy, sai_api_query) +{ + sai_vlan_api_t *api = nullptr; + + EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, sai_api_query(SAI_API_VLAN, nullptr)); + EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, sai_api_query(SAI_API_UNSPECIFIED, (void**)&api)); + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" + EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, sai_api_query((sai_api_t)(1000), (void**)&api)); +#pragma GCC diagnostic pop + + EXPECT_EQ(SAI_STATUS_SUCCESS, sai_api_query(SAI_API_VLAN, (void**)&api)); +} + +TEST(libsaiproxy, sai_query_attribute_capability) +{ + EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_query_attribute_capability(0,SAI_OBJECT_TYPE_NULL,0,0)); +} + +TEST(libsaiproxy, sai_query_attribute_enum_values_capability) +{ + EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_query_attribute_enum_values_capability(0,SAI_OBJECT_TYPE_NULL,0,0)); +} + +TEST(libsaiproxy, sai_object_type_get_availability) +{ + EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_object_type_get_availability(0,SAI_OBJECT_TYPE_NULL,0,0,0)); +} + +TEST(libsaiproxy, sai_dbg_generate_dump) +{ + EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_dbg_generate_dump(nullptr)); +} + +TEST(libsaiproxy, sai_object_type_query) +{ + EXPECT_EQ(SAI_OBJECT_TYPE_NULL, sai_object_type_query(SAI_NULL_OBJECT_ID)); +} + +TEST(libsaiproxy, sai_switch_id_query) +{ + EXPECT_EQ(SAI_NULL_OBJECT_ID, sai_switch_id_query(SAI_NULL_OBJECT_ID)); +} + +TEST(libsaiproxy, sai_bulk_get_attribute) +{ + EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_bulk_get_attribute(0,SAI_OBJECT_TYPE_NULL,0,0,0,0,0)); +} + +TEST(libsaiproxy, sai_get_maximum_attribute_count) +{ + EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_get_maximum_attribute_count(0, SAI_OBJECT_TYPE_NULL,0)); +} + +TEST(libsaiproxy, sai_get_object_count) +{ + EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_get_object_count(0,SAI_OBJECT_TYPE_NULL,0)); +} + +TEST(libsaiproxy, sai_get_object_key) +{ + EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_get_object_key(0,SAI_OBJECT_TYPE_NULL,0,0)); +} + +TEST(libsaiproxy, sai_query_stats_capability) +{ + EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_query_stats_capability(0,SAI_OBJECT_TYPE_NULL,0)); +} + +TEST(libsaiproxy, sai_bulk_object_get_stats) +{ + EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_bulk_object_get_stats(SAI_NULL_OBJECT_ID, + SAI_OBJECT_TYPE_PORT, + 0, + nullptr, + 0, + nullptr, + SAI_STATS_MODE_BULK_READ, + nullptr, + nullptr)); +} + +TEST(libsaiproxy, sai_bulk_object_clear_stats) +{ + EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_bulk_object_clear_stats(SAI_NULL_OBJECT_ID, + SAI_OBJECT_TYPE_PORT, + 0, + nullptr, + 0, + nullptr, + SAI_STATS_MODE_BULK_CLEAR, + nullptr)); +} + +TEST(libsaiproxy, sai_query_api_version) +{ + sai_api_version_t version; + + EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, sai_query_api_version(nullptr)); + EXPECT_EQ(SAI_STATUS_SUCCESS, sai_query_api_version(&version)); +} diff --git a/unittest/proxylib/test_sai_proxy_ipmc.cpp b/unittest/proxylib/test_sai_proxy_ipmc.cpp new file mode 100644 index 000000000..5aa5555d0 --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_ipmc.cpp @@ -0,0 +1,23 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, ipmc) +{ + sai_ipmc_api_t *api = nullptr; + + sai_api_query(SAI_API_IPMC, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_ipmc_entry_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_ipmc_entry(&id,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_ipmc_entry(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_ipmc_entry_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_ipmc_entry_attribute(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_ipmc_group.cpp b/unittest/proxylib/test_sai_proxy_ipmc_group.cpp new file mode 100644 index 000000000..50a56ead6 --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_ipmc_group.cpp @@ -0,0 +1,28 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, ipmc_group) +{ + sai_ipmc_group_api_t *api = nullptr; + + sai_api_query(SAI_API_IPMC_GROUP, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_ipmc_group(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_ipmc_group(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_ipmc_group_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_ipmc_group_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_ipmc_group_member(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_ipmc_group_member(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_ipmc_group_member_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_ipmc_group_member_attribute(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_isolation_group.cpp b/unittest/proxylib/test_sai_proxy_isolation_group.cpp new file mode 100644 index 000000000..23faaa490 --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_isolation_group.cpp @@ -0,0 +1,28 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, isolation_group) +{ + sai_isolation_group_api_t *api = nullptr; + + sai_api_query(SAI_API_ISOLATION_GROUP, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_isolation_group(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_isolation_group(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_isolation_group_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_isolation_group_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_isolation_group_member(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_isolation_group_member(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_isolation_group_member_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_isolation_group_member_attribute(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_l2mc.cpp b/unittest/proxylib/test_sai_proxy_l2mc.cpp new file mode 100644 index 000000000..1c646905a --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_l2mc.cpp @@ -0,0 +1,23 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, l2mc) +{ + sai_l2mc_api_t *api = nullptr; + + sai_api_query(SAI_API_L2MC, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_l2mc_entry_t id ; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_l2mc_entry(&id,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_l2mc_entry(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_l2mc_entry_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_l2mc_entry_attribute(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_l2mcgroup.cpp b/unittest/proxylib/test_sai_proxy_l2mcgroup.cpp new file mode 100644 index 000000000..0c92d1bae --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_l2mcgroup.cpp @@ -0,0 +1,28 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, l2mc_group) +{ + sai_l2mc_group_api_t *api = nullptr; + + sai_api_query(SAI_API_L2MC_GROUP, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_l2mc_group(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_l2mc_group(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_l2mc_group_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_l2mc_group_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_l2mc_group_member(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_l2mc_group_member(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_l2mc_group_member_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_l2mc_group_member_attribute(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_lag.cpp b/unittest/proxylib/test_sai_proxy_lag.cpp new file mode 100644 index 000000000..0cad93689 --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_lag.cpp @@ -0,0 +1,31 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, lag) +{ + sai_lag_api_t *api = nullptr; + + sai_api_query(SAI_API_LAG, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_lag(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_lag(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_lag_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_lag_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_lag_member(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_lag_member(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_lag_member_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_lag_member_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_lag_members(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_lag_members(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_macsec.cpp b/unittest/proxylib/test_sai_proxy_macsec.cpp new file mode 100644 index 000000000..c05eed1f3 --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_macsec.cpp @@ -0,0 +1,59 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, macsec) +{ + sai_macsec_api_t *api = nullptr; + + sai_api_query(SAI_API_MACSEC, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_macsec(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_macsec(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_macsec_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_macsec_port(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_macsec_port(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_macsec_port_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_port_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_port_stats(0,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_port_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_macsec_port_stats(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_macsec_flow(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_macsec_flow(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_macsec_flow_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_flow_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_flow_stats(0,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_flow_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_macsec_flow_stats(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_macsec_sc(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_macsec_sc(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_macsec_sc_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_sc_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_sc_stats(0,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_sc_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_macsec_sc_stats(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_macsec_sa(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_macsec_sa(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_macsec_sa_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_sa_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_sa_stats(0,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_sa_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_macsec_sa_stats(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_mcastfdb.cpp b/unittest/proxylib/test_sai_proxy_mcastfdb.cpp new file mode 100644 index 000000000..0514918f8 --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_mcastfdb.cpp @@ -0,0 +1,23 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, mcast_fdb) +{ + sai_mcast_fdb_api_t *api = nullptr; + + sai_api_query(SAI_API_MCAST_FDB, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_mcast_fdb_entry_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_mcast_fdb_entry(&id,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_mcast_fdb_entry(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_mcast_fdb_entry_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_mcast_fdb_entry_attribute(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_mirror.cpp b/unittest/proxylib/test_sai_proxy_mirror.cpp new file mode 100644 index 000000000..115e02ae3 --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_mirror.cpp @@ -0,0 +1,23 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, mirror) +{ + sai_mirror_api_t *api = nullptr; + + sai_api_query(SAI_API_MIRROR, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_mirror_session(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_mirror_session(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_mirror_session_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_mirror_session_attribute(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_mpls.cpp b/unittest/proxylib/test_sai_proxy_mpls.cpp new file mode 100644 index 000000000..40339c97b --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_mpls.cpp @@ -0,0 +1,28 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, mpls) +{ + sai_mpls_api_t *api = nullptr; + + sai_api_query(SAI_API_MPLS, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_inseg_entry_t id ; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_inseg_entry(&id,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_inseg_entry(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_inseg_entry_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_inseg_entry_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_inseg_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_inseg_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_inseg_entries_attribute(0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_inseg_entries_attribute(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_nat.cpp b/unittest/proxylib/test_sai_proxy_nat.cpp new file mode 100644 index 000000000..8c5e3d40c --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_nat.cpp @@ -0,0 +1,35 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, nat) +{ + sai_nat_api_t *api = nullptr; + + sai_api_query(SAI_API_NAT, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_nat_entry_t id ; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_nat_entry(&id,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_nat_entry(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_nat_entry_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_nat_entry_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_nat_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_nat_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_nat_entries_attribute(0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_nat_entries_attribute(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + + sai_object_id_t id1; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_nat_zone_counter(&id1,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_nat_zone_counter(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_nat_zone_counter_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_nat_zone_counter_attribute(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_neighbor.cpp b/unittest/proxylib/test_sai_proxy_neighbor.cpp new file mode 100644 index 000000000..2c44be0b0 --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_neighbor.cpp @@ -0,0 +1,25 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, neighbor) +{ + sai_neighbor_api_t *api = nullptr; + + sai_api_query(SAI_API_NEIGHBOR, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_neighbor_entry_t id ; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_neighbor_entry(&id,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_neighbor_entry(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_neighbor_entry_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_neighbor_entry_attribute(0,0,0)); + + EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->remove_all_neighbor_entries(0)); +} diff --git a/unittest/proxylib/test_sai_proxy_nexthop.cpp b/unittest/proxylib/test_sai_proxy_nexthop.cpp new file mode 100644 index 000000000..fd5b5399e --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_nexthop.cpp @@ -0,0 +1,23 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, next_hop) +{ + sai_next_hop_api_t *api = nullptr; + + sai_api_query(SAI_API_NEXT_HOP, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_next_hop(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_next_hop(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_next_hop_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_next_hop_attribute(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_nexthopgroup.cpp b/unittest/proxylib/test_sai_proxy_nexthopgroup.cpp new file mode 100644 index 000000000..87c40847d --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_nexthopgroup.cpp @@ -0,0 +1,36 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, next_hop_group) +{ + sai_next_hop_group_api_t *api = nullptr; + + sai_api_query(SAI_API_NEXT_HOP_GROUP, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_next_hop_group(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_next_hop_group(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_next_hop_group_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_next_hop_group_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_next_hop_group_member(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_next_hop_group_member(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_next_hop_group_member_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_next_hop_group_member_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_next_hop_group_members(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_next_hop_group_members(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_next_hop_group_map(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_next_hop_group_map(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_next_hop_group_map_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_next_hop_group_map_attribute(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_poe.cpp b/unittest/proxylib/test_sai_proxy_poe.cpp new file mode 100644 index 000000000..efa7ab2c5 --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_poe.cpp @@ -0,0 +1,33 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, poe) +{ + sai_poe_api_t *api = nullptr; + + sai_api_query(SAI_API_POE, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_poe_device(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_poe_device(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_poe_device_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_poe_device_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_poe_pse(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_poe_pse(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_poe_pse_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_poe_pse_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_poe_port(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_poe_port(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_poe_port_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_poe_port_attribute(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_policer.cpp b/unittest/proxylib/test_sai_proxy_policer.cpp new file mode 100644 index 000000000..da8ef45ae --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_policer.cpp @@ -0,0 +1,27 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, policer) +{ + sai_policer_api_t *api = nullptr; + + sai_api_query(SAI_API_POLICER, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_policer(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_policer(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_policer_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_policer_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_policer_stats(0,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_policer_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_policer_stats(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_port.cpp b/unittest/proxylib/test_sai_proxy_port.cpp new file mode 100644 index 000000000..f24877bc3 --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_port.cpp @@ -0,0 +1,48 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, port) +{ + sai_port_api_t *api = nullptr; + + sai_api_query(SAI_API_PORT, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_port(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_port(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_port_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_port_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_port_stats(0,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_port_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_port_stats(0,0,0)); + + EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->clear_port_all_stats(0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_port_pool(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_port_pool(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_port_pool_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_port_pool_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_port_pool_stats(0,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_port_pool_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_port_pool_stats(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_port_connector(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_port_connector(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_port_connector_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_port_connector_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_port_serdes(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_port_serdes(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_port_serdes_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_port_serdes_attribute(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_qosmap.cpp b/unittest/proxylib/test_sai_proxy_qosmap.cpp new file mode 100644 index 000000000..3dd3811d0 --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_qosmap.cpp @@ -0,0 +1,23 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, qos_map) +{ + sai_qos_map_api_t *api = nullptr; + + sai_api_query(SAI_API_QOS_MAP, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_qos_map(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_qos_map(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_qos_map_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_qos_map_attribute(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_queue.cpp b/unittest/proxylib/test_sai_proxy_queue.cpp new file mode 100644 index 000000000..c230ca56a --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_queue.cpp @@ -0,0 +1,27 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, queue) +{ + sai_queue_api_t *api = nullptr; + + sai_api_query(SAI_API_QUEUE, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_queue(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_queue(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_queue_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_queue_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_queue_stats(0,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_queue_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_queue_stats(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_route.cpp b/unittest/proxylib/test_sai_proxy_route.cpp new file mode 100644 index 000000000..f7369b159 --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_route.cpp @@ -0,0 +1,28 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, route) +{ + sai_route_api_t *api = nullptr; + + sai_api_query(SAI_API_ROUTE, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_route_entry_t id ; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_route_entry(&id,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_route_entry(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_route_entry_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_route_entry_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_route_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_route_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_route_entries_attribute(0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_route_entries_attribute(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_router_interface.cpp b/unittest/proxylib/test_sai_proxy_router_interface.cpp new file mode 100644 index 000000000..0dbd98fac --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_router_interface.cpp @@ -0,0 +1,27 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, router_interface) +{ + sai_router_interface_api_t *api = nullptr; + + sai_api_query(SAI_API_ROUTER_INTERFACE, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_router_interface(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_router_interface(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_router_interface_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_router_interface_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_router_interface_stats(0,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_router_interface_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_router_interface_stats(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_router_rpfgroup.cpp b/unittest/proxylib/test_sai_proxy_router_rpfgroup.cpp new file mode 100644 index 000000000..362c20f35 --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_router_rpfgroup.cpp @@ -0,0 +1,28 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, rpf_group) +{ + sai_rpf_group_api_t *api = nullptr; + + sai_api_query(SAI_API_RPF_GROUP, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_rpf_group(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_rpf_group(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_rpf_group_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_rpf_group_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_rpf_group_member(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_rpf_group_member(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_rpf_group_member_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_rpf_group_member_attribute(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_router_samplepacket.cpp b/unittest/proxylib/test_sai_proxy_router_samplepacket.cpp new file mode 100644 index 000000000..1bec595d8 --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_router_samplepacket.cpp @@ -0,0 +1,23 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, samplepacket) +{ + sai_samplepacket_api_t *api = nullptr; + + sai_api_query(SAI_API_SAMPLEPACKET, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_samplepacket(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_samplepacket(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_samplepacket_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_samplepacket_attribute(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_scheduler.cpp b/unittest/proxylib/test_sai_proxy_scheduler.cpp new file mode 100644 index 000000000..e1b2a77fe --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_scheduler.cpp @@ -0,0 +1,23 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, scheduler) +{ + sai_scheduler_api_t *api = nullptr; + + sai_api_query(SAI_API_SCHEDULER, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_scheduler(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_scheduler(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_scheduler_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_scheduler_attribute(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_schedulergroup.cpp b/unittest/proxylib/test_sai_proxy_schedulergroup.cpp new file mode 100644 index 000000000..48e581220 --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_schedulergroup.cpp @@ -0,0 +1,23 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, scheduler_group) +{ + sai_scheduler_group_api_t *api = nullptr; + + sai_api_query(SAI_API_SCHEDULER_GROUP, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_scheduler_group(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_scheduler_group(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_scheduler_group_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_scheduler_group_attribute(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_srv6.cpp b/unittest/proxylib/test_sai_proxy_srv6.cpp new file mode 100644 index 000000000..d8ba0f748 --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_srv6.cpp @@ -0,0 +1,36 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, srv6) +{ + sai_srv6_api_t *api = nullptr; + + sai_api_query(SAI_API_SRV6, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t obj_id; + sai_my_sid_entry_t id ; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_srv6_sidlist(&obj_id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_srv6_sidlist(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_srv6_sidlist_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_srv6_sidlist_attribute(0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_srv6_sidlists(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_srv6_sidlists(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_my_sid_entry(&id,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_my_sid_entry(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_my_sid_entry_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_my_sid_entry_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_my_sid_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_my_sid_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_my_sid_entries_attribute(0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_my_sid_entries_attribute(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_stp.cpp b/unittest/proxylib/test_sai_proxy_stp.cpp new file mode 100644 index 000000000..4be8b2053 --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_stp.cpp @@ -0,0 +1,31 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, stp) +{ + sai_stp_api_t *api = nullptr; + + sai_api_query(SAI_API_STP, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_stp(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_stp(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_stp_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_stp_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_stp_port(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_stp_port(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_stp_port_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_stp_port_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_stp_ports(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_stp_ports(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_switch.cpp b/unittest/proxylib/test_sai_proxy_switch.cpp new file mode 100644 index 000000000..b78ad7ac5 --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_switch.cpp @@ -0,0 +1,35 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, switch) +{ + sai_switch_api_t *api = nullptr; + + sai_api_query(SAI_API_SWITCH, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_switch(&id,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_switch(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_switch_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_switch_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_switch_stats(0,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_switch_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_switch_stats(0,0,0)); + + EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->switch_mdio_read(0,0,0,0,0)); + EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->switch_mdio_write(0,0,0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_switch_tunnel(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_switch_tunnel(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_switch_tunnel_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_switch_tunnel_attribute(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_system_port.cpp b/unittest/proxylib/test_sai_proxy_system_port.cpp new file mode 100644 index 000000000..ed4b3ac5a --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_system_port.cpp @@ -0,0 +1,23 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, system_port) +{ + sai_system_port_api_t *api = nullptr; + + sai_api_query(SAI_API_SYSTEM_PORT, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_system_port(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_system_port(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_system_port_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_system_port_attribute(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_tam.cpp b/unittest/proxylib/test_sai_proxy_tam.cpp new file mode 100644 index 000000000..7b5dfe048 --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_tam.cpp @@ -0,0 +1,85 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, tam) +{ + sai_tam_api_t *api = nullptr; + + sai_api_query(SAI_API_TAM, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_math_func(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_math_func(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_math_func_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_math_func_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_report(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_report(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_report_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_report_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_event_threshold(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_event_threshold(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_event_threshold_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_event_threshold_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_int(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_int(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_int_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_int_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_tel_type(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_tel_type(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_tel_type_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_tel_type_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_transport(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_transport(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_transport_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_transport_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_telemetry(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_telemetry(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_telemetry_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_telemetry_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_collector(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_collector(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_collector_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_collector_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_event_action(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_event_action(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_event_action_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_event_action_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_event(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_event(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_event_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_event_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_counter_subscription(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_counter_subscription(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_counter_subscription_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_counter_subscription_attribute(0,0,0)); +} + +TEST(libsaiproxy, sai_tam_telemetry_get_data) +{ + sai_object_list_t list; + + EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_tam_telemetry_get_data(0,list,0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_tunnel.cpp b/unittest/proxylib/test_sai_proxy_tunnel.cpp new file mode 100644 index 000000000..190cb63fa --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_tunnel.cpp @@ -0,0 +1,49 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, tunnel) +{ + sai_tunnel_api_t *api = nullptr; + + sai_api_query(SAI_API_TUNNEL, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tunnel_map(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tunnel_map(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tunnel_map_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tunnel_map_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tunnel(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tunnel(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tunnel_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tunnel_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tunnel_stats(0,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tunnel_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_tunnel_stats(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tunnel_term_table_entry(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tunnel_term_table_entry(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tunnel_term_table_entry_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tunnel_term_table_entry_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tunnel_map_entry(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tunnel_map_entry(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tunnel_map_entry_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tunnel_map_entry_attribute(0,0,0)); + + uint32_t attr_count = 0; + sai_status_t status = 0; + sai_attribute_t *p_attr = nullptr; + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tunnels_attribute(0,&id,&attr_count,&p_attr,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,&status)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tunnels_attribute(0,&id,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,&status)); +} + diff --git a/unittest/proxylib/test_sai_proxy_udf.cpp b/unittest/proxylib/test_sai_proxy_udf.cpp new file mode 100644 index 000000000..1549a56f8 --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_udf.cpp @@ -0,0 +1,33 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, udf) +{ + sai_udf_api_t *api = nullptr; + + sai_api_query(SAI_API_UDF, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_udf(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_udf(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_udf_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_udf_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_udf_match(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_udf_match(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_udf_match_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_udf_match_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_udf_group(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_udf_group(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_udf_group_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_udf_group_attribute(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_virtual_router.cpp b/unittest/proxylib/test_sai_proxy_virtual_router.cpp new file mode 100644 index 000000000..0e7b213a9 --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_virtual_router.cpp @@ -0,0 +1,23 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, virtual_router) +{ + sai_virtual_router_api_t *api = nullptr; + + sai_api_query(SAI_API_VIRTUAL_ROUTER, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_virtual_router(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_virtual_router(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_virtual_router_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_virtual_router_attribute(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_vlan.cpp b/unittest/proxylib/test_sai_proxy_vlan.cpp new file mode 100644 index 000000000..fddf914bf --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_vlan.cpp @@ -0,0 +1,35 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, vlan) +{ + sai_vlan_api_t *api = nullptr; + + sai_api_query(SAI_API_VLAN, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_vlan(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_vlan(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_vlan_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_vlan_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_vlan_member(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_vlan_member(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_vlan_member_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_vlan_member_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_vlan_members(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_vlan_members(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_vlan_stats(0,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_vlan_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_vlan_stats(0,0,0)); +} diff --git a/unittest/proxylib/test_sai_proxy_wred.cpp b/unittest/proxylib/test_sai_proxy_wred.cpp new file mode 100644 index 000000000..de00c4a9c --- /dev/null +++ b/unittest/proxylib/test_sai_proxy_wred.cpp @@ -0,0 +1,23 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaiproxy, wred) +{ + sai_wred_api_t *api = nullptr; + + sai_api_query(SAI_API_WRED, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_wred(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_wred(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_wred_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_wred_attribute(0,0,0)); +} diff --git a/unittest/vslib/test_sai_vs_poe.cpp b/unittest/vslib/test_sai_vs_poe.cpp index a79deaa27..03ec57601 100644 --- a/unittest/vslib/test_sai_vs_poe.cpp +++ b/unittest/vslib/test_sai_vs_poe.cpp @@ -6,7 +6,7 @@ extern "C" { #include "swss/logger.h" -TEST(libsairedis, poe) +TEST(libsaivs, poe) { sai_poe_api_t *api = nullptr; diff --git a/unittest/vslib/test_sai_vs_tam.cpp b/unittest/vslib/test_sai_vs_tam.cpp index f879977f7..c77ccd35f 100644 --- a/unittest/vslib/test_sai_vs_tam.cpp +++ b/unittest/vslib/test_sai_vs_tam.cpp @@ -77,7 +77,7 @@ TEST(libsaivs, tam) EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_counter_subscription_attribute(0,0,0)); } -TEST(libsairedis, sai_tam_telemetry_get_data) +TEST(libsaivs, sai_tam_telemetry_get_data) { sai_object_list_t list; From 20bcfe1965a8f9f64e25355783994165b780839a Mon Sep 17 00:00:00 2001 From: Kamil Cudnik Date: Sun, 26 May 2024 19:01:41 +0200 Subject: [PATCH 27/32] [SaiInterface] Support sai_query_api_version api (#1383) Will be needed in later consolidation code --- lib/ClientSai.cpp | 12 ++++++ lib/ClientSai.h | 3 ++ lib/ClientServerSai.cpp | 10 +++++ lib/ClientServerSai.h | 3 ++ lib/RedisRemoteSaiInterface.cpp | 21 +++++++++ lib/RedisRemoteSaiInterface.h | 3 ++ lib/Sai.cpp | 25 +++++++++++ lib/Sai.h | 3 ++ lib/ServerSai.cpp | 10 +++++ lib/ServerSai.h | 3 ++ lib/sai_redis_interfacequery.cpp | 15 +------ meta/DummySaiInterface.cpp | 17 ++++++++ meta/DummySaiInterface.h | 3 ++ meta/Meta.cpp | 10 +++++ meta/Meta.h | 3 ++ meta/SaiInterface.h | 3 ++ proxylib/Sai.cpp | 23 ++++++++++ proxylib/Sai.h | 3 ++ proxylib/sai_proxy_interfacequery.cpp | 17 +------- syncd/VendorSai.cpp | 43 +++++++++++-------- syncd/VendorSai.h | 3 ++ unittest/lib/Makefile.am | 3 +- unittest/lib/TestSai.cpp | 42 ++++++++++++++++++ unittest/meta/Makefile.am | 1 + unittest/meta/TestDummySaiInterface.cpp | 19 ++++++++ unittest/proxylib/TestSai.cpp | 10 +++++ .../vslib/TestVirtualSwitchSaiInterface.cpp | 8 ++++ vslib/Sai.cpp | 10 +++++ vslib/Sai.h | 3 ++ vslib/VirtualSwitchSaiInterface.cpp | 17 ++++++++ vslib/VirtualSwitchSaiInterface.h | 3 ++ vslib/sai_vs_interfacequery.cpp | 3 +- 32 files changed, 302 insertions(+), 50 deletions(-) create mode 100644 unittest/lib/TestSai.cpp create mode 100644 unittest/meta/TestDummySaiInterface.cpp diff --git a/lib/ClientSai.cpp b/lib/ClientSai.cpp index 809f50e73..17c8f54cb 100644 --- a/lib/ClientSai.cpp +++ b/lib/ClientSai.cpp @@ -1497,3 +1497,15 @@ sai_status_t ClientSai::logSet( return SAI_STATUS_SUCCESS; } + +sai_status_t ClientSai::queryApiVersion( + _Out_ sai_api_version_t *version) +{ + MUTEX(); + SWSS_LOG_ENTER(); + REDIS_CHECK_API_INITIALIZED(); + + SWSS_LOG_ERROR("queryApiVersion not implemented, FIXME"); + + return SAI_STATUS_NOT_IMPLEMENTED; +} diff --git a/lib/ClientSai.h b/lib/ClientSai.h index 05d0f5888..ab4516876 100644 --- a/lib/ClientSai.h +++ b/lib/ClientSai.h @@ -175,6 +175,9 @@ namespace sairedis _In_ sai_api_t api, _In_ sai_log_level_t log_level) override; + virtual sai_status_t queryApiVersion( + _Out_ sai_api_version_t *version) override; + private: // QUAD API helpers sai_status_t create( diff --git a/lib/ClientServerSai.cpp b/lib/ClientServerSai.cpp index 60366aaef..cc01a15d2 100644 --- a/lib/ClientServerSai.cpp +++ b/lib/ClientServerSai.cpp @@ -592,3 +592,13 @@ sai_status_t ClientServerSai::logSet( return m_sai->logSet(api, log_level); } + +sai_status_t ClientServerSai::queryApiVersion( + _Out_ sai_api_version_t *version) +{ + MUTEX(); + SWSS_LOG_ENTER(); + REDIS_CHECK_API_INITIALIZED(); + + return m_sai->queryApiVersion(version); +} diff --git a/lib/ClientServerSai.h b/lib/ClientServerSai.h index db6c2460c..502f91dfa 100644 --- a/lib/ClientServerSai.h +++ b/lib/ClientServerSai.h @@ -167,6 +167,9 @@ namespace sairedis _In_ sai_api_t api, _In_ sai_log_level_t log_level) override; + virtual sai_status_t queryApiVersion( + _Out_ sai_api_version_t *version) override; + private: bool m_apiInitialized; diff --git a/lib/RedisRemoteSaiInterface.cpp b/lib/RedisRemoteSaiInterface.cpp index 12bcba7d9..213be710c 100644 --- a/lib/RedisRemoteSaiInterface.cpp +++ b/lib/RedisRemoteSaiInterface.cpp @@ -1854,6 +1854,27 @@ sai_status_t RedisRemoteSaiInterface::logSet( return SAI_STATUS_SUCCESS; } +sai_status_t RedisRemoteSaiInterface::queryApiVersion( + _Out_ sai_api_version_t *version) +{ + SWSS_LOG_ENTER(); + + if (version) + { + *version = SAI_API_VERSION; + + // TODO FIXME implement proper query for syncd, currently this is not an issue since swss is not using this API + + SWSS_LOG_WARN("retruning SAI API version %d with sairedis compiled SAI headers, not actual libsai.so", SAI_API_VERSION); + + return SAI_STATUS_SUCCESS; + } + + SWSS_LOG_ERROR("version parameter is NULL"); + + return SAI_STATUS_INVALID_PARAMETER; +} + sai_status_t RedisRemoteSaiInterface::sai_redis_notify_syncd( _In_ sai_object_id_t switchId, _In_ const sai_attribute_t *attr) diff --git a/lib/RedisRemoteSaiInterface.h b/lib/RedisRemoteSaiInterface.h index 4f19f9faa..b124bc52a 100644 --- a/lib/RedisRemoteSaiInterface.h +++ b/lib/RedisRemoteSaiInterface.h @@ -186,6 +186,9 @@ namespace sairedis _In_ sai_api_t api, _In_ sai_log_level_t log_level) override; + virtual sai_status_t queryApiVersion( + _Out_ sai_api_version_t *version) override; + public: // notify syncd virtual sai_status_t notifySyncd( diff --git a/lib/Sai.cpp b/lib/Sai.cpp index 15725dc24..c817d1574 100644 --- a/lib/Sai.cpp +++ b/lib/Sai.cpp @@ -700,6 +700,31 @@ sai_status_t Sai::logSet( return SAI_STATUS_SUCCESS; } +sai_status_t Sai::queryApiVersion( + _Out_ sai_api_version_t *version) +{ + MUTEX(); + SWSS_LOG_ENTER(); + REDIS_CHECK_API_INITIALIZED(); + + // TODO we should use specific context, but we don't know which one since + // there is no object ID parameter, we can use default context or cast + // version as context id same as passed in SAI_REDIS_SWITCH_ATTR_CONTEXT + // currently we will return just first context on context map, since + // user maybe not aware of trick with casting context + + for (auto&kvp: m_contextMap) + { + SWSS_LOG_WARN("using first context"); + + return kvp.second->m_meta->queryApiVersion(version); + } + + SWSS_LOG_ERROR("context map is empty"); + + return SAI_STATUS_FAILURE; +} + /* * NOTE: Notifications during switch create and switch remove. * diff --git a/lib/Sai.h b/lib/Sai.h index d92c43919..6fe04ebc0 100644 --- a/lib/Sai.h +++ b/lib/Sai.h @@ -176,6 +176,9 @@ namespace sairedis _In_ sai_api_t api, _In_ sai_log_level_t log_level) override; + virtual sai_status_t queryApiVersion( + _Out_ sai_api_version_t *version) override; + private: sai_switch_notifications_t handle_notification( diff --git a/lib/ServerSai.cpp b/lib/ServerSai.cpp index 24bd4043a..b53ccdf0e 100644 --- a/lib/ServerSai.cpp +++ b/lib/ServerSai.cpp @@ -613,6 +613,16 @@ sai_status_t ServerSai::logSet( return m_sai->logSet(api, log_level); } +sai_status_t ServerSai::queryApiVersion( + _Out_ sai_api_version_t *version) +{ + MUTEX(); + SWSS_LOG_ENTER(); + REDIS_CHECK_API_INITIALIZED(); + + return m_sai->queryApiVersion(version); +} + void ServerSai::serverThreadFunction() { SWSS_LOG_ENTER(); diff --git a/lib/ServerSai.h b/lib/ServerSai.h index b67c4ed1c..f6bfbf950 100644 --- a/lib/ServerSai.h +++ b/lib/ServerSai.h @@ -172,6 +172,9 @@ namespace sairedis _In_ sai_api_t api, _In_ sai_log_level_t log_level) override; + virtual sai_status_t queryApiVersion( + _Out_ sai_api_version_t *version) override; + private: void serverThreadFunction(); diff --git a/lib/sai_redis_interfacequery.cpp b/lib/sai_redis_interfacequery.cpp index 41b3c950e..74e910956 100644 --- a/lib/sai_redis_interfacequery.cpp +++ b/lib/sai_redis_interfacequery.cpp @@ -261,20 +261,7 @@ sai_status_t sai_query_api_version( { SWSS_LOG_ENTER(); - if (version) - { - *version = SAI_API_VERSION; - - // TODO FIXME implement proper query for syncd, currently this is not an issue since swss is not using this API - - SWSS_LOG_WARN("retruning SAI API version %d with sairedis compiled SAI headers, not actual libsai.so", SAI_API_VERSION); - - return SAI_STATUS_SUCCESS; - } - - SWSS_LOG_ERROR("version parameter is NULL"); - - return SAI_STATUS_INVALID_PARAMETER; + return redis_sai->queryApiVersion(version); } sai_status_t sai_bulk_object_get_stats( diff --git a/meta/DummySaiInterface.cpp b/meta/DummySaiInterface.cpp index fa3ede4fe..db5781457 100644 --- a/meta/DummySaiInterface.cpp +++ b/meta/DummySaiInterface.cpp @@ -418,3 +418,20 @@ sai_status_t DummySaiInterface::logSet( return m_status; } + +sai_status_t DummySaiInterface::queryApiVersion( + _Out_ sai_api_version_t *version) +{ + SWSS_LOG_ENTER(); + + if (version) + { + *version = SAI_API_VERSION; + + return m_status; + } + + SWSS_LOG_ERROR("version parameter is NULL"); + + return m_status; +} diff --git a/meta/DummySaiInterface.h b/meta/DummySaiInterface.h index 8cef2ecff..0664bf7df 100644 --- a/meta/DummySaiInterface.h +++ b/meta/DummySaiInterface.h @@ -204,6 +204,9 @@ namespace saimeta _In_ sai_api_t api, _In_ sai_log_level_t log_level) override; + virtual sai_status_t queryApiVersion( + _Out_ sai_api_version_t *version) override; + protected: sai_status_t m_status; diff --git a/meta/Meta.cpp b/meta/Meta.cpp index 29cfe771d..1237065a8 100644 --- a/meta/Meta.cpp +++ b/meta/Meta.cpp @@ -1377,6 +1377,16 @@ sai_status_t Meta::logSet( return m_implementation->logSet(api, log_level); } +sai_status_t Meta::queryApiVersion( + _Out_ sai_api_version_t *version) +{ + SWSS_LOG_ENTER(); + + PARAMETER_CHECK_IF_NOT_NULL(version); + + return m_implementation->queryApiVersion(version); +} + void Meta::clean_after_switch_remove( _In_ sai_object_id_t switchId) { diff --git a/meta/Meta.h b/meta/Meta.h index f0dd36142..3e0d97e41 100644 --- a/meta/Meta.h +++ b/meta/Meta.h @@ -183,6 +183,9 @@ namespace saimeta _In_ sai_api_t api, _In_ sai_log_level_t log_level) override; + virtual sai_status_t queryApiVersion( + _Out_ sai_api_version_t *version) override; + public: void meta_init_db(); diff --git a/meta/SaiInterface.h b/meta/SaiInterface.h index fdd55ac00..4c42f0aaf 100644 --- a/meta/SaiInterface.h +++ b/meta/SaiInterface.h @@ -317,6 +317,9 @@ namespace sairedis _In_ sai_api_t api, _In_ sai_log_level_t log_level) = 0; + virtual sai_status_t queryApiVersion( + _Out_ sai_api_version_t *version) = 0; + public: // non SAI API virtual sai_log_level_t logGet( diff --git a/proxylib/Sai.cpp b/proxylib/Sai.cpp index a217769a3..94febf931 100644 --- a/proxylib/Sai.cpp +++ b/proxylib/Sai.cpp @@ -558,6 +558,29 @@ sai_status_t Sai::logSet( return SAI_STATUS_SUCCESS; } +sai_status_t Sai::queryApiVersion( + _Out_ sai_api_version_t *version) +{ + SWSS_LOG_ENTER(); + + // TODO this should be forwarded to SaiInterface object + + if (version) + { + *version = SAI_API_VERSION; + + // TODO FIXME implement proper query for syncd, currently this is not an issue since swss is not using this API + + SWSS_LOG_WARN("retruning SAI API version %d with saiproxy compiled SAI headers, not actual libsai.so", SAI_API_VERSION); + + return SAI_STATUS_SUCCESS; + } + + SWSS_LOG_ERROR("version parameter is NULL"); + + return SAI_STATUS_INVALID_PARAMETER; +} + //sai_switch_notifications_t Sai::handle_notification( // _In_ std::shared_ptr notification) //{ diff --git a/proxylib/Sai.h b/proxylib/Sai.h index b06df2f55..7f35f5092 100644 --- a/proxylib/Sai.h +++ b/proxylib/Sai.h @@ -174,6 +174,9 @@ namespace saiproxy _In_ sai_api_t api, _In_ sai_log_level_t log_level) override; + virtual sai_status_t queryApiVersion( + _Out_ sai_api_version_t *version) override; + private: sai_switch_notifications_t handle_notification( diff --git a/proxylib/sai_proxy_interfacequery.cpp b/proxylib/sai_proxy_interfacequery.cpp index 6a8d451d4..a92aa3c54 100644 --- a/proxylib/sai_proxy_interfacequery.cpp +++ b/proxylib/sai_proxy_interfacequery.cpp @@ -269,22 +269,7 @@ sai_status_t sai_query_api_version( { SWSS_LOG_ENTER(); - // TODO this should be forwarded to SaiInterface object - - if (version) - { - *version = SAI_API_VERSION; - - // TODO FIXME implement proper query for syncd, currently this is not an issue since swss is not using this API - - SWSS_LOG_WARN("retruning SAI API version %d with saiproxy compiled SAI headers, not actual libsai.so", SAI_API_VERSION); - - return SAI_STATUS_SUCCESS; - } - - SWSS_LOG_ERROR("version parameter is NULL"); - - return SAI_STATUS_INVALID_PARAMETER; + return proxy_sai->queryApiVersion(version); } sai_status_t sai_bulk_object_get_stats( diff --git a/syncd/VendorSai.cpp b/syncd/VendorSai.cpp index a0234aa7d..c90f00f9a 100644 --- a/syncd/VendorSai.cpp +++ b/syncd/VendorSai.cpp @@ -93,6 +93,23 @@ sai_status_t VendorSai::initialize( return SAI_STATUS_INVALID_PARAMETER; } + memcpy(&m_service_method_table, service_method_table, sizeof(m_service_method_table)); + + auto status = m_globalApis.api_initialize(flags, service_method_table); + + if (status == SAI_STATUS_SUCCESS) + { + memset(&m_apis, 0, sizeof(m_apis)); + + int failed = sai_metadata_apis_query(m_globalApis.api_query, &m_apis); + + if (failed > 0) + { + SWSS_LOG_NOTICE("sai_api_query failed for %d apis", failed); + } + + } + sai_api_version_t version{}; auto api_status = m_globalApis.query_api_version(&version); @@ -120,23 +137,7 @@ sai_status_t VendorSai::initialize( return SAI_STATUS_FAILURE; } - memcpy(&m_service_method_table, service_method_table, sizeof(m_service_method_table)); - - auto status = m_globalApis.api_initialize(flags, service_method_table); - - if (status == SAI_STATUS_SUCCESS) - { - memset(&m_apis, 0, sizeof(m_apis)); - - int failed = sai_metadata_apis_query(m_globalApis.api_query, &m_apis); - - if (failed > 0) - { - SWSS_LOG_NOTICE("sai_api_query failed for %d apis", failed); - } - - m_apiInitialized = true; - } + m_apiInitialized = true; return status; } @@ -1686,6 +1687,14 @@ sai_status_t VendorSai::logSet( return m_globalApis.log_set(api, log_level); } +sai_status_t VendorSai::queryApiVersion( + _Out_ sai_api_version_t *version) +{ + SWSS_LOG_ENTER(); + + return m_globalApis.query_api_version(version); +} + sai_log_level_t VendorSai::logGet( _In_ sai_api_t api) { diff --git a/syncd/VendorSai.h b/syncd/VendorSai.h index 7a6c4937f..00e659e2f 100644 --- a/syncd/VendorSai.h +++ b/syncd/VendorSai.h @@ -202,6 +202,9 @@ namespace syncd _In_ sai_api_t api, _In_ sai_log_level_t log_level) override; + virtual sai_status_t queryApiVersion( + _Out_ sai_api_version_t *version) override; + public: // extra API virtual sai_log_level_t logGet( diff --git a/unittest/lib/Makefile.am b/unittest/lib/Makefile.am index 1b6face4f..881795774 100644 --- a/unittest/lib/Makefile.am +++ b/unittest/lib/Makefile.am @@ -22,7 +22,8 @@ tests_SOURCES = \ TestServerConfig.cpp \ TestRedisVidIndexGenerator.cpp \ TestRecorder.cpp \ - TestRedisChannel.cpp + TestRedisChannel.cpp \ + TestSai.cpp tests_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) tests_LDADD = $(LDADD_GTEST) $(top_srcdir)/lib/libSaiRedis.a -lhiredis -lswsscommon -lpthread -L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta -lzmq $(CODE_COVERAGE_LIBS) diff --git a/unittest/lib/TestSai.cpp b/unittest/lib/TestSai.cpp new file mode 100644 index 000000000..53b30031f --- /dev/null +++ b/unittest/lib/TestSai.cpp @@ -0,0 +1,42 @@ +#include "Sai.h" + +#include + +#include + +using namespace sairedis; + +static const char* profile_get_value( + _In_ sai_switch_profile_id_t profile_id, + _In_ const char* variable) +{ + SWSS_LOG_ENTER(); + return NULL; +} + +static int profile_get_next_value( + _In_ sai_switch_profile_id_t profile_id, + _Out_ const char** variable, + _Out_ const char** value) +{ + SWSS_LOG_ENTER(); + return -1; +} + +static sai_service_method_table_t test_services = { + profile_get_value, + profile_get_next_value +}; + +TEST(Sai, queryApiVersion) +{ + Sai sai; + + sai_api_version_t version; + + sai.initialize(0,&test_services); + + EXPECT_EQ(sai.queryApiVersion(NULL), SAI_STATUS_INVALID_PARAMETER); + EXPECT_EQ(sai.queryApiVersion(&version), SAI_STATUS_SUCCESS); +} + diff --git a/unittest/meta/Makefile.am b/unittest/meta/Makefile.am index 4a53dac50..f88d6ea1f 100644 --- a/unittest/meta/Makefile.am +++ b/unittest/meta/Makefile.am @@ -15,6 +15,7 @@ tests_SOURCES = \ ../../lib/Channel.cpp \ MockMeta.cpp \ TestAttrKeyMap.cpp \ + TestDummySaiInterface.cpp \ TestGlobals.cpp \ TestMetaKeyHasher.cpp \ TestNotificationFactory.cpp \ diff --git a/unittest/meta/TestDummySaiInterface.cpp b/unittest/meta/TestDummySaiInterface.cpp new file mode 100644 index 000000000..9682b9e06 --- /dev/null +++ b/unittest/meta/TestDummySaiInterface.cpp @@ -0,0 +1,19 @@ +#include "DummySaiInterface.h" + +#include + +#include + +using namespace saimeta; + +TEST(DummySaiInterface, queryApiVersion) +{ + DummySaiInterface sai; + + sai.initialize(0,0); + + sai_api_version_t version; + + EXPECT_EQ(sai.queryApiVersion(NULL), SAI_STATUS_SUCCESS); + EXPECT_EQ(sai.queryApiVersion(&version), SAI_STATUS_SUCCESS); +} diff --git a/unittest/proxylib/TestSai.cpp b/unittest/proxylib/TestSai.cpp index 3cee8d413..bc7d26eb2 100644 --- a/unittest/proxylib/TestSai.cpp +++ b/unittest/proxylib/TestSai.cpp @@ -48,3 +48,13 @@ TEST_F(SaiTest, Ctr) { auto s = std::make_shared(); } + +TEST(Sai, queryApiVersion) +{ + Sai sai; + + sai_api_version_t version; + + EXPECT_EQ(sai.queryApiVersion(NULL), SAI_STATUS_INVALID_PARAMETER); + EXPECT_EQ(sai.queryApiVersion(&version), SAI_STATUS_SUCCESS); +} diff --git a/unittest/vslib/TestVirtualSwitchSaiInterface.cpp b/unittest/vslib/TestVirtualSwitchSaiInterface.cpp index 701b3d05e..f98e541b9 100644 --- a/unittest/vslib/TestVirtualSwitchSaiInterface.cpp +++ b/unittest/vslib/TestVirtualSwitchSaiInterface.cpp @@ -113,3 +113,11 @@ TEST_F(VirtualSwitchSaiInterfaceTest, portBulkAddRemove) ASSERT_EQ(statusList.at(i), SAI_STATUS_SUCCESS); } } + +TEST_F(VirtualSwitchSaiInterfaceTest, queryApiVersion) +{ + sai_api_version_t version; + + EXPECT_EQ(m_vssai->queryApiVersion(NULL), SAI_STATUS_INVALID_PARAMETER); + EXPECT_EQ(m_vssai->queryApiVersion(&version), SAI_STATUS_SUCCESS); +} diff --git a/vslib/Sai.cpp b/vslib/Sai.cpp index 98d0ed476..1c4847d87 100644 --- a/vslib/Sai.cpp +++ b/vslib/Sai.cpp @@ -807,6 +807,16 @@ sai_status_t Sai::logSet( return m_meta->logSet(api, log_level); } +sai_status_t Sai::queryApiVersion( + _Out_ sai_api_version_t *version) +{ + MUTEX(); + SWSS_LOG_ENTER(); + VS_CHECK_API_INITIALIZED(); + + return m_meta->queryApiVersion(version); +} + std::shared_ptr Sai::getContext( _In_ uint32_t globalContext) const { diff --git a/vslib/Sai.h b/vslib/Sai.h index 11075b6ae..d1670bebb 100644 --- a/vslib/Sai.h +++ b/vslib/Sai.h @@ -181,6 +181,9 @@ namespace saivs _In_ sai_api_t api, _In_ sai_log_level_t log_level) override; + virtual sai_status_t queryApiVersion( + _Out_ sai_api_version_t *version) override; + private: // QUAD pre sai_status_t preSet( diff --git a/vslib/VirtualSwitchSaiInterface.cpp b/vslib/VirtualSwitchSaiInterface.cpp index 050cb106e..d1cd4c78f 100644 --- a/vslib/VirtualSwitchSaiInterface.cpp +++ b/vslib/VirtualSwitchSaiInterface.cpp @@ -1230,6 +1230,23 @@ sai_status_t VirtualSwitchSaiInterface::logSet( return SAI_STATUS_SUCCESS; } +sai_status_t VirtualSwitchSaiInterface::queryApiVersion( + _Out_ sai_api_version_t *version) +{ + SWSS_LOG_ENTER(); + + if (version) + { + *version = SAI_API_VERSION; + + return SAI_STATUS_SUCCESS; + } + + SWSS_LOG_ERROR("version parameter is NULL"); + + return SAI_STATUS_INVALID_PARAMETER; +} + bool VirtualSwitchSaiInterface::writeWarmBootFile( _In_ const char* warmBootFile) const { diff --git a/vslib/VirtualSwitchSaiInterface.h b/vslib/VirtualSwitchSaiInterface.h index d868ee59d..db39b2258 100644 --- a/vslib/VirtualSwitchSaiInterface.h +++ b/vslib/VirtualSwitchSaiInterface.h @@ -180,6 +180,9 @@ namespace saivs _In_ sai_api_t api, _In_ sai_log_level_t log_level) override; + virtual sai_status_t queryApiVersion( + _Out_ sai_api_version_t *version) override; + private: // QUAD API helpers sai_status_t create( diff --git a/vslib/sai_vs_interfacequery.cpp b/vslib/sai_vs_interfacequery.cpp index f78d790f9..1651cb12c 100644 --- a/vslib/sai_vs_interfacequery.cpp +++ b/vslib/sai_vs_interfacequery.cpp @@ -213,8 +213,7 @@ sai_status_t sai_query_api_version( { SWSS_LOG_ENTER(); - *version = SAI_API_VERSION; - return SAI_STATUS_SUCCESS; + return vs_sai->queryApiVersion(version); } sai_status_t sai_bulk_object_get_stats( From 270fed7ec5bc76d18b2710c9d8456fee593b11b3 Mon Sep 17 00:00:00 2001 From: Kamil Cudnik Date: Wed, 29 May 2024 11:42:15 +0200 Subject: [PATCH 28/32] Clean up and refactor duplicated code and auto generate sai stub for libraries (#1384) Many refactoring changes include: created libsaistub as fronted replaced libsairedis replaced libsaivs replaced libsaiproxy // will be used in dashapp as proxy sai refactored unitests for new libsaistub remove a lot of duplicated code auto generate SAI stub for libraries fix api naming convention add missing bulkGet api update .gitignore api_version_query in VendorSai is alled after api initialize (since VS requires api to be initialized before returning version) --- .gitignore | 6 + Makefile.am | 2 +- lib/ClientSai.cpp | 48 +- lib/ClientSai.h | 15 +- lib/ClientServerSai.cpp | 48 +- lib/ClientServerSai.h | 15 +- lib/Context.cpp | 2 +- lib/Makefile.am | 73 +-- lib/Recorder.cpp | 4 +- lib/Recorder.h | 4 +- lib/RedisRemoteSaiInterface.cpp | 53 ++- lib/RedisRemoteSaiInterface.h | 17 +- lib/Sai.cpp | 50 +- lib/Sai.h | 15 +- lib/ServerSai.cpp | 52 +- lib/ServerSai.h | 15 +- lib/sai_redis.h | 450 ------------------ lib/sai_redis_acl.cpp | 20 - lib/sai_redis_ars.cpp | 7 - lib/sai_redis_ars_profile.cpp | 8 - lib/sai_redis_bfd.cpp | 10 - lib/sai_redis_bmtor.cpp | 18 - lib/sai_redis_bridge.cpp | 14 - lib/sai_redis_buffer.cpp | 16 - lib/sai_redis_counter.cpp | 10 - lib/sai_redis_dash_acl.cpp | 19 - lib/sai_redis_dash_direction_lookup.cpp | 11 - lib/sai_redis_dash_eni.cpp | 21 - lib/sai_redis_dash_inbound_routing.cpp | 11 - lib/sai_redis_dash_meter.cpp | 28 -- lib/sai_redis_dash_outbound_ca_to_pa.cpp | 11 - lib/sai_redis_dash_outbound_routing.cpp | 11 - lib/sai_redis_dash_pa_validation.cpp | 11 - lib/sai_redis_dash_vip.cpp | 11 - lib/sai_redis_dash_vnet.cpp | 11 - lib/sai_redis_debug_counter.cpp | 8 - lib/sai_redis_dtel.cpp | 16 - lib/sai_redis_fdb.cpp | 26 - lib/sai_redis_genericprogrammable.cpp | 7 - lib/sai_redis_hash.cpp | 9 - lib/sai_redis_hostif.cpp | 66 --- lib/sai_redis_interfacequery.cpp | 296 ------------ lib/sai_redis_ipmc.cpp | 8 - lib/sai_redis_ipmc_group.cpp | 10 - lib/sai_redis_ipsec.cpp | 16 - lib/sai_redis_isolation_group.cpp | 10 - lib/sai_redis_l2mc.cpp | 8 - lib/sai_redis_l2mcgroup.cpp | 10 - lib/sai_redis_lag.cpp | 16 - lib/sai_redis_macsec.cpp | 24 - lib/sai_redis_mcastfdb.cpp | 8 - lib/sai_redis_mirror.cpp | 8 - lib/sai_redis_mpls.cpp | 10 - lib/sai_redis_my_mac.cpp | 8 - lib/sai_redis_nat.cpp | 12 - lib/sai_redis_neighbor.cpp | 20 - lib/sai_redis_nexthop.cpp | 10 - lib/sai_redis_nexthopgroup.cpp | 21 - lib/sai_redis_poe.cpp | 12 - lib/sai_redis_policer.cpp | 10 - lib/sai_redis_port.cpp | 33 -- lib/sai_redis_qosmap.cpp | 8 - lib/sai_redis_queue.cpp | 10 - lib/sai_redis_route.cpp | 10 - lib/sai_redis_router_interface.cpp | 12 - lib/sai_redis_rpfgroup.cpp | 10 - lib/sai_redis_samplepacket.cpp | 8 - lib/sai_redis_scheduler.cpp | 8 - lib/sai_redis_schedulergroup.cpp | 8 - lib/sai_redis_srv6.cpp | 22 - lib/sai_redis_stp.cpp | 15 - lib/sai_redis_switch.cpp | 84 ---- lib/sai_redis_system_port.cpp | 8 - lib/sai_redis_tam.cpp | 42 -- lib/sai_redis_tunnel.cpp | 18 - lib/sai_redis_twamp.cpp | 9 - lib/sai_redis_udf.cpp | 12 - lib/sai_redis_virtual_router.cpp | 8 - lib/sai_redis_vlan.cpp | 18 - lib/sai_redis_wred.cpp | 8 - lib/tests.cpp | 4 +- meta/DummySaiInterface.cpp | 41 +- meta/DummySaiInterface.h | 15 +- meta/Meta.cpp | 45 +- meta/Meta.h | 15 +- meta/SaiInterface.h | 29 +- proxylib/Makefile.am | 73 +-- proxylib/Sai.cpp | 44 +- proxylib/Sai.h | 15 +- proxylib/sai_proxy_acl.cpp | 20 - proxylib/sai_proxy_ars.cpp | 7 - proxylib/sai_proxy_ars_profile.cpp | 8 - proxylib/sai_proxy_bfd.cpp | 10 - proxylib/sai_proxy_bmtor.cpp | 18 - proxylib/sai_proxy_bridge.cpp | 14 - proxylib/sai_proxy_buffer.cpp | 16 - proxylib/sai_proxy_counter.cpp | 10 - proxylib/sai_proxy_dash_acl.cpp | 19 - proxylib/sai_proxy_dash_direction_lookup.cpp | 11 - proxylib/sai_proxy_dash_eni.cpp | 21 - proxylib/sai_proxy_dash_inbound_routing.cpp | 11 - proxylib/sai_proxy_dash_meter.cpp | 28 -- proxylib/sai_proxy_dash_outbound_ca_to_pa.cpp | 11 - proxylib/sai_proxy_dash_outbound_routing.cpp | 11 - proxylib/sai_proxy_dash_pa_validation.cpp | 11 - proxylib/sai_proxy_dash_vip.cpp | 11 - proxylib/sai_proxy_dash_vnet.cpp | 11 - proxylib/sai_proxy_debug_counter.cpp | 8 - proxylib/sai_proxy_dtel.cpp | 16 - proxylib/sai_proxy_fdb.cpp | 26 - proxylib/sai_proxy_genericprogrammable.cpp | 7 - proxylib/sai_proxy_hash.cpp | 9 - proxylib/sai_proxy_hostif.cpp | 66 --- proxylib/sai_proxy_interfacequery.cpp | 308 ------------ proxylib/sai_proxy_ipmc.cpp | 8 - proxylib/sai_proxy_ipmc_group.cpp | 10 - proxylib/sai_proxy_ipsec.cpp | 16 - proxylib/sai_proxy_isolation_group.cpp | 10 - proxylib/sai_proxy_l2mc.cpp | 8 - proxylib/sai_proxy_l2mcgroup.cpp | 10 - proxylib/sai_proxy_lag.cpp | 16 - proxylib/sai_proxy_macsec.cpp | 24 - proxylib/sai_proxy_mcastfdb.cpp | 8 - proxylib/sai_proxy_mirror.cpp | 8 - proxylib/sai_proxy_mpls.cpp | 10 - proxylib/sai_proxy_my_mac.cpp | 8 - proxylib/sai_proxy_nat.cpp | 12 - proxylib/sai_proxy_neighbor.cpp | 20 - proxylib/sai_proxy_nexthop.cpp | 10 - proxylib/sai_proxy_nexthopgroup.cpp | 21 - proxylib/sai_proxy_poe.cpp | 12 - proxylib/sai_proxy_policer.cpp | 10 - proxylib/sai_proxy_port.cpp | 33 -- proxylib/sai_proxy_qosmap.cpp | 8 - proxylib/sai_proxy_queue.cpp | 10 - proxylib/sai_proxy_route.cpp | 10 - proxylib/sai_proxy_router_interface.cpp | 12 - proxylib/sai_proxy_rpfgroup.cpp | 10 - proxylib/sai_proxy_samplepacket.cpp | 8 - proxylib/sai_proxy_scheduler.cpp | 8 - proxylib/sai_proxy_schedulergroup.cpp | 8 - proxylib/sai_proxy_srv6.cpp | 22 - proxylib/sai_proxy_stp.cpp | 15 - proxylib/sai_proxy_switch.cpp | 84 ---- proxylib/sai_proxy_system_port.cpp | 8 - proxylib/sai_proxy_tam.cpp | 42 -- proxylib/sai_proxy_tunnel.cpp | 18 - proxylib/sai_proxy_twamp.cpp | 9 - proxylib/sai_proxy_udf.cpp | 12 - proxylib/sai_proxy_virtual_router.cpp | 8 - proxylib/sai_proxy_vlan.cpp | 18 - proxylib/sai_proxy_wred.cpp | 8 - saidiscovery/saidiscovery.cpp | 4 +- saiplayer/SaiPlayer.cpp | 4 +- stub.pl | 433 +++++++++++++++++ syncd/Syncd.cpp | 6 +- syncd/VendorSai.cpp | 45 +- syncd/VendorSai.h | 15 +- syncd/tests.cpp | 9 +- syncd/tests/TestSyncdBrcm.cpp | 4 +- syncd/tests/TestSyncdMlnx.cpp | 8 +- syncd/tests/TestSyncdNvdaBf.cpp | 4 +- tests/aspellcheck.pl | 1 + tests/checksaiapi.sh | 4 +- unittest/lib/Makefile.am | 71 +-- unittest/lib/TestClientSai.cpp | 52 ++ unittest/lib/TestClientServerSai.cpp | 48 +- unittest/lib/TestRedisRemoteSaiInterface.cpp | 30 ++ unittest/lib/TestSai.cpp | 22 +- unittest/lib/TestServerSai.cpp | 52 ++ unittest/lib/TestUtils.cpp | 2 +- unittest/lib/test_sai_redis_acl.cpp | 48 -- unittest/lib/test_sai_redis_ars.cpp | 23 - unittest/lib/test_sai_redis_ars_profile.cpp | 23 - unittest/lib/test_sai_redis_bfd.cpp | 27 -- unittest/lib/test_sai_redis_bmtor.cpp | 46 -- unittest/lib/test_sai_redis_bridge.cpp | 36 -- unittest/lib/test_sai_redis_buffer.cpp | 41 -- unittest/lib/test_sai_redis_counter.cpp | 27 -- unittest/lib/test_sai_redis_dash_acl.cpp | 33 -- .../test_sai_redis_dash_direction_lookup.cpp | 24 - unittest/lib/test_sai_redis_dash_eni.cpp | 36 -- .../test_sai_redis_dash_inbound_routing.cpp | 24 - .../test_sai_redis_dash_outbound_ca_to_pa.cpp | 24 - .../test_sai_redis_dash_outbound_routing.cpp | 24 - .../lib/test_sai_redis_dash_pa_validation.cpp | 24 - unittest/lib/test_sai_redis_dash_vip.cpp | 24 - unittest/lib/test_sai_redis_dash_vnet.cpp | 24 - unittest/lib/test_sai_redis_debug_counter.cpp | 23 - unittest/lib/test_sai_redis_dtel.cpp | 43 -- unittest/lib/test_sai_redis_fdb.cpp | 30 -- .../test_sai_redis_generic_programmable.cpp | 23 - unittest/lib/test_sai_redis_hash.cpp | 28 -- unittest/lib/test_sai_redis_hostif.cpp | 48 -- .../lib/test_sai_redis_interfacequery.cpp | 115 ----- unittest/lib/test_sai_redis_ipmc.cpp | 23 - unittest/lib/test_sai_redis_ipmc_group.cpp | 28 -- .../lib/test_sai_redis_isolation_group.cpp | 28 -- unittest/lib/test_sai_redis_l2mc.cpp | 23 - unittest/lib/test_sai_redis_l2mcgroup.cpp | 28 -- unittest/lib/test_sai_redis_lag.cpp | 31 -- unittest/lib/test_sai_redis_macsec.cpp | 59 --- unittest/lib/test_sai_redis_mcastfdb.cpp | 23 - unittest/lib/test_sai_redis_mirror.cpp | 23 - unittest/lib/test_sai_redis_mpls.cpp | 28 -- unittest/lib/test_sai_redis_nat.cpp | 35 -- unittest/lib/test_sai_redis_neighbor.cpp | 25 - unittest/lib/test_sai_redis_nexthop.cpp | 23 - unittest/lib/test_sai_redis_nexthopgroup.cpp | 36 -- unittest/lib/test_sai_redis_poe.cpp | 33 -- unittest/lib/test_sai_redis_policer.cpp | 27 -- unittest/lib/test_sai_redis_port.cpp | 48 -- unittest/lib/test_sai_redis_qosmap.cpp | 23 - unittest/lib/test_sai_redis_queue.cpp | 27 -- unittest/lib/test_sai_redis_route.cpp | 28 -- .../lib/test_sai_redis_router_interface.cpp | 27 -- .../lib/test_sai_redis_router_rpfgroup.cpp | 28 -- .../test_sai_redis_router_samplepacket.cpp | 23 - unittest/lib/test_sai_redis_scheduler.cpp | 23 - .../lib/test_sai_redis_schedulergroup.cpp | 23 - unittest/lib/test_sai_redis_srv6.cpp | 36 -- unittest/lib/test_sai_redis_stp.cpp | 31 -- unittest/lib/test_sai_redis_switch.cpp | 35 -- unittest/lib/test_sai_redis_system_port.cpp | 23 - unittest/lib/test_sai_redis_tam.cpp | 85 ---- unittest/lib/test_sai_redis_tunnel.cpp | 49 -- unittest/lib/test_sai_redis_udf.cpp | 33 -- .../lib/test_sai_redis_virtual_router.cpp | 23 - unittest/lib/test_sai_redis_vlan.cpp | 35 -- unittest/lib/test_sai_redis_wred.cpp | 23 - unittest/meta/TestDummySaiInterface.cpp | 24 +- unittest/meta/TestMeta.cpp | 34 +- unittest/proxylib/Makefile.am | 68 +-- unittest/proxylib/TestSai.cpp | 21 + unittest/proxylib/test_sai_proxy_acl.cpp | 48 -- unittest/proxylib/test_sai_proxy_ars.cpp | 23 - .../proxylib/test_sai_proxy_ars_profile.cpp | 23 - unittest/proxylib/test_sai_proxy_bfd.cpp | 27 -- unittest/proxylib/test_sai_proxy_bmtor.cpp | 46 -- unittest/proxylib/test_sai_proxy_bridge.cpp | 36 -- unittest/proxylib/test_sai_proxy_buffer.cpp | 41 -- unittest/proxylib/test_sai_proxy_counter.cpp | 27 -- unittest/proxylib/test_sai_proxy_dash_acl.cpp | 33 -- .../test_sai_proxy_dash_direction_lookup.cpp | 24 - unittest/proxylib/test_sai_proxy_dash_eni.cpp | 33 -- .../test_sai_proxy_dash_inbound_routing.cpp | 24 - .../test_sai_proxy_dash_outbound_ca_to_pa.cpp | 24 - .../test_sai_proxy_dash_outbound_routing.cpp | 24 - .../test_sai_proxy_dash_pa_validation.cpp | 24 - unittest/proxylib/test_sai_proxy_dash_vip.cpp | 24 - .../proxylib/test_sai_proxy_dash_vnet.cpp | 24 - .../proxylib/test_sai_proxy_debug_counter.cpp | 23 - unittest/proxylib/test_sai_proxy_dtel.cpp | 43 -- unittest/proxylib/test_sai_proxy_fdb.cpp | 30 -- .../test_sai_proxy_generic_programmable.cpp | 23 - unittest/proxylib/test_sai_proxy_hash.cpp | 28 -- unittest/proxylib/test_sai_proxy_hostif.cpp | 48 -- .../test_sai_proxy_interfacequery.cpp | 115 ----- unittest/proxylib/test_sai_proxy_ipmc.cpp | 23 - .../proxylib/test_sai_proxy_ipmc_group.cpp | 28 -- .../test_sai_proxy_isolation_group.cpp | 28 -- unittest/proxylib/test_sai_proxy_l2mc.cpp | 23 - .../proxylib/test_sai_proxy_l2mcgroup.cpp | 28 -- unittest/proxylib/test_sai_proxy_lag.cpp | 31 -- unittest/proxylib/test_sai_proxy_macsec.cpp | 59 --- unittest/proxylib/test_sai_proxy_mcastfdb.cpp | 23 - unittest/proxylib/test_sai_proxy_mirror.cpp | 23 - unittest/proxylib/test_sai_proxy_mpls.cpp | 28 -- unittest/proxylib/test_sai_proxy_nat.cpp | 35 -- unittest/proxylib/test_sai_proxy_neighbor.cpp | 25 - unittest/proxylib/test_sai_proxy_nexthop.cpp | 23 - .../proxylib/test_sai_proxy_nexthopgroup.cpp | 36 -- unittest/proxylib/test_sai_proxy_poe.cpp | 33 -- unittest/proxylib/test_sai_proxy_policer.cpp | 27 -- unittest/proxylib/test_sai_proxy_port.cpp | 48 -- unittest/proxylib/test_sai_proxy_qosmap.cpp | 23 - unittest/proxylib/test_sai_proxy_queue.cpp | 27 -- unittest/proxylib/test_sai_proxy_route.cpp | 28 -- .../test_sai_proxy_router_interface.cpp | 27 -- .../test_sai_proxy_router_rpfgroup.cpp | 28 -- .../test_sai_proxy_router_samplepacket.cpp | 23 - .../proxylib/test_sai_proxy_scheduler.cpp | 23 - .../test_sai_proxy_schedulergroup.cpp | 23 - unittest/proxylib/test_sai_proxy_srv6.cpp | 36 -- unittest/proxylib/test_sai_proxy_stp.cpp | 31 -- unittest/proxylib/test_sai_proxy_switch.cpp | 35 -- .../proxylib/test_sai_proxy_system_port.cpp | 23 - unittest/proxylib/test_sai_proxy_tam.cpp | 85 ---- unittest/proxylib/test_sai_proxy_tunnel.cpp | 49 -- unittest/proxylib/test_sai_proxy_udf.cpp | 33 -- .../test_sai_proxy_virtual_router.cpp | 23 - unittest/proxylib/test_sai_proxy_vlan.cpp | 35 -- unittest/proxylib/test_sai_proxy_wred.cpp | 23 - unittest/syncd/MockableSaiInterface.cpp | 26 +- unittest/syncd/MockableSaiInterface.h | 18 +- unittest/syncd/TestVendorSai.cpp | 71 ++- unittest/syncd/TestVirtualOidTranslator.cpp | 4 +- unittest/vslib/Makefile.am | 69 +-- unittest/vslib/TestSai.cpp | 28 ++ unittest/vslib/TestSaiUnittests.cpp | 10 +- .../vslib/TestVirtualSwitchSaiInterface.cpp | 19 + unittest/vslib/test_sai_vs_acl.cpp | 48 -- unittest/vslib/test_sai_vs_ars.cpp | 23 - unittest/vslib/test_sai_vs_ars_profile.cpp | 23 - unittest/vslib/test_sai_vs_bfd.cpp | 27 -- unittest/vslib/test_sai_vs_bmtor.cpp | 46 -- unittest/vslib/test_sai_vs_bridge.cpp | 36 -- unittest/vslib/test_sai_vs_buffer.cpp | 41 -- unittest/vslib/test_sai_vs_counter.cpp | 27 -- unittest/vslib/test_sai_vs_dash_acl.cpp | 33 -- .../test_sai_vs_dash_direction_lookup.cpp | 24 - unittest/vslib/test_sai_vs_dash_eni.cpp | 36 -- .../test_sai_vs_dash_inbound_routing.cpp | 24 - .../test_sai_vs_dash_outbound_ca_to_pa.cpp | 24 - .../test_sai_vs_dash_outbound_routing.cpp | 24 - .../vslib/test_sai_vs_dash_pa_validation.cpp | 24 - unittest/vslib/test_sai_vs_dash_vip.cpp | 24 - unittest/vslib/test_sai_vs_dash_vnet.cpp | 24 - unittest/vslib/test_sai_vs_debug_counter.cpp | 23 - unittest/vslib/test_sai_vs_dtel.cpp | 43 -- unittest/vslib/test_sai_vs_fdb.cpp | 30 -- .../test_sai_vs_generic_programmable.cpp | 23 - unittest/vslib/test_sai_vs_hash.cpp | 28 -- unittest/vslib/test_sai_vs_hostif.cpp | 48 -- unittest/vslib/test_sai_vs_interfacequery.cpp | 82 ---- unittest/vslib/test_sai_vs_ipmc.cpp | 23 - unittest/vslib/test_sai_vs_ipmc_group.cpp | 28 -- .../vslib/test_sai_vs_isolation_group.cpp | 28 -- unittest/vslib/test_sai_vs_l2mc.cpp | 23 - unittest/vslib/test_sai_vs_l2mcgroup.cpp | 28 -- unittest/vslib/test_sai_vs_lag.cpp | 31 -- unittest/vslib/test_sai_vs_macsec.cpp | 59 --- unittest/vslib/test_sai_vs_mcastfdb.cpp | 23 - unittest/vslib/test_sai_vs_mirror.cpp | 23 - unittest/vslib/test_sai_vs_mpls.cpp | 28 -- unittest/vslib/test_sai_vs_nat.cpp | 35 -- unittest/vslib/test_sai_vs_neighbor.cpp | 25 - unittest/vslib/test_sai_vs_nexthop.cpp | 23 - unittest/vslib/test_sai_vs_nexthopgroup.cpp | 37 -- unittest/vslib/test_sai_vs_poe.cpp | 33 -- unittest/vslib/test_sai_vs_policer.cpp | 27 -- unittest/vslib/test_sai_vs_port.cpp | 53 --- unittest/vslib/test_sai_vs_qosmap.cpp | 23 - unittest/vslib/test_sai_vs_queue.cpp | 27 -- unittest/vslib/test_sai_vs_route.cpp | 28 -- .../vslib/test_sai_vs_router_interface.cpp | 27 -- .../vslib/test_sai_vs_router_rpfgroup.cpp | 28 -- .../vslib/test_sai_vs_router_samplepacket.cpp | 23 - unittest/vslib/test_sai_vs_scheduler.cpp | 23 - unittest/vslib/test_sai_vs_schedulergroup.cpp | 23 - unittest/vslib/test_sai_vs_srv6.cpp | 36 -- unittest/vslib/test_sai_vs_stp.cpp | 31 -- unittest/vslib/test_sai_vs_switch.cpp | 35 -- unittest/vslib/test_sai_vs_system_port.cpp | 23 - unittest/vslib/test_sai_vs_tam.cpp | 85 ---- unittest/vslib/test_sai_vs_tunnel.cpp | 49 -- unittest/vslib/test_sai_vs_udf.cpp | 33 -- unittest/vslib/test_sai_vs_virtual_router.cpp | 23 - unittest/vslib/test_sai_vs_vlan.cpp | 35 -- unittest/vslib/test_sai_vs_wred.cpp | 23 - vslib/Makefile.am | 73 +-- vslib/Sai.cpp | 46 +- vslib/Sai.h | 15 +- vslib/VirtualSwitchSaiInterface.cpp | 40 +- vslib/VirtualSwitchSaiInterface.h | 15 +- vslib/sai_vs.h | 450 ------------------ vslib/sai_vs_acl.cpp | 20 - vslib/sai_vs_ars.cpp | 7 - vslib/sai_vs_ars_profile.cpp | 7 - vslib/sai_vs_bfd.cpp | 10 - vslib/sai_vs_bmtor.cpp | 17 - vslib/sai_vs_bridge.cpp | 14 - vslib/sai_vs_buffer.cpp | 16 - vslib/sai_vs_counter.cpp | 11 - vslib/sai_vs_dash_acl.cpp | 19 - vslib/sai_vs_dash_direction_lookup.cpp | 11 - vslib/sai_vs_dash_eni.cpp | 21 - vslib/sai_vs_dash_inbound_routing.cpp | 11 - vslib/sai_vs_dash_meter.cpp | 28 -- vslib/sai_vs_dash_outbound_ca_to_pa.cpp | 11 - vslib/sai_vs_dash_outbound_routing.cpp | 11 - vslib/sai_vs_dash_pa_validation.cpp | 11 - vslib/sai_vs_dash_vip.cpp | 11 - vslib/sai_vs_dash_vnet.cpp | 11 - vslib/sai_vs_debug_counter.cpp | 7 - vslib/sai_vs_dtel.cpp | 16 - vslib/sai_vs_fdb.cpp | 26 - vslib/sai_vs_genericprogrammable.cpp | 7 - vslib/sai_vs_hash.cpp | 9 - vslib/sai_vs_hostif.cpp | 66 --- vslib/sai_vs_interfacequery.cpp | 248 ---------- vslib/sai_vs_ipmc.cpp | 8 - vslib/sai_vs_ipmc_group.cpp | 10 - vslib/sai_vs_ipsec.cpp | 16 - vslib/sai_vs_isolation_group.cpp | 11 - vslib/sai_vs_l2mc.cpp | 8 - vslib/sai_vs_l2mcgroup.cpp | 10 - vslib/sai_vs_lag.cpp | 16 - vslib/sai_vs_macsec.cpp | 32 -- vslib/sai_vs_mcastfdb.cpp | 8 - vslib/sai_vs_mirror.cpp | 8 - vslib/sai_vs_mpls.cpp | 10 - vslib/sai_vs_my_mac.cpp | 8 - vslib/sai_vs_nat.cpp | 15 - vslib/sai_vs_neighbor.cpp | 21 - vslib/sai_vs_nexthop.cpp | 10 - vslib/sai_vs_nexthopgroup.cpp | 22 - vslib/sai_vs_poe.cpp | 12 - vslib/sai_vs_policer.cpp | 10 - vslib/sai_vs_port.cpp | 35 -- vslib/sai_vs_qosmap.cpp | 8 - vslib/sai_vs_queue.cpp | 10 - vslib/sai_vs_route.cpp | 11 - vslib/sai_vs_router_interface.cpp | 12 - vslib/sai_vs_rpfgroup.cpp | 10 - vslib/sai_vs_samplepacket.cpp | 8 - vslib/sai_vs_scheduler.cpp | 8 - vslib/sai_vs_schedulergroup.cpp | 8 - vslib/sai_vs_srv6.cpp | 24 - vslib/sai_vs_stp.cpp | 16 - vslib/sai_vs_switch.cpp | 84 ---- vslib/sai_vs_system_port.cpp | 8 - vslib/sai_vs_tam.cpp | 43 -- vslib/sai_vs_tunnel.cpp | 18 - vslib/sai_vs_twamp.cpp | 9 - vslib/sai_vs_udf.cpp | 12 - vslib/sai_vs_virtual_router.cpp | 8 - vslib/sai_vs_vlan.cpp | 19 - vslib/sai_vs_wred.cpp | 8 - 429 files changed, 1518 insertions(+), 10917 deletions(-) delete mode 100644 lib/sai_redis.h delete mode 100644 lib/sai_redis_acl.cpp delete mode 100644 lib/sai_redis_ars.cpp delete mode 100644 lib/sai_redis_ars_profile.cpp delete mode 100644 lib/sai_redis_bfd.cpp delete mode 100644 lib/sai_redis_bmtor.cpp delete mode 100644 lib/sai_redis_bridge.cpp delete mode 100644 lib/sai_redis_buffer.cpp delete mode 100644 lib/sai_redis_counter.cpp delete mode 100644 lib/sai_redis_dash_acl.cpp delete mode 100644 lib/sai_redis_dash_direction_lookup.cpp delete mode 100644 lib/sai_redis_dash_eni.cpp delete mode 100644 lib/sai_redis_dash_inbound_routing.cpp delete mode 100644 lib/sai_redis_dash_meter.cpp delete mode 100644 lib/sai_redis_dash_outbound_ca_to_pa.cpp delete mode 100644 lib/sai_redis_dash_outbound_routing.cpp delete mode 100644 lib/sai_redis_dash_pa_validation.cpp delete mode 100644 lib/sai_redis_dash_vip.cpp delete mode 100644 lib/sai_redis_dash_vnet.cpp delete mode 100644 lib/sai_redis_debug_counter.cpp delete mode 100644 lib/sai_redis_dtel.cpp delete mode 100644 lib/sai_redis_fdb.cpp delete mode 100644 lib/sai_redis_genericprogrammable.cpp delete mode 100644 lib/sai_redis_hash.cpp delete mode 100644 lib/sai_redis_hostif.cpp delete mode 100644 lib/sai_redis_interfacequery.cpp delete mode 100644 lib/sai_redis_ipmc.cpp delete mode 100644 lib/sai_redis_ipmc_group.cpp delete mode 100644 lib/sai_redis_ipsec.cpp delete mode 100644 lib/sai_redis_isolation_group.cpp delete mode 100644 lib/sai_redis_l2mc.cpp delete mode 100644 lib/sai_redis_l2mcgroup.cpp delete mode 100644 lib/sai_redis_lag.cpp delete mode 100644 lib/sai_redis_macsec.cpp delete mode 100644 lib/sai_redis_mcastfdb.cpp delete mode 100644 lib/sai_redis_mirror.cpp delete mode 100644 lib/sai_redis_mpls.cpp delete mode 100644 lib/sai_redis_my_mac.cpp delete mode 100644 lib/sai_redis_nat.cpp delete mode 100644 lib/sai_redis_neighbor.cpp delete mode 100644 lib/sai_redis_nexthop.cpp delete mode 100644 lib/sai_redis_nexthopgroup.cpp delete mode 100644 lib/sai_redis_poe.cpp delete mode 100644 lib/sai_redis_policer.cpp delete mode 100644 lib/sai_redis_port.cpp delete mode 100644 lib/sai_redis_qosmap.cpp delete mode 100644 lib/sai_redis_queue.cpp delete mode 100644 lib/sai_redis_route.cpp delete mode 100644 lib/sai_redis_router_interface.cpp delete mode 100644 lib/sai_redis_rpfgroup.cpp delete mode 100644 lib/sai_redis_samplepacket.cpp delete mode 100644 lib/sai_redis_scheduler.cpp delete mode 100644 lib/sai_redis_schedulergroup.cpp delete mode 100644 lib/sai_redis_srv6.cpp delete mode 100644 lib/sai_redis_stp.cpp delete mode 100644 lib/sai_redis_switch.cpp delete mode 100644 lib/sai_redis_system_port.cpp delete mode 100644 lib/sai_redis_tam.cpp delete mode 100644 lib/sai_redis_tunnel.cpp delete mode 100644 lib/sai_redis_twamp.cpp delete mode 100644 lib/sai_redis_udf.cpp delete mode 100644 lib/sai_redis_virtual_router.cpp delete mode 100644 lib/sai_redis_vlan.cpp delete mode 100644 lib/sai_redis_wred.cpp delete mode 100644 proxylib/sai_proxy_acl.cpp delete mode 100644 proxylib/sai_proxy_ars.cpp delete mode 100644 proxylib/sai_proxy_ars_profile.cpp delete mode 100644 proxylib/sai_proxy_bfd.cpp delete mode 100644 proxylib/sai_proxy_bmtor.cpp delete mode 100644 proxylib/sai_proxy_bridge.cpp delete mode 100644 proxylib/sai_proxy_buffer.cpp delete mode 100644 proxylib/sai_proxy_counter.cpp delete mode 100644 proxylib/sai_proxy_dash_acl.cpp delete mode 100644 proxylib/sai_proxy_dash_direction_lookup.cpp delete mode 100644 proxylib/sai_proxy_dash_eni.cpp delete mode 100644 proxylib/sai_proxy_dash_inbound_routing.cpp delete mode 100644 proxylib/sai_proxy_dash_meter.cpp delete mode 100644 proxylib/sai_proxy_dash_outbound_ca_to_pa.cpp delete mode 100644 proxylib/sai_proxy_dash_outbound_routing.cpp delete mode 100644 proxylib/sai_proxy_dash_pa_validation.cpp delete mode 100644 proxylib/sai_proxy_dash_vip.cpp delete mode 100644 proxylib/sai_proxy_dash_vnet.cpp delete mode 100644 proxylib/sai_proxy_debug_counter.cpp delete mode 100644 proxylib/sai_proxy_dtel.cpp delete mode 100644 proxylib/sai_proxy_fdb.cpp delete mode 100644 proxylib/sai_proxy_genericprogrammable.cpp delete mode 100644 proxylib/sai_proxy_hash.cpp delete mode 100644 proxylib/sai_proxy_hostif.cpp delete mode 100644 proxylib/sai_proxy_interfacequery.cpp delete mode 100644 proxylib/sai_proxy_ipmc.cpp delete mode 100644 proxylib/sai_proxy_ipmc_group.cpp delete mode 100644 proxylib/sai_proxy_ipsec.cpp delete mode 100644 proxylib/sai_proxy_isolation_group.cpp delete mode 100644 proxylib/sai_proxy_l2mc.cpp delete mode 100644 proxylib/sai_proxy_l2mcgroup.cpp delete mode 100644 proxylib/sai_proxy_lag.cpp delete mode 100644 proxylib/sai_proxy_macsec.cpp delete mode 100644 proxylib/sai_proxy_mcastfdb.cpp delete mode 100644 proxylib/sai_proxy_mirror.cpp delete mode 100644 proxylib/sai_proxy_mpls.cpp delete mode 100644 proxylib/sai_proxy_my_mac.cpp delete mode 100644 proxylib/sai_proxy_nat.cpp delete mode 100644 proxylib/sai_proxy_neighbor.cpp delete mode 100644 proxylib/sai_proxy_nexthop.cpp delete mode 100644 proxylib/sai_proxy_nexthopgroup.cpp delete mode 100644 proxylib/sai_proxy_poe.cpp delete mode 100644 proxylib/sai_proxy_policer.cpp delete mode 100644 proxylib/sai_proxy_port.cpp delete mode 100644 proxylib/sai_proxy_qosmap.cpp delete mode 100644 proxylib/sai_proxy_queue.cpp delete mode 100644 proxylib/sai_proxy_route.cpp delete mode 100644 proxylib/sai_proxy_router_interface.cpp delete mode 100644 proxylib/sai_proxy_rpfgroup.cpp delete mode 100644 proxylib/sai_proxy_samplepacket.cpp delete mode 100644 proxylib/sai_proxy_scheduler.cpp delete mode 100644 proxylib/sai_proxy_schedulergroup.cpp delete mode 100644 proxylib/sai_proxy_srv6.cpp delete mode 100644 proxylib/sai_proxy_stp.cpp delete mode 100644 proxylib/sai_proxy_switch.cpp delete mode 100644 proxylib/sai_proxy_system_port.cpp delete mode 100644 proxylib/sai_proxy_tam.cpp delete mode 100644 proxylib/sai_proxy_tunnel.cpp delete mode 100644 proxylib/sai_proxy_twamp.cpp delete mode 100644 proxylib/sai_proxy_udf.cpp delete mode 100644 proxylib/sai_proxy_virtual_router.cpp delete mode 100644 proxylib/sai_proxy_vlan.cpp delete mode 100644 proxylib/sai_proxy_wred.cpp create mode 100755 stub.pl create mode 100644 unittest/lib/TestClientSai.cpp create mode 100644 unittest/lib/TestRedisRemoteSaiInterface.cpp create mode 100644 unittest/lib/TestServerSai.cpp delete mode 100644 unittest/lib/test_sai_redis_acl.cpp delete mode 100644 unittest/lib/test_sai_redis_ars.cpp delete mode 100644 unittest/lib/test_sai_redis_ars_profile.cpp delete mode 100644 unittest/lib/test_sai_redis_bfd.cpp delete mode 100644 unittest/lib/test_sai_redis_bmtor.cpp delete mode 100644 unittest/lib/test_sai_redis_bridge.cpp delete mode 100644 unittest/lib/test_sai_redis_buffer.cpp delete mode 100644 unittest/lib/test_sai_redis_counter.cpp delete mode 100644 unittest/lib/test_sai_redis_dash_acl.cpp delete mode 100644 unittest/lib/test_sai_redis_dash_direction_lookup.cpp delete mode 100644 unittest/lib/test_sai_redis_dash_eni.cpp delete mode 100644 unittest/lib/test_sai_redis_dash_inbound_routing.cpp delete mode 100644 unittest/lib/test_sai_redis_dash_outbound_ca_to_pa.cpp delete mode 100644 unittest/lib/test_sai_redis_dash_outbound_routing.cpp delete mode 100644 unittest/lib/test_sai_redis_dash_pa_validation.cpp delete mode 100644 unittest/lib/test_sai_redis_dash_vip.cpp delete mode 100644 unittest/lib/test_sai_redis_dash_vnet.cpp delete mode 100644 unittest/lib/test_sai_redis_debug_counter.cpp delete mode 100644 unittest/lib/test_sai_redis_dtel.cpp delete mode 100644 unittest/lib/test_sai_redis_fdb.cpp delete mode 100644 unittest/lib/test_sai_redis_generic_programmable.cpp delete mode 100644 unittest/lib/test_sai_redis_hash.cpp delete mode 100644 unittest/lib/test_sai_redis_hostif.cpp delete mode 100644 unittest/lib/test_sai_redis_interfacequery.cpp delete mode 100644 unittest/lib/test_sai_redis_ipmc.cpp delete mode 100644 unittest/lib/test_sai_redis_ipmc_group.cpp delete mode 100644 unittest/lib/test_sai_redis_isolation_group.cpp delete mode 100644 unittest/lib/test_sai_redis_l2mc.cpp delete mode 100644 unittest/lib/test_sai_redis_l2mcgroup.cpp delete mode 100644 unittest/lib/test_sai_redis_lag.cpp delete mode 100644 unittest/lib/test_sai_redis_macsec.cpp delete mode 100644 unittest/lib/test_sai_redis_mcastfdb.cpp delete mode 100644 unittest/lib/test_sai_redis_mirror.cpp delete mode 100644 unittest/lib/test_sai_redis_mpls.cpp delete mode 100644 unittest/lib/test_sai_redis_nat.cpp delete mode 100644 unittest/lib/test_sai_redis_neighbor.cpp delete mode 100644 unittest/lib/test_sai_redis_nexthop.cpp delete mode 100644 unittest/lib/test_sai_redis_nexthopgroup.cpp delete mode 100644 unittest/lib/test_sai_redis_poe.cpp delete mode 100644 unittest/lib/test_sai_redis_policer.cpp delete mode 100644 unittest/lib/test_sai_redis_port.cpp delete mode 100644 unittest/lib/test_sai_redis_qosmap.cpp delete mode 100644 unittest/lib/test_sai_redis_queue.cpp delete mode 100644 unittest/lib/test_sai_redis_route.cpp delete mode 100644 unittest/lib/test_sai_redis_router_interface.cpp delete mode 100644 unittest/lib/test_sai_redis_router_rpfgroup.cpp delete mode 100644 unittest/lib/test_sai_redis_router_samplepacket.cpp delete mode 100644 unittest/lib/test_sai_redis_scheduler.cpp delete mode 100644 unittest/lib/test_sai_redis_schedulergroup.cpp delete mode 100644 unittest/lib/test_sai_redis_srv6.cpp delete mode 100644 unittest/lib/test_sai_redis_stp.cpp delete mode 100644 unittest/lib/test_sai_redis_switch.cpp delete mode 100644 unittest/lib/test_sai_redis_system_port.cpp delete mode 100644 unittest/lib/test_sai_redis_tam.cpp delete mode 100644 unittest/lib/test_sai_redis_tunnel.cpp delete mode 100644 unittest/lib/test_sai_redis_udf.cpp delete mode 100644 unittest/lib/test_sai_redis_virtual_router.cpp delete mode 100644 unittest/lib/test_sai_redis_vlan.cpp delete mode 100644 unittest/lib/test_sai_redis_wred.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_acl.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_ars.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_ars_profile.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_bfd.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_bmtor.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_bridge.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_buffer.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_counter.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_dash_acl.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_dash_direction_lookup.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_dash_eni.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_dash_inbound_routing.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_dash_outbound_ca_to_pa.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_dash_outbound_routing.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_dash_pa_validation.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_dash_vip.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_dash_vnet.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_debug_counter.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_dtel.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_fdb.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_generic_programmable.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_hash.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_hostif.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_interfacequery.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_ipmc.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_ipmc_group.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_isolation_group.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_l2mc.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_l2mcgroup.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_lag.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_macsec.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_mcastfdb.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_mirror.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_mpls.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_nat.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_neighbor.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_nexthop.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_nexthopgroup.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_poe.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_policer.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_port.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_qosmap.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_queue.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_route.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_router_interface.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_router_rpfgroup.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_router_samplepacket.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_scheduler.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_schedulergroup.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_srv6.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_stp.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_switch.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_system_port.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_tam.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_tunnel.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_udf.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_virtual_router.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_vlan.cpp delete mode 100644 unittest/proxylib/test_sai_proxy_wred.cpp create mode 100644 unittest/vslib/TestSai.cpp delete mode 100644 unittest/vslib/test_sai_vs_acl.cpp delete mode 100644 unittest/vslib/test_sai_vs_ars.cpp delete mode 100644 unittest/vslib/test_sai_vs_ars_profile.cpp delete mode 100644 unittest/vslib/test_sai_vs_bfd.cpp delete mode 100644 unittest/vslib/test_sai_vs_bmtor.cpp delete mode 100644 unittest/vslib/test_sai_vs_bridge.cpp delete mode 100644 unittest/vslib/test_sai_vs_buffer.cpp delete mode 100644 unittest/vslib/test_sai_vs_counter.cpp delete mode 100644 unittest/vslib/test_sai_vs_dash_acl.cpp delete mode 100644 unittest/vslib/test_sai_vs_dash_direction_lookup.cpp delete mode 100644 unittest/vslib/test_sai_vs_dash_eni.cpp delete mode 100644 unittest/vslib/test_sai_vs_dash_inbound_routing.cpp delete mode 100644 unittest/vslib/test_sai_vs_dash_outbound_ca_to_pa.cpp delete mode 100644 unittest/vslib/test_sai_vs_dash_outbound_routing.cpp delete mode 100644 unittest/vslib/test_sai_vs_dash_pa_validation.cpp delete mode 100644 unittest/vslib/test_sai_vs_dash_vip.cpp delete mode 100644 unittest/vslib/test_sai_vs_dash_vnet.cpp delete mode 100644 unittest/vslib/test_sai_vs_debug_counter.cpp delete mode 100644 unittest/vslib/test_sai_vs_dtel.cpp delete mode 100644 unittest/vslib/test_sai_vs_fdb.cpp delete mode 100644 unittest/vslib/test_sai_vs_generic_programmable.cpp delete mode 100644 unittest/vslib/test_sai_vs_hash.cpp delete mode 100644 unittest/vslib/test_sai_vs_hostif.cpp delete mode 100644 unittest/vslib/test_sai_vs_interfacequery.cpp delete mode 100644 unittest/vslib/test_sai_vs_ipmc.cpp delete mode 100644 unittest/vslib/test_sai_vs_ipmc_group.cpp delete mode 100644 unittest/vslib/test_sai_vs_isolation_group.cpp delete mode 100644 unittest/vslib/test_sai_vs_l2mc.cpp delete mode 100644 unittest/vslib/test_sai_vs_l2mcgroup.cpp delete mode 100644 unittest/vslib/test_sai_vs_lag.cpp delete mode 100644 unittest/vslib/test_sai_vs_macsec.cpp delete mode 100644 unittest/vslib/test_sai_vs_mcastfdb.cpp delete mode 100644 unittest/vslib/test_sai_vs_mirror.cpp delete mode 100644 unittest/vslib/test_sai_vs_mpls.cpp delete mode 100644 unittest/vslib/test_sai_vs_nat.cpp delete mode 100644 unittest/vslib/test_sai_vs_neighbor.cpp delete mode 100644 unittest/vslib/test_sai_vs_nexthop.cpp delete mode 100644 unittest/vslib/test_sai_vs_nexthopgroup.cpp delete mode 100644 unittest/vslib/test_sai_vs_poe.cpp delete mode 100644 unittest/vslib/test_sai_vs_policer.cpp delete mode 100644 unittest/vslib/test_sai_vs_port.cpp delete mode 100644 unittest/vslib/test_sai_vs_qosmap.cpp delete mode 100644 unittest/vslib/test_sai_vs_queue.cpp delete mode 100644 unittest/vslib/test_sai_vs_route.cpp delete mode 100644 unittest/vslib/test_sai_vs_router_interface.cpp delete mode 100644 unittest/vslib/test_sai_vs_router_rpfgroup.cpp delete mode 100644 unittest/vslib/test_sai_vs_router_samplepacket.cpp delete mode 100644 unittest/vslib/test_sai_vs_scheduler.cpp delete mode 100644 unittest/vslib/test_sai_vs_schedulergroup.cpp delete mode 100644 unittest/vslib/test_sai_vs_srv6.cpp delete mode 100644 unittest/vslib/test_sai_vs_stp.cpp delete mode 100644 unittest/vslib/test_sai_vs_switch.cpp delete mode 100644 unittest/vslib/test_sai_vs_system_port.cpp delete mode 100644 unittest/vslib/test_sai_vs_tam.cpp delete mode 100644 unittest/vslib/test_sai_vs_tunnel.cpp delete mode 100644 unittest/vslib/test_sai_vs_udf.cpp delete mode 100644 unittest/vslib/test_sai_vs_virtual_router.cpp delete mode 100644 unittest/vslib/test_sai_vs_vlan.cpp delete mode 100644 unittest/vslib/test_sai_vs_wred.cpp delete mode 100644 vslib/sai_vs.h delete mode 100644 vslib/sai_vs_acl.cpp delete mode 100644 vslib/sai_vs_ars.cpp delete mode 100644 vslib/sai_vs_ars_profile.cpp delete mode 100644 vslib/sai_vs_bfd.cpp delete mode 100644 vslib/sai_vs_bmtor.cpp delete mode 100644 vslib/sai_vs_bridge.cpp delete mode 100644 vslib/sai_vs_buffer.cpp delete mode 100644 vslib/sai_vs_counter.cpp delete mode 100644 vslib/sai_vs_dash_acl.cpp delete mode 100644 vslib/sai_vs_dash_direction_lookup.cpp delete mode 100644 vslib/sai_vs_dash_eni.cpp delete mode 100644 vslib/sai_vs_dash_inbound_routing.cpp delete mode 100644 vslib/sai_vs_dash_meter.cpp delete mode 100644 vslib/sai_vs_dash_outbound_ca_to_pa.cpp delete mode 100644 vslib/sai_vs_dash_outbound_routing.cpp delete mode 100644 vslib/sai_vs_dash_pa_validation.cpp delete mode 100644 vslib/sai_vs_dash_vip.cpp delete mode 100644 vslib/sai_vs_dash_vnet.cpp delete mode 100644 vslib/sai_vs_debug_counter.cpp delete mode 100644 vslib/sai_vs_dtel.cpp delete mode 100644 vslib/sai_vs_fdb.cpp delete mode 100644 vslib/sai_vs_genericprogrammable.cpp delete mode 100644 vslib/sai_vs_hash.cpp delete mode 100644 vslib/sai_vs_hostif.cpp delete mode 100644 vslib/sai_vs_interfacequery.cpp delete mode 100644 vslib/sai_vs_ipmc.cpp delete mode 100644 vslib/sai_vs_ipmc_group.cpp delete mode 100644 vslib/sai_vs_ipsec.cpp delete mode 100644 vslib/sai_vs_isolation_group.cpp delete mode 100644 vslib/sai_vs_l2mc.cpp delete mode 100644 vslib/sai_vs_l2mcgroup.cpp delete mode 100644 vslib/sai_vs_lag.cpp delete mode 100644 vslib/sai_vs_macsec.cpp delete mode 100644 vslib/sai_vs_mcastfdb.cpp delete mode 100644 vslib/sai_vs_mirror.cpp delete mode 100644 vslib/sai_vs_mpls.cpp delete mode 100644 vslib/sai_vs_my_mac.cpp delete mode 100644 vslib/sai_vs_nat.cpp delete mode 100644 vslib/sai_vs_neighbor.cpp delete mode 100644 vslib/sai_vs_nexthop.cpp delete mode 100644 vslib/sai_vs_nexthopgroup.cpp delete mode 100644 vslib/sai_vs_poe.cpp delete mode 100644 vslib/sai_vs_policer.cpp delete mode 100644 vslib/sai_vs_port.cpp delete mode 100644 vslib/sai_vs_qosmap.cpp delete mode 100644 vslib/sai_vs_queue.cpp delete mode 100644 vslib/sai_vs_route.cpp delete mode 100644 vslib/sai_vs_router_interface.cpp delete mode 100644 vslib/sai_vs_rpfgroup.cpp delete mode 100644 vslib/sai_vs_samplepacket.cpp delete mode 100644 vslib/sai_vs_scheduler.cpp delete mode 100644 vslib/sai_vs_schedulergroup.cpp delete mode 100644 vslib/sai_vs_srv6.cpp delete mode 100644 vslib/sai_vs_stp.cpp delete mode 100644 vslib/sai_vs_switch.cpp delete mode 100644 vslib/sai_vs_system_port.cpp delete mode 100644 vslib/sai_vs_tam.cpp delete mode 100644 vslib/sai_vs_tunnel.cpp delete mode 100644 vslib/sai_vs_twamp.cpp delete mode 100644 vslib/sai_vs_udf.cpp delete mode 100644 vslib/sai_vs_virtual_router.cpp delete mode 100644 vslib/sai_vs_vlan.cpp delete mode 100644 vslib/sai_vs_wred.cpp diff --git a/.gitignore b/.gitignore index 8c8bd913d..8c96ced02 100644 --- a/.gitignore +++ b/.gitignore @@ -59,6 +59,10 @@ stamp-h1 python/build/ python/setup.py +lib/sai_redis.cpp +vslib/sai_vs.cpp +proxylib/sai_proxy.cpp + # Test Files # ############## meta/test-suite.log @@ -115,6 +119,8 @@ unittest/vslib/testslibsaivs unittest/proxylib/tests unittest/proxylib/testslibsaiproxy vslib/tests +stub/tests +unittest/stub/stub/testslibsaistub # Temporary files # ################### diff --git a/Makefile.am b/Makefile.am index 618545716..6661ff163 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = meta lib vslib pyext proxylib +SUBDIRS = meta lib vslib proxylib pyext if SYNCD SUBDIRS += syncd saiplayer saidump saidiscovery saisdkdump saiasiccmp tests unittest diff --git a/lib/ClientSai.cpp b/lib/ClientSai.cpp index 17c8f54cb..74e09a3a8 100644 --- a/lib/ClientSai.cpp +++ b/lib/ClientSai.cpp @@ -46,11 +46,11 @@ ClientSai::~ClientSai() if (m_apiInitialized) { - uninitialize(); + apiUninitialize(); } } -sai_status_t ClientSai::initialize( +sai_status_t ClientSai::apiInitialize( _In_ uint64_t flags, _In_ const sai_service_method_table_t *service_method_table) { @@ -91,7 +91,7 @@ sai_status_t ClientSai::initialize( return SAI_STATUS_SUCCESS; } -sai_status_t ClientSai::uninitialize(void) +sai_status_t ClientSai::apiUninitialize(void) { SWSS_LOG_ENTER(); REDIS_CHECK_API_INITIALIZED(); @@ -433,6 +433,26 @@ sai_status_t ClientSai::bulkSet( SAIREDIS_DECLARE_EVERY_BULK_ENTRY(DECLARE_BULK_SET_ENTRY) +// BULK GET + +#define DECLARE_BULK_GET_ENTRY(OT,ot) \ +sai_status_t ClientSai::bulkGet( \ + _In_ uint32_t object_count, \ + _In_ const sai_ ## ot ## _t *ot, \ + _In_ const uint32_t *attr_count, \ + _Inout_ sai_attribute_t **attr_list, \ + _In_ sai_bulk_op_error_mode_t mode, \ + _Out_ sai_status_t *object_statuses) \ +{ \ + MUTEX(); \ + SWSS_LOG_ENTER(); \ + REDIS_CHECK_API_INITIALIZED(); \ + SWSS_LOG_ERROR("FIXME not implemented"); \ + return SAI_STATUS_NOT_IMPLEMENTED; \ +} + +SAIREDIS_DECLARE_EVERY_BULK_ENTRY(DECLARE_BULK_GET_ENTRY) + // QUAD API HELPERS sai_status_t ClientSai::create( @@ -814,7 +834,7 @@ sai_status_t ClientSai::waitForQueryAttributeCapabilityResponse( // QUERY ATTRIBUTE ENUM CAPABILITY -sai_status_t ClientSai::queryAattributeEnumValuesCapability( +sai_status_t ClientSai::queryAttributeEnumValuesCapability( _In_ sai_object_id_t switchId, _In_ sai_object_type_t objectType, _In_ sai_attr_id_t attrId, @@ -1337,6 +1357,26 @@ sai_status_t ClientSai::bulkSet( return waitForBulkResponse(SAI_COMMON_API_BULK_SET, (uint32_t)serialized_object_ids.size(), object_statuses); } +// BULK GET + +sai_status_t ClientSai::bulkGet( + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_id_t *object_id, + _In_ const uint32_t *attr_count, + _Inout_ sai_attribute_t **attr_list, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses) +{ + MUTEX(); + SWSS_LOG_ENTER(); + REDIS_CHECK_API_INITIALIZED(); + + SWSS_LOG_ERROR("not implemented, FIXME"); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + // BULK RESPONSE HELPERS sai_status_t ClientSai::waitForBulkResponse( diff --git a/lib/ClientSai.h b/lib/ClientSai.h index ab4516876..cbe6a3204 100644 --- a/lib/ClientSai.h +++ b/lib/ClientSai.h @@ -26,11 +26,11 @@ namespace sairedis public: - sai_status_t initialize( + sai_status_t apiInitialize( _In_ uint64_t flags, _In_ const sai_service_method_table_t *service_method_table) override; - sai_status_t uninitialize(void) override; + sai_status_t apiUninitialize(void) override; public: // SAI interface overrides @@ -88,6 +88,15 @@ namespace sairedis _In_ sai_bulk_op_error_mode_t mode, _Out_ sai_status_t *object_statuses) override; + virtual sai_status_t bulkGet( + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_id_t *object_id, + _In_ const uint32_t *attr_count, + _Inout_ sai_attribute_t **attr_list, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses) override; + public: // stats API virtual sai_status_t getStats( @@ -159,7 +168,7 @@ namespace sairedis _In_ sai_attr_id_t attr_id, _Out_ sai_attr_capability_t *capability) override; - virtual sai_status_t queryAattributeEnumValuesCapability( + virtual sai_status_t queryAttributeEnumValuesCapability( _In_ sai_object_id_t switch_id, _In_ sai_object_type_t object_type, _In_ sai_attr_id_t attr_id, diff --git a/lib/ClientServerSai.cpp b/lib/ClientServerSai.cpp index cc01a15d2..e3a9f808e 100644 --- a/lib/ClientServerSai.cpp +++ b/lib/ClientServerSai.cpp @@ -29,13 +29,13 @@ ClientServerSai::~ClientServerSai() if (m_apiInitialized) { - uninitialize(); + apiUninitialize(); } } // INITIALIZE UNINITIALIZE -sai_status_t ClientServerSai::initialize( +sai_status_t ClientServerSai::apiInitialize( _In_ uint64_t flags, _In_ const sai_service_method_table_t *service_method_table) { @@ -82,7 +82,7 @@ sai_status_t ClientServerSai::initialize( m_sai = std::make_shared(); } - auto status = m_sai->initialize(flags, service_method_table); + auto status = m_sai->apiInitialize(flags, service_method_table); SWSS_LOG_NOTICE("init client/server sai: %s", sai_serialize_status(status).c_str()); @@ -94,7 +94,7 @@ sai_status_t ClientServerSai::initialize( return status; } -sai_status_t ClientServerSai::uninitialize(void) +sai_status_t ClientServerSai::apiUninitialize(void) { SWSS_LOG_ENTER(); REDIS_CHECK_API_INITIALIZED(); @@ -414,6 +414,22 @@ sai_status_t ClientServerSai::bulkSet( object_statuses); } +sai_status_t ClientServerSai::bulkGet( + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_id_t *object_id, + _In_ const uint32_t *attr_count, + _Inout_ sai_attribute_t **attr_list, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses) +{ + SWSS_LOG_ENTER(); + + SWSS_LOG_ERROR("not implemented, FIXME"); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + // BULK QUAD ENTRY #define DECLARE_BULK_CREATE_ENTRY(OT,ot) \ @@ -483,6 +499,26 @@ sai_status_t ClientServerSai::bulkSet( \ SAIREDIS_DECLARE_EVERY_BULK_ENTRY(DECLARE_BULK_SET_ENTRY); +// BULK GET + +#define DECLARE_BULK_GET_ENTRY(OT,ot) \ +sai_status_t ClientServerSai::bulkGet( \ + _In_ uint32_t object_count, \ + _In_ const sai_ ## ot ## _t *ot, \ + _In_ const uint32_t *attr_count, \ + _Inout_ sai_attribute_t **attr_list, \ + _In_ sai_bulk_op_error_mode_t mode, \ + _Out_ sai_status_t *object_statuses) \ +{ \ + MUTEX(); \ + SWSS_LOG_ENTER(); \ + REDIS_CHECK_API_INITIALIZED(); \ + SWSS_LOG_ERROR("FIXME not implemented"); \ + return SAI_STATUS_NOT_IMPLEMENTED; \ +} + +SAIREDIS_DECLARE_EVERY_BULK_ENTRY(DECLARE_BULK_GET_ENTRY); + // NON QUAD API sai_status_t ClientServerSai::flushFdbEntries( @@ -535,7 +571,7 @@ sai_status_t ClientServerSai::queryAttributeCapability( capability); } -sai_status_t ClientServerSai::queryAattributeEnumValuesCapability( +sai_status_t ClientServerSai::queryAttributeEnumValuesCapability( _In_ sai_object_id_t switch_id, _In_ sai_object_type_t object_type, _In_ sai_attr_id_t attr_id, @@ -545,7 +581,7 @@ sai_status_t ClientServerSai::queryAattributeEnumValuesCapability( SWSS_LOG_ENTER(); REDIS_CHECK_API_INITIALIZED(); - return m_sai->queryAattributeEnumValuesCapability( + return m_sai->queryAttributeEnumValuesCapability( switch_id, object_type, attr_id, diff --git a/lib/ClientServerSai.h b/lib/ClientServerSai.h index 502f91dfa..a9163252d 100644 --- a/lib/ClientServerSai.h +++ b/lib/ClientServerSai.h @@ -18,11 +18,11 @@ namespace sairedis public: - sai_status_t initialize( + sai_status_t apiInitialize( _In_ uint64_t flags, _In_ const sai_service_method_table_t *service_method_table) override; - sai_status_t uninitialize(void) override; + sai_status_t apiUninitialize(void) override; public: // SAI interface overrides @@ -80,6 +80,15 @@ namespace sairedis _In_ sai_bulk_op_error_mode_t mode, _Out_ sai_status_t *object_statuses) override; + virtual sai_status_t bulkGet( + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_id_t *object_id, + _In_ const uint32_t *attr_count, + _Inout_ sai_attribute_t **attr_list, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses) override; + public: // stats API virtual sai_status_t getStats( @@ -151,7 +160,7 @@ namespace sairedis _In_ sai_attr_id_t attr_id, _Out_ sai_attr_capability_t *capability) override; - virtual sai_status_t queryAattributeEnumValuesCapability( + virtual sai_status_t queryAttributeEnumValuesCapability( _In_ sai_object_id_t switch_id, _In_ sai_object_type_t object_type, _In_ sai_attr_id_t attr_id, diff --git a/lib/Context.cpp b/lib/Context.cpp index a5cecf528..a03b3bed7 100644 --- a/lib/Context.cpp +++ b/lib/Context.cpp @@ -32,7 +32,7 @@ Context::~Context() { SWSS_LOG_ENTER(); - m_redisSai->uninitialize(); // will stop threads + m_redisSai->apiUninitialize(); // will stop threads m_redisSai = nullptr; diff --git a/lib/Makefile.am b/lib/Makefile.am index a441b519b..7b9e44a92 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -28,70 +28,15 @@ libSaiRedis_a_SOURCES = \ VirtualObjectIdManager.cpp \ ZeroMQChannel.cpp -libsairedis_la_SOURCES = \ - sai_redis_acl.cpp \ - sai_redis_bfd.cpp \ - sai_redis_bmtor.cpp \ - sai_redis_bridge.cpp \ - sai_redis_buffer.cpp \ - sai_redis_counter.cpp \ - sai_redis_dash_vip.cpp \ - sai_redis_dash_pa_validation.cpp \ - sai_redis_dash_vnet.cpp \ - sai_redis_dash_outbound_routing.cpp \ - sai_redis_dash_outbound_ca_to_pa.cpp \ - sai_redis_dash_inbound_routing.cpp \ - sai_redis_dash_eni.cpp \ - sai_redis_dash_direction_lookup.cpp \ - sai_redis_dash_acl.cpp \ - sai_redis_debug_counter.cpp \ - sai_redis_dtel.cpp \ - sai_redis_fdb.cpp \ - sai_redis_genericprogrammable.cpp \ - sai_redis_hash.cpp \ - sai_redis_hostif.cpp \ - sai_redis_interfacequery.cpp \ - sai_redis_ipmc.cpp \ - sai_redis_ipmc_group.cpp \ - sai_redis_isolation_group.cpp \ - sai_redis_l2mc.cpp \ - sai_redis_l2mcgroup.cpp \ - sai_redis_lag.cpp \ - sai_redis_macsec.cpp \ - sai_redis_mcastfdb.cpp \ - sai_redis_mirror.cpp \ - sai_redis_mpls.cpp \ - sai_redis_nat.cpp \ - sai_redis_neighbor.cpp \ - sai_redis_nexthop.cpp \ - sai_redis_nexthopgroup.cpp \ - sai_redis_policer.cpp \ - sai_redis_port.cpp \ - sai_redis_qosmap.cpp \ - sai_redis_queue.cpp \ - sai_redis_route.cpp \ - sai_redis_router_interface.cpp \ - sai_redis_rpfgroup.cpp \ - sai_redis_samplepacket.cpp \ - sai_redis_scheduler.cpp \ - sai_redis_schedulergroup.cpp \ - sai_redis_srv6.cpp \ - sai_redis_stp.cpp \ - sai_redis_switch.cpp \ - sai_redis_system_port.cpp \ - sai_redis_tam.cpp \ - sai_redis_tunnel.cpp \ - sai_redis_udf.cpp \ - sai_redis_virtual_router.cpp \ - sai_redis_vlan.cpp \ - sai_redis_wred.cpp \ - sai_redis_ipsec.cpp \ - sai_redis_my_mac.cpp \ - sai_redis_ars.cpp \ - sai_redis_ars_profile.cpp \ - sai_redis_twamp.cpp \ - sai_redis_poe.cpp \ - sai_redis_dash_meter.cpp +BUILT_SOURCES = sai_redis.cpp + +sai_redis.cpp: ../stub.pl $(top_srcdir)/SAI/meta/saimetadata.c + ../stub.pl -d ../SAI/ -c ClientServerSai -n sairedis -f sai_redis.cpp -s stub + +clean-local: + rm -f sai_redis.cpp + +libsairedis_la_SOURCES = sai_redis.cpp libSaiRedis_a_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS) libSaiRedis_a_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) $(CODE_COVERAGE_CXXFLAGS) diff --git a/lib/Recorder.cpp b/lib/Recorder.cpp index 32bc2d0d8..6c9ebd721 100644 --- a/lib/Recorder.cpp +++ b/lib/Recorder.cpp @@ -1016,7 +1016,7 @@ void Recorder::recordQueryAttributeCapabilityResponse( recordQueryAttributeCapabilityResponse(status, values); } -void Recorder::recordQueryAattributeEnumValuesCapability( +void Recorder::recordQueryAttributeEnumValuesCapability( _In_ sai_object_id_t switchId, _In_ sai_object_type_t objectType, _In_ sai_attr_id_t attrId, @@ -1053,7 +1053,7 @@ void Recorder::recordQueryAattributeEnumValuesCapability( recordQueryAttributeEnumValuesCapability(key, values); } -void Recorder::recordQueryAattributeEnumValuesCapabilityResponse( +void Recorder::recordQueryAttributeEnumValuesCapabilityResponse( _In_ sai_status_t status, _In_ sai_object_type_t objectType, _In_ sai_attr_id_t attrId, diff --git a/lib/Recorder.h b/lib/Recorder.h index ccda2bacb..920ee0c7f 100644 --- a/lib/Recorder.h +++ b/lib/Recorder.h @@ -341,13 +341,13 @@ namespace sairedis _In_ sai_attr_id_t attrId, _In_ const sai_attr_capability_t* capability); - void recordQueryAattributeEnumValuesCapability( + void recordQueryAttributeEnumValuesCapability( _In_ sai_object_id_t switch_id, _In_ sai_object_type_t object_type, _In_ sai_attr_id_t attr_id, _Inout_ sai_s32_list_t *enum_values_capability); - void recordQueryAattributeEnumValuesCapabilityResponse( + void recordQueryAttributeEnumValuesCapabilityResponse( _In_ sai_status_t status, _In_ sai_object_type_t objectType, _In_ sai_attr_id_t attrId, diff --git a/lib/RedisRemoteSaiInterface.cpp b/lib/RedisRemoteSaiInterface.cpp index 213be710c..1c846fe5a 100644 --- a/lib/RedisRemoteSaiInterface.cpp +++ b/lib/RedisRemoteSaiInterface.cpp @@ -43,7 +43,7 @@ RedisRemoteSaiInterface::RedisRemoteSaiInterface( m_initialized = false; - initialize(0, nullptr); + apiInitialize(0, nullptr); } RedisRemoteSaiInterface::~RedisRemoteSaiInterface() @@ -52,11 +52,11 @@ RedisRemoteSaiInterface::~RedisRemoteSaiInterface() if (m_initialized) { - uninitialize(); + apiUninitialize(); } } -sai_status_t RedisRemoteSaiInterface::initialize( +sai_status_t RedisRemoteSaiInterface::apiInitialize( _In_ uint64_t flags, _In_ const sai_service_method_table_t *service_method_table) { @@ -109,7 +109,7 @@ sai_status_t RedisRemoteSaiInterface::initialize( return SAI_STATUS_SUCCESS; } -sai_status_t RedisRemoteSaiInterface::uninitialize(void) +sai_status_t RedisRemoteSaiInterface::apiUninitialize(void) { SWSS_LOG_ENTER(); @@ -778,6 +778,25 @@ sai_status_t RedisRemoteSaiInterface::bulkSet( SAIREDIS_DECLARE_EVERY_BULK_ENTRY(DECLARE_BULK_SET_ENTRY); +// BULK GET + +#define DECLARE_BULK_GET_ENTRY(OT,ot) \ +sai_status_t RedisRemoteSaiInterface::bulkGet( \ + _In_ uint32_t object_count, \ + _In_ const sai_ ## ot ## _t *ot, \ + _In_ const uint32_t *attr_count, \ + _Inout_ sai_attribute_t **attr_list, \ + _In_ sai_bulk_op_error_mode_t mode, \ + _Out_ sai_status_t *object_statuses) \ +{ \ + SWSS_LOG_ENTER(); \ + SWSS_LOG_ERROR("FIXME not implemented"); \ + return SAI_STATUS_NOT_IMPLEMENTED; \ +} + +SAIREDIS_DECLARE_EVERY_BULK_ENTRY(DECLARE_BULK_GET_ENTRY); + + sai_status_t RedisRemoteSaiInterface::create( _In_ sai_object_type_t object_type, _In_ const std::string& serializedObjectId, @@ -1182,7 +1201,7 @@ sai_status_t RedisRemoteSaiInterface::waitForQueryAttributeCapabilityResponse( return status; } -sai_status_t RedisRemoteSaiInterface::queryAattributeEnumValuesCapability( +sai_status_t RedisRemoteSaiInterface::queryAttributeEnumValuesCapability( _In_ sai_object_id_t switchId, _In_ sai_object_type_t objectType, _In_ sai_attr_id_t attrId, @@ -1229,18 +1248,18 @@ sai_status_t RedisRemoteSaiInterface::queryAattributeEnumValuesCapability( // This query will not put any data into the ASIC view, just into the // message queue - m_recorder->recordQueryAattributeEnumValuesCapability(switchId, objectType, attrId, enumValuesCapability); + m_recorder->recordQueryAttributeEnumValuesCapability(switchId, objectType, attrId, enumValuesCapability); m_communicationChannel->set(switch_id_str, entry, REDIS_ASIC_STATE_COMMAND_ATTR_ENUM_VALUES_CAPABILITY_QUERY); - auto status = waitForQueryAattributeEnumValuesCapabilityResponse(enumValuesCapability); + auto status = waitForQueryAttributeEnumValuesCapabilityResponse(enumValuesCapability); - m_recorder->recordQueryAattributeEnumValuesCapabilityResponse(status, objectType, attrId, enumValuesCapability); + m_recorder->recordQueryAttributeEnumValuesCapabilityResponse(status, objectType, attrId, enumValuesCapability); return status; } -sai_status_t RedisRemoteSaiInterface::waitForQueryAattributeEnumValuesCapabilityResponse( +sai_status_t RedisRemoteSaiInterface::waitForQueryAttributeEnumValuesCapabilityResponse( _Inout_ sai_s32_list_t* enumValuesCapability) { SWSS_LOG_ENTER(); @@ -1635,6 +1654,22 @@ sai_status_t RedisRemoteSaiInterface::bulkSet( return waitForBulkResponse(SAI_COMMON_API_BULK_SET, (uint32_t)serialized_object_ids.size(), object_statuses); } +sai_status_t RedisRemoteSaiInterface::bulkGet( + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_id_t *object_id, + _In_ const uint32_t *attr_count, + _Inout_ sai_attribute_t **attr_list, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses) +{ + SWSS_LOG_ENTER(); + + SWSS_LOG_ERROR("not implemented, FIXME"); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + sai_status_t RedisRemoteSaiInterface::bulkCreate( _In_ sai_object_type_t object_type, _In_ sai_object_id_t switch_id, diff --git a/lib/RedisRemoteSaiInterface.h b/lib/RedisRemoteSaiInterface.h index b124bc52a..aa8c136cd 100644 --- a/lib/RedisRemoteSaiInterface.h +++ b/lib/RedisRemoteSaiInterface.h @@ -37,11 +37,11 @@ namespace sairedis public: - virtual sai_status_t initialize( + virtual sai_status_t apiInitialize( _In_ uint64_t flags, _In_ const sai_service_method_table_t *service_method_table) override; - virtual sai_status_t uninitialize(void) override; + virtual sai_status_t apiUninitialize(void) override; public: // SAI interface overrides @@ -99,6 +99,15 @@ namespace sairedis _In_ sai_bulk_op_error_mode_t mode, _Out_ sai_status_t *object_statuses) override; + virtual sai_status_t bulkGet( + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_id_t *object_id, + _In_ const uint32_t *attr_count, + _Inout_ sai_attribute_t **attr_list, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses) override; + public: // stats API virtual sai_status_t getStats( @@ -170,7 +179,7 @@ namespace sairedis _In_ sai_attr_id_t attr_id, _Out_ sai_attr_capability_t *capability) override; - virtual sai_status_t queryAattributeEnumValuesCapability( + virtual sai_status_t queryAttributeEnumValuesCapability( _In_ sai_object_id_t switch_id, _In_ sai_object_type_t object_type, _In_ sai_attr_id_t attr_id, @@ -322,7 +331,7 @@ namespace sairedis sai_status_t waitForQueryAttributeCapabilityResponse( _Out_ sai_attr_capability_t* capability); - sai_status_t waitForQueryAattributeEnumValuesCapabilityResponse( + sai_status_t waitForQueryAttributeEnumValuesCapabilityResponse( _Inout_ sai_s32_list_t* enumValuesCapability); sai_status_t waitForObjectTypeGetAvailabilityResponse( diff --git a/lib/Sai.cpp b/lib/Sai.cpp index c817d1574..6e45c2bf6 100644 --- a/lib/Sai.cpp +++ b/lib/Sai.cpp @@ -43,13 +43,13 @@ Sai::~Sai() if (m_apiInitialized) { - uninitialize(); + apiUninitialize(); } } // INITIALIZE UNINITIALIZE -sai_status_t Sai::initialize( +sai_status_t Sai::apiInitialize( _In_ uint64_t flags, _In_ const sai_service_method_table_t *service_method_table) { @@ -99,7 +99,7 @@ sai_status_t Sai::initialize( return SAI_STATUS_SUCCESS; } -sai_status_t Sai::uninitialize(void) +sai_status_t Sai::apiUninitialize(void) { SWSS_LOG_ENTER(); REDIS_CHECK_API_INITIALIZED(); @@ -503,6 +503,22 @@ sai_status_t Sai::bulkSet( object_statuses); } +sai_status_t Sai::bulkGet( + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_id_t *object_id, + _In_ const uint32_t *attr_count, + _Inout_ sai_attribute_t **attr_list, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses) +{ + SWSS_LOG_ENTER(); + + SWSS_LOG_ERROR("not implemented, FIXME"); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + // BULK QUAD ENTRY #define DECLARE_BULK_CREATE_ENTRY(OT,ot) \ @@ -578,6 +594,30 @@ sai_status_t Sai::bulkSet( \ SAIREDIS_DECLARE_EVERY_BULK_ENTRY(DECLARE_BULK_SET_ENTRY); +// BULK GET + +#define DECLARE_BULK_GET_ENTRY(OT,ot) \ +sai_status_t Sai::bulkGet( \ + _In_ uint32_t object_count, \ + _In_ const sai_ ## ot ## _t *ot, \ + _In_ const uint32_t *attr_count, \ + _Inout_ sai_attribute_t **attr_list, \ + _In_ sai_bulk_op_error_mode_t mode, \ + _Out_ sai_status_t *object_statuses) \ +{ \ + MUTEX(); \ + SWSS_LOG_ENTER(); \ + REDIS_CHECK_API_INITIALIZED(); \ + REDIS_CHECK_POINTER(ot); \ + REDIS_CHECK_POINTER(attr_count); \ + REDIS_CHECK_POINTER(attr_list); \ + REDIS_CHECK_POINTER(object_statuses); \ + SWSS_LOG_ERROR("FIXME not implemented"); \ + return SAI_STATUS_NOT_IMPLEMENTED; \ +} + +SAIREDIS_DECLARE_EVERY_BULK_ENTRY(DECLARE_BULK_GET_ENTRY); + // NON QUAD API sai_status_t Sai::flushFdbEntries( @@ -636,7 +676,7 @@ sai_status_t Sai::queryAttributeCapability( capability); } -sai_status_t Sai::queryAattributeEnumValuesCapability( +sai_status_t Sai::queryAttributeEnumValuesCapability( _In_ sai_object_id_t switch_id, _In_ sai_object_type_t object_type, _In_ sai_attr_id_t attr_id, @@ -647,7 +687,7 @@ sai_status_t Sai::queryAattributeEnumValuesCapability( REDIS_CHECK_API_INITIALIZED(); REDIS_CHECK_CONTEXT(switch_id); - return context->m_meta->queryAattributeEnumValuesCapability( + return context->m_meta->queryAttributeEnumValuesCapability( switch_id, object_type, attr_id, diff --git a/lib/Sai.h b/lib/Sai.h index 6fe04ebc0..1b45c11e0 100644 --- a/lib/Sai.h +++ b/lib/Sai.h @@ -27,11 +27,11 @@ namespace sairedis public: - sai_status_t initialize( + sai_status_t apiInitialize( _In_ uint64_t flags, _In_ const sai_service_method_table_t *service_method_table) override; - sai_status_t uninitialize(void) override; + sai_status_t apiUninitialize(void) override; public: // SAI interface overrides @@ -89,6 +89,15 @@ namespace sairedis _In_ sai_bulk_op_error_mode_t mode, _Out_ sai_status_t *object_statuses) override; + virtual sai_status_t bulkGet( + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_id_t *object_id, + _In_ const uint32_t *attr_count, + _Inout_ sai_attribute_t **attr_list, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses) override; + public: // stats API virtual sai_status_t getStats( @@ -160,7 +169,7 @@ namespace sairedis _In_ sai_attr_id_t attr_id, _Out_ sai_attr_capability_t *capability) override; - virtual sai_status_t queryAattributeEnumValuesCapability( + virtual sai_status_t queryAttributeEnumValuesCapability( _In_ sai_object_id_t switch_id, _In_ sai_object_type_t object_type, _In_ sai_attr_id_t attr_id, diff --git a/lib/ServerSai.cpp b/lib/ServerSai.cpp index b53ccdf0e..6a8f5ad92 100644 --- a/lib/ServerSai.cpp +++ b/lib/ServerSai.cpp @@ -39,13 +39,13 @@ ServerSai::~ServerSai() if (m_apiInitialized) { - uninitialize(); + apiUninitialize(); } } // INITIALIZE UNINITIALIZE -sai_status_t ServerSai::initialize( +sai_status_t ServerSai::apiInitialize( _In_ uint64_t flags, _In_ const sai_service_method_table_t *service_method_table) { @@ -79,7 +79,7 @@ sai_status_t ServerSai::initialize( m_sai = std::make_shared(); // actual SAI to talk to syncd - auto status = m_sai->initialize(flags, service_method_table); + auto status = m_sai->apiInitialize(flags, service_method_table); SWSS_LOG_NOTICE("init client/server sai: %s", sai_serialize_status(status).c_str()); @@ -103,7 +103,7 @@ sai_status_t ServerSai::initialize( return status; } -sai_status_t ServerSai::uninitialize(void) +sai_status_t ServerSai::apiUninitialize(void) { SWSS_LOG_ENTER(); REDIS_CHECK_API_INITIALIZED(); @@ -434,6 +434,24 @@ sai_status_t ServerSai::bulkSet( object_statuses); } +sai_status_t ServerSai::bulkGet( + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_id_t *object_id, + _In_ const uint32_t *attr_count, + _Inout_ sai_attribute_t **attr_list, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses) +{ + MUTEX(); + SWSS_LOG_ENTER(); + REDIS_CHECK_API_INITIALIZED(); + + SWSS_LOG_ERROR("not implemented, FIXME"); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + // BULK QUAD ENTRY #define DECLARE_BULK_CREATE_ENTRY(OT,ot) \ @@ -503,6 +521,26 @@ sai_status_t ServerSai::bulkSet( \ SAIREDIS_DECLARE_EVERY_BULK_ENTRY(DECLARE_BULK_SET_ENTRY); +// BULK GET + +#define DECLARE_BULK_GET_ENTRY(OT,ot) \ +sai_status_t ServerSai::bulkGet( \ + _In_ uint32_t object_count, \ + _In_ const sai_ ## ot ## _t *ot, \ + _In_ const uint32_t *attr_count, \ + _Inout_ sai_attribute_t **attr_list, \ + _In_ sai_bulk_op_error_mode_t mode, \ + _Out_ sai_status_t *object_statuses) \ +{ \ + MUTEX(); \ + SWSS_LOG_ENTER(); \ + REDIS_CHECK_API_INITIALIZED(); \ + SWSS_LOG_ERROR("FIXME not implemented"); \ + return SAI_STATUS_NOT_IMPLEMENTED; \ +} + +SAIREDIS_DECLARE_EVERY_BULK_ENTRY(DECLARE_BULK_GET_ENTRY); + // NON QUAD API sai_status_t ServerSai::flushFdbEntries( @@ -555,7 +593,7 @@ sai_status_t ServerSai::queryAttributeCapability( capability); } -sai_status_t ServerSai::queryAattributeEnumValuesCapability( +sai_status_t ServerSai::queryAttributeEnumValuesCapability( _In_ sai_object_id_t switch_id, _In_ sai_object_type_t object_type, _In_ sai_attr_id_t attr_id, @@ -565,7 +603,7 @@ sai_status_t ServerSai::queryAattributeEnumValuesCapability( SWSS_LOG_ENTER(); REDIS_CHECK_API_INITIALIZED(); - return m_sai->queryAattributeEnumValuesCapability( + return m_sai->queryAttributeEnumValuesCapability( switch_id, object_type, attr_id, @@ -1959,7 +1997,7 @@ sai_status_t ServerSai::processAttrEnumValuesCapabilityQuery( enumCapList.count = list_size; enumCapList.list = enum_capabilities_list.data(); - sai_status_t status = m_sai->queryAattributeEnumValuesCapability(switchOid, objectType, attrId, &enumCapList); + sai_status_t status = m_sai->queryAttributeEnumValuesCapability(switchOid, objectType, attrId, &enumCapList); std::vector entry; diff --git a/lib/ServerSai.h b/lib/ServerSai.h index f6bfbf950..e0a17eab3 100644 --- a/lib/ServerSai.h +++ b/lib/ServerSai.h @@ -23,11 +23,11 @@ namespace sairedis public: - sai_status_t initialize( + sai_status_t apiInitialize( _In_ uint64_t flags, _In_ const sai_service_method_table_t *service_method_table) override; - sai_status_t uninitialize(void) override; + sai_status_t apiUninitialize(void) override; public: // SAI interface overrides @@ -85,6 +85,15 @@ namespace sairedis _In_ sai_bulk_op_error_mode_t mode, _Out_ sai_status_t *object_statuses) override; + virtual sai_status_t bulkGet( + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_id_t *object_id, + _In_ const uint32_t *attr_count, + _Inout_ sai_attribute_t **attr_list, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses) override; + public: // stats API virtual sai_status_t getStats( @@ -156,7 +165,7 @@ namespace sairedis _In_ sai_attr_id_t attr_id, _Out_ sai_attr_capability_t *capability) override; - virtual sai_status_t queryAattributeEnumValuesCapability( + virtual sai_status_t queryAttributeEnumValuesCapability( _In_ sai_object_id_t switch_id, _In_ sai_object_type_t object_type, _In_ sai_attr_id_t attr_id, diff --git a/lib/sai_redis.h b/lib/sai_redis.h deleted file mode 100644 index c0d93c304..000000000 --- a/lib/sai_redis.h +++ /dev/null @@ -1,450 +0,0 @@ -#pragma once - -extern "C" { -#include "sai.h" -#include "saiextensions.h" -} - -#include "meta/SaiInterface.h" - -#include "swss/logger.h" - -#include - -#define PRIVATE __attribute__((visibility("hidden"))) - -PRIVATE extern const sai_acl_api_t redis_acl_api; -PRIVATE extern const sai_ars_api_t redis_ars_api; -PRIVATE extern const sai_ars_profile_api_t redis_ars_profile_api; -PRIVATE extern const sai_bfd_api_t redis_bfd_api; -PRIVATE extern const sai_bmtor_api_t redis_bmtor_api; -PRIVATE extern const sai_generic_programmable_api_t redis_generic_programmable_api; -PRIVATE extern const sai_bridge_api_t redis_bridge_api; -PRIVATE extern const sai_buffer_api_t redis_buffer_api; -PRIVATE extern const sai_counter_api_t redis_counter_api; -PRIVATE extern const sai_dash_vip_api_t redis_dash_vip_api; -PRIVATE extern const sai_dash_pa_validation_api_t redis_dash_pa_validation_api; -PRIVATE extern const sai_dash_vnet_api_t redis_dash_vnet_api; -PRIVATE extern const sai_dash_outbound_routing_api_t redis_dash_outbound_routing_api; -PRIVATE extern const sai_dash_outbound_ca_to_pa_api_t redis_dash_outbound_ca_to_pa_api; -PRIVATE extern const sai_dash_inbound_routing_api_t redis_dash_inbound_routing_api; -PRIVATE extern const sai_dash_eni_api_t redis_dash_eni_api; -PRIVATE extern const sai_dash_direction_lookup_api_t redis_dash_direction_lookup_api; -PRIVATE extern const sai_dash_acl_api_t redis_dash_acl_api; -PRIVATE extern const sai_debug_counter_api_t redis_debug_counter_api; -PRIVATE extern const sai_dtel_api_t redis_dtel_api; -PRIVATE extern const sai_fdb_api_t redis_fdb_api; -PRIVATE extern const sai_hash_api_t redis_hash_api; -PRIVATE extern const sai_hostif_api_t redis_hostif_api; -PRIVATE extern const sai_ipmc_api_t redis_ipmc_api; -PRIVATE extern const sai_ipmc_group_api_t redis_ipmc_group_api; -PRIVATE extern const sai_isolation_group_api_t redis_isolation_group_api; -PRIVATE extern const sai_l2mc_api_t redis_l2mc_api; -PRIVATE extern const sai_l2mc_group_api_t redis_l2mc_group_api; -PRIVATE extern const sai_lag_api_t redis_lag_api; -PRIVATE extern const sai_macsec_api_t redis_macsec_api; -PRIVATE extern const sai_mcast_fdb_api_t redis_mcast_fdb_api; -PRIVATE extern const sai_mirror_api_t redis_mirror_api; -PRIVATE extern const sai_mpls_api_t redis_mpls_api; -PRIVATE extern const sai_nat_api_t redis_nat_api; -PRIVATE extern const sai_neighbor_api_t redis_neighbor_api; -PRIVATE extern const sai_next_hop_api_t redis_next_hop_api; -PRIVATE extern const sai_next_hop_group_api_t redis_next_hop_group_api; -PRIVATE extern const sai_policer_api_t redis_policer_api; -PRIVATE extern const sai_port_api_t redis_port_api; -PRIVATE extern const sai_qos_map_api_t redis_qos_map_api; -PRIVATE extern const sai_queue_api_t redis_queue_api; -PRIVATE extern const sai_route_api_t redis_route_api; -PRIVATE extern const sai_router_interface_api_t redis_router_interface_api; -PRIVATE extern const sai_rpf_group_api_t redis_rpf_group_api; -PRIVATE extern const sai_samplepacket_api_t redis_samplepacket_api; -PRIVATE extern const sai_scheduler_api_t redis_scheduler_api; -PRIVATE extern const sai_scheduler_group_api_t redis_scheduler_group_api; -PRIVATE extern const sai_srv6_api_t redis_srv6_api; -PRIVATE extern const sai_stp_api_t redis_stp_api; -PRIVATE extern const sai_switch_api_t redis_switch_api; -PRIVATE extern const sai_system_port_api_t redis_system_port_api; -PRIVATE extern const sai_tam_api_t redis_tam_api; -PRIVATE extern const sai_tunnel_api_t redis_tunnel_api; -PRIVATE extern const sai_udf_api_t redis_udf_api; -PRIVATE extern const sai_virtual_router_api_t redis_virtual_router_api; -PRIVATE extern const sai_vlan_api_t redis_vlan_api; -PRIVATE extern const sai_wred_api_t redis_wred_api; -PRIVATE extern const sai_my_mac_api_t redis_my_mac_api; -PRIVATE extern const sai_ipsec_api_t redis_ipsec_api; -PRIVATE extern const sai_twamp_api_t redis_twamp_api; -PRIVATE extern const sai_dash_meter_api_t redis_dash_meter_api; -PRIVATE extern const sai_poe_api_t redis_poe_api; - -PRIVATE extern std::shared_ptr redis_sai; - -// QUAD OID - -#define REDIS_CREATE(OT,ot) \ - static sai_status_t redis_create_ ## ot( \ - _Out_ sai_object_id_t *object_id, \ - _In_ sai_object_id_t switch_id, \ - _In_ uint32_t attr_count, \ - _In_ const sai_attribute_t *attr_list) \ -{ \ - SWSS_LOG_ENTER(); \ - return redis_sai->create( \ - (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ - object_id, \ - switch_id, \ - attr_count, \ - attr_list); \ -} - -#define REDIS_REMOVE(OT,ot) \ - static sai_status_t redis_remove_ ## ot( \ - _In_ sai_object_id_t object_id) \ -{ \ - SWSS_LOG_ENTER(); \ - return redis_sai->remove( \ - (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ - object_id); \ -} - -#define REDIS_SET(OT,ot) \ - static sai_status_t redis_set_ ## ot ## _attribute( \ - _In_ sai_object_id_t object_id, \ - _In_ const sai_attribute_t *attr) \ -{ \ - SWSS_LOG_ENTER(); \ - return redis_sai->set( \ - (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ - object_id, \ - attr); \ -} - -#define REDIS_GET(OT,ot) \ - static sai_status_t redis_get_ ## ot ## _attribute( \ - _In_ sai_object_id_t object_id, \ - _In_ uint32_t attr_count, \ - _Inout_ sai_attribute_t *attr_list) \ -{ \ - SWSS_LOG_ENTER(); \ - return redis_sai->get( \ - (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ - object_id, \ - attr_count, \ - attr_list); \ -} - -// QUAD DECLARE - -#define REDIS_GENERIC_QUAD(OT,ot) \ - REDIS_CREATE(OT,ot); \ - REDIS_REMOVE(OT,ot); \ - REDIS_SET(OT,ot); \ - REDIS_GET(OT,ot); - -// QUAD ENTRY - -#define REDIS_CREATE_ENTRY(OT,ot) \ - static sai_status_t redis_create_ ## ot( \ - _In_ const sai_ ## ot ##_t *entry, \ - _In_ uint32_t attr_count, \ - _In_ const sai_attribute_t *attr_list) \ -{ \ - SWSS_LOG_ENTER(); \ - return redis_sai->create( \ - entry, \ - attr_count, \ - attr_list); \ -} - -#define REDIS_REMOVE_ENTRY(OT,ot) \ - static sai_status_t redis_remove_ ## ot( \ - _In_ const sai_ ## ot ## _t *entry) \ -{ \ - SWSS_LOG_ENTER(); \ - return redis_sai->remove( \ - entry); \ -} - -#define REDIS_SET_ENTRY(OT,ot) \ - static sai_status_t redis_set_ ## ot ## _attribute( \ - _In_ const sai_ ## ot ## _t *entry, \ - _In_ const sai_attribute_t *attr) \ -{ \ - SWSS_LOG_ENTER(); \ - return redis_sai->set( \ - entry, \ - attr); \ -} - -#define REDIS_GET_ENTRY(OT,ot) \ - static sai_status_t redis_get_ ## ot ## _attribute( \ - _In_ const sai_ ## ot ## _t *entry, \ - _In_ uint32_t attr_count, \ - _Inout_ sai_attribute_t *attr_list) \ -{ \ - SWSS_LOG_ENTER(); \ - return redis_sai->get( \ - entry, \ - attr_count, \ - attr_list); \ -} - -// QUAD ENTRY DECLARE - -#define REDIS_GENERIC_QUAD_ENTRY(OT,ot) \ - REDIS_CREATE_ENTRY(OT,ot); \ - REDIS_REMOVE_ENTRY(OT,ot); \ - REDIS_SET_ENTRY(OT,ot); \ - REDIS_GET_ENTRY(OT,ot); - -// QUAD API - -#define REDIS_GENERIC_QUAD_API(ot) \ - redis_create_ ## ot, \ - redis_remove_ ## ot, \ - redis_set_ ## ot ##_attribute, \ - redis_get_ ## ot ##_attribute, - -// STATS - -#define REDIS_GET_STATS(OT,ot) \ - static sai_status_t redis_get_ ## ot ## _stats( \ - _In_ sai_object_id_t object_id, \ - _In_ uint32_t number_of_counters, \ - _In_ const sai_stat_id_t *counter_ids, \ - _Out_ uint64_t *counters) \ -{ \ - SWSS_LOG_ENTER(); \ - return redis_sai->getStats( \ - (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ - object_id, \ - number_of_counters, \ - counter_ids, \ - counters); \ -} - -#define REDIS_GET_STATS_EXT(OT,ot) \ - static sai_status_t redis_get_ ## ot ## _stats_ext( \ - _In_ sai_object_id_t object_id, \ - _In_ uint32_t number_of_counters, \ - _In_ const sai_stat_id_t *counter_ids, \ - _In_ sai_stats_mode_t mode, \ - _Out_ uint64_t *counters) \ -{ \ - SWSS_LOG_ENTER(); \ - return redis_sai->getStatsExt( \ - (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ - object_id, \ - number_of_counters, \ - counter_ids, \ - mode, \ - counters); \ -} - -#define REDIS_CLEAR_STATS(OT,ot) \ - static sai_status_t redis_clear_ ## ot ## _stats( \ - _In_ sai_object_id_t object_id, \ - _In_ uint32_t number_of_counters, \ - _In_ const sai_stat_id_t *counter_ids) \ -{ \ - SWSS_LOG_ENTER(); \ - return redis_sai->clearStats( \ - (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ - object_id, \ - number_of_counters, \ - counter_ids); \ -} - -// STATS DECLARE - -#define REDIS_GENERIC_STATS(OT, ot) \ - REDIS_GET_STATS(OT,ot); \ - REDIS_GET_STATS_EXT(OT,ot); \ - REDIS_CLEAR_STATS(OT,ot); - -// STATS API - -#define REDIS_GENERIC_STATS_API(ot) \ - redis_get_ ## ot ## _stats, \ - redis_get_ ## ot ## _stats_ext, \ - redis_clear_ ## ot ## _stats, - -// BULK QUAD - -#define REDIS_BULK_CREATE(OT,fname) \ - static sai_status_t redis_bulk_create_ ## fname( \ - _In_ sai_object_id_t switch_id, \ - _In_ uint32_t object_count, \ - _In_ const uint32_t *attr_count, \ - _In_ const sai_attribute_t **attr_list, \ - _In_ sai_bulk_op_error_mode_t mode, \ - _Out_ sai_object_id_t *object_id, \ - _Out_ sai_status_t *object_statuses) \ -{ \ - SWSS_LOG_ENTER(); \ - return redis_sai->bulkCreate( \ - (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ - switch_id, \ - object_count, \ - attr_count, \ - attr_list, \ - mode, \ - object_id, \ - object_statuses); \ -} - -#define REDIS_BULK_REMOVE(OT,fname) \ - static sai_status_t redis_bulk_remove_ ## fname( \ - _In_ uint32_t object_count, \ - _In_ const sai_object_id_t *object_id, \ - _In_ sai_bulk_op_error_mode_t mode, \ - _Out_ sai_status_t *object_statuses) \ -{ \ - SWSS_LOG_ENTER(); \ - return redis_sai->bulkRemove( \ - (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ - object_count, \ - object_id, \ - mode, \ - object_statuses); \ -} - -#define REDIS_BULK_SET(OT,fname) \ - static sai_status_t redis_bulk_set_ ## fname( \ - _In_ uint32_t object_count, \ - _In_ const sai_object_id_t *object_id, \ - _In_ const sai_attribute_t *attr_list, \ - _In_ sai_bulk_op_error_mode_t mode, \ - _Out_ sai_status_t *object_statuses) \ -{ \ - SWSS_LOG_ENTER(); \ - return redis_sai->bulkSet( \ - (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ - object_count, \ - object_id, \ - attr_list, \ - mode, \ - object_statuses); \ -} - -#define REDIS_BULK_GET(OT,fname) \ - static sai_status_t redis_bulk_get_ ## fname( \ - _In_ uint32_t object_count, \ - _In_ const sai_object_id_t *object_id, \ - _In_ const uint32_t *attr_count, \ - _Inout_ sai_attribute_t **attr_list, \ - _In_ sai_bulk_op_error_mode_t mode, \ - _Out_ sai_status_t *object_statuses) \ -{ \ - SWSS_LOG_ENTER(); \ - SWSS_LOG_ERROR("not implemented"); \ - return SAI_STATUS_NOT_IMPLEMENTED; \ -} - -// BULK QUAD DECLARE - -#define REDIS_BULK_QUAD(OT,ot) \ - REDIS_BULK_CREATE(OT,ot); \ - REDIS_BULK_REMOVE(OT,ot); \ - REDIS_BULK_SET(OT,ot); \ - REDIS_BULK_GET(OT,ot); - -// BULK QUAD ENTRY - -#define REDIS_BULK_CREATE_ENTRY(OT,ot) \ - REDIS_BULK_CREATE_ENTRY_EX(OT, ot, ot) - -#define REDIS_BULK_CREATE_ENTRY_EX(OT,ot,fname) \ - static sai_status_t redis_bulk_create_ ## fname(\ - _In_ uint32_t object_count, \ - _In_ const sai_ ## ot ## _t *entry, \ - _In_ const uint32_t *attr_count, \ - _In_ const sai_attribute_t **attr_list, \ - _In_ sai_bulk_op_error_mode_t mode, \ - _Out_ sai_status_t *object_statuses) \ -{ \ - SWSS_LOG_ENTER(); \ - return redis_sai->bulkCreate( \ - object_count, \ - entry, \ - attr_count, \ - attr_list, \ - mode, \ - object_statuses); \ -} - -#define REDIS_BULK_REMOVE_ENTRY(OT,ot) \ - REDIS_BULK_REMOVE_ENTRY_EX(OT, ot, ot) - -#define REDIS_BULK_REMOVE_ENTRY_EX(OT,ot,fname) \ - static sai_status_t redis_bulk_remove_ ## fname(\ - _In_ uint32_t object_count, \ - _In_ const sai_ ## ot ##_t *entry, \ - _In_ sai_bulk_op_error_mode_t mode, \ - _Out_ sai_status_t *object_statuses) \ -{ \ - SWSS_LOG_ENTER(); \ - return redis_sai->bulkRemove( \ - object_count, \ - entry, \ - mode, \ - object_statuses); \ -} - -#define REDIS_BULK_SET_ENTRY(OT,ot) \ - static sai_status_t redis_bulk_set_ ## ot( \ - _In_ uint32_t object_count, \ - _In_ const sai_ ## ot ## _t *entry, \ - _In_ const sai_attribute_t *attr_list, \ - _In_ sai_bulk_op_error_mode_t mode, \ - _Out_ sai_status_t *object_statuses) \ -{ \ - SWSS_LOG_ENTER(); \ - return redis_sai->bulkSet( \ - object_count, \ - entry, \ - attr_list, \ - mode, \ - object_statuses); \ -} - -#define REDIS_BULK_GET_ENTRY(OT,ot) \ - static sai_status_t redis_bulk_get_ ## ot( \ - _In_ uint32_t object_count, \ - _In_ const sai_ ## ot ## _t *entry, \ - _In_ const uint32_t *attr_count, \ - _Inout_ sai_attribute_t **attr_list, \ - _In_ sai_bulk_op_error_mode_t mode, \ - _Out_ sai_status_t *object_statuses) \ -{ \ - SWSS_LOG_ENTER(); \ - SWSS_LOG_ERROR("not implemented"); \ - return SAI_STATUS_NOT_IMPLEMENTED; \ -} - -// BULK QUAD ENTRY DECLARE - -#define REDIS_BULK_QUAD_ENTRY(OT,ot) \ - REDIS_BULK_CREATE_ENTRY(OT,ot); \ - REDIS_BULK_REMOVE_ENTRY(OT,ot); \ - REDIS_BULK_SET_ENTRY(OT,ot); \ - REDIS_BULK_GET_ENTRY(OT,ot); - -// BULK QUAD API - -#define REDIS_BULK_QUAD_API(ot) \ - redis_bulk_create_ ## ot, \ - redis_bulk_remove_ ## ot, \ - redis_bulk_set_ ## ot, \ - redis_bulk_get_ ## ot, - -// BULK get/set DECLARE - -#define REDIS_BULK_GET_SET(OT,ot) \ - REDIS_BULK_GET(OT,ot); \ - REDIS_BULK_SET(OT,ot); - -// BULK get/set API - -#define REDIS_BULK_GET_SET_API(ot) \ - redis_bulk_get_ ## ot, \ - redis_bulk_set_ ## ot, diff --git a/lib/sai_redis_acl.cpp b/lib/sai_redis_acl.cpp deleted file mode 100644 index 9c1ebf7d8..000000000 --- a/lib/sai_redis_acl.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(ACL_TABLE,acl_table); -REDIS_GENERIC_QUAD(ACL_ENTRY,acl_entry); -REDIS_GENERIC_QUAD(ACL_COUNTER,acl_counter); -REDIS_GENERIC_QUAD(ACL_RANGE,acl_range); -REDIS_GENERIC_QUAD(ACL_TABLE_GROUP,acl_table_group); -REDIS_GENERIC_QUAD(ACL_TABLE_GROUP_MEMBER,acl_table_group_member); -REDIS_GENERIC_QUAD(ACL_TABLE_CHAIN_GROUP,acl_table_chain_group) - -const sai_acl_api_t redis_acl_api = { - - REDIS_GENERIC_QUAD_API(acl_table) - REDIS_GENERIC_QUAD_API(acl_entry) - REDIS_GENERIC_QUAD_API(acl_counter) - REDIS_GENERIC_QUAD_API(acl_range) - REDIS_GENERIC_QUAD_API(acl_table_group) - REDIS_GENERIC_QUAD_API(acl_table_group_member) - REDIS_GENERIC_QUAD_API(acl_table_chain_group) -}; diff --git a/lib/sai_redis_ars.cpp b/lib/sai_redis_ars.cpp deleted file mode 100644 index 5fd6f812a..000000000 --- a/lib/sai_redis_ars.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(ARS, ars); - -const sai_ars_api_t redis_ars_api = { - REDIS_GENERIC_QUAD_API(ars) -}; diff --git a/lib/sai_redis_ars_profile.cpp b/lib/sai_redis_ars_profile.cpp deleted file mode 100644 index ffef33354..000000000 --- a/lib/sai_redis_ars_profile.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_redis.h" - - -REDIS_GENERIC_QUAD(ARS_PROFILE, ars_profile); - -const sai_ars_profile_api_t redis_ars_profile_api = { - REDIS_GENERIC_QUAD_API(ars_profile) -}; diff --git a/lib/sai_redis_bfd.cpp b/lib/sai_redis_bfd.cpp deleted file mode 100644 index 92a778584..000000000 --- a/lib/sai_redis_bfd.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(BFD_SESSION,bfd_session); -REDIS_GENERIC_STATS(BFD_SESSION,bfd_session); - -const sai_bfd_api_t redis_bfd_api = { - - REDIS_GENERIC_QUAD_API(bfd_session) - REDIS_GENERIC_STATS_API(bfd_session) -}; diff --git a/lib/sai_redis_bmtor.cpp b/lib/sai_redis_bmtor.cpp deleted file mode 100644 index 9784ef6c7..000000000 --- a/lib/sai_redis_bmtor.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(TABLE_BITMAP_CLASSIFICATION_ENTRY,table_bitmap_classification_entry); -REDIS_GENERIC_STATS(TABLE_BITMAP_CLASSIFICATION_ENTRY,table_bitmap_classification_entry); -REDIS_GENERIC_QUAD(TABLE_BITMAP_ROUTER_ENTRY,table_bitmap_router_entry); -REDIS_GENERIC_STATS(TABLE_BITMAP_ROUTER_ENTRY,table_bitmap_router_entry); -REDIS_GENERIC_QUAD(TABLE_META_TUNNEL_ENTRY,table_meta_tunnel_entry); -REDIS_GENERIC_STATS(TABLE_META_TUNNEL_ENTRY,table_meta_tunnel_entry); - -const sai_bmtor_api_t redis_bmtor_api = { - - REDIS_GENERIC_QUAD_API(table_bitmap_classification_entry) - REDIS_GENERIC_STATS_API(table_bitmap_classification_entry) - REDIS_GENERIC_QUAD_API(table_bitmap_router_entry) - REDIS_GENERIC_STATS_API(table_bitmap_router_entry) - REDIS_GENERIC_QUAD_API(table_meta_tunnel_entry) - REDIS_GENERIC_STATS_API(table_meta_tunnel_entry) -}; diff --git a/lib/sai_redis_bridge.cpp b/lib/sai_redis_bridge.cpp deleted file mode 100644 index c3491830e..000000000 --- a/lib/sai_redis_bridge.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(BRIDGE,bridge); -REDIS_GENERIC_QUAD(BRIDGE_PORT,bridge_port); -REDIS_GENERIC_STATS(BRIDGE,bridge); -REDIS_GENERIC_STATS(BRIDGE_PORT,bridge_port); - -const sai_bridge_api_t redis_bridge_api = { - - REDIS_GENERIC_QUAD_API(bridge) - REDIS_GENERIC_STATS_API(bridge) - REDIS_GENERIC_QUAD_API(bridge_port) - REDIS_GENERIC_STATS_API(bridge_port) -}; diff --git a/lib/sai_redis_buffer.cpp b/lib/sai_redis_buffer.cpp deleted file mode 100644 index 833ef3e13..000000000 --- a/lib/sai_redis_buffer.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(BUFFER_POOL,buffer_pool); -REDIS_GENERIC_QUAD(INGRESS_PRIORITY_GROUP,ingress_priority_group); -REDIS_GENERIC_QUAD(BUFFER_PROFILE,buffer_profile); -REDIS_GENERIC_STATS(BUFFER_POOL,buffer_pool); -REDIS_GENERIC_STATS(INGRESS_PRIORITY_GROUP,ingress_priority_group); - -const sai_buffer_api_t redis_buffer_api = { - - REDIS_GENERIC_QUAD_API(buffer_pool) - REDIS_GENERIC_STATS_API(buffer_pool) - REDIS_GENERIC_QUAD_API(ingress_priority_group) - REDIS_GENERIC_STATS_API(ingress_priority_group) - REDIS_GENERIC_QUAD_API(buffer_profile) -}; diff --git a/lib/sai_redis_counter.cpp b/lib/sai_redis_counter.cpp deleted file mode 100644 index 5ec1ac48f..000000000 --- a/lib/sai_redis_counter.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(COUNTER,counter); -REDIS_GENERIC_STATS(COUNTER,counter); - -const sai_counter_api_t redis_counter_api = { - - REDIS_GENERIC_QUAD_API(counter) - REDIS_GENERIC_STATS_API(counter) -}; diff --git a/lib/sai_redis_dash_acl.cpp b/lib/sai_redis_dash_acl.cpp deleted file mode 100644 index 69440cb3e..000000000 --- a/lib/sai_redis_dash_acl.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(DASH_ACL_GROUP, dash_acl_group); -REDIS_BULK_CREATE(DASH_ACL_GROUP, dash_acl_groups); -REDIS_BULK_REMOVE(DASH_ACL_GROUP, dash_acl_groups); - -REDIS_GENERIC_QUAD(DASH_ACL_RULE, dash_acl_rule); -REDIS_BULK_CREATE(DASH_ACL_RULE, dash_acl_rules); -REDIS_BULK_REMOVE(DASH_ACL_RULE, dash_acl_rules); - -const sai_dash_acl_api_t redis_dash_acl_api = { - REDIS_GENERIC_QUAD_API(dash_acl_group) - redis_bulk_create_dash_acl_groups, - redis_bulk_remove_dash_acl_groups, - - REDIS_GENERIC_QUAD_API(dash_acl_rule) - redis_bulk_create_dash_acl_rules, - redis_bulk_remove_dash_acl_rules, -}; diff --git a/lib/sai_redis_dash_direction_lookup.cpp b/lib/sai_redis_dash_direction_lookup.cpp deleted file mode 100644 index 4d691dffc..000000000 --- a/lib/sai_redis_dash_direction_lookup.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD_ENTRY(DIRECTION_LOOKUP_ENTRY, direction_lookup_entry); -REDIS_BULK_CREATE_ENTRY_EX(DIRECTION_LOOKUP_ENTRY, direction_lookup_entry, direction_lookup_entries); -REDIS_BULK_REMOVE_ENTRY_EX(DIRECTION_LOOKUP_ENTRY, direction_lookup_entry, direction_lookup_entries); - -const sai_dash_direction_lookup_api_t redis_dash_direction_lookup_api = { - REDIS_GENERIC_QUAD_API(direction_lookup_entry) - redis_bulk_create_direction_lookup_entries, - redis_bulk_remove_direction_lookup_entries, -}; diff --git a/lib/sai_redis_dash_eni.cpp b/lib/sai_redis_dash_eni.cpp deleted file mode 100644 index 54a3a8fc3..000000000 --- a/lib/sai_redis_dash_eni.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD_ENTRY(ENI_ETHER_ADDRESS_MAP_ENTRY, eni_ether_address_map_entry); -REDIS_BULK_CREATE_ENTRY_EX(ENI_ETHER_ADDRESS_MAP_ENTRY, eni_ether_address_map_entry, eni_ether_address_map_entries); -REDIS_BULK_REMOVE_ENTRY_EX(ENI_ETHER_ADDRESS_MAP_ENTRY, eni_ether_address_map_entry, eni_ether_address_map_entries); - -REDIS_GENERIC_QUAD(ENI, eni); -REDIS_GENERIC_STATS(ENI, eni); -REDIS_BULK_CREATE(ENI, enis); -REDIS_BULK_REMOVE(ENI, enis); - -const sai_dash_eni_api_t redis_dash_eni_api = { - REDIS_GENERIC_QUAD_API(eni_ether_address_map_entry) - redis_bulk_create_eni_ether_address_map_entries, - redis_bulk_remove_eni_ether_address_map_entries, - - REDIS_GENERIC_QUAD_API(eni) - REDIS_GENERIC_STATS_API(eni) - redis_bulk_create_enis, - redis_bulk_remove_enis, -}; diff --git a/lib/sai_redis_dash_inbound_routing.cpp b/lib/sai_redis_dash_inbound_routing.cpp deleted file mode 100644 index 30d4e7644..000000000 --- a/lib/sai_redis_dash_inbound_routing.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD_ENTRY(INBOUND_ROUTING_ENTRY, inbound_routing_entry); -REDIS_BULK_CREATE_ENTRY_EX(INBOUND_ROUTING_ENTRY, inbound_routing_entry, inbound_routing_entries); -REDIS_BULK_REMOVE_ENTRY_EX(INBOUND_ROUTING_ENTRY, inbound_routing_entry, inbound_routing_entries); - -const sai_dash_inbound_routing_api_t redis_dash_inbound_routing_api = { - REDIS_GENERIC_QUAD_API(inbound_routing_entry) - redis_bulk_create_inbound_routing_entries, - redis_bulk_remove_inbound_routing_entries, -}; diff --git a/lib/sai_redis_dash_meter.cpp b/lib/sai_redis_dash_meter.cpp deleted file mode 100644 index 5b22e7f27..000000000 --- a/lib/sai_redis_dash_meter.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(METER_BUCKET, meter_bucket); -REDIS_BULK_CREATE(METER_BUCKET, meter_buckets); -REDIS_BULK_REMOVE(METER_BUCKET, meter_buckets); - -REDIS_GENERIC_QUAD(METER_BUCKET, meter_policy); -REDIS_BULK_CREATE(METER_BUCKET, meter_policys); -REDIS_BULK_REMOVE(METER_BUCKET, meter_policys); - -REDIS_GENERIC_QUAD(METER_BUCKET, meter_rule); -REDIS_BULK_CREATE(METER_BUCKET, meter_rules); -REDIS_BULK_REMOVE(METER_BUCKET, meter_rules); - -const sai_dash_meter_api_t redis_dash_meter_api = { - - REDIS_GENERIC_QUAD_API(meter_bucket) - redis_bulk_create_meter_buckets, - redis_bulk_remove_meter_buckets, - - REDIS_GENERIC_QUAD_API(meter_policy) - redis_bulk_create_meter_policys, - redis_bulk_remove_meter_policys, - - REDIS_GENERIC_QUAD_API(meter_rule) - redis_bulk_create_meter_rules, - redis_bulk_remove_meter_rules, -}; diff --git a/lib/sai_redis_dash_outbound_ca_to_pa.cpp b/lib/sai_redis_dash_outbound_ca_to_pa.cpp deleted file mode 100644 index 6f3bd9267..000000000 --- a/lib/sai_redis_dash_outbound_ca_to_pa.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD_ENTRY(OUTBOUND_CA_TO_PA_ENTRY, outbound_ca_to_pa_entry); -REDIS_BULK_CREATE_ENTRY_EX(OUTBOUND_CA_TO_PA_ENTRY, outbound_ca_to_pa_entry, outbound_ca_to_pa_entries); -REDIS_BULK_REMOVE_ENTRY_EX(OUTBOUND_CA_TO_PA_ENTRY, outbound_ca_to_pa_entry, outbound_ca_to_pa_entries); - -const sai_dash_outbound_ca_to_pa_api_t redis_dash_outbound_ca_to_pa_api = { - REDIS_GENERIC_QUAD_API(outbound_ca_to_pa_entry) - redis_bulk_create_outbound_ca_to_pa_entries, - redis_bulk_remove_outbound_ca_to_pa_entries, -}; diff --git a/lib/sai_redis_dash_outbound_routing.cpp b/lib/sai_redis_dash_outbound_routing.cpp deleted file mode 100644 index 4fe8b9aa9..000000000 --- a/lib/sai_redis_dash_outbound_routing.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD_ENTRY(OUTBOUND_ROUTING_ENTRY, outbound_routing_entry); -REDIS_BULK_CREATE_ENTRY_EX(OUTBOUND_ROUTING_ENTRY, outbound_routing_entry, outbound_routing_entries); -REDIS_BULK_REMOVE_ENTRY_EX(OUTBOUND_ROUTING_ENTRY, outbound_routing_entry, outbound_routing_entries); - -const sai_dash_outbound_routing_api_t redis_dash_outbound_routing_api = { - REDIS_GENERIC_QUAD_API(outbound_routing_entry) - redis_bulk_create_outbound_routing_entries, - redis_bulk_remove_outbound_routing_entries, -}; diff --git a/lib/sai_redis_dash_pa_validation.cpp b/lib/sai_redis_dash_pa_validation.cpp deleted file mode 100644 index 24ca4373e..000000000 --- a/lib/sai_redis_dash_pa_validation.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD_ENTRY(PA_VALIDATION_ENTRY, pa_validation_entry); -REDIS_BULK_CREATE_ENTRY_EX(PA_VALIDATION_ENTRY, pa_validation_entry, pa_validation_entries); -REDIS_BULK_REMOVE_ENTRY_EX(PA_VALIDATION_ENTRY, pa_validation_entry, pa_validation_entries); - -const sai_dash_pa_validation_api_t redis_dash_pa_validation_api = { - REDIS_GENERIC_QUAD_API(pa_validation_entry) - redis_bulk_create_pa_validation_entries, - redis_bulk_remove_pa_validation_entries, -}; diff --git a/lib/sai_redis_dash_vip.cpp b/lib/sai_redis_dash_vip.cpp deleted file mode 100644 index 5992a83f7..000000000 --- a/lib/sai_redis_dash_vip.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD_ENTRY(VIP_ENTRY, vip_entry); -REDIS_BULK_CREATE_ENTRY_EX(VIP_ENTRY, vip_entry, vip_entries); -REDIS_BULK_REMOVE_ENTRY_EX(VIP_ENTRY, vip_entry, vip_entries); - -const sai_dash_vip_api_t redis_dash_vip_api = { - REDIS_GENERIC_QUAD_API(vip_entry) - redis_bulk_create_vip_entries, - redis_bulk_remove_vip_entries, -}; diff --git a/lib/sai_redis_dash_vnet.cpp b/lib/sai_redis_dash_vnet.cpp deleted file mode 100644 index 536785bcc..000000000 --- a/lib/sai_redis_dash_vnet.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(VNET, vnet); -REDIS_BULK_CREATE(VNET, vnets); -REDIS_BULK_REMOVE(VNET, vnets); - -const sai_dash_vnet_api_t redis_dash_vnet_api = { - REDIS_GENERIC_QUAD_API(vnet) - redis_bulk_create_vnets, - redis_bulk_remove_vnets, -}; diff --git a/lib/sai_redis_debug_counter.cpp b/lib/sai_redis_debug_counter.cpp deleted file mode 100644 index 6d22002b5..000000000 --- a/lib/sai_redis_debug_counter.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(DEBUG_COUNTER,debug_counter); - -const sai_debug_counter_api_t redis_debug_counter_api = { - - REDIS_GENERIC_QUAD_API(debug_counter) -}; diff --git a/lib/sai_redis_dtel.cpp b/lib/sai_redis_dtel.cpp deleted file mode 100644 index c429cf3dd..000000000 --- a/lib/sai_redis_dtel.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(DTEL,dtel); -REDIS_GENERIC_QUAD(DTEL_QUEUE_REPORT,dtel_queue_report); -REDIS_GENERIC_QUAD(DTEL_INT_SESSION,dtel_int_session); -REDIS_GENERIC_QUAD(DTEL_REPORT_SESSION,dtel_report_session); -REDIS_GENERIC_QUAD(DTEL_EVENT,dtel_event); - -const sai_dtel_api_t redis_dtel_api = { - - REDIS_GENERIC_QUAD_API(dtel) - REDIS_GENERIC_QUAD_API(dtel_queue_report) - REDIS_GENERIC_QUAD_API(dtel_int_session) - REDIS_GENERIC_QUAD_API(dtel_report_session) - REDIS_GENERIC_QUAD_API(dtel_event) -}; diff --git a/lib/sai_redis_fdb.cpp b/lib/sai_redis_fdb.cpp deleted file mode 100644 index 0c2fc3209..000000000 --- a/lib/sai_redis_fdb.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "sai_redis.h" - -static sai_status_t redis_flush_fdb_entries( - _In_ sai_object_id_t switch_id, - _In_ uint32_t attr_count, - _In_ const sai_attribute_t *attr_list) -{ - SWSS_LOG_ENTER(); - - return redis_sai->flushFdbEntries( - switch_id, - attr_count, - attr_list); -} - -REDIS_GENERIC_QUAD_ENTRY(FDB_ENTRY,fdb_entry); -REDIS_BULK_QUAD_ENTRY(FDB_ENTRY,fdb_entry); - -const sai_fdb_api_t redis_fdb_api = { - - REDIS_GENERIC_QUAD_API(fdb_entry) - - redis_flush_fdb_entries, - - REDIS_BULK_QUAD_API(fdb_entry) -}; diff --git a/lib/sai_redis_genericprogrammable.cpp b/lib/sai_redis_genericprogrammable.cpp deleted file mode 100644 index 587917638..000000000 --- a/lib/sai_redis_genericprogrammable.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(GENERIC_PROGRAMMABLE,generic_programmable); - -const sai_generic_programmable_api_t redis_generic_programmable_api = { - REDIS_GENERIC_QUAD_API(generic_programmable) -}; diff --git a/lib/sai_redis_hash.cpp b/lib/sai_redis_hash.cpp deleted file mode 100644 index 0dec9b313..000000000 --- a/lib/sai_redis_hash.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(HASH,hash); -REDIS_GENERIC_QUAD(FINE_GRAINED_HASH_FIELD,fine_grained_hash_field); - -const sai_hash_api_t redis_hash_api = { - REDIS_GENERIC_QUAD_API(hash) - REDIS_GENERIC_QUAD_API(fine_grained_hash_field) -}; diff --git a/lib/sai_redis_hostif.cpp b/lib/sai_redis_hostif.cpp deleted file mode 100644 index fab7a9cfa..000000000 --- a/lib/sai_redis_hostif.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include "sai_redis.h" - -static sai_status_t redis_recv_hostif_packet( - _In_ sai_object_id_t hostif_id, - _Inout_ sai_size_t *buffer_size, - _Out_ void *buffer, - _Inout_ uint32_t *attr_count, - _Out_ sai_attribute_t *attr_list) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -static sai_status_t redis_send_hostif_packet( - _In_ sai_object_id_t hostif_id, - _In_ sai_size_t buffer_size, - _In_ const void *buffer, - _In_ uint32_t attr_count, - _In_ const sai_attribute_t *attr_list) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -static sai_status_t redis_allocate_hostif_packet( - _In_ sai_object_id_t hostif_id, - _In_ sai_size_t buffer_size, - _Out_ void **buffer, - _In_ uint32_t attr_count, - _In_ const sai_attribute_t *attr_list) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -static sai_status_t redis_free_hostif_packet( - _In_ sai_object_id_t hostif_id, - _Inout_ void *buffer) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -REDIS_GENERIC_QUAD(HOSTIF,hostif); -REDIS_GENERIC_QUAD(HOSTIF_TABLE_ENTRY,hostif_table_entry); -REDIS_GENERIC_QUAD(HOSTIF_TRAP_GROUP,hostif_trap_group); -REDIS_GENERIC_QUAD(HOSTIF_TRAP,hostif_trap); -REDIS_GENERIC_QUAD(HOSTIF_USER_DEFINED_TRAP,hostif_user_defined_trap); - -const sai_hostif_api_t redis_hostif_api = { - - REDIS_GENERIC_QUAD_API(hostif) - REDIS_GENERIC_QUAD_API(hostif_table_entry) - REDIS_GENERIC_QUAD_API(hostif_trap_group) - REDIS_GENERIC_QUAD_API(hostif_trap) - REDIS_GENERIC_QUAD_API(hostif_user_defined_trap) - - redis_recv_hostif_packet, - redis_send_hostif_packet, - redis_allocate_hostif_packet, - redis_free_hostif_packet, -}; diff --git a/lib/sai_redis_interfacequery.cpp b/lib/sai_redis_interfacequery.cpp deleted file mode 100644 index 74e910956..000000000 --- a/lib/sai_redis_interfacequery.cpp +++ /dev/null @@ -1,296 +0,0 @@ -#include "sai_redis.h" -#include "ClientServerSai.h" - -using namespace sairedis; - -std::shared_ptr redis_sai = std::make_shared(); - -sai_status_t sai_api_initialize( - _In_ uint64_t flags, - _In_ const sai_service_method_table_t* service_method_table) -{ - SWSS_LOG_ENTER(); - - return redis_sai->initialize(flags, service_method_table); -} - -sai_status_t sai_api_uninitialize(void) -{ - SWSS_LOG_ENTER(); - - return redis_sai->uninitialize(); -} - -sai_status_t sai_log_set( - _In_ sai_api_t sai_api_id, - _In_ sai_log_level_t log_level) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -#define API(api) .api ## _api = const_cast(&redis_ ## api ## _api) - -static sai_apis_t redis_apis = { - API(switch), - API(port), - API(fdb), - API(vlan), - API(virtual_router), - API(route), - API(next_hop), - API(next_hop_group), - API(router_interface), - API(neighbor), - API(acl), - API(hostif), - API(mirror), - API(samplepacket), - API(stp), - API(lag), - API(policer), - API(wred), - API(qos_map), - API(queue), - API(scheduler), - API(scheduler_group), - API(buffer), - API(hash), - API(udf), - API(tunnel), - API(l2mc), - API(ipmc), - API(rpf_group), - API(l2mc_group), - API(ipmc_group), - API(mcast_fdb), - API(bridge), - API(tam), - API(srv6), - API(mpls), - API(dtel), - API(bfd), - API(isolation_group), - API(nat), - API(counter), - API(debug_counter), - API(macsec), - API(system_port), - API(my_mac), - API(ipsec), - API(generic_programmable), - API(ars), - API(ars_profile), - API(twamp), - API(poe), - API(bmtor), - API(dash_acl), - API(dash_direction_lookup), - API(dash_eni), - API(dash_inbound_routing), - API(dash_meter), - API(dash_outbound_ca_to_pa), - API(dash_outbound_routing), - API(dash_vnet), - API(dash_pa_validation), - API(dash_vip), -}; - -static_assert((sizeof(sai_apis_t)/sizeof(void*)) == (SAI_API_EXTENSIONS_MAX - 1)); - -sai_status_t sai_api_query( - _In_ sai_api_t sai_api_id, - _Out_ void** api_method_table) -{ - SWSS_LOG_ENTER(); - - if (api_method_table == NULL) - { - SWSS_LOG_ERROR("NULL method table passed to SAI API initialize"); - - return SAI_STATUS_INVALID_PARAMETER; - } - - if (sai_api_id == SAI_API_UNSPECIFIED) - { - SWSS_LOG_ERROR("api ID is unspecified api"); - - return SAI_STATUS_INVALID_PARAMETER; - } - - if (sai_metadata_get_enum_value_name(&sai_metadata_enum_sai_api_t, sai_api_id)) - { - *api_method_table = ((void**)&redis_apis)[sai_api_id - 1]; - return SAI_STATUS_SUCCESS; - } - - SWSS_LOG_ERROR("Invalid API type %d", sai_api_id); - - return SAI_STATUS_INVALID_PARAMETER; -} - -sai_status_t sai_query_attribute_capability( - _In_ sai_object_id_t switch_id, - _In_ sai_object_type_t object_type, - _In_ sai_attr_id_t attr_id, - _Out_ sai_attr_capability_t *capability) -{ - SWSS_LOG_ENTER(); - - return redis_sai->queryAttributeCapability( - switch_id, - object_type, - attr_id, - capability); -} - -sai_status_t sai_query_attribute_enum_values_capability( - _In_ sai_object_id_t switch_id, - _In_ sai_object_type_t object_type, - _In_ sai_attr_id_t attr_id, - _Inout_ sai_s32_list_t *enum_values_capability) -{ - SWSS_LOG_ENTER(); - - return redis_sai->queryAattributeEnumValuesCapability( - switch_id, - object_type, - attr_id, - enum_values_capability); -} - -sai_status_t sai_object_type_get_availability( - _In_ sai_object_id_t switch_id, - _In_ sai_object_type_t object_type, - _In_ uint32_t attr_count, - _In_ const sai_attribute_t *attr_list, - _Out_ uint64_t *count) -{ - SWSS_LOG_ENTER(); - - return redis_sai->objectTypeGetAvailability( - switch_id, - object_type, - attr_count, - attr_list, - count); -} - -sai_object_type_t sai_object_type_query( - _In_ sai_object_id_t objectId) -{ - SWSS_LOG_ENTER(); - - return redis_sai->objectTypeQuery(objectId); -} - -sai_object_id_t sai_switch_id_query( - _In_ sai_object_id_t objectId) -{ - SWSS_LOG_ENTER(); - - return redis_sai->switchIdQuery(objectId); -} - -sai_status_t sai_dbg_generate_dump( - _In_ const char *dump_file_name) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -sai_status_t sai_bulk_get_attribute( - _In_ sai_object_id_t switch_id, - _In_ sai_object_type_t object_type, - _In_ uint32_t object_count, - _In_ const sai_object_key_t *object_key, - _Inout_ uint32_t *attr_count, - _Inout_ sai_attribute_t **attr_list, - _Inout_ sai_status_t *object_statuses) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -sai_status_t sai_get_maximum_attribute_count( - _In_ sai_object_id_t switch_id, - _In_ sai_object_type_t object_type, - _Out_ uint32_t *count) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -sai_status_t sai_get_object_count( - _In_ sai_object_id_t switch_id, - _In_ sai_object_type_t object_type, - _Out_ uint32_t *count) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -sai_status_t sai_get_object_key( - _In_ sai_object_id_t switch_id, - _In_ sai_object_type_t object_type, - _Inout_ uint32_t *object_count, - _Inout_ sai_object_key_t *object_list) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -sai_status_t sai_query_stats_capability( - _In_ sai_object_id_t switch_id, - _In_ sai_object_type_t object_type, - _Inout_ sai_stat_capability_list_t *stats_capability) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -sai_status_t sai_query_api_version( - _Out_ sai_api_version_t *version) -{ - SWSS_LOG_ENTER(); - - return redis_sai->queryApiVersion(version); -} - -sai_status_t sai_bulk_object_get_stats( - _In_ sai_object_id_t switch_id, - _In_ sai_object_type_t object_type, - _In_ uint32_t object_count, - _In_ const sai_object_key_t *object_key, - _In_ uint32_t number_of_counters, - _In_ const sai_stat_id_t *counter_ids, - _In_ sai_stats_mode_t mode, - _Inout_ sai_status_t *object_statuses, - _Out_ uint64_t *counters) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -sai_status_t sai_bulk_object_clear_stats( - _In_ sai_object_id_t switch_id, - _In_ sai_object_type_t object_type, - _In_ uint32_t object_count, - _In_ const sai_object_key_t *object_key, - _In_ uint32_t number_of_counters, - _In_ const sai_stat_id_t *counter_ids, - _In_ sai_stats_mode_t mode, - _Inout_ sai_status_t *object_statuses) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} diff --git a/lib/sai_redis_ipmc.cpp b/lib/sai_redis_ipmc.cpp deleted file mode 100644 index a27086f42..000000000 --- a/lib/sai_redis_ipmc.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD_ENTRY(IPMC_ENTRY,ipmc_entry); - -const sai_ipmc_api_t redis_ipmc_api = { - - REDIS_GENERIC_QUAD_API(ipmc_entry) -}; diff --git a/lib/sai_redis_ipmc_group.cpp b/lib/sai_redis_ipmc_group.cpp deleted file mode 100644 index 6b41a6e44..000000000 --- a/lib/sai_redis_ipmc_group.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(IPMC_GROUP,ipmc_group); -REDIS_GENERIC_QUAD(IPMC_GROUP_MEMBER,ipmc_group_member); - -const sai_ipmc_group_api_t redis_ipmc_group_api = { - - REDIS_GENERIC_QUAD_API(ipmc_group) - REDIS_GENERIC_QUAD_API(ipmc_group_member) -}; diff --git a/lib/sai_redis_ipsec.cpp b/lib/sai_redis_ipsec.cpp deleted file mode 100644 index 3cde2eeff..000000000 --- a/lib/sai_redis_ipsec.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(IPSEC,ipsec); -REDIS_GENERIC_QUAD(IPSEC_PORT,ipsec_port); -REDIS_GENERIC_QUAD(IPSEC_SA,ipsec_sa); -REDIS_GENERIC_STATS(IPSEC_PORT,ipsec_port); -REDIS_GENERIC_STATS(IPSEC_SA,ipsec_sa); - -const sai_ipsec_api_t redis_ipsec_api = { - - REDIS_GENERIC_QUAD_API(ipsec) - REDIS_GENERIC_QUAD_API(ipsec_port) - REDIS_GENERIC_STATS_API(ipsec_port) - REDIS_GENERIC_QUAD_API(ipsec_sa) - REDIS_GENERIC_STATS_API(ipsec_sa) -}; diff --git a/lib/sai_redis_isolation_group.cpp b/lib/sai_redis_isolation_group.cpp deleted file mode 100644 index f685c73f5..000000000 --- a/lib/sai_redis_isolation_group.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(ISOLATION_GROUP,isolation_group); -REDIS_GENERIC_QUAD(ISOLATION_GROUP_MEMBER,isolation_group_member); - -const sai_isolation_group_api_t redis_isolation_group_api = { - - REDIS_GENERIC_QUAD_API(isolation_group) - REDIS_GENERIC_QUAD_API(isolation_group_member) -}; diff --git a/lib/sai_redis_l2mc.cpp b/lib/sai_redis_l2mc.cpp deleted file mode 100644 index 898ce9d4a..000000000 --- a/lib/sai_redis_l2mc.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD_ENTRY(L2MC_ENTRY,l2mc_entry); - -const sai_l2mc_api_t redis_l2mc_api = { - - REDIS_GENERIC_QUAD_API(l2mc_entry) -}; diff --git a/lib/sai_redis_l2mcgroup.cpp b/lib/sai_redis_l2mcgroup.cpp deleted file mode 100644 index 8892cf4c8..000000000 --- a/lib/sai_redis_l2mcgroup.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(L2MC_GROUP,l2mc_group); -REDIS_GENERIC_QUAD(L2MC_GROUP_MEMBER,l2mc_group_member); - -const sai_l2mc_group_api_t redis_l2mc_group_api = { - - REDIS_GENERIC_QUAD_API(l2mc_group) - REDIS_GENERIC_QUAD_API(l2mc_group_member) -}; diff --git a/lib/sai_redis_lag.cpp b/lib/sai_redis_lag.cpp deleted file mode 100644 index 89c6b5e0c..000000000 --- a/lib/sai_redis_lag.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "sai_redis.h" - -REDIS_BULK_CREATE(LAG_MEMBER,lag_members); -REDIS_BULK_REMOVE(LAG_MEMBER,lag_members); - -REDIS_GENERIC_QUAD(LAG,lag); -REDIS_GENERIC_QUAD(LAG_MEMBER,lag_member); - -const sai_lag_api_t redis_lag_api = { - - REDIS_GENERIC_QUAD_API(lag) - REDIS_GENERIC_QUAD_API(lag_member) - - redis_bulk_create_lag_members, - redis_bulk_remove_lag_members, -}; diff --git a/lib/sai_redis_macsec.cpp b/lib/sai_redis_macsec.cpp deleted file mode 100644 index 0367919e8..000000000 --- a/lib/sai_redis_macsec.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(MACSEC,macsec); -REDIS_GENERIC_QUAD(MACSEC_PORT,macsec_port); -REDIS_GENERIC_STATS(MACSEC_PORT,macsec_port); -REDIS_GENERIC_QUAD(MACSEC_FLOW,macsec_flow); -REDIS_GENERIC_STATS(MACSEC_FLOW,macsec_flow); -REDIS_GENERIC_QUAD(MACSEC_SC,macsec_sc); -REDIS_GENERIC_STATS(MACSEC_SC,macsec_sc); -REDIS_GENERIC_QUAD(MACSEC_SA,macsec_sa); -REDIS_GENERIC_STATS(MACSEC_SA,macsec_sa); - -const sai_macsec_api_t redis_macsec_api = { - - REDIS_GENERIC_QUAD_API(macsec) - REDIS_GENERIC_QUAD_API(macsec_port) - REDIS_GENERIC_STATS_API(macsec_port) - REDIS_GENERIC_QUAD_API(macsec_flow) - REDIS_GENERIC_STATS_API(macsec_flow) - REDIS_GENERIC_QUAD_API(macsec_sc) - REDIS_GENERIC_STATS_API(macsec_sc) - REDIS_GENERIC_QUAD_API(macsec_sa) - REDIS_GENERIC_STATS_API(macsec_sa) -}; diff --git a/lib/sai_redis_mcastfdb.cpp b/lib/sai_redis_mcastfdb.cpp deleted file mode 100644 index e05ada2ce..000000000 --- a/lib/sai_redis_mcastfdb.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD_ENTRY(MCAST_FDB_ENTRY,mcast_fdb_entry); - -const sai_mcast_fdb_api_t redis_mcast_fdb_api = { - - REDIS_GENERIC_QUAD_API(mcast_fdb_entry) -}; diff --git a/lib/sai_redis_mirror.cpp b/lib/sai_redis_mirror.cpp deleted file mode 100644 index 9394d225a..000000000 --- a/lib/sai_redis_mirror.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(MIRROR_SESSION,mirror_session); - -const sai_mirror_api_t redis_mirror_api = { - - REDIS_GENERIC_QUAD_API(mirror_session) -}; diff --git a/lib/sai_redis_mpls.cpp b/lib/sai_redis_mpls.cpp deleted file mode 100644 index 70eef8ae8..000000000 --- a/lib/sai_redis_mpls.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD_ENTRY(INSEG_ENTRY,inseg_entry); -REDIS_BULK_QUAD_ENTRY(INSEG_ENTRY,inseg_entry); - -const sai_mpls_api_t redis_mpls_api = { - - REDIS_GENERIC_QUAD_API(inseg_entry) - REDIS_BULK_QUAD_API(inseg_entry) -}; diff --git a/lib/sai_redis_my_mac.cpp b/lib/sai_redis_my_mac.cpp deleted file mode 100644 index 586644148..000000000 --- a/lib/sai_redis_my_mac.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(MY_MAC,my_mac); - -const sai_my_mac_api_t redis_my_mac_api = { - - REDIS_GENERIC_QUAD_API(my_mac) -}; diff --git a/lib/sai_redis_nat.cpp b/lib/sai_redis_nat.cpp deleted file mode 100644 index caf0b0038..000000000 --- a/lib/sai_redis_nat.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "sai_redis.h" - -REDIS_BULK_QUAD_ENTRY(NAT_ENTRY,nat_entry); -REDIS_GENERIC_QUAD_ENTRY(NAT_ENTRY,nat_entry); -REDIS_GENERIC_QUAD(NAT_ZONE_COUNTER,nat_zone_counter); - -const sai_nat_api_t redis_nat_api = { - - REDIS_GENERIC_QUAD_API(nat_entry) - REDIS_BULK_QUAD_API(nat_entry) - REDIS_GENERIC_QUAD_API(nat_zone_counter) -}; diff --git a/lib/sai_redis_neighbor.cpp b/lib/sai_redis_neighbor.cpp deleted file mode 100644 index e189a775c..000000000 --- a/lib/sai_redis_neighbor.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "sai_redis.h" - -static sai_status_t redis_remove_all_neighbor_entries( - _In_ sai_object_id_t switch_id) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -REDIS_BULK_QUAD_ENTRY(NEIGHBOR_ENTRY,neighbor_entry); -REDIS_GENERIC_QUAD_ENTRY(NEIGHBOR_ENTRY,neighbor_entry); - -const sai_neighbor_api_t redis_neighbor_api = { - - REDIS_GENERIC_QUAD_API(neighbor_entry) - redis_remove_all_neighbor_entries, - - REDIS_BULK_QUAD_API(neighbor_entry) -}; diff --git a/lib/sai_redis_nexthop.cpp b/lib/sai_redis_nexthop.cpp deleted file mode 100644 index 4d7a91399..000000000 --- a/lib/sai_redis_nexthop.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(NEXT_HOP,next_hop); -REDIS_BULK_QUAD(NEXT_HOP,next_hop); - -const sai_next_hop_api_t redis_next_hop_api = { - - REDIS_GENERIC_QUAD_API(next_hop) - REDIS_BULK_QUAD_API(next_hop) -}; diff --git a/lib/sai_redis_nexthopgroup.cpp b/lib/sai_redis_nexthopgroup.cpp deleted file mode 100644 index 98ac1662b..000000000 --- a/lib/sai_redis_nexthopgroup.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "sai_redis.h" - -REDIS_BULK_CREATE(NEXT_HOP_GROUP_MEMBER,next_hop_group_members); -REDIS_BULK_REMOVE(NEXT_HOP_GROUP_MEMBER,next_hop_group_members); -REDIS_BULK_GET(NEXT_HOP_GROUP_MEMBER,next_hop_group_members); -REDIS_BULK_SET(NEXT_HOP_GROUP_MEMBER,next_hop_group_members); -REDIS_GENERIC_QUAD(NEXT_HOP_GROUP,next_hop_group); -REDIS_GENERIC_QUAD(NEXT_HOP_GROUP_MEMBER,next_hop_group_member); -REDIS_GENERIC_QUAD(NEXT_HOP_GROUP_MAP,next_hop_group_map); - -const sai_next_hop_group_api_t redis_next_hop_group_api = { - - REDIS_GENERIC_QUAD_API(next_hop_group) - REDIS_GENERIC_QUAD_API(next_hop_group_member) - - redis_bulk_create_next_hop_group_members, - redis_bulk_remove_next_hop_group_members, - REDIS_GENERIC_QUAD_API(next_hop_group_map) - redis_bulk_set_next_hop_group_members, - redis_bulk_get_next_hop_group_members -}; diff --git a/lib/sai_redis_poe.cpp b/lib/sai_redis_poe.cpp deleted file mode 100644 index 9bede47fc..000000000 --- a/lib/sai_redis_poe.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(POE_DEVICE,poe_device); -REDIS_GENERIC_QUAD(POE_PSE,poe_pse); -REDIS_GENERIC_QUAD(POE_PORT,poe_port); - -const sai_poe_api_t redis_poe_api = { - - REDIS_GENERIC_QUAD_API(poe_device) - REDIS_GENERIC_QUAD_API(poe_pse) - REDIS_GENERIC_QUAD_API(poe_port) -}; diff --git a/lib/sai_redis_policer.cpp b/lib/sai_redis_policer.cpp deleted file mode 100644 index 4129c9cd4..000000000 --- a/lib/sai_redis_policer.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(POLICER,policer); -REDIS_GENERIC_STATS(POLICER,policer); - -const sai_policer_api_t redis_policer_api = { - - REDIS_GENERIC_QUAD_API(policer) - REDIS_GENERIC_STATS_API(policer) -}; diff --git a/lib/sai_redis_port.cpp b/lib/sai_redis_port.cpp deleted file mode 100644 index f6c28f35b..000000000 --- a/lib/sai_redis_port.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include "sai_redis.h" - -static sai_status_t redis_clear_port_all_stats( - _In_ sai_object_id_t port_id) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -REDIS_GENERIC_QUAD(PORT,port); -REDIS_GENERIC_QUAD(PORT_POOL,port_pool); -REDIS_GENERIC_QUAD(PORT_SERDES,port_serdes); -REDIS_GENERIC_QUAD(PORT_CONNECTOR,port_connector); -REDIS_GENERIC_STATS(PORT,port); -REDIS_GENERIC_STATS(PORT_POOL,port_pool); -REDIS_BULK_QUAD(PORT, ports); -REDIS_BULK_QUAD(PORT_SERDES, port_serdeses); - -const sai_port_api_t redis_port_api = { - - REDIS_GENERIC_QUAD_API(port) - REDIS_GENERIC_STATS_API(port) - - redis_clear_port_all_stats, - - REDIS_GENERIC_QUAD_API(port_pool) - REDIS_GENERIC_STATS_API(port_pool) - REDIS_GENERIC_QUAD_API(port_connector) - REDIS_GENERIC_QUAD_API(port_serdes) - REDIS_BULK_QUAD_API(ports) - REDIS_BULK_QUAD_API(port_serdeses) -}; diff --git a/lib/sai_redis_qosmap.cpp b/lib/sai_redis_qosmap.cpp deleted file mode 100644 index 40000eb98..000000000 --- a/lib/sai_redis_qosmap.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(QOS_MAP,qos_map); - -const sai_qos_map_api_t redis_qos_map_api = { - - REDIS_GENERIC_QUAD_API(qos_map) -}; diff --git a/lib/sai_redis_queue.cpp b/lib/sai_redis_queue.cpp deleted file mode 100644 index f05eb120a..000000000 --- a/lib/sai_redis_queue.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(QUEUE,queue); -REDIS_GENERIC_STATS(QUEUE,queue); - -const sai_queue_api_t redis_queue_api = { - - REDIS_GENERIC_QUAD_API(queue) - REDIS_GENERIC_STATS_API(queue) -}; diff --git a/lib/sai_redis_route.cpp b/lib/sai_redis_route.cpp deleted file mode 100644 index 64ab44d51..000000000 --- a/lib/sai_redis_route.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD_ENTRY(ROUTE_ENTRY,route_entry); -REDIS_BULK_QUAD_ENTRY(ROUTE_ENTRY,route_entry); - -const sai_route_api_t redis_route_api = { - - REDIS_GENERIC_QUAD_API(route_entry) - REDIS_BULK_QUAD_API(route_entry) -}; diff --git a/lib/sai_redis_router_interface.cpp b/lib/sai_redis_router_interface.cpp deleted file mode 100644 index 1e77427e7..000000000 --- a/lib/sai_redis_router_interface.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(ROUTER_INTERFACE,router_interface); -REDIS_GENERIC_STATS(ROUTER_INTERFACE,router_interface); -REDIS_BULK_QUAD(ROUTER_INTERFACE,router_interfaces); - -const sai_router_interface_api_t redis_router_interface_api = { - - REDIS_GENERIC_QUAD_API(router_interface) - REDIS_GENERIC_STATS_API(router_interface) - REDIS_BULK_QUAD_API(router_interfaces) -}; diff --git a/lib/sai_redis_rpfgroup.cpp b/lib/sai_redis_rpfgroup.cpp deleted file mode 100644 index 32b66c80d..000000000 --- a/lib/sai_redis_rpfgroup.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(RPF_GROUP,rpf_group); -REDIS_GENERIC_QUAD(RPF_GROUP_MEMBER,rpf_group_member); - -const sai_rpf_group_api_t redis_rpf_group_api = { - - REDIS_GENERIC_QUAD_API(rpf_group) - REDIS_GENERIC_QUAD_API(rpf_group_member) -}; diff --git a/lib/sai_redis_samplepacket.cpp b/lib/sai_redis_samplepacket.cpp deleted file mode 100644 index 283c72e94..000000000 --- a/lib/sai_redis_samplepacket.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(SAMPLEPACKET,samplepacket); - -const sai_samplepacket_api_t redis_samplepacket_api = { - - REDIS_GENERIC_QUAD_API(samplepacket) -}; diff --git a/lib/sai_redis_scheduler.cpp b/lib/sai_redis_scheduler.cpp deleted file mode 100644 index 854a6b831..000000000 --- a/lib/sai_redis_scheduler.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(SCHEDULER,scheduler); - -const sai_scheduler_api_t redis_scheduler_api = { - - REDIS_GENERIC_QUAD_API(scheduler) -}; diff --git a/lib/sai_redis_schedulergroup.cpp b/lib/sai_redis_schedulergroup.cpp deleted file mode 100644 index 9941d87a7..000000000 --- a/lib/sai_redis_schedulergroup.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(SCHEDULER_GROUP,scheduler_group); - -const sai_scheduler_group_api_t redis_scheduler_group_api = { - - REDIS_GENERIC_QUAD_API(scheduler_group) -}; diff --git a/lib/sai_redis_srv6.cpp b/lib/sai_redis_srv6.cpp deleted file mode 100644 index 293a35ac8..000000000 --- a/lib/sai_redis_srv6.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "sai_redis.h" - -REDIS_BULK_CREATE(SRV6_SIDLIST, srv6_sidlist); -REDIS_BULK_REMOVE(SRV6_SIDLIST, srv6_sidlist); -REDIS_GENERIC_QUAD(SRV6_SIDLIST,srv6_sidlist); -REDIS_BULK_QUAD_ENTRY(MY_SID_ENTRY,my_sid_entry); -REDIS_GENERIC_QUAD_ENTRY(MY_SID_ENTRY,my_sid_entry); - -const sai_srv6_api_t redis_srv6_api = { - - REDIS_GENERIC_QUAD_API(srv6_sidlist) - - redis_bulk_create_srv6_sidlist, - redis_bulk_remove_srv6_sidlist, - - NULL, - NULL, - NULL, - - REDIS_GENERIC_QUAD_API(my_sid_entry) - REDIS_BULK_QUAD_API(my_sid_entry) -}; diff --git a/lib/sai_redis_stp.cpp b/lib/sai_redis_stp.cpp deleted file mode 100644 index 98dd9d60b..000000000 --- a/lib/sai_redis_stp.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include "sai_redis.h" - -REDIS_BULK_CREATE(STP_PORT,stp_ports); -REDIS_BULK_REMOVE(STP_PORT,stp_ports); -REDIS_GENERIC_QUAD(STP,stp); -REDIS_GENERIC_QUAD(STP_PORT,stp_port); - -const sai_stp_api_t redis_stp_api = { - - REDIS_GENERIC_QUAD_API(stp) - REDIS_GENERIC_QUAD_API(stp_port) - - redis_bulk_create_stp_ports, - redis_bulk_remove_stp_ports, -}; diff --git a/lib/sai_redis_switch.cpp b/lib/sai_redis_switch.cpp deleted file mode 100644 index 32d227c7e..000000000 --- a/lib/sai_redis_switch.cpp +++ /dev/null @@ -1,84 +0,0 @@ -#include "sai_redis.h" - -static sai_status_t redis_switch_mdio_read( - _In_ sai_object_id_t switch_id, - _In_ uint32_t device_addr, - _In_ uint32_t start_reg_addr, - _In_ uint32_t number_of_registers, - _Out_ uint32_t *reg_val) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -static sai_status_t redis_switch_mdio_write( - _In_ sai_object_id_t switch_id, - _In_ uint32_t device_addr, - _In_ uint32_t start_reg_addr, - _In_ uint32_t number_of_registers, - _In_ const uint32_t *reg_val) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -static sai_status_t redis_switch_mdio_cl22_read( - _In_ sai_object_id_t switch_id, - _In_ uint32_t device_addr, - _In_ uint32_t start_reg_addr, - _In_ uint32_t number_of_registers, - _Out_ uint32_t *reg_val) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -static sai_status_t redis_switch_mdio_cl22_write( - _In_ sai_object_id_t switch_id, - _In_ uint32_t device_addr, - _In_ uint32_t start_reg_addr, - _In_ uint32_t number_of_registers, - _In_ const uint32_t *reg_val) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -REDIS_GENERIC_QUAD(SWITCH,switch); -REDIS_GENERIC_STATS(SWITCH,switch); -REDIS_GENERIC_QUAD(SWITCH_TUNNEL,switch_tunnel); - -static sai_status_t redis_create_switch_uniq( - _Out_ sai_object_id_t *switch_id, - _In_ uint32_t attr_count, - _In_ const sai_attribute_t *attr_list) -{ - SWSS_LOG_ENTER(); - - return redis_create_switch( - switch_id, - SAI_NULL_OBJECT_ID, // no switch id since we create switch - attr_count, - attr_list); -} - -const sai_switch_api_t redis_switch_api = { - - redis_create_switch_uniq, - redis_remove_switch, - redis_set_switch_attribute, - redis_get_switch_attribute, - - REDIS_GENERIC_STATS_API(switch) - - redis_switch_mdio_read, - redis_switch_mdio_write, - - REDIS_GENERIC_QUAD_API(switch_tunnel) - redis_switch_mdio_cl22_read, - redis_switch_mdio_cl22_write -}; diff --git a/lib/sai_redis_system_port.cpp b/lib/sai_redis_system_port.cpp deleted file mode 100644 index 0514fd723..000000000 --- a/lib/sai_redis_system_port.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(SYSTEM_PORT,system_port); - -const sai_system_port_api_t redis_system_port_api = { - - REDIS_GENERIC_QUAD_API(system_port) -}; diff --git a/lib/sai_redis_tam.cpp b/lib/sai_redis_tam.cpp deleted file mode 100644 index 9698af33d..000000000 --- a/lib/sai_redis_tam.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include "sai_redis.h" - -sai_status_t sai_tam_telemetry_get_data( - _In_ sai_object_id_t switch_id, - _In_ sai_object_list_t obj_list, - _In_ bool clear_on_read, - _Inout_ sai_size_t *buffer_size, - _Out_ void *buffer) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -REDIS_GENERIC_QUAD(TAM,tam); -REDIS_GENERIC_QUAD(TAM_MATH_FUNC,tam_math_func); -REDIS_GENERIC_QUAD(TAM_REPORT,tam_report); -REDIS_GENERIC_QUAD(TAM_EVENT_THRESHOLD,tam_event_threshold); -REDIS_GENERIC_QUAD(TAM_INT,tam_int); -REDIS_GENERIC_QUAD(TAM_TEL_TYPE,tam_tel_type); -REDIS_GENERIC_QUAD(TAM_TRANSPORT,tam_transport); -REDIS_GENERIC_QUAD(TAM_TELEMETRY,tam_telemetry); -REDIS_GENERIC_QUAD(TAM_COLLECTOR,tam_collector); -REDIS_GENERIC_QUAD(TAM_EVENT_ACTION,tam_event_action); -REDIS_GENERIC_QUAD(TAM_EVENT,tam_event); -REDIS_GENERIC_QUAD(TAM_COUNTER_SUBSCRIPTION,tam_counter_subscription); - -const sai_tam_api_t redis_tam_api = { - - REDIS_GENERIC_QUAD_API(tam) - REDIS_GENERIC_QUAD_API(tam_math_func) - REDIS_GENERIC_QUAD_API(tam_report) - REDIS_GENERIC_QUAD_API(tam_event_threshold) - REDIS_GENERIC_QUAD_API(tam_int) - REDIS_GENERIC_QUAD_API(tam_tel_type) - REDIS_GENERIC_QUAD_API(tam_transport) - REDIS_GENERIC_QUAD_API(tam_telemetry) - REDIS_GENERIC_QUAD_API(tam_collector) - REDIS_GENERIC_QUAD_API(tam_event_action) - REDIS_GENERIC_QUAD_API(tam_event) - REDIS_GENERIC_QUAD_API(tam_counter_subscription) -}; diff --git a/lib/sai_redis_tunnel.cpp b/lib/sai_redis_tunnel.cpp deleted file mode 100644 index 2807a6b84..000000000 --- a/lib/sai_redis_tunnel.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(TUNNEL_MAP,tunnel_map); -REDIS_GENERIC_QUAD(TUNNEL,tunnel); -REDIS_GENERIC_QUAD(TUNNEL_TERM_TABLE_ENTRY,tunnel_term_table_entry); -REDIS_GENERIC_QUAD(TUNNEL_MAP_ENTRY,tunnel_map_entry); -REDIS_GENERIC_STATS(TUNNEL,tunnel); -REDIS_BULK_QUAD(TUNNEL,tunnels); - -const sai_tunnel_api_t redis_tunnel_api = { - - REDIS_GENERIC_QUAD_API(tunnel_map) - REDIS_GENERIC_QUAD_API(tunnel) - REDIS_GENERIC_STATS_API(tunnel) - REDIS_GENERIC_QUAD_API(tunnel_term_table_entry) - REDIS_GENERIC_QUAD_API(tunnel_map_entry) - REDIS_BULK_QUAD_API(tunnels) -}; diff --git a/lib/sai_redis_twamp.cpp b/lib/sai_redis_twamp.cpp deleted file mode 100644 index 83e1c4cf4..000000000 --- a/lib/sai_redis_twamp.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(TWAMP_SESSION,twamp_session); -REDIS_GENERIC_STATS(TWAMP_SESSION,twamp_session); - -const sai_twamp_api_t redis_twamp_api = { - REDIS_GENERIC_QUAD_API(twamp_session) - REDIS_GENERIC_STATS_API(twamp_session) -}; diff --git a/lib/sai_redis_udf.cpp b/lib/sai_redis_udf.cpp deleted file mode 100644 index fdfaf8979..000000000 --- a/lib/sai_redis_udf.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(UDF,udf) -REDIS_GENERIC_QUAD(UDF_MATCH,udf_match) -REDIS_GENERIC_QUAD(UDF_GROUP,udf_group) - -const sai_udf_api_t redis_udf_api = { - - REDIS_GENERIC_QUAD_API(udf) - REDIS_GENERIC_QUAD_API(udf_match) - REDIS_GENERIC_QUAD_API(udf_group) -}; diff --git a/lib/sai_redis_virtual_router.cpp b/lib/sai_redis_virtual_router.cpp deleted file mode 100644 index 814c0461f..000000000 --- a/lib/sai_redis_virtual_router.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(VIRTUAL_ROUTER,virtual_router); - -const sai_virtual_router_api_t redis_virtual_router_api = { - - REDIS_GENERIC_QUAD_API(virtual_router) -}; diff --git a/lib/sai_redis_vlan.cpp b/lib/sai_redis_vlan.cpp deleted file mode 100644 index cc34a44db..000000000 --- a/lib/sai_redis_vlan.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "sai_redis.h" - -REDIS_BULK_CREATE(VLAN_MEMBER,vlan_members); -REDIS_BULK_REMOVE(VLAN_MEMBER,vlan_members); -REDIS_GENERIC_QUAD(VLAN,vlan); -REDIS_GENERIC_QUAD(VLAN_MEMBER,vlan_member); -REDIS_GENERIC_STATS(VLAN,vlan); - -const sai_vlan_api_t redis_vlan_api = { - - REDIS_GENERIC_QUAD_API(vlan) - REDIS_GENERIC_QUAD_API(vlan_member) - - redis_bulk_create_vlan_members, - redis_bulk_remove_vlan_members, - - REDIS_GENERIC_STATS_API(vlan) -}; diff --git a/lib/sai_redis_wred.cpp b/lib/sai_redis_wred.cpp deleted file mode 100644 index 70c300b50..000000000 --- a/lib/sai_redis_wred.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_redis.h" - -REDIS_GENERIC_QUAD(WRED,wred); - -const sai_wred_api_t redis_wred_api = { - - REDIS_GENERIC_QUAD_API(wred) -}; diff --git a/lib/tests.cpp b/lib/tests.cpp index 355f3e1de..eb3d9ad70 100644 --- a/lib/tests.cpp +++ b/lib/tests.cpp @@ -789,7 +789,7 @@ static void test_recorder_enum_value_capability_query_request( sai_s32_list_t enum_values_capability { .count = 0, .list = nullptr }; - recorder.recordQueryAattributeEnumValuesCapability( + recorder.recordQueryAttributeEnumValuesCapability( switch_id, object_type, attr_id, @@ -821,7 +821,7 @@ static void test_recorder_enum_value_capability_query_response( enum_values_capability.count = static_cast(enumList.size()); enum_values_capability.list = enumList.data(); - recorder.recordQueryAattributeEnumValuesCapabilityResponse( + recorder.recordQueryAttributeEnumValuesCapabilityResponse( status, object_type, attr_id, diff --git a/meta/DummySaiInterface.cpp b/meta/DummySaiInterface.cpp index db5781457..c1671c9d6 100644 --- a/meta/DummySaiInterface.cpp +++ b/meta/DummySaiInterface.cpp @@ -21,7 +21,7 @@ void DummySaiInterface::setStatus( m_status = status; } -sai_status_t DummySaiInterface::initialize( +sai_status_t DummySaiInterface::apiInitialize( _In_ uint64_t flags, _In_ const sai_service_method_table_t *service_method_table) { @@ -30,7 +30,7 @@ sai_status_t DummySaiInterface::initialize( return SAI_STATUS_SUCCESS; } -sai_status_t DummySaiInterface::uninitialize(void) +sai_status_t DummySaiInterface::apiUninitialize(void) { SWSS_LOG_ENTER(); @@ -158,6 +158,22 @@ sai_status_t DummySaiInterface::bulkSet( \ return m_status; \ } +#define DECLARE_BULK_GET_ENTRY(OT,ot) \ +sai_status_t DummySaiInterface::bulkGet( \ + _In_ uint32_t object_count, \ + _In_ const sai_ ## ot ## _t *ot, \ + _In_ const uint32_t *attr_count, \ + _Inout_ sai_attribute_t **attr_list, \ + _In_ sai_bulk_op_error_mode_t mode, \ + _Out_ sai_status_t *object_statuses) \ +{ \ + SWSS_LOG_ENTER(); \ + SWSS_LOG_ERROR("FIXME not implemented"); \ + return SAI_STATUS_NOT_IMPLEMENTED; \ +} + +// NON QUAD API + SAIREDIS_DECLARE_EVERY_ENTRY(DECLARE_REMOVE_ENTRY); SAIREDIS_DECLARE_EVERY_ENTRY(DECLARE_CREATE_ENTRY); SAIREDIS_DECLARE_EVERY_ENTRY(DECLARE_SET_ENTRY); @@ -165,6 +181,7 @@ SAIREDIS_DECLARE_EVERY_ENTRY(DECLARE_GET_ENTRY); SAIREDIS_DECLARE_EVERY_BULK_ENTRY(DECLARE_BULK_CREATE_ENTRY); SAIREDIS_DECLARE_EVERY_BULK_ENTRY(DECLARE_BULK_REMOVE_ENTRY); SAIREDIS_DECLARE_EVERY_BULK_ENTRY(DECLARE_BULK_SET_ENTRY); +SAIREDIS_DECLARE_EVERY_BULK_ENTRY(DECLARE_BULK_GET_ENTRY); sai_status_t DummySaiInterface::flushFdbEntries( _In_ sai_object_id_t switchId, @@ -247,7 +264,7 @@ sai_status_t DummySaiInterface::queryAttributeCapability( return m_status; } -sai_status_t DummySaiInterface::queryAattributeEnumValuesCapability( +sai_status_t DummySaiInterface::queryAttributeEnumValuesCapability( _In_ sai_object_id_t switchId, _In_ sai_object_type_t objectType, _In_ sai_attr_id_t attrId, @@ -279,7 +296,7 @@ sai_status_t DummySaiInterface::queryStatsCapability( { SWSS_LOG_ENTER(); - return SAI_STATUS_NOT_IMPLEMENTED; + return m_status; } sai_status_t DummySaiInterface::getStatsExt( @@ -370,6 +387,22 @@ sai_status_t DummySaiInterface::bulkSet( return m_status; } +sai_status_t DummySaiInterface::bulkGet( + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_id_t *object_id, + _In_ const uint32_t *attr_count, + _Inout_ sai_attribute_t **attr_list, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses) +{ + SWSS_LOG_ENTER(); + + SWSS_LOG_ERROR("not implemented, FIXME"); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + sai_status_t DummySaiInterface::bulkCreate( _In_ sai_object_type_t object_type, _In_ sai_object_id_t switch_id, diff --git a/meta/DummySaiInterface.h b/meta/DummySaiInterface.h index 0664bf7df..d6e8d748d 100644 --- a/meta/DummySaiInterface.h +++ b/meta/DummySaiInterface.h @@ -27,11 +27,11 @@ namespace saimeta public: - virtual sai_status_t initialize( + virtual sai_status_t apiInitialize( _In_ uint64_t flags, _In_ const sai_service_method_table_t *service_method_table) override; - virtual sai_status_t uninitialize(void) override; + virtual sai_status_t apiUninitialize(void) override; public: // SAI interface overrides @@ -89,6 +89,15 @@ namespace saimeta _In_ sai_bulk_op_error_mode_t mode, _Out_ sai_status_t *object_statuses) override; + virtual sai_status_t bulkGet( + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_id_t *object_id, + _In_ const uint32_t *attr_count, + _Inout_ sai_attribute_t **attr_list, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses) override; + public: // stats API virtual sai_status_t getStats( @@ -188,7 +197,7 @@ namespace saimeta _In_ sai_attr_id_t attr_id, _Out_ sai_attr_capability_t *capability) override; - virtual sai_status_t queryAattributeEnumValuesCapability( + virtual sai_status_t queryAttributeEnumValuesCapability( _In_ sai_object_id_t switch_id, _In_ sai_object_type_t object_type, _In_ sai_attr_id_t attr_id, diff --git a/meta/Meta.cpp b/meta/Meta.cpp index 1237065a8..d6a9f4526 100644 --- a/meta/Meta.cpp +++ b/meta/Meta.cpp @@ -146,20 +146,20 @@ Meta::Meta( m_warmBoot = false; } -sai_status_t Meta::initialize( +sai_status_t Meta::apiInitialize( _In_ uint64_t flags, _In_ const sai_service_method_table_t *service_method_table) { SWSS_LOG_ENTER(); - return m_implementation->initialize(flags, service_method_table); + return m_implementation->apiInitialize(flags, service_method_table); } -sai_status_t Meta::uninitialize(void) +sai_status_t Meta::apiUninitialize(void) { SWSS_LOG_ENTER(); - return m_implementation->uninitialize(); + return m_implementation->apiUninitialize(); } void Meta::meta_warm_boot_notify() @@ -723,9 +723,26 @@ sai_status_t Meta::bulkSet( return status; \ } +// BULK GET + +#define DECLARE_BULK_GET_ENTRY(OT,ot) \ +sai_status_t Meta::bulkGet( \ + _In_ uint32_t object_count, \ + _In_ const sai_ ## ot ## _t *ot, \ + _In_ const uint32_t *attr_count, \ + _Inout_ sai_attribute_t **attr_list, \ + _In_ sai_bulk_op_error_mode_t mode, \ + _Out_ sai_status_t *object_statuses) \ +{ \ + SWSS_LOG_ENTER(); \ + SWSS_LOG_ERROR("FIXME not implemented"); \ + return SAI_STATUS_NOT_IMPLEMENTED; \ +} + SAIREDIS_DECLARE_EVERY_BULK_ENTRY(DECLARE_BULK_CREATE_ENTRY); SAIREDIS_DECLARE_EVERY_BULK_ENTRY(DECLARE_BULK_REMOVE_ENTRY); SAIREDIS_DECLARE_EVERY_BULK_ENTRY(DECLARE_BULK_SET_ENTRY); +SAIREDIS_DECLARE_EVERY_BULK_ENTRY(DECLARE_BULK_GET_ENTRY); sai_status_t Meta::objectTypeGetAvailability( _In_ sai_object_id_t switchId, @@ -854,7 +871,7 @@ sai_status_t Meta::queryAttributeCapability( return status; } -sai_status_t Meta::queryAattributeEnumValuesCapability( +sai_status_t Meta::queryAttributeEnumValuesCapability( _In_ sai_object_id_t switchId, _In_ sai_object_type_t objectType, _In_ sai_attr_id_t attrId, @@ -892,7 +909,7 @@ sai_status_t Meta::queryAattributeEnumValuesCapability( return SAI_STATUS_INVALID_PARAMETER; } - auto status = m_implementation->queryAattributeEnumValuesCapability(switchId, objectType, attrId, enumValuesCapability); + auto status = m_implementation->queryAttributeEnumValuesCapability(switchId, objectType, attrId, enumValuesCapability); if (status == SAI_STATUS_SUCCESS) { @@ -1252,6 +1269,22 @@ sai_status_t Meta::bulkSet( return status; } +sai_status_t Meta::bulkGet( + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_id_t *object_id, + _In_ const uint32_t *attr_count, + _Inout_ sai_attribute_t **attr_list, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses) +{ + SWSS_LOG_ENTER(); + + SWSS_LOG_ERROR("not implemented, FIXME"); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + sai_status_t Meta::bulkCreate( _In_ sai_object_type_t object_type, _In_ sai_object_id_t switchId, diff --git a/meta/Meta.h b/meta/Meta.h index 3e0d97e41..12dbf3aa7 100644 --- a/meta/Meta.h +++ b/meta/Meta.h @@ -34,11 +34,11 @@ namespace saimeta public: - virtual sai_status_t initialize( + virtual sai_status_t apiInitialize( _In_ uint64_t flags, _In_ const sai_service_method_table_t *service_method_table) override; - virtual sai_status_t uninitialize(void) override; + virtual sai_status_t apiUninitialize(void) override; public: // SAI interface overrides @@ -96,6 +96,15 @@ namespace saimeta _In_ sai_bulk_op_error_mode_t mode, _Out_ sai_status_t *object_statuses) override; + virtual sai_status_t bulkGet( + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_id_t *object_id, + _In_ const uint32_t *attr_count, + _Inout_ sai_attribute_t **attr_list, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses) override; + public: // stats API virtual sai_status_t getStats( @@ -167,7 +176,7 @@ namespace saimeta _In_ sai_attr_id_t attr_id, _Out_ sai_attr_capability_t *capability) override; - virtual sai_status_t queryAattributeEnumValuesCapability( + virtual sai_status_t queryAttributeEnumValuesCapability( _In_ sai_object_id_t switch_id, _In_ sai_object_type_t object_type, _In_ sai_attr_id_t attr_id, diff --git a/meta/SaiInterface.h b/meta/SaiInterface.h index 4c42f0aaf..d45e0b974 100644 --- a/meta/SaiInterface.h +++ b/meta/SaiInterface.h @@ -87,6 +87,13 @@ extern "C" { _In_ const sai_attribute_t *attr_list, \ _In_ sai_bulk_op_error_mode_t mode, \ _Out_ sai_status_t *object_statuses) = 0; \ + virtual sai_status_t bulkGet( \ + _In_ uint32_t object_count, \ + _In_ const sai_ ## ot ## _t *ot, \ + _In_ const uint32_t *attr_count, \ + _Inout_ sai_attribute_t **attr_list, \ + _In_ sai_bulk_op_error_mode_t mode, \ + _Out_ sai_status_t *object_statuses) = 0; \ #define SAIREDIS_SAIINTERFACE_DECLARE_BULK_ENTRY_OVERRIDE(OT,ot) \ virtual sai_status_t bulkCreate( \ @@ -107,6 +114,13 @@ extern "C" { _In_ const sai_attribute_t *attr_list, \ _In_ sai_bulk_op_error_mode_t mode, \ _Out_ sai_status_t *object_statuses) override; \ + virtual sai_status_t bulkGet( \ + _In_ uint32_t object_count, \ + _In_ const sai_ ## ot ## _t *ot, \ + _In_ const uint32_t *attr_count, \ + _Inout_ sai_attribute_t **attr_list, \ + _In_ sai_bulk_op_error_mode_t mode, \ + _Out_ sai_status_t *object_statuses) override; \ namespace sairedis { @@ -120,11 +134,11 @@ namespace sairedis public: - virtual sai_status_t initialize( + virtual sai_status_t apiInitialize( _In_ uint64_t flags, _In_ const sai_service_method_table_t *service_method_table) = 0; - virtual sai_status_t uninitialize(void) = 0; + virtual sai_status_t apiUninitialize(void) = 0; public: // QUAD oid @@ -182,6 +196,15 @@ namespace sairedis _In_ sai_bulk_op_error_mode_t mode, _Out_ sai_status_t *object_statuses) = 0; + virtual sai_status_t bulkGet( + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_id_t *object_id, + _In_ const uint32_t *attr_count, + _Inout_ sai_attribute_t **attr_list, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses) = 0; + public: // QUAD meta key virtual sai_status_t create( @@ -301,7 +324,7 @@ namespace sairedis _In_ sai_attr_id_t attr_id, _Out_ sai_attr_capability_t *capability) = 0; - virtual sai_status_t queryAattributeEnumValuesCapability( + virtual sai_status_t queryAttributeEnumValuesCapability( _In_ sai_object_id_t switch_id, _In_ sai_object_type_t object_type, _In_ sai_attr_id_t attr_id, diff --git a/proxylib/Makefile.am b/proxylib/Makefile.am index f0aecef41..87738f77a 100644 --- a/proxylib/Makefile.am +++ b/proxylib/Makefile.am @@ -7,70 +7,15 @@ noinst_LIBRARIES = libSaiProxy.a libSaiProxy_a_SOURCES = \ Sai.cpp -libsaiproxy_la_SOURCES = \ - sai_proxy_acl.cpp \ - sai_proxy_bfd.cpp \ - sai_proxy_bmtor.cpp \ - sai_proxy_bridge.cpp \ - sai_proxy_buffer.cpp \ - sai_proxy_counter.cpp \ - sai_proxy_dash_vip.cpp \ - sai_proxy_dash_pa_validation.cpp \ - sai_proxy_dash_vnet.cpp \ - sai_proxy_dash_outbound_routing.cpp \ - sai_proxy_dash_outbound_ca_to_pa.cpp \ - sai_proxy_dash_inbound_routing.cpp \ - sai_proxy_dash_eni.cpp \ - sai_proxy_dash_direction_lookup.cpp \ - sai_proxy_dash_acl.cpp \ - sai_proxy_debug_counter.cpp \ - sai_proxy_dtel.cpp \ - sai_proxy_fdb.cpp \ - sai_proxy_genericprogrammable.cpp \ - sai_proxy_hash.cpp \ - sai_proxy_hostif.cpp \ - sai_proxy_interfacequery.cpp \ - sai_proxy_ipmc.cpp \ - sai_proxy_ipmc_group.cpp \ - sai_proxy_isolation_group.cpp \ - sai_proxy_l2mc.cpp \ - sai_proxy_l2mcgroup.cpp \ - sai_proxy_lag.cpp \ - sai_proxy_macsec.cpp \ - sai_proxy_mcastfdb.cpp \ - sai_proxy_mirror.cpp \ - sai_proxy_mpls.cpp \ - sai_proxy_nat.cpp \ - sai_proxy_neighbor.cpp \ - sai_proxy_nexthop.cpp \ - sai_proxy_nexthopgroup.cpp \ - sai_proxy_policer.cpp \ - sai_proxy_port.cpp \ - sai_proxy_qosmap.cpp \ - sai_proxy_queue.cpp \ - sai_proxy_route.cpp \ - sai_proxy_router_interface.cpp \ - sai_proxy_rpfgroup.cpp \ - sai_proxy_samplepacket.cpp \ - sai_proxy_scheduler.cpp \ - sai_proxy_schedulergroup.cpp \ - sai_proxy_srv6.cpp \ - sai_proxy_stp.cpp \ - sai_proxy_switch.cpp \ - sai_proxy_system_port.cpp \ - sai_proxy_tam.cpp \ - sai_proxy_tunnel.cpp \ - sai_proxy_udf.cpp \ - sai_proxy_virtual_router.cpp \ - sai_proxy_vlan.cpp \ - sai_proxy_wred.cpp \ - sai_proxy_ipsec.cpp \ - sai_proxy_my_mac.cpp \ - sai_proxy_ars.cpp \ - sai_proxy_ars_profile.cpp \ - sai_proxy_twamp.cpp \ - sai_proxy_poe.cpp \ - sai_proxy_dash_meter.cpp +BUILT_SOURCES = sai_proxy.cpp + +sai_proxy.cpp: $(top_srcdir)/SAI/meta/saimetadata.c ../stub.pl + ../stub.pl -d ../SAI/ -c Sai -n saiproxy -f sai_proxy.cpp -s stub + +clean-local: + rm -f sai_proxy.cpp + +libsaiproxy_la_SOURCES = sai_proxy.cpp libSaiProxy_a_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS) libSaiProxy_a_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) $(CODE_COVERAGE_CXXFLAGS) diff --git a/proxylib/Sai.cpp b/proxylib/Sai.cpp index 94febf931..834c9be38 100644 --- a/proxylib/Sai.cpp +++ b/proxylib/Sai.cpp @@ -30,13 +30,13 @@ Sai::~Sai() if (m_apiInitialized) { - uninitialize(); + apiUninitialize(); } } // INITIALIZE UNINITIALIZE -sai_status_t Sai::initialize( +sai_status_t Sai::apiInitialize( _In_ uint64_t flags, _In_ const sai_service_method_table_t *service_method_table) { @@ -80,7 +80,7 @@ sai_status_t Sai::initialize( return SAI_STATUS_SUCCESS; } -sai_status_t Sai::uninitialize(void) +sai_status_t Sai::apiUninitialize(void) { SWSS_LOG_ENTER(); PROXY_CHECK_API_INITIALIZED(); @@ -373,6 +373,23 @@ sai_status_t Sai::bulkSet( return SAI_STATUS_NOT_IMPLEMENTED; } +sai_status_t Sai::bulkGet( + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_id_t *object_id, + _In_ const uint32_t *attr_count, + _Inout_ sai_attribute_t **attr_list, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses) +{ + MUTEX(); + SWSS_LOG_ENTER(); + + SWSS_LOG_ERROR("not implemented, FIXME"); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + // BULK QUAD ENTRY #define DECLARE_BULK_CREATE_ENTRY(OT,ot) \ @@ -433,6 +450,25 @@ sai_status_t Sai::bulkSet( \ SAIREDIS_DECLARE_EVERY_BULK_ENTRY(DECLARE_BULK_SET_ENTRY); +// BULK GET + +#define DECLARE_BULK_GET_ENTRY(OT,ot) \ +sai_status_t Sai::bulkGet( \ + _In_ uint32_t object_count, \ + _In_ const sai_ ## ot ## _t *ot, \ + _In_ const uint32_t *attr_count, \ + _Inout_ sai_attribute_t **attr_list, \ + _In_ sai_bulk_op_error_mode_t mode, \ + _Out_ sai_status_t *object_statuses) \ +{ \ + MUTEX(); \ + SWSS_LOG_ENTER(); \ + SWSS_LOG_ERROR("FIXME not implemented"); \ + return SAI_STATUS_NOT_IMPLEMENTED; \ +} + +SAIREDIS_DECLARE_EVERY_BULK_ENTRY(DECLARE_BULK_GET_ENTRY); + // NON QUAD API sai_status_t Sai::flushFdbEntries( @@ -482,7 +518,7 @@ sai_status_t Sai::queryAttributeCapability( return SAI_STATUS_NOT_IMPLEMENTED; } -sai_status_t Sai::queryAattributeEnumValuesCapability( +sai_status_t Sai::queryAttributeEnumValuesCapability( _In_ sai_object_id_t switch_id, _In_ sai_object_type_t object_type, _In_ sai_attr_id_t attr_id, diff --git a/proxylib/Sai.h b/proxylib/Sai.h index 7f35f5092..f7dfe28a0 100644 --- a/proxylib/Sai.h +++ b/proxylib/Sai.h @@ -25,11 +25,11 @@ namespace saiproxy public: - sai_status_t initialize( + sai_status_t apiInitialize( _In_ uint64_t flags, _In_ const sai_service_method_table_t *service_method_table) override; - sai_status_t uninitialize(void) override; + sai_status_t apiUninitialize(void) override; public: // SAI interface overrides @@ -87,6 +87,15 @@ namespace saiproxy _In_ sai_bulk_op_error_mode_t mode, _Out_ sai_status_t *object_statuses) override; + virtual sai_status_t bulkGet( + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_id_t *object_id, + _In_ const uint32_t *attr_count, + _Inout_ sai_attribute_t **attr_list, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses) override; + public: // stats API virtual sai_status_t getStats( @@ -158,7 +167,7 @@ namespace saiproxy _In_ sai_attr_id_t attr_id, _Out_ sai_attr_capability_t *capability) override; - virtual sai_status_t queryAattributeEnumValuesCapability( + virtual sai_status_t queryAttributeEnumValuesCapability( _In_ sai_object_id_t switch_id, _In_ sai_object_type_t object_type, _In_ sai_attr_id_t attr_id, diff --git a/proxylib/sai_proxy_acl.cpp b/proxylib/sai_proxy_acl.cpp deleted file mode 100644 index c5f653077..000000000 --- a/proxylib/sai_proxy_acl.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(ACL_TABLE,acl_table); -PROXY_GENERIC_QUAD(ACL_ENTRY,acl_entry); -PROXY_GENERIC_QUAD(ACL_COUNTER,acl_counter); -PROXY_GENERIC_QUAD(ACL_RANGE,acl_range); -PROXY_GENERIC_QUAD(ACL_TABLE_GROUP,acl_table_group); -PROXY_GENERIC_QUAD(ACL_TABLE_GROUP_MEMBER,acl_table_group_member); -PROXY_GENERIC_QUAD(ACL_TABLE_CHAIN_GROUP,acl_table_chain_group) - -const sai_acl_api_t proxy_acl_api = { - - PROXY_GENERIC_QUAD_API(acl_table) - PROXY_GENERIC_QUAD_API(acl_entry) - PROXY_GENERIC_QUAD_API(acl_counter) - PROXY_GENERIC_QUAD_API(acl_range) - PROXY_GENERIC_QUAD_API(acl_table_group) - PROXY_GENERIC_QUAD_API(acl_table_group_member) - PROXY_GENERIC_QUAD_API(acl_table_chain_group) -}; diff --git a/proxylib/sai_proxy_ars.cpp b/proxylib/sai_proxy_ars.cpp deleted file mode 100644 index 34f49a48d..000000000 --- a/proxylib/sai_proxy_ars.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(ARS, ars); - -const sai_ars_api_t proxy_ars_api = { - PROXY_GENERIC_QUAD_API(ars) -}; diff --git a/proxylib/sai_proxy_ars_profile.cpp b/proxylib/sai_proxy_ars_profile.cpp deleted file mode 100644 index e707130c5..000000000 --- a/proxylib/sai_proxy_ars_profile.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_proxy.h" - - -PROXY_GENERIC_QUAD(ARS_PROFILE, ars_profile); - -const sai_ars_profile_api_t proxy_ars_profile_api = { - PROXY_GENERIC_QUAD_API(ars_profile) -}; diff --git a/proxylib/sai_proxy_bfd.cpp b/proxylib/sai_proxy_bfd.cpp deleted file mode 100644 index 1d364e1bb..000000000 --- a/proxylib/sai_proxy_bfd.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(BFD_SESSION,bfd_session); -PROXY_GENERIC_STATS(BFD_SESSION,bfd_session); - -const sai_bfd_api_t proxy_bfd_api = { - - PROXY_GENERIC_QUAD_API(bfd_session) - PROXY_GENERIC_STATS_API(bfd_session) -}; diff --git a/proxylib/sai_proxy_bmtor.cpp b/proxylib/sai_proxy_bmtor.cpp deleted file mode 100644 index 87ab996b2..000000000 --- a/proxylib/sai_proxy_bmtor.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(TABLE_BITMAP_CLASSIFICATION_ENTRY,table_bitmap_classification_entry); -PROXY_GENERIC_STATS(TABLE_BITMAP_CLASSIFICATION_ENTRY,table_bitmap_classification_entry); -PROXY_GENERIC_QUAD(TABLE_BITMAP_ROUTER_ENTRY,table_bitmap_router_entry); -PROXY_GENERIC_STATS(TABLE_BITMAP_ROUTER_ENTRY,table_bitmap_router_entry); -PROXY_GENERIC_QUAD(TABLE_META_TUNNEL_ENTRY,table_meta_tunnel_entry); -PROXY_GENERIC_STATS(TABLE_META_TUNNEL_ENTRY,table_meta_tunnel_entry); - -const sai_bmtor_api_t proxy_bmtor_api = { - - PROXY_GENERIC_QUAD_API(table_bitmap_classification_entry) - PROXY_GENERIC_STATS_API(table_bitmap_classification_entry) - PROXY_GENERIC_QUAD_API(table_bitmap_router_entry) - PROXY_GENERIC_STATS_API(table_bitmap_router_entry) - PROXY_GENERIC_QUAD_API(table_meta_tunnel_entry) - PROXY_GENERIC_STATS_API(table_meta_tunnel_entry) -}; diff --git a/proxylib/sai_proxy_bridge.cpp b/proxylib/sai_proxy_bridge.cpp deleted file mode 100644 index 6fd48a789..000000000 --- a/proxylib/sai_proxy_bridge.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(BRIDGE,bridge); -PROXY_GENERIC_QUAD(BRIDGE_PORT,bridge_port); -PROXY_GENERIC_STATS(BRIDGE,bridge); -PROXY_GENERIC_STATS(BRIDGE_PORT,bridge_port); - -const sai_bridge_api_t proxy_bridge_api = { - - PROXY_GENERIC_QUAD_API(bridge) - PROXY_GENERIC_STATS_API(bridge) - PROXY_GENERIC_QUAD_API(bridge_port) - PROXY_GENERIC_STATS_API(bridge_port) -}; diff --git a/proxylib/sai_proxy_buffer.cpp b/proxylib/sai_proxy_buffer.cpp deleted file mode 100644 index 593e42532..000000000 --- a/proxylib/sai_proxy_buffer.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(BUFFER_POOL,buffer_pool); -PROXY_GENERIC_QUAD(INGRESS_PRIORITY_GROUP,ingress_priority_group); -PROXY_GENERIC_QUAD(BUFFER_PROFILE,buffer_profile); -PROXY_GENERIC_STATS(BUFFER_POOL,buffer_pool); -PROXY_GENERIC_STATS(INGRESS_PRIORITY_GROUP,ingress_priority_group); - -const sai_buffer_api_t proxy_buffer_api = { - - PROXY_GENERIC_QUAD_API(buffer_pool) - PROXY_GENERIC_STATS_API(buffer_pool) - PROXY_GENERIC_QUAD_API(ingress_priority_group) - PROXY_GENERIC_STATS_API(ingress_priority_group) - PROXY_GENERIC_QUAD_API(buffer_profile) -}; diff --git a/proxylib/sai_proxy_counter.cpp b/proxylib/sai_proxy_counter.cpp deleted file mode 100644 index 8a300b55c..000000000 --- a/proxylib/sai_proxy_counter.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(COUNTER,counter); -PROXY_GENERIC_STATS(COUNTER,counter); - -const sai_counter_api_t proxy_counter_api = { - - PROXY_GENERIC_QUAD_API(counter) - PROXY_GENERIC_STATS_API(counter) -}; diff --git a/proxylib/sai_proxy_dash_acl.cpp b/proxylib/sai_proxy_dash_acl.cpp deleted file mode 100644 index 465480695..000000000 --- a/proxylib/sai_proxy_dash_acl.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(DASH_ACL_GROUP, dash_acl_group); -PROXY_BULK_CREATE(DASH_ACL_GROUP, dash_acl_groups); -PROXY_BULK_REMOVE(DASH_ACL_GROUP, dash_acl_groups); - -PROXY_GENERIC_QUAD(DASH_ACL_RULE, dash_acl_rule); -PROXY_BULK_CREATE(DASH_ACL_RULE, dash_acl_rules); -PROXY_BULK_REMOVE(DASH_ACL_RULE, dash_acl_rules); - -const sai_dash_acl_api_t proxy_dash_acl_api = { - PROXY_GENERIC_QUAD_API(dash_acl_group) - proxy_bulk_create_dash_acl_groups, - proxy_bulk_remove_dash_acl_groups, - - PROXY_GENERIC_QUAD_API(dash_acl_rule) - proxy_bulk_create_dash_acl_rules, - proxy_bulk_remove_dash_acl_rules, -}; diff --git a/proxylib/sai_proxy_dash_direction_lookup.cpp b/proxylib/sai_proxy_dash_direction_lookup.cpp deleted file mode 100644 index cb3a62c92..000000000 --- a/proxylib/sai_proxy_dash_direction_lookup.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD_ENTRY(DIRECTION_LOOKUP_ENTRY, direction_lookup_entry); -PROXY_BULK_CREATE_ENTRY_EX(DIRECTION_LOOKUP_ENTRY, direction_lookup_entry, direction_lookup_entries); -PROXY_BULK_REMOVE_ENTRY_EX(DIRECTION_LOOKUP_ENTRY, direction_lookup_entry, direction_lookup_entries); - -const sai_dash_direction_lookup_api_t proxy_dash_direction_lookup_api = { - PROXY_GENERIC_QUAD_API(direction_lookup_entry) - proxy_bulk_create_direction_lookup_entries, - proxy_bulk_remove_direction_lookup_entries, -}; diff --git a/proxylib/sai_proxy_dash_eni.cpp b/proxylib/sai_proxy_dash_eni.cpp deleted file mode 100644 index d6fe985d4..000000000 --- a/proxylib/sai_proxy_dash_eni.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD_ENTRY(ENI_ETHER_ADDRESS_MAP_ENTRY, eni_ether_address_map_entry); -PROXY_BULK_CREATE_ENTRY_EX(ENI_ETHER_ADDRESS_MAP_ENTRY, eni_ether_address_map_entry, eni_ether_address_map_entries); -PROXY_BULK_REMOVE_ENTRY_EX(ENI_ETHER_ADDRESS_MAP_ENTRY, eni_ether_address_map_entry, eni_ether_address_map_entries); - -PROXY_GENERIC_QUAD(ENI, eni); -PROXY_GENERIC_STATS(ENI, eni); -PROXY_BULK_CREATE(ENI, enis); -PROXY_BULK_REMOVE(ENI, enis); - -const sai_dash_eni_api_t proxy_dash_eni_api = { - PROXY_GENERIC_QUAD_API(eni_ether_address_map_entry) - proxy_bulk_create_eni_ether_address_map_entries, - proxy_bulk_remove_eni_ether_address_map_entries, - - PROXY_GENERIC_QUAD_API(eni) - PROXY_GENERIC_STATS_API(eni) - proxy_bulk_create_enis, - proxy_bulk_remove_enis, -}; diff --git a/proxylib/sai_proxy_dash_inbound_routing.cpp b/proxylib/sai_proxy_dash_inbound_routing.cpp deleted file mode 100644 index 23267623e..000000000 --- a/proxylib/sai_proxy_dash_inbound_routing.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD_ENTRY(INBOUND_ROUTING_ENTRY, inbound_routing_entry); -PROXY_BULK_CREATE_ENTRY_EX(INBOUND_ROUTING_ENTRY, inbound_routing_entry, inbound_routing_entries); -PROXY_BULK_REMOVE_ENTRY_EX(INBOUND_ROUTING_ENTRY, inbound_routing_entry, inbound_routing_entries); - -const sai_dash_inbound_routing_api_t proxy_dash_inbound_routing_api = { - PROXY_GENERIC_QUAD_API(inbound_routing_entry) - proxy_bulk_create_inbound_routing_entries, - proxy_bulk_remove_inbound_routing_entries, -}; diff --git a/proxylib/sai_proxy_dash_meter.cpp b/proxylib/sai_proxy_dash_meter.cpp deleted file mode 100644 index 4a5da148c..000000000 --- a/proxylib/sai_proxy_dash_meter.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(METER_BUCKET, meter_bucket); -PROXY_BULK_CREATE(METER_BUCKET, meter_buckets); -PROXY_BULK_REMOVE(METER_BUCKET, meter_buckets); - -PROXY_GENERIC_QUAD(METER_BUCKET, meter_policy); -PROXY_BULK_CREATE(METER_BUCKET, meter_policys); -PROXY_BULK_REMOVE(METER_BUCKET, meter_policys); - -PROXY_GENERIC_QUAD(METER_BUCKET, meter_rule); -PROXY_BULK_CREATE(METER_BUCKET, meter_rules); -PROXY_BULK_REMOVE(METER_BUCKET, meter_rules); - -const sai_dash_meter_api_t proxy_dash_meter_api = { - - PROXY_GENERIC_QUAD_API(meter_bucket) - proxy_bulk_create_meter_buckets, - proxy_bulk_remove_meter_buckets, - - PROXY_GENERIC_QUAD_API(meter_policy) - proxy_bulk_create_meter_policys, - proxy_bulk_remove_meter_policys, - - PROXY_GENERIC_QUAD_API(meter_rule) - proxy_bulk_create_meter_rules, - proxy_bulk_remove_meter_rules, -}; diff --git a/proxylib/sai_proxy_dash_outbound_ca_to_pa.cpp b/proxylib/sai_proxy_dash_outbound_ca_to_pa.cpp deleted file mode 100644 index 8a6d686d6..000000000 --- a/proxylib/sai_proxy_dash_outbound_ca_to_pa.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD_ENTRY(OUTBOUND_CA_TO_PA_ENTRY, outbound_ca_to_pa_entry); -PROXY_BULK_CREATE_ENTRY_EX(OUTBOUND_CA_TO_PA_ENTRY, outbound_ca_to_pa_entry, outbound_ca_to_pa_entries); -PROXY_BULK_REMOVE_ENTRY_EX(OUTBOUND_CA_TO_PA_ENTRY, outbound_ca_to_pa_entry, outbound_ca_to_pa_entries); - -const sai_dash_outbound_ca_to_pa_api_t proxy_dash_outbound_ca_to_pa_api = { - PROXY_GENERIC_QUAD_API(outbound_ca_to_pa_entry) - proxy_bulk_create_outbound_ca_to_pa_entries, - proxy_bulk_remove_outbound_ca_to_pa_entries, -}; diff --git a/proxylib/sai_proxy_dash_outbound_routing.cpp b/proxylib/sai_proxy_dash_outbound_routing.cpp deleted file mode 100644 index fb7c1b93e..000000000 --- a/proxylib/sai_proxy_dash_outbound_routing.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD_ENTRY(OUTBOUND_ROUTING_ENTRY, outbound_routing_entry); -PROXY_BULK_CREATE_ENTRY_EX(OUTBOUND_ROUTING_ENTRY, outbound_routing_entry, outbound_routing_entries); -PROXY_BULK_REMOVE_ENTRY_EX(OUTBOUND_ROUTING_ENTRY, outbound_routing_entry, outbound_routing_entries); - -const sai_dash_outbound_routing_api_t proxy_dash_outbound_routing_api = { - PROXY_GENERIC_QUAD_API(outbound_routing_entry) - proxy_bulk_create_outbound_routing_entries, - proxy_bulk_remove_outbound_routing_entries, -}; diff --git a/proxylib/sai_proxy_dash_pa_validation.cpp b/proxylib/sai_proxy_dash_pa_validation.cpp deleted file mode 100644 index 6a2223172..000000000 --- a/proxylib/sai_proxy_dash_pa_validation.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD_ENTRY(PA_VALIDATION_ENTRY, pa_validation_entry); -PROXY_BULK_CREATE_ENTRY_EX(PA_VALIDATION_ENTRY, pa_validation_entry, pa_validation_entries); -PROXY_BULK_REMOVE_ENTRY_EX(PA_VALIDATION_ENTRY, pa_validation_entry, pa_validation_entries); - -const sai_dash_pa_validation_api_t proxy_dash_pa_validation_api = { - PROXY_GENERIC_QUAD_API(pa_validation_entry) - proxy_bulk_create_pa_validation_entries, - proxy_bulk_remove_pa_validation_entries, -}; diff --git a/proxylib/sai_proxy_dash_vip.cpp b/proxylib/sai_proxy_dash_vip.cpp deleted file mode 100644 index e275a09e6..000000000 --- a/proxylib/sai_proxy_dash_vip.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD_ENTRY(VIP_ENTRY, vip_entry); -PROXY_BULK_CREATE_ENTRY_EX(VIP_ENTRY, vip_entry, vip_entries); -PROXY_BULK_REMOVE_ENTRY_EX(VIP_ENTRY, vip_entry, vip_entries); - -const sai_dash_vip_api_t proxy_dash_vip_api = { - PROXY_GENERIC_QUAD_API(vip_entry) - proxy_bulk_create_vip_entries, - proxy_bulk_remove_vip_entries, -}; diff --git a/proxylib/sai_proxy_dash_vnet.cpp b/proxylib/sai_proxy_dash_vnet.cpp deleted file mode 100644 index 3e1e5a002..000000000 --- a/proxylib/sai_proxy_dash_vnet.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(VNET, vnet); -PROXY_BULK_CREATE(VNET, vnets); -PROXY_BULK_REMOVE(VNET, vnets); - -const sai_dash_vnet_api_t proxy_dash_vnet_api = { - PROXY_GENERIC_QUAD_API(vnet) - proxy_bulk_create_vnets, - proxy_bulk_remove_vnets, -}; diff --git a/proxylib/sai_proxy_debug_counter.cpp b/proxylib/sai_proxy_debug_counter.cpp deleted file mode 100644 index 099826d75..000000000 --- a/proxylib/sai_proxy_debug_counter.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(DEBUG_COUNTER,debug_counter); - -const sai_debug_counter_api_t proxy_debug_counter_api = { - - PROXY_GENERIC_QUAD_API(debug_counter) -}; diff --git a/proxylib/sai_proxy_dtel.cpp b/proxylib/sai_proxy_dtel.cpp deleted file mode 100644 index eb27db418..000000000 --- a/proxylib/sai_proxy_dtel.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(DTEL,dtel); -PROXY_GENERIC_QUAD(DTEL_QUEUE_REPORT,dtel_queue_report); -PROXY_GENERIC_QUAD(DTEL_INT_SESSION,dtel_int_session); -PROXY_GENERIC_QUAD(DTEL_REPORT_SESSION,dtel_report_session); -PROXY_GENERIC_QUAD(DTEL_EVENT,dtel_event); - -const sai_dtel_api_t proxy_dtel_api = { - - PROXY_GENERIC_QUAD_API(dtel) - PROXY_GENERIC_QUAD_API(dtel_queue_report) - PROXY_GENERIC_QUAD_API(dtel_int_session) - PROXY_GENERIC_QUAD_API(dtel_report_session) - PROXY_GENERIC_QUAD_API(dtel_event) -}; diff --git a/proxylib/sai_proxy_fdb.cpp b/proxylib/sai_proxy_fdb.cpp deleted file mode 100644 index c4fd20049..000000000 --- a/proxylib/sai_proxy_fdb.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "sai_proxy.h" - -static sai_status_t proxy_flush_fdb_entries( - _In_ sai_object_id_t switch_id, - _In_ uint32_t attr_count, - _In_ const sai_attribute_t *attr_list) -{ - SWSS_LOG_ENTER(); - - return proxy_sai->flushFdbEntries( - switch_id, - attr_count, - attr_list); -} - -PROXY_GENERIC_QUAD_ENTRY(FDB_ENTRY,fdb_entry); -PROXY_BULK_QUAD_ENTRY(FDB_ENTRY,fdb_entry); - -const sai_fdb_api_t proxy_fdb_api = { - - PROXY_GENERIC_QUAD_API(fdb_entry) - - proxy_flush_fdb_entries, - - PROXY_BULK_QUAD_API(fdb_entry) -}; diff --git a/proxylib/sai_proxy_genericprogrammable.cpp b/proxylib/sai_proxy_genericprogrammable.cpp deleted file mode 100644 index 41cad506b..000000000 --- a/proxylib/sai_proxy_genericprogrammable.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(GENERIC_PROGRAMMABLE,generic_programmable); - -const sai_generic_programmable_api_t proxy_generic_programmable_api = { - PROXY_GENERIC_QUAD_API(generic_programmable) -}; diff --git a/proxylib/sai_proxy_hash.cpp b/proxylib/sai_proxy_hash.cpp deleted file mode 100644 index d25b5bd32..000000000 --- a/proxylib/sai_proxy_hash.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(HASH,hash); -PROXY_GENERIC_QUAD(FINE_GRAINED_HASH_FIELD,fine_grained_hash_field); - -const sai_hash_api_t proxy_hash_api = { - PROXY_GENERIC_QUAD_API(hash) - PROXY_GENERIC_QUAD_API(fine_grained_hash_field) -}; diff --git a/proxylib/sai_proxy_hostif.cpp b/proxylib/sai_proxy_hostif.cpp deleted file mode 100644 index c41ba5be0..000000000 --- a/proxylib/sai_proxy_hostif.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include "sai_proxy.h" - -static sai_status_t proxy_recv_hostif_packet( - _In_ sai_object_id_t hostif_id, - _Inout_ sai_size_t *buffer_size, - _Out_ void *buffer, - _Inout_ uint32_t *attr_count, - _Out_ sai_attribute_t *attr_list) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -static sai_status_t proxy_send_hostif_packet( - _In_ sai_object_id_t hostif_id, - _In_ sai_size_t buffer_size, - _In_ const void *buffer, - _In_ uint32_t attr_count, - _In_ const sai_attribute_t *attr_list) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -static sai_status_t proxy_allocate_hostif_packet( - _In_ sai_object_id_t hostif_id, - _In_ sai_size_t buffer_size, - _Out_ void **buffer, - _In_ uint32_t attr_count, - _In_ const sai_attribute_t *attr_list) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -static sai_status_t proxy_free_hostif_packet( - _In_ sai_object_id_t hostif_id, - _Inout_ void *buffer) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -PROXY_GENERIC_QUAD(HOSTIF,hostif); -PROXY_GENERIC_QUAD(HOSTIF_TABLE_ENTRY,hostif_table_entry); -PROXY_GENERIC_QUAD(HOSTIF_TRAP_GROUP,hostif_trap_group); -PROXY_GENERIC_QUAD(HOSTIF_TRAP,hostif_trap); -PROXY_GENERIC_QUAD(HOSTIF_USER_DEFINED_TRAP,hostif_user_defined_trap); - -const sai_hostif_api_t proxy_hostif_api = { - - PROXY_GENERIC_QUAD_API(hostif) - PROXY_GENERIC_QUAD_API(hostif_table_entry) - PROXY_GENERIC_QUAD_API(hostif_trap_group) - PROXY_GENERIC_QUAD_API(hostif_trap) - PROXY_GENERIC_QUAD_API(hostif_user_defined_trap) - - proxy_recv_hostif_packet, - proxy_send_hostif_packet, - proxy_allocate_hostif_packet, - proxy_free_hostif_packet, -}; diff --git a/proxylib/sai_proxy_interfacequery.cpp b/proxylib/sai_proxy_interfacequery.cpp deleted file mode 100644 index a92aa3c54..000000000 --- a/proxylib/sai_proxy_interfacequery.cpp +++ /dev/null @@ -1,308 +0,0 @@ -#include "sai_proxy.h" - -#include "Sai.h" - -using namespace saiproxy; - -std::shared_ptr proxy_sai = std::make_shared(); - -sai_status_t sai_api_initialize( - _In_ uint64_t flags, - _In_ const sai_service_method_table_t* service_method_table) -{ - SWSS_LOG_ENTER(); - - return proxy_sai->initialize(flags, service_method_table); -} - -sai_status_t sai_api_uninitialize(void) -{ - SWSS_LOG_ENTER(); - - return proxy_sai->uninitialize(); -} - -sai_status_t sai_log_set( - _In_ sai_api_t sai_api_id, - _In_ sai_log_level_t log_level) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -#define API(api) .api ## _api = const_cast(&proxy_ ## api ## _api) - -static sai_apis_t proxy_apis = { - API(switch), - API(port), - API(fdb), - API(vlan), - API(virtual_router), - API(route), - API(next_hop), - API(next_hop_group), - API(router_interface), - API(neighbor), - API(acl), - API(hostif), - API(mirror), - API(samplepacket), - API(stp), - API(lag), - API(policer), - API(wred), - API(qos_map), - API(queue), - API(scheduler), - API(scheduler_group), - API(buffer), - API(hash), - API(udf), - API(tunnel), - API(l2mc), - API(ipmc), - API(rpf_group), - API(l2mc_group), - API(ipmc_group), - API(mcast_fdb), - API(bridge), - API(tam), - API(srv6), - API(mpls), - API(dtel), - API(bfd), - API(isolation_group), - API(nat), - API(counter), - API(debug_counter), - API(macsec), - API(system_port), - API(my_mac), - API(ipsec), - API(generic_programmable), - API(ars), - API(ars_profile), - API(twamp), - API(poe), - API(bmtor), - API(dash_acl), - API(dash_direction_lookup), - API(dash_eni), - API(dash_inbound_routing), - API(dash_meter), - API(dash_outbound_ca_to_pa), - API(dash_outbound_routing), - API(dash_vnet), - API(dash_pa_validation), - API(dash_vip), -}; - -static_assert((sizeof(sai_apis_t)/sizeof(void*)) == (SAI_API_EXTENSIONS_MAX - 1)); - -sai_status_t sai_api_query( - _In_ sai_api_t sai_api_id, - _Out_ void** api_method_table) -{ - SWSS_LOG_ENTER(); - - if (api_method_table == NULL) - { - SWSS_LOG_ERROR("NULL method table passed to SAI API initialize"); - - return SAI_STATUS_INVALID_PARAMETER; - } - - if (sai_api_id == SAI_API_UNSPECIFIED) - { - SWSS_LOG_ERROR("api ID is unspecified api"); - - return SAI_STATUS_INVALID_PARAMETER; - } - - if (sai_metadata_get_enum_value_name(&sai_metadata_enum_sai_api_t, sai_api_id)) - { - *api_method_table = ((void**)&proxy_apis)[sai_api_id - 1]; - return SAI_STATUS_SUCCESS; - } - - SWSS_LOG_ERROR("Invalid API type %d", sai_api_id); - - return SAI_STATUS_INVALID_PARAMETER; -} - -sai_status_t sai_query_attribute_capability( - _In_ sai_object_id_t switch_id, - _In_ sai_object_type_t object_type, - _In_ sai_attr_id_t attr_id, - _Out_ sai_attr_capability_t *capability) -{ - SWSS_LOG_ENTER(); - - return proxy_sai->queryAttributeCapability( - switch_id, - object_type, - attr_id, - capability); -} - -sai_status_t sai_query_attribute_enum_values_capability( - _In_ sai_object_id_t switch_id, - _In_ sai_object_type_t object_type, - _In_ sai_attr_id_t attr_id, - _Inout_ sai_s32_list_t *enum_values_capability) -{ - SWSS_LOG_ENTER(); - - return proxy_sai->queryAattributeEnumValuesCapability( - switch_id, - object_type, - attr_id, - enum_values_capability); -} - -sai_status_t sai_object_type_get_availability( - _In_ sai_object_id_t switch_id, - _In_ sai_object_type_t object_type, - _In_ uint32_t attr_count, - _In_ const sai_attribute_t *attr_list, - _Out_ uint64_t *count) -{ - SWSS_LOG_ENTER(); - - return proxy_sai->objectTypeGetAvailability( - switch_id, - object_type, - attr_count, - attr_list, - count); -} - -sai_object_type_t sai_object_type_query( - _In_ sai_object_id_t objectId) -{ - SWSS_LOG_ENTER(); - - return proxy_sai->objectTypeQuery(objectId); -} - -sai_object_id_t sai_switch_id_query( - _In_ sai_object_id_t objectId) -{ - SWSS_LOG_ENTER(); - - return proxy_sai->switchIdQuery(objectId); -} - -sai_status_t sai_dbg_generate_dump( - _In_ const char *dump_file_name) -{ - SWSS_LOG_ENTER(); - - SWSS_LOG_ERROR("not implemented, FIXME"); - return SAI_STATUS_NOT_IMPLEMENTED; -} - -sai_status_t sai_bulk_get_attribute( - _In_ sai_object_id_t switch_id, - _In_ sai_object_type_t object_type, - _In_ uint32_t object_count, - _In_ const sai_object_key_t *object_key, - _Inout_ uint32_t *attr_count, - _Inout_ sai_attribute_t **attr_list, - _Inout_ sai_status_t *object_statuses) -{ - SWSS_LOG_ENTER(); - - SWSS_LOG_ERROR("not implemented, FIXME"); - return SAI_STATUS_NOT_IMPLEMENTED; -} - -sai_status_t sai_get_maximum_attribute_count( - _In_ sai_object_id_t switch_id, - _In_ sai_object_type_t object_type, - _Out_ uint32_t *count) -{ - SWSS_LOG_ENTER(); - - SWSS_LOG_ERROR("not implemented, FIXME"); - return SAI_STATUS_NOT_IMPLEMENTED; -} - -sai_status_t sai_get_object_count( - _In_ sai_object_id_t switch_id, - _In_ sai_object_type_t object_type, - _Out_ uint32_t *count) -{ - SWSS_LOG_ENTER(); - - SWSS_LOG_ERROR("not implemented, FIXME"); - return SAI_STATUS_NOT_IMPLEMENTED; -} - -sai_status_t sai_get_object_key( - _In_ sai_object_id_t switch_id, - _In_ sai_object_type_t object_type, - _Inout_ uint32_t *object_count, - _Inout_ sai_object_key_t *object_list) -{ - SWSS_LOG_ENTER(); - - SWSS_LOG_ERROR("not implemented, FIXME"); - return SAI_STATUS_NOT_IMPLEMENTED; -} - -sai_status_t sai_query_stats_capability( - _In_ sai_object_id_t switch_id, - _In_ sai_object_type_t object_type, - _Inout_ sai_stat_capability_list_t *stats_capability) -{ - SWSS_LOG_ENTER(); - - SWSS_LOG_ERROR("not implemented, FIXME"); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -sai_status_t sai_query_api_version( - _Out_ sai_api_version_t *version) -{ - SWSS_LOG_ENTER(); - - return proxy_sai->queryApiVersion(version); -} - -sai_status_t sai_bulk_object_get_stats( - _In_ sai_object_id_t switch_id, - _In_ sai_object_type_t object_type, - _In_ uint32_t object_count, - _In_ const sai_object_key_t *object_key, - _In_ uint32_t number_of_counters, - _In_ const sai_stat_id_t *counter_ids, - _In_ sai_stats_mode_t mode, - _Inout_ sai_status_t *object_statuses, - _Out_ uint64_t *counters) -{ - SWSS_LOG_ENTER(); - - SWSS_LOG_ERROR("not implemented, FIXME"); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -sai_status_t sai_bulk_object_clear_stats( - _In_ sai_object_id_t switch_id, - _In_ sai_object_type_t object_type, - _In_ uint32_t object_count, - _In_ const sai_object_key_t *object_key, - _In_ uint32_t number_of_counters, - _In_ const sai_stat_id_t *counter_ids, - _In_ sai_stats_mode_t mode, - _Inout_ sai_status_t *object_statuses) -{ - SWSS_LOG_ENTER(); - - SWSS_LOG_ERROR("not implemented, FIXME"); - - return SAI_STATUS_NOT_IMPLEMENTED; -} diff --git a/proxylib/sai_proxy_ipmc.cpp b/proxylib/sai_proxy_ipmc.cpp deleted file mode 100644 index 1488a4bb4..000000000 --- a/proxylib/sai_proxy_ipmc.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD_ENTRY(IPMC_ENTRY,ipmc_entry); - -const sai_ipmc_api_t proxy_ipmc_api = { - - PROXY_GENERIC_QUAD_API(ipmc_entry) -}; diff --git a/proxylib/sai_proxy_ipmc_group.cpp b/proxylib/sai_proxy_ipmc_group.cpp deleted file mode 100644 index 49dad28d1..000000000 --- a/proxylib/sai_proxy_ipmc_group.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(IPMC_GROUP,ipmc_group); -PROXY_GENERIC_QUAD(IPMC_GROUP_MEMBER,ipmc_group_member); - -const sai_ipmc_group_api_t proxy_ipmc_group_api = { - - PROXY_GENERIC_QUAD_API(ipmc_group) - PROXY_GENERIC_QUAD_API(ipmc_group_member) -}; diff --git a/proxylib/sai_proxy_ipsec.cpp b/proxylib/sai_proxy_ipsec.cpp deleted file mode 100644 index 5e7068426..000000000 --- a/proxylib/sai_proxy_ipsec.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(IPSEC,ipsec); -PROXY_GENERIC_QUAD(IPSEC_PORT,ipsec_port); -PROXY_GENERIC_QUAD(IPSEC_SA,ipsec_sa); -PROXY_GENERIC_STATS(IPSEC_PORT,ipsec_port); -PROXY_GENERIC_STATS(IPSEC_SA,ipsec_sa); - -const sai_ipsec_api_t proxy_ipsec_api = { - - PROXY_GENERIC_QUAD_API(ipsec) - PROXY_GENERIC_QUAD_API(ipsec_port) - PROXY_GENERIC_STATS_API(ipsec_port) - PROXY_GENERIC_QUAD_API(ipsec_sa) - PROXY_GENERIC_STATS_API(ipsec_sa) -}; diff --git a/proxylib/sai_proxy_isolation_group.cpp b/proxylib/sai_proxy_isolation_group.cpp deleted file mode 100644 index 220b7ebb8..000000000 --- a/proxylib/sai_proxy_isolation_group.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(ISOLATION_GROUP,isolation_group); -PROXY_GENERIC_QUAD(ISOLATION_GROUP_MEMBER,isolation_group_member); - -const sai_isolation_group_api_t proxy_isolation_group_api = { - - PROXY_GENERIC_QUAD_API(isolation_group) - PROXY_GENERIC_QUAD_API(isolation_group_member) -}; diff --git a/proxylib/sai_proxy_l2mc.cpp b/proxylib/sai_proxy_l2mc.cpp deleted file mode 100644 index f62e460c8..000000000 --- a/proxylib/sai_proxy_l2mc.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD_ENTRY(L2MC_ENTRY,l2mc_entry); - -const sai_l2mc_api_t proxy_l2mc_api = { - - PROXY_GENERIC_QUAD_API(l2mc_entry) -}; diff --git a/proxylib/sai_proxy_l2mcgroup.cpp b/proxylib/sai_proxy_l2mcgroup.cpp deleted file mode 100644 index 790ae1bee..000000000 --- a/proxylib/sai_proxy_l2mcgroup.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(L2MC_GROUP,l2mc_group); -PROXY_GENERIC_QUAD(L2MC_GROUP_MEMBER,l2mc_group_member); - -const sai_l2mc_group_api_t proxy_l2mc_group_api = { - - PROXY_GENERIC_QUAD_API(l2mc_group) - PROXY_GENERIC_QUAD_API(l2mc_group_member) -}; diff --git a/proxylib/sai_proxy_lag.cpp b/proxylib/sai_proxy_lag.cpp deleted file mode 100644 index 222912644..000000000 --- a/proxylib/sai_proxy_lag.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "sai_proxy.h" - -PROXY_BULK_CREATE(LAG_MEMBER,lag_members); -PROXY_BULK_REMOVE(LAG_MEMBER,lag_members); - -PROXY_GENERIC_QUAD(LAG,lag); -PROXY_GENERIC_QUAD(LAG_MEMBER,lag_member); - -const sai_lag_api_t proxy_lag_api = { - - PROXY_GENERIC_QUAD_API(lag) - PROXY_GENERIC_QUAD_API(lag_member) - - proxy_bulk_create_lag_members, - proxy_bulk_remove_lag_members, -}; diff --git a/proxylib/sai_proxy_macsec.cpp b/proxylib/sai_proxy_macsec.cpp deleted file mode 100644 index 7bf838b7d..000000000 --- a/proxylib/sai_proxy_macsec.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(MACSEC,macsec); -PROXY_GENERIC_QUAD(MACSEC_PORT,macsec_port); -PROXY_GENERIC_STATS(MACSEC_PORT,macsec_port); -PROXY_GENERIC_QUAD(MACSEC_FLOW,macsec_flow); -PROXY_GENERIC_STATS(MACSEC_FLOW,macsec_flow); -PROXY_GENERIC_QUAD(MACSEC_SC,macsec_sc); -PROXY_GENERIC_STATS(MACSEC_SC,macsec_sc); -PROXY_GENERIC_QUAD(MACSEC_SA,macsec_sa); -PROXY_GENERIC_STATS(MACSEC_SA,macsec_sa); - -const sai_macsec_api_t proxy_macsec_api = { - - PROXY_GENERIC_QUAD_API(macsec) - PROXY_GENERIC_QUAD_API(macsec_port) - PROXY_GENERIC_STATS_API(macsec_port) - PROXY_GENERIC_QUAD_API(macsec_flow) - PROXY_GENERIC_STATS_API(macsec_flow) - PROXY_GENERIC_QUAD_API(macsec_sc) - PROXY_GENERIC_STATS_API(macsec_sc) - PROXY_GENERIC_QUAD_API(macsec_sa) - PROXY_GENERIC_STATS_API(macsec_sa) -}; diff --git a/proxylib/sai_proxy_mcastfdb.cpp b/proxylib/sai_proxy_mcastfdb.cpp deleted file mode 100644 index 1c9322df1..000000000 --- a/proxylib/sai_proxy_mcastfdb.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD_ENTRY(MCAST_FDB_ENTRY,mcast_fdb_entry); - -const sai_mcast_fdb_api_t proxy_mcast_fdb_api = { - - PROXY_GENERIC_QUAD_API(mcast_fdb_entry) -}; diff --git a/proxylib/sai_proxy_mirror.cpp b/proxylib/sai_proxy_mirror.cpp deleted file mode 100644 index 977226905..000000000 --- a/proxylib/sai_proxy_mirror.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(MIRROR_SESSION,mirror_session); - -const sai_mirror_api_t proxy_mirror_api = { - - PROXY_GENERIC_QUAD_API(mirror_session) -}; diff --git a/proxylib/sai_proxy_mpls.cpp b/proxylib/sai_proxy_mpls.cpp deleted file mode 100644 index 78b5db280..000000000 --- a/proxylib/sai_proxy_mpls.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD_ENTRY(INSEG_ENTRY,inseg_entry); -PROXY_BULK_QUAD_ENTRY(INSEG_ENTRY,inseg_entry); - -const sai_mpls_api_t proxy_mpls_api = { - - PROXY_GENERIC_QUAD_API(inseg_entry) - PROXY_BULK_QUAD_API(inseg_entry) -}; diff --git a/proxylib/sai_proxy_my_mac.cpp b/proxylib/sai_proxy_my_mac.cpp deleted file mode 100644 index ec730b8ab..000000000 --- a/proxylib/sai_proxy_my_mac.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(MY_MAC,my_mac); - -const sai_my_mac_api_t proxy_my_mac_api = { - - PROXY_GENERIC_QUAD_API(my_mac) -}; diff --git a/proxylib/sai_proxy_nat.cpp b/proxylib/sai_proxy_nat.cpp deleted file mode 100644 index 7cfab7fe4..000000000 --- a/proxylib/sai_proxy_nat.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "sai_proxy.h" - -PROXY_BULK_QUAD_ENTRY(NAT_ENTRY,nat_entry); -PROXY_GENERIC_QUAD_ENTRY(NAT_ENTRY,nat_entry); -PROXY_GENERIC_QUAD(NAT_ZONE_COUNTER,nat_zone_counter); - -const sai_nat_api_t proxy_nat_api = { - - PROXY_GENERIC_QUAD_API(nat_entry) - PROXY_BULK_QUAD_API(nat_entry) - PROXY_GENERIC_QUAD_API(nat_zone_counter) -}; diff --git a/proxylib/sai_proxy_neighbor.cpp b/proxylib/sai_proxy_neighbor.cpp deleted file mode 100644 index 0988193cd..000000000 --- a/proxylib/sai_proxy_neighbor.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "sai_proxy.h" - -static sai_status_t proxy_remove_all_neighbor_entries( - _In_ sai_object_id_t switch_id) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -PROXY_BULK_QUAD_ENTRY(NEIGHBOR_ENTRY,neighbor_entry); -PROXY_GENERIC_QUAD_ENTRY(NEIGHBOR_ENTRY,neighbor_entry); - -const sai_neighbor_api_t proxy_neighbor_api = { - - PROXY_GENERIC_QUAD_API(neighbor_entry) - proxy_remove_all_neighbor_entries, - - PROXY_BULK_QUAD_API(neighbor_entry) -}; diff --git a/proxylib/sai_proxy_nexthop.cpp b/proxylib/sai_proxy_nexthop.cpp deleted file mode 100644 index 25af42de8..000000000 --- a/proxylib/sai_proxy_nexthop.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(NEXT_HOP,next_hop); -PROXY_BULK_QUAD(NEXT_HOP,next_hop); - -const sai_next_hop_api_t proxy_next_hop_api = { - - PROXY_GENERIC_QUAD_API(next_hop) - PROXY_BULK_QUAD_API(next_hop) -}; diff --git a/proxylib/sai_proxy_nexthopgroup.cpp b/proxylib/sai_proxy_nexthopgroup.cpp deleted file mode 100644 index f151be1cc..000000000 --- a/proxylib/sai_proxy_nexthopgroup.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "sai_proxy.h" - -PROXY_BULK_CREATE(NEXT_HOP_GROUP_MEMBER,next_hop_group_members); -PROXY_BULK_REMOVE(NEXT_HOP_GROUP_MEMBER,next_hop_group_members); -PROXY_BULK_GET(NEXT_HOP_GROUP_MEMBER,next_hop_group_members); -PROXY_BULK_SET(NEXT_HOP_GROUP_MEMBER,next_hop_group_members); -PROXY_GENERIC_QUAD(NEXT_HOP_GROUP,next_hop_group); -PROXY_GENERIC_QUAD(NEXT_HOP_GROUP_MEMBER,next_hop_group_member); -PROXY_GENERIC_QUAD(NEXT_HOP_GROUP_MAP,next_hop_group_map); - -const sai_next_hop_group_api_t proxy_next_hop_group_api = { - - PROXY_GENERIC_QUAD_API(next_hop_group) - PROXY_GENERIC_QUAD_API(next_hop_group_member) - - proxy_bulk_create_next_hop_group_members, - proxy_bulk_remove_next_hop_group_members, - PROXY_GENERIC_QUAD_API(next_hop_group_map) - proxy_bulk_set_next_hop_group_members, - proxy_bulk_get_next_hop_group_members -}; diff --git a/proxylib/sai_proxy_poe.cpp b/proxylib/sai_proxy_poe.cpp deleted file mode 100644 index 2f91297af..000000000 --- a/proxylib/sai_proxy_poe.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(POE_DEVICE,poe_device); -PROXY_GENERIC_QUAD(POE_PSE,poe_pse); -PROXY_GENERIC_QUAD(POE_PORT,poe_port); - -const sai_poe_api_t proxy_poe_api = { - - PROXY_GENERIC_QUAD_API(poe_device) - PROXY_GENERIC_QUAD_API(poe_pse) - PROXY_GENERIC_QUAD_API(poe_port) -}; diff --git a/proxylib/sai_proxy_policer.cpp b/proxylib/sai_proxy_policer.cpp deleted file mode 100644 index f1b6206b3..000000000 --- a/proxylib/sai_proxy_policer.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(POLICER,policer); -PROXY_GENERIC_STATS(POLICER,policer); - -const sai_policer_api_t proxy_policer_api = { - - PROXY_GENERIC_QUAD_API(policer) - PROXY_GENERIC_STATS_API(policer) -}; diff --git a/proxylib/sai_proxy_port.cpp b/proxylib/sai_proxy_port.cpp deleted file mode 100644 index e7dcde00d..000000000 --- a/proxylib/sai_proxy_port.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include "sai_proxy.h" - -static sai_status_t proxy_clear_port_all_stats( - _In_ sai_object_id_t port_id) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -PROXY_GENERIC_QUAD(PORT,port); -PROXY_GENERIC_QUAD(PORT_POOL,port_pool); -PROXY_GENERIC_QUAD(PORT_SERDES,port_serdes); -PROXY_GENERIC_QUAD(PORT_CONNECTOR,port_connector); -PROXY_GENERIC_STATS(PORT,port); -PROXY_GENERIC_STATS(PORT_POOL,port_pool); -PROXY_BULK_QUAD(PORT, ports); -PROXY_BULK_QUAD(PORT_SERDES, port_serdeses); - -const sai_port_api_t proxy_port_api = { - - PROXY_GENERIC_QUAD_API(port) - PROXY_GENERIC_STATS_API(port) - - proxy_clear_port_all_stats, - - PROXY_GENERIC_QUAD_API(port_pool) - PROXY_GENERIC_STATS_API(port_pool) - PROXY_GENERIC_QUAD_API(port_connector) - PROXY_GENERIC_QUAD_API(port_serdes) - PROXY_BULK_QUAD_API(ports) - PROXY_BULK_QUAD_API(port_serdeses) -}; diff --git a/proxylib/sai_proxy_qosmap.cpp b/proxylib/sai_proxy_qosmap.cpp deleted file mode 100644 index c67bcc8d9..000000000 --- a/proxylib/sai_proxy_qosmap.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(QOS_MAP,qos_map); - -const sai_qos_map_api_t proxy_qos_map_api = { - - PROXY_GENERIC_QUAD_API(qos_map) -}; diff --git a/proxylib/sai_proxy_queue.cpp b/proxylib/sai_proxy_queue.cpp deleted file mode 100644 index 8136454ce..000000000 --- a/proxylib/sai_proxy_queue.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(QUEUE,queue); -PROXY_GENERIC_STATS(QUEUE,queue); - -const sai_queue_api_t proxy_queue_api = { - - PROXY_GENERIC_QUAD_API(queue) - PROXY_GENERIC_STATS_API(queue) -}; diff --git a/proxylib/sai_proxy_route.cpp b/proxylib/sai_proxy_route.cpp deleted file mode 100644 index 07007e5e7..000000000 --- a/proxylib/sai_proxy_route.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD_ENTRY(ROUTE_ENTRY,route_entry); -PROXY_BULK_QUAD_ENTRY(ROUTE_ENTRY,route_entry); - -const sai_route_api_t proxy_route_api = { - - PROXY_GENERIC_QUAD_API(route_entry) - PROXY_BULK_QUAD_API(route_entry) -}; diff --git a/proxylib/sai_proxy_router_interface.cpp b/proxylib/sai_proxy_router_interface.cpp deleted file mode 100644 index 5f65618da..000000000 --- a/proxylib/sai_proxy_router_interface.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(ROUTER_INTERFACE,router_interface); -PROXY_GENERIC_STATS(ROUTER_INTERFACE,router_interface); -PROXY_BULK_QUAD(ROUTER_INTERFACE,router_interfaces); - -const sai_router_interface_api_t proxy_router_interface_api = { - - PROXY_GENERIC_QUAD_API(router_interface) - PROXY_GENERIC_STATS_API(router_interface) - PROXY_BULK_QUAD_API(router_interfaces) -}; diff --git a/proxylib/sai_proxy_rpfgroup.cpp b/proxylib/sai_proxy_rpfgroup.cpp deleted file mode 100644 index 9933f37d5..000000000 --- a/proxylib/sai_proxy_rpfgroup.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(RPF_GROUP,rpf_group); -PROXY_GENERIC_QUAD(RPF_GROUP_MEMBER,rpf_group_member); - -const sai_rpf_group_api_t proxy_rpf_group_api = { - - PROXY_GENERIC_QUAD_API(rpf_group) - PROXY_GENERIC_QUAD_API(rpf_group_member) -}; diff --git a/proxylib/sai_proxy_samplepacket.cpp b/proxylib/sai_proxy_samplepacket.cpp deleted file mode 100644 index 8e0c2ca3f..000000000 --- a/proxylib/sai_proxy_samplepacket.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(SAMPLEPACKET,samplepacket); - -const sai_samplepacket_api_t proxy_samplepacket_api = { - - PROXY_GENERIC_QUAD_API(samplepacket) -}; diff --git a/proxylib/sai_proxy_scheduler.cpp b/proxylib/sai_proxy_scheduler.cpp deleted file mode 100644 index b193b71e0..000000000 --- a/proxylib/sai_proxy_scheduler.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(SCHEDULER,scheduler); - -const sai_scheduler_api_t proxy_scheduler_api = { - - PROXY_GENERIC_QUAD_API(scheduler) -}; diff --git a/proxylib/sai_proxy_schedulergroup.cpp b/proxylib/sai_proxy_schedulergroup.cpp deleted file mode 100644 index 08c79dfa5..000000000 --- a/proxylib/sai_proxy_schedulergroup.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(SCHEDULER_GROUP,scheduler_group); - -const sai_scheduler_group_api_t proxy_scheduler_group_api = { - - PROXY_GENERIC_QUAD_API(scheduler_group) -}; diff --git a/proxylib/sai_proxy_srv6.cpp b/proxylib/sai_proxy_srv6.cpp deleted file mode 100644 index eedafd298..000000000 --- a/proxylib/sai_proxy_srv6.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "sai_proxy.h" - -PROXY_BULK_CREATE(SRV6_SIDLIST, srv6_sidlist); -PROXY_BULK_REMOVE(SRV6_SIDLIST, srv6_sidlist); -PROXY_GENERIC_QUAD(SRV6_SIDLIST,srv6_sidlist); -PROXY_BULK_QUAD_ENTRY(MY_SID_ENTRY,my_sid_entry); -PROXY_GENERIC_QUAD_ENTRY(MY_SID_ENTRY,my_sid_entry); - -const sai_srv6_api_t proxy_srv6_api = { - - PROXY_GENERIC_QUAD_API(srv6_sidlist) - - proxy_bulk_create_srv6_sidlist, - proxy_bulk_remove_srv6_sidlist, - - NULL, - NULL, - NULL, - - PROXY_GENERIC_QUAD_API(my_sid_entry) - PROXY_BULK_QUAD_API(my_sid_entry) -}; diff --git a/proxylib/sai_proxy_stp.cpp b/proxylib/sai_proxy_stp.cpp deleted file mode 100644 index e01a2b0bf..000000000 --- a/proxylib/sai_proxy_stp.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include "sai_proxy.h" - -PROXY_BULK_CREATE(STP_PORT,stp_ports); -PROXY_BULK_REMOVE(STP_PORT,stp_ports); -PROXY_GENERIC_QUAD(STP,stp); -PROXY_GENERIC_QUAD(STP_PORT,stp_port); - -const sai_stp_api_t proxy_stp_api = { - - PROXY_GENERIC_QUAD_API(stp) - PROXY_GENERIC_QUAD_API(stp_port) - - proxy_bulk_create_stp_ports, - proxy_bulk_remove_stp_ports, -}; diff --git a/proxylib/sai_proxy_switch.cpp b/proxylib/sai_proxy_switch.cpp deleted file mode 100644 index 4cf80bcf0..000000000 --- a/proxylib/sai_proxy_switch.cpp +++ /dev/null @@ -1,84 +0,0 @@ -#include "sai_proxy.h" - -static sai_status_t proxy_switch_mdio_read( - _In_ sai_object_id_t switch_id, - _In_ uint32_t device_addr, - _In_ uint32_t start_reg_addr, - _In_ uint32_t number_of_registers, - _Out_ uint32_t *reg_val) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -static sai_status_t proxy_switch_mdio_write( - _In_ sai_object_id_t switch_id, - _In_ uint32_t device_addr, - _In_ uint32_t start_reg_addr, - _In_ uint32_t number_of_registers, - _In_ const uint32_t *reg_val) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -static sai_status_t proxy_switch_mdio_cl22_read( - _In_ sai_object_id_t switch_id, - _In_ uint32_t device_addr, - _In_ uint32_t start_reg_addr, - _In_ uint32_t number_of_registers, - _Out_ uint32_t *reg_val) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -static sai_status_t proxy_switch_mdio_cl22_write( - _In_ sai_object_id_t switch_id, - _In_ uint32_t device_addr, - _In_ uint32_t start_reg_addr, - _In_ uint32_t number_of_registers, - _In_ const uint32_t *reg_val) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -PROXY_GENERIC_QUAD(SWITCH,switch); -PROXY_GENERIC_STATS(SWITCH,switch); -PROXY_GENERIC_QUAD(SWITCH_TUNNEL,switch_tunnel); - -static sai_status_t proxy_create_switch_uniq( - _Out_ sai_object_id_t *switch_id, - _In_ uint32_t attr_count, - _In_ const sai_attribute_t *attr_list) -{ - SWSS_LOG_ENTER(); - - return proxy_create_switch( - switch_id, - SAI_NULL_OBJECT_ID, // no switch id since we create switch - attr_count, - attr_list); -} - -const sai_switch_api_t proxy_switch_api = { - - proxy_create_switch_uniq, - proxy_remove_switch, - proxy_set_switch_attribute, - proxy_get_switch_attribute, - - PROXY_GENERIC_STATS_API(switch) - - proxy_switch_mdio_read, - proxy_switch_mdio_write, - - PROXY_GENERIC_QUAD_API(switch_tunnel) - proxy_switch_mdio_cl22_read, - proxy_switch_mdio_cl22_write -}; diff --git a/proxylib/sai_proxy_system_port.cpp b/proxylib/sai_proxy_system_port.cpp deleted file mode 100644 index 45e9f68a4..000000000 --- a/proxylib/sai_proxy_system_port.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(SYSTEM_PORT,system_port); - -const sai_system_port_api_t proxy_system_port_api = { - - PROXY_GENERIC_QUAD_API(system_port) -}; diff --git a/proxylib/sai_proxy_tam.cpp b/proxylib/sai_proxy_tam.cpp deleted file mode 100644 index 526bca272..000000000 --- a/proxylib/sai_proxy_tam.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include "sai_proxy.h" - -sai_status_t sai_tam_telemetry_get_data( - _In_ sai_object_id_t switch_id, - _In_ sai_object_list_t obj_list, - _In_ bool clear_on_read, - _Inout_ sai_size_t *buffer_size, - _Out_ void *buffer) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -PROXY_GENERIC_QUAD(TAM,tam); -PROXY_GENERIC_QUAD(TAM_MATH_FUNC,tam_math_func); -PROXY_GENERIC_QUAD(TAM_REPORT,tam_report); -PROXY_GENERIC_QUAD(TAM_EVENT_THRESHOLD,tam_event_threshold); -PROXY_GENERIC_QUAD(TAM_INT,tam_int); -PROXY_GENERIC_QUAD(TAM_TEL_TYPE,tam_tel_type); -PROXY_GENERIC_QUAD(TAM_TRANSPORT,tam_transport); -PROXY_GENERIC_QUAD(TAM_TELEMETRY,tam_telemetry); -PROXY_GENERIC_QUAD(TAM_COLLECTOR,tam_collector); -PROXY_GENERIC_QUAD(TAM_EVENT_ACTION,tam_event_action); -PROXY_GENERIC_QUAD(TAM_EVENT,tam_event); -PROXY_GENERIC_QUAD(TAM_COUNTER_SUBSCRIPTION,tam_counter_subscription); - -const sai_tam_api_t proxy_tam_api = { - - PROXY_GENERIC_QUAD_API(tam) - PROXY_GENERIC_QUAD_API(tam_math_func) - PROXY_GENERIC_QUAD_API(tam_report) - PROXY_GENERIC_QUAD_API(tam_event_threshold) - PROXY_GENERIC_QUAD_API(tam_int) - PROXY_GENERIC_QUAD_API(tam_tel_type) - PROXY_GENERIC_QUAD_API(tam_transport) - PROXY_GENERIC_QUAD_API(tam_telemetry) - PROXY_GENERIC_QUAD_API(tam_collector) - PROXY_GENERIC_QUAD_API(tam_event_action) - PROXY_GENERIC_QUAD_API(tam_event) - PROXY_GENERIC_QUAD_API(tam_counter_subscription) -}; diff --git a/proxylib/sai_proxy_tunnel.cpp b/proxylib/sai_proxy_tunnel.cpp deleted file mode 100644 index f0dacf515..000000000 --- a/proxylib/sai_proxy_tunnel.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(TUNNEL_MAP,tunnel_map); -PROXY_GENERIC_QUAD(TUNNEL,tunnel); -PROXY_GENERIC_QUAD(TUNNEL_TERM_TABLE_ENTRY,tunnel_term_table_entry); -PROXY_GENERIC_QUAD(TUNNEL_MAP_ENTRY,tunnel_map_entry); -PROXY_GENERIC_STATS(TUNNEL,tunnel); -PROXY_BULK_QUAD(TUNNEL,tunnels); - -const sai_tunnel_api_t proxy_tunnel_api = { - - PROXY_GENERIC_QUAD_API(tunnel_map) - PROXY_GENERIC_QUAD_API(tunnel) - PROXY_GENERIC_STATS_API(tunnel) - PROXY_GENERIC_QUAD_API(tunnel_term_table_entry) - PROXY_GENERIC_QUAD_API(tunnel_map_entry) - PROXY_BULK_QUAD_API(tunnels) -}; diff --git a/proxylib/sai_proxy_twamp.cpp b/proxylib/sai_proxy_twamp.cpp deleted file mode 100644 index 7abdfc71c..000000000 --- a/proxylib/sai_proxy_twamp.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(TWAMP_SESSION,twamp_session); -PROXY_GENERIC_STATS(TWAMP_SESSION,twamp_session); - -const sai_twamp_api_t proxy_twamp_api = { - PROXY_GENERIC_QUAD_API(twamp_session) - PROXY_GENERIC_STATS_API(twamp_session) -}; diff --git a/proxylib/sai_proxy_udf.cpp b/proxylib/sai_proxy_udf.cpp deleted file mode 100644 index 31f0da664..000000000 --- a/proxylib/sai_proxy_udf.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(UDF,udf) -PROXY_GENERIC_QUAD(UDF_MATCH,udf_match) -PROXY_GENERIC_QUAD(UDF_GROUP,udf_group) - -const sai_udf_api_t proxy_udf_api = { - - PROXY_GENERIC_QUAD_API(udf) - PROXY_GENERIC_QUAD_API(udf_match) - PROXY_GENERIC_QUAD_API(udf_group) -}; diff --git a/proxylib/sai_proxy_virtual_router.cpp b/proxylib/sai_proxy_virtual_router.cpp deleted file mode 100644 index f5c775f79..000000000 --- a/proxylib/sai_proxy_virtual_router.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(VIRTUAL_ROUTER,virtual_router); - -const sai_virtual_router_api_t proxy_virtual_router_api = { - - PROXY_GENERIC_QUAD_API(virtual_router) -}; diff --git a/proxylib/sai_proxy_vlan.cpp b/proxylib/sai_proxy_vlan.cpp deleted file mode 100644 index 89b561a68..000000000 --- a/proxylib/sai_proxy_vlan.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "sai_proxy.h" - -PROXY_BULK_CREATE(VLAN_MEMBER,vlan_members); -PROXY_BULK_REMOVE(VLAN_MEMBER,vlan_members); -PROXY_GENERIC_QUAD(VLAN,vlan); -PROXY_GENERIC_QUAD(VLAN_MEMBER,vlan_member); -PROXY_GENERIC_STATS(VLAN,vlan); - -const sai_vlan_api_t proxy_vlan_api = { - - PROXY_GENERIC_QUAD_API(vlan) - PROXY_GENERIC_QUAD_API(vlan_member) - - proxy_bulk_create_vlan_members, - proxy_bulk_remove_vlan_members, - - PROXY_GENERIC_STATS_API(vlan) -}; diff --git a/proxylib/sai_proxy_wred.cpp b/proxylib/sai_proxy_wred.cpp deleted file mode 100644 index 24dfe0b99..000000000 --- a/proxylib/sai_proxy_wred.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_proxy.h" - -PROXY_GENERIC_QUAD(WRED,wred); - -const sai_wred_api_t proxy_wred_api = { - - PROXY_GENERIC_QUAD_API(wred) -}; diff --git a/saidiscovery/saidiscovery.cpp b/saidiscovery/saidiscovery.cpp index e36305a82..ef332a36c 100644 --- a/saidiscovery/saidiscovery.cpp +++ b/saidiscovery/saidiscovery.cpp @@ -554,7 +554,7 @@ int main(int argc, char **argv) auto sai = std::make_shared(vendorSai); - sai_status_t status = sai->initialize(0, (sai_service_method_table_t*)&test_services); + sai_status_t status = sai->apiInitialize(0, (sai_service_method_table_t*)&test_services); if (status != SAI_STATUS_SUCCESS) { @@ -665,7 +665,7 @@ int main(int argc, char **argv) sai_serialize_status(status).c_str()); } - status = sai->uninitialize(); + status = sai->apiUninitialize(); if (status != SAI_STATUS_SUCCESS) { diff --git a/saiplayer/SaiPlayer.cpp b/saiplayer/SaiPlayer.cpp index 29723edc4..3710a2de8 100644 --- a/saiplayer/SaiPlayer.cpp +++ b/saiplayer/SaiPlayer.cpp @@ -2850,7 +2850,7 @@ int SaiPlayer::run() m_test_services = m_smt.getServiceMethodTable(); - EXIT_ON_ERROR(m_sai->initialize(0, &m_test_services)); + EXIT_ON_ERROR(m_sai->apiInitialize(0, &m_test_services)); sai_attribute_t attr; @@ -2903,7 +2903,7 @@ int SaiPlayer::run() exitcode = replay(); } - m_sai->uninitialize(); + m_sai->apiUninitialize(); return exitcode; } diff --git a/stub.pl b/stub.pl new file mode 100755 index 000000000..208d8e9d0 --- /dev/null +++ b/stub.pl @@ -0,0 +1,433 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use diagnostics; +use sort 'stable'; + +use Getopt::Std; +use Data::Dumper; +use Term::ANSIColor; + +my %options = (); +getopts("d:c:n:f:s:", \%options); + +my $optionSaiDir = $options{d} if defined $options{d}; +my $optionClass = $options{c} if defined $options{c}; +my $optionNamespace = $options{n} if defined $options{n}; +my $optionFileName = $options{f} if defined $options{f}; +my $optionStub = $options{s} if defined $options{s}; + +my $STUB = $optionStub; + +my $DATA = ""; +my @OBJECT_TYPES = (); +my %objectTypes = (); +my @APIS = (); +my @FUNCTIONS = (); +my %FUNCTIONS = (); +my @globalApis = (); +my @apiStructs = (); +my %apiStructs = (); +my %ENTRIES = (); + +my $SOURCE_CONTENT = ""; + +my $warnings = 0; +my $errors = 0; + +sub LogInfo +{ + print color('bright_green') . "@_" . color('reset') . "\n"; +} + +sub LogWarning +{ + $warnings++; + print color('bright_yellow') . "WARNING: @_" . color('reset') . "\n"; +} + +sub LogError +{ + $errors++; + print color('bright_red') . "ERROR: @_" . color('reset') . "\n"; + exit 1; +} + +sub WriteFile +{ + my ($file, $content) = @_; + + open (F, ">", $file) or die "$0: open $file $!"; + + print F $content; + + close F; +} + +sub Write +{ + my $content = shift; + + my $ident = ""; #GetIdent($content); + + my $line = $ident . $content . "\n"; + + $line = "\n" if $content eq ""; + + $SOURCE_CONTENT .= $line; +} + +sub GetFunctionCamelCaseName +{ + my $fun = shift; + + $fun =~ s/^sai_//; + + my @tokens = split/_/,$fun; + + @tokens = map{ucfirst}@tokens; + + shift @tokens if $tokens[0] eq "api"; + + $tokens[0] = lcfirst $tokens[0]; + + $fun = join("",@tokens); + + return $fun; +} + +sub GetData +{ + $DATA = `cat $optionSaiDir/inc/sai*.h $optionSaiDir/experimental/sai*.h`; +} + +sub SanitizeData +{ + $DATA =~ s/SAI_OBJECT_TYPE_\w*(START|END|NULL|MAX)//gms; + $DATA =~ s/SAI_API_\w*(START|END|UNSPECIFIED|MAX)//gms; +} + +sub ExtractData +{ + @OBJECT_TYPES = $DATA =~ /^\s+SAI_OBJECT_TYPE\_(\w+)/gms; + @APIS = $DATA =~ /^\s+SAI_API\_(\w+)/gms; + + for my $ot (@OBJECT_TYPES) + { + $objectTypes{lc$ot} = $ot; + } + + @FUNCTIONS = $DATA =~ /(typedef sai_status_t \(\*(?:sai_\w+_fn)\).*?\))/gms; + + @globalApis = $DATA =~ /^((?:sai_\w+)\s+(?:sai_\w+).+?\))/gms; + + for my $fun (@FUNCTIONS) + { + next if not $fun =~ /sai_\w+\s+.*?(sai_\w+)/gms; + + $FUNCTIONS{$1} = $fun; + } + + @apiStructs = $DATA =~ /(_sai_\w+_api_t.+?sai_\w+_api_t)/gms; + + for my $struct (@apiStructs) + { + next if not $struct =~ /sai_(\w+)_api_t/; + + $apiStructs{$1} = $struct; + } + + my @entries = $DATA =~ /\bsai_(\w+_entry)_t\b/gms; + + for my $e (@entries) + { + $ENTRIES{uc$e} = $e; + } +} + +sub Entry +{ + my $i = shift; + $i =~ s/entries/entry/; + return $i; +} + +sub GetFunctionName +{ + my $fun = shift; + + my $OT = ""; + my $bulk = 0; + my $entry = 0; + + if ($fun =~ /(get|clear)_(\w+)_(stats(_ext)?)/ and defined $objectTypes{$2}) + { + $OT = $objectTypes{$2}; + $fun = "$1_$3"; + } + elsif ($fun =~ /(create|remove|set|get)_(\w+_entries)/ and defined $objectTypes{Entry($2)}) + { + $bulk = 1; + $OT = $objectTypes{Entry($2)}; + $fun = "bulk_$1"; + } + elsif ($fun =~ /(set|get)_(\w+)s_attribute/ and defined $objectTypes{$2}) + { + $bulk = 1; + $OT = $objectTypes{$2}; + $fun = "bulk_$1"; + } + elsif ($fun =~ /(set|get)_(\w+)_attribute/ and defined $objectTypes{$2}) + { + $OT = $objectTypes{$2}; + $fun = "$1"; + } + elsif ($fun =~ /(create|remove|set|get)_(\w+)s(_attribute)?/ and defined $objectTypes{$2}) + { + $bulk = 1; + $OT = $objectTypes{$2}; + $fun = "bulk_$1"; + } + elsif ($fun =~ /(create|remove|set|get)_(\w+)(_attribute)?/ and defined $objectTypes{$2}) + { + $OT = $objectTypes{$2}; + $fun = "$1"; + } + elsif ($fun =~ /(create|remove|set|get)_(\w+)(_attribute)?/ and defined $objectTypes{$2}) + { + $OT = $objectTypes{$2}; + $fun = $1; + } + else + { + LogInfo "Unique function $fun"; + } + + $entry = 1 if defined $ENTRIES{$OT}; + + my $f = GetFunctionCamelCaseName($fun); + + return ($OT, $f, $entry, $bulk); +} + +sub CreateApiStricts() +{ + Write ""; + Write "/* ==== API STRUCTS === */"; + Write ""; + + for my $API (@APIS) + { + my $api = lc $API; + + Write ""; + Write "/* SAI APIS for $API */"; + Write ""; + + my $struct = $apiStructs{$api}; + + LogError "api $api not found" if not defined $struct; + + while ($struct =~ /(sai_\w+_fn)\s+(\w+)/gms) + { + my $type = $1; + my $funname = $2; + + my $fun = $FUNCTIONS{$type}; + + LogError "function $fun not found" if not defined $fun; + + next if not $fun =~ /(sai_\w+).+\((.+?)\)/gms; + + my $rettype = $1; + my $params = $2; + my @par = $params =~ /(\w+,|\w+$)/gms; + + my ($OT, $fname, $entry, $bulk) = GetFunctionName($funname); + + $par[0] = "switch_id,SAI_NULL_OBJECT_ID," if $OT eq "SWITCH" and $bulk == 0 and $fname eq "create"; + + Write "static $rettype ${STUB}_$funname($params)"; + Write "{"; + Write " SWSS_LOG_ENTER();"; + Write ""; + + if ($fname =~ /(clearPortAllStats|removeAllNeighborEntries|recvHostifPacket|sendHostifPacket|allocateHostifPacket|freeHostifPacket)/) + { + Write " SWSS_LOG_ERROR(\"FIXME, no implementation for $fname!\");"; + Write " return SAI_STATUS_NOT_IMPLEMENTED;"; + Write "}"; + next; + } + + Write " return $STUB" . "->$fname(@par);" if $OT eq ""; + Write " return $STUB" . "->$fname(@par);" if $OT ne "" and $bulk == 1 and $entry == 1; + Write " return $STUB" . "->$fname(@par);" if $OT ne "" and $bulk == 0 and $entry == 1; + Write " return $STUB" . "->$fname((sai_object_type_t)(SAI_OBJECT_TYPE_$OT),@par);" if $OT ne "" and $bulk == 0 and $entry == 0; + Write " return $STUB" . "->$fname((sai_object_type_t)(SAI_OBJECT_TYPE_$OT),@par);" if $OT ne "" and $bulk == 1 and $entry == 0; + Write "}"; + Write ""; + } + + Write "const sai_${api}_api_t ${STUB}_${api} = {"; + + while ($struct =~ /(sai_\w+_fn)\s+(\w+)/gms) + { + my $type = $1; + my $funname = $2; + + Write " .$funname = ${STUB}_$funname,"; + } + + Write "};"; + Write ""; + } +} + +sub CreateHeader +{ + Write ""; + Write "/* DO NOT MODIFY, FILE AUTO GENERATED */"; + Write ""; + Write "extern \"C\" {"; + Write "#include \"sai.h\""; + Write "#include \"saiextensions.h\""; + Write "}"; + Write "#include \"meta/SaiInterface.h\""; + Write "#include \"$optionClass.h\""; + Write "#include \"swss/logger.h\""; + Write "#include "; + Write ""; + Write "static std::shared_ptr $STUB = std::make_shared<$optionNamespace" . "::$optionClass>();"; + Write "" +} + +sub CreateApiStruct +{ + Write ""; + Write "/* ==== API STRUCTS === */"; + Write ""; + + Write "static sai_apis_t ${STUB}_apis = {"; + + for my $API (@APIS) + { + my $api = lc $API; + + Write " .${api}_api = const_cast(&${STUB}_${api}),"; + } + + Write "};"; + Write ""; +} + +sub CreateApiQuery +{ + Write ""; + Write "/* ==== API QUERY === */"; + Write ""; + + Write "static_assert((sizeof(sai_apis_t)/sizeof(void*)) == (SAI_API_EXTENSIONS_MAX - 1));"; + Write ""; + Write "sai_status_t sai_api_query("; + Write " _In_ sai_api_t sai_api_id,"; + Write " _Out_ void** api_method_table)"; + Write "{"; + Write " SWSS_LOG_ENTER();"; + Write ""; + Write " if (api_method_table == NULL)"; + Write " {"; + Write " SWSS_LOG_ERROR(\"NULL method table passed to SAI API initialize\");"; + Write ""; + Write " return SAI_STATUS_INVALID_PARAMETER;"; + Write " }"; + Write ""; + Write " if (sai_api_id == SAI_API_UNSPECIFIED)"; + Write " {"; + Write " SWSS_LOG_ERROR(\"api ID is unspecified api\");"; + Write ""; + Write " return SAI_STATUS_INVALID_PARAMETER;"; + Write " }"; + Write ""; + Write " if (sai_metadata_get_enum_value_name(&sai_metadata_enum_sai_api_t, sai_api_id))"; + Write " {"; + Write " *api_method_table = ((void**)&${STUB}_apis)[sai_api_id - 1];"; + Write ""; + Write " return SAI_STATUS_SUCCESS;"; + Write " }"; + Write ""; + Write " SWSS_LOG_ERROR(\"Invalid API type %d\", sai_api_id);"; + Write ""; + Write " return SAI_STATUS_INVALID_PARAMETER;"; + Write "}"; + Write ""; +} + +sub CreateGlobalApis +{ + Write ""; + Write "/* ==== GLOBAL APIS === */"; + Write ""; + + for my $api (sort @globalApis) + { + next if not $api =~ /(sai_\w+)\s+(sai_\w+).*\((.+?)\)/gms; + + my $rettype = $1; + my $funname = $2; + my $params = $3; + + next if $funname eq "sai_api_query"; + + my @par = $params =~ /(\w+,|\w+$)/gms; + + my $fun = GetFunctionCamelCaseName($funname); + + $par[0] = "" if $par[0] eq "void"; + + Write "$rettype $funname($params)"; + Write "{"; + Write " SWSS_LOG_ENTER();"; + Write ""; + + if ($fun =~ /(bulkObjectClearStats|bulkObjectGetStats|dbgGenerateDump|getMaximumAttributeCount|getObjectKey|bulkGetAttribute|dbgGenerateDump|tamTelemetryGetData|getObjectCount|queryObjectStage)/) + { + Write " SWSS_LOG_ERROR(\"FIXME, no implementation for $fun!\");"; + Write " return SAI_STATUS_NOT_IMPLEMENTED;"; + Write "}"; + next; + } + + Write " return $STUB" . "->$fun(@par);"; + Write "}"; + Write ""; + } +} + +# +# MAIN +# + + +LogError "Option SaiDir not specifird (-d)" if not defined $optionSaiDir; +LogError "Option Class not specifird (-c)" if not defined $optionClass; +LogError "Option Namespace not specifird (-n)" if not defined $optionNamespace; +LogError "Option FileName not specifird (-f)" if not defined $optionFileName; +LogError "Option Stub not specifird (-s)" if not defined $optionStub; + +LogInfo "optionSaiDir = $optionSaiDir "; +LogInfo "optionClass = $optionClass "; +LogInfo "optionNamespace = $optionNamespace"; +LogInfo "optionFileName = $optionFileName "; +LogInfo "optionStub = $optionStub "; + +GetData(); +SanitizeData(); +ExtractData(); +CreateHeader(); +CreateApiStricts(); +CreateApiStruct(); +CreateApiQuery(); +CreateGlobalApis(); +WriteFile($optionFileName,$SOURCE_CONTENT); diff --git a/syncd/Syncd.cpp b/syncd/Syncd.cpp index e29481c60..09f066a9e 100644 --- a/syncd/Syncd.cpp +++ b/syncd/Syncd.cpp @@ -196,7 +196,7 @@ Syncd::Syncd( m_test_services = m_smt.getServiceMethodTable(); - sai_status_t status = vendorSai->initialize(0, &m_test_services); + sai_status_t status = vendorSai->apiInitialize(0, &m_test_services); if (status != SAI_STATUS_SUCCESS) { @@ -489,7 +489,7 @@ sai_status_t Syncd::processAttrEnumValuesCapabilityQuery( enumCapList.count = list_size; enumCapList.list = enum_capabilities_list.data(); - sai_status_t status = m_vendorSai->queryAattributeEnumValuesCapability(switchRid, objectType, attrId, &enumCapList); + sai_status_t status = m_vendorSai->queryAttributeEnumValuesCapability(switchRid, objectType, attrId, &enumCapList); std::vector entry; @@ -5206,7 +5206,7 @@ void Syncd::run() SWSS_LOG_NOTICE("calling api uninitialize"); - status = m_vendorSai->uninitialize(); + status = m_vendorSai->apiUninitialize(); if (status != SAI_STATUS_SUCCESS) { diff --git a/syncd/VendorSai.cpp b/syncd/VendorSai.cpp index c90f00f9a..db8aba66b 100644 --- a/syncd/VendorSai.cpp +++ b/syncd/VendorSai.cpp @@ -66,13 +66,13 @@ VendorSai::~VendorSai() if (m_apiInitialized) { - uninitialize(); + apiUninitialize(); } } // INITIALIZE UNINITIALIZE -sai_status_t VendorSai::initialize( +sai_status_t VendorSai::apiInitialize( _In_ uint64_t flags, _In_ const sai_service_method_table_t *service_method_table) { @@ -142,7 +142,7 @@ sai_status_t VendorSai::initialize( return status; } -sai_status_t VendorSai::uninitialize(void) +sai_status_t VendorSai::apiUninitialize(void) { SWSS_LOG_ENTER(); VENDOR_CHECK_API_INITIALIZED(); @@ -608,6 +608,43 @@ sai_status_t VendorSai::bulkSet( return SAI_STATUS_NOT_SUPPORTED; } +sai_status_t VendorSai::bulkGet( + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_id_t *object_id, + _In_ const uint32_t *attr_count, + _Inout_ sai_attribute_t **attr_list, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses) +{ + SWSS_LOG_ENTER(); + + SWSS_LOG_ERROR("not implemented, FIXME"); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + +// BULK GET + +#define DECLARE_BULK_GET_ENTRY(OT,ot) \ +sai_status_t VendorSai::bulkGet( \ + _In_ uint32_t object_count, \ + _In_ const sai_ ## ot ## _t *ot, \ + _In_ const uint32_t *attr_count, \ + _Inout_ sai_attribute_t **attr_list, \ + _In_ sai_bulk_op_error_mode_t mode, \ + _Out_ sai_status_t *object_statuses) \ +{ \ + MUTEX(); \ + SWSS_LOG_ENTER(); \ + VENDOR_CHECK_API_INITIALIZED(); \ + SWSS_LOG_ERROR("FIXME not implemented"); \ + return SAI_STATUS_NOT_IMPLEMENTED; \ +} + +SAIREDIS_DECLARE_EVERY_BULK_ENTRY(DECLARE_BULK_GET_ENTRY); + + // BULK QUAD ENTRY sai_status_t VendorSai::bulkCreate( @@ -1629,7 +1666,7 @@ sai_status_t VendorSai::queryAttributeCapability( capability); } -sai_status_t VendorSai::queryAattributeEnumValuesCapability( +sai_status_t VendorSai::queryAttributeEnumValuesCapability( _In_ sai_object_id_t switchId, _In_ sai_object_type_t objectType, _In_ sai_attr_id_t attrId, diff --git a/syncd/VendorSai.h b/syncd/VendorSai.h index 00e659e2f..3f2ccc48c 100644 --- a/syncd/VendorSai.h +++ b/syncd/VendorSai.h @@ -25,11 +25,11 @@ namespace syncd public: - sai_status_t initialize( + sai_status_t apiInitialize( _In_ uint64_t flags, _In_ const sai_service_method_table_t *service_method_table) override; - sai_status_t uninitialize(void) override; + sai_status_t apiUninitialize(void) override; public: // SAI interface overrides @@ -87,6 +87,15 @@ namespace syncd _In_ sai_bulk_op_error_mode_t mode, _Out_ sai_status_t *object_statuses) override; + virtual sai_status_t bulkGet( + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_id_t *object_id, + _In_ const uint32_t *attr_count, + _Inout_ sai_attribute_t **attr_list, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses) override; + public: // stats API virtual sai_status_t getStats( @@ -186,7 +195,7 @@ namespace syncd _In_ sai_attr_id_t attr_id, _Out_ sai_attr_capability_t *capability) override; - virtual sai_status_t queryAattributeEnumValuesCapability( + virtual sai_status_t queryAttributeEnumValuesCapability( _In_ sai_object_id_t switch_id, _In_ sai_object_type_t object_type, _In_ sai_attr_id_t attr_id, diff --git a/syncd/tests.cpp b/syncd/tests.cpp index 332b8c80f..a150f935e 100644 --- a/syncd/tests.cpp +++ b/syncd/tests.cpp @@ -699,6 +699,7 @@ void test_invoke_dump() SWSS_LOG_ENTER(); clearDB(); + swss::Logger::getInstance().setMinPrio(swss::Logger::SWSS_DEBUG); auto syncd = std::make_shared(syncdThread); syncd->detach(); @@ -708,7 +709,7 @@ void test_invoke_dump() auto sairedis = std::make_shared(); - sai_status_t status = sairedis->initialize(0, &test_services); + sai_status_t status = sairedis->apiInitialize(0, &test_services); CHECK_STATUS(status); @@ -768,11 +769,11 @@ int main() sai_api_uninitialize(); - printf("\n[ %s ]\n\n", sai_serialize_status(SAI_STATUS_SUCCESS).c_str()); - - test_watchdog_timer_clock_rollback(); + //test_watchdog_timer_clock_rollback(); test_invoke_dump(); + + printf("\n[ %s ]\n\n", sai_serialize_status(SAI_STATUS_SUCCESS).c_str()); } catch (const std::exception &e) { diff --git a/syncd/tests/TestSyncdBrcm.cpp b/syncd/tests/TestSyncdBrcm.cpp index 385b0a11d..b776d45e8 100644 --- a/syncd/tests/TestSyncdBrcm.cpp +++ b/syncd/tests/TestSyncdBrcm.cpp @@ -109,7 +109,7 @@ class SyncdBrcmTest : public ::testing::Test m_sairedis = std::make_shared(); - auto status = m_sairedis->initialize(0, &test_services); + auto status = m_sairedis->apiInitialize(0, &test_services); ASSERT_EQ(status, SAI_STATUS_SUCCESS); // set communication mode @@ -137,7 +137,7 @@ class SyncdBrcmTest : public ::testing::Test // uninitialize SAI redis - auto status = m_sairedis->uninitialize(); + auto status = m_sairedis->apiUninitialize(); ASSERT_EQ(status, SAI_STATUS_SUCCESS); // stop syncd worker diff --git a/syncd/tests/TestSyncdMlnx.cpp b/syncd/tests/TestSyncdMlnx.cpp index b2f625518..34311cb42 100644 --- a/syncd/tests/TestSyncdMlnx.cpp +++ b/syncd/tests/TestSyncdMlnx.cpp @@ -115,7 +115,7 @@ class SyncdMlnxTest : public ::testing::Test m_sairedis = std::make_shared(); - auto status = m_sairedis->initialize(0, &test_services); + auto status = m_sairedis->apiInitialize(0, &test_services); ASSERT_EQ(status, SAI_STATUS_SUCCESS); // set communication mode @@ -155,7 +155,7 @@ class SyncdMlnxTest : public ::testing::Test // uninitialize SAI redis - auto status = m_sairedis->uninitialize(); + auto status = m_sairedis->apiUninitialize(); ASSERT_EQ(status, SAI_STATUS_SUCCESS); // stop syncd worker @@ -177,7 +177,7 @@ TEST_F(SyncdMlnxTest, queryAttrEnumValuesCapability) { sai_s32_list_t data = { .count = 0, .list = nullptr }; - auto status = m_sairedis->queryAattributeEnumValuesCapability( + auto status = m_sairedis->queryAttributeEnumValuesCapability( m_switchId, SAI_OBJECT_TYPE_HASH, SAI_HASH_ATTR_NATIVE_HASH_FIELD_LIST, &data ); ASSERT_EQ(status, SAI_STATUS_BUFFER_OVERFLOW); @@ -185,7 +185,7 @@ TEST_F(SyncdMlnxTest, queryAttrEnumValuesCapability) std::vector hfList(data.count); data.list = hfList.data(); - status = m_sairedis->queryAattributeEnumValuesCapability( + status = m_sairedis->queryAttributeEnumValuesCapability( m_switchId, SAI_OBJECT_TYPE_HASH, SAI_HASH_ATTR_NATIVE_HASH_FIELD_LIST, &data ); ASSERT_EQ(status, SAI_STATUS_SUCCESS); diff --git a/syncd/tests/TestSyncdNvdaBf.cpp b/syncd/tests/TestSyncdNvdaBf.cpp index 33c1d1227..21935ea13 100644 --- a/syncd/tests/TestSyncdNvdaBf.cpp +++ b/syncd/tests/TestSyncdNvdaBf.cpp @@ -132,7 +132,7 @@ void SyncdNvdaBfTest::SetUp() m_sairedis = std::make_shared(); - auto status = m_sairedis->initialize(0, &test_services); + auto status = m_sairedis->apiInitialize(0, &test_services); ASSERT_EQ(status, SAI_STATUS_SUCCESS); // set communication mode @@ -168,7 +168,7 @@ void SyncdNvdaBfTest::TearDown() // uninitialize SAI redis - auto status = m_sairedis->uninitialize(); + auto status = m_sairedis->apiUninitialize(); ASSERT_EQ(status, SAI_STATUS_SUCCESS); // stop syncd worker diff --git a/tests/aspellcheck.pl b/tests/aspellcheck.pl index 73c2609a7..4b28a6b18 100755 --- a/tests/aspellcheck.pl +++ b/tests/aspellcheck.pl @@ -151,6 +151,7 @@ sub RunAspell next if $file =~ m!/config.h!; next if $file =~ m!/python/.+wrap.cpp!; next if $file =~ m!/pyext/.+wrap.cpp!; + next if $file =~ m!sai_(redis|proxy|vs|stub).cpp!; my $data = ReadFile $file; diff --git a/tests/checksaiapi.sh b/tests/checksaiapi.sh index 03730d8d1..05894fd8d 100755 --- a/tests/checksaiapi.sh +++ b/tests/checksaiapi.sh @@ -29,14 +29,14 @@ do done | grep "U sai_" | awk '{print $1}' | -perl -ne 'chomp; die "file $_ is using global sai_xxx API, please correct your code" if not /VendorSai.o|saisdkdump/' +perl -ne 'chomp; die "file $_ is using global sai_xxx API, please correct your code" if not /VendorSai.o|sai_redis.o|sai_vs.o|sai_proxy.o|saisdkdump/' REGEX=`cat SAI/meta/saimetadata.c|grep dlsym|grep handle|perl -ne 'print "$1|" if /(sai_\w+)/'|perl -pe 'chop'|perl -ne 'print "\\\\b($_)\\\\b"'` set +e find -name "*.cpp" -o -name "*.c" | xargs grep -P "$REGEX" | -grep -vP "/unittest/|/tests/|/SAI/|/pyext/|tests.cpp|sai_vs_interfacequery|sai_proxy_interfacequery|sai_redis_interfacequery|saisdkdump|SWSS_LOG|.cpp:\s+\*|.cpp:\s+//|sai_status_t\s+sai_|VendorSai.cpp:.+=\s*&sai_" +grep -vP "/unittest/|/tests/|/SAI/|/pyext/|tests.cpp|sai_vs.cpp|sai_proxy.cpp|sai_redis.cpp|saisdkdump|SWSS_LOG|.cpp:\s+\*|.cpp:\s+//|sai_status_t\s+sai_|VendorSai.cpp:.+=\s*&sai_" if [ $? == 0 ]; then echo not allowed files are using global sai_xxx API, please correct your code, only VendorSai.cpp and saisdkdump are allowed to use global SAI apis diff --git a/unittest/lib/Makefile.am b/unittest/lib/Makefile.am index 881795774..62e3a187f 100644 --- a/unittest/lib/Makefile.am +++ b/unittest/lib/Makefile.am @@ -1,6 +1,6 @@ AM_CXXFLAGS = $(SAIINC) -I$(top_srcdir)/meta -I$(top_srcdir)/lib -bin_PROGRAMS = tests testslibsairedis +bin_PROGRAMS = tests LDADD_GTEST = -L/usr/src/gtest -lgtest -lgtest_main @@ -23,73 +23,12 @@ tests_SOURCES = \ TestRedisVidIndexGenerator.cpp \ TestRecorder.cpp \ TestRedisChannel.cpp \ + TestClientSai.cpp \ + TestRedisRemoteSaiInterface.cpp \ + TestServerSai.cpp \ TestSai.cpp tests_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) tests_LDADD = $(LDADD_GTEST) $(top_srcdir)/lib/libSaiRedis.a -lhiredis -lswsscommon -lpthread -L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta -lzmq $(CODE_COVERAGE_LIBS) -testslibsairedis_SOURCES = main_libsairedis.cpp \ - test_sai_redis_acl.cpp \ - test_sai_redis_bfd.cpp \ - test_sai_redis_bmtor.cpp \ - test_sai_redis_bridge.cpp \ - test_sai_redis_buffer.cpp \ - test_sai_redis_counter.cpp \ - test_sai_redis_dash_vip.cpp \ - test_sai_redis_dash_pa_validation.cpp \ - test_sai_redis_dash_vnet.cpp \ - test_sai_redis_dash_outbound_routing.cpp \ - test_sai_redis_dash_outbound_ca_to_pa.cpp \ - test_sai_redis_dash_inbound_routing.cpp \ - test_sai_redis_dash_eni.cpp \ - test_sai_redis_dash_direction_lookup.cpp \ - test_sai_redis_dash_acl.cpp \ - test_sai_redis_debug_counter.cpp \ - test_sai_redis_dtel.cpp \ - test_sai_redis_fdb.cpp \ - test_sai_redis_generic_programmable.cpp \ - test_sai_redis_ipmc.cpp \ - test_sai_redis_l2mc.cpp \ - test_sai_redis_l2mcgroup.cpp \ - test_sai_redis_lag.cpp \ - test_sai_redis_ipmc_group.cpp \ - test_sai_redis_macsec.cpp \ - test_sai_redis_isolation_group.cpp \ - test_sai_redis_interfacequery.cpp \ - test_sai_redis_mcastfdb.cpp \ - test_sai_redis_mirror.cpp \ - test_sai_redis_mpls.cpp \ - test_sai_redis_nat.cpp \ - test_sai_redis_hash.cpp \ - test_sai_redis_neighbor.cpp \ - test_sai_redis_nexthop.cpp \ - test_sai_redis_nexthopgroup.cpp \ - test_sai_redis_port.cpp \ - test_sai_redis_qosmap.cpp \ - test_sai_redis_policer.cpp \ - test_sai_redis_queue.cpp \ - test_sai_redis_route.cpp \ - test_sai_redis_router_interface.cpp \ - test_sai_redis_router_rpfgroup.cpp \ - test_sai_redis_router_samplepacket.cpp \ - test_sai_redis_schedulergroup.cpp \ - test_sai_redis_scheduler.cpp \ - test_sai_redis_srv6.cpp \ - test_sai_redis_switch.cpp \ - test_sai_redis_system_port.cpp \ - test_sai_redis_tam.cpp \ - test_sai_redis_tunnel.cpp \ - test_sai_redis_stp.cpp \ - test_sai_redis_udf.cpp \ - test_sai_redis_virtual_router.cpp \ - test_sai_redis_vlan.cpp \ - test_sai_redis_hostif.cpp \ - test_sai_redis_wred.cpp \ - test_sai_redis_ars.cpp \ - test_sai_redis_poe.cpp \ - test_sai_redis_ars_profile.cpp - -testslibsairedis_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) -testslibsairedis_LDADD = $(LDADD_GTEST) -L$(top_srcdir)/lib/.libs -lsairedis -lhiredis -lswsscommon -lpthread -L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta -lzmq $(CODE_COVERAGE_LIBS) - -TESTS = testslibsairedis tests +TESTS = tests diff --git a/unittest/lib/TestClientSai.cpp b/unittest/lib/TestClientSai.cpp new file mode 100644 index 000000000..b080fd23a --- /dev/null +++ b/unittest/lib/TestClientSai.cpp @@ -0,0 +1,52 @@ +#include "ClientSai.h" + +#include + +#include + +using namespace sairedis; + +static const char* profile_get_value( + _In_ sai_switch_profile_id_t profile_id, + _In_ const char* variable) +{ + SWSS_LOG_ENTER(); + return NULL; +} + +static int profile_get_next_value( + _In_ sai_switch_profile_id_t profile_id, + _Out_ const char** variable, + _Out_ const char** value) +{ + SWSS_LOG_ENTER(); + return -1; +} + +static sai_service_method_table_t test_services = { + profile_get_value, + profile_get_next_value +}; + +TEST(ClientSai, bulkGet) +{ + ClientSai sai; + + sai.apiInitialize(0,&test_services); + + sai_object_id_t oids[1] = {0}; + uint32_t attrcount[1] = {0}; + sai_attribute_t* attrs[1] = {0}; + sai_status_t statuses[1] = {0}; + + EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, + sai.bulkGet( + SAI_OBJECT_TYPE_PORT, + 1, + oids, + attrcount, + attrs, + SAI_BULK_OP_ERROR_MODE_STOP_ON_ERROR, + statuses)); +} + diff --git a/unittest/lib/TestClientServerSai.cpp b/unittest/lib/TestClientServerSai.cpp index 67894f7c2..1f6c06a50 100644 --- a/unittest/lib/TestClientServerSai.cpp +++ b/unittest/lib/TestClientServerSai.cpp @@ -61,23 +61,23 @@ TEST(ClientServerSai, ctr) auto css = std::make_shared(); } -TEST(ClientServerSai, initialize) +TEST(ClientServerSai, apiInitialize) { auto css = std::make_shared(); - EXPECT_NE(SAI_STATUS_SUCCESS, css->initialize(1, nullptr)); + EXPECT_NE(SAI_STATUS_SUCCESS, css->apiInitialize(1, nullptr)); - EXPECT_NE(SAI_STATUS_SUCCESS, css->initialize(0, nullptr)); + EXPECT_NE(SAI_STATUS_SUCCESS, css->apiInitialize(0, nullptr)); - EXPECT_EQ(SAI_STATUS_SUCCESS, css->initialize(0, &test_services)); + EXPECT_EQ(SAI_STATUS_SUCCESS, css->apiInitialize(0, &test_services)); css = nullptr; // invoke uninitialize in destructor css = std::make_shared(); - EXPECT_EQ(SAI_STATUS_SUCCESS, css->initialize(0, &test_services)); + EXPECT_EQ(SAI_STATUS_SUCCESS, css->apiInitialize(0, &test_services)); - EXPECT_NE(SAI_STATUS_SUCCESS, css->initialize(0, &test_services)); + EXPECT_NE(SAI_STATUS_SUCCESS, css->apiInitialize(0, &test_services)); } TEST(ClientServerSai, objectTypeQuery) @@ -100,7 +100,7 @@ TEST(ClientServerSai, logSet) EXPECT_NE(SAI_STATUS_SUCCESS, css->logSet(SAI_API_PORT, SAI_LOG_LEVEL_NOTICE)); - EXPECT_EQ(SAI_STATUS_SUCCESS, css->initialize(0, &test_services)); + EXPECT_EQ(SAI_STATUS_SUCCESS, css->apiInitialize(0, &test_services)); EXPECT_EQ(SAI_STATUS_SUCCESS, css->logSet(SAI_API_PORT, SAI_LOG_LEVEL_NOTICE)); } @@ -128,7 +128,7 @@ TEST(ClientServerSai, bulkGetClearStats) SAI_STATS_MODE_BULK_CLEAR, nullptr)); - EXPECT_EQ(SAI_STATUS_SUCCESS, css->initialize(0, &test_services)); + EXPECT_EQ(SAI_STATUS_SUCCESS, css->apiInitialize(0, &test_services)); EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, css->bulkGetStats(SAI_NULL_OBJECT_ID, SAI_OBJECT_TYPE_PORT, @@ -150,7 +150,7 @@ TEST(ClientServerSai, bulkGetClearStats) nullptr)); css = std::make_shared(); - EXPECT_EQ(SAI_STATUS_SUCCESS, css->initialize(0, &test_client_services)); + EXPECT_EQ(SAI_STATUS_SUCCESS, css->apiInitialize(0, &test_client_services)); EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, css->bulkGetStats(SAI_NULL_OBJECT_ID, SAI_OBJECT_TYPE_PORT, @@ -177,14 +177,14 @@ TEST(ClientServerSai, OT) \ { \ auto css = std::make_shared(); \ sai_ ## ot ## _t e = {}; \ - EXPECT_EQ(SAI_STATUS_SUCCESS, css->initialize(0, &test_services)); \ + EXPECT_EQ(SAI_STATUS_SUCCESS, css->apiInitialize(0, &test_services)); \ EXPECT_NE(SAI_STATUS_SUCCESS, css->create(&e, 0, nullptr)); \ EXPECT_NE(SAI_STATUS_SUCCESS, css->set(&e, nullptr)); \ EXPECT_NE(SAI_STATUS_SUCCESS, css->get(&e, 0, nullptr)); \ EXPECT_NE(SAI_STATUS_SUCCESS, css->remove(&e)); \ \ auto ss = std::make_shared(); \ - EXPECT_EQ(SAI_STATUS_SUCCESS, ss->initialize(0, &test_services)); \ + EXPECT_EQ(SAI_STATUS_SUCCESS, ss->apiInitialize(0, &test_services)); \ EXPECT_NE(SAI_STATUS_SUCCESS, ss->create(&e, 0, nullptr)); \ EXPECT_NE(SAI_STATUS_SUCCESS, ss->set(&e, nullptr)); \ EXPECT_NE(SAI_STATUS_SUCCESS, ss->get(&e, 0, nullptr)); \ @@ -198,16 +198,38 @@ TEST(ClientServerSai, bulk_ ## OT) { \ auto css = std::make_shared(); \ sai_ ## ot ## _t e[2] = {}; \ - EXPECT_EQ(SAI_STATUS_SUCCESS, css->initialize(0, &test_services)); \ + EXPECT_EQ(SAI_STATUS_SUCCESS, css->apiInitialize(0, &test_services)); \ EXPECT_NE(SAI_STATUS_SUCCESS, css->bulkCreate(0, e, nullptr, nullptr, SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR, nullptr)); \ EXPECT_NE(SAI_STATUS_SUCCESS, css->bulkSet(2, e, nullptr, SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR, nullptr)); \ EXPECT_NE(SAI_STATUS_SUCCESS, css->bulkRemove(2, e, SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR, nullptr)); \ \ auto ss = std::make_shared(); \ - EXPECT_EQ(SAI_STATUS_SUCCESS, ss->initialize(0, &test_client_services)); \ + EXPECT_EQ(SAI_STATUS_SUCCESS, ss->apiInitialize(0, &test_client_services)); \ EXPECT_NE(SAI_STATUS_SUCCESS, ss->bulkCreate(0, e, nullptr, nullptr, SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR, nullptr)); \ EXPECT_NE(SAI_STATUS_SUCCESS, ss->bulkSet(0, e, nullptr, SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR, nullptr)); \ EXPECT_NE(SAI_STATUS_SUCCESS, ss->bulkRemove(0, e, SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR, nullptr)); \ } SAIREDIS_DECLARE_EVERY_BULK_ENTRY(TEST_BULK_ENTRY) + + +TEST(ClientServerSai, bulkGet) +{ + ClientServerSai sai; + + sai_object_id_t oids[1] = {0}; + uint32_t attrcount[1] = {0}; + sai_attribute_t* attrs[1] = {0}; + sai_status_t statuses[1] = {0}; + + EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, + sai.bulkGet( + SAI_OBJECT_TYPE_PORT, + 1, + oids, + attrcount, + attrs, + SAI_BULK_OP_ERROR_MODE_STOP_ON_ERROR, + statuses)); +} + diff --git a/unittest/lib/TestRedisRemoteSaiInterface.cpp b/unittest/lib/TestRedisRemoteSaiInterface.cpp new file mode 100644 index 000000000..a638228a0 --- /dev/null +++ b/unittest/lib/TestRedisRemoteSaiInterface.cpp @@ -0,0 +1,30 @@ +#include "RedisRemoteSaiInterface.h" +#include "ContextConfigContainer.h" + +#include + +using namespace sairedis; + +TEST(RedisRemoteSaiInterface, bulkGet) +{ + auto ctx = ContextConfigContainer::loadFromFile("foo"); + auto rec = std::make_shared(); + + RedisRemoteSaiInterface sai(ctx->get(0), nullptr, rec); + + sai_object_id_t oids[1] = {0}; + uint32_t attrcount[1] = {0}; + sai_attribute_t* attrs[1] = {0}; + sai_status_t statuses[1] = {0}; + + EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, + sai.bulkGet( + SAI_OBJECT_TYPE_PORT, + 1, + oids, + attrcount, + attrs, + SAI_BULK_OP_ERROR_MODE_STOP_ON_ERROR, + statuses)); +} + diff --git a/unittest/lib/TestSai.cpp b/unittest/lib/TestSai.cpp index 53b30031f..9d3e11790 100644 --- a/unittest/lib/TestSai.cpp +++ b/unittest/lib/TestSai.cpp @@ -34,9 +34,29 @@ TEST(Sai, queryApiVersion) sai_api_version_t version; - sai.initialize(0,&test_services); + sai.apiInitialize(0,&test_services); EXPECT_EQ(sai.queryApiVersion(NULL), SAI_STATUS_INVALID_PARAMETER); EXPECT_EQ(sai.queryApiVersion(&version), SAI_STATUS_SUCCESS); } +TEST(Sai, bulkGet) +{ + Sai sai; + + sai_object_id_t oids[1] = {0}; + uint32_t attrcount[1] = {0}; + sai_attribute_t* attrs[1] = {0}; + sai_status_t statuses[1] = {0}; + + EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, + sai.bulkGet( + SAI_OBJECT_TYPE_PORT, + 1, + oids, + attrcount, + attrs, + SAI_BULK_OP_ERROR_MODE_STOP_ON_ERROR, + statuses)); +} + diff --git a/unittest/lib/TestServerSai.cpp b/unittest/lib/TestServerSai.cpp new file mode 100644 index 000000000..91185c025 --- /dev/null +++ b/unittest/lib/TestServerSai.cpp @@ -0,0 +1,52 @@ +#include "ServerSai.h" + +#include + +#include + +using namespace sairedis; + +static const char* profile_get_value( + _In_ sai_switch_profile_id_t profile_id, + _In_ const char* variable) +{ + SWSS_LOG_ENTER(); + return NULL; +} + +static int profile_get_next_value( + _In_ sai_switch_profile_id_t profile_id, + _Out_ const char** variable, + _Out_ const char** value) +{ + SWSS_LOG_ENTER(); + return -1; +} + +static sai_service_method_table_t test_services = { + profile_get_value, + profile_get_next_value +}; + +TEST(ServerSai, bulkGet) +{ + ServerSai sai; + + sai.apiInitialize(0,&test_services); + + sai_object_id_t oids[1] = {0}; + uint32_t attrcount[1] = {0}; + sai_attribute_t* attrs[1] = {0}; + sai_status_t statuses[1] = {0}; + + EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, + sai.bulkGet( + SAI_OBJECT_TYPE_PORT, + 1, + oids, + attrcount, + attrs, + SAI_BULK_OP_ERROR_MODE_STOP_ON_ERROR, + statuses)); +} + diff --git a/unittest/lib/TestUtils.cpp b/unittest/lib/TestUtils.cpp index cc91c8505..e43df06a3 100644 --- a/unittest/lib/TestUtils.cpp +++ b/unittest/lib/TestUtils.cpp @@ -12,7 +12,7 @@ TEST(Utils, clearOidValues) { sai_attribute_t attr; - sai_object_id_t oids[1]; + sai_object_id_t oids[1] = {0}; attr.id = 1000; diff --git a/unittest/lib/test_sai_redis_acl.cpp b/unittest/lib/test_sai_redis_acl.cpp deleted file mode 100644 index d1db2481e..000000000 --- a/unittest/lib/test_sai_redis_acl.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, acl) -{ - sai_acl_api_t *api = nullptr; - - sai_api_query(SAI_API_ACL, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_acl_table(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_acl_table(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_acl_table_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_acl_table_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_acl_entry(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_acl_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_acl_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_acl_entry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_acl_counter(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_acl_counter(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_acl_counter_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_acl_counter_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_acl_range(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_acl_range(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_acl_range_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_acl_range_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_acl_table_group(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_acl_table_group(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_acl_table_group_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_acl_table_group_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_acl_table_group_member(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_acl_table_group_member(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_acl_table_group_member_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_acl_table_group_member_attribute(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_ars.cpp b/unittest/lib/test_sai_redis_ars.cpp deleted file mode 100644 index 79befdb48..000000000 --- a/unittest/lib/test_sai_redis_ars.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, ars) -{ - sai_ars_api_t *api = nullptr; - - sai_api_query(SAI_API_ARS, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_ars(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_ars(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_ars_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_ars_attribute(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_ars_profile.cpp b/unittest/lib/test_sai_redis_ars_profile.cpp deleted file mode 100644 index 3cb586d12..000000000 --- a/unittest/lib/test_sai_redis_ars_profile.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, ars_profile) -{ - sai_ars_profile_api_t *api = nullptr; - - sai_api_query(SAI_API_ARS_PROFILE, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_ars_profile(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_ars_profile(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_ars_profile_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_ars_profile_attribute(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_bfd.cpp b/unittest/lib/test_sai_redis_bfd.cpp deleted file mode 100644 index 419b3e7cb..000000000 --- a/unittest/lib/test_sai_redis_bfd.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, bfd) -{ - sai_bfd_api_t *api = nullptr; - - sai_api_query(SAI_API_BFD, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_bfd_session(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_bfd_session(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_bfd_session_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bfd_session_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bfd_session_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bfd_session_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_bfd_session_stats(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_bmtor.cpp b/unittest/lib/test_sai_redis_bmtor.cpp deleted file mode 100644 index 60db78606..000000000 --- a/unittest/lib/test_sai_redis_bmtor.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -#include "saiextensions.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, bmtor) -{ - sai_bmtor_api_t *api = nullptr; - - sai_api_query((sai_api_t)SAI_API_BMTOR, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_table_bitmap_classification_entry(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_table_bitmap_classification_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_table_bitmap_classification_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_bitmap_classification_entry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_bitmap_classification_entry_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_bitmap_classification_entry_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_table_bitmap_classification_entry_stats(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_table_bitmap_router_entry(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_table_bitmap_router_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_table_bitmap_router_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_bitmap_router_entry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_bitmap_router_entry_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_bitmap_router_entry_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_table_bitmap_router_entry_stats(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_table_meta_tunnel_entry(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_table_meta_tunnel_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_table_meta_tunnel_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_meta_tunnel_entry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_meta_tunnel_entry_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_meta_tunnel_entry_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_table_meta_tunnel_entry_stats(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_bridge.cpp b/unittest/lib/test_sai_redis_bridge.cpp deleted file mode 100644 index 6575ab41f..000000000 --- a/unittest/lib/test_sai_redis_bridge.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, bridge) -{ - sai_bridge_api_t *api = nullptr; - - sai_api_query(SAI_API_BRIDGE, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_bridge(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_bridge(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_bridge_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bridge_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bridge_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bridge_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_bridge_stats(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_bridge_port(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_bridge_port(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_bridge_port_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bridge_port_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bridge_port_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bridge_port_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_bridge_port_stats(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_buffer.cpp b/unittest/lib/test_sai_redis_buffer.cpp deleted file mode 100644 index aad915ec9..000000000 --- a/unittest/lib/test_sai_redis_buffer.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, buffer) -{ - sai_buffer_api_t *api = nullptr; - - sai_api_query(SAI_API_BUFFER, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_buffer_pool(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_buffer_pool(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_buffer_pool_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_buffer_pool_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_buffer_pool_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_buffer_pool_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_buffer_pool_stats(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_ingress_priority_group(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_ingress_priority_group(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_ingress_priority_group_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_ingress_priority_group_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_ingress_priority_group_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_ingress_priority_group_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_ingress_priority_group_stats(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_buffer_profile(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_buffer_profile(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_buffer_profile_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_buffer_profile_attribute(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_counter.cpp b/unittest/lib/test_sai_redis_counter.cpp deleted file mode 100644 index 97000adf1..000000000 --- a/unittest/lib/test_sai_redis_counter.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, counter) -{ - sai_counter_api_t *api = nullptr; - - sai_api_query(SAI_API_COUNTER, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_counter(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_counter(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_counter_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_counter_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_counter_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_counter_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_counter_stats(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_dash_acl.cpp b/unittest/lib/test_sai_redis_dash_acl.cpp deleted file mode 100644 index f54435572..000000000 --- a/unittest/lib/test_sai_redis_dash_acl.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -#include "saiextensions.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, dash_acl) -{ - sai_dash_acl_api_t *api = nullptr; - - sai_api_query((sai_api_t)SAI_API_DASH_ACL, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dash_acl_group(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dash_acl_group(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_dash_acl_group_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_dash_acl_group_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dash_acl_groups(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dash_acl_groups(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dash_acl_rule(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dash_acl_rule(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_dash_acl_rule_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_dash_acl_rule_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dash_acl_rules(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dash_acl_rules(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/lib/test_sai_redis_dash_direction_lookup.cpp b/unittest/lib/test_sai_redis_dash_direction_lookup.cpp deleted file mode 100644 index 4ecd63a1b..000000000 --- a/unittest/lib/test_sai_redis_dash_direction_lookup.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -#include "saiextensions.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, dash_direction_lookup) -{ - sai_dash_direction_lookup_api_t *api = nullptr; - - sai_api_query((sai_api_t)SAI_API_DASH_DIRECTION_LOOKUP, (void**)&api); - - EXPECT_NE(api, nullptr); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_direction_lookup_entry(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_direction_lookup_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_direction_lookup_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_direction_lookup_entry_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_direction_lookup_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_direction_lookup_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/lib/test_sai_redis_dash_eni.cpp b/unittest/lib/test_sai_redis_dash_eni.cpp deleted file mode 100644 index 4dcac45a4..000000000 --- a/unittest/lib/test_sai_redis_dash_eni.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -#include "saiextensions.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, dash_eni) -{ - sai_dash_eni_api_t *api = nullptr; - - sai_api_query((sai_api_t)SAI_API_DASH_ENI, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_eni_ether_address_map_entry(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_eni_ether_address_map_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_eni_ether_address_map_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_eni_ether_address_map_entry_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_eni_ether_address_map_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_eni_ether_address_map_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_eni(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_eni(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_eni_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_eni_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_eni_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_eni_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_eni_stats(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_enis(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_enis(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/lib/test_sai_redis_dash_inbound_routing.cpp b/unittest/lib/test_sai_redis_dash_inbound_routing.cpp deleted file mode 100644 index 132e014eb..000000000 --- a/unittest/lib/test_sai_redis_dash_inbound_routing.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -#include "saiextensions.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, dash_inbound_routing) -{ - sai_dash_inbound_routing_api_t *api = nullptr; - - sai_api_query((sai_api_t)SAI_API_DASH_INBOUND_ROUTING, (void**)&api); - - EXPECT_NE(api, nullptr); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_inbound_routing_entry(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_inbound_routing_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_inbound_routing_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_inbound_routing_entry_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_inbound_routing_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_inbound_routing_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/lib/test_sai_redis_dash_outbound_ca_to_pa.cpp b/unittest/lib/test_sai_redis_dash_outbound_ca_to_pa.cpp deleted file mode 100644 index 91671cce5..000000000 --- a/unittest/lib/test_sai_redis_dash_outbound_ca_to_pa.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -#include "saiextensions.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, dash_ca_to_pa) -{ - sai_dash_outbound_ca_to_pa_api_t *api = nullptr; - - sai_api_query((sai_api_t)SAI_API_DASH_OUTBOUND_CA_TO_PA, (void**)&api); - - EXPECT_NE(api, nullptr); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_outbound_ca_to_pa_entry(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_outbound_ca_to_pa_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_outbound_ca_to_pa_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_outbound_ca_to_pa_entry_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_outbound_ca_to_pa_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_outbound_ca_to_pa_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/lib/test_sai_redis_dash_outbound_routing.cpp b/unittest/lib/test_sai_redis_dash_outbound_routing.cpp deleted file mode 100644 index 87791668d..000000000 --- a/unittest/lib/test_sai_redis_dash_outbound_routing.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -#include "saiextensions.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, dash_outbound_routing) -{ - sai_dash_outbound_routing_api_t *api = nullptr; - - sai_api_query((sai_api_t)SAI_API_DASH_OUTBOUND_ROUTING, (void**)&api); - - EXPECT_NE(api, nullptr); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_outbound_routing_entry(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_outbound_routing_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_outbound_routing_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_outbound_routing_entry_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_outbound_routing_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_outbound_routing_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/lib/test_sai_redis_dash_pa_validation.cpp b/unittest/lib/test_sai_redis_dash_pa_validation.cpp deleted file mode 100644 index ff8ea16b3..000000000 --- a/unittest/lib/test_sai_redis_dash_pa_validation.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -#include "saiextensions.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, dash_pa_validation) -{ - sai_dash_pa_validation_api_t *api = nullptr; - - sai_api_query((sai_api_t)SAI_API_DASH_PA_VALIDATION, (void**)&api); - - EXPECT_NE(api, nullptr); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_pa_validation_entry(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_pa_validation_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_pa_validation_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_pa_validation_entry_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_pa_validation_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_pa_validation_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/lib/test_sai_redis_dash_vip.cpp b/unittest/lib/test_sai_redis_dash_vip.cpp deleted file mode 100644 index 67337fcc6..000000000 --- a/unittest/lib/test_sai_redis_dash_vip.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -#include "saiextensions.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, dash_vip) -{ - sai_dash_vip_api_t *api = nullptr; - - sai_api_query((sai_api_t)SAI_API_DASH_VIP, (void**)&api); - - EXPECT_NE(api, nullptr); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_vip_entry(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_vip_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_vip_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_vip_entry_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_vip_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_vip_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/lib/test_sai_redis_dash_vnet.cpp b/unittest/lib/test_sai_redis_dash_vnet.cpp deleted file mode 100644 index 61c4d694a..000000000 --- a/unittest/lib/test_sai_redis_dash_vnet.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -#include "saiextensions.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, dash_vnet) -{ - sai_dash_vnet_api_t *api = nullptr; - - sai_api_query((sai_api_t)SAI_API_DASH_VNET, (void**)&api); - - EXPECT_NE(api, nullptr); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_vnet(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_vnet(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_vnet_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_vnet_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_vnets(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_vnets(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/lib/test_sai_redis_debug_counter.cpp b/unittest/lib/test_sai_redis_debug_counter.cpp deleted file mode 100644 index 8382f138a..000000000 --- a/unittest/lib/test_sai_redis_debug_counter.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, debug_counter) -{ - sai_debug_counter_api_t *api = nullptr; - - sai_api_query(SAI_API_DEBUG_COUNTER, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_debug_counter(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_debug_counter(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_debug_counter_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_debug_counter_attribute(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_dtel.cpp b/unittest/lib/test_sai_redis_dtel.cpp deleted file mode 100644 index 681ba5dbb..000000000 --- a/unittest/lib/test_sai_redis_dtel.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, dtel) -{ - sai_dtel_api_t *api = nullptr; - - sai_api_query(SAI_API_DTEL, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dtel(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dtel(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_dtel_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_dtel_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dtel_queue_report(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dtel_queue_report(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_dtel_queue_report_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_dtel_queue_report_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dtel_int_session(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dtel_int_session(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_dtel_int_session_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_dtel_int_session_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dtel_report_session(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dtel_report_session(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_dtel_report_session_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_dtel_report_session_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dtel_event(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dtel_event(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_dtel_event_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_dtel_event_attribute(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_fdb.cpp b/unittest/lib/test_sai_redis_fdb.cpp deleted file mode 100644 index 12133a886..000000000 --- a/unittest/lib/test_sai_redis_fdb.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, fdb) -{ - sai_fdb_api_t *api = nullptr; - - sai_api_query(SAI_API_FDB, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_fdb_entry_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_fdb_entry(&id,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_fdb_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_fdb_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_fdb_entry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->flush_fdb_entries(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_fdb_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_fdb_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_fdb_entries_attribute(0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_fdb_entries_attribute(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/lib/test_sai_redis_generic_programmable.cpp b/unittest/lib/test_sai_redis_generic_programmable.cpp deleted file mode 100644 index 37e79f28f..000000000 --- a/unittest/lib/test_sai_redis_generic_programmable.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, generic_programmable) -{ - sai_generic_programmable_api_t *api = nullptr; - - sai_api_query(SAI_API_GENERIC_PROGRAMMABLE, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t obj_id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_generic_programmable(&obj_id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_generic_programmable(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_generic_programmable_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_generic_programmable_attribute(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_hash.cpp b/unittest/lib/test_sai_redis_hash.cpp deleted file mode 100644 index b68cb1581..000000000 --- a/unittest/lib/test_sai_redis_hash.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, hash) -{ - sai_hash_api_t *api= nullptr; - - sai_api_query(SAI_API_HASH, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_hash(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_hash(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_hash_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_hash_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_fine_grained_hash_field(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_fine_grained_hash_field(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_fine_grained_hash_field_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_fine_grained_hash_field_attribute(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_hostif.cpp b/unittest/lib/test_sai_redis_hostif.cpp deleted file mode 100644 index f1dfaadb3..000000000 --- a/unittest/lib/test_sai_redis_hostif.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, hostif) -{ - sai_hostif_api_t *api= nullptr; - - sai_api_query(SAI_API_HOSTIF, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_hostif(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_hostif(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_hostif_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_hostif_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_hostif_table_entry(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_hostif_table_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_hostif_table_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_hostif_table_entry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_hostif_trap_group(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_hostif_trap_group(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_hostif_trap_group_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_hostif_trap_group_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_hostif_trap(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_hostif_trap(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_hostif_trap_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_hostif_trap_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_hostif_user_defined_trap(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_hostif_user_defined_trap(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_hostif_user_defined_trap_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_hostif_user_defined_trap_attribute(0,0,0)); - - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->recv_hostif_packet(0,0,0,0,0)); - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->send_hostif_packet(0,0,0,0,0)); - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->allocate_hostif_packet(0,0,0,0,0)); - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->free_hostif_packet(0,0)); -} diff --git a/unittest/lib/test_sai_redis_interfacequery.cpp b/unittest/lib/test_sai_redis_interfacequery.cpp deleted file mode 100644 index 3bc28c9f6..000000000 --- a/unittest/lib/test_sai_redis_interfacequery.cpp +++ /dev/null @@ -1,115 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, sai_log_set) -{ - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_log_set(SAI_API_VLAN, SAI_LOG_LEVEL_NOTICE)); -} - -TEST(libsairedis, sai_api_query) -{ - sai_vlan_api_t *api = nullptr; - - EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, sai_api_query(SAI_API_VLAN, nullptr)); - EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, sai_api_query(SAI_API_UNSPECIFIED, (void**)&api)); - -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" - EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, sai_api_query((sai_api_t)(1000), (void**)&api)); -#pragma GCC diagnostic pop - - EXPECT_EQ(SAI_STATUS_SUCCESS, sai_api_query(SAI_API_VLAN, (void**)&api)); -} - -TEST(libsairedis, sai_query_attribute_capability) -{ - EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, sai_query_attribute_capability(0,SAI_OBJECT_TYPE_NULL,0,0)); -} - -TEST(libsairedis, sai_query_attribute_enum_values_capability) -{ - EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, sai_query_attribute_enum_values_capability(0,SAI_OBJECT_TYPE_NULL,0,0)); -} - -TEST(libsairedis, sai_object_type_get_availability) -{ - EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, sai_object_type_get_availability(0,SAI_OBJECT_TYPE_NULL,0,0,0)); -} - -TEST(libsairedis, sai_dbg_generate_dump) -{ - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_dbg_generate_dump(nullptr)); -} - -TEST(libsairedis, sai_object_type_query) -{ - EXPECT_EQ(SAI_OBJECT_TYPE_NULL, sai_object_type_query(SAI_NULL_OBJECT_ID)); -} - -TEST(libsairedis, sai_switch_id_query) -{ - EXPECT_EQ(SAI_NULL_OBJECT_ID, sai_switch_id_query(SAI_NULL_OBJECT_ID)); -} - -TEST(libsairedis, sai_bulk_get_attribute) -{ - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_bulk_get_attribute(0,SAI_OBJECT_TYPE_NULL,0,0,0,0,0)); -} - -TEST(libsairedis, sai_get_maximum_attribute_count) -{ - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_get_maximum_attribute_count(0, SAI_OBJECT_TYPE_NULL,0)); -} - -TEST(libsairedis, sai_get_object_count) -{ - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_get_object_count(0,SAI_OBJECT_TYPE_NULL,0)); -} - -TEST(libsairedis, sai_get_object_key) -{ - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_get_object_key(0,SAI_OBJECT_TYPE_NULL,0,0)); -} - -TEST(libsairedis, sai_query_stats_capability) -{ - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_query_stats_capability(0,SAI_OBJECT_TYPE_NULL,0)); -} - -TEST(libsairedis, sai_bulk_object_get_stats) -{ - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_bulk_object_get_stats(SAI_NULL_OBJECT_ID, - SAI_OBJECT_TYPE_PORT, - 0, - nullptr, - 0, - nullptr, - SAI_STATS_MODE_BULK_READ, - nullptr, - nullptr)); -} - -TEST(libsairedis, sai_bulk_object_clear_stats) -{ - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_bulk_object_clear_stats(SAI_NULL_OBJECT_ID, - SAI_OBJECT_TYPE_PORT, - 0, - nullptr, - 0, - nullptr, - SAI_STATS_MODE_BULK_CLEAR, - nullptr)); -} - -TEST(libsairedis, sai_query_api_version) -{ - sai_api_version_t version; - - EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, sai_query_api_version(nullptr)); - EXPECT_EQ(SAI_STATUS_SUCCESS, sai_query_api_version(&version)); -} diff --git a/unittest/lib/test_sai_redis_ipmc.cpp b/unittest/lib/test_sai_redis_ipmc.cpp deleted file mode 100644 index 1587a0381..000000000 --- a/unittest/lib/test_sai_redis_ipmc.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, ipmc) -{ - sai_ipmc_api_t *api = nullptr; - - sai_api_query(SAI_API_IPMC, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_ipmc_entry_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_ipmc_entry(&id,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_ipmc_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_ipmc_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_ipmc_entry_attribute(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_ipmc_group.cpp b/unittest/lib/test_sai_redis_ipmc_group.cpp deleted file mode 100644 index 9d18702e3..000000000 --- a/unittest/lib/test_sai_redis_ipmc_group.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, ipmc_group) -{ - sai_ipmc_group_api_t *api = nullptr; - - sai_api_query(SAI_API_IPMC_GROUP, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_ipmc_group(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_ipmc_group(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_ipmc_group_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_ipmc_group_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_ipmc_group_member(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_ipmc_group_member(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_ipmc_group_member_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_ipmc_group_member_attribute(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_isolation_group.cpp b/unittest/lib/test_sai_redis_isolation_group.cpp deleted file mode 100644 index da2e6b72f..000000000 --- a/unittest/lib/test_sai_redis_isolation_group.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, isolation_group) -{ - sai_isolation_group_api_t *api = nullptr; - - sai_api_query(SAI_API_ISOLATION_GROUP, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_isolation_group(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_isolation_group(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_isolation_group_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_isolation_group_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_isolation_group_member(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_isolation_group_member(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_isolation_group_member_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_isolation_group_member_attribute(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_l2mc.cpp b/unittest/lib/test_sai_redis_l2mc.cpp deleted file mode 100644 index 532869c4e..000000000 --- a/unittest/lib/test_sai_redis_l2mc.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, l2mc) -{ - sai_l2mc_api_t *api = nullptr; - - sai_api_query(SAI_API_L2MC, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_l2mc_entry_t id ; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_l2mc_entry(&id,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_l2mc_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_l2mc_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_l2mc_entry_attribute(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_l2mcgroup.cpp b/unittest/lib/test_sai_redis_l2mcgroup.cpp deleted file mode 100644 index 8ebc28014..000000000 --- a/unittest/lib/test_sai_redis_l2mcgroup.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, l2mc_group) -{ - sai_l2mc_group_api_t *api = nullptr; - - sai_api_query(SAI_API_L2MC_GROUP, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_l2mc_group(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_l2mc_group(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_l2mc_group_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_l2mc_group_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_l2mc_group_member(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_l2mc_group_member(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_l2mc_group_member_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_l2mc_group_member_attribute(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_lag.cpp b/unittest/lib/test_sai_redis_lag.cpp deleted file mode 100644 index b8f316ab8..000000000 --- a/unittest/lib/test_sai_redis_lag.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, lag) -{ - sai_lag_api_t *api = nullptr; - - sai_api_query(SAI_API_LAG, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_lag(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_lag(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_lag_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_lag_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_lag_member(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_lag_member(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_lag_member_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_lag_member_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_lag_members(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_lag_members(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/lib/test_sai_redis_macsec.cpp b/unittest/lib/test_sai_redis_macsec.cpp deleted file mode 100644 index ca80607d9..000000000 --- a/unittest/lib/test_sai_redis_macsec.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, macsec) -{ - sai_macsec_api_t *api = nullptr; - - sai_api_query(SAI_API_MACSEC, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_macsec(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_macsec(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_macsec_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_macsec_port(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_macsec_port(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_macsec_port_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_port_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_port_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_port_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_macsec_port_stats(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_macsec_flow(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_macsec_flow(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_macsec_flow_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_flow_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_flow_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_flow_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_macsec_flow_stats(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_macsec_sc(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_macsec_sc(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_macsec_sc_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_sc_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_sc_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_sc_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_macsec_sc_stats(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_macsec_sa(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_macsec_sa(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_macsec_sa_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_sa_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_sa_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_sa_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_macsec_sa_stats(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_mcastfdb.cpp b/unittest/lib/test_sai_redis_mcastfdb.cpp deleted file mode 100644 index fd03a340e..000000000 --- a/unittest/lib/test_sai_redis_mcastfdb.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, mcast_fdb) -{ - sai_mcast_fdb_api_t *api = nullptr; - - sai_api_query(SAI_API_MCAST_FDB, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_mcast_fdb_entry_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_mcast_fdb_entry(&id,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_mcast_fdb_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_mcast_fdb_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_mcast_fdb_entry_attribute(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_mirror.cpp b/unittest/lib/test_sai_redis_mirror.cpp deleted file mode 100644 index c474736c1..000000000 --- a/unittest/lib/test_sai_redis_mirror.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, mirror) -{ - sai_mirror_api_t *api = nullptr; - - sai_api_query(SAI_API_MIRROR, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_mirror_session(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_mirror_session(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_mirror_session_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_mirror_session_attribute(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_mpls.cpp b/unittest/lib/test_sai_redis_mpls.cpp deleted file mode 100644 index 626972a7b..000000000 --- a/unittest/lib/test_sai_redis_mpls.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, mpls) -{ - sai_mpls_api_t *api = nullptr; - - sai_api_query(SAI_API_MPLS, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_inseg_entry_t id ; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_inseg_entry(&id,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_inseg_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_inseg_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_inseg_entry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_inseg_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_inseg_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_inseg_entries_attribute(0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_inseg_entries_attribute(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/lib/test_sai_redis_nat.cpp b/unittest/lib/test_sai_redis_nat.cpp deleted file mode 100644 index 8acafc988..000000000 --- a/unittest/lib/test_sai_redis_nat.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, nat) -{ - sai_nat_api_t *api = nullptr; - - sai_api_query(SAI_API_NAT, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_nat_entry_t id ; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_nat_entry(&id,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_nat_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_nat_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_nat_entry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_nat_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_nat_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_nat_entries_attribute(0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_nat_entries_attribute(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - - sai_object_id_t id1; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_nat_zone_counter(&id1,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_nat_zone_counter(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_nat_zone_counter_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_nat_zone_counter_attribute(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_neighbor.cpp b/unittest/lib/test_sai_redis_neighbor.cpp deleted file mode 100644 index 2322873de..000000000 --- a/unittest/lib/test_sai_redis_neighbor.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, neighbor) -{ - sai_neighbor_api_t *api = nullptr; - - sai_api_query(SAI_API_NEIGHBOR, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_neighbor_entry_t id ; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_neighbor_entry(&id,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_neighbor_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_neighbor_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_neighbor_entry_attribute(0,0,0)); - - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->remove_all_neighbor_entries(0)); -} diff --git a/unittest/lib/test_sai_redis_nexthop.cpp b/unittest/lib/test_sai_redis_nexthop.cpp deleted file mode 100644 index dbcd8d2b1..000000000 --- a/unittest/lib/test_sai_redis_nexthop.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, next_hop) -{ - sai_next_hop_api_t *api = nullptr; - - sai_api_query(SAI_API_NEXT_HOP, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_next_hop(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_next_hop(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_next_hop_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_next_hop_attribute(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_nexthopgroup.cpp b/unittest/lib/test_sai_redis_nexthopgroup.cpp deleted file mode 100644 index d8eea4595..000000000 --- a/unittest/lib/test_sai_redis_nexthopgroup.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, next_hop_group) -{ - sai_next_hop_group_api_t *api = nullptr; - - sai_api_query(SAI_API_NEXT_HOP_GROUP, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_next_hop_group(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_next_hop_group(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_next_hop_group_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_next_hop_group_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_next_hop_group_member(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_next_hop_group_member(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_next_hop_group_member_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_next_hop_group_member_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_next_hop_group_members(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_next_hop_group_members(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_next_hop_group_map(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_next_hop_group_map(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_next_hop_group_map_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_next_hop_group_map_attribute(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_poe.cpp b/unittest/lib/test_sai_redis_poe.cpp deleted file mode 100644 index a79deaa27..000000000 --- a/unittest/lib/test_sai_redis_poe.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, poe) -{ - sai_poe_api_t *api = nullptr; - - sai_api_query(SAI_API_POE, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_poe_device(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_poe_device(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_poe_device_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_poe_device_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_poe_pse(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_poe_pse(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_poe_pse_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_poe_pse_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_poe_port(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_poe_port(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_poe_port_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_poe_port_attribute(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_policer.cpp b/unittest/lib/test_sai_redis_policer.cpp deleted file mode 100644 index bb8924e47..000000000 --- a/unittest/lib/test_sai_redis_policer.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, policer) -{ - sai_policer_api_t *api = nullptr; - - sai_api_query(SAI_API_POLICER, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_policer(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_policer(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_policer_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_policer_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_policer_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_policer_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_policer_stats(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_port.cpp b/unittest/lib/test_sai_redis_port.cpp deleted file mode 100644 index 8e920f963..000000000 --- a/unittest/lib/test_sai_redis_port.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, port) -{ - sai_port_api_t *api = nullptr; - - sai_api_query(SAI_API_PORT, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_port(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_port(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_port_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_port_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_port_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_port_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_port_stats(0,0,0)); - - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->clear_port_all_stats(0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_port_pool(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_port_pool(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_port_pool_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_port_pool_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_port_pool_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_port_pool_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_port_pool_stats(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_port_connector(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_port_connector(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_port_connector_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_port_connector_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_port_serdes(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_port_serdes(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_port_serdes_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_port_serdes_attribute(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_qosmap.cpp b/unittest/lib/test_sai_redis_qosmap.cpp deleted file mode 100644 index c7b980f29..000000000 --- a/unittest/lib/test_sai_redis_qosmap.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, qos_map) -{ - sai_qos_map_api_t *api = nullptr; - - sai_api_query(SAI_API_QOS_MAP, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_qos_map(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_qos_map(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_qos_map_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_qos_map_attribute(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_queue.cpp b/unittest/lib/test_sai_redis_queue.cpp deleted file mode 100644 index b4548c3ab..000000000 --- a/unittest/lib/test_sai_redis_queue.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, queue) -{ - sai_queue_api_t *api = nullptr; - - sai_api_query(SAI_API_QUEUE, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_queue(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_queue(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_queue_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_queue_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_queue_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_queue_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_queue_stats(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_route.cpp b/unittest/lib/test_sai_redis_route.cpp deleted file mode 100644 index 9d03cf9a9..000000000 --- a/unittest/lib/test_sai_redis_route.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, route) -{ - sai_route_api_t *api = nullptr; - - sai_api_query(SAI_API_ROUTE, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_route_entry_t id ; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_route_entry(&id,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_route_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_route_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_route_entry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_route_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_route_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_route_entries_attribute(0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_route_entries_attribute(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/lib/test_sai_redis_router_interface.cpp b/unittest/lib/test_sai_redis_router_interface.cpp deleted file mode 100644 index 34a363720..000000000 --- a/unittest/lib/test_sai_redis_router_interface.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, router_interface) -{ - sai_router_interface_api_t *api = nullptr; - - sai_api_query(SAI_API_ROUTER_INTERFACE, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_router_interface(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_router_interface(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_router_interface_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_router_interface_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_router_interface_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_router_interface_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_router_interface_stats(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_router_rpfgroup.cpp b/unittest/lib/test_sai_redis_router_rpfgroup.cpp deleted file mode 100644 index c92424862..000000000 --- a/unittest/lib/test_sai_redis_router_rpfgroup.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, rpf_group) -{ - sai_rpf_group_api_t *api = nullptr; - - sai_api_query(SAI_API_RPF_GROUP, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_rpf_group(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_rpf_group(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_rpf_group_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_rpf_group_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_rpf_group_member(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_rpf_group_member(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_rpf_group_member_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_rpf_group_member_attribute(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_router_samplepacket.cpp b/unittest/lib/test_sai_redis_router_samplepacket.cpp deleted file mode 100644 index 60f23e210..000000000 --- a/unittest/lib/test_sai_redis_router_samplepacket.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, samplepacket) -{ - sai_samplepacket_api_t *api = nullptr; - - sai_api_query(SAI_API_SAMPLEPACKET, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_samplepacket(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_samplepacket(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_samplepacket_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_samplepacket_attribute(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_scheduler.cpp b/unittest/lib/test_sai_redis_scheduler.cpp deleted file mode 100644 index 56849186a..000000000 --- a/unittest/lib/test_sai_redis_scheduler.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, scheduler) -{ - sai_scheduler_api_t *api = nullptr; - - sai_api_query(SAI_API_SCHEDULER, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_scheduler(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_scheduler(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_scheduler_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_scheduler_attribute(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_schedulergroup.cpp b/unittest/lib/test_sai_redis_schedulergroup.cpp deleted file mode 100644 index 4d56a3eae..000000000 --- a/unittest/lib/test_sai_redis_schedulergroup.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, scheduler_group) -{ - sai_scheduler_group_api_t *api = nullptr; - - sai_api_query(SAI_API_SCHEDULER_GROUP, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_scheduler_group(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_scheduler_group(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_scheduler_group_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_scheduler_group_attribute(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_srv6.cpp b/unittest/lib/test_sai_redis_srv6.cpp deleted file mode 100644 index d9c03e99d..000000000 --- a/unittest/lib/test_sai_redis_srv6.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, srv6) -{ - sai_srv6_api_t *api = nullptr; - - sai_api_query(SAI_API_SRV6, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t obj_id; - sai_my_sid_entry_t id ; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_srv6_sidlist(&obj_id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_srv6_sidlist(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_srv6_sidlist_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_srv6_sidlist_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_srv6_sidlists(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_srv6_sidlists(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_my_sid_entry(&id,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_my_sid_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_my_sid_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_my_sid_entry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_my_sid_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_my_sid_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_my_sid_entries_attribute(0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_my_sid_entries_attribute(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/lib/test_sai_redis_stp.cpp b/unittest/lib/test_sai_redis_stp.cpp deleted file mode 100644 index 0cf4e1ced..000000000 --- a/unittest/lib/test_sai_redis_stp.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, stp) -{ - sai_stp_api_t *api = nullptr; - - sai_api_query(SAI_API_STP, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_stp(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_stp(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_stp_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_stp_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_stp_port(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_stp_port(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_stp_port_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_stp_port_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_stp_ports(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_stp_ports(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/lib/test_sai_redis_switch.cpp b/unittest/lib/test_sai_redis_switch.cpp deleted file mode 100644 index c6c97693c..000000000 --- a/unittest/lib/test_sai_redis_switch.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, switch) -{ - sai_switch_api_t *api = nullptr; - - sai_api_query(SAI_API_SWITCH, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_switch(&id,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_switch(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_switch_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_switch_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_switch_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_switch_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_switch_stats(0,0,0)); - - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->switch_mdio_read(0,0,0,0,0)); - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->switch_mdio_write(0,0,0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_switch_tunnel(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_switch_tunnel(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_switch_tunnel_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_switch_tunnel_attribute(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_system_port.cpp b/unittest/lib/test_sai_redis_system_port.cpp deleted file mode 100644 index ee2c5d9f3..000000000 --- a/unittest/lib/test_sai_redis_system_port.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, system_port) -{ - sai_system_port_api_t *api = nullptr; - - sai_api_query(SAI_API_SYSTEM_PORT, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_system_port(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_system_port(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_system_port_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_system_port_attribute(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_tam.cpp b/unittest/lib/test_sai_redis_tam.cpp deleted file mode 100644 index f7899b053..000000000 --- a/unittest/lib/test_sai_redis_tam.cpp +++ /dev/null @@ -1,85 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, tam) -{ - sai_tam_api_t *api = nullptr; - - sai_api_query(SAI_API_TAM, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_math_func(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_math_func(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_math_func_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_math_func_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_report(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_report(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_report_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_report_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_event_threshold(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_event_threshold(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_event_threshold_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_event_threshold_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_int(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_int(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_int_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_int_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_tel_type(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_tel_type(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_tel_type_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_tel_type_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_transport(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_transport(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_transport_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_transport_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_telemetry(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_telemetry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_telemetry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_telemetry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_collector(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_collector(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_collector_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_collector_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_event_action(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_event_action(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_event_action_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_event_action_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_event(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_event(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_event_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_event_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_counter_subscription(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_counter_subscription(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_counter_subscription_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_counter_subscription_attribute(0,0,0)); -} - -TEST(libsairedis, sai_tam_telemetry_get_data) -{ - sai_object_list_t list; - - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_tam_telemetry_get_data(0,list,0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_tunnel.cpp b/unittest/lib/test_sai_redis_tunnel.cpp deleted file mode 100644 index 1eb42b0b8..000000000 --- a/unittest/lib/test_sai_redis_tunnel.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, tunnel) -{ - sai_tunnel_api_t *api = nullptr; - - sai_api_query(SAI_API_TUNNEL, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tunnel_map(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tunnel_map(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tunnel_map_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tunnel_map_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tunnel(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tunnel(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tunnel_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tunnel_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tunnel_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tunnel_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_tunnel_stats(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tunnel_term_table_entry(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tunnel_term_table_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tunnel_term_table_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tunnel_term_table_entry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tunnel_map_entry(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tunnel_map_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tunnel_map_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tunnel_map_entry_attribute(0,0,0)); - - uint32_t attr_count = 0; - sai_status_t status = 0; - sai_attribute_t *p_attr = nullptr; - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tunnels_attribute(0,&id,&attr_count,&p_attr,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,&status)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tunnels_attribute(0,&id,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,&status)); -} - diff --git a/unittest/lib/test_sai_redis_udf.cpp b/unittest/lib/test_sai_redis_udf.cpp deleted file mode 100644 index c233859dc..000000000 --- a/unittest/lib/test_sai_redis_udf.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, udf) -{ - sai_udf_api_t *api = nullptr; - - sai_api_query(SAI_API_UDF, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_udf(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_udf(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_udf_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_udf_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_udf_match(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_udf_match(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_udf_match_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_udf_match_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_udf_group(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_udf_group(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_udf_group_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_udf_group_attribute(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_virtual_router.cpp b/unittest/lib/test_sai_redis_virtual_router.cpp deleted file mode 100644 index 0128d532c..000000000 --- a/unittest/lib/test_sai_redis_virtual_router.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, virtual_router) -{ - sai_virtual_router_api_t *api = nullptr; - - sai_api_query(SAI_API_VIRTUAL_ROUTER, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_virtual_router(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_virtual_router(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_virtual_router_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_virtual_router_attribute(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_vlan.cpp b/unittest/lib/test_sai_redis_vlan.cpp deleted file mode 100644 index e0a0faac6..000000000 --- a/unittest/lib/test_sai_redis_vlan.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, vlan) -{ - sai_vlan_api_t *api = nullptr; - - sai_api_query(SAI_API_VLAN, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_vlan(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_vlan(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_vlan_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_vlan_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_vlan_member(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_vlan_member(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_vlan_member_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_vlan_member_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_vlan_members(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_vlan_members(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_vlan_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_vlan_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_vlan_stats(0,0,0)); -} diff --git a/unittest/lib/test_sai_redis_wred.cpp b/unittest/lib/test_sai_redis_wred.cpp deleted file mode 100644 index dfeffcd22..000000000 --- a/unittest/lib/test_sai_redis_wred.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, wred) -{ - sai_wred_api_t *api = nullptr; - - sai_api_query(SAI_API_WRED, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_wred(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_wred(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_wred_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_wred_attribute(0,0,0)); -} diff --git a/unittest/meta/TestDummySaiInterface.cpp b/unittest/meta/TestDummySaiInterface.cpp index 9682b9e06..afe1b29c7 100644 --- a/unittest/meta/TestDummySaiInterface.cpp +++ b/unittest/meta/TestDummySaiInterface.cpp @@ -10,10 +10,32 @@ TEST(DummySaiInterface, queryApiVersion) { DummySaiInterface sai; - sai.initialize(0,0); + sai.apiInitialize(0,0); sai_api_version_t version; EXPECT_EQ(sai.queryApiVersion(NULL), SAI_STATUS_SUCCESS); EXPECT_EQ(sai.queryApiVersion(&version), SAI_STATUS_SUCCESS); } + +TEST(DummySaiInterface, bulkGet) +{ + DummySaiInterface sai; + + sai.apiInitialize(0,0); + + sai_object_id_t oids[1] = {0}; + uint32_t attrcount[1] = {0}; + sai_attribute_t* attrs[1] = {0}; + sai_status_t statuses[1] = {0}; + + EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, + sai.bulkGet( + SAI_OBJECT_TYPE_PORT, + 1, + oids, + attrcount, + attrs, + SAI_BULK_OP_ERROR_MODE_STOP_ON_ERROR, + statuses)); +} diff --git a/unittest/meta/TestMeta.cpp b/unittest/meta/TestMeta.cpp index 63427e6c2..2aae01635 100644 --- a/unittest/meta/TestMeta.cpp +++ b/unittest/meta/TestMeta.cpp @@ -450,14 +450,14 @@ TEST(Meta, initialize) { Meta m(std::make_shared()); - EXPECT_EQ(SAI_STATUS_SUCCESS, m.initialize(0, 0)); + EXPECT_EQ(SAI_STATUS_SUCCESS, m.apiInitialize(0, 0)); } TEST(Meta, uninitialize) { Meta m(std::make_shared()); - EXPECT_EQ(SAI_STATUS_SUCCESS, m.uninitialize()); + EXPECT_EQ(SAI_STATUS_SUCCESS, m.apiUninitialize()); } TEST(Meta, quad_mcast_fdb_entry) @@ -898,7 +898,7 @@ TEST(Meta, queryAttributeCapability) EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, m.queryAttributeCapability(switchId, SAI_OBJECT_TYPE_ACL_ENTRY, 100000, &cap)); } -TEST(Meta, queryAattributeEnumValuesCapability) +TEST(Meta, queryAttributeEnumValuesCapability) { Meta m(std::make_shared()); @@ -921,21 +921,21 @@ TEST(Meta, queryAattributeEnumValuesCapability) vals[0] = 0; vals[1] = 100000; - EXPECT_EQ(SAI_STATUS_SUCCESS, m.queryAattributeEnumValuesCapability(switchId, SAI_OBJECT_TYPE_SWITCH, SAI_SWITCH_ATTR_SWITCHING_MODE, &list)); + EXPECT_EQ(SAI_STATUS_SUCCESS, m.queryAttributeEnumValuesCapability(switchId, SAI_OBJECT_TYPE_SWITCH, SAI_SWITCH_ATTR_SWITCHING_MODE, &list)); // set count without list; list.list = nullptr; - EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, m.queryAattributeEnumValuesCapability(switchId, SAI_OBJECT_TYPE_SWITCH, SAI_SWITCH_ATTR_SWITCHING_MODE, &list)); + EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, m.queryAttributeEnumValuesCapability(switchId, SAI_OBJECT_TYPE_SWITCH, SAI_SWITCH_ATTR_SWITCHING_MODE, &list)); // non enum attribute - EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, m.queryAattributeEnumValuesCapability(switchId, SAI_OBJECT_TYPE_SWITCH, SAI_SWITCH_ATTR_BCAST_CPU_FLOOD_ENABLE, &list)); + EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, m.queryAttributeEnumValuesCapability(switchId, SAI_OBJECT_TYPE_SWITCH, SAI_SWITCH_ATTR_BCAST_CPU_FLOOD_ENABLE, &list)); // invalid attribute - EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, m.queryAattributeEnumValuesCapability(switchId, SAI_OBJECT_TYPE_SWITCH, 10000, &list)); + EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, m.queryAttributeEnumValuesCapability(switchId, SAI_OBJECT_TYPE_SWITCH, 10000, &list)); } TEST(Meta, meta_validate_stats) @@ -1803,3 +1803,23 @@ TEST(Meta, quad_ars_profile) EXPECT_EQ(SAI_STATUS_SUCCESS, m.remove(SAI_OBJECT_TYPE_ARS_PROFILE, ars_profile)); } + +TEST(Meta, bulkGet) +{ + Meta sai(std::make_shared()); + + sai_object_id_t oids[1] = {0}; + uint32_t attrcount[1] = {0}; + sai_attribute_t* attrs[1] = {0}; + sai_status_t statuses[1] = {0}; + + EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, + sai.bulkGet( + SAI_OBJECT_TYPE_PORT, + 1, + oids, + attrcount, + attrs, + SAI_BULK_OP_ERROR_MODE_STOP_ON_ERROR, + statuses)); +} diff --git a/unittest/proxylib/Makefile.am b/unittest/proxylib/Makefile.am index 5c7e61134..69206d342 100644 --- a/unittest/proxylib/Makefile.am +++ b/unittest/proxylib/Makefile.am @@ -1,6 +1,6 @@ AM_CXXFLAGS = $(SAIINC) -I$(top_srcdir)/meta -I$(top_srcdir)/proxylib -I$(top_srcdir)/lib -bin_PROGRAMS = tests testslibsaiproxy +bin_PROGRAMS = tests LDADD_GTEST = -L/usr/src/gtest -lgtest -lgtest_main @@ -11,68 +11,4 @@ tests_SOURCES = \ tests_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) tests_LDADD = $(LDADD_GTEST) $(top_srcdir)/proxylib/libSaiProxy.a -lhiredis -lswsscommon -lpthread -L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta -lzmq $(CODE_COVERAGE_LIBS) -testslibsaiproxy_SOURCES = main_libsaiproxy.cpp \ - test_sai_proxy_acl.cpp \ - test_sai_proxy_bfd.cpp \ - test_sai_proxy_bmtor.cpp \ - test_sai_proxy_bridge.cpp \ - test_sai_proxy_buffer.cpp \ - test_sai_proxy_counter.cpp \ - test_sai_proxy_dash_vip.cpp \ - test_sai_proxy_dash_pa_validation.cpp \ - test_sai_proxy_dash_vnet.cpp \ - test_sai_proxy_dash_outbound_routing.cpp \ - test_sai_proxy_dash_outbound_ca_to_pa.cpp \ - test_sai_proxy_dash_inbound_routing.cpp \ - test_sai_proxy_dash_eni.cpp \ - test_sai_proxy_dash_direction_lookup.cpp \ - test_sai_proxy_dash_acl.cpp \ - test_sai_proxy_debug_counter.cpp \ - test_sai_proxy_dtel.cpp \ - test_sai_proxy_fdb.cpp \ - test_sai_proxy_generic_programmable.cpp \ - test_sai_proxy_ipmc.cpp \ - test_sai_proxy_l2mc.cpp \ - test_sai_proxy_l2mcgroup.cpp \ - test_sai_proxy_lag.cpp \ - test_sai_proxy_ipmc_group.cpp \ - test_sai_proxy_macsec.cpp \ - test_sai_proxy_isolation_group.cpp \ - test_sai_proxy_interfacequery.cpp \ - test_sai_proxy_mcastfdb.cpp \ - test_sai_proxy_mirror.cpp \ - test_sai_proxy_mpls.cpp \ - test_sai_proxy_nat.cpp \ - test_sai_proxy_hash.cpp \ - test_sai_proxy_neighbor.cpp \ - test_sai_proxy_nexthop.cpp \ - test_sai_proxy_nexthopgroup.cpp \ - test_sai_proxy_port.cpp \ - test_sai_proxy_qosmap.cpp \ - test_sai_proxy_policer.cpp \ - test_sai_proxy_queue.cpp \ - test_sai_proxy_route.cpp \ - test_sai_proxy_router_interface.cpp \ - test_sai_proxy_router_rpfgroup.cpp \ - test_sai_proxy_router_samplepacket.cpp \ - test_sai_proxy_schedulergroup.cpp \ - test_sai_proxy_scheduler.cpp \ - test_sai_proxy_srv6.cpp \ - test_sai_proxy_switch.cpp \ - test_sai_proxy_system_port.cpp \ - test_sai_proxy_tam.cpp \ - test_sai_proxy_tunnel.cpp \ - test_sai_proxy_stp.cpp \ - test_sai_proxy_udf.cpp \ - test_sai_proxy_virtual_router.cpp \ - test_sai_proxy_vlan.cpp \ - test_sai_proxy_hostif.cpp \ - test_sai_proxy_wred.cpp \ - test_sai_proxy_ars.cpp \ - test_sai_proxy_poe.cpp \ - test_sai_proxy_ars_profile.cpp - -testslibsaiproxy_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) -testslibsaiproxy_LDADD = $(LDADD_GTEST) -L$(top_srcdir)/proxylib/.libs -lsaiproxy -lhiredis -lswsscommon -lpthread -L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta -lzmq $(CODE_COVERAGE_LIBS) - -TESTS = testslibsaiproxy tests +TESTS = tests diff --git a/unittest/proxylib/TestSai.cpp b/unittest/proxylib/TestSai.cpp index bc7d26eb2..47ef03767 100644 --- a/unittest/proxylib/TestSai.cpp +++ b/unittest/proxylib/TestSai.cpp @@ -58,3 +58,24 @@ TEST(Sai, queryApiVersion) EXPECT_EQ(sai.queryApiVersion(NULL), SAI_STATUS_INVALID_PARAMETER); EXPECT_EQ(sai.queryApiVersion(&version), SAI_STATUS_SUCCESS); } + +TEST(Sai, bulkGet) +{ + Sai sai; + + sai_object_id_t oids[1] = {0}; + uint32_t attrcount[1] = {0}; + sai_attribute_t* attrs[1] = {0}; + sai_status_t statuses[1] = {0}; + + + EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, + sai.bulkGet( + SAI_OBJECT_TYPE_PORT, + 1, + oids, + attrcount, + attrs, + SAI_BULK_OP_ERROR_MODE_STOP_ON_ERROR, + statuses)); +} diff --git a/unittest/proxylib/test_sai_proxy_acl.cpp b/unittest/proxylib/test_sai_proxy_acl.cpp deleted file mode 100644 index 03f3a7c8b..000000000 --- a/unittest/proxylib/test_sai_proxy_acl.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, acl) -{ - sai_acl_api_t *api = nullptr; - - sai_api_query(SAI_API_ACL, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_acl_table(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_acl_table(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_acl_table_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_acl_table_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_acl_entry(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_acl_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_acl_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_acl_entry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_acl_counter(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_acl_counter(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_acl_counter_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_acl_counter_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_acl_range(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_acl_range(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_acl_range_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_acl_range_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_acl_table_group(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_acl_table_group(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_acl_table_group_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_acl_table_group_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_acl_table_group_member(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_acl_table_group_member(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_acl_table_group_member_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_acl_table_group_member_attribute(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_ars.cpp b/unittest/proxylib/test_sai_proxy_ars.cpp deleted file mode 100644 index 46b321dfa..000000000 --- a/unittest/proxylib/test_sai_proxy_ars.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, ars) -{ - sai_ars_api_t *api = nullptr; - - sai_api_query(SAI_API_ARS, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_ars(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_ars(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_ars_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_ars_attribute(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_ars_profile.cpp b/unittest/proxylib/test_sai_proxy_ars_profile.cpp deleted file mode 100644 index 4dacf0926..000000000 --- a/unittest/proxylib/test_sai_proxy_ars_profile.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, ars_profile) -{ - sai_ars_profile_api_t *api = nullptr; - - sai_api_query(SAI_API_ARS_PROFILE, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_ars_profile(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_ars_profile(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_ars_profile_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_ars_profile_attribute(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_bfd.cpp b/unittest/proxylib/test_sai_proxy_bfd.cpp deleted file mode 100644 index 375490a0f..000000000 --- a/unittest/proxylib/test_sai_proxy_bfd.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, bfd) -{ - sai_bfd_api_t *api = nullptr; - - sai_api_query(SAI_API_BFD, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_bfd_session(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_bfd_session(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_bfd_session_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bfd_session_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bfd_session_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bfd_session_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_bfd_session_stats(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_bmtor.cpp b/unittest/proxylib/test_sai_proxy_bmtor.cpp deleted file mode 100644 index 4cf9309cb..000000000 --- a/unittest/proxylib/test_sai_proxy_bmtor.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -#include "saiextensions.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, bmtor) -{ - sai_bmtor_api_t *api = nullptr; - - sai_api_query((sai_api_t)SAI_API_BMTOR, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_table_bitmap_classification_entry(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_table_bitmap_classification_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_table_bitmap_classification_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_bitmap_classification_entry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_bitmap_classification_entry_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_bitmap_classification_entry_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_table_bitmap_classification_entry_stats(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_table_bitmap_router_entry(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_table_bitmap_router_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_table_bitmap_router_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_bitmap_router_entry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_bitmap_router_entry_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_bitmap_router_entry_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_table_bitmap_router_entry_stats(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_table_meta_tunnel_entry(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_table_meta_tunnel_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_table_meta_tunnel_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_meta_tunnel_entry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_meta_tunnel_entry_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_meta_tunnel_entry_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_table_meta_tunnel_entry_stats(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_bridge.cpp b/unittest/proxylib/test_sai_proxy_bridge.cpp deleted file mode 100644 index 41b62018c..000000000 --- a/unittest/proxylib/test_sai_proxy_bridge.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, bridge) -{ - sai_bridge_api_t *api = nullptr; - - sai_api_query(SAI_API_BRIDGE, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_bridge(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_bridge(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_bridge_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bridge_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bridge_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bridge_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_bridge_stats(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_bridge_port(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_bridge_port(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_bridge_port_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bridge_port_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bridge_port_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bridge_port_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_bridge_port_stats(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_buffer.cpp b/unittest/proxylib/test_sai_proxy_buffer.cpp deleted file mode 100644 index 8e94de6b2..000000000 --- a/unittest/proxylib/test_sai_proxy_buffer.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, buffer) -{ - sai_buffer_api_t *api = nullptr; - - sai_api_query(SAI_API_BUFFER, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_buffer_pool(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_buffer_pool(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_buffer_pool_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_buffer_pool_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_buffer_pool_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_buffer_pool_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_buffer_pool_stats(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_ingress_priority_group(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_ingress_priority_group(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_ingress_priority_group_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_ingress_priority_group_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_ingress_priority_group_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_ingress_priority_group_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_ingress_priority_group_stats(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_buffer_profile(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_buffer_profile(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_buffer_profile_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_buffer_profile_attribute(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_counter.cpp b/unittest/proxylib/test_sai_proxy_counter.cpp deleted file mode 100644 index ba9b08a2c..000000000 --- a/unittest/proxylib/test_sai_proxy_counter.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, counter) -{ - sai_counter_api_t *api = nullptr; - - sai_api_query(SAI_API_COUNTER, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_counter(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_counter(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_counter_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_counter_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_counter_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_counter_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_counter_stats(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_dash_acl.cpp b/unittest/proxylib/test_sai_proxy_dash_acl.cpp deleted file mode 100644 index 0c01886ac..000000000 --- a/unittest/proxylib/test_sai_proxy_dash_acl.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -#include "saiextensions.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, dash_acl) -{ - sai_dash_acl_api_t *api = nullptr; - - sai_api_query((sai_api_t)SAI_API_DASH_ACL, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dash_acl_group(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dash_acl_group(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_dash_acl_group_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_dash_acl_group_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dash_acl_groups(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dash_acl_groups(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dash_acl_rule(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dash_acl_rule(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_dash_acl_rule_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_dash_acl_rule_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dash_acl_rules(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dash_acl_rules(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_dash_direction_lookup.cpp b/unittest/proxylib/test_sai_proxy_dash_direction_lookup.cpp deleted file mode 100644 index bd6a90c21..000000000 --- a/unittest/proxylib/test_sai_proxy_dash_direction_lookup.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -#include "saiextensions.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, dash_direction_lookup) -{ - sai_dash_direction_lookup_api_t *api = nullptr; - - sai_api_query((sai_api_t)SAI_API_DASH_DIRECTION_LOOKUP, (void**)&api); - - EXPECT_NE(api, nullptr); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_direction_lookup_entry(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_direction_lookup_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_direction_lookup_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_direction_lookup_entry_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_direction_lookup_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_direction_lookup_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_dash_eni.cpp b/unittest/proxylib/test_sai_proxy_dash_eni.cpp deleted file mode 100644 index 21d8424fa..000000000 --- a/unittest/proxylib/test_sai_proxy_dash_eni.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -#include "saiextensions.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, dash_eni) -{ - sai_dash_eni_api_t *api = nullptr; - - sai_api_query((sai_api_t)SAI_API_DASH_ENI, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_eni_ether_address_map_entry(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_eni_ether_address_map_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_eni_ether_address_map_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_eni_ether_address_map_entry_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_eni_ether_address_map_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_eni_ether_address_map_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_eni(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_eni(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_eni_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_eni_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_enis(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_enis(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_dash_inbound_routing.cpp b/unittest/proxylib/test_sai_proxy_dash_inbound_routing.cpp deleted file mode 100644 index 4beabbfb0..000000000 --- a/unittest/proxylib/test_sai_proxy_dash_inbound_routing.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -#include "saiextensions.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, dash_inbound_routing) -{ - sai_dash_inbound_routing_api_t *api = nullptr; - - sai_api_query((sai_api_t)SAI_API_DASH_INBOUND_ROUTING, (void**)&api); - - EXPECT_NE(api, nullptr); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_inbound_routing_entry(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_inbound_routing_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_inbound_routing_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_inbound_routing_entry_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_inbound_routing_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_inbound_routing_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_dash_outbound_ca_to_pa.cpp b/unittest/proxylib/test_sai_proxy_dash_outbound_ca_to_pa.cpp deleted file mode 100644 index 672af07f8..000000000 --- a/unittest/proxylib/test_sai_proxy_dash_outbound_ca_to_pa.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -#include "saiextensions.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, dash_ca_to_pa) -{ - sai_dash_outbound_ca_to_pa_api_t *api = nullptr; - - sai_api_query((sai_api_t)SAI_API_DASH_OUTBOUND_CA_TO_PA, (void**)&api); - - EXPECT_NE(api, nullptr); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_outbound_ca_to_pa_entry(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_outbound_ca_to_pa_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_outbound_ca_to_pa_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_outbound_ca_to_pa_entry_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_outbound_ca_to_pa_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_outbound_ca_to_pa_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_dash_outbound_routing.cpp b/unittest/proxylib/test_sai_proxy_dash_outbound_routing.cpp deleted file mode 100644 index 1f660162e..000000000 --- a/unittest/proxylib/test_sai_proxy_dash_outbound_routing.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -#include "saiextensions.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, dash_outbound_routing) -{ - sai_dash_outbound_routing_api_t *api = nullptr; - - sai_api_query((sai_api_t)SAI_API_DASH_OUTBOUND_ROUTING, (void**)&api); - - EXPECT_NE(api, nullptr); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_outbound_routing_entry(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_outbound_routing_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_outbound_routing_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_outbound_routing_entry_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_outbound_routing_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_outbound_routing_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_dash_pa_validation.cpp b/unittest/proxylib/test_sai_proxy_dash_pa_validation.cpp deleted file mode 100644 index 4ae287ea9..000000000 --- a/unittest/proxylib/test_sai_proxy_dash_pa_validation.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -#include "saiextensions.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, dash_pa_validation) -{ - sai_dash_pa_validation_api_t *api = nullptr; - - sai_api_query((sai_api_t)SAI_API_DASH_PA_VALIDATION, (void**)&api); - - EXPECT_NE(api, nullptr); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_pa_validation_entry(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_pa_validation_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_pa_validation_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_pa_validation_entry_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_pa_validation_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_pa_validation_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_dash_vip.cpp b/unittest/proxylib/test_sai_proxy_dash_vip.cpp deleted file mode 100644 index cc01068d0..000000000 --- a/unittest/proxylib/test_sai_proxy_dash_vip.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -#include "saiextensions.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, dash_vip) -{ - sai_dash_vip_api_t *api = nullptr; - - sai_api_query((sai_api_t)SAI_API_DASH_VIP, (void**)&api); - - EXPECT_NE(api, nullptr); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_vip_entry(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_vip_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_vip_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_vip_entry_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_vip_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_vip_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_dash_vnet.cpp b/unittest/proxylib/test_sai_proxy_dash_vnet.cpp deleted file mode 100644 index 1b1ac4e8f..000000000 --- a/unittest/proxylib/test_sai_proxy_dash_vnet.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -#include "saiextensions.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, dash_vnet) -{ - sai_dash_vnet_api_t *api = nullptr; - - sai_api_query((sai_api_t)SAI_API_DASH_VNET, (void**)&api); - - EXPECT_NE(api, nullptr); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_vnet(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_vnet(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_vnet_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_vnet_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_vnets(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_vnets(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_debug_counter.cpp b/unittest/proxylib/test_sai_proxy_debug_counter.cpp deleted file mode 100644 index d00179740..000000000 --- a/unittest/proxylib/test_sai_proxy_debug_counter.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, debug_counter) -{ - sai_debug_counter_api_t *api = nullptr; - - sai_api_query(SAI_API_DEBUG_COUNTER, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_debug_counter(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_debug_counter(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_debug_counter_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_debug_counter_attribute(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_dtel.cpp b/unittest/proxylib/test_sai_proxy_dtel.cpp deleted file mode 100644 index 101d14762..000000000 --- a/unittest/proxylib/test_sai_proxy_dtel.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, dtel) -{ - sai_dtel_api_t *api = nullptr; - - sai_api_query(SAI_API_DTEL, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dtel(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dtel(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_dtel_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_dtel_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dtel_queue_report(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dtel_queue_report(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_dtel_queue_report_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_dtel_queue_report_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dtel_int_session(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dtel_int_session(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_dtel_int_session_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_dtel_int_session_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dtel_report_session(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dtel_report_session(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_dtel_report_session_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_dtel_report_session_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dtel_event(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dtel_event(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_dtel_event_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_dtel_event_attribute(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_fdb.cpp b/unittest/proxylib/test_sai_proxy_fdb.cpp deleted file mode 100644 index c9f704581..000000000 --- a/unittest/proxylib/test_sai_proxy_fdb.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, fdb) -{ - sai_fdb_api_t *api = nullptr; - - sai_api_query(SAI_API_FDB, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_fdb_entry_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_fdb_entry(&id,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_fdb_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_fdb_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_fdb_entry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->flush_fdb_entries(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_fdb_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_fdb_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_fdb_entries_attribute(0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_fdb_entries_attribute(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_generic_programmable.cpp b/unittest/proxylib/test_sai_proxy_generic_programmable.cpp deleted file mode 100644 index 57804b410..000000000 --- a/unittest/proxylib/test_sai_proxy_generic_programmable.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, generic_programmable) -{ - sai_generic_programmable_api_t *api = nullptr; - - sai_api_query(SAI_API_GENERIC_PROGRAMMABLE, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t obj_id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_generic_programmable(&obj_id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_generic_programmable(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_generic_programmable_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_generic_programmable_attribute(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_hash.cpp b/unittest/proxylib/test_sai_proxy_hash.cpp deleted file mode 100644 index 516cfae26..000000000 --- a/unittest/proxylib/test_sai_proxy_hash.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, hash) -{ - sai_hash_api_t *api= nullptr; - - sai_api_query(SAI_API_HASH, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_hash(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_hash(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_hash_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_hash_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_fine_grained_hash_field(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_fine_grained_hash_field(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_fine_grained_hash_field_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_fine_grained_hash_field_attribute(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_hostif.cpp b/unittest/proxylib/test_sai_proxy_hostif.cpp deleted file mode 100644 index e40f686d4..000000000 --- a/unittest/proxylib/test_sai_proxy_hostif.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, hostif) -{ - sai_hostif_api_t *api= nullptr; - - sai_api_query(SAI_API_HOSTIF, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_hostif(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_hostif(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_hostif_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_hostif_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_hostif_table_entry(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_hostif_table_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_hostif_table_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_hostif_table_entry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_hostif_trap_group(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_hostif_trap_group(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_hostif_trap_group_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_hostif_trap_group_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_hostif_trap(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_hostif_trap(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_hostif_trap_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_hostif_trap_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_hostif_user_defined_trap(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_hostif_user_defined_trap(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_hostif_user_defined_trap_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_hostif_user_defined_trap_attribute(0,0,0)); - - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->recv_hostif_packet(0,0,0,0,0)); - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->send_hostif_packet(0,0,0,0,0)); - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->allocate_hostif_packet(0,0,0,0,0)); - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->free_hostif_packet(0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_interfacequery.cpp b/unittest/proxylib/test_sai_proxy_interfacequery.cpp deleted file mode 100644 index 56dfff7b2..000000000 --- a/unittest/proxylib/test_sai_proxy_interfacequery.cpp +++ /dev/null @@ -1,115 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, sai_log_set) -{ - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_log_set(SAI_API_VLAN, SAI_LOG_LEVEL_NOTICE)); -} - -TEST(libsaiproxy, sai_api_query) -{ - sai_vlan_api_t *api = nullptr; - - EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, sai_api_query(SAI_API_VLAN, nullptr)); - EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, sai_api_query(SAI_API_UNSPECIFIED, (void**)&api)); - -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" - EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, sai_api_query((sai_api_t)(1000), (void**)&api)); -#pragma GCC diagnostic pop - - EXPECT_EQ(SAI_STATUS_SUCCESS, sai_api_query(SAI_API_VLAN, (void**)&api)); -} - -TEST(libsaiproxy, sai_query_attribute_capability) -{ - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_query_attribute_capability(0,SAI_OBJECT_TYPE_NULL,0,0)); -} - -TEST(libsaiproxy, sai_query_attribute_enum_values_capability) -{ - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_query_attribute_enum_values_capability(0,SAI_OBJECT_TYPE_NULL,0,0)); -} - -TEST(libsaiproxy, sai_object_type_get_availability) -{ - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_object_type_get_availability(0,SAI_OBJECT_TYPE_NULL,0,0,0)); -} - -TEST(libsaiproxy, sai_dbg_generate_dump) -{ - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_dbg_generate_dump(nullptr)); -} - -TEST(libsaiproxy, sai_object_type_query) -{ - EXPECT_EQ(SAI_OBJECT_TYPE_NULL, sai_object_type_query(SAI_NULL_OBJECT_ID)); -} - -TEST(libsaiproxy, sai_switch_id_query) -{ - EXPECT_EQ(SAI_NULL_OBJECT_ID, sai_switch_id_query(SAI_NULL_OBJECT_ID)); -} - -TEST(libsaiproxy, sai_bulk_get_attribute) -{ - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_bulk_get_attribute(0,SAI_OBJECT_TYPE_NULL,0,0,0,0,0)); -} - -TEST(libsaiproxy, sai_get_maximum_attribute_count) -{ - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_get_maximum_attribute_count(0, SAI_OBJECT_TYPE_NULL,0)); -} - -TEST(libsaiproxy, sai_get_object_count) -{ - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_get_object_count(0,SAI_OBJECT_TYPE_NULL,0)); -} - -TEST(libsaiproxy, sai_get_object_key) -{ - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_get_object_key(0,SAI_OBJECT_TYPE_NULL,0,0)); -} - -TEST(libsaiproxy, sai_query_stats_capability) -{ - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_query_stats_capability(0,SAI_OBJECT_TYPE_NULL,0)); -} - -TEST(libsaiproxy, sai_bulk_object_get_stats) -{ - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_bulk_object_get_stats(SAI_NULL_OBJECT_ID, - SAI_OBJECT_TYPE_PORT, - 0, - nullptr, - 0, - nullptr, - SAI_STATS_MODE_BULK_READ, - nullptr, - nullptr)); -} - -TEST(libsaiproxy, sai_bulk_object_clear_stats) -{ - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_bulk_object_clear_stats(SAI_NULL_OBJECT_ID, - SAI_OBJECT_TYPE_PORT, - 0, - nullptr, - 0, - nullptr, - SAI_STATS_MODE_BULK_CLEAR, - nullptr)); -} - -TEST(libsaiproxy, sai_query_api_version) -{ - sai_api_version_t version; - - EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, sai_query_api_version(nullptr)); - EXPECT_EQ(SAI_STATUS_SUCCESS, sai_query_api_version(&version)); -} diff --git a/unittest/proxylib/test_sai_proxy_ipmc.cpp b/unittest/proxylib/test_sai_proxy_ipmc.cpp deleted file mode 100644 index 5aa5555d0..000000000 --- a/unittest/proxylib/test_sai_proxy_ipmc.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, ipmc) -{ - sai_ipmc_api_t *api = nullptr; - - sai_api_query(SAI_API_IPMC, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_ipmc_entry_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_ipmc_entry(&id,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_ipmc_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_ipmc_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_ipmc_entry_attribute(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_ipmc_group.cpp b/unittest/proxylib/test_sai_proxy_ipmc_group.cpp deleted file mode 100644 index 50a56ead6..000000000 --- a/unittest/proxylib/test_sai_proxy_ipmc_group.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, ipmc_group) -{ - sai_ipmc_group_api_t *api = nullptr; - - sai_api_query(SAI_API_IPMC_GROUP, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_ipmc_group(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_ipmc_group(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_ipmc_group_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_ipmc_group_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_ipmc_group_member(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_ipmc_group_member(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_ipmc_group_member_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_ipmc_group_member_attribute(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_isolation_group.cpp b/unittest/proxylib/test_sai_proxy_isolation_group.cpp deleted file mode 100644 index 23faaa490..000000000 --- a/unittest/proxylib/test_sai_proxy_isolation_group.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, isolation_group) -{ - sai_isolation_group_api_t *api = nullptr; - - sai_api_query(SAI_API_ISOLATION_GROUP, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_isolation_group(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_isolation_group(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_isolation_group_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_isolation_group_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_isolation_group_member(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_isolation_group_member(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_isolation_group_member_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_isolation_group_member_attribute(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_l2mc.cpp b/unittest/proxylib/test_sai_proxy_l2mc.cpp deleted file mode 100644 index 1c646905a..000000000 --- a/unittest/proxylib/test_sai_proxy_l2mc.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, l2mc) -{ - sai_l2mc_api_t *api = nullptr; - - sai_api_query(SAI_API_L2MC, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_l2mc_entry_t id ; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_l2mc_entry(&id,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_l2mc_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_l2mc_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_l2mc_entry_attribute(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_l2mcgroup.cpp b/unittest/proxylib/test_sai_proxy_l2mcgroup.cpp deleted file mode 100644 index 0c92d1bae..000000000 --- a/unittest/proxylib/test_sai_proxy_l2mcgroup.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, l2mc_group) -{ - sai_l2mc_group_api_t *api = nullptr; - - sai_api_query(SAI_API_L2MC_GROUP, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_l2mc_group(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_l2mc_group(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_l2mc_group_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_l2mc_group_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_l2mc_group_member(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_l2mc_group_member(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_l2mc_group_member_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_l2mc_group_member_attribute(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_lag.cpp b/unittest/proxylib/test_sai_proxy_lag.cpp deleted file mode 100644 index 0cad93689..000000000 --- a/unittest/proxylib/test_sai_proxy_lag.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, lag) -{ - sai_lag_api_t *api = nullptr; - - sai_api_query(SAI_API_LAG, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_lag(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_lag(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_lag_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_lag_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_lag_member(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_lag_member(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_lag_member_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_lag_member_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_lag_members(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_lag_members(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_macsec.cpp b/unittest/proxylib/test_sai_proxy_macsec.cpp deleted file mode 100644 index c05eed1f3..000000000 --- a/unittest/proxylib/test_sai_proxy_macsec.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, macsec) -{ - sai_macsec_api_t *api = nullptr; - - sai_api_query(SAI_API_MACSEC, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_macsec(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_macsec(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_macsec_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_macsec_port(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_macsec_port(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_macsec_port_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_port_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_port_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_port_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_macsec_port_stats(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_macsec_flow(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_macsec_flow(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_macsec_flow_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_flow_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_flow_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_flow_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_macsec_flow_stats(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_macsec_sc(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_macsec_sc(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_macsec_sc_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_sc_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_sc_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_sc_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_macsec_sc_stats(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_macsec_sa(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_macsec_sa(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_macsec_sa_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_sa_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_sa_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_sa_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_macsec_sa_stats(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_mcastfdb.cpp b/unittest/proxylib/test_sai_proxy_mcastfdb.cpp deleted file mode 100644 index 0514918f8..000000000 --- a/unittest/proxylib/test_sai_proxy_mcastfdb.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, mcast_fdb) -{ - sai_mcast_fdb_api_t *api = nullptr; - - sai_api_query(SAI_API_MCAST_FDB, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_mcast_fdb_entry_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_mcast_fdb_entry(&id,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_mcast_fdb_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_mcast_fdb_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_mcast_fdb_entry_attribute(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_mirror.cpp b/unittest/proxylib/test_sai_proxy_mirror.cpp deleted file mode 100644 index 115e02ae3..000000000 --- a/unittest/proxylib/test_sai_proxy_mirror.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, mirror) -{ - sai_mirror_api_t *api = nullptr; - - sai_api_query(SAI_API_MIRROR, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_mirror_session(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_mirror_session(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_mirror_session_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_mirror_session_attribute(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_mpls.cpp b/unittest/proxylib/test_sai_proxy_mpls.cpp deleted file mode 100644 index 40339c97b..000000000 --- a/unittest/proxylib/test_sai_proxy_mpls.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, mpls) -{ - sai_mpls_api_t *api = nullptr; - - sai_api_query(SAI_API_MPLS, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_inseg_entry_t id ; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_inseg_entry(&id,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_inseg_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_inseg_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_inseg_entry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_inseg_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_inseg_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_inseg_entries_attribute(0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_inseg_entries_attribute(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_nat.cpp b/unittest/proxylib/test_sai_proxy_nat.cpp deleted file mode 100644 index 8c5e3d40c..000000000 --- a/unittest/proxylib/test_sai_proxy_nat.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, nat) -{ - sai_nat_api_t *api = nullptr; - - sai_api_query(SAI_API_NAT, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_nat_entry_t id ; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_nat_entry(&id,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_nat_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_nat_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_nat_entry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_nat_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_nat_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_nat_entries_attribute(0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_nat_entries_attribute(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - - sai_object_id_t id1; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_nat_zone_counter(&id1,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_nat_zone_counter(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_nat_zone_counter_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_nat_zone_counter_attribute(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_neighbor.cpp b/unittest/proxylib/test_sai_proxy_neighbor.cpp deleted file mode 100644 index 2c44be0b0..000000000 --- a/unittest/proxylib/test_sai_proxy_neighbor.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, neighbor) -{ - sai_neighbor_api_t *api = nullptr; - - sai_api_query(SAI_API_NEIGHBOR, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_neighbor_entry_t id ; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_neighbor_entry(&id,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_neighbor_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_neighbor_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_neighbor_entry_attribute(0,0,0)); - - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->remove_all_neighbor_entries(0)); -} diff --git a/unittest/proxylib/test_sai_proxy_nexthop.cpp b/unittest/proxylib/test_sai_proxy_nexthop.cpp deleted file mode 100644 index fd5b5399e..000000000 --- a/unittest/proxylib/test_sai_proxy_nexthop.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, next_hop) -{ - sai_next_hop_api_t *api = nullptr; - - sai_api_query(SAI_API_NEXT_HOP, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_next_hop(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_next_hop(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_next_hop_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_next_hop_attribute(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_nexthopgroup.cpp b/unittest/proxylib/test_sai_proxy_nexthopgroup.cpp deleted file mode 100644 index 87c40847d..000000000 --- a/unittest/proxylib/test_sai_proxy_nexthopgroup.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, next_hop_group) -{ - sai_next_hop_group_api_t *api = nullptr; - - sai_api_query(SAI_API_NEXT_HOP_GROUP, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_next_hop_group(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_next_hop_group(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_next_hop_group_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_next_hop_group_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_next_hop_group_member(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_next_hop_group_member(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_next_hop_group_member_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_next_hop_group_member_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_next_hop_group_members(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_next_hop_group_members(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_next_hop_group_map(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_next_hop_group_map(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_next_hop_group_map_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_next_hop_group_map_attribute(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_poe.cpp b/unittest/proxylib/test_sai_proxy_poe.cpp deleted file mode 100644 index efa7ab2c5..000000000 --- a/unittest/proxylib/test_sai_proxy_poe.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, poe) -{ - sai_poe_api_t *api = nullptr; - - sai_api_query(SAI_API_POE, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_poe_device(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_poe_device(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_poe_device_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_poe_device_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_poe_pse(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_poe_pse(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_poe_pse_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_poe_pse_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_poe_port(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_poe_port(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_poe_port_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_poe_port_attribute(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_policer.cpp b/unittest/proxylib/test_sai_proxy_policer.cpp deleted file mode 100644 index da8ef45ae..000000000 --- a/unittest/proxylib/test_sai_proxy_policer.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, policer) -{ - sai_policer_api_t *api = nullptr; - - sai_api_query(SAI_API_POLICER, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_policer(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_policer(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_policer_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_policer_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_policer_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_policer_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_policer_stats(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_port.cpp b/unittest/proxylib/test_sai_proxy_port.cpp deleted file mode 100644 index f24877bc3..000000000 --- a/unittest/proxylib/test_sai_proxy_port.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, port) -{ - sai_port_api_t *api = nullptr; - - sai_api_query(SAI_API_PORT, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_port(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_port(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_port_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_port_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_port_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_port_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_port_stats(0,0,0)); - - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->clear_port_all_stats(0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_port_pool(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_port_pool(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_port_pool_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_port_pool_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_port_pool_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_port_pool_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_port_pool_stats(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_port_connector(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_port_connector(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_port_connector_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_port_connector_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_port_serdes(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_port_serdes(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_port_serdes_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_port_serdes_attribute(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_qosmap.cpp b/unittest/proxylib/test_sai_proxy_qosmap.cpp deleted file mode 100644 index 3dd3811d0..000000000 --- a/unittest/proxylib/test_sai_proxy_qosmap.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, qos_map) -{ - sai_qos_map_api_t *api = nullptr; - - sai_api_query(SAI_API_QOS_MAP, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_qos_map(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_qos_map(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_qos_map_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_qos_map_attribute(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_queue.cpp b/unittest/proxylib/test_sai_proxy_queue.cpp deleted file mode 100644 index c230ca56a..000000000 --- a/unittest/proxylib/test_sai_proxy_queue.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, queue) -{ - sai_queue_api_t *api = nullptr; - - sai_api_query(SAI_API_QUEUE, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_queue(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_queue(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_queue_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_queue_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_queue_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_queue_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_queue_stats(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_route.cpp b/unittest/proxylib/test_sai_proxy_route.cpp deleted file mode 100644 index f7369b159..000000000 --- a/unittest/proxylib/test_sai_proxy_route.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, route) -{ - sai_route_api_t *api = nullptr; - - sai_api_query(SAI_API_ROUTE, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_route_entry_t id ; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_route_entry(&id,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_route_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_route_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_route_entry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_route_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_route_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_route_entries_attribute(0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_route_entries_attribute(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_router_interface.cpp b/unittest/proxylib/test_sai_proxy_router_interface.cpp deleted file mode 100644 index 0dbd98fac..000000000 --- a/unittest/proxylib/test_sai_proxy_router_interface.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, router_interface) -{ - sai_router_interface_api_t *api = nullptr; - - sai_api_query(SAI_API_ROUTER_INTERFACE, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_router_interface(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_router_interface(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_router_interface_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_router_interface_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_router_interface_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_router_interface_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_router_interface_stats(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_router_rpfgroup.cpp b/unittest/proxylib/test_sai_proxy_router_rpfgroup.cpp deleted file mode 100644 index 362c20f35..000000000 --- a/unittest/proxylib/test_sai_proxy_router_rpfgroup.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, rpf_group) -{ - sai_rpf_group_api_t *api = nullptr; - - sai_api_query(SAI_API_RPF_GROUP, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_rpf_group(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_rpf_group(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_rpf_group_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_rpf_group_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_rpf_group_member(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_rpf_group_member(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_rpf_group_member_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_rpf_group_member_attribute(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_router_samplepacket.cpp b/unittest/proxylib/test_sai_proxy_router_samplepacket.cpp deleted file mode 100644 index 1bec595d8..000000000 --- a/unittest/proxylib/test_sai_proxy_router_samplepacket.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, samplepacket) -{ - sai_samplepacket_api_t *api = nullptr; - - sai_api_query(SAI_API_SAMPLEPACKET, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_samplepacket(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_samplepacket(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_samplepacket_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_samplepacket_attribute(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_scheduler.cpp b/unittest/proxylib/test_sai_proxy_scheduler.cpp deleted file mode 100644 index e1b2a77fe..000000000 --- a/unittest/proxylib/test_sai_proxy_scheduler.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, scheduler) -{ - sai_scheduler_api_t *api = nullptr; - - sai_api_query(SAI_API_SCHEDULER, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_scheduler(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_scheduler(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_scheduler_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_scheduler_attribute(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_schedulergroup.cpp b/unittest/proxylib/test_sai_proxy_schedulergroup.cpp deleted file mode 100644 index 48e581220..000000000 --- a/unittest/proxylib/test_sai_proxy_schedulergroup.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, scheduler_group) -{ - sai_scheduler_group_api_t *api = nullptr; - - sai_api_query(SAI_API_SCHEDULER_GROUP, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_scheduler_group(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_scheduler_group(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_scheduler_group_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_scheduler_group_attribute(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_srv6.cpp b/unittest/proxylib/test_sai_proxy_srv6.cpp deleted file mode 100644 index d8ba0f748..000000000 --- a/unittest/proxylib/test_sai_proxy_srv6.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, srv6) -{ - sai_srv6_api_t *api = nullptr; - - sai_api_query(SAI_API_SRV6, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t obj_id; - sai_my_sid_entry_t id ; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_srv6_sidlist(&obj_id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_srv6_sidlist(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_srv6_sidlist_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_srv6_sidlist_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_srv6_sidlists(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_srv6_sidlists(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_my_sid_entry(&id,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_my_sid_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_my_sid_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_my_sid_entry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_my_sid_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_my_sid_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_my_sid_entries_attribute(0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_my_sid_entries_attribute(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_stp.cpp b/unittest/proxylib/test_sai_proxy_stp.cpp deleted file mode 100644 index 4be8b2053..000000000 --- a/unittest/proxylib/test_sai_proxy_stp.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, stp) -{ - sai_stp_api_t *api = nullptr; - - sai_api_query(SAI_API_STP, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_stp(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_stp(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_stp_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_stp_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_stp_port(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_stp_port(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_stp_port_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_stp_port_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_stp_ports(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_stp_ports(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_switch.cpp b/unittest/proxylib/test_sai_proxy_switch.cpp deleted file mode 100644 index b78ad7ac5..000000000 --- a/unittest/proxylib/test_sai_proxy_switch.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, switch) -{ - sai_switch_api_t *api = nullptr; - - sai_api_query(SAI_API_SWITCH, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_switch(&id,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_switch(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_switch_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_switch_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_switch_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_switch_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_switch_stats(0,0,0)); - - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->switch_mdio_read(0,0,0,0,0)); - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->switch_mdio_write(0,0,0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_switch_tunnel(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_switch_tunnel(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_switch_tunnel_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_switch_tunnel_attribute(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_system_port.cpp b/unittest/proxylib/test_sai_proxy_system_port.cpp deleted file mode 100644 index ed4b3ac5a..000000000 --- a/unittest/proxylib/test_sai_proxy_system_port.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, system_port) -{ - sai_system_port_api_t *api = nullptr; - - sai_api_query(SAI_API_SYSTEM_PORT, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_system_port(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_system_port(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_system_port_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_system_port_attribute(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_tam.cpp b/unittest/proxylib/test_sai_proxy_tam.cpp deleted file mode 100644 index 7b5dfe048..000000000 --- a/unittest/proxylib/test_sai_proxy_tam.cpp +++ /dev/null @@ -1,85 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, tam) -{ - sai_tam_api_t *api = nullptr; - - sai_api_query(SAI_API_TAM, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_math_func(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_math_func(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_math_func_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_math_func_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_report(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_report(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_report_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_report_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_event_threshold(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_event_threshold(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_event_threshold_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_event_threshold_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_int(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_int(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_int_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_int_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_tel_type(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_tel_type(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_tel_type_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_tel_type_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_transport(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_transport(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_transport_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_transport_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_telemetry(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_telemetry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_telemetry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_telemetry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_collector(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_collector(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_collector_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_collector_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_event_action(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_event_action(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_event_action_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_event_action_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_event(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_event(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_event_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_event_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_counter_subscription(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_counter_subscription(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_counter_subscription_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_counter_subscription_attribute(0,0,0)); -} - -TEST(libsaiproxy, sai_tam_telemetry_get_data) -{ - sai_object_list_t list; - - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_tam_telemetry_get_data(0,list,0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_tunnel.cpp b/unittest/proxylib/test_sai_proxy_tunnel.cpp deleted file mode 100644 index 190cb63fa..000000000 --- a/unittest/proxylib/test_sai_proxy_tunnel.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, tunnel) -{ - sai_tunnel_api_t *api = nullptr; - - sai_api_query(SAI_API_TUNNEL, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tunnel_map(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tunnel_map(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tunnel_map_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tunnel_map_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tunnel(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tunnel(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tunnel_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tunnel_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tunnel_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tunnel_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_tunnel_stats(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tunnel_term_table_entry(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tunnel_term_table_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tunnel_term_table_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tunnel_term_table_entry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tunnel_map_entry(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tunnel_map_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tunnel_map_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tunnel_map_entry_attribute(0,0,0)); - - uint32_t attr_count = 0; - sai_status_t status = 0; - sai_attribute_t *p_attr = nullptr; - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tunnels_attribute(0,&id,&attr_count,&p_attr,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,&status)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tunnels_attribute(0,&id,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,&status)); -} - diff --git a/unittest/proxylib/test_sai_proxy_udf.cpp b/unittest/proxylib/test_sai_proxy_udf.cpp deleted file mode 100644 index 1549a56f8..000000000 --- a/unittest/proxylib/test_sai_proxy_udf.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, udf) -{ - sai_udf_api_t *api = nullptr; - - sai_api_query(SAI_API_UDF, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_udf(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_udf(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_udf_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_udf_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_udf_match(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_udf_match(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_udf_match_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_udf_match_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_udf_group(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_udf_group(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_udf_group_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_udf_group_attribute(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_virtual_router.cpp b/unittest/proxylib/test_sai_proxy_virtual_router.cpp deleted file mode 100644 index 0e7b213a9..000000000 --- a/unittest/proxylib/test_sai_proxy_virtual_router.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, virtual_router) -{ - sai_virtual_router_api_t *api = nullptr; - - sai_api_query(SAI_API_VIRTUAL_ROUTER, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_virtual_router(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_virtual_router(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_virtual_router_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_virtual_router_attribute(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_vlan.cpp b/unittest/proxylib/test_sai_proxy_vlan.cpp deleted file mode 100644 index fddf914bf..000000000 --- a/unittest/proxylib/test_sai_proxy_vlan.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, vlan) -{ - sai_vlan_api_t *api = nullptr; - - sai_api_query(SAI_API_VLAN, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_vlan(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_vlan(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_vlan_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_vlan_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_vlan_member(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_vlan_member(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_vlan_member_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_vlan_member_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_vlan_members(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_vlan_members(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_vlan_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_vlan_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_vlan_stats(0,0,0)); -} diff --git a/unittest/proxylib/test_sai_proxy_wred.cpp b/unittest/proxylib/test_sai_proxy_wred.cpp deleted file mode 100644 index de00c4a9c..000000000 --- a/unittest/proxylib/test_sai_proxy_wred.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaiproxy, wred) -{ - sai_wred_api_t *api = nullptr; - - sai_api_query(SAI_API_WRED, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_wred(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_wred(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_wred_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_wred_attribute(0,0,0)); -} diff --git a/unittest/syncd/MockableSaiInterface.cpp b/unittest/syncd/MockableSaiInterface.cpp index 79dac43b1..df2fdc302 100644 --- a/unittest/syncd/MockableSaiInterface.cpp +++ b/unittest/syncd/MockableSaiInterface.cpp @@ -11,7 +11,7 @@ MockableSaiInterface::~MockableSaiInterface() SWSS_LOG_ENTER(); } -sai_status_t MockableSaiInterface::initialize( +sai_status_t MockableSaiInterface::apiInitialize( _In_ uint64_t flags, _In_ const sai_service_method_table_t *service_method_table) { @@ -19,7 +19,7 @@ sai_status_t MockableSaiInterface::initialize( return SAI_STATUS_SUCCESS; } -sai_status_t MockableSaiInterface::uninitialize() +sai_status_t MockableSaiInterface::apiUninitialize() { SWSS_LOG_ENTER(); return SAI_STATUS_SUCCESS; @@ -137,6 +137,22 @@ sai_status_t MockableSaiInterface::bulkSet( return SAI_STATUS_SUCCESS; } +sai_status_t MockableSaiInterface::bulkGet( + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_id_t *object_id, + _In_ const uint32_t *attr_count, + _Inout_ sai_attribute_t **attr_list, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses) +{ + SWSS_LOG_ENTER(); + + SWSS_LOG_ERROR("not implemented, FIXME"); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + sai_status_t MockableSaiInterface::getStats( _In_ sai_object_type_t object_type, _In_ sai_object_id_t object_id, @@ -347,16 +363,16 @@ sai_status_t MockableSaiInterface::queryAttributeCapability( return SAI_STATUS_SUCCESS; } -sai_status_t MockableSaiInterface::queryAattributeEnumValuesCapability( +sai_status_t MockableSaiInterface::queryAttributeEnumValuesCapability( _In_ sai_object_id_t switch_id, _In_ sai_object_type_t object_type, _In_ sai_attr_id_t attr_id, _Inout_ sai_s32_list_t *enum_values_capability) { SWSS_LOG_ENTER(); - if (mock_queryAattributeEnumValuesCapability) + if (mock_queryAttributeEnumValuesCapability) { - return mock_queryAattributeEnumValuesCapability(switch_id, object_type, attr_id, enum_values_capability); + return mock_queryAttributeEnumValuesCapability(switch_id, object_type, attr_id, enum_values_capability); } return SAI_STATUS_SUCCESS; diff --git a/unittest/syncd/MockableSaiInterface.h b/unittest/syncd/MockableSaiInterface.h index c01b51206..f6ab10def 100644 --- a/unittest/syncd/MockableSaiInterface.h +++ b/unittest/syncd/MockableSaiInterface.h @@ -14,10 +14,10 @@ class MockableSaiInterface: public saimeta::DummySaiInterface public: - virtual sai_status_t initialize( + virtual sai_status_t apiInitialize( _In_ uint64_t flags, _In_ const sai_service_method_table_t *service_method_table) override; - virtual sai_status_t uninitialize(void) override; + virtual sai_status_t apiUninitialize(void) override; public: // SAI interface overrides @@ -82,8 +82,18 @@ class MockableSaiInterface: public saimeta::DummySaiInterface _In_ sai_bulk_op_error_mode_t mode, _Out_ sai_status_t *object_statuses) override; + std::function mock_bulkSet; + virtual sai_status_t bulkGet( + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_id_t *object_id, + _In_ const uint32_t *attr_count, + _Inout_ sai_attribute_t **attr_list, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses) override; + public: // stats API virtual sai_status_t getStats( @@ -211,13 +221,13 @@ class MockableSaiInterface: public saimeta::DummySaiInterface std::function mock_queryAttributeCapability; - virtual sai_status_t queryAattributeEnumValuesCapability( + virtual sai_status_t queryAttributeEnumValuesCapability( _In_ sai_object_id_t switch_id, _In_ sai_object_type_t object_type, _In_ sai_attr_id_t attr_id, _Inout_ sai_s32_list_t *enum_values_capability) override; - std::function mock_queryAattributeEnumValuesCapability; + std::function mock_queryAttributeEnumValuesCapability; virtual sai_object_type_t objectTypeQuery( _In_ sai_object_id_t objectId) override; diff --git a/unittest/syncd/TestVendorSai.cpp b/unittest/syncd/TestVendorSai.cpp index f3efbc75d..10a0c1356 100644 --- a/unittest/syncd/TestVendorSai.cpp +++ b/unittest/syncd/TestVendorSai.cpp @@ -54,7 +54,7 @@ class VendorSaiTest : public ::testing::Test { m_vsai = std::make_shared(); - auto status = m_vsai->initialize(0, &test_services); + auto status = m_vsai->apiInitialize(0, &test_services); ASSERT_EQ(status, SAI_STATUS_SUCCESS); sai_attribute_t attr; @@ -70,7 +70,7 @@ class VendorSaiTest : public ::testing::Test auto status = m_vsai->remove(SAI_OBJECT_TYPE_SWITCH, m_swid); ASSERT_EQ(status, SAI_STATUS_SUCCESS); - status = m_vsai->uninitialize(); + status = m_vsai->apiUninitialize(); ASSERT_EQ(status, SAI_STATUS_SUCCESS); } @@ -136,7 +136,7 @@ TEST_F(VendorSaiTest, portBulkAddRemove) TEST(VendorSai, bulkGetStats) { VendorSai sai; - sai.initialize(0, &test_services); + sai.apiInitialize(0, &test_services); ASSERT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai.bulkGetStats(SAI_NULL_OBJECT_ID, SAI_OBJECT_TYPE_PORT, 0, @@ -211,7 +211,7 @@ sai_object_id_t create_rif( TEST(VendorSai, quad_bulk_neighbor_entry) { VendorSai sai; - sai.initialize(0, &test_services); + sai.apiInitialize(0, &test_services); sai_object_id_t switchId = 0; @@ -380,7 +380,7 @@ static void remove_eni(VendorSai &sai, sai_object_id_t eni) TEST(VendorSai, quad_dash_direction_lookup) { VendorSai sai; - sai.initialize(0, &test_services); + sai.apiInitialize(0, &test_services); sai_object_id_t switchid = create_switch(sai); @@ -405,7 +405,7 @@ TEST(VendorSai, quad_dash_direction_lookup) TEST(VendorSai, bulk_dash_direction_lookup) { VendorSai sai; - sai.initialize(0, &test_services); + sai.apiInitialize(0, &test_services); sai_object_id_t switchid = create_switch(sai); @@ -447,7 +447,7 @@ TEST(VendorSai, bulk_dash_direction_lookup) TEST(VendorSai, quad_dash_eni) { VendorSai sai; - sai.initialize(0, &test_services); + sai.apiInitialize(0, &test_services); sai_object_id_t switchid = create_switch(sai); @@ -501,7 +501,7 @@ TEST(VendorSai, quad_dash_eni) TEST(VendorSai, bulk_dash_eni) { VendorSai sai; - sai.initialize(0, &test_services); + sai.apiInitialize(0, &test_services); sai_object_id_t switchid = create_switch(sai); @@ -562,7 +562,7 @@ TEST(VendorSai, bulk_dash_eni) TEST(VendorSai, quad_dash_eni_acl) { VendorSai sai; - sai.initialize(0, &test_services); + sai.apiInitialize(0, &test_services); sai_object_id_t switchid = create_switch(sai); @@ -615,7 +615,7 @@ TEST(VendorSai, quad_dash_eni_acl) TEST(VendorSai, quad_dash_vip) { VendorSai sai; - sai.initialize(0, &test_services); + sai.apiInitialize(0, &test_services); sai_object_id_t switchid = create_switch(sai); @@ -642,7 +642,7 @@ TEST(VendorSai, quad_dash_vip) TEST(VendorSai, bulk_dash_vip) { VendorSai sai; - sai.initialize(0, &test_services); + sai.apiInitialize(0, &test_services); sai_object_id_t switchid = create_switch(sai); @@ -690,7 +690,7 @@ TEST(VendorSai, bulk_dash_vip) TEST(VendorSai, quad_dash_acl_group) { VendorSai sai; - sai.initialize(0, &test_services); + sai.apiInitialize(0, &test_services); sai_object_id_t switchid = create_switch(sai); @@ -711,7 +711,7 @@ TEST(VendorSai, quad_dash_acl_group) TEST(VendorSai, bulk_dash_acl_group) { VendorSai sai; - sai.initialize(0, &test_services); + sai.apiInitialize(0, &test_services); sai_object_id_t switchid = create_switch(sai); @@ -749,7 +749,7 @@ TEST(VendorSai, bulk_dash_acl_group) TEST(VendorSai, quad_dash_acl_rule) { VendorSai sai; - sai.initialize(0, &test_services); + sai.apiInitialize(0, &test_services); sai_object_id_t switchid = create_switch(sai); @@ -827,7 +827,7 @@ TEST(VendorSai, quad_dash_acl_rule) TEST(VendorSai, bulk_dash_acl_rule) { VendorSai sai; - sai.initialize(0, &test_services); + sai.apiInitialize(0, &test_services); sai_object_id_t switchid = create_switch(sai); @@ -924,7 +924,7 @@ TEST(VendorSai, bulk_dash_acl_rule) TEST(VendorSai, quad_dash_vnet) { VendorSai sai; - sai.initialize(0, &test_services); + sai.apiInitialize(0, &test_services); sai_object_id_t switchid = create_switch(sai); @@ -941,7 +941,7 @@ TEST(VendorSai, quad_dash_vnet) TEST(VendorSai, bulk_dash_vnet) { VendorSai sai; - sai.initialize(0, &test_services); + sai.apiInitialize(0, &test_services); sai_object_id_t switchid = create_switch(sai); @@ -979,7 +979,7 @@ TEST(VendorSai, bulk_dash_vnet) TEST(VendorSai, quad_dash_inbound_routing_entry) { VendorSai sai; - sai.initialize(0, &test_services); + sai.apiInitialize(0, &test_services); sai_object_id_t switchid = create_switch(sai); @@ -1015,7 +1015,7 @@ TEST(VendorSai, quad_dash_inbound_routing_entry) TEST(VendorSai, bulk_dash_inbound_routing_entry) { VendorSai sai; - sai.initialize(0, &test_services); + sai.apiInitialize(0, &test_services); sai_object_id_t switchid = create_switch(sai); @@ -1081,7 +1081,7 @@ TEST(VendorSai, bulk_dash_inbound_routing_entry) TEST(VendorSai, quad_dash_pa_validation) { VendorSai sai; - sai.initialize(0, &test_services); + sai.apiInitialize(0, &test_services); sai_object_id_t switchid = create_switch(sai); @@ -1109,7 +1109,7 @@ TEST(VendorSai, quad_dash_pa_validation) TEST(VendorSai, bulk_dash_pa_validation) { VendorSai sai; - sai.initialize(0, &test_services); + sai.apiInitialize(0, &test_services); sai_object_id_t switchid = create_switch(sai); @@ -1164,7 +1164,7 @@ TEST(VendorSai, bulk_dash_pa_validation) TEST(VendorSai, quad_dash_outbound_routing_entry) { VendorSai sai; - sai.initialize(0, &test_services); + sai.apiInitialize(0, &test_services); sai_object_id_t switchid = create_switch(sai); @@ -1210,7 +1210,7 @@ TEST(VendorSai, quad_dash_outbound_routing_entry) TEST(VendorSai, bulk_dash_outbound_routing_entry) { VendorSai sai; - sai.initialize(0, &test_services); + sai.apiInitialize(0, &test_services); sai_object_id_t switchid = create_switch(sai); @@ -1288,7 +1288,7 @@ TEST(VendorSai, bulk_dash_outbound_routing_entry) TEST(VendorSai, quad_dash_outbound_ca_to_pa_entry) { VendorSai sai; - sai.initialize(0, &test_services); + sai.apiInitialize(0, &test_services); sai_object_id_t switchid = create_switch(sai); @@ -1337,7 +1337,7 @@ TEST(VendorSai, quad_dash_outbound_ca_to_pa_entry) TEST(VendorSai, bulk_dash_outbound_ca_to_pa_entry) { VendorSai sai; - sai.initialize(0, &test_services); + sai.apiInitialize(0, &test_services); sai_object_id_t switchid = create_switch(sai); @@ -1405,3 +1405,24 @@ TEST(VendorSai, bulk_dash_outbound_ca_to_pa_entry) remove_counter(sai, counter0); remove_counter(sai, counter1); } + +TEST(VendorSie, bulkGet) +{ + VendorSai sai; + + sai_object_id_t oids[1] = {0}; + uint32_t attrcount[1] = {0}; + sai_attribute_t* attrs[1] = {0}; + sai_status_t statuses[1] = {0}; + + EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, + sai.bulkGet( + SAI_OBJECT_TYPE_PORT, + 1, + oids, + attrcount, + attrs, + SAI_BULK_OP_ERROR_MODE_STOP_ON_ERROR, + statuses)); +} + diff --git a/unittest/syncd/TestVirtualOidTranslator.cpp b/unittest/syncd/TestVirtualOidTranslator.cpp index 90ac58461..09d992a37 100644 --- a/unittest/syncd/TestVirtualOidTranslator.cpp +++ b/unittest/syncd/TestVirtualOidTranslator.cpp @@ -91,7 +91,7 @@ TEST(VirtualOidTranslator, tryTranslateVidToRid) sai_service_method_table_t test_services = smt.getServiceMethodTable(); - sai_status_t status = sai->initialize(0, &test_services); + sai_status_t status = sai->apiInitialize(0, &test_services); EXPECT_EQ(status, SAI_STATUS_SUCCESS); @@ -158,5 +158,5 @@ TEST(VirtualOidTranslator, tryTranslateVidToRid) EXPECT_FALSE(vot.tryTranslateVidToRid(mk)); - sai->uninitialize(); + sai->apiUninitialize(); } diff --git a/unittest/vslib/Makefile.am b/unittest/vslib/Makefile.am index 6ba06de4f..092bcf046 100644 --- a/unittest/vslib/Makefile.am +++ b/unittest/vslib/Makefile.am @@ -1,6 +1,6 @@ AM_CXXFLAGS = $(SAIINC) -I$(top_srcdir)/meta -I$(top_srcdir)/vslib -I$(top_srcdir)/lib -I/usr/include/libnl3 -bin_PROGRAMS = tests testslibsaivs +bin_PROGRAMS = tests LDADD_GTEST = -L/usr/src/gtest -lgtest -lgtest_main @@ -45,74 +45,11 @@ tests_SOURCES = main.cpp \ TestSwitchStateBaseMACsec.cpp \ TestMACsecManager.cpp \ TestSwitchStateBase.cpp \ + TestSai.cpp \ TestVirtualSwitchSaiInterface.cpp tests_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) -fno-access-control tests_LDADD = $(LDADD_GTEST) $(top_srcdir)/vslib/libSaiVS.a -lhiredis -lswsscommon -lnl-genl-3 -lnl-nf-3 -lnl-route-3 -lnl-3 \ -lpthread -L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta -lzmq $(CODE_COVERAGE_LIBS) -testslibsaivs_SOURCES = main_libsaivs.cpp \ - test_sai_vs_acl.cpp \ - test_sai_vs_bfd.cpp \ - test_sai_vs_bmtor.cpp \ - test_sai_vs_bridge.cpp \ - test_sai_vs_buffer.cpp \ - test_sai_vs_counter.cpp \ - test_sai_vs_dash_vip.cpp \ - test_sai_vs_dash_pa_validation.cpp \ - test_sai_vs_dash_vnet.cpp \ - test_sai_vs_dash_outbound_routing.cpp \ - test_sai_vs_dash_outbound_ca_to_pa.cpp \ - test_sai_vs_dash_inbound_routing.cpp \ - test_sai_vs_dash_eni.cpp \ - test_sai_vs_dash_direction_lookup.cpp \ - test_sai_vs_dash_acl.cpp \ - test_sai_vs_debug_counter.cpp \ - test_sai_vs_dtel.cpp \ - test_sai_vs_fdb.cpp \ - test_sai_vs_generic_programmable.cpp \ - test_sai_vs_ipmc.cpp \ - test_sai_vs_l2mc.cpp \ - test_sai_vs_l2mcgroup.cpp \ - test_sai_vs_lag.cpp \ - test_sai_vs_ipmc_group.cpp \ - test_sai_vs_macsec.cpp \ - test_sai_vs_isolation_group.cpp \ - test_sai_vs_interfacequery.cpp \ - test_sai_vs_mcastfdb.cpp \ - test_sai_vs_mirror.cpp \ - test_sai_vs_mpls.cpp \ - test_sai_vs_nat.cpp \ - test_sai_vs_hash.cpp \ - test_sai_vs_neighbor.cpp \ - test_sai_vs_nexthop.cpp \ - test_sai_vs_nexthopgroup.cpp \ - test_sai_vs_port.cpp \ - test_sai_vs_qosmap.cpp \ - test_sai_vs_policer.cpp \ - test_sai_vs_queue.cpp \ - test_sai_vs_route.cpp \ - test_sai_vs_router_interface.cpp \ - test_sai_vs_router_rpfgroup.cpp \ - test_sai_vs_router_samplepacket.cpp \ - test_sai_vs_schedulergroup.cpp \ - test_sai_vs_scheduler.cpp \ - test_sai_vs_srv6.cpp \ - test_sai_vs_switch.cpp \ - test_sai_vs_system_port.cpp \ - test_sai_vs_tam.cpp \ - test_sai_vs_tunnel.cpp \ - test_sai_vs_stp.cpp \ - test_sai_vs_udf.cpp \ - test_sai_vs_virtual_router.cpp \ - test_sai_vs_vlan.cpp \ - test_sai_vs_hostif.cpp \ - test_sai_vs_wred.cpp \ - test_sai_vs_ars.cpp \ - test_sai_vs_poe.cpp \ - test_sai_vs_ars_profile.cpp - -testslibsaivs_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) -testslibsaivs_LDADD = $(LDADD_GTEST) -L$(top_srcdir)/vslib/.libs -lsaivs -lhiredis -lswsscommon -lpthread -L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta -lzmq $(CODE_COVERAGE_LIBS) - -TESTS = testslibsaivs tests +TESTS = tests diff --git a/unittest/vslib/TestSai.cpp b/unittest/vslib/TestSai.cpp new file mode 100644 index 000000000..c45663de8 --- /dev/null +++ b/unittest/vslib/TestSai.cpp @@ -0,0 +1,28 @@ +#include "Sai.h" + +#include + +#include + +using namespace saivs; + +TEST(Sai, bulkGet) +{ + Sai sai; + + sai_object_id_t oids[1] = {0}; + uint32_t attrcount[1] = {0}; + sai_attribute_t* attrs[1] = {0}; + sai_status_t statuses[1] = {0}; + + EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, + sai.bulkGet( + SAI_OBJECT_TYPE_PORT, + 1, + oids, + attrcount, + attrs, + SAI_BULK_OP_ERROR_MODE_STOP_ON_ERROR, + statuses)); +} + diff --git a/unittest/vslib/TestSaiUnittests.cpp b/unittest/vslib/TestSaiUnittests.cpp index e59a1dac5..18fe5f647 100644 --- a/unittest/vslib/TestSaiUnittests.cpp +++ b/unittest/vslib/TestSaiUnittests.cpp @@ -43,7 +43,7 @@ TEST(SaiUnittests, ctr) { Sai sai; - sai.initialize(0, &test_services); + sai.apiInitialize(0, &test_services); std::vector values; @@ -101,7 +101,7 @@ TEST(SaiUnittests, handleUnittestChannelOp) // api not initialized vsntf.send("unknown op", "true", entry); - sai.initialize(0, &test_services); + sai.apiInitialize(0, &test_services); vsntf.send("unknown op", "true", entry); @@ -112,7 +112,7 @@ TEST(SaiUnittests, channelOpSetReadOnlyAttribute) { Sai sai; - sai.initialize(0, &test_services); + sai.apiInitialize(0, &test_services); std::vector values; @@ -154,7 +154,7 @@ TEST(SaiUnittests, channelOpSetStats) { Sai sai; - sai.initialize(0, &test_services); + sai.apiInitialize(0, &test_services); std::vector values; @@ -187,7 +187,7 @@ TEST(SaiUnittests, bulkGetClearStats) { Sai sai; - sai.initialize(0, &test_services); + sai.apiInitialize(0, &test_services); EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai.bulkGetStats(SAI_NULL_OBJECT_ID, SAI_OBJECT_TYPE_PORT, diff --git a/unittest/vslib/TestVirtualSwitchSaiInterface.cpp b/unittest/vslib/TestVirtualSwitchSaiInterface.cpp index f98e541b9..445bc56b6 100644 --- a/unittest/vslib/TestVirtualSwitchSaiInterface.cpp +++ b/unittest/vslib/TestVirtualSwitchSaiInterface.cpp @@ -121,3 +121,22 @@ TEST_F(VirtualSwitchSaiInterfaceTest, queryApiVersion) EXPECT_EQ(m_vssai->queryApiVersion(NULL), SAI_STATUS_INVALID_PARAMETER); EXPECT_EQ(m_vssai->queryApiVersion(&version), SAI_STATUS_SUCCESS); } + +TEST_F(VirtualSwitchSaiInterfaceTest, bulkGet) +{ + sai_object_id_t oids[1] = {0}; + uint32_t attrcount[1] = {0}; + sai_attribute_t* attrs[1] = {0}; + sai_status_t statuses[1] = {0}; + + EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, + m_vssai->bulkGet( + SAI_OBJECT_TYPE_PORT, + 1, + oids, + attrcount, + attrs, + SAI_BULK_OP_ERROR_MODE_STOP_ON_ERROR, + statuses)); +} + diff --git a/unittest/vslib/test_sai_vs_acl.cpp b/unittest/vslib/test_sai_vs_acl.cpp deleted file mode 100644 index 73d0bcbcc..000000000 --- a/unittest/vslib/test_sai_vs_acl.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, acl) -{ - sai_acl_api_t *api = nullptr; - - sai_api_query(SAI_API_ACL, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_acl_table(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_acl_table(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_acl_table_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_acl_table_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_acl_entry(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_acl_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_acl_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_acl_entry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_acl_counter(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_acl_counter(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_acl_counter_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_acl_counter_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_acl_range(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_acl_range(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_acl_range_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_acl_range_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_acl_table_group(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_acl_table_group(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_acl_table_group_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_acl_table_group_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_acl_table_group_member(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_acl_table_group_member(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_acl_table_group_member_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_acl_table_group_member_attribute(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_ars.cpp b/unittest/vslib/test_sai_vs_ars.cpp deleted file mode 100644 index 6ae0d2eae..000000000 --- a/unittest/vslib/test_sai_vs_ars.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, ars) -{ - sai_ars_api_t *api = nullptr; - - sai_api_query(SAI_API_ARS, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_ars(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_ars(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_ars_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_ars_attribute(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_ars_profile.cpp b/unittest/vslib/test_sai_vs_ars_profile.cpp deleted file mode 100644 index f10e421ed..000000000 --- a/unittest/vslib/test_sai_vs_ars_profile.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, ars_profile) -{ - sai_ars_profile_api_t *api = nullptr; - - sai_api_query(SAI_API_ARS_PROFILE, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_ars_profile(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_ars_profile(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_ars_profile_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_ars_profile_attribute(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_bfd.cpp b/unittest/vslib/test_sai_vs_bfd.cpp deleted file mode 100644 index 64c3e7fec..000000000 --- a/unittest/vslib/test_sai_vs_bfd.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, bfd) -{ - sai_bfd_api_t *api = nullptr; - - sai_api_query(SAI_API_BFD, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_bfd_session(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_bfd_session(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_bfd_session_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bfd_session_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bfd_session_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bfd_session_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_bfd_session_stats(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_bmtor.cpp b/unittest/vslib/test_sai_vs_bmtor.cpp deleted file mode 100644 index 31ac349f2..000000000 --- a/unittest/vslib/test_sai_vs_bmtor.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -#include "saiextensions.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, bmtor) -{ - sai_bmtor_api_t *api = nullptr; - - sai_api_query((sai_api_t)SAI_API_BMTOR, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_table_bitmap_classification_entry(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_table_bitmap_classification_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_table_bitmap_classification_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_bitmap_classification_entry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_bitmap_classification_entry_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_bitmap_classification_entry_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_table_bitmap_classification_entry_stats(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_table_bitmap_router_entry(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_table_bitmap_router_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_table_bitmap_router_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_bitmap_router_entry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_bitmap_router_entry_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_bitmap_router_entry_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_table_bitmap_router_entry_stats(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_table_meta_tunnel_entry(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_table_meta_tunnel_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_table_meta_tunnel_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_meta_tunnel_entry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_meta_tunnel_entry_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_table_meta_tunnel_entry_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_table_meta_tunnel_entry_stats(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_bridge.cpp b/unittest/vslib/test_sai_vs_bridge.cpp deleted file mode 100644 index 2e8c8c481..000000000 --- a/unittest/vslib/test_sai_vs_bridge.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, bridge) -{ - sai_bridge_api_t *api = nullptr; - - sai_api_query(SAI_API_BRIDGE, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_bridge(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_bridge(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_bridge_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bridge_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bridge_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bridge_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_bridge_stats(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_bridge_port(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_bridge_port(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_bridge_port_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bridge_port_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bridge_port_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_bridge_port_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_bridge_port_stats(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_buffer.cpp b/unittest/vslib/test_sai_vs_buffer.cpp deleted file mode 100644 index b60b31684..000000000 --- a/unittest/vslib/test_sai_vs_buffer.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, buffer) -{ - sai_buffer_api_t *api = nullptr; - - sai_api_query(SAI_API_BUFFER, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_buffer_pool(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_buffer_pool(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_buffer_pool_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_buffer_pool_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_buffer_pool_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_buffer_pool_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_buffer_pool_stats(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_ingress_priority_group(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_ingress_priority_group(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_ingress_priority_group_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_ingress_priority_group_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_ingress_priority_group_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_ingress_priority_group_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_ingress_priority_group_stats(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_buffer_profile(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_buffer_profile(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_buffer_profile_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_buffer_profile_attribute(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_counter.cpp b/unittest/vslib/test_sai_vs_counter.cpp deleted file mode 100644 index 917be9059..000000000 --- a/unittest/vslib/test_sai_vs_counter.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, counter) -{ - sai_counter_api_t *api = nullptr; - - sai_api_query(SAI_API_COUNTER, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_counter(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_counter(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_counter_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_counter_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_counter_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_counter_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_counter_stats(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_dash_acl.cpp b/unittest/vslib/test_sai_vs_dash_acl.cpp deleted file mode 100644 index b5da844d0..000000000 --- a/unittest/vslib/test_sai_vs_dash_acl.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -#include "saiextensions.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, dash_acl) -{ - sai_dash_acl_api_t *api = nullptr; - - sai_api_query((sai_api_t)SAI_API_DASH_ACL, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dash_acl_group(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dash_acl_group(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_dash_acl_group_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_dash_acl_group_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dash_acl_groups(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dash_acl_groups(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dash_acl_rule(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dash_acl_rule(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_dash_acl_rule_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_dash_acl_rule_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dash_acl_rules(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dash_acl_rules(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/vslib/test_sai_vs_dash_direction_lookup.cpp b/unittest/vslib/test_sai_vs_dash_direction_lookup.cpp deleted file mode 100644 index 6c0735796..000000000 --- a/unittest/vslib/test_sai_vs_dash_direction_lookup.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -#include "saiextensions.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, dash_direction_lookup) -{ - sai_dash_direction_lookup_api_t *api = nullptr; - - sai_api_query((sai_api_t)SAI_API_DASH_DIRECTION_LOOKUP, (void**)&api); - - EXPECT_NE(api, nullptr); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_direction_lookup_entry(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_direction_lookup_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_direction_lookup_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_direction_lookup_entry_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_direction_lookup_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_direction_lookup_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/vslib/test_sai_vs_dash_eni.cpp b/unittest/vslib/test_sai_vs_dash_eni.cpp deleted file mode 100644 index 4b2dd061f..000000000 --- a/unittest/vslib/test_sai_vs_dash_eni.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -#include "saiextensions.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, dash_eni) -{ - sai_dash_eni_api_t *api = nullptr; - - sai_api_query((sai_api_t)SAI_API_DASH_ENI, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_eni_ether_address_map_entry(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_eni_ether_address_map_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_eni_ether_address_map_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_eni_ether_address_map_entry_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_eni_ether_address_map_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_eni_ether_address_map_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_eni(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_eni(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_eni_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_eni_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_eni_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_eni_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_eni_stats(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_enis(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_enis(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/vslib/test_sai_vs_dash_inbound_routing.cpp b/unittest/vslib/test_sai_vs_dash_inbound_routing.cpp deleted file mode 100644 index 7e45d141c..000000000 --- a/unittest/vslib/test_sai_vs_dash_inbound_routing.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -#include "saiextensions.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, dash_inbound_routing) -{ - sai_dash_inbound_routing_api_t *api = nullptr; - - sai_api_query((sai_api_t)SAI_API_DASH_INBOUND_ROUTING, (void**)&api); - - EXPECT_NE(api, nullptr); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_inbound_routing_entry(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_inbound_routing_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_inbound_routing_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_inbound_routing_entry_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_inbound_routing_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_inbound_routing_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/vslib/test_sai_vs_dash_outbound_ca_to_pa.cpp b/unittest/vslib/test_sai_vs_dash_outbound_ca_to_pa.cpp deleted file mode 100644 index a6778cf82..000000000 --- a/unittest/vslib/test_sai_vs_dash_outbound_ca_to_pa.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -#include "saiextensions.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, dash_ca_to_pa) -{ - sai_dash_outbound_ca_to_pa_api_t *api = nullptr; - - sai_api_query((sai_api_t)SAI_API_DASH_OUTBOUND_CA_TO_PA, (void**)&api); - - EXPECT_NE(api, nullptr); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_outbound_ca_to_pa_entry(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_outbound_ca_to_pa_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_outbound_ca_to_pa_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_outbound_ca_to_pa_entry_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_outbound_ca_to_pa_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_outbound_ca_to_pa_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/vslib/test_sai_vs_dash_outbound_routing.cpp b/unittest/vslib/test_sai_vs_dash_outbound_routing.cpp deleted file mode 100644 index e77838975..000000000 --- a/unittest/vslib/test_sai_vs_dash_outbound_routing.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -#include "saiextensions.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, dash_outbound_routing) -{ - sai_dash_outbound_routing_api_t *api = nullptr; - - sai_api_query((sai_api_t)SAI_API_DASH_OUTBOUND_ROUTING, (void**)&api); - - EXPECT_NE(api, nullptr); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_outbound_routing_entry(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_outbound_routing_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_outbound_routing_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_outbound_routing_entry_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_outbound_routing_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_outbound_routing_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/vslib/test_sai_vs_dash_pa_validation.cpp b/unittest/vslib/test_sai_vs_dash_pa_validation.cpp deleted file mode 100644 index 911dda16b..000000000 --- a/unittest/vslib/test_sai_vs_dash_pa_validation.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -#include "saiextensions.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, dash_pa_validation) -{ - sai_dash_pa_validation_api_t *api = nullptr; - - sai_api_query((sai_api_t)SAI_API_DASH_PA_VALIDATION, (void**)&api); - - EXPECT_NE(api, nullptr); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_pa_validation_entry(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_pa_validation_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_pa_validation_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_pa_validation_entry_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_pa_validation_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_pa_validation_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/vslib/test_sai_vs_dash_vip.cpp b/unittest/vslib/test_sai_vs_dash_vip.cpp deleted file mode 100644 index b6cdcc5d1..000000000 --- a/unittest/vslib/test_sai_vs_dash_vip.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -#include "saiextensions.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, dash_vip) -{ - sai_dash_vip_api_t *api = nullptr; - - sai_api_query((sai_api_t)SAI_API_DASH_VIP, (void**)&api); - - EXPECT_NE(api, nullptr); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_vip_entry(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_vip_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_vip_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_vip_entry_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_vip_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_vip_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/vslib/test_sai_vs_dash_vnet.cpp b/unittest/vslib/test_sai_vs_dash_vnet.cpp deleted file mode 100644 index b2c390db2..000000000 --- a/unittest/vslib/test_sai_vs_dash_vnet.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -#include "saiextensions.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, dash_vnet) -{ - sai_dash_vnet_api_t *api = nullptr; - - sai_api_query((sai_api_t)SAI_API_DASH_VNET, (void**)&api); - - EXPECT_NE(api, nullptr); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_vnet(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_vnet(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_vnet_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_vnet_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_vnets(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_vnets(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/vslib/test_sai_vs_debug_counter.cpp b/unittest/vslib/test_sai_vs_debug_counter.cpp deleted file mode 100644 index 551570bbc..000000000 --- a/unittest/vslib/test_sai_vs_debug_counter.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, debug_counter) -{ - sai_debug_counter_api_t *api = nullptr; - - sai_api_query(SAI_API_DEBUG_COUNTER, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_debug_counter(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_debug_counter(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_debug_counter_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_debug_counter_attribute(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_dtel.cpp b/unittest/vslib/test_sai_vs_dtel.cpp deleted file mode 100644 index a77ebdff0..000000000 --- a/unittest/vslib/test_sai_vs_dtel.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, dtel) -{ - sai_dtel_api_t *api = nullptr; - - sai_api_query(SAI_API_DTEL, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dtel(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dtel(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_dtel_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_dtel_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dtel_queue_report(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dtel_queue_report(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_dtel_queue_report_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_dtel_queue_report_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dtel_int_session(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dtel_int_session(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_dtel_int_session_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_dtel_int_session_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dtel_report_session(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dtel_report_session(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_dtel_report_session_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_dtel_report_session_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dtel_event(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dtel_event(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_dtel_event_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_dtel_event_attribute(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_fdb.cpp b/unittest/vslib/test_sai_vs_fdb.cpp deleted file mode 100644 index ec0f2e7bb..000000000 --- a/unittest/vslib/test_sai_vs_fdb.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, fdb) -{ - sai_fdb_api_t *api = nullptr; - - sai_api_query(SAI_API_FDB, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_fdb_entry_t id ; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_fdb_entry(&id,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_fdb_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_fdb_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_fdb_entry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->flush_fdb_entries(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_fdb_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_fdb_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_fdb_entries_attribute(0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_fdb_entries_attribute(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/vslib/test_sai_vs_generic_programmable.cpp b/unittest/vslib/test_sai_vs_generic_programmable.cpp deleted file mode 100644 index ca457c518..000000000 --- a/unittest/vslib/test_sai_vs_generic_programmable.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, generic_programmable) -{ - sai_generic_programmable_api_t *api = nullptr; - - sai_api_query(SAI_API_GENERIC_PROGRAMMABLE, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t obj_id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_generic_programmable(&obj_id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_generic_programmable(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_generic_programmable_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_generic_programmable_attribute(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_hash.cpp b/unittest/vslib/test_sai_vs_hash.cpp deleted file mode 100644 index 29ebebcad..000000000 --- a/unittest/vslib/test_sai_vs_hash.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, hash) -{ - sai_hash_api_t *api= nullptr; - - sai_api_query(SAI_API_HASH, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_hash(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_hash(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_hash_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_hash_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_fine_grained_hash_field(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_fine_grained_hash_field(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_fine_grained_hash_field_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_fine_grained_hash_field_attribute(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_hostif.cpp b/unittest/vslib/test_sai_vs_hostif.cpp deleted file mode 100644 index 919b0cabd..000000000 --- a/unittest/vslib/test_sai_vs_hostif.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, hostif) -{ - sai_hostif_api_t *api= nullptr; - - sai_api_query(SAI_API_HOSTIF, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_hostif(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_hostif(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_hostif_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_hostif_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_hostif_table_entry(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_hostif_table_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_hostif_table_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_hostif_table_entry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_hostif_trap_group(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_hostif_trap_group(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_hostif_trap_group_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_hostif_trap_group_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_hostif_trap(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_hostif_trap(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_hostif_trap_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_hostif_trap_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_hostif_user_defined_trap(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_hostif_user_defined_trap(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_hostif_user_defined_trap_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_hostif_user_defined_trap_attribute(0,0,0)); - - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->recv_hostif_packet(0,0,0,0,0)); - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->send_hostif_packet(0,0,0,0,0)); - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->allocate_hostif_packet(0,0,0,0,0)); - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->free_hostif_packet(0,0)); -} diff --git a/unittest/vslib/test_sai_vs_interfacequery.cpp b/unittest/vslib/test_sai_vs_interfacequery.cpp deleted file mode 100644 index f10592aa9..000000000 --- a/unittest/vslib/test_sai_vs_interfacequery.cpp +++ /dev/null @@ -1,82 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, sai_log_set) -{ - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_log_set(SAI_API_VLAN, SAI_LOG_LEVEL_NOTICE)); -} - -TEST(libsaivs, sai_api_query) -{ - sai_vlan_api_t *api = nullptr; - - EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, sai_api_query(SAI_API_VLAN, nullptr)); - EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, sai_api_query(SAI_API_UNSPECIFIED, (void**)&api)); - -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" - EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, sai_api_query((sai_api_t)(1000), (void**)&api)); -#pragma GCC diagnostic pop - - EXPECT_EQ(SAI_STATUS_SUCCESS, sai_api_query(SAI_API_VLAN, (void**)&api)); -} - -TEST(libsaivs, sai_query_attribute_capability) -{ - EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, sai_query_attribute_capability(0,SAI_OBJECT_TYPE_NULL,0,0)); -} - -TEST(libsaivs, sai_query_attribute_enum_values_capability) -{ - EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, sai_query_attribute_enum_values_capability(0,SAI_OBJECT_TYPE_NULL,0,0)); -} - -TEST(libsaivs, sai_object_type_get_availability) -{ - EXPECT_EQ(SAI_STATUS_INVALID_PARAMETER, sai_object_type_get_availability(0,SAI_OBJECT_TYPE_NULL,0,0,0)); -} - -TEST(libsaivs, sai_dbg_generate_dump) -{ - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_dbg_generate_dump(nullptr)); -} - -TEST(libsaivs, sai_object_type_query) -{ - EXPECT_EQ(SAI_OBJECT_TYPE_NULL, sai_object_type_query(SAI_NULL_OBJECT_ID)); -} - -TEST(libsaivs, sai_switch_id_query) -{ - EXPECT_EQ(SAI_NULL_OBJECT_ID, sai_switch_id_query(SAI_NULL_OBJECT_ID)); -} - -TEST(libsaivs, sai_bulk_object_get_stats) -{ - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_bulk_object_get_stats(SAI_NULL_OBJECT_ID, - SAI_OBJECT_TYPE_PORT, - 0, - nullptr, - 0, - nullptr, - SAI_STATS_MODE_BULK_READ, - nullptr, - nullptr)); -} - -TEST(libsaivs, sai_bulk_object_clear_stats) -{ - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_bulk_object_clear_stats(SAI_NULL_OBJECT_ID, - SAI_OBJECT_TYPE_PORT, - 0, - nullptr, - 0, - nullptr, - SAI_STATS_MODE_BULK_CLEAR, - nullptr)); -} diff --git a/unittest/vslib/test_sai_vs_ipmc.cpp b/unittest/vslib/test_sai_vs_ipmc.cpp deleted file mode 100644 index 0ddb064e9..000000000 --- a/unittest/vslib/test_sai_vs_ipmc.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, ipmc) -{ - sai_ipmc_api_t *api = nullptr; - - sai_api_query(SAI_API_IPMC, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_ipmc_entry_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_ipmc_entry(&id,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_ipmc_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_ipmc_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_ipmc_entry_attribute(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_ipmc_group.cpp b/unittest/vslib/test_sai_vs_ipmc_group.cpp deleted file mode 100644 index cce63e401..000000000 --- a/unittest/vslib/test_sai_vs_ipmc_group.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, ipmc_group) -{ - sai_ipmc_group_api_t *api = nullptr; - - sai_api_query(SAI_API_IPMC_GROUP, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_ipmc_group(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_ipmc_group(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_ipmc_group_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_ipmc_group_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_ipmc_group_member(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_ipmc_group_member(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_ipmc_group_member_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_ipmc_group_member_attribute(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_isolation_group.cpp b/unittest/vslib/test_sai_vs_isolation_group.cpp deleted file mode 100644 index c7c14701d..000000000 --- a/unittest/vslib/test_sai_vs_isolation_group.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, isolation_group) -{ - sai_isolation_group_api_t *api = nullptr; - - sai_api_query(SAI_API_ISOLATION_GROUP, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_isolation_group(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_isolation_group(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_isolation_group_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_isolation_group_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_isolation_group_member(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_isolation_group_member(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_isolation_group_member_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_isolation_group_member_attribute(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_l2mc.cpp b/unittest/vslib/test_sai_vs_l2mc.cpp deleted file mode 100644 index 9e629c46e..000000000 --- a/unittest/vslib/test_sai_vs_l2mc.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, l2mc) -{ - sai_l2mc_api_t *api = nullptr; - - sai_api_query(SAI_API_L2MC, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_l2mc_entry_t id ; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_l2mc_entry(&id,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_l2mc_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_l2mc_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_l2mc_entry_attribute(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_l2mcgroup.cpp b/unittest/vslib/test_sai_vs_l2mcgroup.cpp deleted file mode 100644 index a96c72211..000000000 --- a/unittest/vslib/test_sai_vs_l2mcgroup.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, l2mc_group) -{ - sai_l2mc_group_api_t *api = nullptr; - - sai_api_query(SAI_API_L2MC_GROUP, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_l2mc_group(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_l2mc_group(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_l2mc_group_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_l2mc_group_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_l2mc_group_member(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_l2mc_group_member(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_l2mc_group_member_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_l2mc_group_member_attribute(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_lag.cpp b/unittest/vslib/test_sai_vs_lag.cpp deleted file mode 100644 index a185f8897..000000000 --- a/unittest/vslib/test_sai_vs_lag.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, lag) -{ - sai_lag_api_t *api = nullptr; - - sai_api_query(SAI_API_LAG, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_lag(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_lag(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_lag_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_lag_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_lag_member(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_lag_member(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_lag_member_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_lag_member_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_lag_members(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_lag_members(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/vslib/test_sai_vs_macsec.cpp b/unittest/vslib/test_sai_vs_macsec.cpp deleted file mode 100644 index d285df279..000000000 --- a/unittest/vslib/test_sai_vs_macsec.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, macsec) -{ - sai_macsec_api_t *api = nullptr; - - sai_api_query(SAI_API_MACSEC, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_macsec(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_macsec(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_macsec_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_macsec_port(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_macsec_port(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_macsec_port_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_port_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_port_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_port_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_macsec_port_stats(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_macsec_flow(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_macsec_flow(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_macsec_flow_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_flow_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_flow_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_flow_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_macsec_flow_stats(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_macsec_sc(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_macsec_sc(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_macsec_sc_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_sc_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_sc_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_sc_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_macsec_sc_stats(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_macsec_sa(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_macsec_sa(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_macsec_sa_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_sa_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_sa_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_macsec_sa_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_macsec_sa_stats(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_mcastfdb.cpp b/unittest/vslib/test_sai_vs_mcastfdb.cpp deleted file mode 100644 index 19d9e3ab9..000000000 --- a/unittest/vslib/test_sai_vs_mcastfdb.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, mcast_fdb) -{ - sai_mcast_fdb_api_t *api = nullptr; - - sai_api_query(SAI_API_MCAST_FDB, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_mcast_fdb_entry_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_mcast_fdb_entry(&id,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_mcast_fdb_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_mcast_fdb_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_mcast_fdb_entry_attribute(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_mirror.cpp b/unittest/vslib/test_sai_vs_mirror.cpp deleted file mode 100644 index cc8056a1b..000000000 --- a/unittest/vslib/test_sai_vs_mirror.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, mirror) -{ - sai_mirror_api_t *api = nullptr; - - sai_api_query(SAI_API_MIRROR, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_mirror_session(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_mirror_session(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_mirror_session_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_mirror_session_attribute(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_mpls.cpp b/unittest/vslib/test_sai_vs_mpls.cpp deleted file mode 100644 index efab94955..000000000 --- a/unittest/vslib/test_sai_vs_mpls.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, mpls) -{ - sai_mpls_api_t *api = nullptr; - - sai_api_query(SAI_API_MPLS, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_inseg_entry_t id ; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_inseg_entry(&id,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_inseg_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_inseg_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_inseg_entry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_inseg_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_inseg_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_inseg_entries_attribute(0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_inseg_entries_attribute(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/vslib/test_sai_vs_nat.cpp b/unittest/vslib/test_sai_vs_nat.cpp deleted file mode 100644 index 9bf1dacac..000000000 --- a/unittest/vslib/test_sai_vs_nat.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, nat) -{ - sai_nat_api_t *api = nullptr; - - sai_api_query(SAI_API_NAT, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_nat_entry_t id ; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_nat_entry(&id,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_nat_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_nat_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_nat_entry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_nat_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_nat_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_nat_entries_attribute(0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_nat_entries_attribute(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - - sai_object_id_t id1; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_nat_zone_counter(&id1,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_nat_zone_counter(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_nat_zone_counter_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_nat_zone_counter_attribute(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_neighbor.cpp b/unittest/vslib/test_sai_vs_neighbor.cpp deleted file mode 100644 index f5398762a..000000000 --- a/unittest/vslib/test_sai_vs_neighbor.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, neighbor) -{ - sai_neighbor_api_t *api = nullptr; - - sai_api_query(SAI_API_NEIGHBOR, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_neighbor_entry_t id ; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_neighbor_entry(&id,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_neighbor_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_neighbor_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_neighbor_entry_attribute(0,0,0)); - - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->remove_all_neighbor_entries(0)); -} diff --git a/unittest/vslib/test_sai_vs_nexthop.cpp b/unittest/vslib/test_sai_vs_nexthop.cpp deleted file mode 100644 index a6f9f3c65..000000000 --- a/unittest/vslib/test_sai_vs_nexthop.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, next_hop) -{ - sai_next_hop_api_t *api = nullptr; - - sai_api_query(SAI_API_NEXT_HOP, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_next_hop(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_next_hop(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_next_hop_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_next_hop_attribute(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_nexthopgroup.cpp b/unittest/vslib/test_sai_vs_nexthopgroup.cpp deleted file mode 100644 index 24b1cc136..000000000 --- a/unittest/vslib/test_sai_vs_nexthopgroup.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, next_hop_group) -{ - sai_next_hop_group_api_t *api = nullptr; - - sai_api_query(SAI_API_NEXT_HOP_GROUP, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_next_hop_group(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_next_hop_group(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_next_hop_group_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_next_hop_group_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_next_hop_group_member(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_next_hop_group_member(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_next_hop_group_member_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_next_hop_group_member_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_next_hop_group_members(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_next_hop_group_members(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_next_hop_group_map(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_next_hop_group_map(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_next_hop_group_map_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_next_hop_group_map_attribute(0,0,0)); - -} diff --git a/unittest/vslib/test_sai_vs_poe.cpp b/unittest/vslib/test_sai_vs_poe.cpp deleted file mode 100644 index 03ec57601..000000000 --- a/unittest/vslib/test_sai_vs_poe.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, poe) -{ - sai_poe_api_t *api = nullptr; - - sai_api_query(SAI_API_POE, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_poe_device(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_poe_device(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_poe_device_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_poe_device_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_poe_pse(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_poe_pse(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_poe_pse_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_poe_pse_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_poe_port(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_poe_port(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_poe_port_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_poe_port_attribute(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_policer.cpp b/unittest/vslib/test_sai_vs_policer.cpp deleted file mode 100644 index 3ad0bb3ef..000000000 --- a/unittest/vslib/test_sai_vs_policer.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, policer) -{ - sai_policer_api_t *api = nullptr; - - sai_api_query(SAI_API_POLICER, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_policer(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_policer(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_policer_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_policer_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_policer_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_policer_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_policer_stats(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_port.cpp b/unittest/vslib/test_sai_vs_port.cpp deleted file mode 100644 index 189661bb2..000000000 --- a/unittest/vslib/test_sai_vs_port.cpp +++ /dev/null @@ -1,53 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, port) -{ - sai_port_api_t *api = nullptr; - - sai_api_query(SAI_API_PORT, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_port(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_port(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_port_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_port_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_ports(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_ports(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_ports_attribute(0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_ports_attribute(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_port_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_port_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_port_stats(0,0,0)); - - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->clear_port_all_stats(0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_port_pool(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_port_pool(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_port_pool_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_port_pool_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_port_pool_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_port_pool_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_port_pool_stats(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_port_connector(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_port_connector(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_port_connector_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_port_connector_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_port_serdes(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_port_serdes(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_port_serdes_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_port_serdes_attribute(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_qosmap.cpp b/unittest/vslib/test_sai_vs_qosmap.cpp deleted file mode 100644 index 2944056ed..000000000 --- a/unittest/vslib/test_sai_vs_qosmap.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, qos_map) -{ - sai_qos_map_api_t *api = nullptr; - - sai_api_query(SAI_API_QOS_MAP, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_qos_map(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_qos_map(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_qos_map_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_qos_map_attribute(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_queue.cpp b/unittest/vslib/test_sai_vs_queue.cpp deleted file mode 100644 index c9b22717e..000000000 --- a/unittest/vslib/test_sai_vs_queue.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, queue) -{ - sai_queue_api_t *api = nullptr; - - sai_api_query(SAI_API_QUEUE, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_queue(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_queue(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_queue_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_queue_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_queue_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_queue_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_queue_stats(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_route.cpp b/unittest/vslib/test_sai_vs_route.cpp deleted file mode 100644 index 02bbb5043..000000000 --- a/unittest/vslib/test_sai_vs_route.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, route) -{ - sai_route_api_t *api = nullptr; - - sai_api_query(SAI_API_ROUTE, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_route_entry_t id ; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_route_entry(&id,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_route_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_route_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_route_entry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_route_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_route_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_route_entries_attribute(0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_route_entries_attribute(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/vslib/test_sai_vs_router_interface.cpp b/unittest/vslib/test_sai_vs_router_interface.cpp deleted file mode 100644 index 29b591160..000000000 --- a/unittest/vslib/test_sai_vs_router_interface.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, router_interface) -{ - sai_router_interface_api_t *api = nullptr; - - sai_api_query(SAI_API_ROUTER_INTERFACE, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_router_interface(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_router_interface(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_router_interface_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_router_interface_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_router_interface_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_router_interface_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_router_interface_stats(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_router_rpfgroup.cpp b/unittest/vslib/test_sai_vs_router_rpfgroup.cpp deleted file mode 100644 index f7c9a4abf..000000000 --- a/unittest/vslib/test_sai_vs_router_rpfgroup.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, rpf_group) -{ - sai_rpf_group_api_t *api = nullptr; - - sai_api_query(SAI_API_RPF_GROUP, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_rpf_group(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_rpf_group(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_rpf_group_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_rpf_group_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_rpf_group_member(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_rpf_group_member(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_rpf_group_member_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_rpf_group_member_attribute(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_router_samplepacket.cpp b/unittest/vslib/test_sai_vs_router_samplepacket.cpp deleted file mode 100644 index 0747132ca..000000000 --- a/unittest/vslib/test_sai_vs_router_samplepacket.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, samplepacket) -{ - sai_samplepacket_api_t *api = nullptr; - - sai_api_query(SAI_API_SAMPLEPACKET, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_samplepacket(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_samplepacket(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_samplepacket_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_samplepacket_attribute(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_scheduler.cpp b/unittest/vslib/test_sai_vs_scheduler.cpp deleted file mode 100644 index abbda8905..000000000 --- a/unittest/vslib/test_sai_vs_scheduler.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, scheduler) -{ - sai_scheduler_api_t *api = nullptr; - - sai_api_query(SAI_API_SCHEDULER, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_scheduler(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_scheduler(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_scheduler_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_scheduler_attribute(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_schedulergroup.cpp b/unittest/vslib/test_sai_vs_schedulergroup.cpp deleted file mode 100644 index 895388e66..000000000 --- a/unittest/vslib/test_sai_vs_schedulergroup.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, scheduler_group) -{ - sai_scheduler_group_api_t *api = nullptr; - - sai_api_query(SAI_API_SCHEDULER_GROUP, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_scheduler_group(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_scheduler_group(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_scheduler_group_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_scheduler_group_attribute(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_srv6.cpp b/unittest/vslib/test_sai_vs_srv6.cpp deleted file mode 100644 index 6c4bab9d3..000000000 --- a/unittest/vslib/test_sai_vs_srv6.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, srv6) -{ - sai_srv6_api_t *api = nullptr; - - sai_api_query(SAI_API_SRV6, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_my_sid_entry_t id; - sai_object_id_t obj_id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_srv6_sidlist(&obj_id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_srv6_sidlist(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_srv6_sidlist_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_srv6_sidlist_attribute(0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_srv6_sidlists(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_srv6_sidlists(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_my_sid_entry(&id,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_my_sid_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_my_sid_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_my_sid_entry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_my_sid_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_my_sid_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_my_sid_entries_attribute(0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_my_sid_entries_attribute(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/vslib/test_sai_vs_stp.cpp b/unittest/vslib/test_sai_vs_stp.cpp deleted file mode 100644 index 2bbf90d7e..000000000 --- a/unittest/vslib/test_sai_vs_stp.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, stp) -{ - sai_stp_api_t *api = nullptr; - - sai_api_query(SAI_API_STP, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_stp(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_stp(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_stp_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_stp_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_stp_port(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_stp_port(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_stp_port_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_stp_port_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_stp_ports(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_stp_ports(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); -} diff --git a/unittest/vslib/test_sai_vs_switch.cpp b/unittest/vslib/test_sai_vs_switch.cpp deleted file mode 100644 index 6335a9a4d..000000000 --- a/unittest/vslib/test_sai_vs_switch.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, switch) -{ - sai_switch_api_t *api = nullptr; - - sai_api_query(SAI_API_SWITCH, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_switch(&id,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_switch(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_switch_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_switch_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_switch_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_switch_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_switch_stats(0,0,0)); - - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->switch_mdio_read(0,0,0,0,0)); - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->switch_mdio_write(0,0,0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_switch_tunnel(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_switch_tunnel(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_switch_tunnel_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_switch_tunnel_attribute(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_system_port.cpp b/unittest/vslib/test_sai_vs_system_port.cpp deleted file mode 100644 index b668e6f18..000000000 --- a/unittest/vslib/test_sai_vs_system_port.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, system_port) -{ - sai_system_port_api_t *api = nullptr; - - sai_api_query(SAI_API_SYSTEM_PORT, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_system_port(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_system_port(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_system_port_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_system_port_attribute(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_tam.cpp b/unittest/vslib/test_sai_vs_tam.cpp deleted file mode 100644 index c77ccd35f..000000000 --- a/unittest/vslib/test_sai_vs_tam.cpp +++ /dev/null @@ -1,85 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, tam) -{ - sai_tam_api_t *api = nullptr; - - sai_api_query(SAI_API_TAM, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_math_func(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_math_func(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_math_func_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_math_func_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_report(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_report(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_report_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_report_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_event_threshold(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_event_threshold(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_event_threshold_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_event_threshold_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_int(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_int(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_int_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_int_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_tel_type(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_tel_type(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_tel_type_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_tel_type_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_transport(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_transport(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_transport_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_transport_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_telemetry(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_telemetry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_telemetry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_telemetry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_collector(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_collector(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_collector_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_collector_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_event_action(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_event_action(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_event_action_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_event_action_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_event(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_event(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_event_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_event_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tam_counter_subscription(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tam_counter_subscription(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tam_counter_subscription_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tam_counter_subscription_attribute(0,0,0)); -} - -TEST(libsaivs, sai_tam_telemetry_get_data) -{ - sai_object_list_t list; - - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, sai_tam_telemetry_get_data(0,list,0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_tunnel.cpp b/unittest/vslib/test_sai_vs_tunnel.cpp deleted file mode 100644 index 5e9136fc8..000000000 --- a/unittest/vslib/test_sai_vs_tunnel.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, tunnel) -{ - sai_tunnel_api_t *api = nullptr; - - sai_api_query(SAI_API_TUNNEL, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tunnel_map(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tunnel_map(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tunnel_map_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tunnel_map_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tunnel(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tunnel(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tunnel_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tunnel_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tunnel_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tunnel_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_tunnel_stats(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tunnel_term_table_entry(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tunnel_term_table_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tunnel_term_table_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tunnel_term_table_entry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_tunnel_map_entry(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_tunnel_map_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tunnel_map_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tunnel_map_entry_attribute(0,0,0)); - - uint32_t attr_count = 0; - sai_status_t status = 0; - sai_attribute_t *p_attr = nullptr; - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_tunnels_attribute(0,&id,&attr_count,&p_attr,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,&status)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_tunnels_attribute(0,&id,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,&status)); -} - diff --git a/unittest/vslib/test_sai_vs_udf.cpp b/unittest/vslib/test_sai_vs_udf.cpp deleted file mode 100644 index 8b6f6e87f..000000000 --- a/unittest/vslib/test_sai_vs_udf.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, udf) -{ - sai_udf_api_t *api = nullptr; - - sai_api_query(SAI_API_UDF, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_udf(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_udf(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_udf_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_udf_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_udf_match(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_udf_match(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_udf_match_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_udf_match_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_udf_group(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_udf_group(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_udf_group_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_udf_group_attribute(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_virtual_router.cpp b/unittest/vslib/test_sai_vs_virtual_router.cpp deleted file mode 100644 index 88506311b..000000000 --- a/unittest/vslib/test_sai_vs_virtual_router.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, virtual_router) -{ - sai_virtual_router_api_t *api = nullptr; - - sai_api_query(SAI_API_VIRTUAL_ROUTER, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_virtual_router(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_virtual_router(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_virtual_router_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_virtual_router_attribute(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_vlan.cpp b/unittest/vslib/test_sai_vs_vlan.cpp deleted file mode 100644 index 5d41558a4..000000000 --- a/unittest/vslib/test_sai_vs_vlan.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, vlan) -{ - sai_vlan_api_t *api = nullptr; - - sai_api_query(SAI_API_VLAN, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_vlan(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_vlan(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_vlan_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_vlan_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_vlan_member(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_vlan_member(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_vlan_member_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_vlan_member_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_vlan_members(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_vlan_members(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_vlan_stats(0,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_vlan_stats_ext(0,0,0,SAI_STATS_MODE_READ,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->clear_vlan_stats(0,0,0)); -} diff --git a/unittest/vslib/test_sai_vs_wred.cpp b/unittest/vslib/test_sai_vs_wred.cpp deleted file mode 100644 index cdf11847a..000000000 --- a/unittest/vslib/test_sai_vs_wred.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, wred) -{ - sai_wred_api_t *api = nullptr; - - sai_api_query(SAI_API_WRED, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_object_id_t id; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_wred(&id,0,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_wred(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_wred_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_wred_attribute(0,0,0)); -} diff --git a/vslib/Makefile.am b/vslib/Makefile.am index 00ca24ffe..ab6b68a31 100644 --- a/vslib/Makefile.am +++ b/vslib/Makefile.am @@ -61,70 +61,15 @@ libSaiVS_a_SOURCES = \ VirtualSwitchSaiInterfaceFdb.cpp \ VirtualSwitchSaiInterfacePort.cpp -libsaivs_la_SOURCES = \ - sai_vs_acl.cpp \ - sai_vs_bfd.cpp \ - sai_vs_bmtor.cpp \ - sai_vs_bridge.cpp \ - sai_vs_buffer.cpp \ - sai_vs_counter.cpp \ - sai_vs_dash_vip.cpp \ - sai_vs_dash_pa_validation.cpp \ - sai_vs_dash_vnet.cpp \ - sai_vs_dash_outbound_routing.cpp \ - sai_vs_dash_outbound_ca_to_pa.cpp \ - sai_vs_dash_inbound_routing.cpp \ - sai_vs_dash_eni.cpp \ - sai_vs_dash_direction_lookup.cpp \ - sai_vs_dash_acl.cpp \ - sai_vs_debug_counter.cpp\ - sai_vs_dtel.cpp \ - sai_vs_fdb.cpp \ - sai_vs_genericprogrammable.cpp \ - sai_vs_hash.cpp \ - sai_vs_hostif.cpp \ - sai_vs_interfacequery.cpp \ - sai_vs_ipmc.cpp \ - sai_vs_ipmc_group.cpp \ - sai_vs_isolation_group.cpp \ - sai_vs_l2mc.cpp \ - sai_vs_l2mcgroup.cpp \ - sai_vs_lag.cpp \ - sai_vs_macsec.cpp \ - sai_vs_mcastfdb.cpp \ - sai_vs_mirror.cpp \ - sai_vs_mpls.cpp \ - sai_vs_nat.cpp \ - sai_vs_neighbor.cpp \ - sai_vs_nexthop.cpp \ - sai_vs_nexthopgroup.cpp \ - sai_vs_policer.cpp \ - sai_vs_port.cpp \ - sai_vs_qosmap.cpp \ - sai_vs_queue.cpp \ - sai_vs_route.cpp \ - sai_vs_router_interface.cpp \ - sai_vs_rpfgroup.cpp \ - sai_vs_samplepacket.cpp \ - sai_vs_scheduler.cpp \ - sai_vs_schedulergroup.cpp \ - sai_vs_srv6.cpp \ - sai_vs_stp.cpp \ - sai_vs_switch.cpp \ - sai_vs_system_port.cpp \ - sai_vs_tam.cpp \ - sai_vs_tunnel.cpp \ - sai_vs_udf.cpp \ - sai_vs_virtual_router.cpp \ - sai_vs_vlan.cpp \ - sai_vs_wred.cpp \ - sai_vs_my_mac.cpp \ - sai_vs_ipsec.cpp \ - sai_vs_ars.cpp \ - sai_vs_ars_profile.cpp \ - sai_vs_twamp.cpp \ - sai_vs_poe.cpp \ - sai_vs_dash_meter.cpp +BUILT_SOURCES = sai_vs.cpp + +sai_vs.cpp: ../stub.pl $(top_srcdir)/SAI/meta/saimetadata.c + ../stub.pl -d ../SAI/ -c Sai -n saivs -f sai_vs.cpp -s stub + +clean-local: + rm -f sai_vs.cpp + +libsaivs_la_SOURCES = sai_vs.cpp libSaiVS_a_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS) libSaiVS_a_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) $(CODE_COVERAGE_CXXFLAGS) diff --git a/vslib/Sai.cpp b/vslib/Sai.cpp index 1c4847d87..97238f9de 100644 --- a/vslib/Sai.cpp +++ b/vslib/Sai.cpp @@ -51,13 +51,13 @@ Sai::~Sai() if (m_apiInitialized) { - uninitialize(); + apiUninitialize(); } } // INITIALIZE UNINITIALIZE -sai_status_t Sai::initialize( +sai_status_t Sai::apiInitialize( _In_ uint64_t flags, _In_ const sai_service_method_table_t *service_method_table) { @@ -274,7 +274,7 @@ sai_status_t Sai::initialize( return SAI_STATUS_SUCCESS; } -sai_status_t Sai::uninitialize(void) +sai_status_t Sai::apiUninitialize(void) { SWSS_LOG_ENTER(); VS_CHECK_API_INITIALIZED(); @@ -621,6 +621,22 @@ sai_status_t Sai::bulkSet( object_statuses); } +sai_status_t Sai::bulkGet( + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_id_t *object_id, + _In_ const uint32_t *attr_count, + _Inout_ sai_attribute_t **attr_list, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses) +{ + SWSS_LOG_ENTER(); + + SWSS_LOG_ERROR("not implemented, FIXME"); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + // BULK QUAD ENTRY #define DECLARE_BULK_CREATE_ENTRY(OT,ot) \ @@ -690,6 +706,26 @@ sai_status_t Sai::bulkSet( \ SAIREDIS_DECLARE_EVERY_BULK_ENTRY(DECLARE_BULK_SET_ENTRY); +// BULK GET + +#define DECLARE_BULK_GET_ENTRY(OT,ot) \ +sai_status_t Sai::bulkGet( \ + _In_ uint32_t object_count, \ + _In_ const sai_ ## ot ## _t *ot, \ + _In_ const uint32_t *attr_count, \ + _Inout_ sai_attribute_t **attr_list, \ + _In_ sai_bulk_op_error_mode_t mode, \ + _Out_ sai_status_t *object_statuses) \ +{ \ + SWSS_LOG_ENTER(); \ + MUTEX(); \ + VS_CHECK_API_INITIALIZED(); \ + SWSS_LOG_ERROR("FIXME not implemented"); \ + return SAI_STATUS_NOT_IMPLEMENTED; \ +} + +SAIREDIS_DECLARE_EVERY_BULK_ENTRY(DECLARE_BULK_GET_ENTRY); + // NON QUAD API sai_status_t Sai::flushFdbEntries( @@ -745,7 +781,7 @@ sai_status_t Sai::queryAttributeCapability( capability); } -sai_status_t Sai::queryAattributeEnumValuesCapability( +sai_status_t Sai::queryAttributeEnumValuesCapability( _In_ sai_object_id_t switch_id, _In_ sai_object_type_t object_type, _In_ sai_attr_id_t attr_id, @@ -755,7 +791,7 @@ sai_status_t Sai::queryAattributeEnumValuesCapability( SWSS_LOG_ENTER(); VS_CHECK_API_INITIALIZED(); - return m_meta->queryAattributeEnumValuesCapability( + return m_meta->queryAttributeEnumValuesCapability( switch_id, object_type, attr_id, diff --git a/vslib/Sai.h b/vslib/Sai.h index d1670bebb..191746155 100644 --- a/vslib/Sai.h +++ b/vslib/Sai.h @@ -32,11 +32,11 @@ namespace saivs public: - sai_status_t initialize( + sai_status_t apiInitialize( _In_ uint64_t flags, _In_ const sai_service_method_table_t *service_method_table) override; - sai_status_t uninitialize(void) override; + sai_status_t apiUninitialize(void) override; public: // SAI interface overrides @@ -94,6 +94,15 @@ namespace saivs _In_ sai_bulk_op_error_mode_t mode, _Out_ sai_status_t *object_statuses) override; + virtual sai_status_t bulkGet( + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_id_t *object_id, + _In_ const uint32_t *attr_count, + _Inout_ sai_attribute_t **attr_list, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses) override; + public: // stats API virtual sai_status_t getStats( @@ -165,7 +174,7 @@ namespace saivs _In_ sai_attr_id_t attr_id, _Out_ sai_attr_capability_t *capability) override; - virtual sai_status_t queryAattributeEnumValuesCapability( + virtual sai_status_t queryAttributeEnumValuesCapability( _In_ sai_object_id_t switch_id, _In_ sai_object_type_t object_type, _In_ sai_attr_id_t attr_id, diff --git a/vslib/VirtualSwitchSaiInterface.cpp b/vslib/VirtualSwitchSaiInterface.cpp index d1cd4c78f..d866f5ac1 100644 --- a/vslib/VirtualSwitchSaiInterface.cpp +++ b/vslib/VirtualSwitchSaiInterface.cpp @@ -47,7 +47,7 @@ VirtualSwitchSaiInterface::~VirtualSwitchSaiInterface() // empty } -sai_status_t VirtualSwitchSaiInterface::initialize( +sai_status_t VirtualSwitchSaiInterface::apiInitialize( _In_ uint64_t flags, _In_ const sai_service_method_table_t *service_method_table) { @@ -56,7 +56,7 @@ sai_status_t VirtualSwitchSaiInterface::initialize( return SAI_STATUS_SUCCESS; } -sai_status_t VirtualSwitchSaiInterface::uninitialize(void) +sai_status_t VirtualSwitchSaiInterface::apiUninitialize(void) { SWSS_LOG_ENTER(); @@ -533,6 +533,24 @@ sai_status_t VirtualSwitchSaiInterface::bulkSet( \ SAIREDIS_DECLARE_EVERY_BULK_ENTRY(DECLARE_BULK_SET_ENTRY); +// BULK GET + +#define DECLARE_BULK_GET_ENTRY(OT,ot) \ +sai_status_t VirtualSwitchSaiInterface::bulkGet( \ + _In_ uint32_t object_count, \ + _In_ const sai_ ## ot ## _t *ot, \ + _In_ const uint32_t *attr_count, \ + _Inout_ sai_attribute_t **attr_list, \ + _In_ sai_bulk_op_error_mode_t mode, \ + _Out_ sai_status_t *object_statuses) \ +{ \ + SWSS_LOG_ENTER(); \ + SWSS_LOG_ERROR("FIXME not implemented"); \ + return SAI_STATUS_NOT_IMPLEMENTED; \ +} + +SAIREDIS_DECLARE_EVERY_BULK_ENTRY(DECLARE_BULK_GET_ENTRY); + std::shared_ptr VirtualSwitchSaiInterface::init_switch( _In_ sai_object_id_t switch_id, _In_ std::shared_ptr config, @@ -876,7 +894,7 @@ sai_status_t VirtualSwitchSaiInterface::queryAttributeCapability( return ss->queryAttributeCapability(switch_id, object_type, attr_id, capability); } -sai_status_t VirtualSwitchSaiInterface::queryAattributeEnumValuesCapability( +sai_status_t VirtualSwitchSaiInterface::queryAttributeEnumValuesCapability( _In_ sai_object_id_t switch_id, _In_ sai_object_type_t object_type, _In_ sai_attr_id_t attr_id, @@ -1151,6 +1169,22 @@ sai_status_t VirtualSwitchSaiInterface::bulkSet( return ss->bulkSet(object_type, serialized_object_ids, attr_list, mode, object_statuses); } +sai_status_t VirtualSwitchSaiInterface::bulkGet( + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_id_t *object_id, + _In_ const uint32_t *attr_count, + _Inout_ sai_attribute_t **attr_list, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses) +{ + SWSS_LOG_ENTER(); + + SWSS_LOG_ERROR("not implemented, FIXME"); + + return SAI_STATUS_NOT_IMPLEMENTED; +} + sai_status_t VirtualSwitchSaiInterface::bulkCreate( _In_ sai_object_type_t object_type, _In_ sai_object_id_t switch_id, diff --git a/vslib/VirtualSwitchSaiInterface.h b/vslib/VirtualSwitchSaiInterface.h index db39b2258..25855fdec 100644 --- a/vslib/VirtualSwitchSaiInterface.h +++ b/vslib/VirtualSwitchSaiInterface.h @@ -31,11 +31,11 @@ namespace saivs public: - virtual sai_status_t initialize( + virtual sai_status_t apiInitialize( _In_ uint64_t flags, _In_ const sai_service_method_table_t *service_method_table) override; - virtual sai_status_t uninitialize(void) override; + virtual sai_status_t apiUninitialize(void) override; public: // SAI interface overrides @@ -93,6 +93,15 @@ namespace saivs _In_ sai_bulk_op_error_mode_t mode, _Out_ sai_status_t *object_statuses) override; + virtual sai_status_t bulkGet( + _In_ sai_object_type_t object_type, + _In_ uint32_t object_count, + _In_ const sai_object_id_t *object_id, + _In_ const uint32_t *attr_count, + _Inout_ sai_attribute_t **attr_list, + _In_ sai_bulk_op_error_mode_t mode, + _Out_ sai_status_t *object_statuses) override; + public: // stats API virtual sai_status_t getStats( @@ -164,7 +173,7 @@ namespace saivs _In_ sai_attr_id_t attr_id, _Out_ sai_attr_capability_t *capability) override; - virtual sai_status_t queryAattributeEnumValuesCapability( + virtual sai_status_t queryAttributeEnumValuesCapability( _In_ sai_object_id_t switch_id, _In_ sai_object_type_t object_type, _In_ sai_attr_id_t attr_id, diff --git a/vslib/sai_vs.h b/vslib/sai_vs.h deleted file mode 100644 index 74ecd68db..000000000 --- a/vslib/sai_vs.h +++ /dev/null @@ -1,450 +0,0 @@ -#pragma once - -extern "C" { -#include "sai.h" -#include "saiextensions.h" -} - -#include "meta/SaiInterface.h" - -#include "swss/logger.h" - -#include - -#define PRIVATE __attribute__((visibility("hidden"))) - -PRIVATE extern const sai_acl_api_t vs_acl_api; -PRIVATE extern const sai_ars_api_t vs_ars_api; -PRIVATE extern const sai_ars_profile_api_t vs_ars_profile_api; -PRIVATE extern const sai_bfd_api_t vs_bfd_api; -PRIVATE extern const sai_bmtor_api_t vs_bmtor_api; -PRIVATE extern const sai_generic_programmable_api_t vs_generic_programmable_api; -PRIVATE extern const sai_bridge_api_t vs_bridge_api; -PRIVATE extern const sai_buffer_api_t vs_buffer_api; -PRIVATE extern const sai_counter_api_t vs_counter_api; -PRIVATE extern const sai_dash_vip_api_t vs_dash_vip_api; -PRIVATE extern const sai_dash_pa_validation_api_t vs_dash_pa_validation_api; -PRIVATE extern const sai_dash_vnet_api_t vs_dash_vnet_api; -PRIVATE extern const sai_dash_outbound_routing_api_t vs_dash_outbound_routing_api; -PRIVATE extern const sai_dash_outbound_ca_to_pa_api_t vs_dash_outbound_ca_to_pa_api; -PRIVATE extern const sai_dash_inbound_routing_api_t vs_dash_inbound_routing_api; -PRIVATE extern const sai_dash_eni_api_t vs_dash_eni_api; -PRIVATE extern const sai_dash_direction_lookup_api_t vs_dash_direction_lookup_api; -PRIVATE extern const sai_dash_acl_api_t vs_dash_acl_api; -PRIVATE extern const sai_debug_counter_api_t vs_debug_counter_api; -PRIVATE extern const sai_dtel_api_t vs_dtel_api; -PRIVATE extern const sai_fdb_api_t vs_fdb_api; -PRIVATE extern const sai_hash_api_t vs_hash_api; -PRIVATE extern const sai_hostif_api_t vs_hostif_api; -PRIVATE extern const sai_ipmc_api_t vs_ipmc_api; -PRIVATE extern const sai_ipmc_group_api_t vs_ipmc_group_api; -PRIVATE extern const sai_isolation_group_api_t vs_isolation_group_api; -PRIVATE extern const sai_l2mc_api_t vs_l2mc_api; -PRIVATE extern const sai_l2mc_group_api_t vs_l2mc_group_api; -PRIVATE extern const sai_lag_api_t vs_lag_api; -PRIVATE extern const sai_macsec_api_t vs_macsec_api; -PRIVATE extern const sai_mcast_fdb_api_t vs_mcast_fdb_api; -PRIVATE extern const sai_mirror_api_t vs_mirror_api; -PRIVATE extern const sai_mpls_api_t vs_mpls_api; -PRIVATE extern const sai_nat_api_t vs_nat_api; -PRIVATE extern const sai_neighbor_api_t vs_neighbor_api; -PRIVATE extern const sai_next_hop_api_t vs_next_hop_api; -PRIVATE extern const sai_next_hop_group_api_t vs_next_hop_group_api; -PRIVATE extern const sai_policer_api_t vs_policer_api; -PRIVATE extern const sai_port_api_t vs_port_api; -PRIVATE extern const sai_qos_map_api_t vs_qos_map_api; -PRIVATE extern const sai_queue_api_t vs_queue_api; -PRIVATE extern const sai_route_api_t vs_route_api; -PRIVATE extern const sai_router_interface_api_t vs_router_interface_api; -PRIVATE extern const sai_rpf_group_api_t vs_rpf_group_api; -PRIVATE extern const sai_samplepacket_api_t vs_samplepacket_api; -PRIVATE extern const sai_scheduler_api_t vs_scheduler_api; -PRIVATE extern const sai_scheduler_group_api_t vs_scheduler_group_api; -PRIVATE extern const sai_srv6_api_t vs_srv6_api; -PRIVATE extern const sai_stp_api_t vs_stp_api; -PRIVATE extern const sai_switch_api_t vs_switch_api; -PRIVATE extern const sai_system_port_api_t vs_system_port_api; -PRIVATE extern const sai_tam_api_t vs_tam_api; -PRIVATE extern const sai_tunnel_api_t vs_tunnel_api; -PRIVATE extern const sai_udf_api_t vs_udf_api; -PRIVATE extern const sai_virtual_router_api_t vs_virtual_router_api; -PRIVATE extern const sai_vlan_api_t vs_vlan_api; -PRIVATE extern const sai_wred_api_t vs_wred_api; -PRIVATE extern const sai_my_mac_api_t vs_my_mac_api; -PRIVATE extern const sai_ipsec_api_t vs_ipsec_api; -PRIVATE extern const sai_twamp_api_t vs_twamp_api; -PRIVATE extern const sai_dash_meter_api_t vs_dash_meter_api; -PRIVATE extern const sai_poe_api_t vs_poe_api; - -PRIVATE extern std::shared_ptr vs_sai; - -// QUAD OID - -#define VS_CREATE(OT,ot) \ - static sai_status_t vs_create_ ## ot( \ - _Out_ sai_object_id_t *object_id, \ - _In_ sai_object_id_t switch_id, \ - _In_ uint32_t attr_count, \ - _In_ const sai_attribute_t *attr_list) \ -{ \ - SWSS_LOG_ENTER(); \ - return vs_sai->create( \ - (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ - object_id, \ - switch_id, \ - attr_count, \ - attr_list); \ -} - -#define VS_REMOVE(OT,ot) \ - static sai_status_t vs_remove_ ## ot( \ - _In_ sai_object_id_t object_id) \ -{ \ - SWSS_LOG_ENTER(); \ - return vs_sai->remove( \ - (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ - object_id); \ -} - -#define VS_SET(OT,ot) \ - static sai_status_t vs_set_ ## ot ## _attribute( \ - _In_ sai_object_id_t object_id, \ - _In_ const sai_attribute_t *attr) \ -{ \ - SWSS_LOG_ENTER(); \ - return vs_sai->set( \ - (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ - object_id, \ - attr); \ -} - -#define VS_GET(OT,ot) \ - static sai_status_t vs_get_ ## ot ## _attribute( \ - _In_ sai_object_id_t object_id, \ - _In_ uint32_t attr_count, \ - _Inout_ sai_attribute_t *attr_list) \ -{ \ - SWSS_LOG_ENTER(); \ - return vs_sai->get( \ - (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ - object_id, \ - attr_count, \ - attr_list); \ -} - -// QUAD DECLARE - -#define VS_GENERIC_QUAD(OT,ot) \ - VS_CREATE(OT,ot); \ - VS_REMOVE(OT,ot); \ - VS_SET(OT,ot); \ - VS_GET(OT,ot); - -// QUAD ENTRY - -#define VS_CREATE_ENTRY(OT,ot) \ - static sai_status_t vs_create_ ## ot( \ - _In_ const sai_ ## ot ##_t *entry, \ - _In_ uint32_t attr_count, \ - _In_ const sai_attribute_t *attr_list) \ -{ \ - SWSS_LOG_ENTER(); \ - return vs_sai->create( \ - entry, \ - attr_count, \ - attr_list); \ -} - -#define VS_REMOVE_ENTRY(OT,ot) \ - static sai_status_t vs_remove_ ## ot( \ - _In_ const sai_ ## ot ## _t *entry) \ -{ \ - SWSS_LOG_ENTER(); \ - return vs_sai->remove( \ - entry); \ -} - -#define VS_SET_ENTRY(OT,ot) \ - static sai_status_t vs_set_ ## ot ## _attribute( \ - _In_ const sai_ ## ot ## _t *entry, \ - _In_ const sai_attribute_t *attr) \ -{ \ - SWSS_LOG_ENTER(); \ - return vs_sai->set( \ - entry, \ - attr); \ -} - -#define VS_GET_ENTRY(OT,ot) \ - static sai_status_t vs_get_ ## ot ## _attribute( \ - _In_ const sai_ ## ot ## _t *entry, \ - _In_ uint32_t attr_count, \ - _Inout_ sai_attribute_t *attr_list) \ -{ \ - SWSS_LOG_ENTER(); \ - return vs_sai->get( \ - entry, \ - attr_count, \ - attr_list); \ -} - -// QUAD ENTRY DECLARE - -#define VS_GENERIC_QUAD_ENTRY(OT,ot) \ - VS_CREATE_ENTRY(OT,ot); \ - VS_REMOVE_ENTRY(OT,ot); \ - VS_SET_ENTRY(OT,ot); \ - VS_GET_ENTRY(OT,ot); - -// QUAD API - -#define VS_GENERIC_QUAD_API(ot) \ - vs_create_ ## ot, \ - vs_remove_ ## ot, \ - vs_set_ ## ot ##_attribute, \ - vs_get_ ## ot ##_attribute, - -// STATS - -#define VS_GET_STATS(OT,ot) \ - static sai_status_t vs_get_ ## ot ## _stats( \ - _In_ sai_object_id_t object_id, \ - _In_ uint32_t number_of_counters, \ - _In_ const sai_stat_id_t *counter_ids, \ - _Out_ uint64_t *counters) \ -{ \ - SWSS_LOG_ENTER(); \ - return vs_sai->getStats( \ - (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ - object_id, \ - number_of_counters, \ - counter_ids, \ - counters); \ -} - -#define VS_GET_STATS_EXT(OT,ot) \ - static sai_status_t vs_get_ ## ot ## _stats_ext( \ - _In_ sai_object_id_t object_id, \ - _In_ uint32_t number_of_counters, \ - _In_ const sai_stat_id_t *counter_ids, \ - _In_ sai_stats_mode_t mode, \ - _Out_ uint64_t *counters) \ -{ \ - SWSS_LOG_ENTER(); \ - return vs_sai->getStatsExt( \ - (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ - object_id, \ - number_of_counters, \ - counter_ids, \ - mode, \ - counters); \ -} - -#define VS_CLEAR_STATS(OT,ot) \ - static sai_status_t vs_clear_ ## ot ## _stats( \ - _In_ sai_object_id_t object_id, \ - _In_ uint32_t number_of_counters, \ - _In_ const sai_stat_id_t *counter_ids) \ -{ \ - SWSS_LOG_ENTER(); \ - return vs_sai->clearStats( \ - (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ - object_id, \ - number_of_counters, \ - counter_ids); \ -} - -// STATS DECLARE - -#define VS_GENERIC_STATS(OT, ot) \ - VS_GET_STATS(OT,ot); \ - VS_GET_STATS_EXT(OT,ot); \ - VS_CLEAR_STATS(OT,ot); - -// STATS API - -#define VS_GENERIC_STATS_API(ot) \ - vs_get_ ## ot ## _stats, \ - vs_get_ ## ot ## _stats_ext, \ - vs_clear_ ## ot ## _stats, - -// BULK QUAD - -#define VS_BULK_CREATE(OT,fname) \ - static sai_status_t vs_bulk_create_ ## fname( \ - _In_ sai_object_id_t switch_id, \ - _In_ uint32_t object_count, \ - _In_ const uint32_t *attr_count, \ - _In_ const sai_attribute_t **attr_list, \ - _In_ sai_bulk_op_error_mode_t mode, \ - _Out_ sai_object_id_t *object_id, \ - _Out_ sai_status_t *object_statuses) \ -{ \ - SWSS_LOG_ENTER(); \ - return vs_sai->bulkCreate( \ - (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ - switch_id, \ - object_count, \ - attr_count, \ - attr_list, \ - mode, \ - object_id, \ - object_statuses); \ -} - -#define VS_BULK_REMOVE(OT,fname) \ - static sai_status_t vs_bulk_remove_ ## fname( \ - _In_ uint32_t object_count, \ - _In_ const sai_object_id_t *object_id, \ - _In_ sai_bulk_op_error_mode_t mode, \ - _Out_ sai_status_t *object_statuses) \ -{ \ - SWSS_LOG_ENTER(); \ - return vs_sai->bulkRemove( \ - (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ - object_count, \ - object_id, \ - mode, \ - object_statuses); \ -} - -#define VS_BULK_SET(OT,fname) \ - static sai_status_t vs_bulk_set_ ## fname( \ - _In_ uint32_t object_count, \ - _In_ const sai_object_id_t *object_id, \ - _In_ const sai_attribute_t *attr_list, \ - _In_ sai_bulk_op_error_mode_t mode, \ - _Out_ sai_status_t *object_statuses) \ -{ \ - SWSS_LOG_ENTER(); \ - return vs_sai->bulkSet( \ - (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ - object_count, \ - object_id, \ - attr_list, \ - mode, \ - object_statuses); \ -} - -#define VS_BULK_GET(OT,fname) \ - static sai_status_t vs_bulk_get_ ## fname( \ - _In_ uint32_t object_count, \ - _In_ const sai_object_id_t *object_id, \ - _In_ const uint32_t *attr_count, \ - _Inout_ sai_attribute_t **attr_list, \ - _In_ sai_bulk_op_error_mode_t mode, \ - _Out_ sai_status_t *object_statuses) \ -{ \ - SWSS_LOG_ENTER(); \ - SWSS_LOG_ERROR("not implemented"); \ - return SAI_STATUS_NOT_IMPLEMENTED; \ -} - -// BULK QUAD DECLARE - -#define VS_BULK_QUAD(OT,ot) \ - VS_BULK_CREATE(OT,ot); \ - VS_BULK_REMOVE(OT,ot); \ - VS_BULK_SET(OT,ot); \ - VS_BULK_GET(OT,ot); - -// BULK QUAD ENTRY - -#define VS_BULK_CREATE_ENTRY(OT,ot) \ - VS_BULK_CREATE_ENTRY_EX(OT,ot,ot) - -#define VS_BULK_CREATE_ENTRY_EX(OT,ot,fname) \ - static sai_status_t vs_bulk_create_ ## fname( \ - _In_ uint32_t object_count, \ - _In_ const sai_ ## ot ## _t *entry, \ - _In_ const uint32_t *attr_count, \ - _In_ const sai_attribute_t **attr_list, \ - _In_ sai_bulk_op_error_mode_t mode, \ - _Out_ sai_status_t *object_statuses) \ -{ \ - SWSS_LOG_ENTER(); \ - return vs_sai->bulkCreate( \ - object_count, \ - entry, \ - attr_count, \ - attr_list, \ - mode, \ - object_statuses); \ -} - -#define VS_BULK_REMOVE_ENTRY(OT,ot) \ - VS_BULK_REMOVE_ENTRY_EX(OT, ot, ot) - -#define VS_BULK_REMOVE_ENTRY_EX(OT,ot,fname) \ - static sai_status_t vs_bulk_remove_ ## fname( \ - _In_ uint32_t object_count, \ - _In_ const sai_ ## ot ##_t *entry, \ - _In_ sai_bulk_op_error_mode_t mode, \ - _Out_ sai_status_t *object_statuses) \ -{ \ - SWSS_LOG_ENTER(); \ - return vs_sai->bulkRemove( \ - object_count, \ - entry, \ - mode, \ - object_statuses); \ -} - -#define VS_BULK_SET_ENTRY(OT,ot) \ - static sai_status_t vs_bulk_set_ ## ot( \ - _In_ uint32_t object_count, \ - _In_ const sai_ ## ot ## _t *entry, \ - _In_ const sai_attribute_t *attr_list, \ - _In_ sai_bulk_op_error_mode_t mode, \ - _Out_ sai_status_t *object_statuses) \ -{ \ - SWSS_LOG_ENTER(); \ - return vs_sai->bulkSet( \ - object_count, \ - entry, \ - attr_list, \ - mode, \ - object_statuses); \ -} - -#define VS_BULK_GET_ENTRY(OT,ot) \ - static sai_status_t vs_bulk_get_ ## ot( \ - _In_ uint32_t object_count, \ - _In_ const sai_ ## ot ## _t *entry, \ - _In_ const uint32_t *attr_count, \ - _Inout_ sai_attribute_t **attr_list, \ - _In_ sai_bulk_op_error_mode_t mode, \ - _Out_ sai_status_t *object_statuses) \ -{ \ - SWSS_LOG_ENTER(); \ - SWSS_LOG_ERROR("not implemented"); \ - return SAI_STATUS_NOT_IMPLEMENTED; \ -} - -// BULK QUAD ENTRY DECLARE - -#define VS_BULK_QUAD_ENTRY(OT,ot) \ - VS_BULK_CREATE_ENTRY(OT,ot); \ - VS_BULK_REMOVE_ENTRY(OT,ot); \ - VS_BULK_SET_ENTRY(OT,ot); \ - VS_BULK_GET_ENTRY(OT,ot); - -// BULK QUAD API - -#define VS_BULK_QUAD_API(ot) \ - vs_bulk_create_ ## ot, \ - vs_bulk_remove_ ## ot, \ - vs_bulk_set_ ## ot, \ - vs_bulk_get_ ## ot, - -// BULK get/set DECLARE for vs - -#define VS_BULK_GET_SET(OT,ot) \ - VS_BULK_GET(OT,ot); \ - VS_BULK_SET(OT,ot); - -// BULK get/set API for vs - -#define VS_BULK_GET_SET_API(ot) \ - vs_bulk_get_ ## ot, \ - vs_bulk_set_ ## ot, diff --git a/vslib/sai_vs_acl.cpp b/vslib/sai_vs_acl.cpp deleted file mode 100644 index 2fea15e0b..000000000 --- a/vslib/sai_vs_acl.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(ACL_TABLE,acl_table); -VS_GENERIC_QUAD(ACL_ENTRY,acl_entry); -VS_GENERIC_QUAD(ACL_COUNTER,acl_counter); -VS_GENERIC_QUAD(ACL_RANGE,acl_range); -VS_GENERIC_QUAD(ACL_TABLE_GROUP,acl_table_group); -VS_GENERIC_QUAD(ACL_TABLE_GROUP_MEMBER,acl_table_group_member); -VS_GENERIC_QUAD(ACL_TABLE_CHAIN_GROUP,acl_table_chain_group) - -const sai_acl_api_t vs_acl_api = { - - VS_GENERIC_QUAD_API(acl_table) - VS_GENERIC_QUAD_API(acl_entry) - VS_GENERIC_QUAD_API(acl_counter) - VS_GENERIC_QUAD_API(acl_range) - VS_GENERIC_QUAD_API(acl_table_group) - VS_GENERIC_QUAD_API(acl_table_group_member) - VS_GENERIC_QUAD_API(acl_table_chain_group) -}; diff --git a/vslib/sai_vs_ars.cpp b/vslib/sai_vs_ars.cpp deleted file mode 100644 index 961f7a508..000000000 --- a/vslib/sai_vs_ars.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(ARS, ars); - -const sai_ars_api_t vs_ars_api = { - VS_GENERIC_QUAD_API(ars) -}; diff --git a/vslib/sai_vs_ars_profile.cpp b/vslib/sai_vs_ars_profile.cpp deleted file mode 100644 index 4adf53b90..000000000 --- a/vslib/sai_vs_ars_profile.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(ARS_PROFILE, ars_profile); - -const sai_ars_profile_api_t vs_ars_profile_api = { - VS_GENERIC_QUAD_API(ars_profile) -}; diff --git a/vslib/sai_vs_bfd.cpp b/vslib/sai_vs_bfd.cpp deleted file mode 100644 index f444b5118..000000000 --- a/vslib/sai_vs_bfd.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(BFD_SESSION,bfd_session); -VS_GENERIC_STATS(BFD_SESSION,bfd_session); - -const sai_bfd_api_t vs_bfd_api = { - - VS_GENERIC_QUAD_API(bfd_session) - VS_GENERIC_STATS_API(bfd_session) -}; diff --git a/vslib/sai_vs_bmtor.cpp b/vslib/sai_vs_bmtor.cpp deleted file mode 100644 index cec20a576..000000000 --- a/vslib/sai_vs_bmtor.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(TABLE_BITMAP_CLASSIFICATION_ENTRY,table_bitmap_classification_entry); -VS_GENERIC_STATS(TABLE_BITMAP_CLASSIFICATION_ENTRY,table_bitmap_classification_entry); -VS_GENERIC_QUAD(TABLE_BITMAP_ROUTER_ENTRY,table_bitmap_router_entry); -VS_GENERIC_STATS(TABLE_BITMAP_ROUTER_ENTRY,table_bitmap_router_entry); -VS_GENERIC_QUAD(TABLE_META_TUNNEL_ENTRY,table_meta_tunnel_entry); -VS_GENERIC_STATS(TABLE_META_TUNNEL_ENTRY,table_meta_tunnel_entry); - -const sai_bmtor_api_t vs_bmtor_api = { - VS_GENERIC_QUAD_API(table_bitmap_classification_entry) - VS_GENERIC_STATS_API(table_bitmap_classification_entry) - VS_GENERIC_QUAD_API(table_bitmap_router_entry) - VS_GENERIC_STATS_API(table_bitmap_router_entry) - VS_GENERIC_QUAD_API(table_meta_tunnel_entry) - VS_GENERIC_STATS_API(table_meta_tunnel_entry) -}; diff --git a/vslib/sai_vs_bridge.cpp b/vslib/sai_vs_bridge.cpp deleted file mode 100644 index 1d1227a37..000000000 --- a/vslib/sai_vs_bridge.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(BRIDGE,bridge); -VS_GENERIC_QUAD(BRIDGE_PORT,bridge_port); -VS_GENERIC_STATS(BRIDGE,bridge); -VS_GENERIC_STATS(BRIDGE_PORT,bridge_port); - -const sai_bridge_api_t vs_bridge_api = { - - VS_GENERIC_QUAD_API(bridge) - VS_GENERIC_STATS_API(bridge) - VS_GENERIC_QUAD_API(bridge_port) - VS_GENERIC_STATS_API(bridge_port) -}; diff --git a/vslib/sai_vs_buffer.cpp b/vslib/sai_vs_buffer.cpp deleted file mode 100644 index 32e1fa4a4..000000000 --- a/vslib/sai_vs_buffer.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(BUFFER_POOL,buffer_pool); -VS_GENERIC_QUAD(INGRESS_PRIORITY_GROUP,ingress_priority_group); -VS_GENERIC_QUAD(BUFFER_PROFILE,buffer_profile); -VS_GENERIC_STATS(BUFFER_POOL,buffer_pool); -VS_GENERIC_STATS(INGRESS_PRIORITY_GROUP,ingress_priority_group); - -const sai_buffer_api_t vs_buffer_api = { - - VS_GENERIC_QUAD_API(buffer_pool) - VS_GENERIC_STATS_API(buffer_pool) - VS_GENERIC_QUAD_API(ingress_priority_group) - VS_GENERIC_STATS_API(ingress_priority_group) - VS_GENERIC_QUAD_API(buffer_profile) -}; diff --git a/vslib/sai_vs_counter.cpp b/vslib/sai_vs_counter.cpp deleted file mode 100644 index 105eef7b1..000000000 --- a/vslib/sai_vs_counter.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(COUNTER,counter); -VS_GENERIC_STATS(COUNTER,counter); - -const sai_counter_api_t vs_counter_api = { - - VS_GENERIC_QUAD_API(counter) - VS_GENERIC_STATS_API(counter) -}; - diff --git a/vslib/sai_vs_dash_acl.cpp b/vslib/sai_vs_dash_acl.cpp deleted file mode 100644 index f054d1d15..000000000 --- a/vslib/sai_vs_dash_acl.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(DASH_ACL_GROUP, dash_acl_group); -VS_BULK_CREATE(DASH_ACL_GROUP, dash_acl_groups); -VS_BULK_REMOVE(DASH_ACL_GROUP, dash_acl_groups); - -VS_GENERIC_QUAD(DASH_ACL_RULE, dash_acl_rule); -VS_BULK_CREATE(DASH_ACL_RULE, dash_acl_rules); -VS_BULK_REMOVE(DASH_ACL_RULE, dash_acl_rules); - -const sai_dash_acl_api_t vs_dash_acl_api = { - VS_GENERIC_QUAD_API(dash_acl_group) - vs_bulk_create_dash_acl_groups, - vs_bulk_remove_dash_acl_groups, - - VS_GENERIC_QUAD_API(dash_acl_rule) - vs_bulk_create_dash_acl_rules, - vs_bulk_remove_dash_acl_rules, -}; diff --git a/vslib/sai_vs_dash_direction_lookup.cpp b/vslib/sai_vs_dash_direction_lookup.cpp deleted file mode 100644 index 1bb96c84b..000000000 --- a/vslib/sai_vs_dash_direction_lookup.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD_ENTRY(DIRECTION_LOOKUP_ENTRY, direction_lookup_entry); -VS_BULK_CREATE_ENTRY_EX(DIRECTION_LOOKUP_ENTRY, direction_lookup_entry, direction_lookup_entries); -VS_BULK_REMOVE_ENTRY_EX(DIRECTION_LOOKUP_ENTRY, direction_lookup_entry, direction_lookup_entries); - -const sai_dash_direction_lookup_api_t vs_dash_direction_lookup_api = { - VS_GENERIC_QUAD_API(direction_lookup_entry) - vs_bulk_create_direction_lookup_entries, - vs_bulk_remove_direction_lookup_entries, -}; diff --git a/vslib/sai_vs_dash_eni.cpp b/vslib/sai_vs_dash_eni.cpp deleted file mode 100644 index 0971bbff3..000000000 --- a/vslib/sai_vs_dash_eni.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD_ENTRY(ENI_ETHER_ADDRESS_MAP_ENTRY, eni_ether_address_map_entry); -VS_BULK_CREATE_ENTRY_EX(ENI_ETHER_ADDRESS_MAP_ENTRY, eni_ether_address_map_entry, eni_ether_address_map_entries); -VS_BULK_REMOVE_ENTRY_EX(ENI_ETHER_ADDRESS_MAP_ENTRY, eni_ether_address_map_entry, eni_ether_address_map_entries); - -VS_GENERIC_QUAD(ENI, eni); -VS_GENERIC_STATS(ENI, eni); -VS_BULK_CREATE(ENI, enis); -VS_BULK_REMOVE(ENI, enis); - -const sai_dash_eni_api_t vs_dash_eni_api = { - VS_GENERIC_QUAD_API(eni_ether_address_map_entry) - vs_bulk_create_eni_ether_address_map_entries, - vs_bulk_remove_eni_ether_address_map_entries, - - VS_GENERIC_QUAD_API(eni) - VS_GENERIC_STATS_API(eni) - vs_bulk_create_enis, - vs_bulk_remove_enis, -}; diff --git a/vslib/sai_vs_dash_inbound_routing.cpp b/vslib/sai_vs_dash_inbound_routing.cpp deleted file mode 100644 index a017505df..000000000 --- a/vslib/sai_vs_dash_inbound_routing.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD_ENTRY(INBOUND_ROUTING_ENTRY, inbound_routing_entry); -VS_BULK_CREATE_ENTRY_EX(INBOUND_ROUTING_ENTRY, inbound_routing_entry, inbound_routing_entries); -VS_BULK_REMOVE_ENTRY_EX(INBOUND_ROUTING_ENTRY, inbound_routing_entry, inbound_routing_entries); - -const sai_dash_inbound_routing_api_t vs_dash_inbound_routing_api = { - VS_GENERIC_QUAD_API(inbound_routing_entry) - vs_bulk_create_inbound_routing_entries, - vs_bulk_remove_inbound_routing_entries, -}; diff --git a/vslib/sai_vs_dash_meter.cpp b/vslib/sai_vs_dash_meter.cpp deleted file mode 100644 index 2773e1f5a..000000000 --- a/vslib/sai_vs_dash_meter.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(METER_BUCKET, meter_bucket); -VS_BULK_CREATE(METER_BUCKET, meter_buckets); -VS_BULK_REMOVE(METER_BUCKET, meter_buckets); - -VS_GENERIC_QUAD(METER_BUCKET, meter_policy); -VS_BULK_CREATE(METER_BUCKET, meter_policys); -VS_BULK_REMOVE(METER_BUCKET, meter_policys); - -VS_GENERIC_QUAD(METER_BUCKET, meter_rule); -VS_BULK_CREATE(METER_BUCKET, meter_rules); -VS_BULK_REMOVE(METER_BUCKET, meter_rules); - -const sai_dash_meter_api_t vs_dash_meter_api = { - - VS_GENERIC_QUAD_API(meter_bucket) - vs_bulk_create_meter_buckets, - vs_bulk_remove_meter_buckets, - - VS_GENERIC_QUAD_API(meter_policy) - vs_bulk_create_meter_policys, - vs_bulk_remove_meter_policys, - - VS_GENERIC_QUAD_API(meter_rule) - vs_bulk_create_meter_rules, - vs_bulk_remove_meter_rules, -}; diff --git a/vslib/sai_vs_dash_outbound_ca_to_pa.cpp b/vslib/sai_vs_dash_outbound_ca_to_pa.cpp deleted file mode 100644 index 5cac21579..000000000 --- a/vslib/sai_vs_dash_outbound_ca_to_pa.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD_ENTRY(OUTBOUND_CA_TO_PA_ENTRY, outbound_ca_to_pa_entry); -VS_BULK_CREATE_ENTRY_EX(OUTBOUND_CA_TO_PA_ENTRY, outbound_ca_to_pa_entry, outbound_ca_to_pa_entries); -VS_BULK_REMOVE_ENTRY_EX(OUTBOUND_CA_TO_PA_ENTRY, outbound_ca_to_pa_entry, outbound_ca_to_pa_entries); - -const sai_dash_outbound_ca_to_pa_api_t vs_dash_outbound_ca_to_pa_api = { - VS_GENERIC_QUAD_API(outbound_ca_to_pa_entry) - vs_bulk_create_outbound_ca_to_pa_entries, - vs_bulk_remove_outbound_ca_to_pa_entries, -}; diff --git a/vslib/sai_vs_dash_outbound_routing.cpp b/vslib/sai_vs_dash_outbound_routing.cpp deleted file mode 100644 index 0582dc767..000000000 --- a/vslib/sai_vs_dash_outbound_routing.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD_ENTRY(OUTBOUND_ROUTING_ENTRY, outbound_routing_entry); -VS_BULK_CREATE_ENTRY_EX(OUTBOUND_ROUTING_ENTRY, outbound_routing_entry, outbound_routing_entries); -VS_BULK_REMOVE_ENTRY_EX(OUTBOUND_ROUTING_ENTRY, outbound_routing_entry, outbound_routing_entries); - -const sai_dash_outbound_routing_api_t vs_dash_outbound_routing_api = { - VS_GENERIC_QUAD_API(outbound_routing_entry) - vs_bulk_create_outbound_routing_entries, - vs_bulk_remove_outbound_routing_entries, -}; diff --git a/vslib/sai_vs_dash_pa_validation.cpp b/vslib/sai_vs_dash_pa_validation.cpp deleted file mode 100644 index 1b66811f1..000000000 --- a/vslib/sai_vs_dash_pa_validation.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD_ENTRY(PA_VALIDATION_ENTRY, pa_validation_entry); -VS_BULK_CREATE_ENTRY_EX(PA_VALIDATION_ENTRY, pa_validation_entry, pa_validation_entries); -VS_BULK_REMOVE_ENTRY_EX(PA_VALIDATION_ENTRY, pa_validation_entry, pa_validation_entries); - -const sai_dash_pa_validation_api_t vs_dash_pa_validation_api = { - VS_GENERIC_QUAD_API(pa_validation_entry) - vs_bulk_create_pa_validation_entries, - vs_bulk_remove_pa_validation_entries, -}; diff --git a/vslib/sai_vs_dash_vip.cpp b/vslib/sai_vs_dash_vip.cpp deleted file mode 100644 index f3d4f46b1..000000000 --- a/vslib/sai_vs_dash_vip.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD_ENTRY(VIP_ENTRY, vip_entry); -VS_BULK_CREATE_ENTRY_EX(VIP_ENTRY, vip_entry, vip_entries); -VS_BULK_REMOVE_ENTRY_EX(VIP_ENTRY, vip_entry, vip_entries); - -const sai_dash_vip_api_t vs_dash_vip_api = { - VS_GENERIC_QUAD_API(vip_entry) - vs_bulk_create_vip_entries, - vs_bulk_remove_vip_entries, -}; diff --git a/vslib/sai_vs_dash_vnet.cpp b/vslib/sai_vs_dash_vnet.cpp deleted file mode 100644 index 83cd9973d..000000000 --- a/vslib/sai_vs_dash_vnet.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(VNET, vnet); -VS_BULK_CREATE(VNET, vnets); -VS_BULK_REMOVE(VNET, vnets); - -const sai_dash_vnet_api_t vs_dash_vnet_api = { - VS_GENERIC_QUAD_API(vnet) - vs_bulk_create_vnets, - vs_bulk_remove_vnets, -}; diff --git a/vslib/sai_vs_debug_counter.cpp b/vslib/sai_vs_debug_counter.cpp deleted file mode 100644 index 3dbd346f5..000000000 --- a/vslib/sai_vs_debug_counter.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(DEBUG_COUNTER,debug_counter); - -const sai_debug_counter_api_t vs_debug_counter_api = { - VS_GENERIC_QUAD_API(debug_counter) -}; diff --git a/vslib/sai_vs_dtel.cpp b/vslib/sai_vs_dtel.cpp deleted file mode 100644 index b1919d9be..000000000 --- a/vslib/sai_vs_dtel.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(DTEL,dtel); -VS_GENERIC_QUAD(DTEL_QUEUE_REPORT,dtel_queue_report); -VS_GENERIC_QUAD(DTEL_INT_SESSION,dtel_int_session); -VS_GENERIC_QUAD(DTEL_REPORT_SESSION,dtel_report_session); -VS_GENERIC_QUAD(DTEL_EVENT,dtel_event); - -const sai_dtel_api_t vs_dtel_api = { - - VS_GENERIC_QUAD_API(dtel) - VS_GENERIC_QUAD_API(dtel_queue_report) - VS_GENERIC_QUAD_API(dtel_int_session) - VS_GENERIC_QUAD_API(dtel_report_session) - VS_GENERIC_QUAD_API(dtel_event) -}; diff --git a/vslib/sai_vs_fdb.cpp b/vslib/sai_vs_fdb.cpp deleted file mode 100644 index 58a2cf8b9..000000000 --- a/vslib/sai_vs_fdb.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "sai_vs.h" - -static sai_status_t vs_flush_fdb_entries( - _In_ sai_object_id_t switch_id, - _In_ uint32_t attr_count, - _In_ const sai_attribute_t *attr_list) -{ - SWSS_LOG_ENTER(); - - return vs_sai->flushFdbEntries( - switch_id, - attr_count, - attr_list); -} - -VS_GENERIC_QUAD_ENTRY(FDB_ENTRY,fdb_entry); -VS_BULK_QUAD_ENTRY(FDB_ENTRY, fdb_entry); - -const sai_fdb_api_t vs_fdb_api = { - - VS_GENERIC_QUAD_API(fdb_entry) - - vs_flush_fdb_entries, - - VS_BULK_QUAD_API(fdb_entry) -}; diff --git a/vslib/sai_vs_genericprogrammable.cpp b/vslib/sai_vs_genericprogrammable.cpp deleted file mode 100644 index 958d927a8..000000000 --- a/vslib/sai_vs_genericprogrammable.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(GENERIC_PROGRAMMABLE,generic_programmable); - -const sai_generic_programmable_api_t vs_generic_programmable_api = { - VS_GENERIC_QUAD_API(generic_programmable) -}; diff --git a/vslib/sai_vs_hash.cpp b/vslib/sai_vs_hash.cpp deleted file mode 100644 index d7f6e1c89..000000000 --- a/vslib/sai_vs_hash.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(HASH,hash); -VS_GENERIC_QUAD(FINE_GRAINED_HASH_FIELD,fine_grained_hash_field); - -const sai_hash_api_t vs_hash_api = { - VS_GENERIC_QUAD_API(hash) - VS_GENERIC_QUAD_API(fine_grained_hash_field) -}; diff --git a/vslib/sai_vs_hostif.cpp b/vslib/sai_vs_hostif.cpp deleted file mode 100644 index 2a35c2bef..000000000 --- a/vslib/sai_vs_hostif.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include "sai_vs.h" - -static sai_status_t vs_recv_hostif_packet( - _In_ sai_object_id_t hif_id, - _Inout_ sai_size_t *buffer_size, - _Out_ void *buffer, - _Inout_ uint32_t *attr_count, - _Out_ sai_attribute_t *attr_list) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -static sai_status_t vs_send_hostif_packet( - _In_ sai_object_id_t hif_id, - _In_ sai_size_t buffer_size, - _In_ const void *buffer, - _In_ uint32_t attr_count, - _In_ const sai_attribute_t *attr_list) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -static sai_status_t vs_allocate_hostif_packet( - _In_ sai_object_id_t hostif_id, - _In_ sai_size_t buffer_size, - _Out_ void **buffer, - _In_ uint32_t attr_count, - _In_ const sai_attribute_t *attr_list) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -static sai_status_t vs_free_hostif_packet( - _In_ sai_object_id_t hostif_id, - _Inout_ void *buffer) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -VS_GENERIC_QUAD(HOSTIF,hostif); -VS_GENERIC_QUAD(HOSTIF_TABLE_ENTRY,hostif_table_entry); -VS_GENERIC_QUAD(HOSTIF_TRAP_GROUP,hostif_trap_group); -VS_GENERIC_QUAD(HOSTIF_TRAP,hostif_trap); -VS_GENERIC_QUAD(HOSTIF_USER_DEFINED_TRAP,hostif_user_defined_trap); - -const sai_hostif_api_t vs_hostif_api = { - - VS_GENERIC_QUAD_API(hostif) - VS_GENERIC_QUAD_API(hostif_table_entry) - VS_GENERIC_QUAD_API(hostif_trap_group) - VS_GENERIC_QUAD_API(hostif_trap) - VS_GENERIC_QUAD_API(hostif_user_defined_trap) - - vs_recv_hostif_packet, - vs_send_hostif_packet, - vs_allocate_hostif_packet, - vs_free_hostif_packet, -}; diff --git a/vslib/sai_vs_interfacequery.cpp b/vslib/sai_vs_interfacequery.cpp deleted file mode 100644 index 1651cb12c..000000000 --- a/vslib/sai_vs_interfacequery.cpp +++ /dev/null @@ -1,248 +0,0 @@ -#include "sai_vs.h" -#include "Sai.h" - -std::shared_ptr vs_sai = std::make_shared(); - -sai_status_t sai_api_initialize( - _In_ uint64_t flags, - _In_ const sai_service_method_table_t *service_method_table) -{ - SWSS_LOG_ENTER(); - - return vs_sai->initialize(flags, service_method_table); -} - -sai_status_t sai_api_uninitialize(void) -{ - SWSS_LOG_ENTER(); - - return vs_sai->uninitialize(); -} - -sai_status_t sai_log_set( - _In_ sai_api_t sai_api_id, - _In_ sai_log_level_t log_level) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -#define API(api) .api ## _api = const_cast(&vs_ ## api ## _api) - -static sai_apis_t vs_apis = { - API(switch), - API(port), - API(fdb), - API(vlan), - API(virtual_router), - API(route), - API(next_hop), - API(next_hop_group), - API(router_interface), - API(neighbor), - API(acl), - API(hostif), - API(mirror), - API(samplepacket), - API(stp), - API(lag), - API(policer), - API(wred), - API(qos_map), - API(queue), - API(scheduler), - API(scheduler_group), - API(buffer), - API(hash), - API(udf), - API(tunnel), - API(l2mc), - API(ipmc), - API(rpf_group), - API(l2mc_group), - API(ipmc_group), - API(mcast_fdb), - API(bridge), - API(tam), - API(srv6), - API(mpls), - API(dtel), - API(bfd), - API(isolation_group), - API(nat), - API(counter), - API(debug_counter), - API(macsec), - API(system_port), - API(my_mac), - API(ipsec), - API(generic_programmable), - API(ars), - API(ars_profile), - API(twamp), - API(poe), - API(bmtor), - API(dash_acl), - API(dash_direction_lookup), - API(dash_eni), - API(dash_inbound_routing), - API(dash_meter), - API(dash_outbound_ca_to_pa), - API(dash_outbound_routing), - API(dash_vnet), - API(dash_pa_validation), - API(dash_vip), -}; - -static_assert((sizeof(sai_apis_t)/sizeof(void*)) == (SAI_API_EXTENSIONS_MAX - 1)); - -sai_status_t sai_api_query( - _In_ sai_api_t sai_api_id, - _Out_ void** api_method_table) -{ - SWSS_LOG_ENTER(); - - if (api_method_table == NULL) - { - SWSS_LOG_ERROR("NULL method table passed to SAI API initialize"); - return SAI_STATUS_INVALID_PARAMETER; - } - - if (sai_api_id == SAI_API_UNSPECIFIED) - { - SWSS_LOG_ERROR("api ID is unspecified api"); - - return SAI_STATUS_INVALID_PARAMETER; - } - - if (sai_metadata_get_enum_value_name(&sai_metadata_enum_sai_api_t, sai_api_id)) - { - *api_method_table = ((void**)&vs_apis)[sai_api_id - 1]; - return SAI_STATUS_SUCCESS; - } - - SWSS_LOG_ERROR("Invalid API type %d", sai_api_id); - - return SAI_STATUS_INVALID_PARAMETER; -} - -sai_status_t sai_query_attribute_capability( - _In_ sai_object_id_t switch_id, - _In_ sai_object_type_t object_type, - _In_ sai_attr_id_t attr_id, - _Out_ sai_attr_capability_t *capability) -{ - SWSS_LOG_ENTER(); - - return vs_sai->queryAttributeCapability( - switch_id, - object_type, - attr_id, - capability); -} - -sai_status_t sai_query_attribute_enum_values_capability( - _In_ sai_object_id_t switch_id, - _In_ sai_object_type_t object_type, - _In_ sai_attr_id_t attr_id, - _Inout_ sai_s32_list_t *enum_values_capability) -{ - SWSS_LOG_ENTER(); - - return vs_sai->queryAattributeEnumValuesCapability( - switch_id, - object_type, - attr_id, - enum_values_capability); -} - -sai_status_t sai_object_type_get_availability( - _In_ sai_object_id_t switch_id, - _In_ sai_object_type_t object_type, - _In_ uint32_t attr_count, - _In_ const sai_attribute_t *attr_list, - _Out_ uint64_t *count) -{ - SWSS_LOG_ENTER(); - - return vs_sai->objectTypeGetAvailability( - switch_id, - object_type, - attr_count, - attr_list, - count); -} - -sai_status_t sai_dbg_generate_dump( - _In_ const char *dump_file_name) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -sai_object_type_t sai_object_type_query( - _In_ sai_object_id_t objectId) -{ - SWSS_LOG_ENTER(); - - return vs_sai->objectTypeQuery(objectId); -} - -sai_object_id_t sai_switch_id_query( - _In_ sai_object_id_t objectId) -{ - SWSS_LOG_ENTER(); - - return vs_sai->switchIdQuery(objectId); -} - -sai_status_t sai_query_stats_capability( - _In_ sai_object_id_t switch_id, - _In_ sai_object_type_t object_type, - _Inout_ sai_stat_capability_list_t *stats_capability) -{ - SWSS_LOG_ENTER(); - - return vs_sai->queryStatsCapability(switch_id, object_type, stats_capability); -} - -sai_status_t sai_query_api_version( - _Out_ sai_api_version_t *version) -{ - SWSS_LOG_ENTER(); - - return vs_sai->queryApiVersion(version); -} - -sai_status_t sai_bulk_object_get_stats( - _In_ sai_object_id_t switch_id, - _In_ sai_object_type_t object_type, - _In_ uint32_t object_count, - _In_ const sai_object_key_t *object_key, - _In_ uint32_t number_of_counters, - _In_ const sai_stat_id_t *counter_ids, - _In_ sai_stats_mode_t mode, - _Inout_ sai_status_t *object_statuses, - _Out_ uint64_t *counters) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -sai_status_t sai_bulk_object_clear_stats( - _In_ sai_object_id_t switch_id, - _In_ sai_object_type_t object_type, - _In_ uint32_t object_count, - _In_ const sai_object_key_t *object_key, - _In_ uint32_t number_of_counters, - _In_ const sai_stat_id_t *counter_ids, - _In_ sai_stats_mode_t mode, - _Inout_ sai_status_t *object_statuses) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} diff --git a/vslib/sai_vs_ipmc.cpp b/vslib/sai_vs_ipmc.cpp deleted file mode 100644 index 9d7adf152..000000000 --- a/vslib/sai_vs_ipmc.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD_ENTRY(IPMC_ENTRY,ipmc_entry); - -const sai_ipmc_api_t vs_ipmc_api = { - - VS_GENERIC_QUAD_API(ipmc_entry) -}; diff --git a/vslib/sai_vs_ipmc_group.cpp b/vslib/sai_vs_ipmc_group.cpp deleted file mode 100644 index c8bfc3b74..000000000 --- a/vslib/sai_vs_ipmc_group.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(IPMC_GROUP,ipmc_group); -VS_GENERIC_QUAD(IPMC_GROUP_MEMBER,ipmc_group_member); - -const sai_ipmc_group_api_t vs_ipmc_group_api = { - - VS_GENERIC_QUAD_API(ipmc_group) - VS_GENERIC_QUAD_API(ipmc_group_member) -}; diff --git a/vslib/sai_vs_ipsec.cpp b/vslib/sai_vs_ipsec.cpp deleted file mode 100644 index fe4255a0e..000000000 --- a/vslib/sai_vs_ipsec.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(IPSEC,ipsec); -VS_GENERIC_QUAD(IPSEC_PORT,ipsec_port); -VS_GENERIC_QUAD(IPSEC_SA,ipsec_sa); -VS_GENERIC_STATS(IPSEC_PORT,ipsec_port); -VS_GENERIC_STATS(IPSEC_SA,ipsec_sa); - -const sai_ipsec_api_t vs_ipsec_api = { - - VS_GENERIC_QUAD_API(ipsec) - VS_GENERIC_QUAD_API(ipsec_port) - VS_GENERIC_STATS_API(ipsec_port) - VS_GENERIC_QUAD_API(ipsec_sa) - VS_GENERIC_STATS_API(ipsec_sa) -}; diff --git a/vslib/sai_vs_isolation_group.cpp b/vslib/sai_vs_isolation_group.cpp deleted file mode 100644 index 8b6347a53..000000000 --- a/vslib/sai_vs_isolation_group.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(ISOLATION_GROUP,isolation_group); -VS_GENERIC_QUAD(ISOLATION_GROUP_MEMBER,isolation_group_member); - -const sai_isolation_group_api_t vs_isolation_group_api = { - - VS_GENERIC_QUAD_API(isolation_group) - VS_GENERIC_QUAD_API(isolation_group_member) -}; - diff --git a/vslib/sai_vs_l2mc.cpp b/vslib/sai_vs_l2mc.cpp deleted file mode 100644 index 4446913a3..000000000 --- a/vslib/sai_vs_l2mc.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD_ENTRY(L2MC_ENTRY,l2mc_entry); - -const sai_l2mc_api_t vs_l2mc_api = { - - VS_GENERIC_QUAD_API(l2mc_entry) -}; diff --git a/vslib/sai_vs_l2mcgroup.cpp b/vslib/sai_vs_l2mcgroup.cpp deleted file mode 100644 index f91527395..000000000 --- a/vslib/sai_vs_l2mcgroup.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(L2MC_GROUP,l2mc_group); -VS_GENERIC_QUAD(L2MC_GROUP_MEMBER,l2mc_group_member); - -const sai_l2mc_group_api_t vs_l2mc_group_api = { - - VS_GENERIC_QUAD_API(l2mc_group) - VS_GENERIC_QUAD_API(l2mc_group_member) -}; diff --git a/vslib/sai_vs_lag.cpp b/vslib/sai_vs_lag.cpp deleted file mode 100644 index ee8c540a3..000000000 --- a/vslib/sai_vs_lag.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "sai_vs.h" - -VS_BULK_CREATE(LAG_MEMBER,lag_members); -VS_BULK_REMOVE(LAG_MEMBER,lag_members); - -VS_GENERIC_QUAD(LAG,lag); -VS_GENERIC_QUAD(LAG_MEMBER,lag_member); - -const sai_lag_api_t vs_lag_api = { - - VS_GENERIC_QUAD_API(lag) - VS_GENERIC_QUAD_API(lag_member) - - vs_bulk_create_lag_members, - vs_bulk_remove_lag_members, -}; diff --git a/vslib/sai_vs_macsec.cpp b/vslib/sai_vs_macsec.cpp deleted file mode 100644 index 690eba30e..000000000 --- a/vslib/sai_vs_macsec.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(MACSEC,macsec); - -VS_GENERIC_QUAD(MACSEC_PORT,macsec_port); -VS_GENERIC_STATS(MACSEC_PORT,macsec_port); - -VS_GENERIC_QUAD(MACSEC_FLOW,macsec_flow); -VS_GENERIC_STATS(MACSEC_FLOW,macsec_flow); - -VS_GENERIC_QUAD(MACSEC_SC,macsec_sc); -VS_GENERIC_STATS(MACSEC_SC,macsec_sc); - -VS_GENERIC_QUAD(MACSEC_SA,macsec_sa); -VS_GENERIC_STATS(MACSEC_SA,macsec_sa); - -const sai_macsec_api_t vs_macsec_api = { - - VS_GENERIC_QUAD_API(macsec) - - VS_GENERIC_QUAD_API(macsec_port) - VS_GENERIC_STATS_API(macsec_port) - - VS_GENERIC_QUAD_API(macsec_flow) - VS_GENERIC_STATS_API(macsec_flow) - - VS_GENERIC_QUAD_API(macsec_sc) - VS_GENERIC_STATS_API(macsec_sc) - - VS_GENERIC_QUAD_API(macsec_sa) - VS_GENERIC_STATS_API(macsec_sa) -}; diff --git a/vslib/sai_vs_mcastfdb.cpp b/vslib/sai_vs_mcastfdb.cpp deleted file mode 100644 index d400287e9..000000000 --- a/vslib/sai_vs_mcastfdb.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD_ENTRY(MCAST_FDB_ENTRY,mcast_fdb_entry); - -const sai_mcast_fdb_api_t vs_mcast_fdb_api = { - - VS_GENERIC_QUAD_API(mcast_fdb_entry) -}; diff --git a/vslib/sai_vs_mirror.cpp b/vslib/sai_vs_mirror.cpp deleted file mode 100644 index 757c8c430..000000000 --- a/vslib/sai_vs_mirror.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(MIRROR_SESSION,mirror_session); - -const sai_mirror_api_t vs_mirror_api = { - - VS_GENERIC_QUAD_API(mirror_session) -}; diff --git a/vslib/sai_vs_mpls.cpp b/vslib/sai_vs_mpls.cpp deleted file mode 100644 index 2058c4e48..000000000 --- a/vslib/sai_vs_mpls.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD_ENTRY(INSEG_ENTRY,inseg_entry); -VS_BULK_QUAD_ENTRY(INSEG_ENTRY,inseg_entry); - -const sai_mpls_api_t vs_mpls_api = { - - VS_GENERIC_QUAD_API(inseg_entry) - VS_BULK_QUAD_API(inseg_entry) -}; diff --git a/vslib/sai_vs_my_mac.cpp b/vslib/sai_vs_my_mac.cpp deleted file mode 100644 index a159602e1..000000000 --- a/vslib/sai_vs_my_mac.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(IPSEC,my_mac); - -const sai_my_mac_api_t vs_my_mac_api = { - - VS_GENERIC_QUAD_API(my_mac) -}; diff --git a/vslib/sai_vs_nat.cpp b/vslib/sai_vs_nat.cpp deleted file mode 100644 index 68eb708aa..000000000 --- a/vslib/sai_vs_nat.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include "sai_vs.h" - -VS_BULK_QUAD_ENTRY(NAT_ENTRY,nat_entry); - -VS_GENERIC_QUAD_ENTRY(NAT_ENTRY,nat_entry); -VS_GENERIC_QUAD(NAT_ZONE_COUNTER,nat_zone_counter); - -const sai_nat_api_t vs_nat_api = { - - VS_GENERIC_QUAD_API(nat_entry) - - VS_BULK_QUAD_API(nat_entry) - - VS_GENERIC_QUAD_API(nat_zone_counter) -}; diff --git a/vslib/sai_vs_neighbor.cpp b/vslib/sai_vs_neighbor.cpp deleted file mode 100644 index 7049967c8..000000000 --- a/vslib/sai_vs_neighbor.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "sai_vs.h" - -static sai_status_t vs_remove_all_neighbor_entries( - _In_ sai_object_id_t switch_id) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -VS_BULK_QUAD_ENTRY(NEIGHBOR_ENTRY,neighbor_entry); -VS_GENERIC_QUAD_ENTRY(NEIGHBOR_ENTRY,neighbor_entry); - -const sai_neighbor_api_t vs_neighbor_api = { - - VS_GENERIC_QUAD_API(neighbor_entry) - - vs_remove_all_neighbor_entries, - - VS_BULK_QUAD_API(neighbor_entry) -}; diff --git a/vslib/sai_vs_nexthop.cpp b/vslib/sai_vs_nexthop.cpp deleted file mode 100644 index fdab7ab0e..000000000 --- a/vslib/sai_vs_nexthop.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(NEXT_HOP,next_hop); -VS_BULK_QUAD(NEXT_HOP,next_hop); - -const sai_next_hop_api_t vs_next_hop_api = { - - VS_GENERIC_QUAD_API(next_hop) - VS_BULK_QUAD_API(next_hop) -}; diff --git a/vslib/sai_vs_nexthopgroup.cpp b/vslib/sai_vs_nexthopgroup.cpp deleted file mode 100644 index f3881f825..000000000 --- a/vslib/sai_vs_nexthopgroup.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "sai_vs.h" - -VS_BULK_CREATE(NEXT_HOP_GROUP_MEMBER,next_hop_group_members); -VS_BULK_REMOVE(NEXT_HOP_GROUP_MEMBER,next_hop_group_members); -VS_BULK_GET(NEXT_HOP_GROUP_MEMBER,next_hop_group_members); -VS_BULK_SET(NEXT_HOP_GROUP_MEMBER,next_hop_group_members); - -VS_GENERIC_QUAD(NEXT_HOP_GROUP,next_hop_group); -VS_GENERIC_QUAD(NEXT_HOP_GROUP_MEMBER,next_hop_group_member); -VS_GENERIC_QUAD(NEXT_HOP_GROUP_MAP,next_hop_group_map); - -const sai_next_hop_group_api_t vs_next_hop_group_api = { - - VS_GENERIC_QUAD_API(next_hop_group) - VS_GENERIC_QUAD_API(next_hop_group_member) - - vs_bulk_create_next_hop_group_members, - vs_bulk_remove_next_hop_group_members, - VS_GENERIC_QUAD_API(next_hop_group_map) - vs_bulk_set_next_hop_group_members, - vs_bulk_get_next_hop_group_members -}; diff --git a/vslib/sai_vs_poe.cpp b/vslib/sai_vs_poe.cpp deleted file mode 100644 index b4b9aa9c0..000000000 --- a/vslib/sai_vs_poe.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(POE_DEVICE,poe_device); -VS_GENERIC_QUAD(POE_PSE,poe_pse); -VS_GENERIC_QUAD(POE_PORT,poe_port); - -const sai_poe_api_t vs_poe_api = { - - VS_GENERIC_QUAD_API(poe_device) - VS_GENERIC_QUAD_API(poe_pse) - VS_GENERIC_QUAD_API(poe_port) -}; diff --git a/vslib/sai_vs_policer.cpp b/vslib/sai_vs_policer.cpp deleted file mode 100644 index a4ce3d3e8..000000000 --- a/vslib/sai_vs_policer.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(POLICER,policer); -VS_GENERIC_STATS(POLICER,policer); - -const sai_policer_api_t vs_policer_api = { - - VS_GENERIC_QUAD_API(policer) - VS_GENERIC_STATS_API(policer) -}; diff --git a/vslib/sai_vs_port.cpp b/vslib/sai_vs_port.cpp deleted file mode 100644 index 54e4a7116..000000000 --- a/vslib/sai_vs_port.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include "sai_vs.h" - -static sai_status_t vs_clear_port_all_stats( - _In_ sai_object_id_t port_id) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -VS_GENERIC_QUAD(PORT,port); -VS_GENERIC_QUAD(PORT_POOL,port_pool); -VS_GENERIC_QUAD(PORT_CONNECTOR,port_connector); -VS_GENERIC_QUAD(PORT_SERDES,port_serdes); -VS_GENERIC_STATS(PORT,port); -VS_GENERIC_STATS(PORT_POOL,port_pool); -VS_BULK_QUAD(PORT,ports); -VS_BULK_QUAD(PORT_SERDES, port_serdeses); - -const sai_port_api_t vs_port_api = { - - VS_GENERIC_QUAD_API(port) - VS_GENERIC_STATS_API(port) - - vs_clear_port_all_stats, - - VS_GENERIC_QUAD_API(port_pool) - VS_GENERIC_STATS_API(port_pool) - - VS_GENERIC_QUAD_API(port_connector) - - VS_GENERIC_QUAD_API(port_serdes) - VS_BULK_QUAD_API(ports) - VS_BULK_QUAD_API(port_serdeses) -}; diff --git a/vslib/sai_vs_qosmap.cpp b/vslib/sai_vs_qosmap.cpp deleted file mode 100644 index 802c3b82d..000000000 --- a/vslib/sai_vs_qosmap.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(QOS_MAP,qos_map); - -const sai_qos_map_api_t vs_qos_map_api = { - - VS_GENERIC_QUAD_API(qos_map) -}; diff --git a/vslib/sai_vs_queue.cpp b/vslib/sai_vs_queue.cpp deleted file mode 100644 index 75ab91ada..000000000 --- a/vslib/sai_vs_queue.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(QUEUE,queue); -VS_GENERIC_STATS(QUEUE,queue); - -const sai_queue_api_t vs_queue_api = { - - VS_GENERIC_QUAD_API(queue) - VS_GENERIC_STATS_API(queue) -}; diff --git a/vslib/sai_vs_route.cpp b/vslib/sai_vs_route.cpp deleted file mode 100644 index 0f5698020..000000000 --- a/vslib/sai_vs_route.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD_ENTRY(ROUTE_ENTRY,route_entry); - -VS_BULK_QUAD_ENTRY(ROUTE_ENTRY,route_entry); - -const sai_route_api_t vs_route_api = { - - VS_GENERIC_QUAD_API(route_entry) - VS_BULK_QUAD_API(route_entry) -}; diff --git a/vslib/sai_vs_router_interface.cpp b/vslib/sai_vs_router_interface.cpp deleted file mode 100644 index df8bfeaa2..000000000 --- a/vslib/sai_vs_router_interface.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(ROUTER_INTERFACE,router_interface); -VS_GENERIC_STATS(ROUTER_INTERFACE,router_interface); -VS_BULK_QUAD(ROUTER_INTERFACE,router_interfaces); - -const sai_router_interface_api_t vs_router_interface_api = { - - VS_GENERIC_QUAD_API(router_interface) - VS_GENERIC_STATS_API(router_interface) - VS_BULK_QUAD_API(router_interfaces) -}; diff --git a/vslib/sai_vs_rpfgroup.cpp b/vslib/sai_vs_rpfgroup.cpp deleted file mode 100644 index 7096c19de..000000000 --- a/vslib/sai_vs_rpfgroup.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(RPF_GROUP,rpf_group); -VS_GENERIC_QUAD(RPF_GROUP_MEMBER,rpf_group_member); - -const sai_rpf_group_api_t vs_rpf_group_api = { - - VS_GENERIC_QUAD_API(rpf_group) - VS_GENERIC_QUAD_API(rpf_group_member) -}; diff --git a/vslib/sai_vs_samplepacket.cpp b/vslib/sai_vs_samplepacket.cpp deleted file mode 100644 index 36d944b82..000000000 --- a/vslib/sai_vs_samplepacket.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(SAMPLEPACKET,samplepacket); - -const sai_samplepacket_api_t vs_samplepacket_api = { - - VS_GENERIC_QUAD_API(samplepacket) -}; diff --git a/vslib/sai_vs_scheduler.cpp b/vslib/sai_vs_scheduler.cpp deleted file mode 100644 index 54f3ce5eb..000000000 --- a/vslib/sai_vs_scheduler.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(SCHEDULER,scheduler); - -const sai_scheduler_api_t vs_scheduler_api = { - - VS_GENERIC_QUAD_API(scheduler) -}; diff --git a/vslib/sai_vs_schedulergroup.cpp b/vslib/sai_vs_schedulergroup.cpp deleted file mode 100644 index ad7e12ec8..000000000 --- a/vslib/sai_vs_schedulergroup.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(SCHEDULER_GROUP,scheduler_group); - -const sai_scheduler_group_api_t vs_scheduler_group_api = { - - VS_GENERIC_QUAD_API(scheduler_group) -}; diff --git a/vslib/sai_vs_srv6.cpp b/vslib/sai_vs_srv6.cpp deleted file mode 100644 index 8d669251f..000000000 --- a/vslib/sai_vs_srv6.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "sai_vs.h" - -VS_BULK_CREATE(SRV6_SIDLIST,srv6_sidlists); -VS_BULK_REMOVE(SRV6_SIDLIST,srv6_sidlists); - -VS_GENERIC_QUAD(SRV6_SIDLIST,srv6_sidlist); - -VS_GENERIC_QUAD_ENTRY(MY_SID_ENTRY, my_sid_entry); -VS_BULK_QUAD_ENTRY(MY_SID_ENTRY, my_sid_entry); - -const sai_srv6_api_t vs_srv6_api = { - - VS_GENERIC_QUAD_API(srv6_sidlist) - - vs_bulk_create_srv6_sidlists, - vs_bulk_remove_srv6_sidlists, - - NULL, - NULL, - NULL, - - VS_GENERIC_QUAD_API(my_sid_entry) - VS_BULK_QUAD_API(my_sid_entry) -}; diff --git a/vslib/sai_vs_stp.cpp b/vslib/sai_vs_stp.cpp deleted file mode 100644 index 5a478e81c..000000000 --- a/vslib/sai_vs_stp.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "sai_vs.h" - -VS_BULK_CREATE(STP_PORT,stp_ports); -VS_BULK_REMOVE(STP_PORT,stp_ports); - -VS_GENERIC_QUAD(STP,stp); -VS_GENERIC_QUAD(STP_PORT,stp_port); - -const sai_stp_api_t vs_stp_api = { - - VS_GENERIC_QUAD_API(stp) - VS_GENERIC_QUAD_API(stp_port) - - vs_bulk_create_stp_ports, - vs_bulk_remove_stp_ports, -}; diff --git a/vslib/sai_vs_switch.cpp b/vslib/sai_vs_switch.cpp deleted file mode 100644 index 3ef226426..000000000 --- a/vslib/sai_vs_switch.cpp +++ /dev/null @@ -1,84 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(SWITCH,switch); -VS_GENERIC_STATS(SWITCH,switch); -VS_GENERIC_QUAD(SWITCH_TUNNEL,switch_tunnel); - -static sai_status_t vs_create_switch_uniq( - _Out_ sai_object_id_t *switch_id, - _In_ uint32_t attr_count, - _In_ const sai_attribute_t *attr_list) -{ - SWSS_LOG_ENTER(); - - return vs_create_switch( - switch_id, - SAI_NULL_OBJECT_ID, // no switch id since we create switch - attr_count, - attr_list); -} - -static sai_status_t vs_switch_mdio_read( - _In_ sai_object_id_t switch_id, - _In_ uint32_t device_addr, - _In_ uint32_t start_reg_addr, - _In_ uint32_t number_of_registers, - _Out_ uint32_t *reg_val) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -static sai_status_t vs_switch_mdio_write( - _In_ sai_object_id_t switch_id, - _In_ uint32_t device_addr, - _In_ uint32_t start_reg_addr, - _In_ uint32_t number_of_registers, - _In_ const uint32_t *reg_val) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -static sai_status_t vs_switch_mdio_cl22_read( - _In_ sai_object_id_t switch_id, - _In_ uint32_t device_addr, - _In_ uint32_t start_reg_addr, - _In_ uint32_t number_of_registers, - _Out_ uint32_t *reg_val) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -static sai_status_t vs_switch_mdio_cl22_write( - _In_ sai_object_id_t switch_id, - _In_ uint32_t device_addr, - _In_ uint32_t start_reg_addr, - _In_ uint32_t number_of_registers, - _In_ const uint32_t *reg_val) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -const sai_switch_api_t vs_switch_api = { - - vs_create_switch_uniq, - vs_remove_switch, - vs_set_switch_attribute, - vs_get_switch_attribute, - - VS_GENERIC_STATS_API(switch) - - vs_switch_mdio_read, - vs_switch_mdio_write, - - VS_GENERIC_QUAD_API(switch_tunnel) - vs_switch_mdio_cl22_read, - vs_switch_mdio_cl22_write -}; diff --git a/vslib/sai_vs_system_port.cpp b/vslib/sai_vs_system_port.cpp deleted file mode 100644 index 20b0243f4..000000000 --- a/vslib/sai_vs_system_port.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(SYSTEM_PORT,system_port); - -const sai_system_port_api_t vs_system_port_api = { - - VS_GENERIC_QUAD_API(system_port) -}; diff --git a/vslib/sai_vs_tam.cpp b/vslib/sai_vs_tam.cpp deleted file mode 100644 index a1abba1ff..000000000 --- a/vslib/sai_vs_tam.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include "sai_vs.h" - -sai_status_t sai_tam_telemetry_get_data( - _In_ sai_object_id_t switch_id, - _In_ sai_object_list_t obj_list, - _In_ bool clear_on_read, - _Inout_ sai_size_t *buffer_size, - _Out_ void *buffer) -{ - SWSS_LOG_ENTER(); - - return SAI_STATUS_NOT_IMPLEMENTED; -} - -VS_GENERIC_QUAD(TAM,tam); -VS_GENERIC_QUAD(TAM_MATH_FUNC,tam_math_func); -VS_GENERIC_QUAD(TAM_REPORT,tam_report); -VS_GENERIC_QUAD(TAM_EVENT_THRESHOLD,tam_event_threshold); -VS_GENERIC_QUAD(TAM_INT,tam_int); -VS_GENERIC_QUAD(TAM_TEL_TYPE,tam_tel_type); -VS_GENERIC_QUAD(TAM_TRANSPORT,tam_transport); -VS_GENERIC_QUAD(TAM_TELEMETRY,tam_telemetry); -VS_GENERIC_QUAD(TAM_COLLECTOR,tam_collector); -VS_GENERIC_QUAD(TAM_EVENT_ACTION,tam_event_action); -VS_GENERIC_QUAD(TAM_EVENT,tam_event); -VS_GENERIC_QUAD(TAM_COUNTER_SUBSCRIPTION,tam_counter_subscription); - -const sai_tam_api_t vs_tam_api = { - - VS_GENERIC_QUAD_API(tam) - VS_GENERIC_QUAD_API(tam_math_func) - VS_GENERIC_QUAD_API(tam_report) - VS_GENERIC_QUAD_API(tam_event_threshold) - VS_GENERIC_QUAD_API(tam_int) - VS_GENERIC_QUAD_API(tam_tel_type) - VS_GENERIC_QUAD_API(tam_transport) - VS_GENERIC_QUAD_API(tam_telemetry) - VS_GENERIC_QUAD_API(tam_collector) - VS_GENERIC_QUAD_API(tam_event_action) - VS_GENERIC_QUAD_API(tam_event) - VS_GENERIC_QUAD_API(tam_counter_subscription) - -}; diff --git a/vslib/sai_vs_tunnel.cpp b/vslib/sai_vs_tunnel.cpp deleted file mode 100644 index e7b522a08..000000000 --- a/vslib/sai_vs_tunnel.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(TUNNEL_MAP,tunnel_map); -VS_GENERIC_QUAD(TUNNEL,tunnel); -VS_GENERIC_QUAD(TUNNEL_TERM_TABLE_ENTRY,tunnel_term_table_entry); -VS_GENERIC_QUAD(TUNNEL_MAP_ENTRY,tunnel_map_entry); -VS_GENERIC_STATS(TUNNEL,tunnel); -VS_BULK_QUAD(TUNNEL,tunnels); - -const sai_tunnel_api_t vs_tunnel_api = { - - VS_GENERIC_QUAD_API(tunnel_map) - VS_GENERIC_QUAD_API(tunnel) - VS_GENERIC_STATS_API(tunnel) - VS_GENERIC_QUAD_API(tunnel_term_table_entry) - VS_GENERIC_QUAD_API(tunnel_map_entry) - VS_BULK_QUAD_API(tunnels) -}; diff --git a/vslib/sai_vs_twamp.cpp b/vslib/sai_vs_twamp.cpp deleted file mode 100644 index 5a62b790a..000000000 --- a/vslib/sai_vs_twamp.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(TWAMP_SESSION,twamp_session); -VS_GENERIC_STATS(TWAMP_SESSION,twamp_session); - -const sai_twamp_api_t vs_twamp_api = { - VS_GENERIC_QUAD_API(twamp_session) - VS_GENERIC_STATS_API(twamp_session) -}; diff --git a/vslib/sai_vs_udf.cpp b/vslib/sai_vs_udf.cpp deleted file mode 100644 index 0f4f108d9..000000000 --- a/vslib/sai_vs_udf.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(UDF,udf) -VS_GENERIC_QUAD(UDF_MATCH,udf_match) -VS_GENERIC_QUAD(UDF_GROUP,udf_group) - -const sai_udf_api_t vs_udf_api = { - - VS_GENERIC_QUAD_API(udf) - VS_GENERIC_QUAD_API(udf_match) - VS_GENERIC_QUAD_API(udf_group) -}; diff --git a/vslib/sai_vs_virtual_router.cpp b/vslib/sai_vs_virtual_router.cpp deleted file mode 100644 index cb3c05e9c..000000000 --- a/vslib/sai_vs_virtual_router.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(VIRTUAL_ROUTER,virtual_router); - -const sai_virtual_router_api_t vs_virtual_router_api = { - - VS_GENERIC_QUAD_API(virtual_router) -}; diff --git a/vslib/sai_vs_vlan.cpp b/vslib/sai_vs_vlan.cpp deleted file mode 100644 index 8395f4027..000000000 --- a/vslib/sai_vs_vlan.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "sai_vs.h" - -VS_BULK_CREATE(VLAN_MEMBER,vlan_members); -VS_BULK_REMOVE(VLAN_MEMBER,vlan_members); - -VS_GENERIC_QUAD(VLAN,vlan); -VS_GENERIC_QUAD(VLAN_MEMBER,vlan_member); -VS_GENERIC_STATS(VLAN,vlan); - -const sai_vlan_api_t vs_vlan_api = { - - VS_GENERIC_QUAD_API(vlan) - VS_GENERIC_QUAD_API(vlan_member) - - vs_bulk_create_vlan_members, - vs_bulk_remove_vlan_members, - - VS_GENERIC_STATS_API(vlan) -}; diff --git a/vslib/sai_vs_wred.cpp b/vslib/sai_vs_wred.cpp deleted file mode 100644 index d02b0bb2d..000000000 --- a/vslib/sai_vs_wred.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "sai_vs.h" - -VS_GENERIC_QUAD(WRED,wred); - -const sai_wred_api_t vs_wred_api = { - - VS_GENERIC_QUAD_API(wred) -}; From c8cede0f405b6f6ee65fca48a8c5e4261e93fb04 Mon Sep 17 00:00:00 2001 From: Nikola Dancejic <26731235+Ndancejic@users.noreply.github.com> Date: Thu, 30 May 2024 09:30:20 -0700 Subject: [PATCH 29/32] [syncd] Enable bulk api for neighbor entries (#1373) * [syncd] Enable bulk api for neighbor entries SAI 1.11.0 added support for bulk neighbor entries. Adding support for neighbor bulk operations to syncd. * added neighbor entry capability to bulk operations in syncd * added unit tests for neighbor bulk operations * added code coverage for neighbor bulk operations --- saiplayer/SaiPlayer.cpp | 52 ++++++++ syncd/Syncd.cpp | 64 ++++++++++ syncd/tests.cpp | 141 ++++++++++++++++++++++ syncd/tests/TestSyncdBrcm.cpp | 146 +++++++++++++++++++++++ tests/BCM56850.pl | 8 ++ tests/BCM56850/bulk_neighbor.rec | 12 ++ unittest/lib/test_sai_redis_neighbor.cpp | 30 +++++ unittest/vslib/test_sai_vs_neighbor.cpp | 30 +++++ 8 files changed, 483 insertions(+) create mode 100644 tests/BCM56850/bulk_neighbor.rec create mode 100644 unittest/lib/test_sai_redis_neighbor.cpp create mode 100644 unittest/vslib/test_sai_vs_neighbor.cpp diff --git a/saiplayer/SaiPlayer.cpp b/saiplayer/SaiPlayer.cpp index 3710a2de8..4437f2906 100644 --- a/saiplayer/SaiPlayer.cpp +++ b/saiplayer/SaiPlayer.cpp @@ -1698,6 +1698,23 @@ sai_status_t SaiPlayer::handle_bulk_entry( } break; + case SAI_OBJECT_TYPE_NEIGHBOR_ENTRY: + { + std::vector entries(object_count); + + for (size_t it = 0; it < object_count; it++) + { + sai_deserialize_neighbor_entry(object_ids[it], entries[it]); + + entries[it].switch_id = translate_local_to_redis(entries[it].switch_id); + entries[it].rif_id = translate_local_to_redis(entries[it].rif_id); + } + + CALL_BULK_CREATE_API_WITH_TIMER("neighbor_entry"); + + } + break; + case SAI_OBJECT_TYPE_FDB_ENTRY: { @@ -1876,6 +1893,23 @@ sai_status_t SaiPlayer::handle_bulk_entry( } break; + case SAI_OBJECT_TYPE_NEIGHBOR_ENTRY: + { + std::vector entries(object_count); + + for (size_t it = 0; it < object_count; it++) + { + sai_deserialize_neighbor_entry(object_ids[it], entries[it]); + + entries[it].switch_id = translate_local_to_redis(entries[it].switch_id); + entries[it].rif_id = translate_local_to_redis(entries[it].rif_id); + } + + CALL_BULK_REMOVE_API_WITH_TIMER("neighbor_entry"); + + } + break; + case SAI_OBJECT_TYPE_FDB_ENTRY: { @@ -2061,6 +2095,23 @@ sai_status_t SaiPlayer::handle_bulk_entry( } break; + case SAI_OBJECT_TYPE_NEIGHBOR_ENTRY: + { + std::vector entries(object_count); + + for (size_t it = 0; it < object_count; it++) + { + sai_deserialize_neighbor_entry(object_ids[it], entries[it]); + + entries[it].switch_id = translate_local_to_redis(entries[it].switch_id); + entries[it].rif_id = translate_local_to_redis(entries[it].rif_id); + } + + CALL_BULK_SET_API_WITH_TIMER("neighbor_entry"); + + } + break; + case SAI_OBJECT_TYPE_FDB_ENTRY: { @@ -2452,6 +2503,7 @@ void SaiPlayer::processBulk( switch ((int)object_type) { case SAI_OBJECT_TYPE_ROUTE_ENTRY: + case SAI_OBJECT_TYPE_NEIGHBOR_ENTRY: case SAI_OBJECT_TYPE_FDB_ENTRY: case SAI_OBJECT_TYPE_NAT_ENTRY: case SAI_OBJECT_TYPE_DIRECTION_LOOKUP_ENTRY: diff --git a/syncd/Syncd.cpp b/syncd/Syncd.cpp index 09f066a9e..980886f8f 100644 --- a/syncd/Syncd.cpp +++ b/syncd/Syncd.cpp @@ -1015,6 +1015,27 @@ sai_status_t Syncd::processBulkCreateEntry( } break; + case SAI_OBJECT_TYPE_NEIGHBOR_ENTRY: + { + std::vector entries(object_count); + for (uint32_t it = 0; it < object_count; it++) + { + sai_deserialize_neighbor_entry(objectIds[it], entries[it]); + + entries[it].switch_id = m_translator->translateVidToRid(entries[it].switch_id); + entries[it].rif_id = m_translator->translateVidToRid(entries[it].rif_id); + } + + status = m_vendorSai->bulkCreate( + object_count, + entries.data(), + attr_counts.data(), + attr_lists.data(), + mode, + statuses.data()); + } + break; + case SAI_OBJECT_TYPE_FDB_ENTRY: { std::vector entries(object_count); @@ -1301,6 +1322,25 @@ sai_status_t Syncd::processBulkRemoveEntry( } break; + case SAI_OBJECT_TYPE_NEIGHBOR_ENTRY: + { + std::vector entries(object_count); + for (uint32_t it = 0; it < object_count; it++) + { + sai_deserialize_neighbor_entry(objectIds[it], entries[it]); + + entries[it].switch_id = m_translator->translateVidToRid(entries[it].switch_id); + entries[it].rif_id = m_translator->translateVidToRid(entries[it].rif_id); + } + + status = m_vendorSai->bulkRemove( + object_count, + entries.data(), + mode, + statuses.data()); + } + break; + case SAI_OBJECT_TYPE_FDB_ENTRY: { std::vector entries(object_count); @@ -1574,6 +1614,26 @@ sai_status_t Syncd::processBulkSetEntry( } break; + case SAI_OBJECT_TYPE_NEIGHBOR_ENTRY: + { + std::vector entries(object_count); + for (uint32_t it = 0; it < object_count; it++) + { + sai_deserialize_neighbor_entry(objectIds[it], entries[it]); + + entries[it].switch_id = m_translator->translateVidToRid(entries[it].switch_id); + entries[it].rif_id = m_translator->translateVidToRid(entries[it].rif_id); + } + + status = m_vendorSai->bulkSet( + object_count, + entries.data(), + attr_lists.data(), + mode, + statuses.data()); + } + break; + case SAI_OBJECT_TYPE_FDB_ENTRY: { std::vector entries(object_count); @@ -1730,6 +1790,10 @@ sai_status_t Syncd::processBulkEntry( sai_deserialize_route_entry(objectIds[idx], metaKey.objectkey.key.route_entry); break; + case SAI_OBJECT_TYPE_NEIGHBOR_ENTRY: + sai_deserialize_neighbor_entry(objectIds[idx], metaKey.objectkey.key.neighbor_entry); + break; + case SAI_OBJECT_TYPE_NAT_ENTRY: sai_deserialize_nat_entry(objectIds[idx], metaKey.objectkey.key.nat_entry); break; diff --git a/syncd/tests.cpp b/syncd/tests.cpp index a150f935e..27b89dfa7 100644 --- a/syncd/tests.cpp +++ b/syncd/tests.cpp @@ -671,6 +671,145 @@ void test_bulk_route_set() ASSERT_SUCCESS("Failed to bulk remove route entry"); } +void test_bulk_neighbor_set() +{ + SWSS_LOG_ENTER(); + + + sai_reinit(); + + + sai_status_t status; + + sai_neighbor_api_t *sai_neighbor_api = NULL; + sai_switch_api_t *sai_switch_api = NULL; + sai_virtual_router_api_t * sai_virtual_router_api = NULL; + sai_lag_api_t *sai_lag_api = NULL; + sai_router_interface_api_t *sai_rif_api = NULL; + + sai_api_query(SAI_API_NEIGHBOR, (void**)&sai_neighbor_api); + sai_api_query(SAI_API_SWITCH, (void**)&sai_switch_api); + sai_api_query(SAI_API_VIRTUAL_ROUTER, (void**)&sai_virtual_router_api); + sai_api_query(SAI_API_ROUTER_INTERFACE, (void **)&sai_rif_api); + sai_api_query(SAI_API_LAG, (void**)&sai_lag_api); + + uint32_t count = 3; + + std::vector neighbors; + std::vector attrs; + + sai_attribute_t swattr; + + swattr.id = SAI_SWITCH_ATTR_INIT_SWITCH; + swattr.value.booldata = true; + + sai_object_id_t switch_id; + status = sai_switch_api->create_switch(&switch_id, 1, &swattr); + + ASSERT_SUCCESS("Failed to create switch"); + + std::vector> neighbor_attrs; + std::vector neighbor_attrs_array; + std::vector neighbor_attrs_count; + + for (uint32_t i = 0; i < count; ++i) + { + sai_neighbor_entry_t neighbor_entry; + + // virtual router + sai_object_id_t vr; + + status = sai_virtual_router_api->create_virtual_router(&vr, switch_id, 0, NULL); + + ASSERT_SUCCESS("failed to create virtual router"); + + // create lag + sai_object_id_t lag; + status = sai_lag_api->create_lag(&lag, switch_id, 0, NULL); + + // create router interface + sai_object_id_t rif; + sai_attribute_t rifattr[3]; + rifattr[0].id = SAI_ROUTER_INTERFACE_ATTR_VIRTUAL_ROUTER_ID; + rifattr[0].value.oid = vr; + rifattr[1].id = SAI_ROUTER_INTERFACE_ATTR_TYPE; + rifattr[1].value.s32 = SAI_ROUTER_INTERFACE_TYPE_PORT; + rifattr[2].id = SAI_ROUTER_INTERFACE_ATTR_PORT_ID; + rifattr[2].value.oid = lag; + status = sai_rif_api->create_router_interface(&rif, switch_id, 3, rifattr); + ASSERT_SUCCESS("Failed to create router interface"); + + neighbor_entry.ip_address.addr_family = SAI_IP_ADDR_FAMILY_IPV4; + neighbor_entry.ip_address.addr.ip4 = 0x10000001 + i; + neighbor_entry.rif_id = rif; + neighbor_entry.switch_id = switch_id; + neighbors.push_back(neighbor_entry); + + std::vector list(1); + sai_attribute_t &attr = list[0]; + + sai_mac_t mac = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66}; + attr.id = SAI_NEIGHBOR_ENTRY_ATTR_DST_MAC_ADDRESS; + memcpy(attr.value.mac, mac, 6); + neighbor_attrs.push_back(list); + neighbor_attrs_count.push_back(1); + } + + for (size_t j = 0; j < neighbor_attrs.size(); j++) + { + neighbor_attrs_array.push_back(neighbor_attrs[j].data()); + } + + std::vector statuses(count); + status = sai_neighbor_api->create_neighbor_entries(count, neighbors.data(), neighbor_attrs_count.data(), neighbor_attrs_array.data(), SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR, statuses.data()); + ASSERT_SUCCESS("Failed to create neighbor"); + for (size_t j = 0; j < statuses.size(); j++) + { + status = statuses[j]; + ASSERT_SUCCESS("Failed to create neighbor # %zu", j); + } + + for (uint32_t i = 0; i < count; ++i) + { + sai_attribute_t attr; + attr.id = SAI_NEIGHBOR_ENTRY_ATTR_PACKET_ACTION; + attr.value.s32 = SAI_PACKET_ACTION_FORWARD; + + status = sai_neighbor_api->set_neighbor_entry_attribute(&neighbors[i], &attr); + + attrs.push_back(attr); + + ASSERT_SUCCESS("Failed to set neighbor"); + } + + statuses.clear(); + statuses.resize(attrs.size()); + + for (auto &attr: attrs) + { + attr.value.s32 = SAI_PACKET_ACTION_FORWARD; + } + + status = sai_neighbor_api->set_neighbor_entries_attribute( + count, + neighbors.data(), + attrs.data(), + SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR, + statuses.data()); + + ASSERT_SUCCESS("Failed to bulk set neighbor"); + + for (auto s: statuses) + { + status = s; + + ASSERT_SUCCESS("Failed to bulk set neighbor on one of the neighbors"); + } + + status = sai_neighbor_api->remove_neighbor_entries(count, neighbors.data(), SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR, statuses.data()); + ASSERT_SUCCESS("Failed to bulk remove neighbor entry"); +} + void syncdThread() { SWSS_LOG_ENTER(); @@ -765,6 +904,8 @@ int main() test_bulk_fdb_create(); + test_bulk_neighbor_set(); + test_bulk_route_set(); sai_api_uninitialize(); diff --git a/syncd/tests/TestSyncdBrcm.cpp b/syncd/tests/TestSyncdBrcm.cpp index b776d45e8..892a3ca0e 100644 --- a/syncd/tests/TestSyncdBrcm.cpp +++ b/syncd/tests/TestSyncdBrcm.cpp @@ -243,3 +243,149 @@ TEST_F(SyncdBrcmTest, routeBulkCreate) status = m_sairedis->set(SAI_OBJECT_TYPE_SWITCH, SAI_NULL_OBJECT_ID, attrs); ASSERT_EQ(status, SAI_STATUS_SUCCESS); } + +TEST_F(SyncdBrcmTest, neighborBulkTest) +{ + sai_object_id_t switchId; + sai_object_id_t rif; + sai_object_id_t port; + sai_attribute_t attrs[3]; + + // init view + + attrs[0].id = SAI_REDIS_SWITCH_ATTR_NOTIFY_SYNCD; + attrs[0].value.s32 = SAI_REDIS_NOTIFY_SYNCD_INIT_VIEW; + + auto status = m_sairedis->set(SAI_OBJECT_TYPE_SWITCH, SAI_NULL_OBJECT_ID, attrs); + ASSERT_EQ(status, SAI_STATUS_SUCCESS); + + // create switch + + attrs[0].id = SAI_SWITCH_ATTR_INIT_SWITCH; + attrs[0].value.booldata = true; + + status = m_sairedis->create(SAI_OBJECT_TYPE_SWITCH, &switchId, SAI_NULL_OBJECT_ID, 1, attrs); + ASSERT_EQ(status, SAI_STATUS_SUCCESS); + + attrs[0].id = SAI_SWITCH_ATTR_DEFAULT_VIRTUAL_ROUTER_ID; + status = m_sairedis->get(SAI_OBJECT_TYPE_SWITCH, switchId, 1, attrs); + ASSERT_EQ(status, SAI_STATUS_SUCCESS); + + sai_object_id_t vr = attrs[0].value.oid; + + // create port + static uint32_t id = 1; + id++; + + uint32_t hw_lane_list[1] = { id }; + + attrs[0].id = SAI_PORT_ATTR_HW_LANE_LIST; + attrs[0].value.u32list.count = 1; + attrs[0].value.u32list.list = hw_lane_list; + + attrs[1].id = SAI_PORT_ATTR_SPEED; + attrs[1].value.u32 = 10000; + + status = m_sairedis->create(SAI_OBJECT_TYPE_PORT, &port, switchId, 2, attrs); + EXPECT_EQ(SAI_STATUS_SUCCESS, status); + + // create rif + attrs[0].id = SAI_ROUTER_INTERFACE_ATTR_VIRTUAL_ROUTER_ID; + attrs[0].value.oid = vr; + + attrs[1].id = SAI_ROUTER_INTERFACE_ATTR_TYPE; + attrs[1].value.s32 = SAI_ROUTER_INTERFACE_TYPE_PORT; + + attrs[2].id = SAI_ROUTER_INTERFACE_ATTR_PORT_ID; + attrs[2].value.oid = port; + + status = m_sairedis->create(SAI_OBJECT_TYPE_ROUTER_INTERFACE, &rif, switchId, 3, attrs); + EXPECT_EQ(SAI_STATUS_SUCCESS, status); + + // create neighbor bulk neighbors in init view mode + + std::vector> neighbor_attrs; + std::vector neighbor_attrs_array; + std::vector neighbor_attrs_count; + std::vector neighbors; + + uint32_t count = 3; + for (uint32_t i = 0; i < count; ++i) + { + sai_neighbor_entry_t neighbor_entry; + + neighbor_entry.ip_address.addr_family = SAI_IP_ADDR_FAMILY_IPV4; + neighbor_entry.ip_address.addr.ip4 = 0x10000001 + i; + neighbor_entry.rif_id = rif; + neighbor_entry.switch_id = switchId; + + neighbors.push_back(neighbor_entry); + + std::vector list(1); // no attributes + sai_attribute_t &neigh_attr = list[0]; + + sai_mac_t mac = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66}; + neigh_attr.id = SAI_NEIGHBOR_ENTRY_ATTR_DST_MAC_ADDRESS; + memcpy(neigh_attr.value.mac, mac, 6); + + neighbor_attrs.push_back(list); + neighbor_attrs_count.push_back(1); + } + + for (size_t j = 0; j < neighbor_attrs.size(); j++) + { + neighbor_attrs_array.push_back(neighbor_attrs[j].data()); + } + + std::vector statuses(count); + + status = m_sairedis->bulkCreate( + count, + neighbors.data(), + neighbor_attrs_count.data(), + neighbor_attrs_array.data(), + SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR, + statuses.data()); + ASSERT_EQ(status, SAI_STATUS_SUCCESS); + + for (size_t j = 0; j < statuses.size(); j++) + { + status = statuses[j]; + ASSERT_EQ(status, SAI_STATUS_SUCCESS); + } + + statuses.clear(); + + for (uint32_t i = 0; i < count; ++i) + { + attrs[i].id = SAI_NEIGHBOR_ENTRY_ATTR_PACKET_ACTION; + attrs[i].value.s32 = SAI_PACKET_ACTION_FORWARD; + } + + status = m_sairedis->bulkSet( + count, + neighbors.data(), + attrs, + SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR, + statuses.data()); + + for (size_t j = 0; j < statuses.size(); j++) + { + status = statuses[j]; + ASSERT_EQ(status, SAI_STATUS_SUCCESS); + } + + statuses.clear(); + + status = m_sairedis->bulkRemove( + count, + neighbors.data(), + SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR, + statuses.data()); + + for (size_t j = 0; j < statuses.size(); j++) + { + status = statuses[j]; + ASSERT_EQ(status, SAI_STATUS_SUCCESS); + } +} diff --git a/tests/BCM56850.pl b/tests/BCM56850.pl index 5127757c7..7dd6ea0a8 100755 --- a/tests/BCM56850.pl +++ b/tests/BCM56850.pl @@ -580,6 +580,13 @@ sub test_bulk_route play "bulk_route.rec" } +sub test_bulk_neighbor +{ + fresh_start; + + play "bulk_neighbor.rec" +} + sub test_bulk_fdb { fresh_start; @@ -862,6 +869,7 @@ sub test_acl_pre_match_999 test_acl_mask; test_empty_lag_buffer_acl; test_bulk_route; +test_bulk_neighbor; test_bulk_fdb; test_bulk_object; test_brcm_config_acl; diff --git a/tests/BCM56850/bulk_neighbor.rec b/tests/BCM56850/bulk_neighbor.rec new file mode 100644 index 000000000..4d0887031 --- /dev/null +++ b/tests/BCM56850/bulk_neighbor.rec @@ -0,0 +1,12 @@ +2024-05-22.01:55:46.541806|#|recording on: ./sairedis.2024-05-22.01:55:46.541389.rec +2024-05-22.01:55:46.543987|a|INIT_VIEW +2024-05-22.01:55:46.551164|A|SAI_STATUS_SUCCESS +2024-05-22.01:55:46.555975|c|SAI_OBJECT_TYPE_SWITCH:oid:0x21000000000000|SAI_SWITCH_ATTR_INIT_SWITCH=true|SAI_SWITCH_ATTR_FDB_EVENT_NOTIFY=0x417890|SAI_SWITCH_ATTR_PORT_STATE_CHANGE_NOTIFY=0x4179f0|SAI_SWITCH_ATTR_SWITCH_SHUTDOWN_REQUEST_NOTIFY=0x417b50 +2024-05-22.01:56:05.508992|c|SAI_OBJECT_TYPE_VIRTUAL_ROUTER:oid:0x3000000000004 +2024-05-22.01:56:05.708992|c|SAI_OBJECT_TYPE_PORT:oid:0x20000000006ee|SAI_PORT_ATTR_SPEED=10000|SAI_PORT_ATTR_HW_LANE_LIST=1:202 +2024-05-22.01:56:05.805336|c|SAI_OBJECT_TYPE_ROUTER_INTERFACE:oid:0x6000000000727|SAI_ROUTER_INTERFACE_ATTR_VIRTUAL_ROUTER_ID=oid:0x3000000000004|SAI_ROUTER_INTERFACE_ATTR_SRC_MAC_ADDRESS=00:E0:EC:C2:AF:7A|SAI_ROUTER_INTERFACE_ATTR_TYPE=SAI_ROUTER_INTERFACE_TYPE_PORT|SAI_ROUTER_INTERFACE_ATTR_PORT_ID=oid:0x20000000006ee|SAI_ROUTER_INTERFACE_ATTR_MTU=9100|SAI_ROUTER_INTERFACE_ATTR_NAT_ZONE_ID=0 +2024-05-22.01:56:06.105336|C|SAI_OBJECT_TYPE_NEIGHBOR_ENTRY||{"ip":"10.0.0.57","rif":"oid:0x6000000000727","switch_id":"oid:0x21000000000000"}|SAI_NEIGHBOR_ENTRY_ATTR_DST_MAC_ADDRESS=FF:FF:FF:FF:FF:FF||{"ip":"10.0.0.59","rif":"oid:0x6000000000727","switch_id":"oid:0x21000000000000"}|SAI_NEIGHBOR_ENTRY_ATTR_DST_MAC_ADDRESS=FF:FF:FF:FF:FF:FF +2024-05-22.01:56:06.205336|S|SAI_OBJECT_TYPE_NEIGHBOR_ENTRY||{"ip":"10.0.0.57","rif":"oid:0x6000000000727","switch_id":"oid:0x21000000000000"}|SAI_NEIGHBOR_ENTRY_ATTR_DST_MAC_ADDRESS=FF:FF:FF:FF:FF:00||{"ip":"10.0.0.59","rif":"oid:0x6000000000727","switch_id":"oid:0x21000000000000"}|SAI_NEIGHBOR_ENTRY_ATTR_DST_MAC_ADDRESS=FF:FF:FF:FF:FF:00 +2024-05-22.01:56:06.205336|R|SAI_OBJECT_TYPE_NEIGHBOR_ENTRY||{"ip":"10.0.0.57","rif":"oid:0x6000000000727","switch_id":"oid:0x21000000000000"}||{"ip":"10.0.0.59","rif":"oid:0x6000000000727","switch_id":"oid:0x21000000000000"} +2024-05-22.01:56:06.151337|a|APPLY_VIEW +2024-05-22.01:56:06.156740|A|SAI_STATUS_SUCCESS \ No newline at end of file diff --git a/unittest/lib/test_sai_redis_neighbor.cpp b/unittest/lib/test_sai_redis_neighbor.cpp new file mode 100644 index 000000000..9a7852410 --- /dev/null +++ b/unittest/lib/test_sai_redis_neighbor.cpp @@ -0,0 +1,30 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsairedis, neighbor) +{ + sai_neighbor_api_t *api = nullptr; + + sai_api_query(SAI_API_NEIGHBOR, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_neighbor_entry_t id ; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_neighbor_entry(&id,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_neighbor_entry(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_neighbor_entry_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_neighbor_entry_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_neighbor_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_neighbor_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_neighbor_entries_attribute(0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_neighbor_entries_attribute(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + + EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->remove_all_neighbor_entries(0)); +} diff --git a/unittest/vslib/test_sai_vs_neighbor.cpp b/unittest/vslib/test_sai_vs_neighbor.cpp new file mode 100644 index 000000000..3ad85a077 --- /dev/null +++ b/unittest/vslib/test_sai_vs_neighbor.cpp @@ -0,0 +1,30 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaivs, neighbor) +{ + sai_neighbor_api_t *api = nullptr; + + sai_api_query(SAI_API_NEIGHBOR, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_neighbor_entry_t id ; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_neighbor_entry(&id,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_neighbor_entry(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_neighbor_entry_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_neighbor_entry_attribute(0,0,0)); + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_neighbor_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_neighbor_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_neighbor_entries_attribute(0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_neighbor_entries_attribute(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); + + EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->remove_all_neighbor_entries(0)); +} From 104835026159093aca3438548dcb129dfd940441 Mon Sep 17 00:00:00 2001 From: Kamil Cudnik Date: Thu, 6 Jun 2024 23:02:24 +0200 Subject: [PATCH 30/32] [saiproxy] Implement all APIs except bulk (#1386) Initial implementaion of all APIs except bulk and notifications required for sai proxy feature --- meta/DummySaiInterface.cpp | 5 + proxylib/Makefile.am | 3 +- proxylib/Proxy.cpp | 1006 +++++++++++++++++++++++ proxylib/Proxy.h | 126 +++ proxylib/Sai.cpp | 643 +++++++++++++-- proxylib/Sai.h | 40 +- unittest/meta/TestDummySaiInterface.cpp | 12 + unittest/proxylib/Makefile.am | 8 +- unittest/proxylib/TestSai.cpp | 535 +++++++++++- 9 files changed, 2290 insertions(+), 88 deletions(-) create mode 100644 proxylib/Proxy.cpp create mode 100644 proxylib/Proxy.h diff --git a/meta/DummySaiInterface.cpp b/meta/DummySaiInterface.cpp index c1671c9d6..b15454bb2 100644 --- a/meta/DummySaiInterface.cpp +++ b/meta/DummySaiInterface.cpp @@ -46,6 +46,11 @@ sai_status_t DummySaiInterface::create( { SWSS_LOG_ENTER(); + if (objectId && m_status == SAI_STATUS_SUCCESS) + { + *objectId = (sai_object_id_t)1; + } + return m_status; } diff --git a/proxylib/Makefile.am b/proxylib/Makefile.am index 87738f77a..5797451eb 100644 --- a/proxylib/Makefile.am +++ b/proxylib/Makefile.am @@ -1,10 +1,11 @@ -AM_CXXFLAGS = $(SAIINC) -I$(top_srcdir)/lib +AM_CXXFLAGS = $(SAIINC) -I$(top_srcdir)/lib -I$(top_srcdir)/meta lib_LTLIBRARIES = libsaiproxy.la noinst_LIBRARIES = libSaiProxy.a libSaiProxy_a_SOURCES = \ + Proxy.cpp \ Sai.cpp BUILT_SOURCES = sai_proxy.cpp diff --git a/proxylib/Proxy.cpp b/proxylib/Proxy.cpp new file mode 100644 index 000000000..60ecb43bd --- /dev/null +++ b/proxylib/Proxy.cpp @@ -0,0 +1,1006 @@ +#include "Proxy.h" + +#include "swss/logger.h" +#include "swss/select.h" +#include "swss/table.h" + +#include "meta/SaiAttributeList.h" +#include "meta/sai_serialize.h" +#include "meta/ZeroMQSelectableChannel.h" + +#include "syncd/ZeroMQNotificationProducer.h" + +#include +#include + +using namespace saiproxy; +using namespace std::placeholders; + +// TODO we need pointers translation for receiving notifications +// TODO handle diagnostic shell + +Proxy::Proxy( + _In_ std::shared_ptr vendorSai): + m_vendorSai(vendorSai), + m_apiInitialized(false) +{ + SWSS_LOG_ENTER(); + + // TODO to move hard coded addresses to config + + m_selectableChannel = std::make_shared("tcp://127.0.0.1:5555"); + m_notifications = std::make_shared("tcp://127.0.0.1:5556"); + + m_smt.profileGetValue = std::bind(&Proxy::profileGetValue, this, _1, _2); + m_smt.profileGetNextValue = std::bind(&Proxy::profileGetNextValue, this, _1, _2, _3); + + m_test_services = m_smt.getServiceMethodTable(); + + sai_status_t status = m_vendorSai->apiInitialize(0, &m_test_services); + + if (status != SAI_STATUS_SUCCESS) + { + SWSS_LOG_ERROR("FATAL: failed to sai_api_initialize: %s", + sai_serialize_status(status).c_str()); + } + else + { + m_apiInitialized = true; + + SWSS_LOG_NOTICE("api initialized success"); + } +} + +Proxy::~Proxy() +{ + SWSS_LOG_ENTER(); + + if (m_apiInitialized) + { + SWSS_LOG_NOTICE("calling api uninitialize"); + + auto status = m_vendorSai->apiUninitialize(); + + if (status != SAI_STATUS_SUCCESS) + { + SWSS_LOG_ERROR("api uninitialize failed: %s", sai_serialize_status(status).c_str()); + } + } + + // TODO lock guard could be needed to wait for notifications destruction + // until all possible notification thread will be sent + + m_notifications = nullptr; +} + +const char* Proxy::profileGetValue( + _In_ sai_switch_profile_id_t profile_id, + _In_ const char* variable) +{ + SWSS_LOG_ENTER(); + + if (variable == NULL) + { + SWSS_LOG_WARN("variable is null"); + return NULL; + } + + auto it = m_profileMap.find(variable); + + if (it == m_profileMap.end()) + { + SWSS_LOG_NOTICE("%s: NULL", variable); + return NULL; + } + + SWSS_LOG_NOTICE("%s: %s", variable, it->second.c_str()); + + return it->second.c_str(); +} + +int Proxy::profileGetNextValue( + _In_ sai_switch_profile_id_t profile_id, + _Out_ const char** variable, + _Out_ const char** value) +{ + SWSS_LOG_ENTER(); + + if (value == NULL) + { + SWSS_LOG_INFO("resetting profile map iterator"); + + m_profileIter = m_profileMap.begin(); + return 0; + } + + if (variable == NULL) + { + SWSS_LOG_WARN("variable is null"); + return -1; + } + + if (m_profileIter == m_profileMap.end()) + { + SWSS_LOG_INFO("iterator reached end"); + return -1; + } + + *variable = m_profileIter->first.c_str(); + *value = m_profileIter->second.c_str(); + + SWSS_LOG_INFO("key: %s:%s", *variable, *value); + + m_profileIter++; + + return 0; +} + +void Proxy::run() +{ + SWSS_LOG_ENTER(); + + SWSS_LOG_NOTICE("thread start"); + + std::shared_ptr s = std::make_shared(); + + // TODO will we need this thread at all?, maybe just resend notification as they + // arrive ? could this potentially cause deadlock ? if we will be invoking + // some api under mutex and then that ntf would be called from same thread + // as api invoked that's why we have processing queue on syncd here we would + // need only protect ntf sender- notification channel + + // m_processor->startNotificationsProcessingThread(); + + s->addSelectable(m_selectableChannel.get()); + s->addSelectable(&m_stopEvent); + + SWSS_LOG_NOTICE("entering main thread loop"); + + while (true) + { + swss::Selectable *sel = NULL; + + int result = s->select(&sel); + + if (sel == &m_stopEvent) + { + break; + } + else if (sel == m_selectableChannel.get()) + { + processEvent(*m_selectableChannel.get()); + } + else + { + SWSS_LOG_ERROR("select failed: %d", result); + } + } + + SWSS_LOG_NOTICE("thread end"); +} + +void Proxy::stop() +{ + SWSS_LOG_ENTER(); + + SWSS_LOG_NOTICE("stop thread requested"); + + // TODO maybe not needed + std::lock_guard lock(m_mutex); + + m_stopEvent.notify(); +} + +void Proxy::processEvent( + _In_ sairedis::SelectableChannel& consumer) +{ + SWSS_LOG_ENTER(); + + std::lock_guard lock(m_mutex); + + do + { + swss::KeyOpFieldsValuesTuple kco; + + consumer.pop(kco, false); + + processSingleEvent(kco); + } + while (!consumer.empty()); +} + +void Proxy::processSingleEvent( + _In_ const swss::KeyOpFieldsValuesTuple &kco) +{ + SWSS_LOG_ENTER(); + + auto& key = kfvKey(kco); + auto& op = kfvOp(kco); + + SWSS_LOG_INFO("key: %s op: %s", key.c_str(), op.c_str()); + + if (key.length() == 0) + { + SWSS_LOG_DEBUG("no elements in m_buffer"); + + return; + } + + // TODO implement bulk create/remove/set/get + + if (op == "create") + return processCreate(kco); + + if (op == "remove") + return processRemove(kco); + + if (op == "set") + return processSet(kco); + + if (op == "get") + return processGet(kco); + + if (op == "create_entry") + return processCreateEntry(kco); + + if (op == "flush_fdb_entries") + return processFlushFdbEntries(kco); + + if (op == "object_type_get_availability") + return processObjectTypeGetAvailability(kco); + + if (op == "query_attribute_capability") + return processQueryAttributeCapability(kco); + + if (op == "query_attribute_enum_values_capability") + return processQueryAttributeEnumValuesCapability(kco); + + if (op == "object_type_query") + return processObjectTypeQuery(kco); + + if (op == "switch_id_query") + return processSwitchIdQuery(kco); + + if (op == "query_api_version") + return processQueryApiVersion(kco); + + if (op == "log_set") + return processLogSet(kco); + + if (op == "get_stats") + return processGetStats(kco); + + if (op == "get_stats_ext") + return processGetStatsExt(kco); + + if (op == "clear_stats") + return processClearStats(kco); + + SWSS_LOG_THROW("event op '%s' is not implemented, FIXME", op.c_str()); +} + +void Proxy::processCreate( + _In_ const swss::KeyOpFieldsValuesTuple &kco) +{ + SWSS_LOG_ENTER(); + + const std::string& key = kfvKey(kco); + + const std::string& strObjectId = key.substr(key.find(":") + 1); + + sai_object_meta_key_t metaKey; + sai_deserialize_object_meta_key(key, metaKey); + + if (!sai_metadata_is_object_type_valid(metaKey.objecttype)) + { + SWSS_LOG_THROW("invalid object type %s", key.c_str()); + } + + auto values = kfvFieldsValues(kco); + + sai_object_id_t switchId = SAI_NULL_OBJECT_ID; + + auto vv = values.back(); + + values.pop_back(); + + SWSS_LOG_NOTICE("removed last field: %s: %s", fvField(vv).c_str(), fvValue(vv).c_str()); + + sai_deserialize_object_id(fvValue(vv), switchId); + + for (auto& v: values) + { + SWSS_LOG_DEBUG("attr: %s: %s", fvField(v).c_str(), fvValue(v).c_str()); + } + + saimeta::SaiAttributeList list(metaKey.objecttype, values, false); + + sai_attribute_t *attr_list = list.get_attr_list(); + uint32_t attr_count = list.get_attr_count(); + + if (metaKey.objecttype == SAI_OBJECT_TYPE_SWITCH) + { + /* + * TODO: translate notification pointers + * TODO: must be done per switch, and switch may not exists yet + */ + + // TODO + // m_handler->updateNotificationsPointers(attr_count, attr_list); + } + + sai_object_id_t newObjectId = SAI_NULL_OBJECT_ID;; + + sai_status_t status = m_vendorSai->create(metaKey.objecttype, &newObjectId, switchId, attr_count, attr_list); + + std::vector entry; + + std::string strStatus = sai_serialize_status(status); + + swss::FieldValueTuple fvt("OBJECT_ID", sai_serialize_object_id(newObjectId)); + + entry.push_back(fvt); + + m_selectableChannel->set(strStatus, entry, "create_response"); +} + +void Proxy::processRemove( + _In_ const swss::KeyOpFieldsValuesTuple &kco) +{ + SWSS_LOG_ENTER(); + + const std::string& key = kfvKey(kco); + + const std::string& strObjectId = key.substr(key.find(":") + 1); + + sai_object_meta_key_t metaKey; + sai_deserialize_object_meta_key(key, metaKey); + + if (!sai_metadata_is_object_type_valid(metaKey.objecttype)) + { + SWSS_LOG_THROW("invalid object type %s", key.c_str()); + } + + sai_status_t status = m_vendorSai->remove(metaKey); + + std::string strStatus = sai_serialize_status(status); + + m_selectableChannel->set(strStatus, {}, "remove_response"); +} + +void Proxy::processSet( + _In_ const swss::KeyOpFieldsValuesTuple &kco) +{ + SWSS_LOG_ENTER(); + + const std::string& key = kfvKey(kco); + + const std::string& strObjectId = key.substr(key.find(":") + 1); + + sai_object_meta_key_t metaKey; + sai_deserialize_object_meta_key(key, metaKey); + + if (!sai_metadata_is_object_type_valid(metaKey.objecttype)) + { + SWSS_LOG_THROW("invalid object type %s", key.c_str()); + } + + auto values = kfvFieldsValues(kco); + + for (auto& v: values) + { + SWSS_LOG_DEBUG("attr: %s: %s", fvField(v).c_str(), fvValue(v).c_str()); + } + + saimeta::SaiAttributeList list(metaKey.objecttype, values, false); + + sai_attribute_t *attr_list = list.get_attr_list(); + + if (metaKey.objecttype == SAI_OBJECT_TYPE_SWITCH) + { + /* + * TODO: translate notification pointers + * TODO: must be done per switch, and switch may not exists yet + */ + + // TODO + // m_handler->updateNotificationsPointers(attr_count, attr_list); + } + + sai_status_t status = m_vendorSai->set(metaKey, attr_list); + + std::vector entry; + + std::string strStatus = sai_serialize_status(status); + + m_selectableChannel->set(strStatus, {}, "set_response"); +} + +void Proxy::processGet( + _In_ const swss::KeyOpFieldsValuesTuple &kco) +{ + SWSS_LOG_ENTER(); + + const std::string& key = kfvKey(kco); + const std::string& strObjectId = key.substr(key.find(":") + 1); + + sai_object_meta_key_t metaKey; + sai_deserialize_object_meta_key(key, metaKey); + + if (!sai_metadata_is_object_type_valid(metaKey.objecttype)) + { + SWSS_LOG_THROW("invalid object type %s", key.c_str()); + } + + auto& values = kfvFieldsValues(kco); + + for (auto& v: values) + { + SWSS_LOG_DEBUG("attr: %s: %s", fvField(v).c_str(), fvValue(v).c_str()); + } + + saimeta::SaiAttributeList list(metaKey.objecttype, values, false); + + sai_attribute_t *attr_list = list.get_attr_list(); + uint32_t attr_count = list.get_attr_count(); + + auto status = m_vendorSai->get(metaKey, attr_count, attr_list); + + std::vector entry; + + if (status == SAI_STATUS_SUCCESS) + { + entry = saimeta::SaiAttributeList::serialize_attr_list( + metaKey.objecttype, + attr_count, + attr_list, + false); + } + else if (status == SAI_STATUS_BUFFER_OVERFLOW) + { + /* + * In this case we got correct values for list, but list was too small + * so serialize only count without list itself, sairedis will need to + * take this into account when deserialize. + * + * If there was a list somewhere, count will be changed to actual value + * different attributes can have different lists, many of them may + * serialize only count, and will need to support that on the receiver. + */ + + entry = saimeta::SaiAttributeList::serialize_attr_list( + metaKey.objecttype, + attr_count, + attr_list, + true); + } + else + { + /* + * Some other error, don't send attributes at all. + */ + + SWSS_LOG_WARN("api failed: %s", sai_serialize_status(status).c_str()); + } + + std::string strStatus = sai_serialize_status(status); + + SWSS_LOG_INFO("sending response for GET api with status: %s", strStatus.c_str()); + + /* + * Since we have only one get at a time, we don't have to serialize object + * type and object id, only get status is required to be returned. Get + * response will not put any data to table, only queue is used. + */ + + m_selectableChannel->set(strStatus, entry, "get_response"); +} + +void Proxy::processCreateEntry( + _In_ const swss::KeyOpFieldsValuesTuple &kco) +{ + SWSS_LOG_ENTER(); + + const std::string& key = kfvKey(kco); + // const std::string& op = kfvOp(kco); + + const std::string& strObjectId = key.substr(key.find(":") + 1); + + sai_object_meta_key_t metaKey; + sai_deserialize_object_meta_key(key, metaKey); + + if (!sai_metadata_is_object_type_valid(metaKey.objecttype)) + { + SWSS_LOG_THROW("invalid object type %s", key.c_str()); + } + + auto values = kfvFieldsValues(kco); + + saimeta::SaiAttributeList list(metaKey.objecttype, values, false); + + sai_attribute_t *attr_list = list.get_attr_list(); + uint32_t attr_count = list.get_attr_count(); + + // since this is only used for create entries, there is no need for notification + // pointers translation, since object entries don't contain pointers + + sai_status_t status = m_vendorSai->create(metaKey, SAI_NULL_OBJECT_ID, attr_count, attr_list); + + std::string strStatus = sai_serialize_status(status); + + m_selectableChannel->set(strStatus, {}, "create_entry_response"); +} + +void Proxy::processFlushFdbEntries( + _In_ const swss::KeyOpFieldsValuesTuple &kco) +{ + SWSS_LOG_ENTER(); + + auto& key = kfvKey(kco); + auto strSwitchId = key.substr(key.find(":") + 1); + + sai_object_id_t switchId; + sai_deserialize_object_id(strSwitchId, switchId); + + auto& values = kfvFieldsValues(kco); + + for (const auto &v: values) + { + SWSS_LOG_NOTICE("attr: %s: %s", fvField(v).c_str(), fvValue(v).c_str()); + } + + saimeta::SaiAttributeList list(SAI_OBJECT_TYPE_FDB_FLUSH, values, false); + + sai_attribute_t *attr_list = list.get_attr_list(); + uint32_t attr_count = list.get_attr_count(); + + sai_status_t status = m_vendorSai->flushFdbEntries(switchId, attr_count, attr_list); + + std::string strStatus = sai_serialize_status(status); + + m_selectableChannel->set(strStatus, {}, "flush_fdb_entries_response"); +} + +void Proxy::processObjectTypeGetAvailability( + _In_ const swss::KeyOpFieldsValuesTuple &kco) +{ + SWSS_LOG_ENTER(); + + auto& strSwitchId = kfvKey(kco); + + sai_object_id_t switchId; + sai_deserialize_object_id(strSwitchId, switchId); + + std::vector values = kfvFieldsValues(kco); + + sai_object_type_t objectType; + sai_deserialize_object_type(fvValue(values.back()), objectType); + + values.pop_back(); + + saimeta::SaiAttributeList list(objectType, values, false); + + sai_attribute_t *attr_list = list.get_attr_list(); + uint32_t attr_count = list.get_attr_count(); + + uint64_t count; + + sai_status_t status = m_vendorSai->objectTypeGetAvailability( + switchId, + objectType, + attr_count, + attr_list, + &count); + + std::vector entry; + + if (status == SAI_STATUS_SUCCESS) + { + entry.emplace_back("COUNT", std::to_string(count)); + } + + std::string strStatus = sai_serialize_status(status); + + m_selectableChannel->set(strStatus, entry, "object_type_get_availability_response"); +} + +void Proxy::processQueryAttributeCapability( + _In_ const swss::KeyOpFieldsValuesTuple &kco) +{ + SWSS_LOG_ENTER(); + + auto& strSwitchId = kfvKey(kco); + + sai_object_id_t switchId; + sai_deserialize_object_id(strSwitchId, switchId); + + auto& values = kfvFieldsValues(kco); + + if (values.size() != 2) + { + SWSS_LOG_ERROR("logic error, expected 2 arguments, received %zu", values.size()); + + auto strStatus = sai_serialize_status(SAI_STATUS_INVALID_PARAMETER); + + m_selectableChannel->set(strStatus, {}, "query_attribute_capability_response"); + + return; + } + + sai_object_type_t objectType; + sai_deserialize_object_type(fvValue(values[0]), objectType); + + sai_attr_id_t attrId; + sai_deserialize_attr_id(fvValue(values[1]), attrId); + + sai_attr_capability_t capability; + + sai_status_t status = m_vendorSai->queryAttributeCapability(switchId, objectType, attrId, &capability); + + std::vector entry; + + if (status == SAI_STATUS_SUCCESS) + { + entry = + { + swss::FieldValueTuple("CREATE_IMPLEMENTED", (capability.create_implemented ? "true" : "false")), + swss::FieldValueTuple("SET_IMPLEMENTED", (capability.set_implemented ? "true" : "false")), + swss::FieldValueTuple("GET_IMPLEMENTED", (capability.get_implemented ? "true" : "false")) + }; + } + + auto strStatus = sai_serialize_status(status); + + m_selectableChannel->set(strStatus, entry, "query_attribute_capability_response"); +} + +void Proxy::processQueryAttributeEnumValuesCapability( + _In_ const swss::KeyOpFieldsValuesTuple &kco) +{ + SWSS_LOG_ENTER(); + + auto& strSwitchId = kfvKey(kco); + + sai_object_id_t switchId; + sai_deserialize_object_id(strSwitchId, switchId); + + auto& values = kfvFieldsValues(kco); + + if (values.size() != 3) + { + SWSS_LOG_ERROR("logic error, expected 3 arguments, received %zu", values.size()); + + auto strStatus = sai_serialize_status(SAI_STATUS_INVALID_PARAMETER); + + m_selectableChannel->set(strStatus, {}, "query_attribute_enum_values_capability_response"); + + return; + } + + sai_object_type_t objectType; + sai_deserialize_object_type(fvValue(values[0]), objectType); + + sai_attr_id_t attrId; + sai_deserialize_attr_id(fvValue(values[1]), attrId); + + uint32_t list_size = std::stoi(fvValue(values[2])); + + std::vector enum_capabilities_list(list_size); + + sai_s32_list_t enumCapList; + + enumCapList.count = list_size; + enumCapList.list = enum_capabilities_list.data(); + + sai_status_t status = m_vendorSai->queryAttributeEnumValuesCapability(switchId, objectType, attrId, &enumCapList); + + std::vector entry; + + if (status == SAI_STATUS_SUCCESS) + { + std::vector vec; + std::transform(enumCapList.list, enumCapList.list + enumCapList.count, + std::back_inserter(vec), [](auto&e) { return std::to_string(e); }); + + std::ostringstream join; + std::copy(vec.begin(), vec.end(), std::ostream_iterator(join, ",")); + + auto strCap = join.str(); + + entry = + { + swss::FieldValueTuple("ENUM_CAPABILITIES", strCap), + swss::FieldValueTuple("ENUM_COUNT", std::to_string(enumCapList.count)) + }; + } + else if (status == SAI_STATUS_BUFFER_OVERFLOW) + { + entry = + { + swss::FieldValueTuple("ENUM_COUNT", std::to_string(enumCapList.count)) + }; + } + + auto strStatus = sai_serialize_status(status); + + m_selectableChannel->set(strStatus, entry, "query_attribute_enum_values_capability_response"); +} + +void Proxy::processObjectTypeQuery( + _In_ const swss::KeyOpFieldsValuesTuple &kco) +{ + SWSS_LOG_ENTER(); + + const std::string& key = kfvKey(kco); + + sai_object_id_t objectId; + sai_deserialize_object_id(key, objectId); + + sai_object_type_t objectType = m_vendorSai->objectTypeQuery(objectId); + + std::vector entry; + + std::string strStatus = sai_serialize_status(SAI_STATUS_SUCCESS); // we assume success + + entry.emplace_back("OBJECT_TYPE", sai_serialize_object_type(objectType)); + + m_selectableChannel->set(strStatus, entry, "object_type_query_response"); +} + +void Proxy::processSwitchIdQuery( + _In_ const swss::KeyOpFieldsValuesTuple &kco) +{ + SWSS_LOG_ENTER(); + + const std::string& key = kfvKey(kco); + + sai_object_id_t objectId; + sai_deserialize_object_id(key, objectId); + + sai_object_id_t switchId = m_vendorSai->switchIdQuery(objectId); + + std::vector entry; + + std::string strStatus = sai_serialize_status(SAI_STATUS_SUCCESS); // we assume success + + entry.emplace_back("OBJECT_ID", sai_serialize_object_id(switchId)); + + m_selectableChannel->set(strStatus, entry, "switch_id_query_response"); +} + +void Proxy::processQueryApiVersion( + _In_ const swss::KeyOpFieldsValuesTuple &kco) +{ + SWSS_LOG_ENTER(); + + sai_api_version_t version; + + sai_status_t status = m_vendorSai->queryApiVersion(&version); + + std::vector entry; + + if (status == SAI_STATUS_SUCCESS) + { + entry.emplace_back("VERSION", std::to_string(version)); + + SWSS_LOG_NOTICE("query api version returned: %ld", version); + } + + auto strStatus = sai_serialize_status(status); + + m_selectableChannel->set(strStatus, entry, "query_api_version_response"); +} + +void Proxy::processLogSet( + _In_ const swss::KeyOpFieldsValuesTuple &kco) +{ + SWSS_LOG_ENTER(); + + auto& key = kfvKey(kco); + + auto strApi = key.substr(0, key.find(":")); + auto strLogLevel = key.substr(key.find(":") + 1); + + sai_api_t api; + sai_deserialize_api(strApi, api); + + sai_log_level_t level; + sai_deserialize_log_level(strLogLevel, level); + + sai_status_t status = m_vendorSai->logSet(api, level); + + auto strStatus = sai_serialize_status(status); + + m_selectableChannel->set(strStatus, {}, "log_set_response"); +} + +void Proxy::processGetStats( + _In_ const swss::KeyOpFieldsValuesTuple &kco) +{ + SWSS_LOG_ENTER(); + + const std::string& key = kfvKey(kco); + + sai_object_meta_key_t metaKey; + sai_deserialize_object_meta_key(key, metaKey); + + if (!sai_metadata_is_object_type_valid(metaKey.objecttype)) + { + SWSS_LOG_THROW("invalid object type %s", key.c_str()); + } + + auto oi = sai_metadata_get_object_type_info(metaKey.objecttype); + + if (oi == NULL) + { + SWSS_LOG_ERROR("invalid object type: %s", sai_serialize_object_type(metaKey.objecttype).c_str()); + + std::string strStatus = sai_serialize_status(SAI_STATUS_FAILURE); + + m_selectableChannel->set(strStatus, {}, "get_stats_response"); + + return; + } + + auto &values = kfvFieldsValues(kco); + + uint32_t numberOfCounters = (uint32_t)values.size(); + + std::vector counterIds; + std::vector counters; + + for (const auto&fv: values) + { + sai_stat_id_t stat; + sai_deserialize_enum(fvField(fv), oi->statenum, (int32_t&)stat); + + counters.push_back(stat); + } + + auto status = m_vendorSai->getStats( + metaKey.objecttype, + metaKey.objectkey.key.object_id, + numberOfCounters, + counterIds.data(), + counters.data()); + + std::vector entry; + + if (status == SAI_STATUS_SUCCESS) + { + for (auto c: counters) + { + entry.emplace_back("", std::to_string(c)); + } + } + + std::string strStatus = sai_serialize_status(status); + + m_selectableChannel->set(strStatus, entry, "get_stats_response"); +} + +void Proxy::processGetStatsExt( + _In_ const swss::KeyOpFieldsValuesTuple &kco) +{ + SWSS_LOG_ENTER(); + + const std::string& key = kfvKey(kco); + + sai_object_meta_key_t metaKey; + sai_deserialize_object_meta_key(key, metaKey); + + if (!sai_metadata_is_object_type_valid(metaKey.objecttype)) + { + SWSS_LOG_THROW("invalid object type %s", key.c_str()); + } + + auto oi = sai_metadata_get_object_type_info(metaKey.objecttype); + + if (oi == NULL) + { + SWSS_LOG_ERROR("invalid object type: %s", sai_serialize_object_type(metaKey.objecttype).c_str()); + + std::string strStatus = sai_serialize_status(SAI_STATUS_FAILURE); + + m_selectableChannel->set(strStatus, {}, "get_stats_ext_response"); + + return; + } + + auto values = kfvFieldsValues(kco); + + sai_stats_mode_t mode = (sai_stats_mode_t)stoull(fvValue(values.back())); + + values.pop_back(); + + uint32_t numberOfCounters = (uint32_t)values.size(); + + std::vector counterIds; + std::vector counters; + + for (const auto&fv: values) + { + sai_stat_id_t stat; + sai_deserialize_enum(fvField(fv), oi->statenum, (int32_t&)stat); + + counters.push_back(stat); + } + + auto status = m_vendorSai->getStatsExt( + metaKey.objecttype, + metaKey.objectkey.key.object_id, + numberOfCounters, + counterIds.data(), + mode, + counters.data()); + + std::vector entry; + + if (status == SAI_STATUS_SUCCESS) + { + for (auto c: counters) + { + entry.emplace_back("", std::to_string(c)); + } + } + + std::string strStatus = sai_serialize_status(status); + + m_selectableChannel->set(strStatus, entry, "get_stats_ext_response"); +} + +void Proxy::processClearStats( + _In_ const swss::KeyOpFieldsValuesTuple &kco) +{ + SWSS_LOG_ENTER(); + + const std::string& key = kfvKey(kco); + + sai_object_meta_key_t metaKey; + sai_deserialize_object_meta_key(key, metaKey); + + if (!sai_metadata_is_object_type_valid(metaKey.objecttype)) + { + SWSS_LOG_THROW("invalid object type %s", key.c_str()); + } + + auto oi = sai_metadata_get_object_type_info(metaKey.objecttype); + + if (oi == NULL) + { + SWSS_LOG_ERROR("invalid object type: %s", sai_serialize_object_type(metaKey.objecttype).c_str()); + + std::string strStatus = sai_serialize_status(SAI_STATUS_FAILURE); + + m_selectableChannel->set(strStatus, {}, "clear_stats_response"); + + return; + } + + auto &values = kfvFieldsValues(kco); + + uint32_t numberOfCounters = (uint32_t)values.size(); + + std::vector counterIds; + std::vector counters; + + for (const auto&fv: values) + { + sai_stat_id_t stat; + sai_deserialize_enum(fvField(fv), oi->statenum, (int32_t&)stat); + + counters.push_back(stat); + } + + auto status = m_vendorSai->clearStats( + metaKey.objecttype, + metaKey.objectkey.key.object_id, + numberOfCounters, + counterIds.data()); + + std::vector entry; + + std::string strStatus = sai_serialize_status(status); + + m_selectableChannel->set(strStatus, entry, "clear_stats_response"); +} diff --git a/proxylib/Proxy.h b/proxylib/Proxy.h new file mode 100644 index 000000000..45f696ebe --- /dev/null +++ b/proxylib/Proxy.h @@ -0,0 +1,126 @@ +#pragma once + +#include "swss/selectableevent.h" + +#include "meta/SaiInterface.h" +#include "meta/SelectableChannel.h" + +#include "syncd/ServiceMethodTable.h" +#include "syncd/NotificationProducerBase.h" + +#include +#include +#include +#include + +namespace saiproxy +{ + class Proxy + { + public: + + Proxy( + _In_ std::shared_ptr vendorSai); + + virtual ~Proxy(); + + public: + + void run(); + + void stop(); + + private: + + const char* profileGetValue( + _In_ sai_switch_profile_id_t profile_id, + _In_ const char* variable); + + int profileGetNextValue( + _In_ sai_switch_profile_id_t profile_id, + _Out_ const char** variable, + _Out_ const char** value); + + void processEvent( + _In_ sairedis::SelectableChannel& consumer); + + void processSingleEvent( + _In_ const swss::KeyOpFieldsValuesTuple &kco); + + private: // api process methods + + // TODO implement bulk apis + + void processCreate( + _In_ const swss::KeyOpFieldsValuesTuple &kco); + + void processRemove( + _In_ const swss::KeyOpFieldsValuesTuple &kco); + + void processSet( + _In_ const swss::KeyOpFieldsValuesTuple &kco); + + void processGet( + _In_ const swss::KeyOpFieldsValuesTuple &kco); + + void processCreateEntry( + _In_ const swss::KeyOpFieldsValuesTuple &kco); + + void processFlushFdbEntries( + _In_ const swss::KeyOpFieldsValuesTuple &kco); + + void processObjectTypeGetAvailability( + _In_ const swss::KeyOpFieldsValuesTuple &kco); + + void processQueryAttributeCapability( + _In_ const swss::KeyOpFieldsValuesTuple &kco); + + void processQueryAttributeEnumValuesCapability( + _In_ const swss::KeyOpFieldsValuesTuple &kco); + + void processObjectTypeQuery( + _In_ const swss::KeyOpFieldsValuesTuple &kco); + + void processSwitchIdQuery( + _In_ const swss::KeyOpFieldsValuesTuple &kco); + + void processQueryApiVersion( + _In_ const swss::KeyOpFieldsValuesTuple &kco); + + void processLogSet( + _In_ const swss::KeyOpFieldsValuesTuple &kco); + + void processGetStats( + _In_ const swss::KeyOpFieldsValuesTuple &kco); + + void processGetStatsExt( + _In_ const swss::KeyOpFieldsValuesTuple &kco); + + void processClearStats( + _In_ const swss::KeyOpFieldsValuesTuple &kco); + private: + + syncd::ServiceMethodTable m_smt; + + sai_service_method_table_t m_test_services; + + std::shared_ptr m_vendorSai; + + swss::SelectableEvent m_stopEvent; + + std::map m_profileMap; + + std::map::iterator m_profileIter; + + std::shared_ptr m_selectableChannel; + + std::shared_ptr m_notifications; + + /** + * @brief Mutex for synchronizing api execution and notifications + */ + std::mutex m_mutex; + + bool m_apiInitialized; + }; +} diff --git a/proxylib/Sai.cpp b/proxylib/Sai.cpp index 834c9be38..e99c6989f 100644 --- a/proxylib/Sai.cpp +++ b/proxylib/Sai.cpp @@ -1,5 +1,8 @@ #include "Sai.h" +#include "Utils.h" #include "SaiInternal.h" +#include "ZeroMQChannel.h" +#include "SaiAttributeList.h" #include "meta/Meta.h" #include "meta/sai_serialize.h" @@ -68,12 +71,12 @@ sai_status_t Sai::apiInitialize( memcpy(&m_service_method_table, service_method_table, sizeof(m_service_method_table)); - // TODO move to service method table and - // TODO enable for channel to work! -// m_communicationChannel = std::make_shared<_ZeroMQChannel>( -// "/tmp/saiproxy", -// "/tmp/saiproxy_ntf", -// std::bind(&Sai::handleNotification, this, _1, _2, _3)); + // TODO move hard coded values to config + + m_communicationChannel = std::make_shared( + "tcp://127.0.0.1:5555", + "tcp://127.0.0.1:5556", + std::bind(&Sai::handleNotification, this, _1, _2, _3)); m_apiInitialized = true; @@ -107,9 +110,39 @@ sai_status_t Sai::create( SWSS_LOG_ENTER(); PROXY_CHECK_API_INITIALIZED(); - SWSS_LOG_ERROR("not implemented, FIXME"); + auto entry = saimeta::SaiAttributeList::serialize_attr_list(objectType, attr_count, attr_list, false); - return SAI_STATUS_NOT_IMPLEMENTED; + entry.emplace_back("SWITCH_ID", sai_serialize_object_id(switchId)); // last entry is switch_id + + auto serializedObjectType = sai_serialize_object_type(objectType); + + auto serializedObjectId = sai_serialize_object_id(SAI_NULL_OBJECT_ID); + + std::string key = serializedObjectType + ":" + serializedObjectId; + + m_communicationChannel->set(key, entry, "create"); + + swss::KeyOpFieldsValuesTuple kco; + + auto status = m_communicationChannel->wait("create_response", kco); + + // TODO SAVE pointers for notifications + + if (status == SAI_STATUS_SUCCESS) + { + auto& values = kfvFieldsValues(kco); + + if (values.size() == 0) + { + SWSS_LOG_THROW("logic error, api returned 0 values!"); + } + + SWSS_LOG_NOTICE("deserialize new object id: %s", fvValue(values[0]).c_str()); + + sai_deserialize_object_id(fvValue(values[0]), *objectId); + } + + return status; } sai_status_t Sai::remove( @@ -120,9 +153,7 @@ sai_status_t Sai::remove( SWSS_LOG_ENTER(); PROXY_CHECK_API_INITIALIZED(); - SWSS_LOG_ERROR("not implemented, FIXME"); - - return SAI_STATUS_NOT_IMPLEMENTED; + return remove(objectType, sai_serialize_object_id(objectId)); } sai_status_t Sai::set( @@ -134,9 +165,7 @@ sai_status_t Sai::set( SWSS_LOG_ENTER(); PROXY_CHECK_API_INITIALIZED(); - SWSS_LOG_ERROR("not implemented, FIXME"); - - return SAI_STATUS_NOT_IMPLEMENTED; + return set(objectType, sai_serialize_object_id(objectId), attr); } sai_status_t Sai::get( @@ -149,9 +178,7 @@ sai_status_t Sai::get( SWSS_LOG_ENTER(); PROXY_CHECK_API_INITIALIZED(); - SWSS_LOG_ERROR("not implemented, FIXME"); - - return SAI_STATUS_NOT_IMPLEMENTED; + return get(objectType, sai_serialize_object_id(objectId), attr_count, attr_list); } // QUAD ENTRY @@ -166,8 +193,11 @@ sai_status_t Sai::create( \ SWSS_LOG_ENTER(); \ PROXY_CHECK_API_INITIALIZED(); \ PROXY_CHECK_POINTER(entry) \ - SWSS_LOG_ERROR("not implemented, FIXME"); \ - return SAI_STATUS_NOT_IMPLEMENTED; \ + return create( \ + (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ + sai_serialize_ ## ot(*entry), \ + attr_count, \ + attr_list); \ } SAIREDIS_DECLARE_EVERY_ENTRY(DECLARE_CREATE_ENTRY); @@ -180,8 +210,9 @@ sai_status_t Sai::remove( \ SWSS_LOG_ENTER(); \ PROXY_CHECK_API_INITIALIZED(); \ PROXY_CHECK_POINTER(entry) \ - SWSS_LOG_ERROR("not implemented, FIXME"); \ - return SAI_STATUS_NOT_IMPLEMENTED; \ + return remove( \ + (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ + sai_serialize_ ## ot(*entry)); \ } SAIREDIS_DECLARE_EVERY_ENTRY(DECLARE_REMOVE_ENTRY); @@ -195,8 +226,10 @@ sai_status_t Sai::set( \ SWSS_LOG_ENTER(); \ PROXY_CHECK_API_INITIALIZED(); \ PROXY_CHECK_POINTER(entry) \ - SWSS_LOG_ERROR("not implemented, FIXME"); \ - return SAI_STATUS_NOT_IMPLEMENTED; \ + return set( \ + (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ + sai_serialize_ ## ot(*entry), \ + attr); \ } SAIREDIS_DECLARE_EVERY_ENTRY(DECLARE_SET_ENTRY); @@ -211,12 +244,133 @@ sai_status_t Sai::get( \ SWSS_LOG_ENTER(); \ PROXY_CHECK_API_INITIALIZED(); \ PROXY_CHECK_POINTER(entry) \ - SWSS_LOG_ERROR("not implemented, FIXME"); \ - return SAI_STATUS_NOT_IMPLEMENTED; \ + return get( \ + (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ + sai_serialize_ ## ot(*entry), \ + attr_count, \ + attr_list); \ } SAIREDIS_DECLARE_EVERY_ENTRY(DECLARE_GET_ENTRY); +sai_status_t Sai::create( + _In_ sai_object_type_t objectType, + _In_ const std::string& entry, + _In_ uint32_t attr_count, + _In_ const sai_attribute_t *attr_list) +{ + SWSS_LOG_ENTER(); + + auto vals = saimeta::SaiAttributeList::serialize_attr_list(objectType, attr_count, attr_list, false); + + auto serializedObjectType = sai_serialize_object_type(objectType); + + std::string key = serializedObjectType + ":" + entry; + + // TODO SAVE pointers for notifications + + m_communicationChannel->set(key, vals, "create_entry"); + + swss::KeyOpFieldsValuesTuple kco; + + return m_communicationChannel->wait("create_entry_response", kco); +} + +sai_status_t Sai::remove( + _In_ sai_object_type_t objectType, + _In_ const std::string& entry) +{ + SWSS_LOG_ENTER(); + + auto serializedObjectType = sai_serialize_object_type(objectType); + + std::string key = serializedObjectType + ":" + entry; + + m_communicationChannel->set(key, {}, "remove"); + + swss::KeyOpFieldsValuesTuple kco; + + return m_communicationChannel->wait("remove_response", kco); +} + +sai_status_t Sai::set( + _In_ sai_object_type_t objectType, + _In_ const std::string& entry, + _In_ const sai_attribute_t *attr) +{ + SWSS_LOG_ENTER(); + + auto val = saimeta::SaiAttributeList::serialize_attr_list(objectType, 1, attr, false); + + // TODO SAVE pointers for notifications + + auto serializedObjectType = sai_serialize_object_type(objectType); + + std::string key = serializedObjectType + ":" + entry; + + m_communicationChannel->set(key, val, "set"); + + swss::KeyOpFieldsValuesTuple kco; + + return m_communicationChannel->wait("set_response", kco); +} + +sai_status_t Sai::get( + _In_ sai_object_type_t objectType, + _In_ const std::string& entry, + _In_ uint32_t attr_count, + _Inout_ sai_attribute_t *attr_list) +{ + SWSS_LOG_ENTER(); + + /* + * Since user may reuse buffers, then oid list buffers maybe not cleared + * and contain some garbage, let's clean them so we send all oids as null to + * syncd. + */ + + sairedis::Utils::clearOidValues(objectType, attr_count, attr_list); + + auto vals = saimeta::SaiAttributeList::serialize_attr_list(objectType, attr_count, attr_list, false); + + std::string serializedObjectType = sai_serialize_object_type(objectType); + + std::string key = serializedObjectType + ":" + entry; + + m_communicationChannel->set(key, vals, "get"); + + swss::KeyOpFieldsValuesTuple kco; + + auto status = m_communicationChannel->wait("get_response", kco); + + auto &values = kfvFieldsValues(kco); + + if (status == SAI_STATUS_SUCCESS) + { + if (values.size() == 0) + { + SWSS_LOG_THROW("logic error, api returned 0 values!"); + } + + saimeta::SaiAttributeList list(objectType, values, false); + + transfer_attributes(objectType, attr_count, list.get_attr_list(), attr_list, false); + } + else if (status == SAI_STATUS_BUFFER_OVERFLOW) + { + if (values.size() == 0) + { + SWSS_LOG_THROW("logic error, api returned 0 values!"); + } + + saimeta::SaiAttributeList list(objectType, values, true); + + transfer_attributes(objectType, attr_count, list.get_attr_list(), attr_list, true); + } + + return status; +} + // STATS sai_status_t Sai::getStats( @@ -230,21 +384,49 @@ sai_status_t Sai::getStats( SWSS_LOG_ENTER(); PROXY_CHECK_API_INITIALIZED(); - SWSS_LOG_ERROR("not implemented, FIXME"); + auto oi = sai_metadata_get_object_type_info(object_type); - return SAI_STATUS_NOT_IMPLEMENTED; -} + if (oi == NULL) + { + SWSS_LOG_ERROR("invalid object type: %s", sai_serialize_object_type(object_type).c_str()); -sai_status_t Sai::queryStatsCapability( - _In_ sai_object_id_t switchId, - _In_ sai_object_type_t objectType, - _Inout_ sai_stat_capability_list_t *stats_capability) -{ - SWSS_LOG_ENTER(); + return SAI_STATUS_INVALID_PARAMETER; + } - SWSS_LOG_ERROR("not implemented, FIXME"); + auto strObjectType = sai_serialize_object_type(object_type); + auto strObjectId = sai_serialize_object_id(object_id); - return SAI_STATUS_NOT_IMPLEMENTED; + std::string key = strObjectType + ":" + strObjectId; + + std::vector entry; + + for (uint32_t i = 0; i < number_of_counters; i++) + { + entry.emplace_back(sai_serialize_enum(counter_ids[i], oi->statenum), ""); + } + + m_communicationChannel->set(key, entry, "get_stats"); + + swss::KeyOpFieldsValuesTuple kco; + + auto status = m_communicationChannel->wait("get_stats_response", kco); + + if (status == SAI_STATUS_SUCCESS) + { + auto &values = kfvFieldsValues(kco); + + if (values.size () != number_of_counters) + { + SWSS_LOG_THROW("logic error, wrong number of counters, got %zu, expected %u", values.size(), number_of_counters); + } + + for (uint32_t idx = 0; idx < number_of_counters; idx++) + { + counters[idx] = stoull(fvValue(values[idx])); + } + } + + return status; } sai_status_t Sai::getStatsExt( @@ -259,9 +441,51 @@ sai_status_t Sai::getStatsExt( SWSS_LOG_ENTER(); PROXY_CHECK_API_INITIALIZED(); - SWSS_LOG_ERROR("not implemented, FIXME"); + auto oi = sai_metadata_get_object_type_info(object_type); - return SAI_STATUS_NOT_IMPLEMENTED; + if (oi == NULL) + { + SWSS_LOG_ERROR("invalid object type: %s", sai_serialize_object_type(object_type).c_str()); + + return SAI_STATUS_INVALID_PARAMETER; + } + + auto strObjectType = sai_serialize_object_type(object_type); + auto strObjectId = sai_serialize_object_id(object_id); + + std::string key = strObjectType + ":" + strObjectId; + + std::vector entry; + + for (uint32_t i = 0; i < number_of_counters; i++) + { + entry.emplace_back(sai_serialize_enum(counter_ids[i], oi->statenum), ""); + } + + entry.emplace_back("STATS_MODE", std::to_string(mode)); // TODO add serialize + + m_communicationChannel->set(key, entry, "get_stats_ext"); + + swss::KeyOpFieldsValuesTuple kco; + + auto status = m_communicationChannel->wait("get_stats_ext_response", kco); + + if (status == SAI_STATUS_SUCCESS) + { + auto &values = kfvFieldsValues(kco); + + if (values.size () != number_of_counters) + { + SWSS_LOG_THROW("logic error, wrong number of counters, got %zu, expected %u", values.size(), number_of_counters); + } + + for (uint32_t idx = 0; idx < number_of_counters; idx++) + { + counters[idx] = stoull(fvValue(values[idx])); + } + } + + return status; } sai_status_t Sai::clearStats( @@ -274,11 +498,48 @@ sai_status_t Sai::clearStats( SWSS_LOG_ENTER(); PROXY_CHECK_API_INITIALIZED(); + auto oi = sai_metadata_get_object_type_info(object_type); + + if (oi == NULL) + { + SWSS_LOG_ERROR("invalid object type: %s", sai_serialize_object_type(object_type).c_str()); + + return SAI_STATUS_INVALID_PARAMETER; + } + + auto strObjectType = sai_serialize_object_type(object_type); + auto strObjectId = sai_serialize_object_id(object_id); + + std::string key = strObjectType + ":" + strObjectId; + + std::vector entry; + + for (uint32_t i = 0; i < number_of_counters; i++) + { + entry.emplace_back(sai_serialize_enum(counter_ids[i], oi->statenum), ""); + } + + m_communicationChannel->set(key, entry, "clear_stats"); + + swss::KeyOpFieldsValuesTuple kco; + + return m_communicationChannel->wait("clear_stats_response", kco); +} + +sai_status_t Sai::queryStatsCapability( + _In_ sai_object_id_t switchId, + _In_ sai_object_type_t objectType, + _Inout_ sai_stat_capability_list_t *stats_capability) +{ + SWSS_LOG_ENTER(); + SWSS_LOG_ERROR("not implemented, FIXME"); return SAI_STATUS_NOT_IMPLEMENTED; } +// BULK STATS + sai_status_t Sai::bulkGetStats( _In_ sai_object_id_t switchId, _In_ sai_object_type_t object_type, @@ -480,9 +741,24 @@ sai_status_t Sai::flushFdbEntries( SWSS_LOG_ENTER(); PROXY_CHECK_API_INITIALIZED(); - SWSS_LOG_ERROR("not implemented, FIXME"); + auto entry = saimeta::SaiAttributeList::serialize_attr_list( + SAI_OBJECT_TYPE_FDB_FLUSH, + attr_count, + attr_list, + false); - return SAI_STATUS_NOT_IMPLEMENTED; + std::string serializedObjectId = sai_serialize_object_type(SAI_OBJECT_TYPE_FDB_FLUSH); + + // NOTE ! we actually give switch ID since FLUSH is not real object + std::string key = serializedObjectId + ":" + sai_serialize_object_id(switch_id); + + SWSS_LOG_NOTICE("flush key: %s, fields: %lu", key.c_str(), entry.size()); + + m_communicationChannel->set(key, entry, "flush_fdb_entries"); + + swss::KeyOpFieldsValuesTuple kco; + + return m_communicationChannel->wait("flush_fdb_entries_response", kco); } // SAI API @@ -498,39 +774,190 @@ sai_status_t Sai::objectTypeGetAvailability( SWSS_LOG_ENTER(); PROXY_CHECK_API_INITIALIZED(); - SWSS_LOG_ERROR("not implemented, FIXME"); + auto strSwitchId = sai_serialize_object_id(switchId); - return SAI_STATUS_NOT_IMPLEMENTED; + auto entry = saimeta::SaiAttributeList::serialize_attr_list(objectType, attrCount, attrList, false); + + entry.emplace_back("OBJECT_TYPE", sai_serialize_object_type(objectType)); + + m_communicationChannel->set(strSwitchId, entry, "object_type_get_availability"); + + swss::KeyOpFieldsValuesTuple kco; + + auto status = m_communicationChannel->wait("object_type_get_availability_response", kco); + + if (status == SAI_STATUS_SUCCESS) + { + auto& values = kfvFieldsValues(kco); + + if (values.size() == 0) + { + SWSS_LOG_THROW("logic error, api returned 0 values!"); + } + + *count = std::stoull(fvValue(values[0])); + } + + return status; } sai_status_t Sai::queryAttributeCapability( - _In_ sai_object_id_t switch_id, - _In_ sai_object_type_t object_type, - _In_ sai_attr_id_t attr_id, + _In_ sai_object_id_t switchId, + _In_ sai_object_type_t objectType, + _In_ sai_attr_id_t attrId, _Out_ sai_attr_capability_t *capability) { MUTEX(); SWSS_LOG_ENTER(); PROXY_CHECK_API_INITIALIZED(); - SWSS_LOG_ERROR("not implemented, FIXME"); + auto strSwitchId = sai_serialize_object_id(switchId); + auto strObjectType = sai_serialize_object_type(objectType); - return SAI_STATUS_NOT_IMPLEMENTED; + auto meta = sai_metadata_get_attr_metadata(objectType, attrId); + + if (meta == NULL) + { + SWSS_LOG_ERROR("Failed to find attribute metadata: object type %s, attr id %d", strObjectType.c_str(), attrId); + + return SAI_STATUS_INVALID_PARAMETER; + } + + const std::string attrIdStr = meta->attridname; + + const std::vector entry = + { + swss::FieldValueTuple("OBJECT_TYPE", strObjectType), + swss::FieldValueTuple("ATTR_ID", attrIdStr) + }; + + m_communicationChannel->set(strSwitchId, entry, "query_attribute_capability"); + + swss::KeyOpFieldsValuesTuple kco; + + auto status = m_communicationChannel->wait("query_attribute_capability_response", kco); + + if (status == SAI_STATUS_SUCCESS) + { + auto &values = kfvFieldsValues(kco); + + if (values.size() != 3) + { + SWSS_LOG_ERROR("logic error, api returned invalin numer in response: expected 3 values, received %zu", values.size()); + + return SAI_STATUS_FAILURE; + } + + capability->create_implemented = (fvValue(values[0]) == "true" ? true : false); + capability->set_implemented = (fvValue(values[1]) == "true" ? true : false); + capability->get_implemented = (fvValue(values[2]) == "true" ? true : false); + } + + return status; } sai_status_t Sai::queryAttributeEnumValuesCapability( - _In_ sai_object_id_t switch_id, - _In_ sai_object_type_t object_type, - _In_ sai_attr_id_t attr_id, - _Inout_ sai_s32_list_t *enum_values_capability) + _In_ sai_object_id_t switchId, + _In_ sai_object_type_t objectType, + _In_ sai_attr_id_t attrId, + _Inout_ sai_s32_list_t *enumValuesCapability) { MUTEX(); SWSS_LOG_ENTER(); PROXY_CHECK_API_INITIALIZED(); - SWSS_LOG_ERROR("not implemented, FIXME"); + if (enumValuesCapability && enumValuesCapability->list) + { + // clear input list, since we use serialize to transfer values + for (uint32_t idx = 0; idx < enumValuesCapability->count; idx++) + { + enumValuesCapability->list[idx] = 0; + } + } - return SAI_STATUS_NOT_IMPLEMENTED; + auto strSwitchId = sai_serialize_object_id(switchId); + auto strObjectType = sai_serialize_object_type(objectType); + + auto meta = sai_metadata_get_attr_metadata(objectType, attrId); + + if (meta == NULL) + { + SWSS_LOG_ERROR("Failed to find attribute metadata: object type %s, attr id %d", strObjectType.c_str(), attrId); + + return SAI_STATUS_INVALID_PARAMETER; + } + + const std::string strAttrId = meta->attridname; + const std::string listSize = std::to_string(enumValuesCapability->count); + + const std::vector entry = + { + swss::FieldValueTuple("OBJECT_TYPE", strObjectType), + swss::FieldValueTuple("ATTR_ID", strAttrId), + swss::FieldValueTuple("LIST_SIZE", listSize) + }; + + m_communicationChannel->set(strSwitchId, entry, "query_attribute_enum_values_capability"); + + swss::KeyOpFieldsValuesTuple kco; + + auto status = m_communicationChannel->wait("query_attribute_enum_values_capability_response", kco); + + if (status == SAI_STATUS_SUCCESS) + { + const std::vector &values = kfvFieldsValues(kco); + + if (values.size() != 2) + { + SWSS_LOG_ERROR("logic error, expected 2 values, received %zu", values.size()); + + return SAI_STATUS_FAILURE; + } + + const std::string &capability_str = fvValue(values[0]); + const uint32_t num_capabilities = std::stoi(fvValue(values[1])); + + enumValuesCapability->count = num_capabilities; + + size_t position = 0; + + for (uint32_t i = 0; i < num_capabilities; i++) + { + size_t old_position = position; + position = capability_str.find(",", old_position); + std::string capability = capability_str.substr(old_position, position - old_position); + enumValuesCapability->list[i] = std::stoi(capability); + + // We have run out of values to add to our list + if (position == std::string::npos) + { + if (num_capabilities != i + 1) + { + SWSS_LOG_WARN("Query returned less attributes than expected: expected %d, received %d", num_capabilities, i+1); + } + + break; + } + + // Skip the commas + position++; + } + } + else if (status == SAI_STATUS_BUFFER_OVERFLOW) + { + const auto &values = kfvFieldsValues(kco); + + if (values.size() != 1) + { + SWSS_LOG_ERROR("logic error, expected 1 value, received %zu", values.size()); + + return SAI_STATUS_FAILURE; + } + + enumValuesCapability->count = std::stoi(fvValue(values[0])); + } + + return status; } sai_object_type_t Sai::objectTypeQuery( @@ -541,20 +968,37 @@ sai_object_type_t Sai::objectTypeQuery( if (!m_apiInitialized) { - SWSS_LOG_ERROR("%s: SAI API not initialized", __PRETTY_FUNCTION__); + SWSS_LOG_ERROR("%s: api not initialized", __PRETTY_FUNCTION__); return SAI_OBJECT_TYPE_NULL; } - //json j; + auto key = sai_serialize_object_id(objectId); - //j["switch_id"] = sai_serialize_object_id(switch_id); + m_communicationChannel->set(key, {}, "object_type_query"); - //return j.dump(); + swss::KeyOpFieldsValuesTuple kco; - // TODO implement ! + auto status = m_communicationChannel->wait("object_type_query_response", kco); - SWSS_LOG_ERROR("not implemented, FIXME"); + if (status == SAI_STATUS_SUCCESS) + { + auto& values = kfvFieldsValues(kco); + + if (values.size() == 0) + { + SWSS_LOG_THROW("logic error, api returned 0 values!"); + } + + sai_object_type_t objectType; + sai_deserialize_object_type(fvValue(values[0]), objectType); + + return objectType; + } + else + { + SWSS_LOG_ERROR("switchIdQuery failed: %s", sai_serialize_status(status).c_str()); + } return SAI_OBJECT_TYPE_NULL; } @@ -567,14 +1011,37 @@ sai_object_id_t Sai::switchIdQuery( if (!m_apiInitialized) { - SWSS_LOG_ERROR("%s: SAI API not initialized", __PRETTY_FUNCTION__); + SWSS_LOG_ERROR("%s: api not initialized", __PRETTY_FUNCTION__); return SAI_NULL_OBJECT_ID; } - // TODO implement ! + auto key = sai_serialize_object_id(objectId); - SWSS_LOG_ERROR("not implemented, FIXME"); + m_communicationChannel->set(key, {}, "switch_id_query"); + + swss::KeyOpFieldsValuesTuple kco; + + auto status = m_communicationChannel->wait("switch_id_query_response", kco); + + if (status == SAI_STATUS_SUCCESS) + { + auto& values = kfvFieldsValues(kco); + + if (values.size() == 0) + { + SWSS_LOG_THROW("logic error, api returned 0 values!"); + } + + sai_object_id_t switchId; + sai_deserialize_object_id(fvValue(values[0]), switchId); + + return switchId; + } + else + { + SWSS_LOG_ERROR("switchIdQuery failed: %s", sai_serialize_status(status).c_str()); + } return SAI_NULL_OBJECT_ID; } @@ -587,34 +1054,62 @@ sai_status_t Sai::logSet( SWSS_LOG_ENTER(); PROXY_CHECK_API_INITIALIZED(); - SWSS_LOG_WARN("log set not implemented for %s:%s", - sai_serialize_api(api).c_str(), - sai_serialize_log_level(log_level).c_str()); + auto key = sai_serialize_api(api) + ":" + sai_serialize_log_level(log_level); - return SAI_STATUS_SUCCESS; + m_communicationChannel->set(key, {}, "log_set"); + + swss::KeyOpFieldsValuesTuple kco; + + return m_communicationChannel->wait("log_set_response", kco); } sai_status_t Sai::queryApiVersion( _Out_ sai_api_version_t *version) { + MUTEX(); SWSS_LOG_ENTER(); + PROXY_CHECK_API_INITIALIZED(); + + SWSS_LOG_NOTICE("compiled proxy headers SAI API version: %d", SAI_API_VERSION); + + if (version == NULL) + { + SWSS_LOG_ERROR("version parameter is NULL"); - // TODO this should be forwarded to SaiInterface object + return SAI_STATUS_INVALID_PARAMETER; + } + + m_communicationChannel->set("api", {}, "query_api_version"); + + swss::KeyOpFieldsValuesTuple kco; + + auto status = m_communicationChannel->wait("query_api_version_response", kco); - if (version) + if (status == SAI_STATUS_SUCCESS) { - *version = SAI_API_VERSION; + auto& values = kfvFieldsValues(kco); - // TODO FIXME implement proper query for syncd, currently this is not an issue since swss is not using this API + if (values.size() == 0) + { + SWSS_LOG_THROW("logic error, api returned 0 values!"); + } - SWSS_LOG_WARN("retruning SAI API version %d with saiproxy compiled SAI headers, not actual libsai.so", SAI_API_VERSION); + SWSS_LOG_NOTICE("returned sai api version: %s", fvValue(values[0]).c_str()); - return SAI_STATUS_SUCCESS; + *version = std::stoull(fvValue(values[0])); } - SWSS_LOG_ERROR("version parameter is NULL"); + return status; +} + +void Sai::handleNotification( + _In_ const std::string &name, + _In_ const std::string &serializedNotification, + _In_ const std::vector &values) +{ + SWSS_LOG_ENTER(); - return SAI_STATUS_INVALID_PARAMETER; + SWSS_LOG_ERROR("FIXME"); } //sai_switch_notifications_t Sai::handle_notification( diff --git a/proxylib/Sai.h b/proxylib/Sai.h index f7dfe28a0..889eb7b63 100644 --- a/proxylib/Sai.h +++ b/proxylib/Sai.h @@ -1,5 +1,7 @@ #pragma once +#include + #include "lib/Channel.h" #include "meta/Meta.h" #include "meta/Notification.h" @@ -105,11 +107,6 @@ namespace saiproxy _In_ const sai_stat_id_t *counter_ids, _Out_ uint64_t *counters) override; - virtual sai_status_t queryStatsCapability( - _In_ sai_object_id_t switch_id, - _In_ sai_object_type_t object_type, - _Inout_ sai_stat_capability_list_t *stats_capability) override; - virtual sai_status_t getStatsExt( _In_ sai_object_type_t object_type, _In_ sai_object_id_t object_id, @@ -124,6 +121,11 @@ namespace saiproxy _In_ uint32_t number_of_counters, _In_ const sai_stat_id_t *counter_ids) override; + virtual sai_status_t queryStatsCapability( + _In_ sai_object_id_t switch_id, + _In_ sai_object_type_t object_type, + _Inout_ sai_stat_capability_list_t *stats_capability) override; + virtual sai_status_t bulkGetStats( _In_ sai_object_id_t switchId, _In_ sai_object_type_t object_type, @@ -186,11 +188,39 @@ namespace saiproxy virtual sai_status_t queryApiVersion( _Out_ sai_api_version_t *version) override; + private: // QUAD helpers for entry + + virtual sai_status_t create( + _In_ sai_object_type_t objectType, + _In_ const std::string& entry, + _In_ uint32_t attr_count, + _In_ const sai_attribute_t *attr_list); + + virtual sai_status_t remove( + _In_ sai_object_type_t objectType, + _In_ const std::string& entry); + + virtual sai_status_t set( + _In_ sai_object_type_t objectType, + _In_ const std::string& entry, + _In_ const sai_attribute_t *attr); + + virtual sai_status_t get( + _In_ sai_object_type_t objectType, + _In_ const std::string& entry, + _In_ uint32_t attr_count, + _Inout_ sai_attribute_t *attr_list); + private: sai_switch_notifications_t handle_notification( _In_ std::shared_ptr notification); + void handleNotification( + _In_ const std::string &name, + _In_ const std::string &serializedNotification, + _In_ const std::vector &values); + private: bool m_apiInitialized; diff --git a/unittest/meta/TestDummySaiInterface.cpp b/unittest/meta/TestDummySaiInterface.cpp index afe1b29c7..c85294d57 100644 --- a/unittest/meta/TestDummySaiInterface.cpp +++ b/unittest/meta/TestDummySaiInterface.cpp @@ -39,3 +39,15 @@ TEST(DummySaiInterface, bulkGet) SAI_BULK_OP_ERROR_MODE_STOP_ON_ERROR, statuses)); } + +TEST(DummySaiInterface, create) +{ + DummySaiInterface sai; + + sai.apiInitialize(0,0); + + sai_object_id_t oid; + sai.create(SAI_OBJECT_TYPE_SWITCH,&oid, 0, 0, 0); + + EXPECT_NE(oid, SAI_NULL_OBJECT_ID); +} diff --git a/unittest/proxylib/Makefile.am b/unittest/proxylib/Makefile.am index 69206d342..b1b8b73a7 100644 --- a/unittest/proxylib/Makefile.am +++ b/unittest/proxylib/Makefile.am @@ -5,10 +5,16 @@ bin_PROGRAMS = tests LDADD_GTEST = -L/usr/src/gtest -lgtest -lgtest_main tests_SOURCES = \ + ../../meta/DummySaiInterface.cpp \ main.cpp \ TestSai.cpp tests_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) -tests_LDADD = $(LDADD_GTEST) $(top_srcdir)/proxylib/libSaiProxy.a -lhiredis -lswsscommon -lpthread -L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta -lzmq $(CODE_COVERAGE_LIBS) +tests_LDADD = $(LDADD_GTEST) $(top_srcdir)/proxylib/libSaiProxy.a \ + $(top_srcdir)/lib/libSaiRedis.a \ + $(top_srcdir)/syncd/libSyncd.a \ + -lhiredis -lswsscommon -lpthread \ + -L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta \ + -lzmq $(CODE_COVERAGE_LIBS) TESTS = tests diff --git a/unittest/proxylib/TestSai.cpp b/unittest/proxylib/TestSai.cpp index 47ef03767..933cf2402 100644 --- a/unittest/proxylib/TestSai.cpp +++ b/unittest/proxylib/TestSai.cpp @@ -6,7 +6,12 @@ #include +#include "meta/DummySaiInterface.h" + #include "Sai.h" +#include "Proxy.h" + +// TODO fix join when tests will fail using namespace saiproxy; @@ -44,19 +49,36 @@ class SaiTest : public ::testing::Test const std::uint32_t m_scid = 0; // default switch config id }; -TEST_F(SaiTest, Ctr) +static const char* profile_get_value( + _In_ sai_switch_profile_id_t profile_id, + _In_ const char* variable) { - auto s = std::make_shared(); + SWSS_LOG_ENTER(); + + if (variable == NULL) + return NULL; + + return nullptr; } -TEST(Sai, queryApiVersion) +static int profile_get_next_value( + _In_ sai_switch_profile_id_t profile_id, + _Out_ const char** variable, + _Out_ const char** value) { - Sai sai; + SWSS_LOG_ENTER(); - sai_api_version_t version; + return 0; +} - EXPECT_EQ(sai.queryApiVersion(NULL), SAI_STATUS_INVALID_PARAMETER); - EXPECT_EQ(sai.queryApiVersion(&version), SAI_STATUS_SUCCESS); +static sai_service_method_table_t test_services = { + profile_get_value, + profile_get_next_value +}; + +TEST_F(SaiTest, Ctr) +{ + auto s = std::make_shared(); } TEST(Sai, bulkGet) @@ -79,3 +101,502 @@ TEST(Sai, bulkGet) SAI_BULK_OP_ERROR_MODE_STOP_ON_ERROR, statuses)); } + +TEST(Sai, apiInitialize) +{ + Sai sai; + + // non zero flags + EXPECT_EQ(sai.apiInitialize(1, &test_services), SAI_STATUS_INVALID_PARAMETER); + + // table null + EXPECT_EQ(sai.apiInitialize(0, NULL), SAI_STATUS_INVALID_PARAMETER); + + // correct one + EXPECT_EQ(sai.apiInitialize(0, &test_services), SAI_STATUS_SUCCESS); + + // second initialize + EXPECT_EQ(sai.apiInitialize(0, &test_services), SAI_STATUS_FAILURE); +} + +TEST(Sai, apiUninitialize) +{ + Sai sai; + + EXPECT_EQ(sai.apiInitialize(0, &test_services), SAI_STATUS_SUCCESS); + + EXPECT_EQ(sai.apiUninitialize(), SAI_STATUS_SUCCESS); +} + +static void fun(std::shared_ptr proxy) +{ + SWSS_LOG_ENTER(); + + proxy->run(); +} + +TEST(Sai, create) +{ + Sai sai; + + EXPECT_EQ(sai.apiInitialize(0, &test_services), SAI_STATUS_SUCCESS); + + std::shared_ptr dummy = std::make_shared(); + + auto proxy = std::make_shared(dummy); + + auto thread = std::make_shared(fun,proxy); + + sai_object_id_t switch_id = SAI_NULL_OBJECT_ID; + + sai_attribute_t attr; + + attr.id = SAI_SWITCH_ATTR_INIT_SWITCH; + attr.value.booldata = true; + + // create oid + auto status = sai.create( + SAI_OBJECT_TYPE_SWITCH, + &switch_id, + SAI_NULL_OBJECT_ID, // creating switch + 1, + &attr); + + EXPECT_EQ(status, SAI_STATUS_SUCCESS); + EXPECT_NE(switch_id, SAI_NULL_OBJECT_ID); + + sai_fdb_entry_t fdb = {}; + + attr.id = SAI_FDB_ENTRY_ATTR_META_DATA; + attr.value.u32 = 0; + + // create entry + status = sai.create(&fdb, 1, &attr); + + EXPECT_EQ(status, SAI_STATUS_SUCCESS); + + proxy->stop(); + + thread->join(); +} + +TEST(Sai, remove) +{ + Sai sai; + + EXPECT_EQ(sai.apiInitialize(0, &test_services), SAI_STATUS_SUCCESS); + + std::shared_ptr dummy = std::make_shared(); + + auto proxy = std::make_shared(dummy); + + auto thread = std::make_shared(fun,proxy); + + // remove oid + auto status = sai.remove( + SAI_OBJECT_TYPE_SWITCH, + (sai_object_id_t)1); + + EXPECT_EQ(status, SAI_STATUS_SUCCESS); + + sai_fdb_entry_t fdb = {}; + + // remove entry + status = sai.remove(&fdb); + + EXPECT_EQ(status, SAI_STATUS_SUCCESS); + + proxy->stop(); + + thread->join(); +} + +TEST(Sai, set) +{ + Sai sai; + + EXPECT_EQ(sai.apiInitialize(0, &test_services), SAI_STATUS_SUCCESS); + + std::shared_ptr dummy = std::make_shared(); + + auto proxy = std::make_shared(dummy); + + auto thread = std::make_shared(fun,proxy); + + sai_attribute_t attr; + + attr.id = SAI_SWITCH_ATTR_INIT_SWITCH; + attr.value.booldata = true; + + // set oid + auto status = sai.set( + SAI_OBJECT_TYPE_SWITCH, + (sai_object_id_t)1, + &attr); + + EXPECT_EQ(status, SAI_STATUS_SUCCESS); + + sai_fdb_entry_t fdb = {}; + + attr.id = SAI_FDB_ENTRY_ATTR_META_DATA; + attr.value.u32 = 0; + + // set entry + status = sai.set(&fdb, &attr); + + EXPECT_EQ(status, SAI_STATUS_SUCCESS); + + proxy->stop(); + + thread->join(); +} + +TEST(Sai, get) +{ + Sai sai; + + EXPECT_EQ(sai.apiInitialize(0, &test_services), SAI_STATUS_SUCCESS); + + std::shared_ptr dummy = std::make_shared(); + + auto proxy = std::make_shared(dummy); + + auto thread = std::make_shared(fun,proxy); + + sai_attribute_t attr; + + attr.id = SAI_SWITCH_ATTR_INIT_SWITCH; + + // get oid + auto status = sai.get( + SAI_OBJECT_TYPE_SWITCH, + (sai_object_id_t)1, + 1, + &attr); + + EXPECT_EQ(status, SAI_STATUS_SUCCESS); + + sai_fdb_entry_t fdb = {}; + + attr.id = SAI_FDB_ENTRY_ATTR_META_DATA; + + // get entry + status = sai.get(&fdb, 1, &attr); + + EXPECT_EQ(status, SAI_STATUS_SUCCESS); + + proxy->stop(); + + thread->join(); +} + +TEST(Sai, flushFdbEntries) +{ + Sai sai; + + EXPECT_EQ(sai.apiInitialize(0, &test_services), SAI_STATUS_SUCCESS); + + std::shared_ptr dummy = std::make_shared(); + + auto proxy = std::make_shared(dummy); + + auto thread = std::make_shared(fun,proxy); + + auto status = sai.flushFdbEntries((sai_object_id_t)1, 0, 0); + + EXPECT_EQ(status, SAI_STATUS_SUCCESS); + + proxy->stop(); + + thread->join(); +} + + +TEST(Sai, processObjectTypeGetAvailability) +{ + Sai sai; + + EXPECT_EQ(sai.apiInitialize(0, &test_services), SAI_STATUS_SUCCESS); + + std::shared_ptr dummy = std::make_shared(); + + auto proxy = std::make_shared(dummy); + + auto thread = std::make_shared(fun,proxy); + + uint64_t count; + + auto status = sai.objectTypeGetAvailability( + (sai_object_id_t)1, + SAI_OBJECT_TYPE_SWITCH, + 0, + 0, + &count); + + + EXPECT_EQ(status, SAI_STATUS_SUCCESS); + + proxy->stop(); + + thread->join(); +} + +TEST(Sai, processQueryAttributeCapability) +{ + Sai sai; + + EXPECT_EQ(sai.apiInitialize(0, &test_services), SAI_STATUS_SUCCESS); + + std::shared_ptr dummy = std::make_shared(); + + auto proxy = std::make_shared(dummy); + + auto thread = std::make_shared(fun,proxy); + + sai_attr_capability_t cap; + + auto status = sai.queryAttributeCapability( + (sai_object_id_t)1, + SAI_OBJECT_TYPE_SWITCH, + SAI_SWITCH_ATTR_INIT_SWITCH, + &cap); + + EXPECT_EQ(status, SAI_STATUS_SUCCESS); + + proxy->stop(); + + thread->join(); +} + +TEST(Sai, queryAttributeEnumValuesCapability) +{ + Sai sai; + + EXPECT_EQ(sai.apiInitialize(0, &test_services), SAI_STATUS_SUCCESS); + + std::shared_ptr dummy = std::make_shared(); + + auto proxy = std::make_shared(dummy); + + auto thread = std::make_shared(fun,proxy); + + sai_s32_list_t list; + + int32_t arr[10]; + + list.count = 10; + list.list = arr; + + auto status = sai.queryAttributeEnumValuesCapability( + (sai_object_id_t)1, + SAI_OBJECT_TYPE_SWITCH, + SAI_SWITCH_ATTR_INIT_SWITCH, + &list); + + EXPECT_EQ(status, SAI_STATUS_SUCCESS); + + proxy->stop(); + + thread->join(); +} + +TEST(Sai, objectTypeQuery) +{ + Sai sai; + + EXPECT_EQ(sai.apiInitialize(0, &test_services), SAI_STATUS_SUCCESS); + + std::shared_ptr dummy = std::make_shared(); + + auto proxy = std::make_shared(dummy); + + auto thread = std::make_shared(fun,proxy); + + auto objectType = sai.objectTypeQuery(SAI_NULL_OBJECT_ID); + + EXPECT_EQ(objectType, SAI_OBJECT_TYPE_NULL); + + proxy->stop(); + + thread->join(); +} + +TEST(Sai, switchIdQuery) +{ + Sai sai; + + EXPECT_EQ(sai.apiInitialize(0, &test_services), SAI_STATUS_SUCCESS); + + std::shared_ptr dummy = std::make_shared(); + + auto proxy = std::make_shared(dummy); + + auto thread = std::make_shared(fun,proxy); + + auto objectId = sai.switchIdQuery(SAI_NULL_OBJECT_ID); + + EXPECT_EQ(objectId, SAI_NULL_OBJECT_ID); + + proxy->stop(); + + thread->join(); +} + +TEST(Sai, queryApiVersion) +{ + Sai sai; + + sai_api_version_t version; + + // api not initialized + EXPECT_EQ(sai.queryApiVersion(&version), SAI_STATUS_FAILURE); + + EXPECT_EQ(sai.apiInitialize(0, &test_services), SAI_STATUS_SUCCESS); + + std::shared_ptr dummy = std::make_shared(); + + auto proxy = std::make_shared(dummy); + + auto thread = std::make_shared(fun,proxy); + + EXPECT_EQ(sai.queryApiVersion(NULL), SAI_STATUS_INVALID_PARAMETER); + + auto status = sai.queryApiVersion(&version); + + EXPECT_EQ(status, SAI_STATUS_SUCCESS); + EXPECT_EQ(version, SAI_API_VERSION); + + proxy->stop(); + + thread->join(); +} + +TEST(Sai, logSet) +{ + Sai sai; + + sai_api_version_t version; + + // api not initialized + EXPECT_EQ(sai.queryApiVersion(&version), SAI_STATUS_FAILURE); + + EXPECT_EQ(sai.apiInitialize(0, &test_services), SAI_STATUS_SUCCESS); + + std::shared_ptr dummy = std::make_shared(); + + auto proxy = std::make_shared(dummy); + + auto thread = std::make_shared(fun,proxy); + + auto status = sai.logSet(SAI_API_SWITCH, SAI_LOG_LEVEL_NOTICE); + + EXPECT_EQ(status, SAI_STATUS_SUCCESS); + + proxy->stop(); + + thread->join(); +} + +TEST(Sai, getStats) +{ + Sai sai; + + sai_api_version_t version; + + // api not initialized + EXPECT_EQ(sai.queryApiVersion(&version), SAI_STATUS_FAILURE); + + EXPECT_EQ(sai.apiInitialize(0, &test_services), SAI_STATUS_SUCCESS); + + std::shared_ptr dummy = std::make_shared(); + + auto proxy = std::make_shared(dummy); + + auto thread = std::make_shared(fun,proxy); + + sai_stat_id_t counter_ids[2] = { SAI_PORT_STAT_IF_IN_OCTETS, SAI_PORT_STAT_IF_IN_UCAST_PKTS }; + + uint64_t counters[2]; + + auto status = sai.getStats( + SAI_OBJECT_TYPE_PORT, + (sai_object_id_t)1, + 2, + counter_ids, + counters); + + EXPECT_EQ(status, SAI_STATUS_SUCCESS); + + proxy->stop(); + + thread->join(); +} + +TEST(Sai, getStatsExt) +{ + Sai sai; + + sai_api_version_t version; + + // api not initialized + EXPECT_EQ(sai.queryApiVersion(&version), SAI_STATUS_FAILURE); + + EXPECT_EQ(sai.apiInitialize(0, &test_services), SAI_STATUS_SUCCESS); + + std::shared_ptr dummy = std::make_shared(); + + auto proxy = std::make_shared(dummy); + + auto thread = std::make_shared(fun,proxy); + + sai_stat_id_t counter_ids[2] = { SAI_PORT_STAT_IF_IN_OCTETS, SAI_PORT_STAT_IF_IN_UCAST_PKTS }; + + uint64_t counters[2]; + + auto status = sai.getStatsExt( + SAI_OBJECT_TYPE_PORT, + (sai_object_id_t)1, + 2, + counter_ids, + SAI_STATS_MODE_READ, + counters); + + EXPECT_EQ(status, SAI_STATUS_SUCCESS); + + proxy->stop(); + + thread->join(); +} + +TEST(Sai, clearStats) +{ + Sai sai; + + sai_api_version_t version; + + // api not initialized + EXPECT_EQ(sai.queryApiVersion(&version), SAI_STATUS_FAILURE); + + EXPECT_EQ(sai.apiInitialize(0, &test_services), SAI_STATUS_SUCCESS); + + std::shared_ptr dummy = std::make_shared(); + + auto proxy = std::make_shared(dummy); + + auto thread = std::make_shared(fun,proxy); + + sai_stat_id_t counter_ids[2] = { SAI_PORT_STAT_IF_IN_OCTETS, SAI_PORT_STAT_IF_IN_UCAST_PKTS }; + + auto status = sai.clearStats( + SAI_OBJECT_TYPE_PORT, + (sai_object_id_t)1, + 2, + counter_ids); + + EXPECT_EQ(status, SAI_STATUS_SUCCESS); + + proxy->stop(); + + thread->join(); +} + From 1f2c861aafe751e62ad8510419a4da7c795f4bb5 Mon Sep 17 00:00:00 2001 From: Kamil Cudnik Date: Sun, 9 Jun 2024 10:58:26 +0200 Subject: [PATCH 31/32] Update SAI submodule to latest master (#1388) To include newest changes --- SAI | 2 +- syncd/SwitchNotifications.h | 2 ++ syncd/tests/TestSyncdNvdaBf.cpp | 2 +- tests/TestDash.cpp | 4 ++-- unittest/lib/test_sai_redis_neighbor.cpp | 30 ------------------------ unittest/meta/TestMetaDash.cpp | 2 +- unittest/vslib/test_sai_vs_neighbor.cpp | 30 ------------------------ 7 files changed, 7 insertions(+), 65 deletions(-) delete mode 100644 unittest/lib/test_sai_redis_neighbor.cpp delete mode 100644 unittest/vslib/test_sai_vs_neighbor.cpp diff --git a/SAI b/SAI index 2587c3b89..0788e82e8 160000 --- a/SAI +++ b/SAI @@ -1 +1 @@ -Subproject commit 2587c3b89241022bb0eef3ef82ab764eda7a183c +Subproject commit 0788e82e8ca56b82eb8f8c0a3dee40edbc2ba9ba diff --git a/syncd/SwitchNotifications.h b/syncd/SwitchNotifications.h index be0f1438e..2921a9cc1 100644 --- a/syncd/SwitchNotifications.h +++ b/syncd/SwitchNotifications.h @@ -118,6 +118,8 @@ namespace syncd .on_switch_asic_sdk_health_event = &Slot::onSwitchAsicSdkHealthEvent, .on_port_host_tx_ready = &Slot::onPortHostTxReady, .on_twamp_session_event = &Slot::onTwampSessionEvent, + .on_ha_set_event = nullptr, + .on_ha_scope_event = nullptr, }) { } virtual ~Slot() {} diff --git a/syncd/tests/TestSyncdNvdaBf.cpp b/syncd/tests/TestSyncdNvdaBf.cpp index 21935ea13..f86ba08a9 100644 --- a/syncd/tests/TestSyncdNvdaBf.cpp +++ b/syncd/tests/TestSyncdNvdaBf.cpp @@ -578,7 +578,7 @@ TEST_F(SyncdNvdaBfTest, dashVip) EXPECT_EQ(SAI_STATUS_SUCCESS, m_sairedis->get(&vip, (uint32_t)attrs.size(), attrs.data())); EXPECT_EQ(attrs[0].value.s32, SAI_VIP_ENTRY_ACTION_ACCEPT); - attr.id = SAI_ENI_ETHER_ADDRESS_MAP_ENTRY_ATTR_ENI_ID; + attr.id = SAI_VIP_ENTRY_ATTR_ACTION; attr.value.s32 = SAI_VIP_ENTRY_ACTION_ACCEPT; EXPECT_EQ(SAI_STATUS_SUCCESS, m_sairedis->set(&vip, &attr)); diff --git a/tests/TestDash.cpp b/tests/TestDash.cpp index 1e1ec5057..49da8e510 100644 --- a/tests/TestDash.cpp +++ b/tests/TestDash.cpp @@ -261,7 +261,7 @@ TEST(APIBulk, eni_ether_address_map_entry) } for (uint32_t i = 0; i < entries_count; i++) { - attr.id = SAI_DIRECTION_LOOKUP_ENTRY_ATTR_ACTION; + attr.id = SAI_ENI_ETHER_ADDRESS_MAP_ENTRY_ATTR_ENI_ID; ASSERT_SUCCESS(dash_api->get_eni_ether_address_map_entry_attribute(&entries[i], 1, &attr)); ASSERT_EQ(attr.value.oid, attr_list[i][0].value.oid); } @@ -535,7 +535,7 @@ TEST(API, vip_entry) ASSERT_SUCCESS(dash_api->get_vip_entry_attribute(&vip, (uint32_t)attrs.size(), attrs.data())); ASSERT_EQ(attrs[0].value.s32, SAI_VIP_ENTRY_ACTION_ACCEPT); - attr.id = SAI_ENI_ETHER_ADDRESS_MAP_ENTRY_ATTR_ENI_ID; + attr.id = SAI_VIP_ENTRY_ATTR_ACTION; attr.value.s32 = SAI_VIP_ENTRY_ACTION_ACCEPT; ASSERT_SUCCESS(dash_api->set_vip_entry_attribute(&vip, &attr)); ASSERT_SUCCESS(dash_api->get_vip_entry_attribute(&vip, (uint32_t)attrs.size(), attrs.data())); diff --git a/unittest/lib/test_sai_redis_neighbor.cpp b/unittest/lib/test_sai_redis_neighbor.cpp deleted file mode 100644 index 9a7852410..000000000 --- a/unittest/lib/test_sai_redis_neighbor.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsairedis, neighbor) -{ - sai_neighbor_api_t *api = nullptr; - - sai_api_query(SAI_API_NEIGHBOR, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_neighbor_entry_t id ; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_neighbor_entry(&id,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_neighbor_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_neighbor_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_neighbor_entry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_neighbor_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_neighbor_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_neighbor_entries_attribute(0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_neighbor_entries_attribute(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->remove_all_neighbor_entries(0)); -} diff --git a/unittest/meta/TestMetaDash.cpp b/unittest/meta/TestMetaDash.cpp index 5fec7d475..b7b4234d1 100644 --- a/unittest/meta/TestMetaDash.cpp +++ b/unittest/meta/TestMetaDash.cpp @@ -529,7 +529,7 @@ TEST(Meta, quad_dash_vip) EXPECT_EQ(SAI_STATUS_SUCCESS, m.get(&vip, (uint32_t)attrs.size(), attrs.data())); EXPECT_EQ(attrs[0].value.s32, SAI_VIP_ENTRY_ACTION_ACCEPT); - attr.id = SAI_ENI_ETHER_ADDRESS_MAP_ENTRY_ATTR_ENI_ID; + attr.id = SAI_VIP_ENTRY_ATTR_ACTION; attr.value.s32 = SAI_VIP_ENTRY_ACTION_ACCEPT; EXPECT_EQ(SAI_STATUS_SUCCESS, m.set(&vip, &attr)); diff --git a/unittest/vslib/test_sai_vs_neighbor.cpp b/unittest/vslib/test_sai_vs_neighbor.cpp deleted file mode 100644 index 3ad85a077..000000000 --- a/unittest/vslib/test_sai_vs_neighbor.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include - -extern "C" { -#include "sai.h" -} - -#include "swss/logger.h" - -TEST(libsaivs, neighbor) -{ - sai_neighbor_api_t *api = nullptr; - - sai_api_query(SAI_API_NEIGHBOR, (void**)&api); - - EXPECT_NE(api, nullptr); - - sai_neighbor_entry_t id ; - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_neighbor_entry(&id,0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_neighbor_entry(0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_neighbor_entry_attribute(0,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_neighbor_entry_attribute(0,0,0)); - - EXPECT_NE(SAI_STATUS_SUCCESS, api->create_neighbor_entries(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_neighbor_entries(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->set_neighbor_entries_attribute(0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - EXPECT_NE(SAI_STATUS_SUCCESS, api->get_neighbor_entries_attribute(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0)); - - EXPECT_EQ(SAI_STATUS_NOT_IMPLEMENTED, api->remove_all_neighbor_entries(0)); -} From 4f0fcafe5e8aeeedb6f81dc8a2cb25966c6bf498 Mon Sep 17 00:00:00 2001 From: Kamil Cudnik Date: Mon, 10 Jun 2024 11:02:53 +0200 Subject: [PATCH 32/32] [proxy] Support load profile map from file (#1389) Implement load config.ini to profile map. Remove unused proxy header --- meta/DummySaiInterface.cpp | 25 +- proxylib/Proxy.cpp | 47 ++++ proxylib/Proxy.h | 7 + proxylib/sai_proxy.h | 450 -------------------------------- unittest/proxylib/Makefile.am | 1 + unittest/proxylib/TestProxy.cpp | 25 ++ unittest/proxylib/config.ini | 8 + 7 files changed, 112 insertions(+), 451 deletions(-) delete mode 100644 proxylib/sai_proxy.h create mode 100644 unittest/proxylib/TestProxy.cpp create mode 100644 unittest/proxylib/config.ini diff --git a/meta/DummySaiInterface.cpp b/meta/DummySaiInterface.cpp index b15454bb2..51e9e7d51 100644 --- a/meta/DummySaiInterface.cpp +++ b/meta/DummySaiInterface.cpp @@ -23,10 +23,33 @@ void DummySaiInterface::setStatus( sai_status_t DummySaiInterface::apiInitialize( _In_ uint64_t flags, - _In_ const sai_service_method_table_t *service_method_table) + _In_ const sai_service_method_table_t *smt) { SWSS_LOG_ENTER(); + if (smt) + { + if (smt->profile_get_value) + { + SWSS_LOG_NOTICE("Dummy: profile_get_value(NULL): %s", smt->profile_get_value(0, NULL)); + SWSS_LOG_NOTICE("Dummy: profile_get_value(FOO): %s", smt->profile_get_value(0, "FOO")); + SWSS_LOG_NOTICE("Dummy: profile_get_value(FOO): %s", smt->profile_get_value(0, "CAR")); + } + + if (smt->profile_get_next_value) + { + + const char *var = NULL; + const char *val = NULL; + + SWSS_LOG_NOTICE("Dummy: profile_get_next_value: %d", smt->profile_get_next_value(0, NULL, NULL)); + SWSS_LOG_NOTICE("Dummy: profile_get_next_value: %d", smt->profile_get_next_value(0, NULL, &val)); + SWSS_LOG_NOTICE("Dummy: profile_get_next_value: %d", smt->profile_get_next_value(0, &var, NULL)); + SWSS_LOG_NOTICE("Dummy: profile_get_next_value: %d", smt->profile_get_next_value(0, &var, &val)); + SWSS_LOG_NOTICE("Dummy: profile_get_next_value: %d", smt->profile_get_next_value(0, &var, &val)); + } + } + return SAI_STATUS_SUCCESS; } diff --git a/proxylib/Proxy.cpp b/proxylib/Proxy.cpp index 60ecb43bd..ff789c5fd 100644 --- a/proxylib/Proxy.cpp +++ b/proxylib/Proxy.cpp @@ -26,11 +26,15 @@ Proxy::Proxy( { SWSS_LOG_ENTER(); + m_configFile = "config.ini"; // TODO to command line + // TODO to move hard coded addresses to config m_selectableChannel = std::make_shared("tcp://127.0.0.1:5555"); m_notifications = std::make_shared("tcp://127.0.0.1:5556"); + loadProfileMap(); + m_smt.profileGetValue = std::bind(&Proxy::profileGetValue, this, _1, _2); m_smt.profileGetNextValue = std::bind(&Proxy::profileGetNextValue, this, _1, _2, _3); @@ -55,6 +59,8 @@ Proxy::~Proxy() { SWSS_LOG_ENTER(); + // TODO call stop() + if (m_apiInitialized) { SWSS_LOG_NOTICE("calling api uninitialize"); @@ -73,6 +79,47 @@ Proxy::~Proxy() m_notifications = nullptr; } +void Proxy::loadProfileMap() +{ + SWSS_LOG_ENTER(); + + std::ifstream profile(m_configFile.c_str()); + + if (!profile.is_open()) + { + SWSS_LOG_WARN("failed to open profile map file: %s: %s", + m_configFile.c_str(), + strerror(errno)); + + return; + } + + std::string line; + + while (getline(profile, line)) + { + if (line.size() > 0 && (line[0] == '#' || line[0] == ';')) + { + continue; + } + + size_t pos = line.find("="); + + if (pos == std::string::npos) + { + SWSS_LOG_WARN("not found '=' in line %s", line.c_str()); + continue; + } + + std::string key = line.substr(0, pos); + std::string value = line.substr(pos + 1); + + m_profileMap[key] = value; + + SWSS_LOG_NOTICE("insert: %s:%s", key.c_str(), value.c_str()); + } +} + const char* Proxy::profileGetValue( _In_ sai_switch_profile_id_t profile_id, _In_ const char* variable) diff --git a/proxylib/Proxy.h b/proxylib/Proxy.h index 45f696ebe..8fc3b6424 100644 --- a/proxylib/Proxy.h +++ b/proxylib/Proxy.h @@ -98,6 +98,11 @@ namespace saiproxy void processClearStats( _In_ const swss::KeyOpFieldsValuesTuple &kco); + + private: + + void loadProfileMap(); + private: syncd::ServiceMethodTable m_smt; @@ -116,6 +121,8 @@ namespace saiproxy std::shared_ptr m_notifications; + std::string m_configFile; + /** * @brief Mutex for synchronizing api execution and notifications */ diff --git a/proxylib/sai_proxy.h b/proxylib/sai_proxy.h deleted file mode 100644 index e9810523e..000000000 --- a/proxylib/sai_proxy.h +++ /dev/null @@ -1,450 +0,0 @@ -#pragma once - -extern "C" { -#include "sai.h" -#include "saiextensions.h" -} - -#include "meta/SaiInterface.h" - -#include "swss/logger.h" - -#include - -#define PRIVATE __attribute__((visibility("hidden"))) - -PRIVATE extern const sai_acl_api_t proxy_acl_api; -PRIVATE extern const sai_ars_api_t proxy_ars_api; -PRIVATE extern const sai_ars_profile_api_t proxy_ars_profile_api; -PRIVATE extern const sai_bfd_api_t proxy_bfd_api; -PRIVATE extern const sai_bmtor_api_t proxy_bmtor_api; -PRIVATE extern const sai_generic_programmable_api_t proxy_generic_programmable_api; -PRIVATE extern const sai_bridge_api_t proxy_bridge_api; -PRIVATE extern const sai_buffer_api_t proxy_buffer_api; -PRIVATE extern const sai_counter_api_t proxy_counter_api; -PRIVATE extern const sai_dash_vip_api_t proxy_dash_vip_api; -PRIVATE extern const sai_dash_pa_validation_api_t proxy_dash_pa_validation_api; -PRIVATE extern const sai_dash_vnet_api_t proxy_dash_vnet_api; -PRIVATE extern const sai_dash_outbound_routing_api_t proxy_dash_outbound_routing_api; -PRIVATE extern const sai_dash_outbound_ca_to_pa_api_t proxy_dash_outbound_ca_to_pa_api; -PRIVATE extern const sai_dash_inbound_routing_api_t proxy_dash_inbound_routing_api; -PRIVATE extern const sai_dash_eni_api_t proxy_dash_eni_api; -PRIVATE extern const sai_dash_direction_lookup_api_t proxy_dash_direction_lookup_api; -PRIVATE extern const sai_dash_acl_api_t proxy_dash_acl_api; -PRIVATE extern const sai_debug_counter_api_t proxy_debug_counter_api; -PRIVATE extern const sai_dtel_api_t proxy_dtel_api; -PRIVATE extern const sai_fdb_api_t proxy_fdb_api; -PRIVATE extern const sai_hash_api_t proxy_hash_api; -PRIVATE extern const sai_hostif_api_t proxy_hostif_api; -PRIVATE extern const sai_ipmc_api_t proxy_ipmc_api; -PRIVATE extern const sai_ipmc_group_api_t proxy_ipmc_group_api; -PRIVATE extern const sai_isolation_group_api_t proxy_isolation_group_api; -PRIVATE extern const sai_l2mc_api_t proxy_l2mc_api; -PRIVATE extern const sai_l2mc_group_api_t proxy_l2mc_group_api; -PRIVATE extern const sai_lag_api_t proxy_lag_api; -PRIVATE extern const sai_macsec_api_t proxy_macsec_api; -PRIVATE extern const sai_mcast_fdb_api_t proxy_mcast_fdb_api; -PRIVATE extern const sai_mirror_api_t proxy_mirror_api; -PRIVATE extern const sai_mpls_api_t proxy_mpls_api; -PRIVATE extern const sai_nat_api_t proxy_nat_api; -PRIVATE extern const sai_neighbor_api_t proxy_neighbor_api; -PRIVATE extern const sai_next_hop_api_t proxy_next_hop_api; -PRIVATE extern const sai_next_hop_group_api_t proxy_next_hop_group_api; -PRIVATE extern const sai_policer_api_t proxy_policer_api; -PRIVATE extern const sai_port_api_t proxy_port_api; -PRIVATE extern const sai_qos_map_api_t proxy_qos_map_api; -PRIVATE extern const sai_queue_api_t proxy_queue_api; -PRIVATE extern const sai_route_api_t proxy_route_api; -PRIVATE extern const sai_router_interface_api_t proxy_router_interface_api; -PRIVATE extern const sai_rpf_group_api_t proxy_rpf_group_api; -PRIVATE extern const sai_samplepacket_api_t proxy_samplepacket_api; -PRIVATE extern const sai_scheduler_api_t proxy_scheduler_api; -PRIVATE extern const sai_scheduler_group_api_t proxy_scheduler_group_api; -PRIVATE extern const sai_srv6_api_t proxy_srv6_api; -PRIVATE extern const sai_stp_api_t proxy_stp_api; -PRIVATE extern const sai_switch_api_t proxy_switch_api; -PRIVATE extern const sai_system_port_api_t proxy_system_port_api; -PRIVATE extern const sai_tam_api_t proxy_tam_api; -PRIVATE extern const sai_tunnel_api_t proxy_tunnel_api; -PRIVATE extern const sai_udf_api_t proxy_udf_api; -PRIVATE extern const sai_virtual_router_api_t proxy_virtual_router_api; -PRIVATE extern const sai_vlan_api_t proxy_vlan_api; -PRIVATE extern const sai_wred_api_t proxy_wred_api; -PRIVATE extern const sai_my_mac_api_t proxy_my_mac_api; -PRIVATE extern const sai_ipsec_api_t proxy_ipsec_api; -PRIVATE extern const sai_twamp_api_t proxy_twamp_api; -PRIVATE extern const sai_dash_meter_api_t proxy_dash_meter_api; -PRIVATE extern const sai_poe_api_t proxy_poe_api; - -PRIVATE extern std::shared_ptr proxy_sai; - -// QUAD OID - -#define PROXY_CREATE(OT,ot) \ - static sai_status_t proxy_create_ ## ot( \ - _Out_ sai_object_id_t *object_id, \ - _In_ sai_object_id_t switch_id, \ - _In_ uint32_t attr_count, \ - _In_ const sai_attribute_t *attr_list) \ -{ \ - SWSS_LOG_ENTER(); \ - return proxy_sai->create( \ - (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ - object_id, \ - switch_id, \ - attr_count, \ - attr_list); \ -} - -#define PROXY_REMOVE(OT,ot) \ - static sai_status_t proxy_remove_ ## ot( \ - _In_ sai_object_id_t object_id) \ -{ \ - SWSS_LOG_ENTER(); \ - return proxy_sai->remove( \ - (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ - object_id); \ -} - -#define PROXY_SET(OT,ot) \ - static sai_status_t proxy_set_ ## ot ## _attribute( \ - _In_ sai_object_id_t object_id, \ - _In_ const sai_attribute_t *attr) \ -{ \ - SWSS_LOG_ENTER(); \ - return proxy_sai->set( \ - (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ - object_id, \ - attr); \ -} - -#define PROXY_GET(OT,ot) \ - static sai_status_t proxy_get_ ## ot ## _attribute( \ - _In_ sai_object_id_t object_id, \ - _In_ uint32_t attr_count, \ - _Inout_ sai_attribute_t *attr_list) \ -{ \ - SWSS_LOG_ENTER(); \ - return proxy_sai->get( \ - (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ - object_id, \ - attr_count, \ - attr_list); \ -} - -// QUAD DECLARE - -#define PROXY_GENERIC_QUAD(OT,ot) \ - PROXY_CREATE(OT,ot); \ - PROXY_REMOVE(OT,ot); \ - PROXY_SET(OT,ot); \ - PROXY_GET(OT,ot); - -// QUAD ENTRY - -#define PROXY_CREATE_ENTRY(OT,ot) \ - static sai_status_t proxy_create_ ## ot( \ - _In_ const sai_ ## ot ##_t *entry, \ - _In_ uint32_t attr_count, \ - _In_ const sai_attribute_t *attr_list) \ -{ \ - SWSS_LOG_ENTER(); \ - return proxy_sai->create( \ - entry, \ - attr_count, \ - attr_list); \ -} - -#define PROXY_REMOVE_ENTRY(OT,ot) \ - static sai_status_t proxy_remove_ ## ot( \ - _In_ const sai_ ## ot ## _t *entry) \ -{ \ - SWSS_LOG_ENTER(); \ - return proxy_sai->remove( \ - entry); \ -} - -#define PROXY_SET_ENTRY(OT,ot) \ - static sai_status_t proxy_set_ ## ot ## _attribute( \ - _In_ const sai_ ## ot ## _t *entry, \ - _In_ const sai_attribute_t *attr) \ -{ \ - SWSS_LOG_ENTER(); \ - return proxy_sai->set( \ - entry, \ - attr); \ -} - -#define PROXY_GET_ENTRY(OT,ot) \ - static sai_status_t proxy_get_ ## ot ## _attribute( \ - _In_ const sai_ ## ot ## _t *entry, \ - _In_ uint32_t attr_count, \ - _Inout_ sai_attribute_t *attr_list) \ -{ \ - SWSS_LOG_ENTER(); \ - return proxy_sai->get( \ - entry, \ - attr_count, \ - attr_list); \ -} - -// QUAD ENTRY DECLARE - -#define PROXY_GENERIC_QUAD_ENTRY(OT,ot) \ - PROXY_CREATE_ENTRY(OT,ot); \ - PROXY_REMOVE_ENTRY(OT,ot); \ - PROXY_SET_ENTRY(OT,ot); \ - PROXY_GET_ENTRY(OT,ot); - -// QUAD API - -#define PROXY_GENERIC_QUAD_API(ot) \ - proxy_create_ ## ot, \ - proxy_remove_ ## ot, \ - proxy_set_ ## ot ##_attribute, \ - proxy_get_ ## ot ##_attribute, - -// STATS - -#define PROXY_GET_STATS(OT,ot) \ - static sai_status_t proxy_get_ ## ot ## _stats( \ - _In_ sai_object_id_t object_id, \ - _In_ uint32_t number_of_counters, \ - _In_ const sai_stat_id_t *counter_ids, \ - _Out_ uint64_t *counters) \ -{ \ - SWSS_LOG_ENTER(); \ - return proxy_sai->getStats( \ - (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ - object_id, \ - number_of_counters, \ - counter_ids, \ - counters); \ -} - -#define PROXY_GET_STATS_EXT(OT,ot) \ - static sai_status_t proxy_get_ ## ot ## _stats_ext( \ - _In_ sai_object_id_t object_id, \ - _In_ uint32_t number_of_counters, \ - _In_ const sai_stat_id_t *counter_ids, \ - _In_ sai_stats_mode_t mode, \ - _Out_ uint64_t *counters) \ -{ \ - SWSS_LOG_ENTER(); \ - return proxy_sai->getStatsExt( \ - (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ - object_id, \ - number_of_counters, \ - counter_ids, \ - mode, \ - counters); \ -} - -#define PROXY_CLEAR_STATS(OT,ot) \ - static sai_status_t proxy_clear_ ## ot ## _stats( \ - _In_ sai_object_id_t object_id, \ - _In_ uint32_t number_of_counters, \ - _In_ const sai_stat_id_t *counter_ids) \ -{ \ - SWSS_LOG_ENTER(); \ - return proxy_sai->clearStats( \ - (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ - object_id, \ - number_of_counters, \ - counter_ids); \ -} - -// STATS DECLARE - -#define PROXY_GENERIC_STATS(OT, ot) \ - PROXY_GET_STATS(OT,ot); \ - PROXY_GET_STATS_EXT(OT,ot); \ - PROXY_CLEAR_STATS(OT,ot); - -// STATS API - -#define PROXY_GENERIC_STATS_API(ot) \ - proxy_get_ ## ot ## _stats, \ - proxy_get_ ## ot ## _stats_ext, \ - proxy_clear_ ## ot ## _stats, - -// BULK QUAD - -#define PROXY_BULK_CREATE(OT,fname) \ - static sai_status_t proxy_bulk_create_ ## fname( \ - _In_ sai_object_id_t switch_id, \ - _In_ uint32_t object_count, \ - _In_ const uint32_t *attr_count, \ - _In_ const sai_attribute_t **attr_list, \ - _In_ sai_bulk_op_error_mode_t mode, \ - _Out_ sai_object_id_t *object_id, \ - _Out_ sai_status_t *object_statuses) \ -{ \ - SWSS_LOG_ENTER(); \ - return proxy_sai->bulkCreate( \ - (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ - switch_id, \ - object_count, \ - attr_count, \ - attr_list, \ - mode, \ - object_id, \ - object_statuses); \ -} - -#define PROXY_BULK_REMOVE(OT,fname) \ - static sai_status_t proxy_bulk_remove_ ## fname( \ - _In_ uint32_t object_count, \ - _In_ const sai_object_id_t *object_id, \ - _In_ sai_bulk_op_error_mode_t mode, \ - _Out_ sai_status_t *object_statuses) \ -{ \ - SWSS_LOG_ENTER(); \ - return proxy_sai->bulkRemove( \ - (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ - object_count, \ - object_id, \ - mode, \ - object_statuses); \ -} - -#define PROXY_BULK_SET(OT,fname) \ - static sai_status_t proxy_bulk_set_ ## fname( \ - _In_ uint32_t object_count, \ - _In_ const sai_object_id_t *object_id, \ - _In_ const sai_attribute_t *attr_list, \ - _In_ sai_bulk_op_error_mode_t mode, \ - _Out_ sai_status_t *object_statuses) \ -{ \ - SWSS_LOG_ENTER(); \ - return proxy_sai->bulkSet( \ - (sai_object_type_t)SAI_OBJECT_TYPE_ ## OT, \ - object_count, \ - object_id, \ - attr_list, \ - mode, \ - object_statuses); \ -} - -#define PROXY_BULK_GET(OT,fname) \ - static sai_status_t proxy_bulk_get_ ## fname( \ - _In_ uint32_t object_count, \ - _In_ const sai_object_id_t *object_id, \ - _In_ const uint32_t *attr_count, \ - _Inout_ sai_attribute_t **attr_list, \ - _In_ sai_bulk_op_error_mode_t mode, \ - _Out_ sai_status_t *object_statuses) \ -{ \ - SWSS_LOG_ENTER(); \ - SWSS_LOG_ERROR("not implemented"); \ - return SAI_STATUS_NOT_IMPLEMENTED; \ -} - -// BULK QUAD DECLARE - -#define PROXY_BULK_QUAD(OT,ot) \ - PROXY_BULK_CREATE(OT,ot); \ - PROXY_BULK_REMOVE(OT,ot); \ - PROXY_BULK_SET(OT,ot); \ - PROXY_BULK_GET(OT,ot); - -// BULK QUAD ENTRY - -#define PROXY_BULK_CREATE_ENTRY(OT,ot) \ - PROXY_BULK_CREATE_ENTRY_EX(OT, ot, ot) - -#define PROXY_BULK_CREATE_ENTRY_EX(OT,ot,fname) \ - static sai_status_t proxy_bulk_create_ ## fname(\ - _In_ uint32_t object_count, \ - _In_ const sai_ ## ot ## _t *entry, \ - _In_ const uint32_t *attr_count, \ - _In_ const sai_attribute_t **attr_list, \ - _In_ sai_bulk_op_error_mode_t mode, \ - _Out_ sai_status_t *object_statuses) \ -{ \ - SWSS_LOG_ENTER(); \ - return proxy_sai->bulkCreate( \ - object_count, \ - entry, \ - attr_count, \ - attr_list, \ - mode, \ - object_statuses); \ -} - -#define PROXY_BULK_REMOVE_ENTRY(OT,ot) \ - PROXY_BULK_REMOVE_ENTRY_EX(OT, ot, ot) - -#define PROXY_BULK_REMOVE_ENTRY_EX(OT,ot,fname) \ - static sai_status_t proxy_bulk_remove_ ## fname(\ - _In_ uint32_t object_count, \ - _In_ const sai_ ## ot ##_t *entry, \ - _In_ sai_bulk_op_error_mode_t mode, \ - _Out_ sai_status_t *object_statuses) \ -{ \ - SWSS_LOG_ENTER(); \ - return proxy_sai->bulkRemove( \ - object_count, \ - entry, \ - mode, \ - object_statuses); \ -} - -#define PROXY_BULK_SET_ENTRY(OT,ot) \ - static sai_status_t proxy_bulk_set_ ## ot( \ - _In_ uint32_t object_count, \ - _In_ const sai_ ## ot ## _t *entry, \ - _In_ const sai_attribute_t *attr_list, \ - _In_ sai_bulk_op_error_mode_t mode, \ - _Out_ sai_status_t *object_statuses) \ -{ \ - SWSS_LOG_ENTER(); \ - return proxy_sai->bulkSet( \ - object_count, \ - entry, \ - attr_list, \ - mode, \ - object_statuses); \ -} - -#define PROXY_BULK_GET_ENTRY(OT,ot) \ - static sai_status_t proxy_bulk_get_ ## ot( \ - _In_ uint32_t object_count, \ - _In_ const sai_ ## ot ## _t *entry, \ - _In_ const uint32_t *attr_count, \ - _Inout_ sai_attribute_t **attr_list, \ - _In_ sai_bulk_op_error_mode_t mode, \ - _Out_ sai_status_t *object_statuses) \ -{ \ - SWSS_LOG_ENTER(); \ - SWSS_LOG_ERROR("not implemented"); \ - return SAI_STATUS_NOT_IMPLEMENTED; \ -} - -// BULK QUAD ENTRY DECLARE - -#define PROXY_BULK_QUAD_ENTRY(OT,ot) \ - PROXY_BULK_CREATE_ENTRY(OT,ot); \ - PROXY_BULK_REMOVE_ENTRY(OT,ot); \ - PROXY_BULK_SET_ENTRY(OT,ot); \ - PROXY_BULK_GET_ENTRY(OT,ot); - -// BULK QUAD API - -#define PROXY_BULK_QUAD_API(ot) \ - proxy_bulk_create_ ## ot, \ - proxy_bulk_remove_ ## ot, \ - proxy_bulk_set_ ## ot, \ - proxy_bulk_get_ ## ot, - -// BULK get/set DECLARE - -#define PROXY_BULK_GET_SET(OT,ot) \ - PROXY_BULK_GET(OT,ot); \ - PROXY_BULK_SET(OT,ot); - -// BULK get/set API - -#define PROXY_BULK_GET_SET_API(ot) \ - proxy_bulk_get_ ## ot, \ - proxy_bulk_set_ ## ot, diff --git a/unittest/proxylib/Makefile.am b/unittest/proxylib/Makefile.am index b1b8b73a7..a7c5d8ac6 100644 --- a/unittest/proxylib/Makefile.am +++ b/unittest/proxylib/Makefile.am @@ -7,6 +7,7 @@ LDADD_GTEST = -L/usr/src/gtest -lgtest -lgtest_main tests_SOURCES = \ ../../meta/DummySaiInterface.cpp \ main.cpp \ + TestProxy.cpp \ TestSai.cpp tests_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) diff --git a/unittest/proxylib/TestProxy.cpp b/unittest/proxylib/TestProxy.cpp new file mode 100644 index 000000000..00060593b --- /dev/null +++ b/unittest/proxylib/TestProxy.cpp @@ -0,0 +1,25 @@ +#include + +#include +#include +#include + +#include + +#include "meta/DummySaiInterface.h" + +#include "Sai.h" +#include "Proxy.h" + +using namespace saiproxy; + +TEST(Proxy, ctr) +{ + Sai sai; + + std::shared_ptr dummy = std::make_shared(); + + // will test loadProfileMap + + auto proxy = std::make_shared(dummy); +} diff --git a/unittest/proxylib/config.ini b/unittest/proxylib/config.ini new file mode 100644 index 000000000..da5334b45 --- /dev/null +++ b/unittest/proxylib/config.ini @@ -0,0 +1,8 @@ +# test proxu config comment +; comment + +invalid line + +VARIABLE=VALUE +FOO=bar +BAR=baz