From patchwork Tue Jun 7 08:19:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Itamar Ofek X-Patchwork-Id: 631387 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (archives.nicira.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 3rP4HZ4cdVz9sBf for ; Tue, 7 Jun 2016 18:19:54 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=vM9t8uia; dkim-atps=neutral Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 1C059106EE; Tue, 7 Jun 2016 01:19:53 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v3.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id 20F3F106C9 for ; Tue, 7 Jun 2016 01:19:51 -0700 (PDT) Received: from bar6.cudamail.com (localhost [127.0.0.1]) by mx3v3.cudamail.com (Postfix) with ESMTPS id 9D232162432 for ; Tue, 7 Jun 2016 02:19:50 -0600 (MDT) X-ASG-Debug-ID: 1465287564-0b3237676c21460001-byXFYA Received: from mx3-pf1.cudamail.com ([192.168.14.2]) by bar6.cudamail.com with ESMTP id glFEWqrK5WgGXCE2 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 07 Jun 2016 02:19:24 -0600 (MDT) X-Barracuda-Envelope-From: itamar.ofeq@gmail.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.2 Received: from unknown (HELO mail-lf0-f67.google.com) (209.85.215.67) by mx3-pf1.cudamail.com with ESMTPS (AES128-SHA encrypted); 7 Jun 2016 08:19:23 -0000 Received-SPF: pass (mx3-pf1.cudamail.com: SPF record at _netblocks.google.com designates 209.85.215.67 as permitted sender) X-Barracuda-Apparent-Source-IP: 209.85.215.67 X-Barracuda-RBL-IP: 209.85.215.67 Received: by mail-lf0-f67.google.com with SMTP id s186so8808160lfs.2 for ; Tue, 07 Jun 2016 01:19:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=491GqOctiP0FyRNh1Te3XgJVeAmxAfAWD7y+qwSe8d4=; b=vM9t8uiakXzTT5aTMtx+y+w4fkGrHdX4wb5lF1yeWm/Sb6Caqg17pkcKm9myGzD495 tckk6tdwnj+nE5WwJ95S6s8q7OhX4gz9Mp/meQoU6rVa6N4+h8C545JAzeZ0ZnuoT/gL uhVy3ZJfNqIKJPrgKvt7O44uRgougiAuYj96Dn04/DHYZVwab40LcWM9upb6/t426x9Z EputVa37eeRbelx0OEo6Yz+34B9bd4k9cvnYhf47hMXFnOkwYtTzOC2rIDicTddrb5rK xr0Q4gt8f0ucXehqcNvwwYa41zdKqSIXSu2kF7Gj5v9O6BGQwjqjf2n4oqAnV1sxEytz exvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=491GqOctiP0FyRNh1Te3XgJVeAmxAfAWD7y+qwSe8d4=; b=BNJ+hx+6Fp5za85CR3/LNo6b2MGSrrWeyMkqc9YnemZsVRumzl4T0kHNJj7Sfu2XNe gSrQgtfUpUQB1jCJFtktQswuUNdt99iFgqC7DcGwIpMxjDlrPFQkUmKz2Yp59MDnyNxa 1F2GaV6Q+o3z7wj2UDLIlYGUvEkk+0Qmaw3b1aQ25h7GfgIAdgal3ot0cD6Ah3oe2RrH oixnq7usEJY0FUzC58J9vgKt8fRzfIt04MqOk3Q8QNdGjifLe0MwRB5IgFVslutFwI8p l6dlNDC25QAqe1TyUNTtqXrpKx+ZSS+vsF2C91ZyY2lyHW9wx0vSOYPhcFWYzrCFyAg3 /l9A== X-Gm-Message-State: ALyK8tIpf+2jzuuk2moBUmNWTOXokTSn2W8vtyeZh1ZamDkwohiR/oL/Vo32D6Nfltd6b7euUAhiLpE8i+ltpg== X-Received: by 10.46.1.197 with SMTP id f66mr5521360lji.52.1465287560422; Tue, 07 Jun 2016 01:19:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.25.163.5 with HTTP; Tue, 7 Jun 2016 01:19:19 -0700 (PDT) X-CudaMail-Envelope-Sender: itamar.ofeq@gmail.com From: Itamar Ofek Date: Tue, 7 Jun 2016 11:19:19 +0300 Message-ID: X-CudaMail-MID: CM-V1-606001641 X-CudaMail-DTE: 060716 X-CudaMail-Originating-IP: 209.85.215.67 To: dev@openvswitch.org X-ASG-Orig-Subj: [##CM-V1-606001641##][PATCH] vtep: add per-tunnel tunnel key support in vtep-ctl and ovs-vtep. related to commit c2cd1902 X-GBUdb-Analysis: 0, 209.85.215.67, Ugly c=0.25607 p=-0.166667 Source Normal X-MessageSniffer-Rules: 0-0-0-32767-c X-Barracuda-Connect: UNKNOWN[192.168.14.2] X-Barracuda-Start-Time: 1465287564 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-Barracuda-BRTS-Status: 1 X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-Spam-Score: 1.10 X-Barracuda-Spam-Status: No, SCORE=1.10 using global scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=4.0 tests=BSF_SC0_MV0713, BSF_SC5_MJ1963, DKIM_SIGNED, HTML_MESSAGE, INFO_TLD, NORMAL_HTTP_TO_IP, RDNS_NONE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.30239 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.00 DKIM_SIGNED Domain Keys Identified Mail: message has a signature 0.00 NORMAL_HTTP_TO_IP URI: Uses a dotted-decimal IP address in URL 0.00 INFO_TLD URI: Contains an URL in the INFO top-level domain 0.00 HTML_MESSAGE BODY: HTML included in message 0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS 0.50 BSF_SC0_MV0713 Custom rule MV0713 0.50 BSF_SC5_MJ1963 Custom Rule MJ1963 X-Content-Filtered-By: Mailman/MimeDel 2.1.16 Subject: [ovs-dev] [PATCH] vtep: add per-tunnel tunnel key support in vtep-ctl and ovs-vtep. related to commit c2cd1902 X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@openvswitch.org Sender: "dev" This patch adds support for handeling a per-tunnel tunnel key in the ovs-vtep and vtep-ctl to support the usage of neutron L2GW as an inter-cloud gateway. The Neutron spec is available here: https://review.openstack.org/#/c/270786/ Requested-by: "Ofer Ben-Yacov" Signed-off-by: "Itamar Ofek" --- tests/vtep-ctl.at | 132 +++++++++++++++++++++++++-------------------------- vtep/ovs-vtep | 52 +++++++++++++------- vtep/vtep-ctl.c | 138 +++++++++++++++++++++++++++++++++++------------------- vtep/vtep.xml | 10 +++- 4 files changed, 200 insertions(+), 132 deletions(-)

diff --git a/tests/vtep-ctl.at b/tests/vtep-ctl.at index f0511ad..b7803c3 100644 --- a/tests/vtep-ctl.at +++ b/tests/vtep-ctl.at @@ -437,8 +437,8 @@ AT_CHECK([RUN_VTEP_CTL( ], [0], [], [], [VTEP_CTL_CLEANUP]) AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0], [ucast-mac-local - 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 - 00:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 + 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 [[]] + 00:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 [[]] mcast-mac-local @@ -464,7 +464,7 @@ AT_CHECK([RUN_VTEP_CTL( ], [0], [], [], [VTEP_CTL_CLEANUP]) AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0], [ucast-mac-local - 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.11 + 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.11 [[]] mcast-mac-local @@ -484,8 +484,8 @@ AT_CHECK([RUN_VTEP_CTL( ], [0], [], [], [VTEP_CTL_CLEANUP]) AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0], [ucast-mac-local - 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 - 00:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 + 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 [[]] + 00:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 [[]] mcast-mac-local @@ -495,7 +495,7 @@ AT_CHECK([RUN_VTEP_CTL( ], [0], [], [], [VTEP_CTL_CLEANUP]) AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0], [ucast-mac-local - 00:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 + 00:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 [[]] mcast-mac-local @@ -515,8 +515,8 @@ AT_CHECK([RUN_VTEP_CTL( ], [0], [], [], [VTEP_CTL_CLEANUP]) AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0], [ucast-mac-remote - 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 - 00:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 + 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 [[]] + 00:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 [[]] mcast-mac-remote @@ -542,7 +542,7 @@ AT_CHECK([RUN_VTEP_CTL( ], [0], [], [], [VTEP_CTL_CLEANUP]) AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0], [ucast-mac-remote - 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.11 + 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.11 [[]] mcast-mac-remote @@ -562,8 +562,8 @@ AT_CHECK([RUN_VTEP_CTL( ], [0], [], [], [VTEP_CTL_CLEANUP]) AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0], [ucast-mac-remote - 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 - 00:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 + 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 [[]] + 00:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 [[]] mcast-mac-remote @@ -573,7 +573,7 @@ AT_CHECK([RUN_VTEP_CTL( ], [0], [], [], [VTEP_CTL_CLEANUP]) AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0], [ucast-mac-remote - 00:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 + 00:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 [[]] mcast-mac-remote @@ -595,16 +595,16 @@ AT_CHECK([RUN_VTEP_CTL( ], [0], [], [], [VTEP_CTL_CLEANUP]) AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0], [ucast-mac-local - 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 - 00:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 + 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 [[]] + 00:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 [[]] mcast-mac-local ], [], [VTEP_CTL_CLEANUP]) AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0], [ucast-mac-remote - 02:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 - 02:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 + 02:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 [[]] + 02:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 [[]] mcast-mac-remote @@ -627,9 +627,9 @@ AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0], [ucast-mac-local mcast-mac-local - 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 - 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12 - 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 + 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 [[]] + 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12 [[]] + 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 [[]] ], [], [VTEP_CTL_CLEANUP]) AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0], @@ -657,10 +657,10 @@ AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0], [ucast-mac-local mcast-mac-local - 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 - 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12 - 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.13 - 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 + 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 [[]] + 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12 [[]] + 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.13 [[]] + 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 [[]] ], [], [VTEP_CTL_CLEANUP]) AT_CHECK([RUN_VTEP_CTL( @@ -670,9 +670,9 @@ AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0], [ucast-mac-local mcast-mac-local - 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 - 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.13 - 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 + 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 [[]] + 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.13 [[]] + 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 [[]] ], [], [VTEP_CTL_CLEANUP]) VTEP_CTL_CLEANUP @@ -693,9 +693,9 @@ AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0], [ucast-mac-remote mcast-mac-remote - 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 - 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12 - 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 + 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 [[]] + 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12 [[]] + 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 [[]] ], [], [VTEP_CTL_CLEANUP]) AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0], @@ -723,10 +723,10 @@ AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0], [ucast-mac-remote mcast-mac-remote - 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 - 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12 - 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.13 - 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 + 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 [[]] + 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12 [[]] + 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.13 [[]] + 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 [[]] ], [], [VTEP_CTL_CLEANUP]) AT_CHECK([RUN_VTEP_CTL( @@ -736,9 +736,9 @@ AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0], [ucast-mac-remote mcast-mac-remote - 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 - 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.13 - 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 + 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 [[]] + 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.13 [[]] + 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 [[]] ], [], [VTEP_CTL_CLEANUP]) VTEP_CTL_CLEANUP @@ -762,18 +762,18 @@ AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0], [ucast-mac-local mcast-mac-local - 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 - 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12 - 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 + 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 [[]] + 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12 [[]] + 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 [[]] ], [], [VTEP_CTL_CLEANUP]) AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0], [ucast-mac-remote mcast-mac-remote - 03:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 - 03:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12 - 03:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 + 03:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 [[]] + 03:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12 [[]] + 03:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 [[]] ], [], [VTEP_CTL_CLEANUP]) VTEP_CTL_CLEANUP @@ -797,22 +797,22 @@ AT_CHECK([RUN_VTEP_CTL( ], [0], [], [], [VTEP_CTL_CLEANUP]) AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0], [ucast-mac-local - 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 + 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 [[]] mcast-mac-local - 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 - 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12 - 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 + 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 [[]] + 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12 [[]] + 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 [[]] ], [], [VTEP_CTL_CLEANUP]) AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0], [ucast-mac-remote - 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 + 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 [[]] mcast-mac-remote - 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 - 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12 - 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 + 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 [[]] + 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12 [[]] + 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 [[]] ], [], [VTEP_CTL_CLEANUP]) AT_CHECK([RUN_VTEP_CTL( @@ -825,12 +825,12 @@ mcast-mac-local ], [], [VTEP_CTL_CLEANUP]) AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0], [ucast-mac-remote - 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 + 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 [[]] mcast-mac-remote - 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 - 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12 - 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 + 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 [[]] + 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12 [[]] + 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 [[]] ], [], [VTEP_CTL_CLEANUP]) VTEP_CTL_CLEANUP @@ -854,34 +854,34 @@ AT_CHECK([RUN_VTEP_CTL( ], [0], [], [], [VTEP_CTL_CLEANUP]) AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0], [ucast-mac-local - 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 + 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 [[]] mcast-mac-local - 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 - 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12 - 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 + 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 [[]] + 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12 [[]] + 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 [[]] ], [], [VTEP_CTL_CLEANUP]) AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0], [ucast-mac-remote - 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 + 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 [[]] mcast-mac-remote - 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 - 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12 - 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 + 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 [[]] + 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12 [[]] + 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 [[]] ], [], [VTEP_CTL_CLEANUP]) AT_CHECK([RUN_VTEP_CTL( [clear-remote-macs ls1])], [0], [], [], [VTEP_CTL_CLEANUP]) AT_CHECK([RUN_VTEP_CTL([list-local-macs ls1])], [0], [ucast-mac-local - 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 + 00:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 [[]] mcast-mac-local - 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 - 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12 - 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 + 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.10 [[]] + 01:11:22:33:44:55 -> vxlan_over_ipv4/10.0.0.12 [[]] + 01:11:22:33:44:66 -> vxlan_over_ipv4/10.0.0.11 [[]] ], [], [VTEP_CTL_CLEANUP]) AT_CHECK([RUN_VTEP_CTL([list-remote-macs ls1])], [0], diff --git a/vtep/ovs-vtep b/vtep/ovs-vtep index e52c66f..59b76db 100755 --- a/vtep/ovs-vtep +++ b/vtep/ovs-vtep @@ -175,11 +175,25 @@ class Logical_Switch(object): del self.ports[lbinding] self.update_flood() + def tunnel_dict(self,entry): + return { + 'tunnel_type': entry[2], + 'dest_ip': entry[3], + 'tunnel_key': entry[4], + } + def add_tunnel(self, tunnel): global tun_id - vlog.info("adding tunnel %s" % tunnel) - encap, ip = tunnel.split("/") - + use_self_key = False + tunnel_key = tunnel['tunnel_key'] + if not tunnel_key: + use_self_key = True + tunnel_key = self.tunnel_key + vlog.info("adding tunnel %s key %s" % (tunnel['dest_ip'], + tunnel_key)) + + encap = tunnel['tunnel_type'] + ip = tunnel['dest_ip'] if encap != "vxlan_over_ipv4": vlog.warn("unsupported tunnel format %s" % encap) return @@ -189,7 +203,7 @@ class Logical_Switch(object): ovs_vsctl("add-port %s %s -- set Interface %s type=vxlan " "options:key=%s options:remote_ip=%s" - % (self.short_name, tun_name, tun_name, self.tunnel_key, ip)) + % (self.short_name, tun_name, tun_name, tunnel_key, ip)) for i in range(10): port_no = ovs_vsctl("get Interface %s ofport" % tun_name) @@ -203,10 +217,13 @@ class Logical_Switch(object): # Give the system a moment to allocate the port number time.sleep(0.5) - self.tunnels[tunnel] = (port_no, tun_name, ip) + self.tunnels[ip] = (port_no, + tun_name, + ip, + tunnel['tunnel_key']) add_bfd(ip) - + ovs_ofctl("add-flow %s table=0,priority=1000,in_port=%s," "actions=resubmit(,1)" % (self.short_name, port_no)) @@ -256,7 +273,7 @@ class Logical_Switch(object): def update_remote_macs(self): remote_macs = {} unknown_dsts = set() - tunnels = set() + tunnels = {} parse_ucast = True mac_list = vtep_ctl("list-remote-macs %s" % self.name).splitlines() @@ -264,32 +281,31 @@ class Logical_Switch(object): if (line.find("mcast-mac-remote") != -1): parse_ucast = False continue - - entry = re.split(r' (.*) -> (.*)', line) - if len(entry) != 4: + entry = re.split(r' (.*) -> (.*)/(.*) \[(.*)\]', line) + if len(entry) != 6: continue if parse_ucast: - remote_macs[entry[1]] = entry[2] + remote_macs[entry[1]] = self.tunnel_dict(entry) else: if entry[1] != "unknown-dst": continue - unknown_dsts.add(entry[2]) + unknown_dsts.add(entry[3]) - tunnels.add(entry[2]) + tunnels[entry[3]]= self.tunnel_dict(entry) old_tunnels = set(self.tunnels.keys()) + tunnels_keys = set(tunnels.keys()) + for tunnel in tunnels_keys.difference(old_tunnels): + self.add_tunnel(tunnels[tunnel]) - for tunnel in tunnels.difference(old_tunnels): - self.add_tunnel(tunnel) - - for tunnel in old_tunnels.difference(tunnels): + for tunnel in old_tunnels.difference(tunnels_keys): self.del_tunnel(tunnel) for mac in six.iterkeys(remote_macs): if (self.remote_macs.get(mac) != remote_macs[mac]): - self.add_remote_mac(mac, remote_macs[mac]) + self.add_remote_mac(mac, remote_macs[mac]['dest_ip']) for mac in six.iterkeys(self.remote_macs): if mac not in remote_macs: diff --git a/vtep/vtep-ctl.c b/vtep/vtep-ctl.c index 5c18971..e09425c 100644 --- a/vtep/vtep-ctl.c +++ b/vtep/vtep-ctl.c @@ -345,18 +345,18 @@ Logical Router commands:\n\ lr-exists LR exit 2 if LR does not exist\n\ \n\ MAC binding commands:\n\ - add-ucast-local LS MAC [ENCAP] IP add ucast local entry in LS\n\ - del-ucast-local LS MAC del ucast local entry from LS\n\ - add-mcast-local LS MAC [ENCAP] IP add mcast local entry in LS\n\ - del-mcast-local LS MAC [ENCAP] IP del mcast local entry from LS\n\ - clear-local-macs LS clear local mac entries\n\ - list-local-macs LS list local mac entries\n\ - add-ucast-remote LS MAC [ENCAP] IP add ucast remote entry in LS\n\ - del-ucast-remote LS MAC del ucast remote entry from LS\n\ - add-mcast-remote LS MAC [ENCAP] IP add mcast remote entry in LS\n\ - del-mcast-remote LS MAC [ENCAP] IP del mcast remote entry from LS\n\ - clear-remote-macs LS clear remote mac entries\n\ - list-remote-macs LS list remote mac entries\n\ + add-ucast-local LS MAC [ENCAP] IP [KEY] add ucast local entry in LS\n\ + del-ucast-local LS MAC del ucast local entry from LS\n\ + add-mcast-local LS MAC [ENCAP] IP [KEY] add mcast local entry in LS\n\ + del-mcast-local LS MAC [ENCAP] IP del mcast local entry from LS\n\ + clear-local-macs LS clear local mac entries\n\ + list-local-macs LS list local mac entries\n\ + add-ucast-remote LS MAC [ENCAP] IP [KEY] add ucast remote entry in LS\n\ + del-ucast-remote LS MAC del ucast remote entry from LS\n\ + add-mcast-remote LS MAC [ENCAP] IP [KEY] add mcast remote entry in LS\n\ + del-mcast-remote LS MAC [ENCAP] IP del mcast remote entry from LS\n\ + clear-remote-macs LS clear remote mac entries\n\ + list-remote-macs LS list remote mac entries\n\ \n\ %s\ \n\ @@ -451,6 +451,11 @@ struct vtep_ctl_context { * struct vtep_ctl_lrouter. */ }; +static bool is_valid_ip(const char* address) +{ + struct sockaddr_in sa; + return inet_pton(AF_INET, address, &(sa.sin_addr)); +} /* Casts 'base' into 'struct vtep_ctl_context'. */ static struct vtep_ctl_context * vtep_ctl_context_cast(struct ctl_context *base) @@ -887,7 +892,8 @@ pre_get_info(struct ctl_context *ctx) &vteprec_physical_locator_col_dst_ip); ovsdb_idl_add_column(ctx->idl, &vteprec_physical_locator_col_encapsulation_type); - + ovsdb_idl_add_column(ctx->idl, + &vteprec_physical_locator_col_tunnel_key); ovsdb_idl_add_column(ctx->idl, &vteprec_tunnel_col_local); ovsdb_idl_add_column(ctx->idl, &vteprec_tunnel_col_remote); } @@ -1653,27 +1659,43 @@ add_ucast_entry(struct ctl_context *ctx, bool local) { struct vtep_ctl_context *vtepctl_ctx = vtep_ctl_context_cast(ctx); struct vtep_ctl_lswitch *ls; - const char *mac; - const char *encap; - const char *dst_ip; + const char *mac = 0; + const char *encap = 0; + const char *dst_ip = 0; + const char *tunnel_key = 0; struct vteprec_physical_locator *ploc_cfg; vtep_ctl_context_populate_cache(ctx); ls = find_lswitch(vtepctl_ctx, ctx->argv[1], true); mac = ctx->argv[2]; - - if (ctx->argc == 4) { - encap = "vxlan_over_ipv4"; - dst_ip = ctx->argv[3]; - } else { - encap = ctx->argv[3]; - dst_ip = ctx->argv[4]; + switch (ctx->argc) + { + case 6: + tunnel_key = ctx->argv[5]; + case 5: + if (is_valid_ip(ctx->argv[4])){ + dst_ip = ctx->argv[4]; + encap = ctx->argv[3]; + break; + } + tunnel_key = ctx->argv[4]; + case 4: + dst_ip = ctx->argv[3]; + encap = "vxlan_over_ipv4"; + break; + default: + break; } ploc_cfg = find_ploc(vtepctl_ctx, encap, dst_ip); if (!ploc_cfg) { ploc_cfg = vteprec_physical_locator_insert(ctx->txn); + if (tunnel_key) { + int64_t segement_value = 0; + sscanf(tunnel_key,"%ld",&segement_value); + vteprec_physical_locator_set_tunnel_key(ploc_cfg,&segement_value,1); + } vteprec_physical_locator_set_dst_ip(ploc_cfg, dst_ip); vteprec_physical_locator_set_encapsulation_type(ploc_cfg, encap); @@ -1790,7 +1812,7 @@ commit_mcast_entries(struct vtep_ctl_mcast_mac *mcast_mac) static void add_mcast_entry(struct ctl_context *ctx, struct vtep_ctl_lswitch *ls, const char *mac, - const char *encap, const char *dst_ip, bool local) + const char *encap, const char *dst_ip, const char* tunnel_key,bool local) { struct vtep_ctl_context *vtepctl_ctx = vtep_ctl_context_cast(ctx); struct shash *mcast_shash; @@ -1839,6 +1861,11 @@ add_mcast_entry(struct ctl_context *ctx, ploc_cfg = find_ploc(vtepctl_ctx, encap, dst_ip); if (!ploc_cfg) { ploc_cfg = vteprec_physical_locator_insert(ctx->txn); + if (tunnel_key) { + int64_t tunnel_id = 0; + sscanf(tunnel_key,"%ld",&tunnel_id); + vteprec_physical_locator_set_tunnel_key(ploc_cfg,&tunnel_id,1); + } vteprec_physical_locator_set_dst_ip(ploc_cfg, dst_ip); vteprec_physical_locator_set_encapsulation_type(ploc_cfg, encap); @@ -1908,25 +1935,35 @@ add_del_mcast_entry(struct ctl_context *ctx, bool add, bool local) { struct vtep_ctl_context *vtepctl_ctx = vtep_ctl_context_cast(ctx); struct vtep_ctl_lswitch *ls; - const char *mac; - const char *encap; - const char *dst_ip; - + const char *mac = 0; + const char *encap = 0; + const char *dst_ip = 0; + const char *tunnel_key = 0; vtep_ctl_context_populate_cache(ctx); ls = find_lswitch(vtepctl_ctx, ctx->argv[1], true); mac = ctx->argv[2]; - if (ctx->argc == 4) { - encap = "vxlan_over_ipv4"; - dst_ip = ctx->argv[3]; - } else { - encap = ctx->argv[3]; - dst_ip = ctx->argv[4]; + switch (ctx->argc) + { + case 6: + tunnel_key = ctx->argv[5]; + case 5: + if (is_valid_ip(ctx->argv[4])){ + dst_ip = ctx->argv[4]; + encap = ctx->argv[3]; + break; + } + tunnel_key = ctx->argv[4]; + case 4: + dst_ip = ctx->argv[3]; + encap = "vxlan_over_ipv4"; + break; + default: + break; } - if (add) { - add_mcast_entry(ctx, ls, mac, encap, dst_ip, local); + add_mcast_entry(ctx, ls, mac, encap, dst_ip, tunnel_key, local); } else { del_mcast_entry(ctx, ls, mac, encap, dst_ip, local); } @@ -2017,7 +2054,7 @@ list_macs(struct ctl_context *ctx, bool local) struct svec ucast_macs; struct shash *mcast_shash; struct svec mcast_macs; - + char tunnel_key[6]; vtep_ctl_context_populate_cache(ctx); ls = find_lswitch(vtepctl_ctx, ctx->argv[1], true); @@ -2032,9 +2069,13 @@ list_macs(struct ctl_context *ctx, bool local) char *entry; ploc_cfg = local ? ucast_local->locator : ucast_remote->locator; - - entry = xasprintf(" %s -> %s/%s", node->name, - ploc_cfg->encapsulation_type, ploc_cfg->dst_ip); + tunnel_key[0] = 0; + if (ploc_cfg->tunnel_key) + snprintf(&tunnel_key[0],5,"%d",(uint32_t)*ploc_cfg->tunnel_key); + entry = xasprintf(" %s -> %s/%s [%s]", node->name, + ploc_cfg->encapsulation_type, + ploc_cfg->dst_ip, + tunnel_key ); svec_add_nocopy(&ucast_macs, entry); } ds_put_format(&ctx->output, "ucast-mac-%s\n", local ? "local" : "remote"); @@ -2047,11 +2088,14 @@ list_macs(struct ctl_context *ctx, bool local) struct vtep_ctl_mcast_mac *mcast_mac = node->data; struct vtep_ctl_ploc *ploc; char *entry; - LIST_FOR_EACH (ploc, locators_node, &mcast_mac->locators) { - entry = xasprintf(" %s -> %s/%s", node->name, + tunnel_key[0] = 0; + if (ploc->ploc_cfg->tunnel_key) + snprintf(tunnel_key,5,"%d",(uint32_t)*ploc->ploc_cfg->tunnel_key); + entry = xasprintf(" %s -> %s/%s [%s]", node->name, ploc->ploc_cfg->encapsulation_type, - ploc->ploc_cfg->dst_ip); + ploc->ploc_cfg->dst_ip, + tunnel_key); svec_add_nocopy(&mcast_macs, entry); } } @@ -2508,11 +2552,11 @@ static const struct ctl_command_syntax vtep_commands[] = { {"lr-exists", 1, 1, NULL, pre_get_info, cmd_lr_exists, NULL, "", RO}, /* MAC binding commands. */ - {"add-ucast-local", 3, 4, NULL, pre_get_info, cmd_add_ucast_local, NULL, + {"add-ucast-local", 3, 5, NULL, pre_get_info, cmd_add_ucast_local, NULL, "", RW}, {"del-ucast-local", 2, 2, NULL, pre_get_info, cmd_del_ucast_local, NULL, "", RW}, - {"add-mcast-local", 3, 4, NULL, pre_get_info, cmd_add_mcast_local, NULL, + {"add-mcast-local", 3, 5, NULL, pre_get_info, cmd_add_mcast_local, NULL, "", RW}, {"del-mcast-local", 3, 4, NULL, pre_get_info, cmd_del_mcast_local, NULL, "", RW}, @@ -2520,11 +2564,11 @@ static const struct ctl_command_syntax vtep_commands[] = { "", RO}, {"list-local-macs", 1, 1, NULL, pre_get_info, cmd_list_local_macs, NULL, "", RO}, - {"add-ucast-remote", 3, 4, NULL, pre_get_info, cmd_add_ucast_remote, NULL, + {"add-ucast-remote", 3, 5, NULL, pre_get_info, cmd_add_ucast_remote, NULL, "", RW}, {"del-ucast-remote", 2, 2, NULL, pre_get_info, cmd_del_ucast_remote, NULL, "", RW}, - {"add-mcast-remote", 3, 4, NULL, pre_get_info, cmd_add_mcast_remote, NULL, + {"add-mcast-remote", 3, 5, NULL, pre_get_info, cmd_add_mcast_remote, NULL, "", RW}, {"del-mcast-remote", 3, 4, NULL, pre_get_info, cmd_del_mcast_remote, NULL, "", RW}, diff --git a/vtep/vtep.xml b/vtep/vtep.xml index 62075ca..cbef24b 100644 --- a/vtep/vtep.xml +++ b/vtep/vtep.xml @@ -1173,7 +1173,15 @@ 16,777,215.

- + +

+ For vxlan_over_ipv4 encapsulation to support vni mapping, the vni tage of the mapped + VXLAN tunnel. +

+

+ Futer implementation will support other then VXLAN tunnels. +

+