From patchwork Wed Oct 30 21:12:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Han Zhou X-Patchwork-Id: 1186968 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) 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=none (p=none dis=none) header.from=ovn.org 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 473Ltz0DBqz9sP3 for ; Thu, 31 Oct 2019 08:19:38 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 522D8E9C; Wed, 30 Oct 2019 21:13:24 +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 D5E46E4C for ; Wed, 30 Oct 2019 21:13:19 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id D0EC28A9 for ; Wed, 30 Oct 2019 21:13:18 +0000 (UTC) X-Originating-IP: 216.113.160.77 Received: from localhost.localdomain.localdomain (unknown [216.113.160.77]) (Authenticated sender: hzhou@ovn.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 93FCF1C0004; Wed, 30 Oct 2019 21:13:16 +0000 (UTC) From: Han Zhou To: dev@openvswitch.org Date: Wed, 30 Oct 2019 14:12:50 -0700 Message-Id: <1572469973-2733-11-git-send-email-hzhou@ovn.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1572469973-2733-1-git-send-email-hzhou@ovn.org> References: <1572469973-2733-1-git-send-email-hzhou@ovn.org> X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Han Zhou Subject: [ovs-dev] [PATCH ovn v2 10/13] ovn.at: e2e test for OVN interconnection. 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 Test with 5 AZs, each with 1 GW, 1 HV, 5 VIFs, 5 LRs, connected to 5 transit switches. Verify traffic through each TS between each pair of AZs. Signed-off-by: Han Zhou --- tests/ovn.at | 149 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) diff --git a/tests/ovn.at b/tests/ovn.at index d78689d..2737b2c 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -16365,3 +16365,152 @@ grep 101 | wc -l`]) OVN_CLEANUP([hv1]) AT_CLEANUP + +AT_SETUP([ovn -- interconnection]) +AT_SKIP_IF([test $HAVE_PYTHON = no]) +ovn_init_ic_db +n_az=5 +n_ts=5 +for i in `seq 1 $n_az`; do + ovn_start az$i +done + +net_add n1 + +# 1 HV and 1 GW per AZ +for az in `seq 1 $n_az`; do + sim_add hv$az + as hv$az + ovs-vsctl add-br br-phys + ovn_az_attach az$az n1 br-phys 192.168.$az.1 16 + for p in `seq 1 $n_ts`; do + ovs-vsctl -- add-port br-int vif$p -- \ + set interface vif$p external-ids:iface-id=lsp$az-$p \ + options:tx_pcap=hv$az/vif$p-tx.pcap \ + options:rxq_pcap=hv$az/vif$p-rx.pcap \ + ofport-request=$p + done + + sim_add gw$az + as gw$az + ovs-vsctl add-br br-phys + ovn_az_attach az$az n1 br-phys 192.168.$az.2 16 + ovs-vsctl set open . external-ids:is-interconn=true +done + +for ts in `seq 1 $n_ts`; do + ovn-inbctl create Transit_Switch name=ts$ts +done + +for az in `seq 1 $n_az`; do + ovn_as az$az + + # Each AZ has n_ts LSPi->LSi->LRi connecting to each TSi + for i in `seq 1 $n_ts`; do + lsp_mac=00:00:00:0$az:0$i:00 + lrp_ls_mac=00:00:00:0$az:0$i:01 + lrp_ts_mac=00:00:00:0$az:0$i:02 + lsp_ip=10.$az.$i.123 + lrp_ls_ip=10.$az.$i.1 + lrp_ts_ip=169.254.$i.$az + + ovn-nbctl ls-add ls$az-$i + ovn-nbctl lsp-add ls$az-$i lsp$az-$i + ovn-nbctl lsp-set-addresses lsp$az-$i "$lsp_mac $lsp_ip" + + ovn-nbctl lr-add lr$az-$i + + ovn-nbctl lrp-add lr$az-$i lrp-lr$az-$i-ls$az-$i $lrp_ls_mac $lrp_ls_ip/24 + ovn-nbctl lsp-add ls$az-$i lsp-ls$az-$i-lr$az-$i + ovn-nbctl lsp-set-addresses lsp-ls$az-$i-lr$az-$i router + ovn-nbctl lsp-set-type lsp-ls$az-$i-lr$az-$i router + ovn-nbctl lsp-set-options lsp-ls$az-$i-lr$az-$i router-port=lrp-lr$az-$i-ls$az-$i + + ovn-nbctl lrp-add lr$az-$i lrp-lr$az-$i-ts$i $lrp_ts_mac $lrp_ts_ip/24 + ovn-nbctl lsp-add ts$i lsp-ts$i-lr$az-$i + ovn-nbctl lsp-set-addresses lsp-ts$i-lr$az-$i router + ovn-nbctl lsp-set-type lsp-ts$i-lr$az-$i router + ovn-nbctl lsp-set-options lsp-ts$i-lr$az-$i router-port=lrp-lr$az-$i-ts$i + ovn-nbctl lrp-set-gateway-chassis lrp-lr$az-$i-ts$i gw$az + + for remote in `seq 1 $n_az`; do + if test $az = $remote; then + continue + fi + ovn-nbctl lr-route-add lr$az-$i 10.$remote.$i.0/24 169.254.$i.$remote + done + done +done + +# Pre-populate the hypervisors' ARP tables so that we don't lose any +# packets for ARP resolution (native tunneling doesn't queue packets +# for ARP resolution). +OVN_POPULATE_ARP + +for i in `seq 1 $n_az`; do + AT_CHECK([ovn_as az$i ovn-nbctl --timeout=3 --wait=sb sync], [0], [ignore]) +done + +# Allow some time for ovn-northd and ovn-controller to catch up. +# XXX This should be more systematic. +sleep 2 + +# Send packets between AZs on each TS +for s_az in `seq 1 $n_az`; do + for d_az in `seq 1 $n_az`; do + if test $s_az = $d_az; then + continue + fi + + for i in `seq 1 $n_ts`; do + lsp_smac=00:00:00:0${s_az}:0$i:00 + lsp_dmac=00:00:00:0${d_az}:0$i:00 + lrp_ls_smac=00:00:00:0${s_az}:0$i:01 + lrp_ls_dmac=00:00:00:0${d_az}:0$i:01 + lsp_sip=10.${s_az}.$i.123 + lsp_dip=10.${d_az}.$i.123 + + packet="inport==\"lsp${s_az}-$i\" && eth.src==$lsp_smac && eth.dst==$lrp_ls_smac && + ip4 && ip.ttl==64 && ip4.src==$lsp_sip && ip4.dst==$lsp_dip && + udp && udp.src==53 && udp.dst==4369" + AT_CHECK([as hv${s_az} ovs-appctl -t ovn-controller inject-pkt "$packet"]) + + # Packet to Expect + # The TTL should be decremented by 2. + packet="eth.src==$lrp_ls_dmac && eth.dst==$lsp_dmac && + ip4 && ip.ttl==62 && ip4.src==$lsp_sip && ip4.dst==$lsp_dip && + udp && udp.src==53 && udp.dst==4369" + echo $packet | ovstest test-ovn expr-to-packets >> ${d_az}-$i.expected + done + done +done + +echo "---------INB dump-----" +ovn-inbctl show +echo "---------------------" + +echo "---------ISB dump-----" +ovn-isbctl show +echo "---------------------" +ovn-isbctl list gateway +echo "---------------------" +ovn-isbctl list datapath_binding +echo "---------------------" +ovn-isbctl list port_binding +echo "---------------------" + +for az in `seq 1 $n_az`; do + for i in `seq 1 $n_ts`; do + OVN_CHECK_PACKETS([hv$az/vif$i-tx.pcap], [$az-$i.expected]) + done +done + +for az in `seq 1 $n_az`; do + OVN_CLEANUP_SBOX([hv$az]) + OVN_CLEANUP_SBOX([gw$az]) + OVN_CLEANUP_AZ([az$az]) +done + +OVN_CLEANUP_IC + +AT_CLEANUP