mbox series

[ovs-dev,v2,00/29] Remove most of the hardcoded table numbers

Message ID 20240206094043.530335-1-amusil@redhat.com
Headers show
Series Remove most of the hardcoded table numbers | expand

Message

Ales Musil Feb. 6, 2024, 9:40 a.m. UTC
A lot of tests were relying on exact table numbers for
flow comparison either logical or OpenFlows.

To solve this problem logical flows will have stripped table
maening that the table=<NUMBER> will become table=??. This makes it
future proof for any logical table shifts and there is no need to deal
with number changes when the pipleine shifts for example.

For OpenFlows the solution is to use macros and replace table=<NUMBER>
with the macro e.g. table=OFTABLE_PHY_TO_LOG. This means that if there is
table shift we just have to adjust those macros instead of "random" tests.

In order to take care of table references into OpenFlow through logical
flow stage, new binary is added called ovn-debug. The new binary provides
command that will translate stage name into OpenFlow table number.

Simple grep for table=<NUMBER> before and after shows the benefit.

Before:
grep -E "table=[0-9]+" tests/*.at | wc -l
1651

After:
grep -E "table=[0-9]+" tests/*.at | wc -l
65

The same applies to resubmits to known tables:

Before:
grep -E "resubmit\(,[0-9]+\)" tests/*.at | wc -l
168

After:
grep -E "resubmit\(,[0-9]+\)" tests/*.at | wc -l
64

Only test that is still hardcoded is "action parsing", because
it compares the direct output from the test binary.
---
v2: Rebase on top of main and adjust tests that have been updated.
    Add the new tool to get replace another hardcoded batch.

Ales Musil (29):
  tests: Add macro to strip table numbers from lflows.
  tests: Use ovn_strip_lflows instead of single ? for the replace.
  tests: Use ovn_strip_lflows for cases with sort before sed.
  tests: Use ovn_strip_lflows for cases without sort.
  tests: Use ovn_strip_lflows for the rest of lflows.
  tests: Add macro for OFTABLE_PHY_TO_LOG table number.
  tests: Add macro for OFTABLE_LOG_INGRESS_PIPELINE table number.
  tests: Add macro for OFTABLE_OUTPUT_LARGE_PKT_DETECT table number.
  tests: Add macro for OFTABLE_OUTPUT_LARGE_PKT_PROCESS table number.
  tests: Add macro for OFTABLE_REMOTE_OUTPUT table number.
  tests: Add macro for OFTABLE_LOCAL_OUTPUT table number.
  tests: Add macro for OFTABLE_LOG_TO_PHY table number.
  tests: Add macro for OFTABLE_MAC_BINDING table number.
  tests: Add macro for OFTABLE_MAC_LOOKUP table number.
  tests: Add macro for OFTABLE_CHK_LB_HAIRPIN table number.
  tests: Add macro for OFTABLE_CHK_LB_HAIRPIN_REPLY table number.
  tests: Add macro for OFTABLE_CT_SNAT_HAIRPIN table number.
  tests: Add macro for OFTABLE_GET_FDB table number.
  tests: Add macro for OFTABLE_LOOKUP_FDB table number.
  tests: Add macro for OFTABLE_CHK_IN_PORT_SEC table number.
  tests: Add macro for OFTABLE_CHK_IN_PORT_SEC_ND table number.
  tests: Add macro for OFTABLE_CHK_OUT_PORT_SEC table number.
  tests: Add macro for OFTABLE_ECMP_NH_MAC table number.
  tests: Add macro for OFTABLE_ECMP_NH table number.
  tests: Add macro for OFTABLE_CHK_LB_AFFINITY table number.
  tests: Add macro for OFTABLE_MAC_CACHE_USE table number.
  checkpatch: Add rule to check for hardcoded table numbers.
  utilities: Add ovn-debug binary tool.
  tests: Use the ovn-debug binary to determine table numbers.

 NEWS                         |    5 +
 README.rst                   |    1 +
 debian/ovn-common.install    |    1 +
 debian/ovn-common.manpages   |    1 +
 rhel/ovn-fedora.spec.in      |    2 +
 tests/ovn-controller-vtep.at |   14 +-
 tests/ovn-controller.at      |  354 ++--
 tests/ovn-macros.at          |   26 +
 tests/ovn-northd.at          | 3023 +++++++++++++++++-----------------
 tests/ovn.at                 | 1791 ++++++++++----------
 tests/system-ovn-kmod.at     |   32 +-
 tests/system-ovn.at          |   34 +-
 utilities/.gitignore         |    2 +
 utilities/automake.mk        |   10 +-
 utilities/checkpatch.py      |   12 +
 utilities/ovn-debug.8.xml    |   28 +
 utilities/ovn-debug.c        |  155 ++
 17 files changed, 2921 insertions(+), 2570 deletions(-)
 create mode 100644 utilities/ovn-debug.8.xml
 create mode 100644 utilities/ovn-debug.c