Skip to content

Commit 0caa6a4

Browse files
Cleanup
Signed-off-by: Prabhat Aravind <[email protected]>
1 parent 03ed716 commit 0caa6a4

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

orchagent/dash/dashrouteorch.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,7 @@ void DashRouteOrch::doTaskRouteGroupTable(ConsumerBase& consumer)
807807
if (op == SET_COMMAND)
808808
{
809809
dash::route_group::RouteGroup entry;
810+
string version = entry.version();
810811
if (!parsePbMessage(kfvFieldsValues(t), entry))
811812
{
812813
SWSS_LOG_WARN("Requires protobuf at RouteGroup :%s", route_group.c_str());
@@ -823,7 +824,7 @@ void DashRouteOrch::doTaskRouteGroupTable(ConsumerBase& consumer)
823824
result = 1;
824825
it++;
825826
}
826-
writeResultToDB(dash_route_group_result_table_, route_group, result);
827+
writeResultToDB(dash_route_group_result_table_, route_group, result, version);
827828
}
828829
else if (op == DEL_COMMAND)
829830
{

orchagent/saihelper.cpp

+14-15
Original file line numberDiff line numberDiff line change
@@ -1136,15 +1136,8 @@ std::vector<sai_stat_id_t> queryAvailableCounterStats(const sai_object_type_t ob
11361136
return stat_list;
11371137
}
11381138

1139-
FieldValueTuple makeResultDbEntry(uint32_t res)
1140-
{
1141-
auto field = "result";
1142-
auto value = std::to_string(res);
1143-
1144-
return FieldValueTuple(field, value);
1145-
}
1146-
1147-
void writeResultToDB(const std::unique_ptr<swss::Table>& table, const string& key, uint32_t res)
1139+
void writeResultToDB(const std::unique_ptr<swss::Table>& table, const string& key,
1140+
uint32_t res, const string& version)
11481141
{
11491142
SWSS_LOG_ENTER();
11501143

@@ -1154,12 +1147,17 @@ void writeResultToDB(const std::unique_ptr<swss::Table>& table, const string& ke
11541147
return;
11551148
}
11561149

1157-
std::vector<FieldValueTuple> fvList = {
1158-
makeResultDbEntry(res)
1159-
};
1150+
std::vector<FieldValueTuple> fvVector;
1151+
1152+
fvVector.emplace_back("result", std::to_string(res));
1153+
1154+
if (!version.empty())
1155+
{
1156+
fvVector.emplace_back("version", version);
1157+
}
11601158

1161-
table->set(key, fvList);
1162-
SWSS_LOG_NOTICE("Wrote result to DB for key %s", key.c_str());
1159+
table->set(key, fvVector);
1160+
SWSS_LOG_INFO("Wrote result to DB for key %s", key.c_str());
11631161
}
11641162

11651163
void removeResultFromDB(const std::unique_ptr<swss::Table>& table, const string& key)
@@ -1172,5 +1170,6 @@ void removeResultFromDB(const std::unique_ptr<swss::Table>& table, const string&
11721170
return;
11731171
}
11741172

1175-
table_->del(key);
1173+
table->del(key);
1174+
SWSS_LOG_INFO("Removed result from DB for key %s", key.c_str());
11761175
}

orchagent/saihelper.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,6 @@ void stopFlexCounterPolling(sai_object_id_t switch_oid,
5151
const std::string &key);
5252

5353
std::vector<sai_stat_id_t> queryAvailableCounterStats(const sai_object_type_t);
54-
swss::FieldValueTuple makeResultDbEntry(uint32_t res);
55-
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);
54+
void writeResultToDB(const std::unique_ptr<swss::Table>&, const std::string& key,
55+
uint32_t res, const std::string& version="");
56+
void removeResultFromDB(const std::unique_ptr<swss::Table>& table, const std::string& key);

0 commit comments

Comments
 (0)