Skip to content

Commit

Permalink
EVPN VxLAN enhancement to support P2MP tunnel based programming for L…
Browse files Browse the repository at this point in the history
…ayer2 extension (sonic-net#1858)

* Vxlan evpn p2mp changes for Layer2 functionality
  • Loading branch information
dgsudharsan authored Oct 20, 2021
1 parent 85bdf54 commit b0aa6a0
Show file tree
Hide file tree
Showing 17 changed files with 3,184 additions and 1,878 deletions.
49 changes: 37 additions & 12 deletions orchagent/fdborch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -760,18 +760,33 @@ void FdbOrch::doTask(Consumer& consumer)
}
}

/* FDB type is either dynamic or static */
assert(type == "dynamic" || type == "dynamic_local" || type == "static" );

if(origin == FDB_ORIGIN_VXLAN_ADVERTIZED)
{
VxlanTunnelOrch* tunnel_orch = gDirectory.get<VxlanTunnelOrch*>();

if(!remote_ip.length())
if (tunnel_orch->isDipTunnelsSupported())
{
it = consumer.m_toSync.erase(it);
continue;
if(!remote_ip.length())
{
it = consumer.m_toSync.erase(it);
continue;
}
port = tunnel_orch->getTunnelPortName(remote_ip);
}
else
{
EvpnNvoOrch* evpn_nvo_orch = gDirectory.get<EvpnNvoOrch*>();
VxlanTunnel* sip_tunnel = evpn_nvo_orch->getEVPNVtep();
if (sip_tunnel == NULL)
{
it = consumer.m_toSync.erase(it);
continue;
}
port = tunnel_orch->getTunnelPortName(sip_tunnel->getSrcIP().to_string(), true);
}
port = tunnel_orch->getTunnelPortName(remote_ip);
}


Expand Down Expand Up @@ -804,8 +819,6 @@ void FdbOrch::doTask(Consumer& consumer)
}
port = tunnel_orch->getTunnelPortName(remote_ip);
}


it = consumer.m_toSync.erase(it);
}
else
Expand Down Expand Up @@ -1125,11 +1138,14 @@ bool FdbOrch::addFdbEntry(const FdbEntry& entry, const string& port_name,
{
Port vlan;
Port port;
string end_point_ip = "";

VxlanTunnelOrch* tunnel_orch = gDirectory.get<VxlanTunnelOrch*>();

SWSS_LOG_ENTER();
SWSS_LOG_INFO("mac=%s bv_id=0x%" PRIx64 " port_name=%s type=%s origin=%d",
SWSS_LOG_INFO("mac=%s bv_id=0x%" PRIx64 " port_name=%s type=%s origin=%d remote_ip=%s",
entry.mac.to_string().c_str(), entry.bv_id, port_name.c_str(),
fdbData.type.c_str(), fdbData.origin);
fdbData.type.c_str(), fdbData.origin, fdbData.remote_ip.c_str());

if (!m_portsOrch->getPort(entry.bv_id, vlan))
{
Expand All @@ -1146,8 +1162,14 @@ bool FdbOrch::addFdbEntry(const FdbEntry& entry, const string& port_name,
return true;
}

/* Assign end point IP only in SIP tunnel scenario since Port + IP address
needed to uniquely identify Vlan member */
if (!tunnel_orch->isDipTunnelsSupported())
{
end_point_ip = fdbData.remote_ip;
}
/* Retry until port is member of vlan*/
if (vlan.m_members.find(port_name) == vlan.m_members.end())
if (!m_portsOrch->isVlanMember(vlan, port, end_point_ip))
{
SWSS_LOG_INFO("Saving a fdb entry until port %s becomes vlan %s member", port_name.c_str(), vlan.m_alias.c_str());
saved_fdb_entries[port_name].push_back({entry.mac,
Expand All @@ -1163,6 +1185,7 @@ bool FdbOrch::addFdbEntry(const FdbEntry& entry, const string& port_name,

Port oldPort;
string oldType;
string oldRemoteIp;
FdbOrigin oldOrigin = FDB_ORIGIN_INVALID ;
bool macUpdate = false;

Expand All @@ -1172,19 +1195,21 @@ bool FdbOrch::addFdbEntry(const FdbEntry& entry, const string& port_name,
/* get existing port and type */
oldType = it->second.type;
oldOrigin = it->second.origin;
oldRemoteIp = it->second.remote_ip;

if (!m_portsOrch->getPortByBridgePortId(it->second.bridge_port_id, oldPort))
{
SWSS_LOG_ERROR("Existing port 0x%" PRIx64 " details not found", it->second.bridge_port_id);
return false;
}

if ((oldOrigin == fdbData.origin) && (oldType == fdbData.type) && (port.m_bridge_port_id == it->second.bridge_port_id))
if ((oldOrigin == fdbData.origin) && (oldType == fdbData.type) && (port.m_bridge_port_id == it->second.bridge_port_id)
&& (oldRemoteIp == fdbData.remote_ip))
{
/* Duplicate Mac */
SWSS_LOG_INFO("FdbOrch: mac=%s %s port=%s type=%s origin=%d is duplicate", entry.mac.to_string().c_str(),
SWSS_LOG_INFO("FdbOrch: mac=%s %s port=%s type=%s origin=%d remote_ip=%s is duplicate", entry.mac.to_string().c_str(),
vlan.m_alias.c_str(), port_name.c_str(),
fdbData.type.c_str(), fdbData.origin);
fdbData.type.c_str(), fdbData.origin, fdbData.remote_ip.c_str());
return true;
}
else if (fdbData.origin != oldOrigin)
Expand Down
17 changes: 14 additions & 3 deletions orchagent/orchdaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ bool OrchDaemon::init()
VxlanVrfMapOrch *vxlan_vrf_orch = new VxlanVrfMapOrch(m_applDb, APP_VXLAN_VRF_TABLE_NAME);
gDirectory.set(vxlan_vrf_orch);

EvpnRemoteVniOrch* evpn_remote_vni_orch = new EvpnRemoteVniOrch(m_applDb, APP_VXLAN_REMOTE_VNI_TABLE_NAME);
gDirectory.set(evpn_remote_vni_orch);

EvpnNvoOrch* evpn_nvo_orch = new EvpnNvoOrch(m_applDb, APP_VXLAN_EVPN_NVO_TABLE_NAME);
gDirectory.set(evpn_nvo_orch);
Expand Down Expand Up @@ -373,7 +371,20 @@ bool OrchDaemon::init()
m_orchList.push_back(vxlan_tunnel_orch);
m_orchList.push_back(evpn_nvo_orch);
m_orchList.push_back(vxlan_tunnel_map_orch);
m_orchList.push_back(evpn_remote_vni_orch);

if (vxlan_tunnel_orch->isDipTunnelsSupported())
{
EvpnRemoteVnip2pOrch* evpn_remote_vni_orch = new EvpnRemoteVnip2pOrch(m_applDb, APP_VXLAN_REMOTE_VNI_TABLE_NAME);
gDirectory.set(evpn_remote_vni_orch);
m_orchList.push_back(evpn_remote_vni_orch);
}
else
{
EvpnRemoteVnip2mpOrch* evpn_remote_vni_orch = new EvpnRemoteVnip2mpOrch(m_applDb, APP_VXLAN_REMOTE_VNI_TABLE_NAME);
gDirectory.set(evpn_remote_vni_orch);
m_orchList.push_back(evpn_remote_vni_orch);
}

m_orchList.push_back(vxlan_vrf_orch);
m_orchList.push_back(cfg_vnet_rt_orch);
m_orchList.push_back(vnet_orch);
Expand Down
6 changes: 6 additions & 0 deletions orchagent/port.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,17 @@ struct VlanMemberEntry

typedef std::map<sai_vlan_id_t, VlanMemberEntry> vlan_members_t;

typedef std::map<std::string, sai_object_id_t> endpoint_ip_l2mc_group_member_map_t;

struct VlanInfo
{
sai_object_id_t vlan_oid = 0;
sai_vlan_id_t vlan_id = 0;
sai_object_id_t host_intf_id = SAI_NULL_OBJECT_ID;
sai_vlan_flood_control_type_t uuc_flood_type = SAI_VLAN_FLOOD_CONTROL_TYPE_ALL;
sai_vlan_flood_control_type_t bc_flood_type = SAI_VLAN_FLOOD_CONTROL_TYPE_ALL;
sai_object_id_t l2mc_group_id = SAI_NULL_OBJECT_ID;
endpoint_ip_l2mc_group_member_map_t l2mc_members;
};

struct SystemPortInfo
Expand Down
Loading

0 comments on commit b0aa6a0

Please sign in to comment.