@@ -46,15 +46,20 @@ static std::unordered_map<string, sai_dash_eni_mac_override_type_t> sMacOverride
46
46
{ " dst_mac" , SAI_DASH_ENI_MAC_OVERRIDE_TYPE_DST_MAC}
47
47
};
48
48
49
- DashOrch::DashOrch (DBConnector *db, vector<string> &tableName, ZmqServer *zmqServer) :
49
+ DashOrch::DashOrch (DBConnector *db, vector<string> &tableName, DBConnector *app_state_db, ZmqServer *zmqServer) :
50
50
ZmqOrch(db, tableName, zmqServer),
51
51
m_eni_stat_manager(ENI_STAT_COUNTER_FLEX_COUNTER_GROUP, StatsMode::READ, ENI_STAT_FLEX_COUNTER_POLLING_INTERVAL_MS, false )
52
52
{
53
53
SWSS_LOG_ENTER ();
54
54
55
55
m_asic_db = std::shared_ptr<DBConnector>(new DBConnector (" ASIC_DB" , 0 ));
56
56
m_counter_db = std::shared_ptr<DBConnector>(new DBConnector (" COUNTERS_DB" , 0 ));
57
- m_eni_name_table = std::unique_ptr<Table>(new Table (m_counter_db.get (), COUNTERS_ENI_NAME_MAP));
57
+ m_eni_name_table = make_unique<Table>(m_counter_db.get (), COUNTERS_ENI_NAME_MAP);
58
+ dash_eni_result_table_ = make_unique<Table>(app_state_db, APP_DASH_ENI_TABLE_NAME);
59
+ dash_eni_route_result_table_ = make_unique<Table>(app_state_db, APP_DASH_ENI_ROUTE_TABLE_NAME);
60
+ dash_qos_result_table_ = make_unique<Table>(app_state_db, APP_DASH_QOS_TABLE_NAME);
61
+ dash_appliance_result_table_ = make_unique<Table>(app_state_db, APP_DASH_APPLIANCE_TABLE_NAME);
62
+ dash_routing_type_result_table_ = make_unique<Table>(app_state_db, APP_DASH_ROUTING_TYPE_TABLE_NAME);
58
63
59
64
if (gTraditionalFlexCounter )
60
65
{
@@ -260,11 +265,13 @@ void DashOrch::doTaskApplianceTable(ConsumerBase& consumer)
260
265
SWSS_LOG_ENTER ();
261
266
262
267
auto it = consumer.m_toSync .begin ();
268
+ uint32_t result;
263
269
while (it != consumer.m_toSync .end ())
264
270
{
265
271
KeyOpFieldsValuesTuple t = it->second ;
266
272
string appliance_id = kfvKey (t);
267
273
string op = kfvOp (t);
274
+ result = DASH_RESULT_SUCCESS;
268
275
269
276
if (op == SET_COMMAND)
270
277
{
@@ -283,14 +290,17 @@ void DashOrch::doTaskApplianceTable(ConsumerBase& consumer)
283
290
}
284
291
else
285
292
{
293
+ result = DASH_RESULT_FAILURE;
286
294
it++;
287
295
}
296
+ writeResultToDB (dash_appliance_result_table_, appliance_id, result);
288
297
}
289
298
else if (op == DEL_COMMAND)
290
299
{
291
300
if (removeApplianceEntry (appliance_id))
292
301
{
293
302
it = consumer.m_toSync .erase (it);
303
+ removeResultFromDB (dash_appliance_result_table_, appliance_id);
294
304
}
295
305
else
296
306
{
@@ -342,12 +352,14 @@ void DashOrch::doTaskRoutingTypeTable(ConsumerBase& consumer)
342
352
SWSS_LOG_ENTER ();
343
353
344
354
auto it = consumer.m_toSync .begin ();
355
+ uint32_t result;
345
356
while (it != consumer.m_toSync .end ())
346
357
{
347
358
KeyOpFieldsValuesTuple t = it->second ;
348
359
string routing_type_str = kfvKey (t);
349
360
string op = kfvOp (t);
350
361
dash::route_type::RoutingType routing_type;
362
+ result = DASH_RESULT_SUCCESS;
351
363
352
364
std::transform (routing_type_str.begin (), routing_type_str.end (), routing_type_str.begin (), ::toupper);
353
365
routing_type_str = " ROUTING_TYPE_" + routing_type_str;
@@ -376,14 +388,17 @@ void DashOrch::doTaskRoutingTypeTable(ConsumerBase& consumer)
376
388
}
377
389
else
378
390
{
391
+ result = DASH_RESULT_FAILURE;
379
392
it++;
380
393
}
394
+ writeResultToDB (dash_routing_type_result_table_, routing_type_str, result);
381
395
}
382
396
else if (op == DEL_COMMAND)
383
397
{
384
398
if (removeRoutingTypeEntry (routing_type))
385
399
{
386
400
it = consumer.m_toSync .erase (it);
401
+ removeResultFromDB (dash_routing_type_result_table_, routing_type_str);
387
402
}
388
403
else
389
404
{
@@ -677,14 +692,14 @@ void DashOrch::doTaskEniTable(ConsumerBase& consumer)
677
692
{
678
693
SWSS_LOG_ENTER ();
679
694
680
- const auto & tn = consumer.getTableName ();
681
-
682
695
auto it = consumer.m_toSync .begin ();
696
+ uint32_t result;
683
697
while (it != consumer.m_toSync .end ())
684
698
{
685
699
auto t = it->second ;
686
700
string eni = kfvKey (t);
687
701
string op = kfvOp (t);
702
+ result = DASH_RESULT_SUCCESS;
688
703
if (op == SET_COMMAND)
689
704
{
690
705
EniEntry entry;
@@ -702,14 +717,17 @@ void DashOrch::doTaskEniTable(ConsumerBase& consumer)
702
717
}
703
718
else
704
719
{
720
+ result = DASH_RESULT_FAILURE;
705
721
it++;
706
722
}
723
+ writeResultToDB (dash_eni_result_table_, eni, result);
707
724
}
708
725
else if (op == DEL_COMMAND)
709
726
{
710
727
if (removeEni (eni))
711
728
{
712
729
it = consumer.m_toSync .erase (it);
730
+ removeResultFromDB (dash_eni_result_table_, eni);
713
731
}
714
732
else
715
733
{
@@ -756,11 +774,13 @@ bool DashOrch::removeQosEntry(const string& qos_name)
756
774
void DashOrch::doTaskQosTable (ConsumerBase& consumer)
757
775
{
758
776
auto it = consumer.m_toSync .begin ();
777
+ uint32_t result;
759
778
while (it != consumer.m_toSync .end ())
760
779
{
761
780
KeyOpFieldsValuesTuple t = it->second ;
762
781
string qos_name = kfvKey (t);
763
782
string op = kfvOp (t);
783
+ result = DASH_RESULT_SUCCESS;
764
784
765
785
if (op == SET_COMMAND)
766
786
{
@@ -779,14 +799,17 @@ void DashOrch::doTaskQosTable(ConsumerBase& consumer)
779
799
}
780
800
else
781
801
{
802
+ result = DASH_RESULT_FAILURE;
782
803
it++;
783
804
}
805
+ writeResultToDB (dash_qos_result_table_, qos_name, result);
784
806
}
785
807
else if (op == DEL_COMMAND)
786
808
{
787
809
if (removeQosEntry (qos_name))
788
810
{
789
811
it = consumer.m_toSync .erase (it);
812
+ removeResultFromDB (dash_qos_result_table_, qos_name);
790
813
}
791
814
else
792
815
{
@@ -904,11 +927,13 @@ bool DashOrch::removeEniRoute(const std::string& eni)
904
927
void DashOrch::doTaskEniRouteTable (ConsumerBase& consumer)
905
928
{
906
929
auto it = consumer.m_toSync .begin ();
930
+ uint32_t result;
907
931
while (it != consumer.m_toSync .end ())
908
932
{
909
933
KeyOpFieldsValuesTuple t = it->second ;
910
934
string eni = kfvKey (t);
911
935
string op = kfvOp (t);
936
+ result = DASH_RESULT_SUCCESS;
912
937
913
938
if (op == SET_COMMAND)
914
939
{
@@ -927,14 +952,17 @@ void DashOrch::doTaskEniRouteTable(ConsumerBase& consumer)
927
952
}
928
953
else
929
954
{
955
+ result = DASH_RESULT_FAILURE;
930
956
it++;
931
957
}
958
+ writeResultToDB (dash_eni_route_result_table_, eni, result);
932
959
}
933
960
else if (op == DEL_COMMAND)
934
961
{
935
962
if (removeEniRoute (eni))
936
963
{
937
964
it = consumer.m_toSync .erase (it);
965
+ removeResultFromDB (dash_eni_route_result_table_, eni);
938
966
}
939
967
else
940
968
{
0 commit comments