[ovs-dev] [PATCH v2 2/2] ofproto-dpif: Make "fdb/show" report OpenFlow port numbers.

Ben Pfaff blp at nicira.com
Wed Jun 12 18:38:31 UTC 2013


Users are more likely to be able to reasonably interpret OpenFlow port
numbers than datapath port numbers.

This issue has existed since at least 2011 but only recently has it been
possible for OpenFlow and datapath port numbers to differ (except for the
"local" port).

Reported-by: Christopher Paggen <cpaggen at cisco.com>
Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 AUTHORS                |    1 +
 ofproto/ofproto-dpif.c |    9 ++++++---
 tests/ofproto-dpif.at  |   11 ++++-------
 3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 91d4dfd..5db58cd 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -123,6 +123,7 @@ Brent Salisbury         brent.salisbury at gmail.com
 Bryan Fulton            bryan at nicira.com
 Bryan Osoro             bosoro at nicira.com
 Cedric Hobbs            cedric at nicira.com
+Christopher Paggen      cpaggen at cisco.com
 Dave Walker             DaveWalker at ubuntu.com
 David Palma             palma at onesource.pt
 Derek Cormier           derek.cormier at lab.ntt.co.jp
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index 3bc8dd7..843d953 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -5623,9 +5623,12 @@ ofproto_unixctl_fdb_show(struct unixctl_conn *conn, int argc OVS_UNUSED,
     ds_put_cstr(&ds, " port  VLAN  MAC                Age\n");
     LIST_FOR_EACH (e, lru_node, &ofproto->ml->lrus) {
         struct ofbundle *bundle = e->port.p;
-        ds_put_format(&ds, "%5d  %4d  "ETH_ADDR_FMT"  %3d\n",
-                      ofbundle_get_a_port(bundle)->odp_port,
-                      e->vlan, ETH_ADDR_ARGS(e->mac),
+        char name[OFP_MAX_PORT_NAME_LEN];
+
+        ofputil_port_to_string(ofbundle_get_a_port(bundle)->up.ofp_port,
+                               name, sizeof name);
+        ds_put_format(&ds, "%5s  %4d  "ETH_ADDR_FMT"  %3d\n",
+                      name, e->vlan, ETH_ADDR_ARGS(e->mac),
                       mac_entry_age(ofproto->ml, e));
     }
     unixctl_command_reply(conn, ds_cstr(&ds));
diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at
index e8458d0..3bacaca 100644
--- a/tests/ofproto-dpif.at
+++ b/tests/ofproto-dpif.at
@@ -1368,9 +1368,8 @@ AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [d
 AT_CHECK(
   [ovs-vsctl \
      -- add-br br1 \
-     -- set bridge br1 datapath-type=dummy \
-     -- add-port br1 p4 -- set interface p4 type=dummy \
-     -- add-port br1 p5 -- set interface p5 type=dummy])
+     -- set bridge br1 datapath-type=dummy])
+ADD_OF_PORTS([br1], 4, 5)
 
 # Trace some packet arrivals in br1 to create MAC learning entries there too.
 OFPROTO_TRACE(
@@ -1408,10 +1407,8 @@ AT_CLEANUP
 
 AT_SETUP([ofproto-dpif - MAC table overflow])
 OVS_VSWITCHD_START(
-  [set bridge br0 fail-mode=standalone other-config:mac-table-size=10 -- \
-   add-port br0 p1 -- set Interface p1 type=dummy -- \
-   add-port br0 p2 -- set Interface p2 type=dummy -- \
-   add-port br0 p3 -- set Interface p3 type=dummy])
+  [set bridge br0 fail-mode=standalone other-config:mac-table-size=10])
+ADD_OF_PORTS([br0], 1, 2, 3)
 
 arp='eth_type(0x0806),arp(sip=192.168.0.1,tip=192.168.0.2,op=1,sha=50:54:00:00:00:05,tha=00:00:00:00:00:00)'
 
-- 
1.7.2.5




More information about the dev mailing list