@@ -274,13 +274,7 @@ namespace flexcounter_test
274274 sai_switch_api = pold_sai_switch_api;
275275 }
276276
277- enum class StartType
278- {
279- Cold,
280- Warm,
281- };
282-
283- struct FlexCounterTest : public ::testing::TestWithParam<std::tuple<bool , bool , StartType>>
277+ struct FlexCounterTest : public ::testing::TestWithParam<std::tuple<bool , bool , uint32_t >>
284278 {
285279 shared_ptr<swss::DBConnector> m_app_db;
286280 shared_ptr<swss::DBConnector> m_config_db;
@@ -290,7 +284,6 @@ namespace flexcounter_test
290284 shared_ptr<swss::DBConnector> m_asic_db;
291285 shared_ptr<swss::DBConnector> m_flex_counter_db;
292286 bool create_only_config_db_buffers;
293- StartType m_start_type;
294287
295288 FlexCounterTest ()
296289 {
@@ -317,7 +310,7 @@ namespace flexcounter_test
317310
318311 gTraditionalFlexCounter = get<0 >(GetParam ());
319312 create_only_config_db_buffers = get<1 >(GetParam ());
320- m_start_type = get<2 >(GetParam ());
313+ gFlexCounterDelaySec = get<2 >(GetParam ());
321314
322315 if (gTraditionalFlexCounter )
323316 {
@@ -364,18 +357,8 @@ namespace flexcounter_test
364357 CFG_FLEX_COUNTER_TABLE_NAME
365358 };
366359
367- if (m_start_type == StartType::Warm)
368- {
369- WarmStart::getInstance ().m_enabled = true ;
370- }
371-
372360 auto * flexCounterOrch = new FlexCounterOrch (m_config_db.get (), flex_counter_tables);
373361
374- if (m_start_type == StartType::Warm)
375- {
376- WarmStart::getInstance ().m_enabled = false ;
377- }
378-
379362 gDirectory .set (flexCounterOrch);
380363
381364 vector<string> buffer_tables = { APP_BUFFER_POOL_TABLE_NAME,
@@ -441,6 +424,9 @@ namespace flexcounter_test
441424 gDirectory .m_values .clear ();
442425
443426 _unhook_sai_switch_api ();
427+
428+ // reset flex counter delay sec
429+ gFlexCounterDelaySec = 0 ;
444430 }
445431
446432 static void SetUpTestCase ()
@@ -641,7 +627,7 @@ namespace flexcounter_test
641627 flexCounterOrch->addExistingData (&flexCounterCfg);
642628 static_cast <Orch *>(flexCounterOrch)->doTask ();
643629
644- if (m_start_type == StartType::Warm )
630+ if (gFlexCounterDelaySec > 0 )
645631 {
646632 // Expire timer
647633 flexCounterOrch->doTask (*flexCounterOrch->m_delayTimer );
@@ -1015,14 +1001,16 @@ namespace flexcounter_test
10151001 FlexCounterTests,
10161002 FlexCounterTest,
10171003 ::testing::Values (
1018- std::make_tuple (false , true , StartType::Cold),
1019- std::make_tuple(false , false , StartType::Cold),
1020- std::make_tuple(true , true , StartType::Cold),
1021- std::make_tuple(true , false , StartType::Cold),
1022- std::make_tuple(false , true , StartType::Warm),
1023- std::make_tuple(false , false , StartType::Warm),
1024- std::make_tuple(true , true , StartType::Warm),
1025- std::make_tuple(true , false , StartType::Warm))
1004+ // traditional_flex_counter, create_only_config_db_buffers, flex_counter_delay_sec
1005+ std::make_tuple (false , true , 0 ),
1006+ std::make_tuple(false , false , 0 ),
1007+ std::make_tuple(true , true , 0 ),
1008+ std::make_tuple(true , false , 0 ),
1009+ std::make_tuple(false , true , 120 ),
1010+ std::make_tuple(false , false , 120 ),
1011+ std::make_tuple(true , true , 120 ),
1012+ std::make_tuple(true , false , 120 )
1013+ )
10261014 );
10271015
10281016 using namespace mock_orch_test ;
0 commit comments