From patchwork Tue Feb 6 09:40:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ales Musil X-Patchwork-Id: 1895579 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=I8Z//K12; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TTdXk60G5z23g2 for ; Tue, 6 Feb 2024 20:40:54 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id F08B1610EF; Tue, 6 Feb 2024 09:40:50 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org F08B1610EF Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=I8Z//K12 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1ArwFKH2UOYR; Tue, 6 Feb 2024 09:40:50 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id ED63960E09; Tue, 6 Feb 2024 09:40:48 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org ED63960E09 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id BBA21C0072; Tue, 6 Feb 2024 09:40:48 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 80FF0C0037 for ; Tue, 6 Feb 2024 09:40:48 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 6439A60E09 for ; Tue, 6 Feb 2024 09:40:48 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 6439A60E09 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JPGbRzQ_F8Fd for ; Tue, 6 Feb 2024 09:40:47 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id 7701B60B45 for ; Tue, 6 Feb 2024 09:40:47 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 7701B60B45 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707212446; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0fKvI3qDdsxickKpGb0OpZDMPeLp2xf+CmuqzLOHRPM=; b=I8Z//K12Pr0dTale9qS7CH51+JWuiq89LTH59Y2F2vvnRinJamWApdOURYy3xRm0jW9xAI riSCawxVfntEs4S9E6j6H2sY46zTb3xPEOiwPGyQ1ErO4ycmY7bIIA6PMASJNxWkLIVg9d O7Ekx3txKaH5a9iT18wxui+FDrX6n2A= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-679-FUCvdb76NNi4HGR--WlXLQ-1; Tue, 06 Feb 2024 04:40:44 -0500 X-MC-Unique: FUCvdb76NNi4HGR--WlXLQ-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6D18485A58F for ; Tue, 6 Feb 2024 09:40:44 +0000 (UTC) Received: from amusil.brq.redhat.com (unknown [10.43.17.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id EDA94492BF0; Tue, 6 Feb 2024 09:40:43 +0000 (UTC) From: Ales Musil To: dev@openvswitch.org Date: Tue, 6 Feb 2024 10:40:14 +0100 Message-ID: <20240206094043.530335-1-amusil@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn v2 00/29] Remove most of the hardcoded table numbers X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" 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= 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= 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= 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