mbox series

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

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

Message

Ales Musil Feb. 1, 2024, 4:17 p.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.

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
332

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
152

There are still some tests that use the direct number, those
are tests that reference the logical pipeline through OpenFlows.
Solution for those is not very straight forward and will be probably
addressed in future. Nevertheless the overall improvement is visible.

Ales Musil (26):
  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_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

 tests/ovn-controller-vtep.at |   14 +-
 tests/ovn-controller.at      |   12 +-
 tests/ovn-macros.at          |   25 +
 tests/ovn-northd.at          | 3005 +++++++++++++++++-----------------
 tests/ovn.at                 | 1404 ++++++++--------
 tests/system-ovn-kmod.at     |   16 +-
 tests/system-ovn.at          |   14 +-
 utilities/checkpatch.py      |   12 +
 8 files changed, 2270 insertions(+), 2232 deletions(-)