From patchwork Thu May 9 07:35:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ales Musil X-Patchwork-Id: 1933350 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=fuaNv6hc; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (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 4VZkMf5k94z1ymg for ; Thu, 9 May 2024 17:35:57 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 740A9414A2; Thu, 9 May 2024 07:35:54 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id TF7NEoRU7NXJ; Thu, 9 May 2024 07:35:53 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.9.56; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 1CF4541498 Authentication-Results: smtp4.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=fuaNv6hc Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id 1CF4541498; Thu, 9 May 2024 07:35:52 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 5CF5BC0DCE; Thu, 9 May 2024 07:35:52 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id B6C53C0037 for ; Thu, 9 May 2024 07:35:51 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 96E1B404DA for ; Thu, 9 May 2024 07:35:51 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id BSpmStIxQfrg for ; Thu, 9 May 2024 07:35:51 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=amusil@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org B9A6240119 Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org B9A6240119 Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=fuaNv6hc Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id B9A6240119 for ; Thu, 9 May 2024 07:35:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1715240149; 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=/aayyvuos+yCvzaRHFlbTnnuo2zsemhiC7+i+Dj7E4s=; b=fuaNv6hcKrP6W3zDDXgVHeB4TXbzXSPpIDhEN2tnv21zZpfbV3fQ0T589ZgboaurDoBToE uup7HJyX9iBFGrCfKt5F68vO8cFOFJUsT8SgNuPXpWUeTDitHWxKe3OjnDGjNyxVT12fKd D1n32NGJ7hiaKlDZWgz+JgtoPdetb+s= 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-451-3Pgab4QkPiy7Ucd-vqar8w-1; Thu, 09 May 2024 03:35:44 -0400 X-MC-Unique: 3Pgab4QkPiy7Ucd-vqar8w-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (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 B6609185A78E for ; Thu, 9 May 2024 07:35:44 +0000 (UTC) Received: from amusil.brq.redhat.com (unknown [10.43.17.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id 067F02026D68; Thu, 9 May 2024 07:35:43 +0000 (UTC) From: Ales Musil To: dev@openvswitch.org Date: Thu, 9 May 2024 09:35:42 +0200 Message-ID: <20240509073543.563418-1-amusil@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: Dumitru Ceara Subject: [ovs-dev] [PATCH ovn 1/2 branch-24.03] tests: Add macro for checking flows after recompute. 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" From: Xavier Simonart The macro CHECK_FLOWS_AFTER_RECOMPUTE dumps the Openflows, then recomputes, then dumps again the Openflows, and finally compares both sets of flows. The test fails if flows are different. As of now, the macro cannot be used in all tests: many tests would fail as I+P does not properly remove flows when the last logical port of a datapath is deleted. Signed-off-by: Xavier Simonart Acked-by: Ales Musil Signed-off-by: Dumitru Ceara (cherry picked from commit 69ec36eba074263c43051ade7578792b44518d2c) --- tests/ovn-macros.at | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/tests/ovn-macros.at b/tests/ovn-macros.at index 5b1e37d8a..344fdd69c 100644 --- a/tests/ovn-macros.at +++ b/tests/ovn-macros.at @@ -10,6 +10,50 @@ m4_define([OVN_CLEANUP_VSWITCH],[ OVS_APP_EXIT_AND_WAIT([ovsdb-server]) ]) +# DUMP_FLOWS(sbox, output_file) +# Dump openflows to output_file for sbox +m4_define([DUMP_FLOWS], [ + sbox=$1 + output_file=$2 + as $sbox + ovs-ofctl dump-flows br-int | + sed 's/cookie=0x[[^,]]*/cookie=xx/g' | + sed 's/duration=[[^,]]*/duration=xx/g' | + sed 's/idle_age=[[^,]]*/idle_age=xx/g' | + sed 's/, hard_age=[[^,]]*//g' | + sed 's/n_bytes=[[^,]]*/n_bytes=xx/g' | + sed 's/n_packets=[[^,]]*/n_packets=xx/g' | + sed 's/conjunction([[^,]]*/conjunction(xx/g' | + sort > $output_file +]) + +m4_define([CHECK_FLOWS_AFTER_RECOMPUTE], [ + hv=$1 + sbox=$2 + # Make sure I+P has finalized his job before getting flows and comparing them after recompte. + # Some tests have northd and ovn-nb ovsdb stopped, so avoid ovn-nbctl for those. + if [[ -e ovn-nb/ovn-nb.sock ]] && [[ -e northd/ovn-northd.pid ]]; then + # Do wait twice to handle some potential race conditions + check ovn-nbctl --wait=hv sync + check ovn-nbctl --wait=hv sync + fi + + as $sbox + if test "$hv" != "vtep"; then + # Get flows before and after recompute + DUMP_FLOWS([$sbox], [flows-$hv-1]) + + check ovn-appctl -t ovn-controller recompute + # The recompute might cause some sb changes. Let controller catch up. + if [[ -e ovn-nb/ovn-nb.sock ]] && [[ -e northd/ovn-northd.pid ]]; then + check ovn-nbctl --wait=hv sync + fi + DUMP_FLOWS([$sbox], [flows-$hv-2]) + diff flows-$hv-1 flows-$hv-2 > flow-diff + AT_CHECK([test $(diff flows-$hv-1 flows-$hv-2 | wc -l) == 0]) + fi +]) + # OVN_CLEANUP_CONTROLLER(sbox) # # Gracefully terminate ovn-controller in the specified