Skip to content

Commit

Permalink
Add neighbor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kcudnik committed Aug 23, 2021
1 parent fc28438 commit 27a2b90
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 13 deletions.
1 change: 1 addition & 0 deletions unittest/vslib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 17 additions & 13 deletions unittest/vslib/test_sai_vs_lag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
25 changes: 25 additions & 0 deletions unittest/vslib/test_sai_vs_neighbor.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include <gtest/gtest.h>

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

0 comments on commit 27a2b90

Please sign in to comment.