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 HaveTableEntry predicates #736

Closed
wants to merge 41 commits into from
Closed

Conversation

ffoulkes
Copy link
Contributor

@ffoulkes ffoulkes commented Jan 12, 2025

  • Implemented HaveTableEntry predicates as wrappers around the GetTableEntry functions. Modified the code to use the predicates when the purpose of the read request is to test for the existence of an entry.

This PR is ES2K-specific. Only ES2K functions call the GetTableEntry and HaveTableEntry functions.

ffoulkes and others added 30 commits October 2, 2024 09:13
Document that summarizes apparent encoding issues in ovsp4rt.

Signed-off-by: Derek Foster <derek.foster@intel.com>
- Encode and validate IPv6 addresses as arrays of uint16_t.
  This allows us to provide better feedback in case of a
  mismatch.

- Make a couple of minor changes to encode_addr_test.

Signed-off-by: Derek Foster <derek.foster@intel.com>
Signed-off-by: Derek Foster <derek.foster@intel.com>
Signed-off-by: Derek Foster <derek.foster@intel.com>
- Enabled CMAKE_EXPORT_COMPILE_COMMANDS. This option instructs CMake
  to generate a `compile_commands.json` file in the build directory,
  for use by other tools (such as `clang-tidy`)

- Expanded CMAKE_INSTALL_PREFIX to an absolute path, which is what
  happens when you set `CMAKE_INSTALL_PREFIX` on the CMake command
  line.

Signed-off-by: Derek Foster <derek.foster@intel.com>
Signed-off-by: Derek Foster <derek.foster@intel.com>
- Moved the set_property() for the STRINGS property on P4OVS_MODE
  after its definition. This fixes a CMake configuration error
  that cropped up in the Tofino build.

Signed-off-by: Derek Foster <derek.foster@intel.com>
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 5.0.2 to 5.1.0.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](actions/setup-go@v5.0.2...v5.1.0)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Derek Foster <derek.foster@intel.com>
- Implemented an `install-path-presets` preset that defines
  DEPEND_INSTALL_DIR and SDE_INSTALL_DIR from the DEPEND_INSTALL
  and SDE_INSTALL environment variables.

Signed-off-by: Derek Foster <derek.foster@intel.com>
- Added sample cmake pre-load scripts and a user presets file,
  and updated the buildsystem to install them in the `share`
  directory tree.

- Added /dpdk.cmake and /es2k.cmake to .gitignore.

Signed-off-by: Derek Foster <derek.foster@intel.com>
- Sanitized a couple of file paths.

- Changed "pre-load" to "preload". The CMake documentation uses
  the hyphenated form, but I find it distracting.

Signed-off-by: Derek Foster <derek.foster@intel.com>
- Removed the experimental p4cpconfig script. It has been
  superseded by cmake presets.

Signed-off-by: Derek Foster <derek.foster@intel.com>
Signed-off-by: Derek Foster <derek.foster@intel.com>
Signed-off-by: Derek Foster <derek.foster@intel.com>
- Marked the BUILD_JOURNAL and BUILD_SPIES variables as advanced.
  They are internal options, used to enable features that are
  still under development, and should normally be hidden.

Signed-off-by: Derek Foster <derek.foster@intel.com>
Signed-off-by: Derek Foster <derek.foster@intel.com>
- This is an internal variable intended for use by developers.

Signed-off-by: Derek Foster <derek.foster@intel.com>
- Added logic to generate an uninstall script and defined a
  target to run the script.

Signed-off-by: Derek Foster <derek.foster@intel.com>
- Created an experimental CMakePresets.json file.

- Defined property strings for the P4OVS_MODE variable.

Signed-off-by: Derek Foster <derek.foster@intel.com>
- Updated the stratum and krnlmon submodule references.

Signed-off-by: Derek Foster <derek.foster@intel.com>
- Implemented the `Client` `ClientInterface`, and `ClientMock`
  classes, to abstract the interface to the P4Runtime server.

Signed-off-by: Derek Foster <justffoulkes@gmail.com>
- Renamed the Journal "schema" element to "version".

- Added `const` qualifier to a couple of parameters.

Signed-off-by: Derek Foster <justffoulkes@gmail.com>
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 5.1.0 to 5.2.0.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](actions/setup-go@v5.1.0...v5.2.0)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
The purpose of the `Client` class is to replace the discrete logic
that interacts with the P4Runtime server with an object that
implements an abstract interface.

- `ClientInterface` is an abstract class that defines the interface.
- `Client` is an implementation of `ClientInterface` that replaces
  the current discrete logic.
- `ClientMock` is a mock implementation of `ClientInterface`.

For this to work, we need to hide the session object from the user.

Signed-off-by: Derek Foster <justffoulkes@gmail.com>
- Modified CMakeLists.txt files to fix compile and link
  errors when building with BUILD_CLIENT enabled.

Signed-off-by: Derek Foster <justffoulkes@gmail.com>
- Changed `ubuntu-latest` to `ubuntu-22.04` in the workflows,
  in preparation for GitHub bumping ubuntu-latest to 24.04.

Signed-off-by: Derek Foster <justffoulkes@gmail.com>
* [ovsp4rt] Implement journaling api and client

- Created JournalClient, a subclass of Client that is
  instrumented to record interactions between OVS and
  the P4Runtime server.

Signed-off-by: Derek Foster <justffoulkes@gmail.com>

* [ovsp4rt] Rough in new Journal methods

- Added methods to the Journal class to record P4Runtime server
  requests and responses.

Signed-off-by: Derek Foster <justffoulkes@gmail.com>

---------

Signed-off-by: Derek Foster <justffoulkes@gmail.com>
- Moved the C API wrapper functions to a separate source
  file. This makes it possible to substitute a different
  implementation of the API, for testing.

  Extracted from PR #674. Works with an updated version
  of ovsp4rt.cc that has not been committed. Currently
  excluded from the build.

Signed-off-by: Derek Foster <justffoulkes@gmail.com>
- Created a variant of the public API that uses
  JournalClient objects.

  Extracted from PR #674. Works with several files that
  have not yet been committed, or that are being committed
  separately. Currently excluded from the build.

Signed-off-by: Derek Foster <justffoulkes@gmail.com>
* Update to stratum-deps v1.3.4
* Update stratum submodule to v3.3.0.0

Signed-off-by: Derek Foster <justffoulkes@gmail.com>
Signed-off-by: Derek Foster <justffoulkes@gmail.com>
Signed-off-by: Derek Foster <justffoulkes@gmail.com>
Signed-off-by: Derek Foster <justffoulkes@gmail.com>
- Corrected ES2K to DPDK in the DPDK version of the file.

Signed-off-by: Derek Foster <justffoulkes@gmail.com>
Signed-off-by: Derek Foster <justffoulkes@gmail.com>
- Updated cmake listfile to use `newovsp4rt.cc` instead of
  `ovsp4rt.cc` when the BUILD_CLIENT option is enabled.

- Modified newovsp4rt.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`), separating the user interface from
  the implementation.

- Created a second implementation of the C API
  (`ovsp4rt_journal_api.cc`) that enables journaling.

- Added an `ovsp4rt_build_and_test` job to the pipeline, to verify
  that ovsp4rt builds when BUILD_CLIENT and BUILD_JOURNAL are enabled.

Signed-off-by: Derek Foster <justffoulkes@gmail.com>
- Moved ovsp4rt_str_to_tunnel_type() to a separate source
  file for C api functions that are not wrappers.

Signed-off-by: Derek Foster <justffoulkes@gmail.com>
- Renamed the functions in the internal C++ API from
  ConfigEntry to DoConfigEntry, to keep them from being
  confused with ConfigTableEntry functions.

The conventions are:

- A PrepareTableEntry function populates the fields of a
  TableEntry.

- A ConfigTableEntry function initializes a WriteRequest,
  prepares the TableEntry, and sends the request to the
  P4Runtime server.

- A GetTableEntry function initializes a ReadRequest,
  prepares the TableEntry, sends the request to the
  P4Runtime server, and returns the response.

- A DoConfigEntry function implements the core logic of
  an ovsp4rt_table_entry C API. It may make one or more
  ConfigTableEntry or GetTableEntry calls.

Signed-off-by: Derek Foster <justffoulkes@gmail.com>
- Modified the functions in the internal C++ API to return
  `absl::Status`, allowing a test program to verify whether
  the function encountered an error.

- Updated the C API wrappers to ignore the returned Status
  explicitly. The public APIs currently have a `void` return
  type.

These changes only apply when BUILD_CLIENT is enabled.

Signed-off-by: Derek Foster <justffoulkes@gmail.com>
- Implemented `HaveTableEntry` predicates as wrappers around
  the `GetTableEntry` functions. Modified the code to use the
  predicates when the purpose of the read request is to test
  for the existence of an entry.

Signed-off-by: Derek Foster <justffoulkes@gmail.com>
@ffoulkes ffoulkes closed this Jan 24, 2025
@ffoulkes ffoulkes deleted the HaveTableEntry branch January 24, 2025 20:30
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