Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[orchagent]: Remove updating APP_DB port oper_status logic from orchagent #192

Merged
merged 1 commit into from
Apr 19, 2017
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
6 changes: 5 additions & 1 deletion orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ bool PortsOrch::isInitDone()

bool PortsOrch::getPort(string alias, Port &p)
{
SWSS_LOG_ENTER();

if (m_portList.find(alias) == m_portList.end())
return false;
p = m_portList[alias];
Expand All @@ -163,6 +165,8 @@ bool PortsOrch::getPort(string alias, Port &p)

bool PortsOrch::getPort(sai_object_id_t id, Port &port)
{
SWSS_LOG_ENTER();

for (const auto& portIter: m_portList)
{
switch (portIter.second.m_type)
Expand Down Expand Up @@ -255,7 +259,7 @@ void PortsOrch::updateDbPortOperStatus(sai_object_id_t id, sai_port_oper_status_
if (it->second.m_port_id == id)
{
vector<FieldValueTuple> vector;
FieldValueTuple tuple("oper_status", to_string(status));
FieldValueTuple tuple("oper_status", oper_status_strings.at(status));
vector.push_back(tuple);
m_portTable->set(it->first, vector);
}
Expand Down
9 changes: 9 additions & 0 deletions orchagent/portsorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@

#include <map>

static const map<sai_port_oper_status_t, string> oper_status_strings =
{
{ SAI_PORT_OPER_STATUS_UNKNOWN, "unknown" },
{ SAI_PORT_OPER_STATUS_UP, "up" },
{ SAI_PORT_OPER_STATUS_DOWN, "down" },
{ SAI_PORT_OPER_STATUS_TESTING, "testing" },
{ SAI_PORT_OPER_STATUS_NOT_PRESENT, "not present" }
};

struct LagMemberUpdate
{
Port lag;
Expand Down
4 changes: 2 additions & 2 deletions portsyncd/linksync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,8 @@ void LinkSync::onMsg(int nlmsg_type, struct nl_object *obj)

vector<FieldValueTuple> fvVector;
FieldValueTuple a("admin_status", admin ? "up" : "down");
FieldValueTuple o("oper_status", oper ? "up" : "down");
FieldValueTuple m("mtu", to_string(mtu));
fvVector.push_back(a);
fvVector.push_back(o);
fvVector.push_back(m);

/* VLAN interfaces: Check if the type is bridge */
Expand All @@ -180,6 +178,8 @@ void LinkSync::onMsg(int nlmsg_type, struct nl_object *obj)
}
else
{
FieldValueTuple o("oper_status", oper ? "up" : "down");
fvVector.push_back(o);
m_vlanTableProducer.set(key, fvVector);
}
return;
Expand Down