Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[staticroutebfd] fix static route uninstall issue if no nexthop #15575

Merged
merged 1 commit into from
Jul 7, 2023
Merged

[staticroutebfd] fix static route uninstall issue if no nexthop #15575

merged 1 commit into from
Jul 7, 2023

Conversation

baorliu
Copy link
Contributor

@baorliu baorliu commented Jun 22, 2023

fixes #15574
fix static route uninstall issue when all nexthops are not reachable.
the feature was working but the bug was introduced when support dynamic bfd enable/disable.

Why I did it

If a static route is bfd protected, when all the bfd sessions are down and all the nexthop need to be removed from the static route, it fails because a kip condition is missing.

Work item tracking
  • Microsoft ADO (number only):

How I did it

To support bfd config dynamic change and avoid race condition when delete static route, there is a skip checking for staticRouteMgr(appl_db) to check if the deletion should be skipped. Besides checking if the route exists in config_db, also need to check if the route is bfd protected.

How to verify it

verified it both in UT and in real testbed.

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211
  • 202305

Tested branch (Please provide the tested image version)

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

…re not reachable

fix static route uninstall issue when all nexthops are not reachable.
the feature was working but the bug was introduced when support dynamic bfd enable/disable. Added UT testcase to guard this.
@StormLiangMS
Copy link
Contributor

@jcaiMR could you help to take a look?

@tjchadaga tjchadaga requested a review from abdosi July 5, 2023 15:06
if bfd == "true":
log_debug("skip_appl_del: {}, key {}, bfd flag {}".format(self.db_name, cfg_key, bfd))
return False

Copy link
Contributor

@jcaiMR jcaiMR Jul 6, 2023

Choose a reason for hiding this comment

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

Can we migrate the code in "if vrf == "default"" and the code out of the if logic.
Since they are doing the same work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason is that, in the redis STATIC ROUTE table, both of the following keys are valid if vrf is default:
STATIC_ROUTE|ip_prefix
STATIC_ROUTE|default|ip_prefix
so if vrf is default, check key STATIC_ROUTE|ip_prefix first, if bfd is not "true" then check the next legal key STATIC_ROUTE|default|ip_prefix.
3 possible states for bfd, only return False if bfd is "true". (again, two legal key formats, need to do redis get twice)
1, key is not in the table
2, key in in the table, bfd flag value if false
3, key in in the table, bfd flag value if true
The comment logic here is:
if bfd == "true":
return False
but if put it outside, need more logic to check the above 3 states.
Hope this can explain the code.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, thanks for explanation.

@abdosi abdosi added the Chassis for 202205 branch PRs needed for 202205 branch in msft repo label Jul 7, 2023
@abdosi
Copy link
Contributor

abdosi commented Jul 7, 2023

@StormLiangMS / @prsunny can you help with merge of this.

@jcaiMR jcaiMR requested a review from yxieca July 7, 2023 01:53
@jcaiMR
Copy link
Contributor

jcaiMR commented Jul 7, 2023

@yxieca Add Ying for review and code merge.

@yxieca yxieca merged commit a86a026 into sonic-net:master Jul 7, 2023
20 checks passed
abdosi added a commit to sonic-net/sonic-buildimage-msft that referenced this pull request Jul 7, 2023
…15574

[staticroutebfd] fix static route uninstall issue
Double commit the PR from sonic-net/sonic-buildimage.
Original PR for staticroutebfd:
sonic-net/sonic-buildimage#15575
@gechiang
Copy link
Collaborator

labeling this as already included for chassis 202205 branch via the PR that @abdosi merged: sonic-net/sonic-buildimage-msft#43 which went directly into the msft repo 202205 branch.

@gechiang gechiang added the Included in Chassis for 202205 Branch Indicate PR is already in MSFT repo 202205 branch label Jul 14, 2023
@StormLiangMS
Copy link
Contributor

@gechiang could we have ADO for cherry-pick ask to 202305?

@gechiang
Copy link
Collaborator

gechiang commented Aug 7, 2023

@StormLiangMS
MSFT ADO: 24772230
Thanks!

mssonicbld pushed a commit to mssonicbld/sonic-buildimage that referenced this pull request Aug 14, 2023
…re not reachable (sonic-net#15575)

fix static route uninstall issue when all nexthops are not reachable.
the feature was working but the bug was introduced when support dynamic bfd enable/disable. Added UT testcase to guard this.
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202305: #16133

mssonicbld pushed a commit that referenced this pull request Aug 15, 2023
…re not reachable (#15575)

fix static route uninstall issue when all nexthops are not reachable.
the feature was working but the bug was introduced when support dynamic bfd enable/disable. Added UT testcase to guard this.
sonic-otn pushed a commit to sonic-otn/sonic-buildimage that referenced this pull request Sep 20, 2023
…re not reachable (sonic-net#15575)

fix static route uninstall issue when all nexthops are not reachable.
the feature was working but the bug was introduced when support dynamic bfd enable/disable. Added UT testcase to guard this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

staticroutebfd fails to uninstall static route after all the nexthop becomes unavailable
7 participants