From 5dd5e36d4855efc1591d63d3c5e2f4841fe21f14 Mon Sep 17 00:00:00 2001 From: Marian Pritsak Date: Wed, 4 Oct 2017 21:59:41 +0300 Subject: [PATCH] [portsorch]: Use sai_serialize api to write to DB (#331) Keep object IDs serializeable in database, so that they can be reused later by client code --- orchagent/portsorch.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/orchagent/portsorch.cpp b/orchagent/portsorch.cpp index 3d9a7deba83a..8f34bb8f939c 100644 --- a/orchagent/portsorch.cpp +++ b/orchagent/portsorch.cpp @@ -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; @@ -549,9 +550,7 @@ bool PortsOrch::initPort(const string &alias, const set &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 vector; vector.push_back(tuple); m_counterTable->set("", vector);