From patchwork Thu Jun 7 10:38:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Sitnicki X-Patchwork-Id: 926266 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 411hq00Snpz9s1R for ; Thu, 7 Jun 2018 20:38:52 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 1E45CC8D; Thu, 7 Jun 2018 10:38:25 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 5C6FFC49 for ; Thu, 7 Jun 2018 10:38:23 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id C72D376E for ; Thu, 7 Jun 2018 10:38:22 +0000 (UTC) Received: by mail-wm0-f68.google.com with SMTP id z6-v6so2544093wma.0 for ; Thu, 07 Jun 2018 03:38:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2R9ZdsB9wKrojpChSZr3G9wRG5dkQWUDsXQmHAh76gs=; b=rShkOUHs06+muuGDTD4fc6XIGKGsqdc/0AO3JtHRvNXo003t1Q0yRXlzwsS7vj3OI4 0WCxDCXKvzA8mk/t3BCiH/va5OPvzBb+OfaQRJvKyDtA3+PWPWBanIQeDJQSgi6Rko6G iaf6IVOkwBelcq/Ig+OgXjJMIKTcmvQnPOm8H5jP5bFiwolbJOHLueff/zAvInhgJ7Bj fp0wak30OK4BfYgCODhZRRUp4pDmjRHoBAjC/cdrRXLVPu2DwMso6KUnq6wm9HvkKBwm ZxSkLE9xwJOw117hQXQRIyRZBuWUwGw3l+thopWrRG1qX0/lc71F/MeuxXRS8w4bnn2r VlJQ== X-Gm-Message-State: APt69E0E7RNjb8QqAsdVbBpRKW/OnHCe5HxVw9zmYnqn0dDeVV+qNPE+ YTZCJBYvPgcgjT9vGnidNsBEUtJLbSA= X-Google-Smtp-Source: ADUXVKJrLTrMWwHhCY4KRoCaeSJidzVYVudFyA/8SjjW4XR8DVSPoNUPr24YjCNloI4DtUEvp/G65g== X-Received: by 2002:a1c:c208:: with SMTP id s8-v6mr1256130wmf.29.1528367901261; Thu, 07 Jun 2018 03:38:21 -0700 (PDT) Received: from redhat.com (red-hat-inc.vlan404.asr1.mad1.gblx.net. [64.215.113.190]) by smtp.gmail.com with ESMTPSA id 136-v6sm1908920wmo.12.2018.06.07.03.38.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Jun 2018 03:38:20 -0700 (PDT) From: Jakub Sitnicki To: dev@openvswitch.org Date: Thu, 7 Jun 2018 12:38:17 +0200 Message-Id: <20180607103818.1313-2-jkbs@redhat.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180607103818.1313-1-jkbs@redhat.com> References: <20180607103818.1313-1-jkbs@redhat.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH v4 1/2] coverage: Add command for reading counter value X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Facilitate checking coverage counters from scripts and tests with a new "coverage/read-counter" command that gets the total count for a counter. Same could be achieved by scraping the output of "coverage/show" command but the difficulties there are that output is in human readable format and zero-value counters are not listed. Signed-off-by: Jakub Sitnicki Acked-by: Han Zhou --- lib/coverage-unixctl.man | 2 ++ lib/coverage.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/lib/coverage-unixctl.man b/lib/coverage-unixctl.man index 8e5df818e..81eb93902 100644 --- a/lib/coverage-unixctl.man +++ b/lib/coverage-unixctl.man @@ -11,3 +11,5 @@ debugging. Displays the averaged per-second rates for the last few seconds, the last minute and the last hour, and the total counts of all of the coverage counters. +.IP "\fBcoverage/read-counter\fR \fIcounter\fR" +Displays the total count for the given coverage \fIcounter\fR. diff --git a/lib/coverage.c b/lib/coverage.c index 6cef82614..a95b6aa25 100644 --- a/lib/coverage.c +++ b/lib/coverage.c @@ -44,6 +44,8 @@ static unsigned int idx_count = 0; static void coverage_read(struct svec *); static unsigned int coverage_array_sum(const unsigned int *arr, const unsigned int len); +static bool coverage_read_counter(const char *name, + unsigned long long int *count); /* Registers a coverage counter with the coverage core */ void @@ -72,11 +74,32 @@ coverage_unixctl_show(struct unixctl_conn *conn, int argc OVS_UNUSED, svec_destroy(&lines); } +static void +coverage_unixctl_read_counter(struct unixctl_conn *conn, int argc OVS_UNUSED, + const char *argv[], void *aux OVS_UNUSED) +{ + unsigned long long count; + char *reply; + bool ok; + + ok = coverage_read_counter(argv[1], &count); + if (!ok) { + unixctl_command_reply_error(conn, "No such counter"); + return; + } + + reply = xasprintf("%llu\n", count); + unixctl_command_reply(conn, reply); + free(reply); +} + void coverage_init(void) { unixctl_command_register("coverage/show", "", 0, 0, coverage_unixctl_show, NULL); + unixctl_command_register("coverage/read-counter", "COUNTER", 1, 1, + coverage_unixctl_read_counter, NULL); } /* Sorts coverage counters in descending order by total, within equal @@ -372,3 +395,22 @@ coverage_array_sum(const unsigned int *arr, const unsigned int len) ovs_mutex_unlock(&coverage_mutex); return sum; } + +static bool +coverage_read_counter(const char *name, unsigned long long int *count) +{ + for (size_t i = 0; i < n_coverage_counters; i++) { + struct coverage_counter *c = coverage_counters[i]; + + if (!strcmp(c->name, name)) { + ovs_mutex_lock(&coverage_mutex); + c->total += c->count(); + *count = c->total; + ovs_mutex_unlock(&coverage_mutex); + + return true; + } + } + + return false; +} From patchwork Thu Jun 7 10:38:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Sitnicki X-Patchwork-Id: 926267 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 411hqZ4sf7z9s1b for ; Thu, 7 Jun 2018 20:39:22 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 1F011C97; Thu, 7 Jun 2018 10:38:27 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id D7244C83 for ; Thu, 7 Jun 2018 10:38:25 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-wr0-f195.google.com (mail-wr0-f195.google.com [209.85.128.195]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 88B2E760 for ; Thu, 7 Jun 2018 10:38:24 +0000 (UTC) Received: by mail-wr0-f195.google.com with SMTP id d2-v6so9515505wrm.10 for ; Thu, 07 Jun 2018 03:38:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3bDYd4Wl+anN+LaVkvvl8bQ83AAXfZK4LH+8C9cYXwg=; b=W1XuqEFg8RaPAikNc9DCLged27rvBwUjTG02q62ORJxXlbPDGo06dIJ0OLz4AsoGQs r9kIqtssAAqfLexk34Rty3jdHcSTxiPBlmIWdAqhDdQTgI7NXCFc96xLWtsdcntMkF+C hDt8VxpczVViE56myEAKBenDtuEzQzGcez3mlDjPrTIZ1Ejxz7ogT32ITkNZ3eOqhszC 5Dqnh6L7B++9Oym7I9QwjxFrKIBDv6S+fMDrV8KszIapUsk4N/ab9yZ/2mEJe2SouayY CSu8KCHmmZb5zL01F4bRBb22T/zrDPjBXuOAexWItLTqYB4kCtJLKJPXx1dTz8HSX6H6 9zKA== X-Gm-Message-State: APt69E31aBkaNFtN5kkr+0SASDbawh5RP3aRTOGzley3BI2oVkJsckyv Cw2wBltWzEYUh3nO2L0+Jx64e/PhXvY= X-Google-Smtp-Source: ADUXVKII6AyumoIPu/TQr40IBsVrA2UAdToCmwh9meEI9v/vjctpUwooPfYlrfo/3DcjAS8H56HFjg== X-Received: by 2002:adf:9187:: with SMTP id 7-v6mr1306871wri.69.1528367902749; Thu, 07 Jun 2018 03:38:22 -0700 (PDT) Received: from redhat.com (red-hat-inc.vlan404.asr1.mad1.gblx.net. [64.215.113.190]) by smtp.gmail.com with ESMTPSA id r75-v6sm2422997wmg.31.2018.06.07.03.38.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Jun 2018 03:38:22 -0700 (PDT) From: Jakub Sitnicki To: dev@openvswitch.org Date: Thu, 7 Jun 2018 12:38:18 +0200 Message-Id: <20180607103818.1313-3-jkbs@redhat.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180607103818.1313-1-jkbs@redhat.com> References: <20180607103818.1313-1-jkbs@redhat.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH v4 2/2] ovn: Test for full logical flow processing in ovn-controller X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Add a test that performs typical operations of creating & destroying logical routers, switches, ports, address sets and ACLs while checking if they trigger full logical flow processing in the ovn-controller. This way confirm that incremental processing is taking effect when we expect it to. Place the new test in a separate module - tests/ovn-performance.at, instead of the usual tests/ovn.at as it doesn't test OVN's functionality but rather a performance aspect of ovn-controller. Signed-off-by: Jakub Sitnicki Acked-by: Han Zhou --- tests/automake.mk | 3 +- tests/ovn-performance.at | 389 +++++++++++++++++++++++++++++++++++++++++++++++ tests/testsuite.at | 1 + 3 files changed, 392 insertions(+), 1 deletion(-) create mode 100644 tests/ovn-performance.at diff --git a/tests/automake.mk b/tests/automake.mk index c420b29f3..1e009389c 100644 --- a/tests/automake.mk +++ b/tests/automake.mk @@ -105,7 +105,8 @@ TESTSUITE_AT = \ tests/ovn-controller-vtep.at \ tests/mcast-snooping.at \ tests/packet-type-aware.at \ - tests/nsh.at + tests/nsh.at \ + tests/ovn-performance.at SYSTEM_KMOD_TESTSUITE_AT = \ tests/system-common-macros.at \ diff --git a/tests/ovn-performance.at b/tests/ovn-performance.at new file mode 100644 index 000000000..8d2007a41 --- /dev/null +++ b/tests/ovn-performance.at @@ -0,0 +1,389 @@ +# +# Tests targeting performance of OVN components. +# + +m4_divert_push([PREPARE_TESTS]) + +# vec_cmp VALUE_VEC OP-VALUE_VEC +# +# Compares each value from VALUE_VEC to the operator-value pair from the +# OP-VALUE_VEC. +# +# VALUE_VEC must be a list of values separated by a character from $IFS. +# OP-VALUE_VEC must be a list of operator-value expressions separated by a +# character from $IFS. Operator-value expressions cannot contain any characters +# from $IFS like spaces. '=' is treated as an equality operator ('==') for +# conciseness. +# +# Returns the result of each comparison as a list of boolean values (0 or 1) +# separated by a new-line character. +vec_cmp() { + local a b i j + + i=0 + for a in $1; do + j=0 + for b in $2; do + if test $i -eq $j; then + # Replace assignment '=' with equality comparison '==' + case "$b" in + =[[0-9]]*) b="=$b" ;; + esac + + echo $(($a $b)) + break + fi + j=$((j + 1)) + done + i=$((i + 1)) + done +} + +# vec_sub VEC_A VEC_B +# +# Subtracts two vectors: +# +# VEC_A = [a1, a2, ...] +# VEC_B = [b1, b2, ...] +# OUT = [(a1 - b1), (a2 - b2), ...] +# +# VEC_A and VEC_B must be lists of values separated by a character from $IFS. +vec_sub() { + local a b i j + + i=0 + for a in $1; do + j=0 + for b in $2; do + if test $i -eq $j; then + echo $((a - b)) + break + fi + j=$((j + 1)) + done + i=$((i + 1)) + done +} + +# vec_fold VEC OP +# +# Reduces a vector to a single value by applying the binary operator OP (i.e., +# one that requires two arguments) cumulatively to all vector elements from left +# to right: +# +# VEC = [e1, e2, e3 ...] +# OUT = (...((e1 OP e2) OP e3) OP ...) +# +# VEC must be a list of values separated by a character from $IFS. +vec_fold() { + local first op prod + + first=1 + op=$2 + for a in $1; do + if test $first -eq 1; then + prod=$a + first=0 + else + prod=$((prod $op a)) + fi + done + echo $prod +} + +# read_counters SANDBOXES TARGET COUNTER +# +# Prints out the coverage COUNTER for the TARGET in each of the SANDBOXES. +# +# SANDBOXES must be a list of strings separated by a character from $IFS. +read_counters() { + local sims="$1" target="$2" counter="$3" + + for sim in $sims; do + as $sim ovs-appctl -t "$target" coverage/read-counter "$counter" || return 1 + done +} + +# counter_delta_ SANDBOXES TARGET COUNTER COMMAND +# +# Runs the COMMAND and reports the COUNTER change registered during the command +# run for the given TARGET in each of the SANDBOXES. +counter_delta_() { + local sims="$1" target="$2" counter="$3" cmd="$4" + local before after + + before=$(read_counters "$sims" "$target" "$counter") || return 1 + eval "$cmd" >/dev/null || return 1 + after=$(read_counters "$sims" "$target" "$counter") || return 1 + + vec_sub "$after" "$before" +} + +# counter_delta SANDBOXES TARGET COUNTER COMMAND +# +# Same as counter_delta_ but also prints the COUNTER values together with the +# COMMAND to standard error. +counter_delta() { + local cmd="$4" + local v + + v=$(counter_delta_ "$@") || return 1 + + # Dump the counters and the command for troubleshooting + echo "$v" | tr '\n' '\t' >&2 + echo "$cmd" >&2 + + echo "$v" +} + +# vec_cmp_counter_delta SANDBOXES TARGET COUNTER CONDS COMMAND +# +# Check if COUNTER change in the TARGET app in each of the SANDBOXES after +# running the COMMAND meets the conditions listed as operator-value pairs in +# CONDS. +vec_cmp_counter_delta() { + local v + + v=$(counter_delta "$1" "$2" "$3" "$5") || return 1 + v=$(vec_cmp "$v" "$4") || return 1 + v=$(vec_fold "$v" "&&") || return 1 + + echo "$v" +} + +# cmp_counter_delta SANDBOXES TARGET COUNTER COND COMMAND +# +# Check if COUNTER change in the TARGET app in each of the SANDBOXES after +# running the COMMAND meets the COND condition given as a operator-value pair. +cmp_counter_delta() { + local conds="" + + # Use the same condition for each sandbox + for _ in $1; do + conds="$conds $4" + done + + vec_cmp_counter_delta "$1" "$2" "$3" "$conds" "$5" +} + +m4_divert_pop([PREPARE_TESTS]) + +# CHECK_COUNTER_DELTA_IS_ZERO SANDBOXES TARGET COUNTER COMMAND +# +# Runs the COMMAND and checks if the COUNTER value for the TARGET in all of +# the SANDBOXES did not change. +m4_define([CHECK_COUNTER_DELTA_IS_ZERO],[ + rv=$(cmp_counter_delta "$1" "$2" "$3" "=0" "$4") + rc=$? + AT_CHECK([test $rc -eq 0 -a $rv -eq 1]) +]) + +# CHECK_COUNTER_DELTA_IS_NOT_ZERO SANDBOXES TARGET COUNTER COMMAND +# +# Runs the COMMAND and checks if the COUNTER value for the TARGET in +# all of the SANDBOXES has changed. +m4_define([CHECK_COUNTER_DELTA_IS_NOT_ZERO],[ + rv=$(cmp_counter_delta "$1" "$2" "$3" ">0" "$4") + rc=$? + AT_CHECK([test $rc -eq 0 -a $rv -eq 1]) +]) + +# CHECK_COUNTER_DELTA_COND SANDBOXES TARGET COUNTER CONDS COMMAND +# +# Runs the COMMAND and checks if the COUNTER value for the TARGET in all of the +# SANDBOXES satisfies the conditions listed in CONDS. +m4_define([CHECK_COUNTER_DELTA_COND],[ + rv=$(vec_cmp_counter_delta "$1" "$2" "$3" "$4" "$5") + rc=$? + AT_CHECK([test $rc -eq 0 -a $rv -eq 1]) +]) + +# OVN_CONTROLLER_EXPECT_HIT SANDBOXES COUNTER COMMAND +# +# Checks if the COUNTER value has changed for any of the ovn-controller +# processes in the SANDBOXES when the COMMAND was run. +m4_define([OVN_CONTROLLER_EXPECT_HIT],[ + CHECK_COUNTER_DELTA_IS_NOT_ZERO([$1], [ovn-controller], [$2], [$3]) +]) + +# OVN_CONTROLLER_EXPECT_NO_HIT SANDBOXES COUNTER COMMAND +# +# Checks if the COUNTER value has not changed for any of the ovn-controller +# processes in the SANDBOXES when the COMMAND was run. +m4_define([OVN_CONTROLLER_EXPECT_NO_HIT],[ + CHECK_COUNTER_DELTA_IS_ZERO([$1], [ovn-controller], [$2], [$3]) +]) + +# OVN_CONTROLLER_EXPECT_HIT_COND SANDBOXES COUNTER CONDS COMMAND +# +# Checks if the change of the COUNTER value, when the COMMAND was run, of the +# ovn-controller process in each of the SANDBOXES meets the conditions in +# CONDS. CONDS must be a list of operator-value pairs, for example "[>0 =0]", +# following the same order as SANDBOXES. +m4_define([OVN_CONTROLLER_EXPECT_HIT_COND],[ + CHECK_COUNTER_DELTA_COND([$1], [ovn-controller], [$2], [$3], [$4]) +]) + +AT_SETUP([ovn -- ovn-controller incremental processing]) +# Check which operations the trigger full logical flow processing. +# +# Create and destroy logical routers, switches, ports, address sets and ACLs +# while counting calls to lflow_run() in ovn-controller. + +ovn_start +net_add n1 +for i in 1 2; do + sim_add hv$i + as hv$i + ovs-vsctl add-br br-phys + ovn_attach n1 br-phys 192.168.0.$i +done + +# Add router lr1 +OVN_CONTROLLER_EXPECT_HIT( + [hv1 hv2], [lflow_run], + [ovn-nbctl --wait=hv lr-add lr1] +) + +for i in 1 2; do + ls=ls$i + lsp=$ls-lr1 + lrp=lr1-$ls + + # Add switch $ls + OVN_CONTROLLER_EXPECT_HIT( + [hv1 hv2], [lflow_run], + [ovn-nbctl --wait=hv ls-add $ls] + ) + OVN_CONTROLLER_EXPECT_NO_HIT( + [hv1 hv2], [lflow_run], + [ovn-nbctl --wait=hv add Logical_Switch $ls other_config subnet=10.0.$i.0/24] + ) + + # Add router port to $ls + OVN_CONTROLLER_EXPECT_HIT( + [hv1 hv2], [lflow_run], + [ovn-nbctl --wait=hv lrp-add lr1 $lrp 02:00:00:00:0$i:01 10.0.$i.1/24] + ) + OVN_CONTROLLER_EXPECT_NO_HIT( + [hv1 hv2], [lflow_run], + [ovn-nbctl --wait=hv lsp-add $ls $lsp] + ) + OVN_CONTROLLER_EXPECT_HIT( + [hv1 hv2], [lflow_run], + [ovn-nbctl --wait=hv lsp-set-type $lsp router] + ) + OVN_CONTROLLER_EXPECT_HIT( + [hv1 hv2], [lflow_run], + [ovn-nbctl --wait=hv lsp-set-addresses $lsp router] + ) +done + +for i in 1 2; do + j=$((i%2 + 1)) + as=as$i + ls=ls$i + lp=lp$i + vif=vif$i + + # Add port $lp + OVN_CONTROLLER_EXPECT_NO_HIT( + [hv1 hv2], [lflow_run], + [ovn-nbctl --wait=hv lsp-add $ls $lp] + ) + OVN_CONTROLLER_EXPECT_NO_HIT( + [hv1 hv2], [lflow_run], + [ovn-nbctl --wait=hv lsp-set-addresses $lp "dynamic"] + ) + OVN_CONTROLLER_EXPECT_NO_HIT( + [hv1 hv2], [lflow_run], + [ovn-nbctl wait-until Logical_Switch_Port $lp dynamic_addresses!=[[]] && + ovn-nbctl --wait=hv sync] + ) + OVN_CONTROLLER_EXPECT_NO_HIT( + [hv1 hv2], [lflow_run], + [ovn-nbctl get Logical_Switch_Port $lp dynamic_addresses && + ovn-nbctl --wait=hv sync] + ) + + # Add address set $as + OVN_CONTROLLER_EXPECT_NO_HIT( + [hv1 hv2], [lflow_run], + [ovn-nbctl --wait=hv create Address_Set name="$as"] + ) + OVN_CONTROLLER_EXPECT_NO_HIT( + [hv1 hv2], [lflow_run], + [ovn-nbctl --wait=hv add Address_Set "$as" addresses "10.0.$i.10"] + ) + + # Add ACLs for port $lp + OVN_CONTROLLER_EXPECT_NO_HIT( + [hv1 hv2], [lflow_run], + [ovn-nbctl --wait=hv acl-add $ls to-lport 1001 'outport == \"$lp\" && ip4.src == \\$$as' allow] + ) + OVN_CONTROLLER_EXPECT_NO_HIT( + [hv1 hv2], [lflow_run], + [ovn-nbctl --wait=hv acl-add $ls to-lport 1000 'outport == \"$lp\"' drop] + ) + + # Bind port $lp and wait for it to come up + OVN_CONTROLLER_EXPECT_HIT_COND( + [hv$i hv$j], [lflow_run], [>0 =0], + [as hv$i ovs-vsctl add-port br-int $vif -- set Interface $vif external-ids:iface-id=$lp && + ovn-nbctl wait-until Logical_Switch_Port $lp 'up=true' && + ovn-nbctl --wait=hv sync] + ) +done + +for i in 1 2; do + j=$((i%2 + 1)) + as=as$i + ls=ls$i + lp=lp$i + + # Delete port $lp + OVN_CONTROLLER_EXPECT_HIT_COND( + [hv$i hv$j], [lflow_run], [>0 =0], + [ovn-nbctl --wait=hv lsp-del $lp] + ) + + # Delete ACLs for port $lp + OVN_CONTROLLER_EXPECT_NO_HIT( + [hv1 hv2], [lflow_run], + [ovn-nbctl --wait=hv acl-del $ls to-lport 1001 'outport == \"$lp\" && ip4.src == \\$$as'] + ) + OVN_CONTROLLER_EXPECT_NO_HIT( + [hv1 hv2], [lflow_run], + [ovn-nbctl --wait=hv acl-del $ls to-lport 1000 'outport == \"$lp\"'] + ) + + # Delete address set $as + OVN_CONTROLLER_EXPECT_NO_HIT( + [hv1 hv2], [lflow_run], + [ovn-nbctl --wait=hv remove Address_Set "$as" addresses "10.0.$i.10"] + ) + OVN_CONTROLLER_EXPECT_NO_HIT( + [hv1 hv2], [lflow_run], + [ovn-nbctl --wait=hv destroy Address_Set "$as"] + ) +done + +for i in 1 2; do + ls=ls$i + + # Delete switch $ls + OVN_CONTROLLER_EXPECT_HIT( + [hv1 hv2], [lflow_run], + [ovn-nbctl --wait=hv ls-del $ls] + ) +done + +# Delete router lr1 +OVN_CONTROLLER_EXPECT_HIT( + [hv1 hv2], [lflow_run], + [ovn-nbctl --wait=hv lr-del lr1] +) + +OVN_CLEANUP([hv1], [hv2]) + +AT_CLEANUP diff --git a/tests/testsuite.at b/tests/testsuite.at index 15c385e2c..c769770b1 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -80,3 +80,4 @@ m4_include([tests/ovn-controller-vtep.at]) m4_include([tests/mcast-snooping.at]) m4_include([tests/packet-type-aware.at]) m4_include([tests/nsh.at]) +m4_include([tests/ovn-performance.at])