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

Implementation of System ports initialization, Interface & Neighbor Synchronization... #1431

Merged
merged 30 commits into from Jan 17, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
30c8a0c
[voq] Redis instance for global app db
Sep 10, 2020
bfb6f2f
[voq] System port init and orchestration
Sep 10, 2020
ee967d9
[voq] Router interface for system ports, global app db sync
Sep 10, 2020
45942e7
[voq] Inband interface config
Sep 10, 2020
10771a8
[voq] System port neighbors
Sep 10, 2020
2ca2a00
[swss] Review comments fixes
Sep 29, 2020
8e235e6
[swss]Code review comments fix 2
Oct 1, 2020
52fe3e1
Merge branch 'master' into chassis-voq-pr1
vganesan-nokia Oct 1, 2020
1b6d62f
Merge branch 'master' into chassis-voq-pr1
vganesan-nokia Oct 11, 2020
8704004
[swss] voq code review comment fix 3
Oct 12, 2020
8b68af4
[swss] voq code review comments fixes 4
Oct 13, 2020
52972b6
[swss] Voq code review comments fixes 5
Oct 22, 2020
b6fe4e6
Merge branch 'master' into chassis-voq-pr1
vganesan-nokia Nov 3, 2020
34e9f68
[swss]VS tests for VOQ system ports
Nov 9, 2020
a42d3f5
[vstest]Voq switch test - removed chassis_db.json
Nov 20, 2020
8922f46
[vstest]VOQ switch system ports test
Nov 21, 2020
d9df781
[swss]VOQ Code review comments fix 6
Nov 21, 2020
39b1858
Merge branch 'master' into chassis-voq-pr1
vganesan-nokia Nov 30, 2020
21b7cd6
Merge branch 'master' into chassis-voq-pr1
vganesan-nokia Dec 2, 2020
233a1be
[swss]vs test for voq neighbor
Dec 3, 2020
e9fc950
[swss]vs test for voq nbr review comments fix 1
Dec 8, 2020
ae86130
[swss]vs test for voq nbr review comments fix 2
Dec 9, 2020
2d090d5
Merge branch 'master' into chassis-voq-pr1
vganesan-nokia Dec 18, 2020
d93ea79
[systemport]VOQ system port code review comments fix - 7
Dec 22, 2020
40fb3fc
[systemport] VS test chgs in code review comments fix - 7 reverted
Dec 22, 2020
a5c2533
Merge branch 'master' into chassis-voq-pr1
vganesan-nokia Dec 23, 2020
96d5a71
[systemport] Rebase to master, neighorch conflict fix
Dec 23, 2020
5878628
Merge remote-tracking branch 'vganesan-nokia/master' into chassis-voq…
Jan 12, 2021
0ab5d95
Merge remote-tracking branch 'origin/master' into chassis-voq-pr1
Jan 15, 2021
08b256b
[voq] azure-pipeline armhf build error fix
Jan 15, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions cfgmgr/intfmgr.cpp
Expand Up @@ -627,6 +627,8 @@ void IntfMgr::doTask(Consumer &consumer)
{
SWSS_LOG_ENTER();

string table_name = consumer.getTableName();

auto it = consumer.m_toSync.begin();
while (it != consumer.m_toSync.end())
{
Expand All @@ -638,6 +640,16 @@ void IntfMgr::doTask(Consumer &consumer)

if (keys.size() == 1)
{
if((table_name == CFG_VOQ_INBAND_INTERFACE_TABLE_NAME) &&
(op == SET_COMMAND))
{
//No further processing needed. Just relay to orchagent
m_appIntfTableProducer.set(keys[0], data);
m_stateIntfTable.hset(keys[0], "vrf", "");

it = consumer.m_toSync.erase(it);
continue;
}
if (!doIntfGeneralTask(keys, data, op))
{
it++;
Expand Down
1 change: 1 addition & 0 deletions cfgmgr/intfmgrd.cpp
Expand Up @@ -47,6 +47,7 @@ int main(int argc, char **argv)
CFG_VLAN_INTF_TABLE_NAME,
CFG_LOOPBACK_INTERFACE_TABLE_NAME,
CFG_VLAN_SUB_INTF_TABLE_NAME,
CFG_VOQ_INBAND_INTERFACE_TABLE_NAME,
};

DBConnector cfgDb("CONFIG_DB", 0);
Expand Down
133 changes: 132 additions & 1 deletion orchagent/intfsorch.cpp
Expand Up @@ -16,6 +16,7 @@
#include "bufferorch.h"
#include "directory.h"
#include "vnetorch.h"
#include "subscriberstatetable.h"

extern sai_object_id_t gVirtualRouterId;
extern Directory<Orch*> gDirectory;
Expand All @@ -32,6 +33,8 @@ extern RouteOrch *gRouteOrch;
extern CrmOrch *gCrmOrch;
extern BufferOrch *gBufferOrch;
extern bool gIsNatSupported;
extern NeighOrch *gNeighOrch;
extern string gMySwitchType;

const int intfsorch_pri = 35;

Expand All @@ -52,7 +55,7 @@ static const vector<sai_router_interface_stat_t> rifStatIds =
SAI_ROUTER_INTERFACE_STAT_OUT_ERROR_OCTETS,
};

IntfsOrch::IntfsOrch(DBConnector *db, string tableName, VRFOrch *vrf_orch) :
IntfsOrch::IntfsOrch(DBConnector *db, string tableName, VRFOrch *vrf_orch, DBConnector *chassisAppDb) :
Orch(db, tableName, intfsorch_pri), m_vrfOrch(vrf_orch)
{
SWSS_LOG_ENTER();
Expand Down Expand Up @@ -96,6 +99,15 @@ IntfsOrch::IntfsOrch(DBConnector *db, string tableName, VRFOrch *vrf_orch) :
{
SWSS_LOG_WARN("RIF flex counter group plugins was not set successfully: %s", e.what());
}

if(gMySwitchType == "voq")
{
//Add subscriber to process VOQ system interface
tableName = CHASSIS_APP_SYSTEM_INTERFACE_TABLE_NAME;
Orch::addExecutor(new Consumer(new SubscriberStateTable(chassisAppDb, tableName, TableConsumable::DEFAULT_POP_BATCH_SIZE, 0), this, tableName));
m_tableVoqSystemInterfaceTable = unique_ptr<Table>(new Table(chassisAppDb, CHASSIS_APP_SYSTEM_INTERFACE_TABLE_NAME));
}

}

sai_object_id_t IntfsOrch::getRouterIntfsId(const string &alias)
Expand Down Expand Up @@ -430,6 +442,15 @@ bool IntfsOrch::setIntf(const string& alias, sai_object_id_t vrf_id, const IpPre

addIp2MeRoute(port.m_vr_id, *ip_prefix);

if(gMySwitchType == "voq")
{
if(gPortsOrch->isInbandPort(alias))
{
//Need to sync the inband intf neighbor for other asics
gNeighOrch->addInbandNeighbor(alias, ip_prefix->getIp());
}
}

if (port.m_type == Port::VLAN)
{
addDirectedBroadcast(port, *ip_prefix);
Expand All @@ -453,6 +474,14 @@ bool IntfsOrch::removeIntf(const string& alias, sai_object_id_t vrf_id, const Ip
{
removeIp2MeRoute(port.m_vr_id, *ip_prefix);

if(gMySwitchType == "voq")
{
if(gPortsOrch->isInbandPort(alias))
{
gNeighOrch->delInbandNeighbor(alias, ip_prefix->getIp());
}
}

if(port.m_type == Port::VLAN)
{
removeDirectedBroadcast(port, *ip_prefix);
Expand Down Expand Up @@ -497,6 +526,8 @@ void IntfsOrch::doTask(Consumer &consumer)
return;
}

string table_name = consumer.getTableName();

auto it = consumer.m_toSync.begin();
while (it != consumer.m_toSync.end())
{
Expand All @@ -521,6 +552,16 @@ void IntfsOrch::doTask(Consumer &consumer)
ip_prefix_in_key = true;
}

if(table_name == CHASSIS_APP_SYSTEM_INTERFACE_TABLE_NAME)
{
if(!isRemoteSystemPortIntf(alias))
{
//Synced local interface. Skip
it = consumer.m_toSync.erase(it);
continue;
}
}

const vector<FieldValueTuple>& data = kfvFieldsValues(t);
string vrf_name = "", vnet_name = "", nat_zone = "";
MacAddress mac;
Expand All @@ -529,6 +570,7 @@ void IntfsOrch::doTask(Consumer &consumer)
bool adminUp;
uint32_t nat_zone_id = 0;
string proxy_arp = "";
string inband_type = "";

for (auto idx : data)
{
Expand Down Expand Up @@ -608,6 +650,10 @@ void IntfsOrch::doTask(Consumer &consumer)
{
proxy_arp = value;
}
else if (field == "inband_type")
{
inband_type = value;
}
}

if (alias == "eth0" || alias == "docker0")
Expand Down Expand Up @@ -661,6 +707,16 @@ void IntfsOrch::doTask(Consumer &consumer)
continue;
}

//Voq Inband interface config processing
if(inband_type.size() && !ip_prefix_in_key)
{
if(!gPortsOrch->setVoqInbandIntf(alias, inband_type))
{
it++;
continue;
}
}

Port port;
if (!gPortsOrch->getPort(alias, port))
{
Expand Down Expand Up @@ -895,6 +951,7 @@ bool IntfsOrch::addRouterIntfs(sai_object_id_t vrf_id, Port &port)
{
case Port::PHY:
case Port::LAG:
case Port::SYSTEM:
attr.value.s32 = SAI_ROUTER_INTERFACE_TYPE_PORT;
attrs.push_back(attr);
break;
Expand All @@ -914,6 +971,7 @@ bool IntfsOrch::addRouterIntfs(sai_object_id_t vrf_id, Port &port)
switch(port.m_type)
{
case Port::PHY:
case Port::SYSTEM:
attr.id = SAI_ROUTER_INTERFACE_ATTR_PORT_ID;
attr.value.oid = port.m_port_id;
attrs.push_back(attr);
Expand Down Expand Up @@ -978,6 +1036,12 @@ bool IntfsOrch::addRouterIntfs(sai_object_id_t vrf_id, Port &port)

SWSS_LOG_NOTICE("Create router interface %s MTU %u", port.m_alias.c_str(), port.m_mtu);

if(gMySwitchType == "voq")
{
//Sync the interface to add to the SYSTEM_INTERFACE table of CHASSIS_APP_DB
minionatwork marked this conversation as resolved.
Show resolved Hide resolved
voqSyncAddIntf(port.m_alias);
}

return true;
}

Expand Down Expand Up @@ -1008,6 +1072,12 @@ bool IntfsOrch::removeRouterIntfs(Port &port)

SWSS_LOG_NOTICE("Remove router interface for port %s", port.m_alias.c_str());

if(gMySwitchType == "voq")
{
//Sync the interface to del from the SYSTEM_INTERFACE table of CHASSIS_APP_DB
voqSyncDelIntf(port.m_alias);
}

return true;
}

Expand Down Expand Up @@ -1230,6 +1300,7 @@ void IntfsOrch::doTask(SelectableTimer &timer)
{
case Port::PHY:
case Port::LAG:
case Port::SYSTEM:
type = "SAI_ROUTER_INTERFACE_TYPE_PORT";
break;
case Port::VLAN:
Expand All @@ -1255,3 +1326,63 @@ void IntfsOrch::doTask(SelectableTimer &timer)
}
}
}

bool IntfsOrch::isRemoteSystemPortIntf(string alias)
{
Port port;
if(gPortsOrch->getPort(alias, port))
{
return(port.m_system_port_info.type == SAI_SYSTEM_PORT_TYPE_REMOTE);
}
//Given alias is system port alias of the local port
return false;
}

void IntfsOrch::voqSyncAddIntf(string &alias)
{
//Sync only local interface. Confirm for the local interface and
//get the system port alias for key for syncing to CHASSIS_APP_DB
Port port;
if(gPortsOrch->getPort(alias, port))
{
if(port.m_system_port_info.type == SAI_SYSTEM_PORT_TYPE_REMOTE)
{
return;
}
alias = port.m_system_port_info.alias;
}
else
{
SWSS_LOG_ERROR("Port does not exist for %s!", alias.c_str());
return;
}

FieldValueTuple nullFv ("NULL", "NULL");
vector<FieldValueTuple> attrs;
attrs.push_back(nullFv);

m_tableVoqSystemInterfaceTable->set(alias, attrs);
}

void IntfsOrch::voqSyncDelIntf(string &alias)
{
//Sync only local interface. Confirm for the local interface and
//get the system port alias for key for syncing to CHASSIS_APP_DB
Port port;
if(gPortsOrch->getPort(alias, port))
{
if(port.m_system_port_info.type == SAI_SYSTEM_PORT_TYPE_REMOTE)
{
return;
}
alias = port.m_system_port_info.alias;
}
else
{
SWSS_LOG_ERROR("Port does not exist for %s!", alias.c_str());
return;
}

m_tableVoqSystemInterfaceTable->del(alias);
}

9 changes: 8 additions & 1 deletion orchagent/intfsorch.h
Expand Up @@ -32,7 +32,7 @@ typedef map<string, IntfsEntry> IntfsTable;
class IntfsOrch : public Orch
{
public:
IntfsOrch(DBConnector *db, string tableName, VRFOrch *vrf_orch);
IntfsOrch(DBConnector *db, string tableName, VRFOrch *vrf_orch, DBConnector *chassisAppDb);

sai_object_id_t getRouterIntfsId(const string&);
bool isPrefixSubnet(const IpPrefix&, const string&);
Expand Down Expand Up @@ -64,6 +64,8 @@ class IntfsOrch : public Orch

bool updateSyncdIntfPfx(const string &alias, const IpPrefix &ip_prefix, bool add = true);

bool isRemoteSystemPortIntf(string alias);

private:

SelectableTimer* m_updateMapsTimer = nullptr;
Expand Down Expand Up @@ -94,6 +96,11 @@ class IntfsOrch : public Orch

bool setIntfVlanFloodType(const Port &port, sai_vlan_flood_control_type_t vlan_flood_type);
bool setIntfProxyArp(const string &alias, const string &proxy_arp);

unique_ptr<Table> m_tableVoqSystemInterfaceTable;
void voqSyncAddIntf(string &alias);
void voqSyncDelIntf(string &alias);

};

#endif /* SWSS_INTFSORCH_H */