From patchwork Tue Jul 12 06:35:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gurucharan Shetty X-Patchwork-Id: 647503 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 3rpnbz0SBzz9s5w for ; Wed, 13 Jul 2016 02:34:23 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 1DB7510868; Tue, 12 Jul 2016 09:34:21 -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 0816910868 for ; Tue, 12 Jul 2016 09:34:20 -0700 (PDT) Received: from bar6.cudamail.com (localhost [127.0.0.1]) by mx3v3.cudamail.com (Postfix) with ESMTPS id 8C1E01629D6 for ; Tue, 12 Jul 2016 10:34:19 -0600 (MDT) X-ASG-Debug-ID: 1468341258-0b323706fe19fb0001-byXFYA Received: from mx3-pf1.cudamail.com ([192.168.14.2]) by bar6.cudamail.com with ESMTP id pMjnCA3EbHqdyQPK (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 12 Jul 2016 10:34:19 -0600 (MDT) X-Barracuda-Envelope-From: guru.ovn@gmail.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.2 Received: from unknown (HELO mail-pa0-f66.google.com) (209.85.220.66) by mx3-pf1.cudamail.com with ESMTPS (AES128-SHA encrypted); 12 Jul 2016 16:34:18 -0000 Received-SPF: pass (mx3-pf1.cudamail.com: SPF record at _netblocks.google.com designates 209.85.220.66 as permitted sender) X-Barracuda-Apparent-Source-IP: 209.85.220.66 X-Barracuda-RBL-IP: 209.85.220.66 Received: by mail-pa0-f66.google.com with SMTP id q2so1326424pap.0 for ; Tue, 12 Jul 2016 09:34:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=0t4ClTwLr4nysnff7V/Bl19IFeC2kpnBV1DK0CbzDWs=; b=idux/hV7lqXxpsGg02dKj/+6LeGoinjCVXjKS4/Z3I00KQJ/P5De849QUJp9BJXOH9 F9XK2TuIZtL96MANLz+m9Zju89W303piYDvS8Zc4R6mZF7mkQNzFblaYt7RldwxXCKxE MbtZGtoce06V9mK9Zz6dpZEKOP5IgFKoyZyG0lC/2jejqMcM1Y32L+sQXuGBJoYuUEBl FNxhNhAKgo9O6QLlqQgc/QGjPNGDFyepJKZRHSfMG0v8YwdCDCfVpYfvL1lb701wrkGY UYvnlDIHNnvByIcALYHntJ2WQB8yGzOeMUPaK7vwkBeGtxF2B3CmDbM0WvzknG08SVjk zW8A== X-Gm-Message-State: ALyK8tJw85Zu5ycyLgyJNAhVnn2EZ9Uxj704mv8QTdWnoDGD0ziBw7bu7Vc7cZhVk5pQ+A== X-Received: by 10.66.170.44 with SMTP id aj12mr5489386pac.131.1468341257792; Tue, 12 Jul 2016 09:34:17 -0700 (PDT) Received: from ovn1.eng.vmware.com ([208.91.1.34]) by smtp.gmail.com with ESMTPSA id s3sm5728593pfb.87.2016.07.12.09.34.16 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 12 Jul 2016 09:34:16 -0700 (PDT) X-CudaMail-Envelope-Sender: guru.ovn@gmail.com From: Gurucharan Shetty To: dev@openvswitch.org X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-V1-711028733 X-CudaMail-DTE: 071216 X-CudaMail-Originating-IP: 209.85.220.66 Date: Mon, 11 Jul 2016 23:35:26 -0700 X-ASG-Orig-Subj: [##CM-V1-711028733##][PATCH 1/4] system-common-macros: Enhance ADD_VETH to take mac and gateway. Message-Id: <1468305329-28456-1-git-send-email-guru@ovn.org> X-Mailer: git-send-email 1.9.1 X-Barracuda-Connect: UNKNOWN[192.168.14.2] X-Barracuda-Start-Time: 1468341259 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?= X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 Subject: [ovs-dev] [PATCH 1/4] system-common-macros: Enhance ADD_VETH to take mac and gateway. 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: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" It is useful to set the mac address and gateway while using ADD_VETH to connect a namespace to a OVN logical topology. Upcoming commits use this enhancement. Signed-off-by: Gurucharan Shetty Acked-by: Joe Stringer --- tests/system-common-macros.at | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/system-common-macros.at b/tests/system-common-macros.at index 1e3219c..27fceed 100644 --- a/tests/system-common-macros.at +++ b/tests/system-common-macros.at @@ -56,7 +56,7 @@ m4_define([ADD_INT], ] ) -# ADD_VETH([port], [namespace], [ovs-br], [ip_addr]) +# ADD_VETH([port], [namespace], [ovs-br], [ip_addr] [mac_addr [gateway]]) # # Add a pair of veth ports. 'port' will be added to name space 'namespace', # and "ovs-'port'" will be added to ovs bridge 'ovs-br'. @@ -64,6 +64,9 @@ m4_define([ADD_INT], # The 'port' in 'namespace' will be brought up with static IP address # with 'ip_addr' in CIDR notation. # +# Optionally, one can specify the 'mac_addr' for 'port' and the default +# 'gateway'. +# # The existing 'port' or 'ovs-port' will be removed before new ones are added. # m4_define([ADD_VETH], @@ -74,6 +77,12 @@ m4_define([ADD_VETH], AT_CHECK([ovs-vsctl add-port $3 ovs-$1]) NS_CHECK_EXEC([$2], [ip addr add $4 dev $1]) NS_CHECK_EXEC([$2], [ip link set dev $1 up]) + if test -n "$5"; then + NS_CHECK_EXEC([$2], [ip link set dev $1 address $5]) + fi + if test -n "$6"; then + NS_CHECK_EXEC([$2], [ip route add default via $6]) + fi on_exit 'ip link del ovs-$1' ] )