Skip to content

Commit

Permalink
Add dtel tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kcudnik committed Aug 23, 2021
1 parent b56c601 commit 8af035b
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
2 changes: 2 additions & 0 deletions unittest/vslib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ testslibsaivs_SOURCES = main_libsaivs.cpp \
test_sai_vs_bridge.cpp \
test_sai_vs_buffer.cpp \
test_sai_vs_counter.cpp \
test_sai_vs_debug_counter.cpp \
test_sai_vs_dtel.cpp \
test_sai_vs_hash.cpp \
test_sai_vs_vlan.cpp \
test_sai_vs_hostif.cpp \
Expand Down
23 changes: 23 additions & 0 deletions unittest/vslib/test_sai_vs_debug_counter.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <gtest/gtest.h>

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

#include "swss/logger.h"

TEST(libsaivs, debug_counter)
{
sai_debug_counter_api_t *api = nullptr;

sai_api_query(SAI_API_DEBUG_COUNTER, (void**)&api);

EXPECT_NE(api, nullptr);

sai_object_id_t id;

EXPECT_NE(SAI_STATUS_SUCCESS, api->create_debug_counter(&id,0,0,0));
EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_debug_counter(0));
EXPECT_NE(SAI_STATUS_SUCCESS, api->set_debug_counter_attribute(0,0));
EXPECT_NE(SAI_STATUS_SUCCESS, api->get_debug_counter_attribute(0,0,0));
}
43 changes: 43 additions & 0 deletions unittest/vslib/test_sai_vs_dtel.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#include <gtest/gtest.h>

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

#include "swss/logger.h"

TEST(libsaivs, dtel)
{
sai_dtel_api_t *api = nullptr;

sai_api_query(SAI_API_DTEL, (void**)&api);

EXPECT_NE(api, nullptr);

sai_object_id_t id;

EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dtel(&id,0,0,0));
EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dtel(0));
EXPECT_NE(SAI_STATUS_SUCCESS, api->set_dtel_attribute(0,0));
EXPECT_NE(SAI_STATUS_SUCCESS, api->get_dtel_attribute(0,0,0));

EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dtel_queue_report(&id,0,0,0));
EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dtel_queue_report(0));
EXPECT_NE(SAI_STATUS_SUCCESS, api->set_dtel_queue_report_attribute(0,0));
EXPECT_NE(SAI_STATUS_SUCCESS, api->get_dtel_queue_report_attribute(0,0,0));

EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dtel_int_session(&id,0,0,0));
EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dtel_int_session(0));
EXPECT_NE(SAI_STATUS_SUCCESS, api->set_dtel_int_session_attribute(0,0));
EXPECT_NE(SAI_STATUS_SUCCESS, api->get_dtel_int_session_attribute(0,0,0));

EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dtel_report_session(&id,0,0,0));
EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dtel_report_session(0));
EXPECT_NE(SAI_STATUS_SUCCESS, api->set_dtel_report_session_attribute(0,0));
EXPECT_NE(SAI_STATUS_SUCCESS, api->get_dtel_report_session_attribute(0,0,0));

EXPECT_NE(SAI_STATUS_SUCCESS, api->create_dtel_event(&id,0,0,0));
EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_dtel_event(0));
EXPECT_NE(SAI_STATUS_SUCCESS, api->set_dtel_event_attribute(0,0));
EXPECT_NE(SAI_STATUS_SUCCESS, api->get_dtel_event_attribute(0,0,0));
}

0 comments on commit 8af035b

Please sign in to comment.