Skip to content

Commit

Permalink
Add vs vlan tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kcudnik committed Aug 23, 2021
1 parent 3122b37 commit a02b593
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions unittest/vslib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ tests_LDADD = $(LDADD_GTEST) $(top_srcdir)/vslib/libSaiVS.a -lhiredis -lswsscomm

testslibsaivs_SOURCES = \
main_libsaivs.cpp \
test_sai_vs_vlan.cpp \
test_sai_vs_wred.cpp

testslibsaivs_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON)
Expand Down
36 changes: 36 additions & 0 deletions unittest/vslib/test_sai_vs_vlan.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include <gtest/gtest.h>

extern "C" {
#include "sai.h"
}

#include "swss/logger.h"

TEST(libsaivs, vlan)
{
sai_vlan_api_t *vs_vlan_api = nullptr;

sai_api_query(SAI_API_VLAN, (void**)&vs_vlan_api);

EXPECT_NE(vs_vlan_api, nullptr);

sai_object_id_t id;

EXPECT_NE(SAI_STATUS_SUCCESS, vs_vlan_api->create_vlan(&id,0,0,0));
EXPECT_NE(SAI_STATUS_SUCCESS, vs_vlan_api->remove_vlan(0));
EXPECT_NE(SAI_STATUS_SUCCESS, vs_vlan_api->set_vlan_attribute(0,0));
EXPECT_NE(SAI_STATUS_SUCCESS, vs_vlan_api->get_vlan_attribute(0,0,0));

EXPECT_NE(SAI_STATUS_SUCCESS, vs_vlan_api->create_vlan_member(&id,0,0,0));
EXPECT_NE(SAI_STATUS_SUCCESS, vs_vlan_api->remove_vlan_member(0));
EXPECT_NE(SAI_STATUS_SUCCESS, vs_vlan_api->set_vlan_member_attribute(0,0));
EXPECT_NE(SAI_STATUS_SUCCESS, vs_vlan_api->get_vlan_member_attribute(0,0,0));

EXPECT_NE(SAI_STATUS_SUCCESS, vs_vlan_api->create_vlan_members(0,0,0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0,0));
EXPECT_NE(SAI_STATUS_SUCCESS, vs_vlan_api->remove_vlan_members(0,0,SAI_BULK_OP_ERROR_MODE_IGNORE_ERROR,0));

EXPECT_NE(SAI_STATUS_SUCCESS, vs_vlan_api->get_vlan_stats(0,0,0,0));
EXPECT_NE(SAI_STATUS_SUCCESS, vs_vlan_api->get_vlan_stats_ext(0,0,0,SAI_STATS_MODE_READ,0));
EXPECT_NE(SAI_STATUS_SUCCESS, vs_vlan_api->clear_vlan_stats(0,0,0));

}

0 comments on commit a02b593

Please sign in to comment.