From 27a2b90bd5090ec3afdbed6e768428c00ac4c22c Mon Sep 17 00:00:00 2001 From: kcudnik Date: Mon, 16 Aug 2021 20:36:15 +0200 Subject: [PATCH] Add neighbor tests --- unittest/vslib/Makefile.am | 1 + unittest/vslib/test_sai_vs_lag.cpp | 30 ++++++++++++++----------- unittest/vslib/test_sai_vs_neighbor.cpp | 25 +++++++++++++++++++++ 3 files changed, 43 insertions(+), 13 deletions(-) create mode 100644 unittest/vslib/test_sai_vs_neighbor.cpp diff --git a/unittest/vslib/Makefile.am b/unittest/vslib/Makefile.am index e214f3898146..01efed921f4e 100644 --- a/unittest/vslib/Makefile.am +++ b/unittest/vslib/Makefile.am @@ -32,6 +32,7 @@ testslibsaivs_SOURCES = main_libsaivs.cpp \ test_sai_vs_mpls.cpp \ test_sai_vs_nat.cpp \ test_sai_vs_hash.cpp \ + test_sai_vs_neighbor.cpp \ test_sai_vs_vlan.cpp \ test_sai_vs_hostif.cpp \ test_sai_vs_wred.cpp diff --git a/unittest/vslib/test_sai_vs_lag.cpp b/unittest/vslib/test_sai_vs_lag.cpp index a185f8897129..5d41558a4723 100644 --- a/unittest/vslib/test_sai_vs_lag.cpp +++ b/unittest/vslib/test_sai_vs_lag.cpp @@ -6,26 +6,30 @@ extern "C" { #include "swss/logger.h" -TEST(libsaivs, lag) +TEST(libsaivs, vlan) { - sai_lag_api_t *api = nullptr; + sai_vlan_api_t *api = nullptr; - sai_api_query(SAI_API_LAG, (void**)&api); + sai_api_query(SAI_API_VLAN, (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_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_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_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_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)); + 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_neighbor.cpp b/unittest/vslib/test_sai_vs_neighbor.cpp new file mode 100644 index 000000000000..f5398762aa35 --- /dev/null +++ b/unittest/vslib/test_sai_vs_neighbor.cpp @@ -0,0 +1,25 @@ +#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)); +}