Skip to content

Commit b0aa6a0

Browse files
authored
EVPN VxLAN enhancement to support P2MP tunnel based programming for Layer2 extension (sonic-net#1858)
* Vxlan evpn p2mp changes for Layer2 functionality
1 parent 85bdf54 commit b0aa6a0

17 files changed

+3184
-1878
lines changed

orchagent/fdborch.cpp

+37-12
Original file line numberDiff line numberDiff line change
@@ -760,18 +760,33 @@ void FdbOrch::doTask(Consumer& consumer)
760760
}
761761
}
762762

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

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

769-
if(!remote_ip.length())
770+
if (tunnel_orch->isDipTunnelsSupported())
770771
{
771-
it = consumer.m_toSync.erase(it);
772-
continue;
772+
if(!remote_ip.length())
773+
{
774+
it = consumer.m_toSync.erase(it);
775+
continue;
776+
}
777+
port = tunnel_orch->getTunnelPortName(remote_ip);
778+
}
779+
else
780+
{
781+
EvpnNvoOrch* evpn_nvo_orch = gDirectory.get<EvpnNvoOrch*>();
782+
VxlanTunnel* sip_tunnel = evpn_nvo_orch->getEVPNVtep();
783+
if (sip_tunnel == NULL)
784+
{
785+
it = consumer.m_toSync.erase(it);
786+
continue;
787+
}
788+
port = tunnel_orch->getTunnelPortName(sip_tunnel->getSrcIP().to_string(), true);
773789
}
774-
port = tunnel_orch->getTunnelPortName(remote_ip);
775790
}
776791

777792

@@ -804,8 +819,6 @@ void FdbOrch::doTask(Consumer& consumer)
804819
}
805820
port = tunnel_orch->getTunnelPortName(remote_ip);
806821
}
807-
808-
809822
it = consumer.m_toSync.erase(it);
810823
}
811824
else
@@ -1125,11 +1138,14 @@ bool FdbOrch::addFdbEntry(const FdbEntry& entry, const string& port_name,
11251138
{
11261139
Port vlan;
11271140
Port port;
1141+
string end_point_ip = "";
1142+
1143+
VxlanTunnelOrch* tunnel_orch = gDirectory.get<VxlanTunnelOrch*>();
11281144

11291145
SWSS_LOG_ENTER();
1130-
SWSS_LOG_INFO("mac=%s bv_id=0x%" PRIx64 " port_name=%s type=%s origin=%d",
1146+
SWSS_LOG_INFO("mac=%s bv_id=0x%" PRIx64 " port_name=%s type=%s origin=%d remote_ip=%s",
11311147
entry.mac.to_string().c_str(), entry.bv_id, port_name.c_str(),
1132-
fdbData.type.c_str(), fdbData.origin);
1148+
fdbData.type.c_str(), fdbData.origin, fdbData.remote_ip.c_str());
11331149

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

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

11641186
Port oldPort;
11651187
string oldType;
1188+
string oldRemoteIp;
11661189
FdbOrigin oldOrigin = FDB_ORIGIN_INVALID ;
11671190
bool macUpdate = false;
11681191

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

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

1182-
if ((oldOrigin == fdbData.origin) && (oldType == fdbData.type) && (port.m_bridge_port_id == it->second.bridge_port_id))
1206+
if ((oldOrigin == fdbData.origin) && (oldType == fdbData.type) && (port.m_bridge_port_id == it->second.bridge_port_id)
1207+
&& (oldRemoteIp == fdbData.remote_ip))
11831208
{
11841209
/* Duplicate Mac */
1185-
SWSS_LOG_INFO("FdbOrch: mac=%s %s port=%s type=%s origin=%d is duplicate", entry.mac.to_string().c_str(),
1210+
SWSS_LOG_INFO("FdbOrch: mac=%s %s port=%s type=%s origin=%d remote_ip=%s is duplicate", entry.mac.to_string().c_str(),
11861211
vlan.m_alias.c_str(), port_name.c_str(),
1187-
fdbData.type.c_str(), fdbData.origin);
1212+
fdbData.type.c_str(), fdbData.origin, fdbData.remote_ip.c_str());
11881213
return true;
11891214
}
11901215
else if (fdbData.origin != oldOrigin)

orchagent/orchdaemon.cpp

+14-3
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,6 @@ bool OrchDaemon::init()
177177
VxlanVrfMapOrch *vxlan_vrf_orch = new VxlanVrfMapOrch(m_applDb, APP_VXLAN_VRF_TABLE_NAME);
178178
gDirectory.set(vxlan_vrf_orch);
179179

180-
EvpnRemoteVniOrch* evpn_remote_vni_orch = new EvpnRemoteVniOrch(m_applDb, APP_VXLAN_REMOTE_VNI_TABLE_NAME);
181-
gDirectory.set(evpn_remote_vni_orch);
182180

183181
EvpnNvoOrch* evpn_nvo_orch = new EvpnNvoOrch(m_applDb, APP_VXLAN_EVPN_NVO_TABLE_NAME);
184182
gDirectory.set(evpn_nvo_orch);
@@ -373,7 +371,20 @@ bool OrchDaemon::init()
373371
m_orchList.push_back(vxlan_tunnel_orch);
374372
m_orchList.push_back(evpn_nvo_orch);
375373
m_orchList.push_back(vxlan_tunnel_map_orch);
376-
m_orchList.push_back(evpn_remote_vni_orch);
374+
375+
if (vxlan_tunnel_orch->isDipTunnelsSupported())
376+
{
377+
EvpnRemoteVnip2pOrch* evpn_remote_vni_orch = new EvpnRemoteVnip2pOrch(m_applDb, APP_VXLAN_REMOTE_VNI_TABLE_NAME);
378+
gDirectory.set(evpn_remote_vni_orch);
379+
m_orchList.push_back(evpn_remote_vni_orch);
380+
}
381+
else
382+
{
383+
EvpnRemoteVnip2mpOrch* evpn_remote_vni_orch = new EvpnRemoteVnip2mpOrch(m_applDb, APP_VXLAN_REMOTE_VNI_TABLE_NAME);
384+
gDirectory.set(evpn_remote_vni_orch);
385+
m_orchList.push_back(evpn_remote_vni_orch);
386+
}
387+
377388
m_orchList.push_back(vxlan_vrf_orch);
378389
m_orchList.push_back(cfg_vnet_rt_orch);
379390
m_orchList.push_back(vnet_orch);

orchagent/port.h

+6
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,17 @@ struct VlanMemberEntry
3838

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

41+
typedef std::map<std::string, sai_object_id_t> endpoint_ip_l2mc_group_member_map_t;
42+
4143
struct VlanInfo
4244
{
4345
sai_object_id_t vlan_oid = 0;
4446
sai_vlan_id_t vlan_id = 0;
4547
sai_object_id_t host_intf_id = SAI_NULL_OBJECT_ID;
48+
sai_vlan_flood_control_type_t uuc_flood_type = SAI_VLAN_FLOOD_CONTROL_TYPE_ALL;
49+
sai_vlan_flood_control_type_t bc_flood_type = SAI_VLAN_FLOOD_CONTROL_TYPE_ALL;
50+
sai_object_id_t l2mc_group_id = SAI_NULL_OBJECT_ID;
51+
endpoint_ip_l2mc_group_member_map_t l2mc_members;
4652
};
4753

4854
struct SystemPortInfo

0 commit comments

Comments
 (0)