@@ -771,38 +771,45 @@ static std::vector<std::string> parseFirstRecordedAPI()
771
771
{
772
772
SWSS_LOG_ENTER ();
773
773
774
- const auto delimiter = ' |' ;
775
774
std::ifstream infile (SairedisRecFilename);
776
775
std::string line;
776
+
777
777
// skip first line
778
778
std::getline (infile, line);
779
779
std::getline (infile, line);
780
780
781
781
std::vector<std::string> tokens;
782
782
std::stringstream sstream (line);
783
783
std::string token;
784
+
785
+ const auto delimiter = ' |' ;
786
+
784
787
// skip first, it is a timestamp
785
788
std::getline (sstream, token, delimiter);
786
- while (std::getline (sstream, token, delimiter)) {
789
+
790
+ while (std::getline (sstream, token, delimiter))
791
+ {
787
792
tokens.push_back (token);
788
793
}
794
+
789
795
return tokens;
790
796
}
791
797
792
798
static void test_recorder_enum_value_capability_query_request (
793
- sai_object_id_t switch_id,
794
- sai_object_type_t object_type,
795
- sai_attr_id_t attr_id,
796
- const std::vector<std::string>& expectedOutput)
799
+ _In_ sai_object_id_t switch_id,
800
+ _In_ sai_object_type_t object_type,
801
+ _In_ sai_attr_id_t attr_id,
802
+ _In_ const std::vector<std::string>& expectedOutput)
797
803
{
798
804
SWSS_LOG_ENTER ();
799
805
800
806
remove (SairedisRecFilename.c_str ());
801
807
802
808
Recorder recorder;
809
+
803
810
recorder.enableRecording (true );
804
811
805
- sai_s32_list_t enum_values_capability {.count = 0 , .list = nullptr };
812
+ sai_s32_list_t enum_values_capability { .count = 0 , .list = nullptr };
806
813
807
814
recorder.recordQueryAattributeEnumValuesCapability (
808
815
switch_id,
@@ -812,24 +819,27 @@ static void test_recorder_enum_value_capability_query_request(
812
819
);
813
820
814
821
auto tokens = parseFirstRecordedAPI ();
822
+
815
823
ASSERT_EQ (tokens, expectedOutput);
816
824
}
817
825
818
826
static void test_recorder_enum_value_capability_query_response (
819
- sai_status_t status,
820
- sai_object_type_t object_type,
821
- sai_attr_id_t attr_id,
822
- std::vector<int32_t > enumList,
823
- const std::vector<std::string>& expectedOutput)
827
+ _In_ sai_status_t status,
828
+ _In_ sai_object_type_t object_type,
829
+ _In_ sai_attr_id_t attr_id,
830
+ _In_ std::vector<int32_t > enumList,
831
+ _In_ const std::vector<std::string>& expectedOutput)
824
832
{
825
833
SWSS_LOG_ENTER ();
826
834
827
835
remove (SairedisRecFilename.c_str ());
828
836
829
837
Recorder recorder;
838
+
830
839
recorder.enableRecording (true );
831
840
832
841
sai_s32_list_t enum_values_capability;
842
+
833
843
enum_values_capability.count = static_cast <int32_t >(enumList.size ());
834
844
enum_values_capability.list = enumList.data ();
835
845
@@ -841,6 +851,7 @@ static void test_recorder_enum_value_capability_query_response(
841
851
);
842
852
843
853
auto tokens = parseFirstRecordedAPI ();
854
+
844
855
ASSERT_EQ (tokens, expectedOutput);
845
856
}
846
857
@@ -859,6 +870,7 @@ static void test_recorder_enum_value_capability_query()
859
870
" SAI_DEBUG_COUNTER_ATTR_TYPE=0" ,
860
871
}
861
872
);
873
+
862
874
test_recorder_enum_value_capability_query_response (
863
875
SAI_STATUS_SUCCESS,
864
876
SAI_OBJECT_TYPE_DEBUG_COUNTER,
@@ -877,6 +889,7 @@ static void test_recorder_enum_value_capability_query()
877
889
" SAI_DEBUG_COUNTER_TYPE_SWITCH_IN_DROP_REASONS,SAI_DEBUG_COUNTER_TYPE_SWITCH_OUT_DROP_REASONS" ,
878
890
}
879
891
);
892
+
880
893
test_recorder_enum_value_capability_query_request (
881
894
1 ,
882
895
SAI_OBJECT_TYPE_DEBUG_COUNTER,
@@ -888,6 +901,7 @@ static void test_recorder_enum_value_capability_query()
888
901
" SAI_DEBUG_COUNTER_ATTR_IN_DROP_REASON_LIST=0" ,
889
902
}
890
903
);
904
+
891
905
test_recorder_enum_value_capability_query_response (
892
906
SAI_STATUS_SUCCESS,
893
907
SAI_OBJECT_TYPE_DEBUG_COUNTER,
0 commit comments