[ovs-dev] [PATCH] FAQ: Add FAQ entry for determining OpenFlow port numbers.

Ben Pfaff blp at nicira.com
Wed Jul 11 07:59:24 UTC 2012


On Wed, Jul 11, 2012 at 12:57:20AM -0700, Justin Pettit wrote:
> On Jul 11, 2012, at 12:53 AM, Ben Pfaff wrote:
> 
> > +Q: How can I figure out the port number for a given port?
> 
> "Port number" is such an overloaded term that maybe we should be more
> specific.  What about "OpenFlow port number"?  Also, it may be useful
> that it distinguishes it from the datapath port numbers, too.

Good point.  Here's a version that sprinkles "OpenFlow" around a bit:

--8<--------------------------cut here-------------------------->8--

From: Ben Pfaff <blp at nicira.com>
Date: Wed, 11 Jul 2012 00:58:53 -0700
Subject: [PATCH] FAQ: Add FAQ entry for determining OpenFlow port numbers.

I don't understand why, but I've had this question from multiple people
recently.

Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 FAQ |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/FAQ b/FAQ
index a6dd568..4ad8c43 100644
--- a/FAQ
+++ b/FAQ
@@ -520,6 +520,33 @@ A: The term "normalization" in the log message means that a flow
    TCP source port 1234, write "tcp,tp_src=1234", or to match UDP
    source port 1234, write "udp,tp_src=1234".
 
+Q: How can I figure out the OpenFlow port number for a given port?
+
+A: The OFPT_FEATURES_REQUEST message requests an OpenFlow switch to
+   respond with an OFPT_FEATURES_REPLY that, among other information,
+   includes a mapping between OpenFlow port names and numbers.  From a
+   command prompt, "ovs-ofctl show br0" makes such a request and
+   prints the response for switch br0.
+
+   The Interface table in the Open vSwitch database also maps OpenFlow
+   port names to numbers.  To print the OpenFlow port number
+   associated with interface eth0, run:
+
+       ovs-vsctl get Interface eth0 ofport
+
+   You can print the entire mapping with:
+
+       ovs-vsctl -- --columns=name,ofport list Interface
+
+   but the output mixes together interfaces from all bridges in the
+   database, so it may be confusing if more than one bridge exists.
+
+   In the Open vSwitch database, ofport value -1 means that the
+   interface could not be created due to an error.  (The Open vSwitch
+   log should indicate the reason.)  ofport value [] (the empty set)
+   means that the interface hasn't been created yet.  The latter is
+   normally an intermittent condition (unless ovs-vswitchd is not
+   running).
 
 Contact 
 -------
-- 
1.7.2.5




More information about the dev mailing list