Skip to content

Commit

Permalink
Add port tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kcudnik committed Aug 23, 2021
1 parent 46d15e9 commit 8162205
Show file tree
Hide file tree
Showing 2 changed files with 49 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 @@ -35,6 +35,7 @@ testslibsaivs_SOURCES = main_libsaivs.cpp \
test_sai_vs_neighbor.cpp \
test_sai_vs_nexthop.cpp \
test_sai_vs_nexthopgroup.cpp \
test_sai_vs_port.cpp \
test_sai_vs_policer.cpp \
test_sai_vs_vlan.cpp \
test_sai_vs_hostif.cpp \
Expand Down
48 changes: 48 additions & 0 deletions unittest/vslib/test_sai_vs_port.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#include <gtest/gtest.h>

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->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));
}

0 comments on commit 8162205

Please sign in to comment.