From 7c61b13ed05b1eb687b048f968fe031a6cb5f4b2 Mon Sep 17 00:00:00 2001 From: kcudnik Date: Mon, 16 Aug 2021 19:02:10 +0200 Subject: [PATCH] Add buffer tests --- unittest/vslib/Makefile.am | 1 + unittest/vslib/test_sai_vs_buffer.cpp | 41 +++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 unittest/vslib/test_sai_vs_buffer.cpp diff --git a/unittest/vslib/Makefile.am b/unittest/vslib/Makefile.am index b69fe3f551dc..2064b57bafa3 100644 --- a/unittest/vslib/Makefile.am +++ b/unittest/vslib/Makefile.am @@ -15,6 +15,7 @@ testslibsaivs_SOURCES = main_libsaivs.cpp \ test_sai_vs_bfd.cpp \ test_sai_vs_bmtor.cpp \ test_sai_vs_bridge.cpp \ + test_sai_vs_buffer.cpp \ test_sai_vs_hash.cpp \ test_sai_vs_vlan.cpp \ test_sai_vs_hostif.cpp \ diff --git a/unittest/vslib/test_sai_vs_buffer.cpp b/unittest/vslib/test_sai_vs_buffer.cpp new file mode 100644 index 000000000000..b60b31684996 --- /dev/null +++ b/unittest/vslib/test_sai_vs_buffer.cpp @@ -0,0 +1,41 @@ +#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)); +}