@@ -2037,7 +2037,7 @@ bool VxlanVrfMapOrch::delOperation(const Request& request)
20372037
20382038// ------------------- EVPN_REMOTE_VNI Table --------------------------//
20392039
2040- bool EvpnRemoteVniOrch ::addOperation (const Request& request)
2040+ bool EvpnRemoteVnip2pOrch ::addOperation (const Request& request)
20412041{
20422042 SWSS_LOG_ENTER ();
20432043
@@ -2104,7 +2104,7 @@ bool EvpnRemoteVniOrch::addOperation(const Request& request)
21042104 return true ;
21052105}
21062106
2107- bool EvpnRemoteVniOrch ::delOperation (const Request& request)
2107+ bool EvpnRemoteVnip2pOrch ::delOperation (const Request& request)
21082108{
21092109 bool ret;
21102110
@@ -2180,6 +2180,137 @@ bool EvpnRemoteVniOrch::delOperation(const Request& request)
21802180 return ret;
21812181}
21822182
2183+ bool EvpnRemoteVnip2mpOrch::addOperation (const Request& request)
2184+ {
2185+ SWSS_LOG_ENTER ();
2186+
2187+ EvpnNvoOrch* evpn_nvo_orch = gDirectory .get <EvpnNvoOrch*>();
2188+ // Extract end point ip
2189+ auto end_point_ip = request.getKeyString (1 );
2190+
2191+ // Extract VLAN and VNI
2192+ auto vlan_name = request.getKeyString (0 );
2193+ sai_vlan_id_t vlan_id = (sai_vlan_id_t ) stoi (vlan_name.substr (4 ));
2194+
2195+ auto vni_id = static_cast <sai_uint32_t >(request.getAttrUint (" vni" ));
2196+ if (vni_id >= 1 <<24 )
2197+ {
2198+ SWSS_LOG_ERROR (" Vxlan tunnel map vni id is too big: %d" , vni_id);
2199+ return true ;
2200+ }
2201+
2202+ VxlanTunnelOrch* tunnel_orch = gDirectory .get <VxlanTunnelOrch*>();
2203+ Port tunnelPort, vlanPort;
2204+ auto vtep_ptr = evpn_orch->getEVPNVtep ();
2205+ if (!vtep_ptr)
2206+ {
2207+ SWSS_LOG_WARN (" Remote VNI add: VTEP not found. remote=%s vid=%d" ,
2208+ remote_vtep.c_str (),vlan_id);
2209+ return true ;
2210+ }
2211+
2212+ if (!gPortsOrch ->getVlanByVlanId (vlan_id, vlanPort))
2213+ {
2214+ SWSS_LOG_WARN (" Vxlan tunnel map vlan id doesn't exist: %d" , vlan_id);
2215+ return false ;
2216+ }
2217+
2218+ auto src_vtep = vtep_ptr->getSrcIP ().to_string ();
2219+ if (tunnel_orch->getTunnelPort (src_vtep,tunnelPort, true ))
2220+ {
2221+ SWSS_LOG_INFO (" Vxlan tunnelPort exists: %s" , remote_vtep.c_str ());
2222+
2223+ if (gPortsOrch ->isVlanMember (vlanPort, tunnelPort, end_point_ip))
2224+ {
2225+ SWSS_LOG_WARN (" Remote end point %s already member of vid %d" ,
2226+ end_point_ip.c_str (),vlan_id);
2227+ vtep_ptr->increment_spurious_imr_add (remote_vtep);
2228+ return true ;
2229+ }
2230+ }
2231+ else
2232+ {
2233+ SWSS_LOG_WARN (" Vxlan tunnelPort doesn't exist: %s" , src_vtep.c_str ());
2234+ return false ;
2235+ }
2236+
2237+ // SAI Call to add tunnel to the VLAN flood domain
2238+
2239+ string tagging_mode = " untagged" ;
2240+ gPortsOrch ->addVlanMember (vlanPort, tunnelPort, tagging_mode, end_point_ip);
2241+
2242+ SWSS_LOG_INFO (" end_point_ip=%s vni=%d vlanid=%d " ,
2243+ remote_vtep.c_str (), vni_id, vlan_id);
2244+
2245+ return true ;
2246+ }
2247+
2248+ bool EvpnRemoteVnip2mpOrch::delOperation (const Request& request)
2249+ {
2250+ bool ret;
2251+
2252+ SWSS_LOG_ENTER ();
2253+
2254+ // Extract end point ip
2255+ auto end_point_ip = request.getKeyString (1 );
2256+
2257+ // Extract VLAN and VNI
2258+ auto vlan_name = request.getKeyString (0 );
2259+ sai_vlan_id_t vlan_id = (sai_vlan_id_t )stoi (vlan_name.substr (4 ));
2260+
2261+ auto vni_id = static_cast <sai_uint32_t >(request.getAttrUint (" vni" ));
2262+ if (vni_id >= 1 <<24 )
2263+ {
2264+ SWSS_LOG_ERROR (" Vxlan tunnel map vni id is too big: %d" , vni_id);
2265+ return true ;
2266+ }
2267+
2268+ // SAI Call to add tunnel to the VLAN flood domain
2269+
2270+ VxlanTunnelOrch* tunnel_orch = gDirectory .get <VxlanTunnelOrch*>();
2271+ Port vlanPort, tunnelPort;
2272+ EvpnNvoOrch* evpn_nvo_orch = gDirectory .get <EvpnNvoOrch*>();
2273+
2274+ auto vtep_ptr = evpn_orch->getEVPNVtep ();
2275+ if (!vtep_ptr)
2276+ {
2277+ SWSS_LOG_WARN (" Remote VNI add: VTEP not found. remote=%s vid=%d" ,
2278+ remote_vtep.c_str (),vlan_id);
2279+ return true ;
2280+ }
2281+
2282+ if (!gPortsOrch ->getVlanByVlanId (vlan_id, vlanPort))
2283+ {
2284+ SWSS_LOG_WARN (" Vxlan tunnel map vlan id doesn't exist: %d" , vlan_id);
2285+ return true ;
2286+ }
2287+
2288+ auto src_vtep = vtep_ptr->getSrcIP ().to_string ();
2289+ if (!tunnel_orch->getTunnelPort (src_vtep,tunnelPort,true ))
2290+ {
2291+ SWSS_LOG_WARN (" RemoteVniDel getTunnelPort Fails: %s" , src_vtep.c_str ());
2292+ return true ;
2293+ }
2294+
2295+
2296+ if (!gPortsOrch ->isVlanMember (vlanPort, tunnelPort, end_point_ip))
2297+ {
2298+ SWSS_LOG_WARN (" marking it as spurious tunnelPort %s not a member of vid %d" ,
2299+ end_point_ip.c_str (), vlan_id);
2300+ vtep_ptr->increment_spurious_imr_del (end_point_ip);
2301+ return true ;
2302+ }
2303+
2304+ if (!gPortsOrch ->removeVlanMember (vlanPort, tunnelPort, end_point_ip))
2305+ {
2306+ SWSS_LOG_WARN (" RemoteVniDel remove vlan member fails: vlan:%hu ip %s" ,
2307+ vlan_id, end_point_ip.c_str ());
2308+ return false ;
2309+ }
2310+
2311+ return true ;
2312+ }
2313+
21832314// ------------------- EVPN_NVO Table --------------------------//
21842315
21852316bool EvpnNvoOrch::addOperation (const Request& request)
0 commit comments