Skip to content

Commit

Permalink
Add udf tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kcudnik committed Aug 23, 2021
1 parent 31a3613 commit 27bbde7
Show file tree
Hide file tree
Showing 2 changed files with 34 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 @@ -51,6 +51,7 @@ testslibsaivs_SOURCES = main_libsaivs.cpp \
test_sai_vs_tam.cpp \
test_sai_vs_tunnel.cpp \
test_sai_vs_stp.cpp \
test_sai_vs_udf.cpp \
test_sai_vs_vlan.cpp \
test_sai_vs_hostif.cpp \
test_sai_vs_wred.cpp
Expand Down
33 changes: 33 additions & 0 deletions unittest/vslib/test_sai_vs_udf.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include <gtest/gtest.h>

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

#include "swss/logger.h"

TEST(libsaivs, udf)
{
sai_udf_api_t *api = nullptr;

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

EXPECT_NE(api, nullptr);

sai_object_id_t id;

EXPECT_NE(SAI_STATUS_SUCCESS, api->create_udf(&id,0,0,0));
EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_udf(0));
EXPECT_NE(SAI_STATUS_SUCCESS, api->set_udf_attribute(0,0));
EXPECT_NE(SAI_STATUS_SUCCESS, api->get_udf_attribute(0,0,0));

EXPECT_NE(SAI_STATUS_SUCCESS, api->create_udf_match(&id,0,0,0));
EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_udf_match(0));
EXPECT_NE(SAI_STATUS_SUCCESS, api->set_udf_match_attribute(0,0));
EXPECT_NE(SAI_STATUS_SUCCESS, api->get_udf_match_attribute(0,0,0));

EXPECT_NE(SAI_STATUS_SUCCESS, api->create_udf_group(&id,0,0,0));
EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_udf_group(0));
EXPECT_NE(SAI_STATUS_SUCCESS, api->set_udf_group_attribute(0,0));
EXPECT_NE(SAI_STATUS_SUCCESS, api->get_udf_group_attribute(0,0,0));
}

0 comments on commit 27bbde7

Please sign in to comment.