Skip to content

Link event damping feature#1906

Merged
mramezani95 merged 35 commits into
sonic-net:masterfrom
sivat6:link_event_damping_feature
Jun 12, 2026
Merged

Link event damping feature#1906
mramezani95 merged 35 commits into
sonic-net:masterfrom
sivat6:link_event_damping_feature

Conversation

@sivat6

@sivat6 sivat6 commented May 22, 2026

Copy link
Copy Markdown
Contributor
  1. PR#1331 is not yet merged. Added the changes of Add libsai RedisInterface for link event damping. #1331.

Other changes:

  1. Feature Functionality implementation was missing:
    The existing implementation only defines structures and enums for configuration provisioning. The damping functional logic was not implemented. Implemented the damping algorithm as mentioned in the HLD and invoked during the link event handling.

  2. Missing Damping Statistics
    Damping-related counters mentioned in HLD are not present in STATS_DB. Added the damping stats (pre & post damping counters) to STATS_DB

  3. Physical vs Operational State Mismatch
    The damping algorithm is triggered during link up/down events, with timer and threshold checks handled there.
    Once the maximum suppress time is reached, the actual status update occurs only during the next link event, causing a mismatch. Added the timer thread which periodically checks the damping timer and if the damping ends, it updates the physical link status.

Test Plan: Test plan is already in place (https://github.com/sivat6/sonic-mgmt/blob/master/docs/testplan/Link_event_damping.md)

Test Results: This test plan has 9 major test cases and there are about 54 total test cases (Including sub test cases). All these 54 test cases are executed.

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Comment thread lib/ClientSai.cpp
@prsunny

prsunny commented May 22, 2026

Copy link
Copy Markdown
Contributor

@sivat6 , can you check the build failure?

@prsunny

prsunny commented May 22, 2026

Copy link
Copy Markdown
Contributor

HLD PR - sonic-net/SONiC#1071

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements the link event damping feature end-to-end in sairedis/syncd: it introduces Redis-extension PORT attributes to configure damping, applies the damping algorithm to port state change notifications in syncd, and adds a periodic timer to end suppression even without new link events.

Changes:

  • Add Redis-extension PORT attributes and plumbing (libsai ⇄ syncd) for link-event damping algorithm/config.
  • Apply damping during port state change notification processing, plus a timer thread to enforce max-suppress-time expiry.
  • Emit per-port damping counters/state into a dedicated DB table for observability.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
unittest/lib/TestClientServerSai.cpp Adds unit tests for setting Redis PORT damping attributes and client-mode rejection.
syncd/tests/TestSyncdLinkEventDamping.cpp Adds a syncd integration-style test for damping config set behavior.
syncd/tests/Makefile.am Registers the new syncd damping test source file.
syncd/Syncd.h Introduces per-port damping state structure, helper APIs, and thread/db members.
syncd/Syncd.cpp Implements config handling, damping algorithm, timer thread, and stats publishing.
syncd/NotificationProcessor.h Extends constructor to accept an optional “apply damping” callback.
syncd/NotificationProcessor.cpp Filters port state change notifications by applying damping before sending.
lib/sairediscommon.h Adds the Redis op name for damping config set.
lib/Sai.cpp Bypasses metadata for Redis PORT extension attributes and routes them to RedisSai.
lib/RedisRemoteSaiInterface.h Declares Redis PORT attribute detection and damping config setter helpers.
lib/RedisRemoteSaiInterface.cpp Implements Redis PORT attribute set handling and op dispatch to syncd.
lib/ClientSai.cpp Rejects Redis extension attrs (including Redis PORT attrs) in CLIENT mode.

Comment thread syncd/Syncd.cpp
Comment thread syncd/Syncd.cpp
Comment thread syncd/Syncd.cpp
Comment thread syncd/Syncd.cpp
Comment thread syncd/Syncd.cpp
Comment thread syncd/Syncd.cpp Outdated
Comment thread syncd/tests/TestSyncdLinkEventDamping.cpp Outdated
Comment thread lib/RedisRemoteSaiInterface.h
Comment thread lib/RedisRemoteSaiInterface.cpp
Comment thread syncd/Syncd.cpp
@prsunny

prsunny commented May 22, 2026

Copy link
Copy Markdown
Contributor

Please address copilot comments

Comment thread syncd/Syncd.cpp Fixed
Comment thread syncd/Syncd.cpp Fixed
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@sivat6

sivat6 commented May 27, 2026

Copy link
Copy Markdown
Contributor Author

Please address copilot comments

Addressed all copilot comments.

@sivat6 sivat6 closed this May 27, 2026
@sivat6 sivat6 reopened this May 27, 2026
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@prsunny

prsunny commented May 28, 2026

Copy link
Copy Markdown
Contributor

Can you check the build failure?

@sivat6
sivat6 force-pushed the link_event_damping_feature branch from 4bb4573 to 8f4866a Compare May 28, 2026 04:02
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

sivat6 added 11 commits June 12, 2026 10:18
Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>
Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>
Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>
Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>
Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>
…yncd/tests/TestSyncdLinkEventDamping.cpp

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>
Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>
Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>
Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>
Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>
Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>
@sivat6
sivat6 force-pushed the link_event_damping_feature branch from 46ac713 to 6fc0dd4 Compare June 12, 2026 04:49
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown
Collaborator

Hi, there are workflow run(s) waiting for approval, you may be first-time contributor. I will notify maintainers to help approve once PR is approved. Thanks!

---Powered by SONiC BuildBot

@sivat6

sivat6 commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

/azpw retry

@mssonicbld

Copy link
Copy Markdown
Collaborator

Retrying failed(or canceled) jobs...

@mssonicbld

Copy link
Copy Markdown
Collaborator

Retrying failed(or canceled) stages in build 1136667:

✅Stage Test:

  • Job vstest: retried.

Comment thread syncd/Syncd.h
Comment thread syncd/Syncd.h
Comment thread syncd/Syncd.cpp
sivat6 added a commit to sivat6/sonic-sairedis that referenced this pull request Jun 22, 2026
* Adding link event damping support

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Revert "Adding link event damping support"

This reverts commit 0953e68.

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Adding link event damping support

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Addressing review comments

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Wrongly checked !=0 instead of ==0

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Fixing indentation issues

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Fix build errors

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Fixing build error

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Fixing unit test failure

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Fixing white space error and missing SWSS_LOG_ENTER

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Fixing dpkg dependency problems for libswsscommon

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Removing my changes in build-template.yml file

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Fixing spell check failures

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Removing the fix added to build-swss-template.yml

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Adding more test cases to increase coverage

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Fixing the failed UT case

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Fixing the typo in the last commit

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Removing few test cases

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Removing similar tests

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Removing the notification from timer thread to main thread

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Test purpose to see PR# 1925 fixes current build issue

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Remove the code of PR# 1925

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Fixing build issue

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* SWSS_LOG_ENTER missed in new API

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Adding suppress and reuse threshold invalid config check

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Adding tests to increase coverage

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Added SWSS_LOG_ENTER() in the APIs in test file

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Addressed review comments

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Addressed code review comments

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Adding tests under unittest and removing the unnecessary tests from syncd/tests/TestSyncdLinkEventDamping.cpp

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Trigger pipeline

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Adding SWSS_LOG_ENTER()

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Debugging the test case

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Tweaking some timing value in one test

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Tweaking params

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

---------

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants