From 24e3d92a2c9dbc9604bbb07c800462e779af4306 Mon Sep 17 00:00:00 2001 From: kcudnik Date: Mon, 16 Aug 2021 21:04:52 +0200 Subject: [PATCH] Add sample packet tests --- unittest/vslib/Makefile.am | 1 + .../vslib/test_sai_vs_router_samplepacket.cpp | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 unittest/vslib/test_sai_vs_router_samplepacket.cpp diff --git a/unittest/vslib/Makefile.am b/unittest/vslib/Makefile.am index 3e517be31f1a..302b97d40d47 100644 --- a/unittest/vslib/Makefile.am +++ b/unittest/vslib/Makefile.am @@ -42,6 +42,7 @@ testslibsaivs_SOURCES = main_libsaivs.cpp \ test_sai_vs_route.cpp \ test_sai_vs_router_interface.cpp \ test_sai_vs_router_rpfgroup.cpp \ + test_sai_vs_router_samplepacket.cpp \ test_sai_vs_vlan.cpp \ test_sai_vs_hostif.cpp \ test_sai_vs_wred.cpp diff --git a/unittest/vslib/test_sai_vs_router_samplepacket.cpp b/unittest/vslib/test_sai_vs_router_samplepacket.cpp new file mode 100644 index 000000000000..0747132ca552 --- /dev/null +++ b/unittest/vslib/test_sai_vs_router_samplepacket.cpp @@ -0,0 +1,23 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaivs, samplepacket) +{ + sai_samplepacket_api_t *api = nullptr; + + sai_api_query(SAI_API_SAMPLEPACKET, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_samplepacket(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_samplepacket(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_samplepacket_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_samplepacket_attribute(0,0,0)); +}