@@ -2295,7 +2295,7 @@ void PortsOrch::doPortTask(Consumer &consumer)
22952295 Port p;
22962296 if (getPort (port_id, p))
22972297 {
2298- PortUpdate update = {p, false };
2298+ PortUpdate update = {p, false };
22992299 notify (SUBJECT_TYPE_PORT_CHANGE, static_cast <void *>(&update));
23002300 }
23012301 }
@@ -2551,6 +2551,8 @@ void PortsOrch::doLagTask(Consumer &consumer)
25512551 // Retrieve attributes
25522552 uint32_t mtu = 0 ;
25532553 string learn_mode;
2554+ bool operation_status_changed = false ;
2555+ string operation_status;
25542556
25552557 for (auto i : kfvFieldsValues (t))
25562558 {
@@ -2564,20 +2566,22 @@ void PortsOrch::doLagTask(Consumer &consumer)
25642566 }
25652567 else if (fvField (i) == " oper_status" )
25662568 {
2567- if (fvValue (i) == " down" )
2569+ operation_status = fvValue (i);
2570+ if (!string_oper_status.count (operation_status))
25682571 {
2569- gNeighOrch ->ifChangeInformNextHop (alias, false );
2570- Port lag;
2571- if (getPort (alias, lag))
2572- {
2573- SWSS_LOG_NOTICE (" Flushing FDB entries for %s with bridge port id: %" PRIx64
2574- " as it is DOWN" , alias.c_str (), lag.m_bridge_port_id );
2575- flushFDBEntries (lag.m_bridge_port_id );
2576- }
2572+ SWSS_LOG_ERROR (" Invalid operation status value:%s" , operation_status.c_str ());
2573+ it++;
2574+ continue ;
25772575 }
2578- else
2576+
2577+ gNeighOrch ->ifChangeInformNextHop (alias,
2578+ (operation_status == " down" ) ?
2579+ false : true );
2580+ Port lag
2581+ if (getPort (alias, lag))
25792582 {
2580- gNeighOrch ->ifChangeInformNextHop (alias, true );
2583+ operation_status_changed = (string_oper_status[operation_status] != lag.m_oper_status ) ?
2584+ true : false ;
25812585 }
25822586 }
25832587 }
@@ -2600,6 +2604,17 @@ void PortsOrch::doLagTask(Consumer &consumer)
26002604 }
26012605 else
26022606 {
2607+
2608+ if (!operation_status.empty ())
2609+ {
2610+ l.m_oper_status = string_oper_status[operation_status];
2611+ m_portList[alias] = l;
2612+ }
2613+ if (operation_status_changed)
2614+ {
2615+ PortOperStateUpdate update = {l, string_oper_status[operation_status]};
2616+ notify (SUBJECT_TYPE_PORT_OPER_STATE_CHANGE, static_cast <void *>(&update));
2617+ }
26032618 if (mtu != 0 )
26042619 {
26052620 l.m_mtu = mtu;
@@ -3154,9 +3169,6 @@ bool PortsOrch::removeBridgePort(Port &port)
31543169 return false ;
31553170 }
31563171
3157- /* Flush FDB entries pointing to this bridge port */
3158- flushFDBEntries (port.m_bridge_port_id );
3159-
31603172 /* Remove bridge port */
31613173 status = sai_bridge_api->remove_bridge_port (port.m_bridge_port_id );
31623174 if (status != SAI_STATUS_SUCCESS)
@@ -3806,13 +3818,6 @@ void PortsOrch::doTask(NotificationConsumer &consumer)
38063818
38073819 updatePortOperStatus (port, status);
38083820
3809- if (status == SAI_PORT_OPER_STATUS_DOWN)
3810- {
3811- SWSS_LOG_NOTICE (" Flushing FDB entries for %s with bridge port id: %" PRIx64
3812- " as it is DOWN" , port.m_alias .c_str (), port.m_bridge_port_id );
3813- flushFDBEntries (port.m_bridge_port_id );
3814- }
3815-
38163821 /* update m_portList */
38173822 m_portList[port.m_alias ] = port;
38183823 }
@@ -3844,6 +3849,9 @@ void PortsOrch::updatePortOperStatus(Port &port, sai_port_oper_status_t status)
38443849 {
38453850 SWSS_LOG_WARN (" Inform nexthop operation failed for interface %s" , port.m_alias .c_str ());
38463851 }
3852+
3853+ PortOperStateUpdate update = {port, status};
3854+ notify (SUBJECT_TYPE_PORT_OPER_STATE_CHANGE, static_cast <void *>(&update));
38473855}
38483856
38493857/*
@@ -3997,22 +4005,3 @@ void PortsOrch::getPortSerdesVal(const std::string& val_str,
39974005 lane_values.push_back (lane_val);
39984006 }
39994007}
4000-
4001- void PortsOrch::flushFDBEntries (sai_object_id_t bridge_port_id)
4002- {
4003- sai_attribute_t attr;
4004- vector<sai_attribute_t > attrs;
4005- sai_status_t rv;
4006-
4007- SWSS_LOG_INFO (" Flushing the port with bridge port id: %" PRIx64, bridge_port_id);
4008-
4009- attr.id = SAI_FDB_FLUSH_ATTR_BRIDGE_PORT_ID;
4010- attr.value .oid = bridge_port_id;
4011- attrs.push_back (attr);
4012- rv = sai_fdb_api->flush_fdb_entries (gSwitchId , (uint32_t )attrs.size (), attrs.data ());
4013-
4014- if (rv != SAI_STATUS_SUCCESS)
4015- {
4016- SWSS_LOG_ERROR (" Flush fdb by bridge port id: %" PRIx64 " failed: %d" , bridge_port_id, rv);
4017- }
4018- }
0 commit comments