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'.