Skip to content

Commit

Permalink
[voq/systemlag] Voq system lag functionality (#1605)
Browse files Browse the repository at this point in the history
* [voq/systemlag] VOQ System lag functionality

Signed-off-by: vedganes <vedavinayagam.ganesan@nokia.com>

Changes for voq system lag implementation
(1) Portsorch changes for allocating unique lag id from chassis ap pdb
and sending the id in system port aggregator id attribute while creating
lag local LAG
(2) Portsorch changes to synd local LAG and local LAG members to
chassis app db. The sync-ing includes the allocated unique system lag id
(3) Portsorch changes to process remote system lag from chassis app db
and create lag entry in local asic db with received system lag id
(4) Interface orch changes to identify local or remote interfaces
(for both port and lag)
(5) Orchdaemon changes in orchagent intialization to get hostname and
asic_name attributes from DEVICE_METATDATA. These are used for unique
system lag name derivation

* [vog/systemlag] VS test for system lag
  • Loading branch information
vganesan-nokia authored Mar 31, 2021
1 parent fa983d2 commit 691bd30
Show file tree
Hide file tree
Showing 16 changed files with 780 additions and 36 deletions.
6 changes: 4 additions & 2 deletions orchagent/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ dist_swss_DATA = \
port_rates.lua \
watermark_queue.lua \
watermark_pg.lua \
watermark_bufferpool.lua
watermark_bufferpool.lua \
lagids.lua

bin_PROGRAMS = orchagent routeresync orchagent_restart_check

Expand Down Expand Up @@ -62,7 +63,8 @@ orchagent_SOURCES = \
debugcounterorch.cpp \
natorch.cpp \
muxorch.cpp \
macsecorch.cpp
macsecorch.cpp \
lagid.cpp

orchagent_SOURCES += flex_counter/flex_counter_manager.cpp flex_counter/flex_counter_stat_manager.cpp
orchagent_SOURCES += debug_counter/debug_counter.cpp debug_counter/drop_counter.cpp
Expand Down
42 changes: 35 additions & 7 deletions orchagent/intfsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ extern BufferOrch *gBufferOrch;
extern bool gIsNatSupported;
extern NeighOrch *gNeighOrch;
extern string gMySwitchType;
extern int32_t gVoqMySwitchId;

const int intfsorch_pri = 35;

Expand Down Expand Up @@ -1410,9 +1411,14 @@ bool IntfsOrch::isRemoteSystemPortIntf(string alias)
Port port;
if(gPortsOrch->getPort(alias, port))
{
if (port.m_type == Port::LAG)
{
return(port.m_system_lag_info.switch_id != gVoqMySwitchId);
}

return(port.m_system_port_info.type == SAI_SYSTEM_PORT_TYPE_REMOTE);
}
//Given alias is system port alias of the local port
//Given alias is system port alias of the local port/LAG
return false;
}

Expand All @@ -1423,11 +1429,22 @@ void IntfsOrch::voqSyncAddIntf(string &alias)
Port port;
if(gPortsOrch->getPort(alias, port))
{
if(port.m_system_port_info.type == SAI_SYSTEM_PORT_TYPE_REMOTE)
if (port.m_type == Port::LAG)
{
return;
if (port.m_system_lag_info.switch_id != gVoqMySwitchId)
{
return;
}
alias = port.m_system_lag_info.alias;
}
else
{
if(port.m_system_port_info.type == SAI_SYSTEM_PORT_TYPE_REMOTE)
{
return;
}
alias = port.m_system_port_info.alias;
}
alias = port.m_system_port_info.alias;
}
else
{
Expand All @@ -1449,11 +1466,22 @@ void IntfsOrch::voqSyncDelIntf(string &alias)
Port port;
if(gPortsOrch->getPort(alias, port))
{
if(port.m_system_port_info.type == SAI_SYSTEM_PORT_TYPE_REMOTE)
if (port.m_type == Port::LAG)
{
return;
if (port.m_system_lag_info.switch_id != gVoqMySwitchId)
{
return;
}
alias = port.m_system_lag_info.alias;
}
else
{
if(port.m_system_port_info.type == SAI_SYSTEM_PORT_TYPE_REMOTE)
{
return;
}
alias = port.m_system_port_info.alias;
}
alias = port.m_system_port_info.alias;
}
else
{
Expand Down
30 changes: 30 additions & 0 deletions orchagent/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ string gMySwitchType = "";
int32_t gVoqMySwitchId = -1;
int32_t gVoqMaxCores = 0;
uint32_t gCfgSystemPorts = 0;
string gMyHostName = "";
string gMyAsicName = "";

void usage()
{
Expand Down Expand Up @@ -212,6 +214,34 @@ bool getSystemPortConfigList(DBConnector *cfgDb, DBConnector *appDb, vector<sai_
return false;
}

if (!cfgDeviceMetaDataTable.hget("localhost", "hostname", value))
{
// hostname is not configured.
SWSS_LOG_ERROR("Host name is not configured");
return false;
}
gMyHostName = value;

if (!gMyHostName.size())
{
SWSS_LOG_ERROR("Invalid host name %s configured", gMyHostName.c_str());
return false;
}

if (!cfgDeviceMetaDataTable.hget("localhost", "asic_name", value))
{
// asic_name is not configured.
SWSS_LOG_ERROR("Asic name is not configured");
return false;
}
gMyAsicName = value;

if (!gMyAsicName.size())
{
SWSS_LOG_ERROR("Invalid asic name %s configured", gMyAsicName.c_str());
return false;
}

vector<string> spKeys;
cfgSystemPortTable.getKeys(spKeys);

Expand Down
37 changes: 29 additions & 8 deletions orchagent/neighorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ extern RouteOrch *gRouteOrch;
extern FgNhgOrch *gFgNhgOrch;
extern Directory<Orch*> gDirectory;
extern string gMySwitchType;
extern int32_t gVoqMySwitchId;

const int neighorch_pri = 30;

Expand Down Expand Up @@ -1116,7 +1117,6 @@ void NeighOrch::doVoqSystemNeighTask(Consumer &consumer)
}
else
{
SWSS_LOG_ERROR("Failed to add voq neighbor %s to SAI", kfvKey(t).c_str());
it++;
}
}
Expand All @@ -1141,7 +1141,6 @@ void NeighOrch::doVoqSystemNeighTask(Consumer &consumer)
}
else
{
SWSS_LOG_ERROR("Failed to remove voq neighbor %s from SAI", kfvKey(t).c_str());
it++;
}
}
Expand Down Expand Up @@ -1232,11 +1231,22 @@ void NeighOrch::voqSyncAddNeigh(string &alias, IpAddress &ip_address, const MacA
Port port;
if(gPortsOrch->getPort(alias, port))
{
if(port.m_system_port_info.type == SAI_SYSTEM_PORT_TYPE_REMOTE)
if (port.m_type == Port::LAG)
{
return;
if (port.m_system_lag_info.switch_id != gVoqMySwitchId)
{
return;
}
alias = port.m_system_lag_info.alias;
}
else
{
if(port.m_system_port_info.type == SAI_SYSTEM_PORT_TYPE_REMOTE)
{
return;
}
alias = port.m_system_port_info.alias;
}
alias = port.m_system_port_info.alias;
}
else
{
Expand Down Expand Up @@ -1278,11 +1288,22 @@ void NeighOrch::voqSyncDelNeigh(string &alias, IpAddress &ip_address)
Port port;
if(gPortsOrch->getPort(alias, port))
{
if(port.m_system_port_info.type == SAI_SYSTEM_PORT_TYPE_REMOTE)
if (port.m_type == Port::LAG)
{
return;
if (port.m_system_lag_info.switch_id != gVoqMySwitchId)
{
return;
}
alias = port.m_system_lag_info.alias;
}
else
{
if(port.m_system_port_info.type == SAI_SYSTEM_PORT_TYPE_REMOTE)
{
return;
}
alias = port.m_system_port_info.alias;
}
alias = port.m_system_port_info.alias;
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion orchagent/orchdaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ bool OrchDaemon::init()
};

gCrmOrch = new CrmOrch(m_configDb, CFG_CRM_TABLE_NAME);
gPortsOrch = new PortsOrch(m_applDb, ports_tables);
gPortsOrch = new PortsOrch(m_applDb, ports_tables, m_chassisAppDb);
TableConnector stateDbFdb(m_stateDb, STATE_FDB_TABLE_NAME);
gFdbOrch = new FdbOrch(m_applDb, app_fdb_tables, stateDbFdb, gPortsOrch);

Expand Down
8 changes: 8 additions & 0 deletions orchagent/port.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ struct SystemPortInfo
uint32_t num_voq = 8;
};

struct SystemLagInfo
{
std::string alias = "";
int32_t switch_id = -1;
int32_t spa_id = 0;
};

class Port
{
public:
Expand Down Expand Up @@ -142,6 +149,7 @@ class Port

sai_object_id_t m_system_port_oid = 0;
SystemPortInfo m_system_port_info;
SystemLagInfo m_system_lag_info;

};

Expand Down
Loading

0 comments on commit 691bd30

Please sign in to comment.