From patchwork Fri Jul 19 15:35:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Simonart X-Patchwork-Id: 1962538 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=fob6Z+wk; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (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 4WQYgB29MHz1ySl for ; Sat, 20 Jul 2024 01:36:22 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 8BCE64100D; Fri, 19 Jul 2024 15:36:20 +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 BZZ5KX3BFuwo; Fri, 19 Jul 2024 15:36:19 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 79A7A4102C Authentication-Results: smtp2.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=fob6Z+wk Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id 79A7A4102C; Fri, 19 Jul 2024 15:36:19 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 47F0EC0A99; Fri, 19 Jul 2024 15:36:19 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists.linuxfoundation.org (Postfix) with ESMTP id B738BC0A9E for ; Fri, 19 Jul 2024 15:36:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 959A681EDD for ; Fri, 19 Jul 2024 15:36:12 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 7Kfxr5BQ7Dvh for ; Fri, 19 Jul 2024 15:36:11 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=xsimonar@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 54D2C80DE8 Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 54D2C80DE8 Authentication-Results: smtp1.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=fob6Z+wk Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id 54D2C80DE8 for ; Fri, 19 Jul 2024 15:36:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1721403370; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zweJAG7ioaV3t1SAh6Q63Y60/1NnpQVHmjAPq3atyac=; b=fob6Z+wkS7QN1nfOwFOXblSVjEBd9N1KH3t/hT1N0qHEtqmaBThhOHeuWaPmunc/n/biLl Lw+asrzj/U8bSk73iPs0RncrkK01yREv6onQ5gjifedPcuZBvEDWhmy9kwf5G3l0g/57af NnMAMW/W79Y3zWSkp4A1QfYAIaOuzp8= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-167-qBttReXkM1-B9CN9D-hbSA-1; Fri, 19 Jul 2024 11:36:06 -0400 X-MC-Unique: qBttReXkM1-B9CN9D-hbSA-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (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 mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 121541955D47 for ; Fri, 19 Jul 2024 15:36:06 +0000 (UTC) Received: from wsfd-netdev90.ntdv.lab.eng.bos.redhat.com (wsfd-netdev90.anl.eng.rdu2.dc.redhat.com [10.6.38.135]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 62BB51955D47; Fri, 19 Jul 2024 15:36:05 +0000 (UTC) From: Xavier Simonart To: xsimonar@redhat.com, dev@openvswitch.org Date: Fri, 19 Jul 2024 17:35:58 +0200 Message-Id: <20240719153603.2914663-3-xsimonar@redhat.com> In-Reply-To: <20240719153603.2914663-1-xsimonar@redhat.com> References: <20240719153603.2914663-1-xsimonar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 2/7] tests: Add macros for checking related ports. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Two macros have been added: - CHECK_RELATED_PORTS_AFTER_RECOMPUTE Checks the related_lports using IP and recompute. - CHECK_AFTER_RECOMPUTE Checks related_lports and flows using IP and recompute. Using CHECK_RELATED_PORTS_AFTER_RECOMPUTE followed by CHECK_FLOWS_PORTS_AFTER_RECOMPUTE would not detect any lflow related issues. CHECK_RELATED_PORTS_AFTER_RECOMPUTE will be used in following patch to check related_ports at the end of the tests. Signed-off-by: Xavier Simonart --- tests/ovn-macros.at | 80 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 79 insertions(+), 1 deletion(-) diff --git a/tests/ovn-macros.at b/tests/ovn-macros.at index 47ada5c70..02de7208d 100644 --- a/tests/ovn-macros.at +++ b/tests/ovn-macros.at @@ -27,6 +27,15 @@ m4_define([DUMP_FLOWS], [ sort > $output_file ]) +# DUMP_RELATED_PORTS(sbix, output_file) +# Dump related ports +m4_define([DUMP_RELATED_PORTS], [ + sbox=$1 + output_file=$2 + as $sbox + ovn-appctl debug/dump-related-ports | sort > $output_file +]) + m4_define([CHECK_FLOWS_AFTER_RECOMPUTE], [ hv=$1 sbox=$2 @@ -50,7 +59,76 @@ m4_define([CHECK_FLOWS_AFTER_RECOMPUTE], [ 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]) + AT_CHECK([wc -l < flow-diff], [0], [0 +]) + fi +]) + +m4_define([CHECK_RELATED_PORTS_AFTER_RECOMPUTE], [ + hv=$1 + sbox=$2 + related_ports=$3 + AT_CAPTURE_FILE([related-ports-diff]) + # 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 + DUMP_RELATED_PORTS([$sbox], [related-ports-$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_RELATED_PORTS([$sbox], [related-ports-$hv-2]) + # Compare and store differences before and after recompute + comm -3 related-ports-$hv-1 related-ports-$hv-2 > related-ports-diff-$hv + # Ignore some differences. + echo "$related_ports" | comm -2 -3 related-ports-diff-$hv - > related-ports-diff + AT_CHECK([wc -l < related-ports-diff], [0], [0 +]) + fi +]) + +m4_define([CHECK_AFTER_RECOMPUTE], [ + hv=$1 + sbox=$2 + related_ports=$3 + AT_CAPTURE_FILE([related-ports-diff]) + # 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 + DUMP_RELATED_PORTS([$sbox], [related-ports-$hv-1]) + 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_RELATED_PORTS([$sbox], [related-ports-$hv-2]) + DUMP_FLOWS([$sbox], [flows-$hv-2]) + # Compare and store differences before and after recompute + comm -3 related-ports-$hv-1 related-ports-$hv-2 > related-ports-diff-$hv + # Ignore some differences. + echo "$related_ports" | comm -2 -3 related-ports-diff-$hv - > related-ports-diff + AT_CHECK([wc -l < related-ports-diff], [0], [0 +]) + diff flows-$hv-1 flows-$hv-2 > flow-diff + AT_CHECK([wc -l < flow-diff], [0], [0 +]) + diff flows-$hv-1 flows-$hv-2 > flow-diff fi ])