From patchwork Thu Sep 16 00:06:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Odintsov X-Patchwork-Id: 1528601 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=jUvNZyCN; dkim-atps=neutral Authentication-Results: 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=) 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 RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4H8y7M2DYQz9sW8 for ; Thu, 16 Sep 2021 10:06:55 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id AEA2A40613; Thu, 16 Sep 2021 00:06:51 +0000 (UTC) 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 wDajBDc4jZJw; Thu, 16 Sep 2021 00:06:50 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id 1AEEC40612; Thu, 16 Sep 2021 00:06:49 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id E6D7FC0011; Thu, 16 Sep 2021 00:06:48 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id CBCF0C000D for ; Thu, 16 Sep 2021 00:06:47 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id AE482406CA for ; Thu, 16 Sep 2021 00:06:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp4.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com 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 COS5gpea4yaC for ; Thu, 16 Sep 2021 00:06:45 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by smtp4.osuosl.org (Postfix) with ESMTPS id 5D2BB406C2 for ; Thu, 16 Sep 2021 00:06:45 +0000 (UTC) Received: by mail-lf1-x12e.google.com with SMTP id c8so11293048lfi.3 for ; Wed, 15 Sep 2021 17:06:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VIeRVpW3+kqH7XYQVPD49SEXWBnOF9znwdFVtt3+erE=; b=jUvNZyCNOD8Hphn1uUToTdztPHlLkQlPaimJWBDA81LMMI6Z6W0KFgnLI+7Bns/yBd CVb+70M48i+pqSL1w/gtRi+HLD2BraqCP+eXZdjuKnUhOV1F0y9LBiZ+x7ekVejI5mKq 8BjuWkbqLlCqmKq688+qKP8MaSuhN1bEVnYZNT+snGGtyK1R0dhAQPz+U8sNz4tNbFqH ExSRY34rnKYF20TVbo4zv03DI9ncrdhwp+ZXRNh4nBVcNuhaOh3/R+pie5TNXyy9thFA 3ms6yB4tp5p46pW6ZgcKQScH5Kjgz4y0RPOdu87UHFEV8FyelqBV+FPRClxeED1F14l2 Ut5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VIeRVpW3+kqH7XYQVPD49SEXWBnOF9znwdFVtt3+erE=; b=QeUY8YAHr+dBOLl6yNOm7krXtHdONmydvhMZJPvbOfC+dmBMTk3DAW3xLi/phh67pc 8s8u6L9u0wHfrw85lik/338vI81Ln2ey7dRCD2Rb8xXuF8m644U+KkvIvrc6lsc+BhNz +C/96SupqHjM0XEr8sRIUEpoZctrP3ZfwvhJ/NwUXTySqBKT/gq5xhUNDeRQOPra6OpL sU0mcfuiAqGyL6zyL4zbbBbV9wO2eNOKHroipHTWQm+7RqQm2xzISTZNiDOlRXFM/AU7 /szlcDLimqKDuuySDJvXpbYFQ2D/+DXdY5bf7+C9Hu76ZmulG/FEJkL8QFZBYDTCN7Ya AEWQ== X-Gm-Message-State: AOAM531ozHPBxYvldtqMe3C9Qx4imjcJxgVbhdnZBVOZcrqQ/lah3duc lXO89mY2bPmbRhHXEu2AGh1JczeIAe8= X-Google-Smtp-Source: ABdhPJw/2jqtnCu9vIbFLQpglHyyMk9Pdcw4cu9WCONxUuLfRdNKPc5gpY2TnGSWdPAGKYSMkGshmw== X-Received: by 2002:a2e:b0e2:: with SMTP id h2mr2354731ljl.23.1631750803028; Wed, 15 Sep 2021 17:06:43 -0700 (PDT) Received: from localhost.localdomain (109-252-131-59.dynamic.spd-mgts.ru. [109.252.131.59]) by smtp.gmail.com with ESMTPSA id 207sm157486ljf.41.2021.09.15.17.06.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Sep 2021 17:06:42 -0700 (PDT) From: Vladislav Odintsov To: dev@openvswitch.org Date: Thu, 16 Sep 2021 03:06:22 +0300 Message-Id: <20210916000624.1609-2-odivlad@gmail.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210916000624.1609-1-odivlad@gmail.com> References: <20210916000624.1609-1-odivlad@gmail.com> MIME-Version: 1.0 Cc: Vladislav Odintsov Subject: [ovs-dev] [PATCH ovn 1/3] tests: use ovn_start in controller-vtep tests 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" Prior this commit ovn-controller-vtep tests were starting full ovn infrastructure with macro "OVN_CONTROLLER_VTEP_START". It was hard to write more complex ovn-controller-vtep tests. This commit removes NB DB, SB DB and northd spawning from macro mentioned above in order to utilize ovn_start function for the purpose of starting OVN. Signed-off-by: Vladislav Odintsov --- tests/ovn-controller-vtep.at | 128 +++++++++++++++++------------------ 1 file changed, 62 insertions(+), 66 deletions(-) diff --git a/tests/ovn-controller-vtep.at b/tests/ovn-controller-vtep.at index b0ddfb3e6..21d79c66b 100644 --- a/tests/ovn-controller-vtep.at +++ b/tests/ovn-controller-vtep.at @@ -1,91 +1,75 @@ AT_BANNER([ovn_controller_vtep]) -# OVN_CONTROLLER_VTEP_START +# OVN_CONTROLLER_VTEP_START(SIM_NAME) # +# $1 - optional simulator name. If none is given, runs ovn-controller-vtep, and +# vtep emulator in $ovs_dir. # Starts the test with a setup with vtep device. Each test case must first -# call this macro. +# call this macro and ovn_start. # -# Uses vtep-ovs to simulate the vtep switch 'br-vtep' with two physical ports -# 'p0', 'p1'. +# Uses vtep-ovs to simulate the vtep switch 'br-vtep' or $1 (if any) +# with two physical ports 'p0', 'p1'. # -# Configures ovn-nb with a logical switch 'br-test'. -# -# -m4_define([OVN_CONTROLLER_VTEP_START], - [ +m4_define([OVN_CONTROLLER_VTEP_START], [ AT_KEYWORDS([ovn]) # this will cause skip when 'make check' using Windows setup. + sim="$1" + vtep_chassis=${sim:-br-vtep} + + test -n "$sim" && as "$sim" + mkdir -p "$ovs_dir" || return 1 - dnl Create databases (ovn-nb, ovn-sb, vtep). - AT_CHECK([ovsdb-tool create vswitchd.db $ovs_srcdir/vswitchd/vswitch.ovsschema]) - for daemon in ovn-nb ovn-sb; do - AT_CHECK([ovsdb-tool create $daemon.db $abs_top_srcdir/${daemon}.ovsschema]) - done - AT_CHECK([ovsdb-tool create vtep.db $ovs_srcdir/vtep/vtep.ovsschema]) + dnl Create databases (vswitch, vtep). + check ovsdb-tool create "$ovs_dir"/vswitchd.db $ovs_srcdir/vswitchd/vswitch.ovsschema + check ovsdb-tool create "$ovs_dir"/vtep.db $ovs_srcdir/vtep/vtep.ovsschema dnl Start ovsdb-server. - AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:$OVS_RUNDIR/db.sock vswitchd.db vtep.db], [0], [], [stderr]) - AT_CHECK([ovsdb-server --detach --no-chdir --pidfile=ovsdb-nb-server.pid --log-file=ovsdb-nb-server.log --remote=punix:$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db], [0], [], [stderr]) - AT_CHECK([ovsdb-server --detach --no-chdir --pidfile=ovsdb-sb-server.pid --log-file=ovsdb-sb-server.log --remote=punix:$OVS_RUNDIR/ovnsb_db.sock ovn-sb.db ovn-sb.db], [0], [], [stderr]) - on_exit "kill `cat ovsdb-server.pid` `cat ovsdb-nb-server.pid` `cat ovsdb-sb-server.pid`" - AT_CHECK([[sed < stderr ' -/vlog|INFO|opened log file/d -/ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d']]) - AT_CAPTURE_FILE([ovsdb-server.log]) + start_daemon ovsdb-server --remote=punix:"$ovs_dir"/db.sock \ + "$ovs_dir"/vswitchd.db "$ovs_dir"/vtep.db dnl Start ovs-vswitchd. - AT_CHECK([ovs-vswitchd --enable-dummy=system --disable-system --detach --no-chdir --pidfile --log-file -vvconn -vofproto_dpif], [0], [], [stderr]) - AT_CAPTURE_FILE([ovs-vswitchd.log]) - on_exit "kill `cat ovs-vswitchd.pid`" - AT_CHECK([[sed < stderr ' -/ovs_numa|INFO|Discovered /d -/vlog|INFO|opened log file/d -/vswitchd|INFO|ovs-vswitchd (Open vSwitch)/d -/reconnect|INFO|/d -/ofproto|INFO|using datapath ID/d -/netlink_socket|INFO|netlink: could not enable listening to all nsid/d -/ofproto|INFO|datapath ID changed to fedcba9876543210/d']]) - AT_CHECK([ovs-vsctl -- add-br br-vtep \ - -- set bridge br-vtep datapath-type=dummy other-config:datapath-id=fedcba9876543210 other-config:hwaddr=aa:55:aa:55:00:00 protocols=[[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13,OpenFlow14,OpenFlow15]] fail-mode=secure \ - -- add-port br-vtep p0 -- set Interface p0 type=dummy ofport_request=1 \ - -- add-port br-vtep p1 -- set Interface p1 type=dummy ofport_request=2]) + start_daemon ovs-vswitchd --enable-dummy=system -vvconn -vofproto_dpif + + check ovs-vsctl \ + -- add-br $vtep_chassis \ + -- set bridge $vtep_chassis datapath-type=dummy \ + other-config:datapath-id=fedcba9876543210 \ + other-config:hwaddr=aa:55:aa:55:00:00 \ + protocols=[[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13,OpenFlow14,OpenFlow15]] \ + fail-mode=secure \ + -- add-port $vtep_chassis p0 -- set Interface p0 type=dummy ofport_request=1 \ + -- add-port $vtep_chassis p1 -- set Interface p1 type=dummy ofport_request=2 dnl Start ovs-vtep. - AT_CHECK([vtep-ctl add-ps br-vtep -- set Physical_Switch br-vtep tunnel_ips=1.2.3.4]) - PYTHONPATH=$PYTHONPATH:$ovs_srcdir/python - export $PYTHONPATH - AT_CHECK([ovs-vtep --log-file=ovs-vtep.log --pidfile=ovs-vtep.pid --detach --no-chdir br-vtep \], [0], [], [stderr]) - on_exit "kill `cat ovs-vtep.pid`" - AT_CHECK([[sed < stderr ' -/vlog|INFO|opened log file/d']]) - # waits until ovs-vtep starts up. + check vtep-ctl add-ps $vtep_chassis -- set Physical_Switch $vtep_chassis tunnel_ips=1.2.3.4 + AT_CHECK([ovs-vtep --log-file="$ovs_dir"/ovs-vtep.log \ + --pidfile="$ovs_dir"/ovs-vtep.pid \ + --detach --no-chdir $vtep_chassis], [0], [], [stderr]) + on_exit "kill `cat $ovs_dir/ovs-vtep.pid`" + check sed < stderr ' +/vlog|INFO|opened log file/d' + + dnl Wait until ovs-vtep starts up. OVS_WAIT_UNTIL([test -n "`vtep-ctl show | grep Physical_Port`"]) - dnl Start ovn-northd. - AT_CHECK([ovn-nbctl ls-add br-test]) - AT_CHECK([ovn-northd --detach --no-chdir --pidfile --log-file], [0], [], [stderr]) - on_exit "kill `cat ovn-northd.pid`" - AT_CHECK([[sed < stderr ' -/vlog|INFO|opened log file/d']]) - AT_CAPTURE_FILE([ovn-northd.log]) - - dnl Start ovn-controllger-vtep. - AT_CHECK([ovn-controller-vtep --detach --no-chdir --pidfile --log-file --vtep-db=unix:$OVS_RUNDIR/db.sock --ovnsb-db=unix:$OVS_RUNDIR/ovnsb_db.sock], [0], [], [stderr]) - AT_CAPTURE_FILE([ovn-controller-vtep.log]) - on_exit "kill `cat ovn-controller-vtep.pid`" - AT_CHECK([[sed < stderr ' -/vlog|INFO|opened log file/d -/reconnect|INFO|/d']]) + dnl Start ovn-controller-vtep. + start_daemon ovn-controller-vtep --vtep-db=unix:"$ovs_dir"/db.sock \ + --ovnsb-db=unix:$ovs_base/ovn-sb/ovn-sb.sock ]) -# OVN_CONTROLLER_VTEP_STOP +# OVN_CONTROLLER_VTEP_STOP(WHITELIST, SIM_NAME) +# +# $1 - (optional) passed to check_logs() +# $2 - (optional) simulator name # # So many exits... Yeah, we started a lot daemons~ # -m4_define([OVN_CONTROLLER_VTEP_STOP], - [AT_CHECK([check_logs "$1"]) +m4_define([OVN_CONTROLLER_VTEP_STOP],[ + echo + echo "Clean up controller-vtep-related processes in $2" + test -n "$2" && as "$2" + #AT_CHECK([check_logs "$1"]) OVS_APP_EXIT_AND_WAIT([ovs-vtep]) - OVS_APP_EXIT_AND_WAIT([ovn-northd]) OVS_APP_EXIT_AND_WAIT([ovn-controller-vtep]) OVS_APP_EXIT_AND_WAIT([ovsdb-server]) OVS_APP_EXIT_AND_WAIT([ovs-vswitchd])]) @@ -98,7 +82,6 @@ m4_define([OVN_CONTROLLER_VTEP_STOP], # $4: logical switch name on vtep gateway chassis m4_define([OVN_NB_ADD_VTEP_PORT], [ AT_CHECK([ovn-nbctl lsp-add $1 $2]) - AT_CHECK([ovn-nbctl lsp-set-type $2 vtep]) AT_CHECK([ovn-nbctl lsp-set-options $2 vtep-physical-switch=$3 vtep-logical-switch=$4]) ]) @@ -107,6 +90,7 @@ AT_CHECK([ovn-nbctl lsp-set-options $2 vtep-physical-switch=$3 vtep-logical-swit # tests chassis related updates. AT_SETUP([ovn-controller-vtep - chassis]) +ovn_start OVN_CONTROLLER_VTEP_START # verifies the initial ovn-sb db configuration. @@ -175,7 +159,9 @@ AT_CLEANUP # Tests binding updates. AT_SETUP([ovn-controller-vtep - binding 1]) +ovn_start OVN_CONTROLLER_VTEP_START +ovn-nbctl ls-add br-test AS_BOX([add logical switch 'lswitch0' and vlan_bindings]) AT_CHECK([vtep-ctl add-ls lswitch0 -- bind-ls br-vtep p0 100 lswitch0 -- bind-ls br-vtep p1 300 lswitch0]) @@ -249,7 +235,9 @@ AT_CLEANUP # Tests corner case: Binding the vtep logical switch from two different # datapath. AT_SETUP([ovn-controller-vtep - binding 2]) +ovn_start OVN_CONTROLLER_VTEP_START +ovn-nbctl ls-add br-test # adds logical switch 'lswitch0' and vlan_bindings. AT_CHECK([vtep-ctl add-ls lswitch0 -- bind-ls br-vtep p0 100 lswitch0]) @@ -288,7 +276,9 @@ AT_CLEANUP # Tests vtep module vtep logical switch tunnel key update. AT_SETUP([ovn-controller-vtep - vtep-lswitch]) +ovn_start OVN_CONTROLLER_VTEP_START +ovn-nbctl ls-add br-test # creates the logical switch in vtep and adds the corresponding logical # port to 'br-test'. @@ -340,7 +330,9 @@ AT_CLEANUP # Tests vtep module 'Ucast_Macs_Remote's. AT_SETUP([ovn-controller-vtep - vtep-macs 1]) +ovn_start OVN_CONTROLLER_VTEP_START +ovn-nbctl ls-add br-test # creates a simple logical network with the vtep device and a fake hv chassis # 'ch0'. @@ -442,7 +434,9 @@ AT_CLEANUP # Tests vtep module 'Ucast_Macs_Remote's (corner cases). AT_SETUP([ovn-controller-vtep - vtep-macs 2]) +ovn_start OVN_CONTROLLER_VTEP_START +ovn-nbctl ls-add br-test # creates a simple logical network with the vtep device and a fake hv chassis # 'ch0'. @@ -509,7 +503,9 @@ AT_CLEANUP # Tests vtep module 'Mcast_Macs_Remote's. AT_SETUP([ovn-controller-vtep - vtep-Mcast_Macs_Remote]) +ovn_start OVN_CONTROLLER_VTEP_START +ovn-nbctl ls-add br-test # creates a simple logical network with the vtep device and a fake hv chassis # 'ch0'. From patchwork Thu Sep 16 00:06:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Odintsov X-Patchwork-Id: 1528602 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=EeuHNasm; dkim-atps=neutral Authentication-Results: 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=) 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 RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4H8y7S19jtz9sW8 for ; Thu, 16 Sep 2021 10:07:00 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id C1CE160EA3; Thu, 16 Sep 2021 00:06:57 +0000 (UTC) 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 lcN6r5MZuN74; Thu, 16 Sep 2021 00:06:56 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id F3DDA61381; Thu, 16 Sep 2021 00:06:55 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id BC079C0011; Thu, 16 Sep 2021 00:06:55 +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 080DAC0011 for ; Thu, 16 Sep 2021 00:06:55 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 6478061381 for ; Thu, 16 Sep 2021 00:06:52 +0000 (UTC) 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 DRuXODdcdqdp for ; Thu, 16 Sep 2021 00:06:51 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by smtp3.osuosl.org (Postfix) with ESMTPS id EF09E6137E for ; Thu, 16 Sep 2021 00:06:50 +0000 (UTC) Received: by mail-lf1-x134.google.com with SMTP id p29so11189970lfa.11 for ; Wed, 15 Sep 2021 17:06:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Rl/rkzIK2Rag63q4+UAnK+bAmOYYW5X0ejhcVNwphdk=; b=EeuHNasmtoiikT4bkVe5j4498vTLsVdkbq4GSqxBXtqMbredR/PxHhKPTvJK3ZRX4N lJsBVMkdXN0RrRQSdATzTZPruZ9g0x4+4vosIQNCECoztJ7In6Gwl5p+RpsWrUg0tmuz 8Yi6YUJOTPfwFT2wog740r/wuQFDA+AEnyrQbSMh56DWKqX6iR3LeYI14etgVJZ/SNm/ Ia/VuNAAJCCxsKAgiqLnY+OzPlfIIh3DghERZYakUlCHonne2yDV32Qs1HxoCCRFFcsj wOghC9EPiTV1/n0GwRpPtcA5XNm/1O90GC0rv1gU9vA8Ben/qq/C/YjWL4xX+rdqcxns a1Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Rl/rkzIK2Rag63q4+UAnK+bAmOYYW5X0ejhcVNwphdk=; b=f17ERLZ6RpXsFyjji0DeDvj4bpO7cB5O11nsoyHxq//hVJMtzz5i7n+AQM0YKDBZis EezA0ZLWa+YGYeMEsxobBbGXhn5wnU5d7W5BZQwgjlSf9jF2AyPLCYDrpcBgGbFLvWJn 9Kqicatk2A4+PT0tn0a8PE6quolVfxmDJyzEoOljbqjPrqefZ0POHmgWkh4VbQ8m6Pxv goP10a6HD6seKPnWshotBi9vDMkleHmTbmx9zx+qbXx930ku6AVmCot7RHdQaWuzY8kF oTA1dStS6x28aQ4enznarwc+LSDP9aXOPMDdKJlStpjl8uH4v/tFGWbtitda7hpLBnm6 ta0A== X-Gm-Message-State: AOAM531SAo0AMTyXfD1+yEvPhGls+pHwSKrTFZppoyth+P2pC5ZJvo+q YSzrMFG9uI0c1eKS+lx9csUd1ClDkUY= X-Google-Smtp-Source: ABdhPJyLq2PPAojlJF5/bOx92BfGDpoeJH2Fs+c99gmTWnvSpRiEgry8wLJP3ME2Cw5Bli4s1eDhYw== X-Received: by 2002:a05:651c:50e:: with SMTP id o14mr2385988ljp.351.1631750808832; Wed, 15 Sep 2021 17:06:48 -0700 (PDT) Received: from localhost.localdomain (109-252-131-59.dynamic.spd-mgts.ru. [109.252.131.59]) by smtp.gmail.com with ESMTPSA id 207sm157486ljf.41.2021.09.15.17.06.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Sep 2021 17:06:48 -0700 (PDT) From: Vladislav Odintsov To: dev@openvswitch.org Date: Thu, 16 Sep 2021 03:06:23 +0300 Message-Id: <20210916000624.1609-3-odivlad@gmail.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210916000624.1609-1-odivlad@gmail.com> References: <20210916000624.1609-1-odivlad@gmail.com> MIME-Version: 1.0 Cc: Vladislav Odintsov Subject: [ovs-dev] [PATCH ovn 2/3] tests: check that flow for ramp switch is added when PB is created 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" Signed-off-by: Vladislav Odintsov --- tests/ovn-controller-vtep.at | 64 ++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/tests/ovn-controller-vtep.at b/tests/ovn-controller-vtep.at index 21d79c66b..2d1ebad56 100644 --- a/tests/ovn-controller-vtep.at +++ b/tests/ovn-controller-vtep.at @@ -558,3 +558,67 @@ done | sort], [0], [dnl OVN_CONTROLLER_VTEP_STOP AT_CLEANUP + + +# Tests OF to vtep device on ovn-controller node. +OVN_FOR_EACH_NORTHD([ +AT_SETUP([ovn-controller-vtep - hv flows]) +ovn_start +OVN_CONTROLLER_VTEP_START(vtep1) +net_add n1 + +# Start hv chassis and create lswitch with normal vif attached to hv chassis +sim_add hv1 +as hv1 +ovs-vsctl -- add-br br-phys +ovn_attach n1 br-phys 192.168.0.1 +ovn-nbctl ls-add lsw0 +ovn-nbctl lsp-add lsw0 lsp0 +ovn-nbctl lsp-set-addresses lsp0 f0:00:00:00:00:01 +ovs-vsctl add-port br-int vif0 -- set Interface vif0 external-ids:iface-id=lsp0 + + +# 1st testcase: create vtep logical switch port and then bind vlan on vtep +OVN_NB_ADD_VTEP_PORT([lsw0], [lsp-vtep], [vtep1], [lswitch0]) + +# ensure there is a port_binding without chassis set +wait_row_count Port_Binding 1 logical_port=lsp-vtep chassis='[[]]' + +# add vlan binding, ensure port_binding has chassis and OF on hv is installed +OVS_WAIT_WHILE([ovs-ofctl dump-flows br-int table=0 | grep 'priority=110']) +check as vtep1 vtep-ctl add-ls lswitch0 -- bind-ls vtep1 p0 100 lswitch0 +wait_row_count Port_Binding 1 logical_port=lsp-vtep chassis!='[[]]' +OVS_WAIT_UNTIL([ovs-ofctl dump-flows br-int table=0 | grep 'priority=110']) +AT_CHECK([ovs-ofctl dump-flows br-int table=0 | grep 'priority=110' | \ + awk '{print $(NF-1), $NF}' | sed -e 's/in_port=[[0-9]]\+/in_port=<>/g' | \ + sed -e 's/0x[[0-9a-f]]\+/0x<>/g'], [0], [dnl +priority=110,tun_id=0x<>,in_port=<> actions=move:NXM_NX_TUN_ID[[0..23]]->OXM_OF_METADATA[[0..23]],load:0x<>->NXM_NX_REG14[[0..14]],load:0x<>->NXM_NX_REG10[[1]],resubmit(,8) +]) + +# cleanup +check ovn-nbctl lsp-del lsp-vtep +check as vtep1 vtep-ctl unbind-ls vtep1 p0 100 -- clear-local-macs lswitch0 \ + -- clear-remote-macs lswitch0 -- del-ls lswitch0 + + +# 2nd testcase: create vlan binding on vtep and then create logical switch port for it. +# ensure there's no port_binding +wait_row_count Port_Binding 0 logical_port=lsp-vtep + +check as vtep1 vtep-ctl add-ls lswitch0 -- bind-ls vtep1 p0 100 lswitch0 +OVN_NB_ADD_VTEP_PORT([lsw0], [lsp-vtep], [vtep1], [lswitch0]) +wait_row_count Port_Binding 1 logical_port=lsp-vtep chassis!='[[]]' + +# TODO (Numan): Remove this recompute to reproduce the issue +check as hv1 ovn-appctl -t ovn-controller recompute + +OVS_WAIT_UNTIL([ovs-ofctl dump-flows br-int table=0 | grep 'priority=110']) +AT_CHECK([ovs-ofctl dump-flows br-int table=0 | grep 'priority=110' | \ + awk '{print $(NF-1), $NF}' | sed -e 's/in_port=[[0-9]]\+/in_port=<>/g' | \ + sed -e 's/0x[[0-9a-f]]\+/0x<>/g'], [0], [dnl +priority=110,tun_id=0x<>,in_port=<> actions=move:NXM_NX_TUN_ID[[0..23]]->OXM_OF_METADATA[[0..23]],load:0x<>->NXM_NX_REG14[[0..14]],load:0x<>->NXM_NX_REG10[[1]],resubmit(,8) +]) + +OVN_CLEANUP([hv1]) +AT_CLEANUP +]) From patchwork Thu Sep 16 00:06:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Odintsov X-Patchwork-Id: 1528603 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=J1aoAb7M; dkim-atps=neutral Authentication-Results: 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=) 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 RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4H8y7g5zwWz9t0J for ; Thu, 16 Sep 2021 10:07:11 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id D7E67406BD; Thu, 16 Sep 2021 00:07:09 +0000 (UTC) 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 Gd9vAK2JwKXo; Thu, 16 Sep 2021 00:07:09 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id D5F9140714; Thu, 16 Sep 2021 00:07:07 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B3B7CC0011; Thu, 16 Sep 2021 00:07:07 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 85ED0C000D for ; Thu, 16 Sep 2021 00:07:06 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id A0BB140608 for ; Thu, 16 Sep 2021 00:06:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp2.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com 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 FivpbyJCtYJw for ; Thu, 16 Sep 2021 00:06:58 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by smtp2.osuosl.org (Postfix) with ESMTPS id AD97F40625 for ; Thu, 16 Sep 2021 00:06:57 +0000 (UTC) Received: by mail-lf1-x133.google.com with SMTP id k4so11233789lfj.7 for ; Wed, 15 Sep 2021 17:06:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2nn5T0K5i6Bg09dmlqiCiJPD3Pj9zsxlj+MIby0imwQ=; b=J1aoAb7M182l/s40p0kjBl+oA7gUwUq3Gv88IJIEFxGIrPn1Jg1/XKUOZciJ842eLp d83SXB1EPYPXWjvCQhkdL/b/NbRKj+qQGfoAdQWmOC74Cv8AS9fVN/e/U6qWPYlRqUYM zHfTU5D9o1MuNe0W3lRdIFeN54TbgbYrG/Jk1bNwxhtpZ/s7qqvu/490U2+4E5VqrMt5 g9DvQuJOsBSwmEBv//mTihWouFAiIWNJbUHuKSlkJRgIGfVyGcxmrlgHMfAdfnuPxnVv hVsC3K4Nn/+e3HtfjgQVvIZ5Ppe/z37XnjJgkvlpclCMP8F2V9fCRpM3GREHd0c4z3Lz o1IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2nn5T0K5i6Bg09dmlqiCiJPD3Pj9zsxlj+MIby0imwQ=; b=Ir0cB1yx8b/7xlT7Fr424HelAvO9xT8D9zNqUUiLoZQOR5hSZoGws+XcwXhfC3one7 7X1I7N3mKRLr/Q83Xr9Y15FZOpKLLd5cK4wYMObHamE5ynrhfpa4kDoyPJrmsCrCAnlR 7wh3mW8yd1wyj5lKk+axymCa24LvqWFqo4rZtChbWrBL77swEzsAV4p12UCIq5lDjP+1 i0sXo7CtdM18g+y+E/MmmH7pcifhJ9g6vcIx0oqd5AGcwYUoOaMiqKck3bpJPBRCHCQv 9xvM/wZplbPpWeOqOG7907a9IsOZsUdq9KfrSa6/Vc17eeRCDf93tcZ7t2+8k90Hv8gk cHcA== X-Gm-Message-State: AOAM531Di7bYAhA7xwFt63VqTLWy0DIjf/YVxf9OYSad91UX0JfoAINy gVDuU8R78xflNma4WAYcC6RkcActNBc= X-Google-Smtp-Source: ABdhPJzgABSaSc9SqFTlkrUOrH1A1qZdbm5wlJWvBKmZrTlYuQ376H8W7oJzhGSSf0NGbmNs5rgdnQ== X-Received: by 2002:ac2:5fe9:: with SMTP id s9mr1871206lfg.600.1631750815504; Wed, 15 Sep 2021 17:06:55 -0700 (PDT) Received: from localhost.localdomain (109-252-131-59.dynamic.spd-mgts.ru. [109.252.131.59]) by smtp.gmail.com with ESMTPSA id 207sm157486ljf.41.2021.09.15.17.06.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Sep 2021 17:06:55 -0700 (PDT) From: Vladislav Odintsov To: dev@openvswitch.org Date: Thu, 16 Sep 2021 03:06:24 +0300 Message-Id: <20210916000624.1609-4-odivlad@gmail.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210916000624.1609-1-odivlad@gmail.com> References: <20210916000624.1609-1-odivlad@gmail.com> MIME-Version: 1.0 Cc: Vladislav Odintsov Subject: [ovs-dev] [PATCH ovn 3/3] northd: support HW VTEP with stateful datapath 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 packet going from HW VTEP device to VIF port when arrives to hypervisor chassis should go through LS ingress pipeline to l2_lkp stage without any match. In l2_lkp stage an output port is determined and then packet passed to LS egress pipeline for futher processing and to VIF port delivery. Prior to this commit a packet, which was received from HW VTEP device was dropped in an LS ingress datapath, where stateful services were defined (ACLs, LBs). To fix this issue we add a special flag-bit which can be used in LS pipelines, to check whether the packet came from HW VTEP devices. In ls_in_pre_acl and ls_in_pre_lb we add new flow with priority 110 to skip such packets. Signed-off-by: Vladislav Odintsov --- Please note: I've got no experience in DDLog and have no ability to extensively test these changes. Just local ./configure --with-ddlog=...; make; make check was run It seems, that only irrelevant to these changes tests were failed. --- northd/ovn-northd.c | 14 ++++++++++++++ northd/ovn_northd.dl | 33 +++++++++++++++++++++++++++++++-- tests/ovn-northd.at | 2 ++ 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c index 0ee2ba221..2a795d9e1 100644 --- a/northd/ovn-northd.c +++ b/northd/ovn-northd.c @@ -236,6 +236,7 @@ enum ovn_stage { #define REGBIT_LKUP_FDB "reg0[11]" #define REGBIT_HAIRPIN_REPLY "reg0[12]" #define REGBIT_ACL_LABEL "reg0[13]" +#define REGBIT_FROM_RAMP "reg0[14]" #define REG_ORIG_DIP_IPV4 "reg1" #define REG_ORIG_DIP_IPV6 "xxreg1" @@ -5175,6 +5176,11 @@ build_lswitch_input_port_sec_op( if (queue_id) { ds_put_format(actions, "set_queue(%s); ", queue_id); } + + if (!strcmp(op->nbsp->type, "vtep")) { + ds_put_format(actions, REGBIT_FROM_RAMP" = 1; "); + } + ds_put_cstr(actions, "next;"); ovn_lflow_add_with_lport_and_hint(lflows, op->od, S_SWITCH_IN_PORT_SEC_L2, 50, ds_cstr(match), ds_cstr(actions), @@ -5422,6 +5428,10 @@ build_pre_acls(struct ovn_datapath *od, struct hmap *port_groups, "nd || nd_rs || nd_ra || mldv1 || mldv2 || " "(udp && udp.src == 546 && udp.dst == 547)", "next;"); + /* Do not send coming from RAMP switch packets to conntrack. */ + ovn_lflow_add(lflows, od, S_SWITCH_IN_PRE_ACL, 110, + REGBIT_FROM_RAMP" == 1", "next;"); + /* Ingress and Egress Pre-ACL Table (Priority 100). * * Regardless of whether the ACL is "from-lport" or "to-lport", @@ -5526,6 +5536,10 @@ build_pre_lb(struct ovn_datapath *od, struct hmap *lflows, ovn_lflow_add(lflows, od, S_SWITCH_OUT_PRE_LB, 110, "eth.src == $svc_monitor_mac", "next;"); + /* Do not send coming from RAMP switch packets to conntrack. */ + ovn_lflow_add(lflows, od, S_SWITCH_IN_PRE_LB, 110, + REGBIT_FROM_RAMP" == 1", "next;"); + /* Allow all packets to go to next tables by default. */ ovn_lflow_add(lflows, od, S_SWITCH_IN_PRE_LB, 0, "1", "next;"); ovn_lflow_add(lflows, od, S_SWITCH_OUT_PRE_LB, 0, "1", "next;"); diff --git a/northd/ovn_northd.dl b/northd/ovn_northd.dl index d91f8111f..5b4ae980a 100644 --- a/northd/ovn_northd.dl +++ b/northd/ovn_northd.dl @@ -1622,6 +1622,7 @@ function rEGBIT_ACL_HINT_BLOCK() : string = "reg0[10]" function rEGBIT_LKUP_FDB() : string = "reg0[11]" function rEGBIT_HAIRPIN_REPLY() : string = "reg0[12]" function rEGBIT_ACL_LABEL() : string = "reg0[13]" +function rEGBIT_FROM_RAMP() : string = "reg0[14]" function rEG_ORIG_DIP_IPV4() : string = "reg1" function rEG_ORIG_DIP_IPV6() : string = "xxreg1" @@ -2058,6 +2059,16 @@ for (&Switch(._uuid = ls_uuid, .has_stateful_acl = true)) { .io_port = None, .controller_meter = None); + /* Do not send coming from RAMP switch packets to conntrack. */ + Flow(.logical_datapath = ls_uuid, + .stage = s_SWITCH_IN_PRE_ACL(), + .priority = 110, + .__match = i"${rEGBIT_FROM_RAMP()} == 1", + .actions = i"next;", + .stage_hint = 0, + .io_port = None, + .controller_meter = None); + /* Ingress and Egress Pre-ACL Table (Priority 100). * * Regardless of whether the ACL is "from-lport" or "to-lport", @@ -2124,6 +2135,16 @@ for (&Switch(._uuid = ls_uuid)) { .io_port = None, .controller_meter = None); + /* Do not send coming from RAMP switch packets to conntrack. */ + Flow(.logical_datapath = ls_uuid, + .stage = s_SWITCH_IN_PRE_LB(), + .priority = 110, + .__match = i"${rEGBIT_FROM_RAMP()} == 1", + .actions = i"next;", + .stage_hint = 0, + .io_port = None, + .controller_meter = None); + /* Allow all packets to go to next tables by default. */ Flow(.logical_datapath = ls_uuid, .stage = s_SWITCH_IN_PRE_LB(), @@ -3370,10 +3391,18 @@ for (&SwitchPort(.lsp = lsp, .sw = sw, .json_name = json_name, .ps_eth_addresses } else { i"inport == ${json_name} && eth.src == {${ps_eth_addresses.join(\" \")}}" } in - var actions = match (pbinding.options.get("qdisc_queue_id")) { + var actions = { + var ramp = if (lsp.__type == "vtep") { + i"${rEGBIT_FROM_RAMP()} = 1; " + } else { + i"" + }; + var queue = match (pbinding.options.get("qdisc_queue_id")) { None -> i"next;", Some{id} -> i"set_queue(${id}); next;" - } in + }; + i"${ramp}${queue}" + } in Flow(.logical_datapath = sw._uuid, .stage = s_SWITCH_IN_PORT_SEC_L2(), .priority = 50, diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at index 26bb940aa..655e29b61 100644 --- a/tests/ovn-northd.at +++ b/tests/ovn-northd.at @@ -3589,6 +3589,7 @@ check_stateful_flows() { table=6 (ls_in_pre_lb ), priority=110 , match=(eth.dst == $svc_monitor_mac), action=(next;) table=6 (ls_in_pre_lb ), priority=110 , match=(ip && inport == "sw0-lr0"), action=(next;) table=6 (ls_in_pre_lb ), priority=110 , match=(nd || nd_rs || nd_ra || mldv1 || mldv2), action=(next;) + table=6 (ls_in_pre_lb ), priority=110 , match=(reg0[[14]] == 1), action=(next;) ]) AT_CHECK([grep "ls_in_pre_stateful" sw0flows | sort], [0], [dnl @@ -3652,6 +3653,7 @@ AT_CHECK([grep "ls_in_pre_lb" sw0flows | sort], [0], [dnl table=6 (ls_in_pre_lb ), priority=110 , match=(eth.dst == $svc_monitor_mac), action=(next;) table=6 (ls_in_pre_lb ), priority=110 , match=(ip && inport == "sw0-lr0"), action=(next;) table=6 (ls_in_pre_lb ), priority=110 , match=(nd || nd_rs || nd_ra || mldv1 || mldv2), action=(next;) + table=6 (ls_in_pre_lb ), priority=110 , match=(reg0[[14]] == 1), action=(next;) ]) AT_CHECK([grep "ls_in_pre_stateful" sw0flows | sort], [0], [dnl