Skip to content

Commit 03ed716

Browse files
More changes
Signed-off-by: Prabhat Aravind <[email protected]>
1 parent 5825cec commit 03ed716

File tree

5 files changed

+45
-1
lines changed

5 files changed

+45
-1
lines changed

orchagent/dash/dashorch.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -279,12 +279,14 @@ void DashOrch::doTaskApplianceTable(ConsumerBase& consumer)
279279
result = 1;
280280
it++;
281281
}
282+
writeResultToDB(dash_appliance_result_table_, appliance_id, result);
282283
}
283284
else if (op == DEL_COMMAND)
284285
{
285286
if (removeApplianceEntry(appliance_id))
286287
{
287288
it = consumer.m_toSync.erase(it);
289+
removeResultFromDB(dash_appliance_result_table_, appliance_id);
288290
}
289291
else
290292
{
@@ -376,12 +378,14 @@ void DashOrch::doTaskRoutingTypeTable(ConsumerBase& consumer)
376378
result = 1;
377379
it++;
378380
}
381+
writeResultToDB(dash_routing_type_result_table_, routing_type_str, result);
379382
}
380383
else if (op == DEL_COMMAND)
381384
{
382385
if (removeRoutingTypeEntry(routing_type))
383386
{
384387
it = consumer.m_toSync.erase(it);
388+
removeResultFromDB(dash_routing_type_result_table_, routing_type_str);
385389
}
386390
else
387391
{
@@ -704,12 +708,14 @@ void DashOrch::doTaskEniTable(ConsumerBase& consumer)
704708
result = 1;
705709
it++;
706710
}
711+
writeResultToDB(dash_eni_result_table_, eni, result);
707712
}
708713
else if (op == DEL_COMMAND)
709714
{
710715
if (removeEni(eni))
711716
{
712717
it = consumer.m_toSync.erase(it);
718+
removeResultFromDB(dash_eni_result_table_, eni);
713719
}
714720
else
715721
{
@@ -785,12 +791,14 @@ void DashOrch::doTaskQosTable(ConsumerBase& consumer)
785791
result = 1;
786792
it++;
787793
}
794+
writeResultToDB(dash_eni_qos_table_, qos_name, result);
788795
}
789796
else if (op == DEL_COMMAND)
790797
{
791798
if (removeQosEntry(qos_name))
792799
{
793800
it = consumer.m_toSync.erase(it);
801+
removeResultFromDB(dash_eni_qos_table_, qos_name);
794802
}
795803
else
796804
{
@@ -937,12 +945,14 @@ void DashOrch::doTaskEniRouteTable(ConsumerBase& consumer)
937945
result = 1;
938946
it++;
939947
}
948+
writeResultToDB(dash_eni_route_result_table_, eni, result);
940949
}
941950
else if (op == DEL_COMMAND)
942951
{
943952
if (removeEniRoute(eni))
944953
{
945954
it = consumer.m_toSync.erase(it);
955+
removeResultFromDB(dash_eni_route_result_table_, eni);
946956
}
947957
else
948958
{

orchagent/dash/dashrouteorch.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -372,12 +372,14 @@ void DashRouteOrch::doTaskRouteTable(ConsumerBase& consumer)
372372
result = 1;
373373
it_prev++;
374374
}
375+
writeResultToDB(dash_route_result_table_, key, result);
375376
}
376377
else if (op == DEL_COMMAND)
377378
{
378379
if (removeOutboundRoutingPost(key, ctxt))
379380
{
380381
it_prev = consumer.m_toSync.erase(it_prev);
382+
removeResultFromDB(dash_route_result_table_, key);
381383
}
382384
else
383385
{
@@ -655,12 +657,14 @@ void DashRouteOrch::doTaskRouteRuleTable(ConsumerBase& consumer)
655657
result = 1;
656658
it_prev++;
657659
}
660+
writeResultToDB(dash_route_rule_result_table_, key, result);
658661
}
659662
else if (op == DEL_COMMAND)
660663
{
661664
if (removeInboundRoutingPost(key, ctxt))
662665
{
663666
it_prev = consumer.m_toSync.erase(it_prev);
667+
removeResultFromDB(dash_route_rule_result_table_, key);
664668
}
665669
else
666670
{
@@ -819,12 +823,14 @@ void DashRouteOrch::doTaskRouteGroupTable(ConsumerBase& consumer)
819823
result = 1;
820824
it++;
821825
}
826+
writeResultToDB(dash_route_group_result_table_, route_group, result);
822827
}
823828
else if (op == DEL_COMMAND)
824829
{
825830
if (removeRouteGroup(route_group))
826831
{
827832
it = consumer.m_toSync.erase(it);
833+
removeResultFromDB(dash_route_group_result_table_, route_group);
828834
}
829835
else
830836
{

orchagent/dash/dashvnetorch.cpp

+9-1
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ void DashVnetOrch::doTaskVnetTable(ConsumerBase& consumer)
235235

236236
string key = kfvKey(t);
237237
string op = kfvOp(t);
238+
uint32_t result = 0;
238239
auto found = toBulk.find(make_pair(key, op));
239240
if (found == toBulk.end())
240241
{
@@ -259,8 +260,10 @@ void DashVnetOrch::doTaskVnetTable(ConsumerBase& consumer)
259260
}
260261
else
261262
{
263+
result = 1;
262264
it_prev++;
263265
}
266+
writeResultToDB(dash_vnet_result_table_, key, result);
264267
}
265268
else if (op == DEL_COMMAND)
266269
{
@@ -272,6 +275,7 @@ void DashVnetOrch::doTaskVnetTable(ConsumerBase& consumer)
272275
if (removeVnetPost(key, vnet_ctxt))
273276
{
274277
it_prev = consumer.m_toSync.erase(it_prev);
278+
removeResultFromDB(dash_vnet_result_table_, key);
275279
}
276280
else
277281
{
@@ -293,7 +297,7 @@ bool DashVnetOrch::addOutboundCaToPa(const string& key, VnetMapBulkContext& ctxt
293297
auto& object_statuses = ctxt.outbound_ca_to_pa_object_statuses;
294298
sai_attribute_t outbound_ca_to_pa_attr;
295299
vector<sai_attribute_t> outbound_ca_to_pa_attrs;
296-
300+
297301
DashOrch* dash_orch = gDirectory.get<DashOrch*>();
298302
dash::route_type::RouteType route_type_actions;
299303
if (!dash_orch->getRouteTypeActions(ctxt.metadata.routing_type(), route_type_actions))
@@ -784,6 +788,7 @@ void DashVnetOrch::doTaskVnetMapTable(ConsumerBase& consumer)
784788
KeyOpFieldsValuesTuple t = it_prev->second;
785789
string key = kfvKey(t);
786790
string op = kfvOp(t);
791+
uint32_t result = 0;
787792
auto found = toBulk.find(make_pair(key, op));
788793
if (found == toBulk.end())
789794
{
@@ -808,14 +813,17 @@ void DashVnetOrch::doTaskVnetMapTable(ConsumerBase& consumer)
808813
}
809814
else
810815
{
816+
result = 1;
811817
it_prev++;
812818
}
819+
writeResultToDB(dash_vnet_map_result_table_, key, result);
813820
}
814821
else if (op == DEL_COMMAND)
815822
{
816823
if (removeVnetMapPost(key, ctxt))
817824
{
818825
it_prev = consumer.m_toSync.erase(it_prev);
826+
removeResultFromDB(dash_vnet_map_result_table_, key);
819827
}
820828
else
821829
{

orchagent/saihelper.cpp

+19
Original file line numberDiff line numberDiff line change
@@ -1148,10 +1148,29 @@ void writeResultToDB(const std::unique_ptr<swss::Table>& table, const string& ke
11481148
{
11491149
SWSS_LOG_ENTER();
11501150

1151+
if (!table)
1152+
{
1153+
SWSS_LOG_WARN("Table passed in is NULL");
1154+
return;
1155+
}
1156+
11511157
std::vector<FieldValueTuple> fvList = {
11521158
makeResultDbEntry(res)
11531159
};
11541160

11551161
table->set(key, fvList);
11561162
SWSS_LOG_NOTICE("Wrote result to DB for key %s", key.c_str());
11571163
}
1164+
1165+
void removeResultFromDB(const std::unique_ptr<swss::Table>& table, const string& key)
1166+
{
1167+
SWSS_LOG_ENTER();
1168+
1169+
if (!table)
1170+
{
1171+
SWSS_LOG_WARN("Table passed in is NULL");
1172+
return;
1173+
}
1174+
1175+
table_->del(key);
1176+
}

orchagent/saihelper.h

+1
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,4 @@ void stopFlexCounterPolling(sai_object_id_t switch_oid,
5353
std::vector<sai_stat_id_t> queryAvailableCounterStats(const sai_object_type_t);
5454
swss::FieldValueTuple makeResultDbEntry(uint32_t res);
5555
void writeResultToDB(const std::unique_ptr<swss::Table>&, const std::string& key, uint32_t res);
56+
void removeResultFromDB(const std::unique_ptr<swss::Table>& table, const string& key);

0 commit comments

Comments
 (0)