[ovs-dev] From Openflow port number to hardware port number

Bibrak Qamar bibrakc at gmail.com
Wed Aug 24 06:21:41 UTC 2011


/ # ./openvswitch/utilities/ovs-ofctl show br0 --> gives the following
result

 1(p1): addr:00:00:00:00:00:01, config: 0, state:0x1
     current:    1GB-FD COPPER
     advertised: 10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-HD 1GB-FD
     supported:  10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-HD 1GB-FD
 2(p4): addr:00:00:00:00:00:04, config: 0, state:0x1
     current:    1GB-FD COPPER
     advertised: 10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-HD 1GB-FD
     supported:  10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-HD 1GB-FD
 3(p2): addr:00:00:00:00:00:02, config: 0, state:0x1
     current:    1GB-FD COPPER
     advertised: 10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-HD 1GB-FD
     supported:  10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-HD 1GB-FD
 4(p5): addr:00:00:00:00:00:05, config: 0, state:0x1
     current:    1GB-FD COPPER
     advertised: 10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-HD 1GB-FD
     supported:  10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-HD 1GB-FD
 5(p3): addr:00:00:00:00:00:03, config: 0, state:0x1
     current:    1GB-FD COPPER
     advertised: 10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-HD 1GB-FD
     supported:  10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-HD 1GB-FD
 6(p0): addr:00:00:00:00:00:00, config: 0, state:0x1
     current:    1GB-FD COPPER
     advertised: 10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-HD 1GB-FD
     supported:  10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-HD 1GB-FD
 LOCAL(br0): addr:00:00:02:00:00:00, config: 0x1, state:0x1
     current:    1GB-FD COPPER
     advertised: 10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-HD 1GB-FD
     supported:  10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-HD 1GB-FD

OFPT_GET_CONFIG_REPLY (xid=0x3): frags=normal miss_send_len=0
---------------------

Here p0,p1,p2 .. ..  represent physical port numbers. OVS uses its own
numbering which is in an incremental way starting from 1 to the number of
ports activated.

Here, OVS port number 1 points to physical port number 1, OVS port number 2
points to physical port number 4.
So I would like to know whether there is any simple way to convert the ovs
port number to the physical number.
Some thing like:
int phyPort = getPhyPortNum(IN OVSportNum);



MORE INFO:

Following chunk of code in function --> static void
ofp_print_switch_features(struct ds *string,const struct ofp_switch_features
*osf), in ofp-print.c prints the ports numbers.

port_list = xmemdup(osf->ports, len - sizeof *osf);
    qsort(port_list, n_ports, sizeof *port_list, compare_ports);
    for (i = 0; i < n_ports; i++) {
        *ofp_print_phy_port*(string, &port_list[i]);
    }

And in ofp_print_phy_port(struct ds *string, const struct ofp_phy_port
*port) --> char name store the physical port number.




Bibrak


On Wed, Aug 24, 2011 at 10:14 AM, Ben Pfaff <blp at nicira.com> wrote:

> On Wed, Aug 24, 2011 at 10:10:01AM +0500, Bibrak Qamar wrote:
> > ovs-ofctl show br0 --- > Shows list of ports with their OVS port number
> and
> > Hardware port number. Is there any simple way (may be a function) to
> convert
> > ovs port number to its corresponding hardware port number and vise versa
> .
>
> Can you point out what part of the "ovs-ofctl show" output you regard as
> the hardware port number?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20110824/0863d6ab/attachment-0003.html>


More information about the dev mailing list