Skip to content

Commit

Permalink
Add bridge tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kcudnik committed Aug 23, 2021
1 parent ec96469 commit fe6a041
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 @@ -14,6 +14,7 @@ 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_hash.cpp \
test_sai_vs_vlan.cpp \
test_sai_vs_hostif.cpp \
Expand Down
36 changes: 36 additions & 0 deletions unittest/vslib/test_sai_vs_bridge.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, 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));
}

0 comments on commit fe6a041

Please sign in to comment.