Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "net/if.h"

#include "logger.h"
#include "schema.h"

extern sai_switch_api_t *sai_switch_api;
extern sai_port_api_t *sai_port_api;
Expand All @@ -23,6 +24,10 @@ PortsOrch::PortsOrch(DBConnector *db, vector<string> tableNames) :
{
SWSS_LOG_ENTER();

/* Initialize Counter Table */
DBConnector *counter_db = new DBConnector(COUNTERS_DB, "localhost", 6379, 0);
m_counterTable = new Table(counter_db, COUNTERS_PORT_NAME_MAP);

int i, j;
sai_status_t status;
sai_attribute_t attr;
Expand Down Expand Up @@ -244,6 +249,14 @@ void PortsOrch::doPortTask(Consumer &consumer)
{
/* 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());
vector<FieldValueTuple> vector;
vector.push_back(tuple);
m_counterTable->set("", vector);

SWSS_LOG_NOTICE("Port is initialized alias:%s\n", alias.c_str());

}
Expand Down
2 changes: 2 additions & 0 deletions orchagent/portsorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class PortsOrch : public Orch
void setPort(string alias, Port port);

private:
Table *m_counterTable;

bool m_initDone = false;
sai_object_id_t m_cpuPort;

Expand Down