From 5b67e6b1dabe71c0df2120a3266a908bd123f2c9 Mon Sep 17 00:00:00 2001 From: kcudnik Date: Tue, 17 Aug 2021 12:17:44 +0200 Subject: [PATCH] Add virtual router tests --- unittest/vslib/Makefile.am | 1 + unittest/vslib/test_sai_vs_virtual_router.cpp | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 unittest/vslib/test_sai_vs_virtual_router.cpp diff --git a/unittest/vslib/Makefile.am b/unittest/vslib/Makefile.am index 535e9a05e5a4..0f803c4365df 100644 --- a/unittest/vslib/Makefile.am +++ b/unittest/vslib/Makefile.am @@ -52,6 +52,7 @@ testslibsaivs_SOURCES = main_libsaivs.cpp \ test_sai_vs_tunnel.cpp \ test_sai_vs_stp.cpp \ test_sai_vs_udf.cpp \ + test_sai_vs_virtual_router.cpp \ test_sai_vs_vlan.cpp \ test_sai_vs_hostif.cpp \ test_sai_vs_wred.cpp diff --git a/unittest/vslib/test_sai_vs_virtual_router.cpp b/unittest/vslib/test_sai_vs_virtual_router.cpp new file mode 100644 index 000000000000..88506311b185 --- /dev/null +++ b/unittest/vslib/test_sai_vs_virtual_router.cpp @@ -0,0 +1,23 @@ +#include + +extern "C" { +#include "sai.h" +} + +#include "swss/logger.h" + +TEST(libsaivs, virtual_router) +{ + sai_virtual_router_api_t *api = nullptr; + + sai_api_query(SAI_API_VIRTUAL_ROUTER, (void**)&api); + + EXPECT_NE(api, nullptr); + + sai_object_id_t id; + + EXPECT_NE(SAI_STATUS_SUCCESS, api->create_virtual_router(&id,0,0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_virtual_router(0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->set_virtual_router_attribute(0,0)); + EXPECT_NE(SAI_STATUS_SUCCESS, api->get_virtual_router_attribute(0,0,0)); +}