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

sonic-swss: bfdorch changes to support software bfd sessions #3406

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

abdbaig
Copy link

@abdbaig abdbaig commented Dec 1, 2024

What I did

  • Added logic in bfdorch to check for switch_type value of dpu and if it's dpu, program BFD sessions in a new software BFD session table in STATE_DB, instead of programming sessions in the HW through ASIC_DB. This table will be monitored by bgpcfgd which will program BFD sessions in FRR accordingly.
  • Added pytest testcases

Why I did it

As part of the Smartswitch project, BFD sessions need to be run between DPU and NPU but DPU doesn't currently support BFD hardware offload.
HLD: https://github.com/kperumalbfn/SONiC/blob/kperumal/bfd/doc/smart-switch/BFD/SmartSwitchDpuLivenessUsingBfd.md

HA manager (hamgrd) will be responsible for programming BFD sessions in the DPU by programming BFD_SESSION_TABLE in APP_DB (just like it's currently done for NPU), but bfdorch needs to now program software BFD sessions if it's running on the DPU.

How I verified it

  • Added a new test_soft_bfd.py test file and verified the tests passed.

Details if related

@abdbaig abdbaig requested a review from prsunny as a code owner December 1, 2024 22:04
Copy link
Contributor

@siqbal1986 siqbal1986 left a comment

Choose a reason for hiding this comment

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

overall looks good. jsut a few minor comments

extern sai_bfd_api_t* sai_bfd_api;
extern sai_object_id_t gSwitchId;
extern sai_object_id_t gVirtualRouterId;
extern PortsOrch* gPortsOrch;
extern sai_switch_api_t* sai_switch_api;
extern Directory<Orch*> gDirectory;
extern string gMySwitchType;

Copy link
Contributor

Choose a reason for hiding this comment

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

why extra space

vector<string> keys;

// Clean up state database BFD entries
Copy link
Contributor

Choose a reason for hiding this comment

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

please remove extra new line below this


# Check BFD session 3 in STATE_DB
createdSessions = self.get_exist_bfd_session() - bfdSessions
bfdSessions = self.get_exist_bfd_session()
Copy link
Contributor

Choose a reason for hiding this comment

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

can you please add a test in test_vnet.py where a vnet route with BFD session is created and added, that way we can be sure that it works fine with VNET routes as well.

@@ -81,6 +100,21 @@ BfdOrch::~BfdOrch(void)
SWSS_LOG_ENTER();
}

std::string BfdOrch::replaceFirstTwoColons(const std::string &input) {
Copy link
Contributor

Choose a reason for hiding this comment

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

can you please rename to something like createStateDBKey.

@@ -0,0 +1,189 @@
import pytest

Check notice

Code scanning / CodeQL

Unused import Note test

Import of 'pytest' is not used.
@@ -0,0 +1,189 @@
import pytest
import time

Check notice

Code scanning / CodeQL

Unused import Note test

Import of 'time' is not used.

# Check BFD session 3 in STATE_DB
createdSessions = self.get_exist_bfd_session() - bfdSessions
bfdSessions = self.get_exist_bfd_session()

Check notice

Code scanning / CodeQL

Unused local variable Note test

Variable bfdSessions is not used.
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.

3 participants