@@ -685,6 +685,10 @@ void FdbOrch::doTask(NotificationConsumer& consumer)
685
685
std::string op;
686
686
std::string data;
687
687
std::vector<swss::FieldValueTuple> values;
688
+ string alias;
689
+ string vlan;
690
+ Port port;
691
+ Port vlanPort;
688
692
689
693
consumer.pop (op, data, values);
690
694
@@ -706,14 +710,76 @@ void FdbOrch::doTask(NotificationConsumer& consumer)
706
710
}
707
711
else if (op == " PORT" )
708
712
{
709
- /* place holder for flush port fdb*/
710
- SWSS_LOG_ERROR (" Received unsupported flush port fdb request" );
713
+ alias = data;
714
+ if (alias.empty ())
715
+ {
716
+ SWSS_LOG_ERROR (" Receive wrong port to flush fdb!" );
717
+ return ;
718
+ }
719
+ if (!gPortsOrch ->getPort (alias, port))
720
+ {
721
+ SWSS_LOG_ERROR (" Get Port from port(%s) failed!" , alias.c_str ());
722
+ return ;
723
+ }
724
+ if (port.m_bridge_port_id == SAI_NULL_OBJECT_ID)
725
+ {
726
+ return ;
727
+ }
728
+ flushFDBEntries (port.m_bridge_port_id , SAI_NULL_OBJECT_ID);
729
+ SWSS_LOG_NOTICE (" Clear fdb by port(%s)" , alias.c_str ());
711
730
return ;
712
731
}
713
732
else if (op == " VLAN" )
714
733
{
715
- /* place holder for flush vlan fdb*/
716
- SWSS_LOG_ERROR (" Received unsupported flush vlan fdb request" );
734
+ vlan = data;
735
+ if (vlan.empty ())
736
+ {
737
+ SWSS_LOG_ERROR (" Receive wrong vlan to flush fdb!" );
738
+ return ;
739
+ }
740
+ if (!gPortsOrch ->getPort (vlan, vlanPort))
741
+ {
742
+ SWSS_LOG_ERROR (" Get Port from vlan(%s) failed!" , vlan.c_str ());
743
+ return ;
744
+ }
745
+ if (vlanPort.m_vlan_info .vlan_oid == SAI_NULL_OBJECT_ID)
746
+ {
747
+ return ;
748
+ }
749
+ flushFDBEntries (SAI_NULL_OBJECT_ID, vlanPort.m_vlan_info .vlan_oid );
750
+ SWSS_LOG_NOTICE (" Clear fdb by vlan(%s)" , vlan.c_str ());
751
+ return ;
752
+ }
753
+ else if (op == " PORTVLAN" )
754
+ {
755
+ size_t found = data.find (' |' );
756
+ if (found != string::npos)
757
+ {
758
+ alias = data.substr (0 , found);
759
+ vlan = data.substr (found+1 );
760
+ }
761
+ if (alias.empty () || vlan.empty ())
762
+ {
763
+ SWSS_LOG_ERROR (" Receive wrong port or vlan to flush fdb!" );
764
+ return ;
765
+ }
766
+ if (!gPortsOrch ->getPort (alias, port))
767
+ {
768
+ SWSS_LOG_ERROR (" Get Port from port(%s) failed!" , alias.c_str ());
769
+ return ;
770
+ }
771
+ if (!gPortsOrch ->getPort (vlan, vlanPort))
772
+ {
773
+ SWSS_LOG_ERROR (" Get Port from vlan(%s) failed!" , vlan.c_str ());
774
+ return ;
775
+ }
776
+ if (port.m_bridge_port_id == SAI_NULL_OBJECT_ID ||
777
+ vlanPort.m_vlan_info .vlan_oid == SAI_NULL_OBJECT_ID)
778
+ {
779
+ return ;
780
+ }
781
+ flushFDBEntries (port.m_bridge_port_id , vlanPort.m_vlan_info .vlan_oid );
782
+ SWSS_LOG_NOTICE (" Clear fdb by port(%s)+vlan(%s)" , alias.c_str (), vlan.c_str ());
717
783
return ;
718
784
}
719
785
else
0 commit comments