From patchwork Tue Jan 9 11:12:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mohammad Heib X-Patchwork-Id: 1884377 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=RPaJ2f61; 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 4T8Svn6s48z1yPf for ; Tue, 9 Jan 2024 22:12:53 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id D34456114D; Tue, 9 Jan 2024 11:12:51 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org D34456114D 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=RPaJ2f61 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 nBAUl5hG1elP; Tue, 9 Jan 2024 11:12: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 2E19D61169; Tue, 9 Jan 2024 11:12:49 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 2E19D61169 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 35E0CC0DE2; Tue, 9 Jan 2024 11:12:46 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 98D01C0DE0 for ; Tue, 9 Jan 2024 11:12:44 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 7296D42201 for ; Tue, 9 Jan 2024 11:12:44 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 7296D42201 Authentication-Results: smtp4.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=RPaJ2f61 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LNpuagfkdG2x for ; Tue, 9 Jan 2024 11:12:43 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp4.osuosl.org (Postfix) with ESMTPS id 9DB38421B9 for ; Tue, 9 Jan 2024 11:12:43 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 9DB38421B9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704798762; 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: in-reply-to:in-reply-to:references:references; bh=rDun1E7IAIjDiIS4+10j5OTF2BZcBd3eM3Kb8WdPOpY=; b=RPaJ2f61DasUGsIyR1bpGeb/KNF956GXaZU75t9SX4dDdbDU+c0LSXskoI8rBwtDvifAa5 voLMCtWPPeS2LHij9g8SET/6hODFA+3cXGNs7Bt7ctvceRq1zVI1mV34qxeWrkNGrjV1Ol 1ftvvE4Zh8Z+QrRNUpH4NSfSOhgx+ow= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-39-NE2aGDSSNSeRRkcXrkgpcA-1; Tue, 09 Jan 2024 06:12:41 -0500 X-MC-Unique: NE2aGDSSNSeRRkcXrkgpcA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (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 0BF211C05151 for ; Tue, 9 Jan 2024 11:12:41 +0000 (UTC) Received: from mheiblap.localdomain (unknown [10.47.238.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5F5AF40C6EBA; Tue, 9 Jan 2024 11:12:40 +0000 (UTC) From: Mohammad Heib To: dev@openvswitch.org Date: Tue, 9 Jan 2024 13:12:32 +0200 Message-Id: <20240109111232.539196-5-mheib@redhat.com> In-Reply-To: <20240109111232.539196-4-mheib@redhat.com> References: <20240109111232.539196-1-mheib@redhat.com> <20240109111232.539196-2-mheib@redhat.com> <20240109111232.539196-3-mheib@redhat.com> <20240109111232.539196-4-mheib@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn v3 4/4] ic/tests: add unit test for ic sync command 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" add unit test that check validate that sync command sync ISB properly Signed-off-by: Mohammad Heib --- tests/ovn-ic.at | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/tests/ovn-ic.at b/tests/ovn-ic.at index d4c436f84..f55ffa6cd 100644 --- a/tests/ovn-ic.at +++ b/tests/ovn-ic.at @@ -1274,3 +1274,50 @@ OVN_CLEANUP_IC([az1], [az2]) AT_CLEANUP ]) + +AT_SETUP([ovn-ic -- sync ISB status to INB]) +ovn_init_ic_db +net_add n1 + +ovn_start az1 +sim_add gw-az1 +as gw-az1 + +check ovs-vsctl add-br br-phys +ovn_az_attach az1 n1 br-phys 192.168.1.1 +check ovs-vsctl set open . external-ids:ovn-is-interconn=true +as az1 + +# pause ovn-ic instance +check ovn-appctl -t ic/ovn-ic pause + +# run sync command in the background this commands +# supposed to stuck since ovn-ic is paused. +$(ovn-ic-nbctl --wait=sb sync &) + +for i in {1..5}; do + set -- $(ovn-ic-nbctl get ic_nb_global . nb_ic_cfg sb_ic_cfg) + AS_VAR_SET([ic_nb_cfg], [$1]) + AS_VAR_SET([ic_sb_cfg], [$2]) + if test $ic_nb_cfg -gt $ic_sb_cfg; then + sleep 1 + else + break + fi +done + +# if ic_nb_cfg equal to ic_sb_cfg that mean both zero +# or both 1 which is a not correct and the test must fail. +AT_FAIL_IF([test $ic_nb_cfg == $ic_sb_cfg]) + +# resume ovn-ic instance +check ovn-appctl -t ic/ovn-ic resume +set -- $(ovn-ic-nbctl get ic_nb_global . nb_ic_cfg sb_ic_cfg) +AS_VAR_SET([ic_nb_cfg], [$1]) +AS_VAR_SET([ic_sb_cfg], [$2]) +AT_FAIL_IF([test $ic_nb_cfg != 1]) +AT_FAIL_IF([test $ic_nb_cfg != 1]) + +OVN_CLEANUP_IC([az1]) +AT_CLEANUP +])