Skip to content

Commit

Permalink
[portsorch]: Use sai_serialize api to write to DB (sonic-net#331)
Browse files Browse the repository at this point in the history
Keep object IDs serializeable in database,
so that they can be reused later by client code
  • Loading branch information
marian-pritsak authored and Shuotian Cheng committed Oct 4, 2017
1 parent f208eb7 commit 5dd5e36
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "logger.h"
#include "schema.h"
#include "converter.h"
#include "saiserialize.h"

extern sai_switch_api_t *sai_switch_api;
extern sai_bridge_api_t *sai_bridge_api;
Expand Down Expand Up @@ -549,9 +550,7 @@ bool PortsOrch::initPort(const string &alias, const set<int> &lane_set)
/* Add port to port list */
m_portList[alias] = p;
/* Add port name map to counter table */
std::stringstream ss;
ss << hex << p.m_port_id;
FieldValueTuple tuple(p.m_alias, ss.str());
FieldValueTuple tuple(p.m_alias, sai_serialize_object_id(p.m_port_id));
vector<FieldValueTuple> vector;
vector.push_back(tuple);
m_counterTable->set("", vector);
Expand Down

0 comments on commit 5dd5e36

Please sign in to comment.