[pox-dev] L2_Learning POX

Murphy McCauley murphy.mccauley at gmail.com
Mon Jun 15 23:59:59 PDT 2015


Usually if you want to do something when switches disconnect, you do it by registering a handler for the ConnectionDown event on pox.core.openflow, as described in the "OpenFlow Events" section of the manual.

You haven't given enough information to know for sure, but if what you want is to do something when POX shuts down (which isn't the same thing as when switches disconnect, but is what happens when you do Ctrl+C), you do this by registering a handler for GoingDownEvent on pox.core.

If you really want to put a print statement before the message you mention, you're looking in the wrong place -- it's not in l2_learning.  As the log message states, this message comes from openflow.of_01.  Which is pox/openflow/of_01.py.  It's a log message in the Connection.disconnect() method.

Also, you might consider using a log message instead of a print statement.  Doing so is incredibly easy in POX, and there are a number of advantages.

-- Murphy

On Jun 15, 2015, at 11:08 PM, Talal Alharbi <tal012 at hotmail.com> wrote:

> Hi All, 
> 
> I need to place a print statement before discounting switches. When you press Ctrl+C and the component stops, there is a message " INFO:openflow.of_01:[00-00-00.......] disconnected. I want to place the print statement before this line. I could not find where that is in the code(l2_learning)
> 
> Cheers,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.noxrepo.org/pipermail/pox-dev-noxrepo.org/attachments/20150615/5bf4d171/attachment.html>


More information about the pox-dev mailing list