File tree 4 files changed +71
-1
lines changed
4 files changed +71
-1
lines changed Original file line number Diff line number Diff line change @@ -207,6 +207,8 @@ AC_MSG_ERROR("SAI headers API version and library version mismatch")])])
207
207
CXXFLAGS="$SAVED_FLAGS"
208
208
] )] )
209
209
210
+ AC_CHECK_FUNCS ( sai_bulk_object_clear_stats sai_bulk_object_get_stats )
211
+
210
212
AC_OUTPUT (Makefile
211
213
meta/Makefile
212
214
lib/Makefile
Original file line number Diff line number Diff line change @@ -661,6 +661,7 @@ sai_status_t VendorSai::bulkGetStats(
661
661
SWSS_LOG_ENTER ();
662
662
VENDOR_CHECK_API_INITIALIZED ();
663
663
664
+ #ifdef HAVE_SAI_BULK_OBJECT_GET_STATS
664
665
return sai_bulk_object_get_stats (
665
666
switchId,
666
667
object_type,
@@ -671,6 +672,9 @@ sai_status_t VendorSai::bulkGetStats(
671
672
mode,
672
673
object_statuses,
673
674
counters);
675
+ #else // For vendors do not support this API
676
+ return SAI_STATUS_NOT_IMPLEMENTED;
677
+ #endif
674
678
}
675
679
676
680
sai_status_t VendorSai::bulkClearStats (
@@ -687,6 +691,7 @@ sai_status_t VendorSai::bulkClearStats(
687
691
SWSS_LOG_ENTER ();
688
692
VENDOR_CHECK_API_INITIALIZED ();
689
693
694
+ #ifdef HAVE_SAI_BULK_OBJECT_CLEAR_STATS
690
695
return sai_bulk_object_clear_stats (
691
696
switchId,
692
697
object_type,
@@ -696,6 +701,9 @@ sai_status_t VendorSai::bulkClearStats(
696
701
counter_ids,
697
702
mode,
698
703
object_statuses);
704
+ #else // For vendors do not support this API
705
+ return SAI_STATUS_NOT_IMPLEMENTED;
706
+ #endif
699
707
}
700
708
701
709
// BULK QUAD OID
Original file line number Diff line number Diff line change @@ -11,7 +11,8 @@ tests_SOURCES = main.cpp \
11
11
TestCommandLineOptions.cpp \
12
12
TestFlexCounter.cpp \
13
13
TestVirtualOidTranslator.cpp \
14
- TestNotificationQueue.cpp
14
+ TestNotificationQueue.cpp \
15
+ TestVendorSai.cpp
15
16
16
17
tests_CXXFLAGS = $(DBGFLAGS ) $(AM_CXXFLAGS ) $(CXXFLAGS_COMMON )
17
18
tests_LDADD = $(LDADD_GTEST ) $(top_srcdir ) /syncd/libSyncd.a $(top_srcdir ) /vslib/libSaiVS.a -lhiredis -lswsscommon -lnl-genl-3 -lnl-nf-3 -lnl-route-3 -lnl-3 -lpthread -L$(top_srcdir ) /lib/.libs -lsairedis -L$(top_srcdir ) /meta/.libs -lsaimetadata -lsaimeta -lzmq $(CODE_COVERAGE_LIBS )
Original file line number Diff line number Diff line change
1
+ #include < gtest/gtest.h>
2
+ #include " VendorSai.h"
3
+ #include " swss/logger.h"
4
+
5
+ #ifdef HAVE_SAI_BULK_OBJECT_GET_STATS
6
+ #undef HAVE_SAI_BULK_OBJECT_GET_STATS
7
+ #endif
8
+
9
+ using namespace syncd ;
10
+
11
+ static const char * profile_get_value (
12
+ _In_ sai_switch_profile_id_t profile_id,
13
+ _In_ const char * variable)
14
+ {
15
+ SWSS_LOG_ENTER ();
16
+
17
+ if (variable == NULL )
18
+ return NULL ;
19
+
20
+ return nullptr ;
21
+ }
22
+
23
+ static int profile_get_next_value (
24
+ _In_ sai_switch_profile_id_t profile_id,
25
+ _Out_ const char ** variable,
26
+ _Out_ const char ** value)
27
+ {
28
+ SWSS_LOG_ENTER ();
29
+
30
+ return 0 ;
31
+ }
32
+
33
+ static sai_service_method_table_t test_services = {
34
+ profile_get_value,
35
+ profile_get_next_value
36
+ };
37
+
38
+ TEST (VendorSai, bulkGetStats)
39
+ {
40
+ VendorSai sai;
41
+ sai.initialize (0 , &test_services);
42
+ ASSERT_EQ (SAI_STATUS_NOT_IMPLEMENTED, sai.bulkGetStats (SAI_NULL_OBJECT_ID,
43
+ SAI_OBJECT_TYPE_PORT,
44
+ 0 ,
45
+ nullptr ,
46
+ 0 ,
47
+ nullptr ,
48
+ SAI_STATS_MODE_BULK_READ_AND_CLEAR,
49
+ nullptr ,
50
+ nullptr ));
51
+ ASSERT_EQ (SAI_STATUS_NOT_IMPLEMENTED, sai.bulkClearStats (SAI_NULL_OBJECT_ID,
52
+ SAI_OBJECT_TYPE_PORT,
53
+ 0 ,
54
+ nullptr ,
55
+ 0 ,
56
+ nullptr ,
57
+ SAI_STATS_MODE_BULK_READ_AND_CLEAR,
58
+ nullptr ));
59
+ }
You can’t perform that action at this time.
0 commit comments