From 7e14891e87341b4033c5920d3e59b53a6aed8415 Mon Sep 17 00:00:00 2001 From: vedganes Date: Mon, 21 Dec 2020 13:42:34 -0500 Subject: [PATCH] [inbandif]VOQ Inband intf support - code review comments fix - 1 Signed-off-by: vedganes Fixed code review comments: - Added comment to delInbandNeighbor() to indicate this is for local inband interface - Used hardcoded "Inband" prefix - Reverted to net dev link up event detection using IFF_LOWER_UP flag - Renamed "oper_status" of net dev to "netdev_oper_status" in the state db PORT_TABLE. --- cfgmgr/nbrmgr.cpp | 4 ++-- orchagent/neighorch.cpp | 3 ++- portsyncd/linksync.cpp | 9 +++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/cfgmgr/nbrmgr.cpp b/cfgmgr/nbrmgr.cpp index 16ff6dde0ac..042f5b88b33 100644 --- a/cfgmgr/nbrmgr.cpp +++ b/cfgmgr/nbrmgr.cpp @@ -444,11 +444,11 @@ bool NbrMgr::isIntfOperUp(const string &alias) { string oper; - if (m_statePortTable.hget(alias, "oper_status", oper)) + if (m_statePortTable.hget(alias, "netdev_oper_status", oper)) { if (oper == "up") { - SWSS_LOG_DEBUG("Intf %s is oper up", alias.c_str()); + SWSS_LOG_DEBUG("NetDev %s is oper up", alias.c_str()); return true; } } diff --git a/orchagent/neighorch.cpp b/orchagent/neighorch.cpp index 038d65146af..28f768da936 100644 --- a/orchagent/neighorch.cpp +++ b/orchagent/neighorch.cpp @@ -1245,7 +1245,8 @@ bool NeighOrch::addInbandNeighbor(string alias, IpAddress ip_address) bool NeighOrch::delInbandNeighbor(string alias, IpAddress ip_address) { - //Remove neighbor from SAI + // Remove local inband neighbor from SAI + if(gIntfsOrch->isRemoteSystemPortIntf(alias)) { //Remote Inband interface. Skip diff --git a/portsyncd/linksync.cpp b/portsyncd/linksync.cpp index dd49ff74c7d..c9f95e22add 100644 --- a/portsyncd/linksync.cpp +++ b/portsyncd/linksync.cpp @@ -30,6 +30,7 @@ using namespace swss; const string MGMT_PREFIX = "eth"; const string INTFS_PREFIX = "Ethernet"; const string LAG_PREFIX = "PortChannel"; +const string INBAND_PREFIX = "Inband"; extern set g_portSet; extern bool g_init; @@ -165,18 +166,17 @@ void LinkSync::onMsg(int nlmsg_type, struct nl_object *obj) struct rtnl_link *link = (struct rtnl_link *)obj; string key = rtnl_link_get_name(link); - vector temp; if (key.compare(0, INTFS_PREFIX.length(), INTFS_PREFIX) && key.compare(0, LAG_PREFIX.length(), LAG_PREFIX) && key.compare(0, MGMT_PREFIX.length(), MGMT_PREFIX) && - !m_portTable.get(key, temp)) + key.compare(0, INBAND_PREFIX.length(), INBAND_PREFIX)) { return; } unsigned int flags = rtnl_link_get_flags(link); bool admin = flags & IFF_UP; - bool oper = flags & IFF_RUNNING; + bool oper = flags & IFF_LOWER_UP; char addrStr[MAX_ADDR_SIZE+1] = {0}; nl_addr2str(rtnl_link_get_addr(link), addrStr, MAX_ADDR_SIZE); @@ -248,13 +248,14 @@ void LinkSync::onMsg(int nlmsg_type, struct nl_object *obj) /* front panel interfaces: Check if the port is in the PORT_TABLE * non-front panel interfaces such as eth0, lo which are not in the * PORT_TABLE are ignored. */ + vector temp; if (m_portTable.get(key, temp)) { g_portSet.erase(key); FieldValueTuple tuple("state", "ok"); vector vector; vector.push_back(tuple); - FieldValueTuple op("oper_status", oper ? "up" : "down"); + FieldValueTuple op("netdev_oper_status", oper ? "up" : "down"); vector.push_back(op); m_statePortTable.set(key, vector); SWSS_LOG_NOTICE("Publish %s(ok:%s) to state db", key.c_str(), oper ? "up" : "down");