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

[ovsp4rt] Implement Client class (DRAFT) #727

Closed
wants to merge 5 commits into from
Closed

Conversation

ffoulkes
Copy link
Contributor

@ffoulkes ffoulkes commented Jan 6, 2025

Superseded by PR #732

This is a project to improve the testability of ovsp4rt. See issue #701 for details.

  • Modified ovsp4rt.cc to use a Client object instead of an OvsP4rtSession object to communicate with the P4Runtime server.

  • Made each public C API function a wrapper around a C++ function that accepts a Client object as a parameter. This allows a test to replace the object with a test double (e.g. a mock).

  • Moved the C API functions to another file (ovsp4rt_standard_api.cc or ovsp4rt_journal_api.cc), separating the user interface from the implementation.

Note

  • The BUILD_CLIENT cmake option is enabled by default in this branch. CI can't compile the modified version of ovsp4rt.cc without it.
  • The BUILD_JOURNAL cmake option is also enabled by default, so the CI workflow compiles that as well.

This PR supersedes PR #674.

- Modified ovsp4rt.cc to use a `Client` object instead of an
  `OvsP4rtSession` object to communicate with the P4Runtime server.

- Made each public C API function a wrapper around a C++ function
  that accepts a Client object as a parameter. This allows a unit
  test to replace the object with a test double (e.g. a mock).

- Moved the C API functions to another file, separating the user
  interface from the implementation.

Signed-off-by: Derek Foster <[email protected]>
@ffoulkes ffoulkes marked this pull request as draft January 6, 2025 18:00
@ffoulkes ffoulkes changed the title [ovsp4rt] Implement Client class (work in progress) [ovsp4rt] Implement Client class (DRAFT) Jan 7, 2025
- A small difference in the DPDK and ES2K implementations of
  ConfigFdbEntry() resulted in 'undefined reference' errors in
  the ES2K build. This problem has been fixed.

Signed-off-by: Derek Foster <[email protected]>
@ffoulkes ffoulkes closed this Jan 8, 2025
@ffoulkes ffoulkes deleted the client-class branch January 8, 2025 22:10
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.

1 participant