Re: [pox-dev] How to get switch name set in Mininet in POX

2013-10-29 Thread Sulabh Bista
Thanks Murphy. That helped.

I noticed (with the dpctl show command in Mininet CLI) that two switches s1
and r1 have the same DPID. Should DPID be unique or is this behaviour ok?

I checked the source where dpid is being generated automatically and it
shows that the dpid is derived from the number in the switch's name. So, s1
and r1 has the same dpid '0001'.


On Tue, Oct 29, 2013 at 8:14 PM, Murphy McCauley
murphy.mccau...@gmail.comwrote:

 I don't think that switch name is communicated in a particularly direct
 way over OpenFlow.   That is, I don't think it's set as one of the fields
 in the switch stats or anything.  However, you can take advantage of the
 fact that this name is used as the name of the internal port on the
 switch, since port names are communicated from switch to controller.  Each
 OpenFlow Connection object attempts to keep track of the ports, so you just
 need to check the name of the internal port.  Try print
 event.connection.ports[of.OFPP_LOCAL].name in your packet handler.

 There may be configurations where this doesn't work, but one doesn't
 immediately come to mind (at least for OVS).

 For what it's worth, it's usually better to track switches by their DPID
 rather than a name.

 -- Murphy

 On Oct 29, 2013, at 4:55 PM, Sulabh Bista sul...@gmail.com wrote:

  Hello:
 
  I wanted to know if we can fetch the name assigned to an OVSwitch in
 Mininet in POX. I am listening to PacketIn event and found noting relating
 to the switch name in the 'event' object.
 
  I am new to all of this. Sorry if my question sounds too dumb.
 
  Regards,
  Sulabh Bista




Re: [pox-dev] How to get switch name set in Mininet in POX

2013-10-29 Thread Murphy McCauley
On Oct 29, 2013, at 5:23 PM, Sulabh Bista sul...@gmail.com wrote:

 Thanks Murphy. That helped.
 
 I noticed (with the dpctl show command in Mininet CLI) that two switches s1 
 and r1 have the same DPID. Should DPID be unique or is this behaviour ok?

Nope, not okay.  They're supposed to be unique and it says so in the spec.

 I checked the source where dpid is being generated automatically and it shows 
 that the dpid is derived from the number in the switch's name. So, s1 and r1 
 has the same dpid '0001'.

Yeah.  It's convenient to have them match up when it works out nicely (e.g., 
when all your switches are named s*).  When it doesn't work out nicely, it's 
just wrong.  You should override the default DPID selection.  (And Mininet 
should really refuse to do this in the first place!)

-- Murphy

 On Tue, Oct 29, 2013 at 8:14 PM, Murphy McCauley murphy.mccau...@gmail.com 
 wrote:
 I don't think that switch name is communicated in a particularly direct way 
 over OpenFlow.   That is, I don't think it's set as one of the fields in the 
 switch stats or anything.  However, you can take advantage of the fact that 
 this name is used as the name of the internal port on the switch, since 
 port names are communicated from switch to controller.  Each OpenFlow 
 Connection object attempts to keep track of the ports, so you just need to 
 check the name of the internal port.  Try print 
 event.connection.ports[of.OFPP_LOCAL].name in your packet handler.
 
 There may be configurations where this doesn't work, but one doesn't 
 immediately come to mind (at least for OVS).
 
 For what it's worth, it's usually better to track switches by their DPID 
 rather than a name.
 
 -- Murphy
 
 On Oct 29, 2013, at 4:55 PM, Sulabh Bista sul...@gmail.com wrote:
 
  Hello:
 
  I wanted to know if we can fetch the name assigned to an OVSwitch in 
  Mininet in POX. I am listening to PacketIn event and found noting relating 
  to the switch name in the 'event' object.
 
  I am new to all of this. Sorry if my question sounds too dumb.
 
  Regards,
  Sulabh Bista
 
 



Re: [pox-dev] How to get switch name set in Mininet in POX

2013-10-29 Thread Sulabh Bista
Thanks for the clarification.


On Tue, Oct 29, 2013 at 8:31 PM, Murphy McCauley
murphy.mccau...@gmail.comwrote:

 On Oct 29, 2013, at 5:23 PM, Sulabh Bista sul...@gmail.com wrote:

 Thanks Murphy. That helped.

 I noticed (with the dpctl show command in Mininet CLI) that two switches
 s1 and r1 have the same DPID. Should DPID be unique or is this behaviour ok?


 Nope, not okay.  They're supposed to be unique and it says so in the spec.

 I checked the source where dpid is being generated automatically and it
 shows that the dpid is derived from the number in the switch's name. So, s1
 and r1 has the same dpid '0001'.


 Yeah.  It's convenient to have them match up when it works out nicely
 (e.g., when all your switches are named s*).  When it doesn't work out
 nicely, it's just wrong.  You should override the default DPID selection.
  (And Mininet should really refuse to do this in the first place!)

 -- Murphy

 On Tue, Oct 29, 2013 at 8:14 PM, Murphy McCauley 
 murphy.mccau...@gmail.com wrote:

 I don't think that switch name is communicated in a particularly direct
 way over OpenFlow.   That is, I don't think it's set as one of the fields
 in the switch stats or anything.  However, you can take advantage of the
 fact that this name is used as the name of the internal port on the
 switch, since port names are communicated from switch to controller.  Each
 OpenFlow Connection object attempts to keep track of the ports, so you just
 need to check the name of the internal port.  Try print
 event.connection.ports[of.OFPP_LOCAL].name in your packet handler.

 There may be configurations where this doesn't work, but one doesn't
 immediately come to mind (at least for OVS).

 For what it's worth, it's usually better to track switches by their DPID
 rather than a name.

 -- Murphy

 On Oct 29, 2013, at 4:55 PM, Sulabh Bista sul...@gmail.com wrote:

  Hello:
 
  I wanted to know if we can fetch the name assigned to an OVSwitch in
 Mininet in POX. I am listening to PacketIn event and found noting relating
 to the switch name in the 'event' object.
 
  I am new to all of this. Sorry if my question sounds too dumb.
 
  Regards,
  Sulabh Bista