From patchwork Tue Apr 18 06:50:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ales Musil X-Patchwork-Id: 1769950 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) 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=fApsL1p1; dkim-atps=neutral Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q0vgW0rfRz1ybC for ; Tue, 18 Apr 2023 16:50:13 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 591FC417A2; Tue, 18 Apr 2023 06:50:11 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 591FC417A2 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=fApsL1p1 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 N6p4pn_ERwcJ; Tue, 18 Apr 2023 06:50:09 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id 54C6E41609; Tue, 18 Apr 2023 06:50:08 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 54C6E41609 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 1D328C0037; Tue, 18 Apr 2023 06:50:08 +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 B8E5BC002A for ; Tue, 18 Apr 2023 06:50:06 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 9A2B640C12 for ; Tue, 18 Apr 2023 06:50:06 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 9A2B640C12 Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=fApsL1p1 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cMphrQJgVsCQ for ; Tue, 18 Apr 2023 06:50:05 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 22058402F6 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id 22058402F6 for ; Tue, 18 Apr 2023 06:50:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681800603; 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=2WBgpU8xMaLcgbubji1zuIPgwIWkSgEXv44tmBTTOV4=; b=fApsL1p1gA8kbnOWLroirOBo8BLoUhsm0IxLEDxmSltHk1j3YTPWDge5iMnFtYWczXlVql 8Hp8Hhx9coTBULeh6J5YmjdHD6ZEkwSscJo/UpvTsljS01c3A6N99ExlmqTXeWkIK527vk bMGqjpMijYpMeAB7a6E4QIT/DnXSbdg= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-522-lmTkOjRSM6WvR_nCDKiGiQ-1; Tue, 18 Apr 2023 02:50:02 -0400 X-MC-Unique: lmTkOjRSM6WvR_nCDKiGiQ-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 269D23C02541 for ; Tue, 18 Apr 2023 06:50:02 +0000 (UTC) Received: from amusil.. (unknown [10.34.131.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6D8D7492B0F; Tue, 18 Apr 2023 06:50:01 +0000 (UTC) From: Ales Musil To: dev@openvswitch.org Date: Tue, 18 Apr 2023 08:50:00 +0200 Message-Id: <20230418065000.78150-1-amusil@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: dceara@redhat.com Subject: [ovs-dev] [PATCH ovn] system-tests: Fix and enable the SCTP test 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" Fix the outdated parts of SCTP test and allow it to be run on CI, in order to do that we just need to load sctp kernel module. Reported-at: https://bugzilla.redhat.com/2183516 Signed-off-by: Ales Musil --- tests/system-ovn-kmod.at | 32 ++++++++++++++++++-------------- tests/test-l7.py | 37 ++++++++++++++----------------------- 2 files changed, 32 insertions(+), 37 deletions(-) diff --git a/tests/system-ovn-kmod.at b/tests/system-ovn-kmod.at index c1272d5ef..593ddd2b2 100644 --- a/tests/system-ovn-kmod.at +++ b/tests/system-ovn-kmod.at @@ -9,6 +9,10 @@ AT_SKIP_IF([test $HAVE_SCTP = no]) AT_SKIP_IF([test $HAVE_NC = no]) AT_KEYWORDS([ovnlb sctp]) +# Make sure the SCTP kernel module is loaded +check modprobe sctp +on_exit 'modprobe -q -r sctp' + CHECK_CONNTRACK() CHECK_CONNTRACK_NAT() ovn_start @@ -127,8 +131,8 @@ AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(30.0.0.1) | sed -e 's/zone=[[0-9]]*/zone=/' | sed -e 's/vtag_orig=[[0-9]]*/vtag_orig=/' | sed -e 's/vtag_reply=[[0-9]]*/vtag_reply=/' | uniq], [0], [dnl -sctp,orig=(src=172.16.1.2,dst=30.0.0.1,sport=,dport=),reply=(src=192.168.1.2,dst=172.16.1.2,sport=,dport=),zone=,protoinfo=(state=,vtag_orig=,vtag_reply=) -sctp,orig=(src=172.16.1.2,dst=30.0.0.1,sport=,dport=),reply=(src=192.168.2.2,dst=172.16.1.2,sport=,dport=),zone=,protoinfo=(state=,vtag_orig=,vtag_reply=) +sctp,orig=(src=172.16.1.2,dst=30.0.0.1,sport=,dport=),reply=(src=192.168.1.2,dst=172.16.1.2,sport=,dport=),zone=,mark=2,protoinfo=(state=,vtag_orig=,vtag_reply=) +sctp,orig=(src=172.16.1.2,dst=30.0.0.1,sport=,dport=),reply=(src=192.168.2.2,dst=172.16.1.2,sport=,dport=),zone=,mark=2,protoinfo=(state=,vtag_orig=,vtag_reply=) ]) dnl Test load-balancing that includes L4 ports in NAT. @@ -142,20 +146,19 @@ AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(30.0.0.2) | sed -e 's/zone=[[0-9]]*/zone=/' | sed -e 's/vtag_orig=[[0-9]]*/vtag_orig=/' | sed -e 's/vtag_reply=[[0-9]]*/vtag_reply=/' | uniq], [0], [dnl -sctp,orig=(src=172.16.1.2,dst=30.0.0.2,sport=,dport=),reply=(src=192.168.1.2,dst=172.16.1.2,sport=,dport=),zone=,protoinfo=(state=,vtag_orig=,vtag_reply=) -sctp,orig=(src=172.16.1.2,dst=30.0.0.2,sport=,dport=),reply=(src=192.168.2.2,dst=172.16.1.2,sport=,dport=),zone=,protoinfo=(state=,vtag_orig=,vtag_reply=) +sctp,orig=(src=172.16.1.2,dst=30.0.0.2,sport=,dport=),reply=(src=192.168.1.2,dst=172.16.1.2,sport=,dport=),zone=,mark=2,protoinfo=(state=,vtag_orig=,vtag_reply=) +sctp,orig=(src=172.16.1.2,dst=30.0.0.2,sport=,dport=),reply=(src=192.168.2.2,dst=172.16.1.2,sport=,dport=),zone=,mark=2,protoinfo=(state=,vtag_orig=,vtag_reply=) ]) check_est_flows () { - n=$(ovs-ofctl dump-flows br-int table=14 | grep \ -"priority=120,ct_state=+est+trk,sctp,metadata=0x2,nw_dst=30.0.0.2,tp_dst=8000" \ -| grep nat | sed -n 's/.*n_packets=\([[0-9]]\{1,\}\).*/\1/p') + n=$(ovs-ofctl dump-flows br-int table=15 | grep "+est" \ + | grep "ct_mark=$1" | sed -n 's/.*n_packets=\([[0-9]]\{1,\}\).*/\1/p') echo "n_packets=$n" - test "$n" != 0 + test -n "$n" && test "$n" != "0" } -OVS_WAIT_UNTIL([check_est_flows], [check established flows]) +OVS_WAIT_UNTIL([check_est_flows 0x2], [check established flows]) ovn-nbctl set logical_router R2 options:lb_force_snat_ip="20.0.0.2" @@ -167,13 +170,14 @@ ovn-nbctl destroy load_balancer $uuid uuid=`ovn-nbctl create load_balancer protocol=sctp vips:30.0.0.1="192.168.1.2,192.168.2.2"` ovn-nbctl set logical_router R2 load_balancer=$uuid +check ovs-appctl dpctl/flush-conntrack + # Config OVN load-balancer with another VIP (this time with ports). ovn-nbctl set load_balancer $uuid vips:'"30.0.0.2:8000"'='"192.168.1.2:12345,192.168.2.2:12345"' ovn-nbctl list load_balancer ovn-sbctl dump-flows R2 -OVS_WAIT_UNTIL([ovs-ofctl -O OpenFlow13 dump-flows br-int table=41 | \ -grep 'nat(src=20.0.0.2)']) +OVS_WAIT_UNTIL([ovs-ofctl -O OpenFlow13 dump-flows br-int table=43 | grep 'nat(src=20.0.0.2)']) dnl Test load-balancing that includes L4 ports in NAT. for i in `seq 1 20`; do @@ -186,8 +190,8 @@ AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(30.0.0.2) | sed -e 's/zone=[[0-9]]*/zone=/' | sed -e 's/vtag_orig=[[0-9]]*/vtag_orig=/' | sed -e 's/vtag_reply=[[0-9]]*/vtag_reply=/' | uniq], [0], [dnl -sctp,orig=(src=172.16.1.2,dst=30.0.0.2,sport=,dport=),reply=(src=192.168.1.2,dst=172.16.1.2,sport=,dport=),zone=,protoinfo=(state=,vtag_orig=,vtag_reply=) -sctp,orig=(src=172.16.1.2,dst=30.0.0.2,sport=,dport=),reply=(src=192.168.2.2,dst=172.16.1.2,sport=,dport=),zone=,protoinfo=(state=,vtag_orig=,vtag_reply=) +sctp,orig=(src=172.16.1.2,dst=30.0.0.2,sport=,dport=),reply=(src=192.168.1.2,dst=172.16.1.2,sport=,dport=),zone=,mark=10,protoinfo=(state=,vtag_orig=,vtag_reply=) +sctp,orig=(src=172.16.1.2,dst=30.0.0.2,sport=,dport=),reply=(src=192.168.2.2,dst=172.16.1.2,sport=,dport=),zone=,mark=10,protoinfo=(state=,vtag_orig=,vtag_reply=) ]) AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(20.0.0.2) | @@ -198,7 +202,7 @@ sctp,orig=(src=172.16.1.2,dst=192.168.1.2,sport=,dport=),reply sctp,orig=(src=172.16.1.2,dst=192.168.2.2,sport=,dport=),reply=(src=192.168.2.2,dst=20.0.0.2,sport=,dport=),zone=,protoinfo=(state=,vtag_orig=,vtag_reply=) ]) -OVS_WAIT_UNTIL([check_est_flows], [check established flows]) +OVS_WAIT_UNTIL([check_est_flows 0xa], [check established flows]) OVS_APP_EXIT_AND_WAIT([ovn-controller]) diff --git a/tests/test-l7.py b/tests/test-l7.py index 701c63f0d..6e592f0dc 100755 --- a/tests/test-l7.py +++ b/tests/test-l7.py @@ -74,29 +74,20 @@ def get_tftpd(): def get_sctp(): - try: - import socket - import sctp - except ImportError: - print("Failed to import for SCTP") - server = None - pass - else: - class OVSSCTPServer(object): - def __init__(self, listen, handler=None): - self.sock = sctp.sctpsocket_tcp(socket.AF_INET) - self.sock.bind(listen) - self.sock.listen() - - def serve_forever(self): - while True: - client, _ = self.sock.accept() - client.send(b"SCRAM\r\n") - client.close() - - server = [OVSSCTPServer, None, 12345] - - return server + class OVSSCTPServer(object): + def __init__(self, listen, handler=None): + self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM, + socket.IPPROTO_SCTP) + self.sock.bind(listen) + self.sock.listen() + + def serve_forever(self): + while True: + client, _ = self.sock.accept() + client.sendall(b"SCRAM\r\n") + client.close() + + return [OVSSCTPServer, None, 12345] def main():