[pox-dev] run a method on exit

Masoud Moshref Javadi moshrefj at usc.edu
Thu Sep 6 19:23:58 PDT 2012


This is my code:
ThreadRule is a thread that creates opens a socket. and checks the flag 
if the flag is false it will stop

The GoingUpEvent works but the GoingDownEvent does not. So is it even 
the right way to do cleanup for a pox controller?

class my_l2_learning (EventMixin):
   def __init__ (self, port):
     self.listenTo(core.openflow)

     self.t = ThreadRule(port)
     self.t.start()
     #core.addListener(pox.core.GoingUpEvent, self._handle_GoingUpEvent)
      core.addListener(pox.core.GoingDownEvent, self._handle_GoingDownEvent)

   def _handle_GoingDownEvent (self, event):
         self.t.flag=False
         print('go down')
  def _handle_GoingUpEvent (self, event):
         print ("go up")



On 9/6/2012 3:04 PM, Murphy McCauley wrote:
>
> Can you post the code that you tried?
>
> -- Murphy
>
> On Sep 6, 2012 2:29 PM, "Masoud Moshref Javadi" <moshrefj at usc.edu 
> <mailto:moshrefj at usc.edu>> wrote:
>
>     I want to run a method when the controller goes down to close a
>     socket.
>     I tried to register for pox.core.GoingDownEvent but it does not
>     work. Is there any special way to be informed on the exit of pox?
>
>     -- 
>     Masoud Moshref Javadi
>     Computer Engineering PhD Student
>     Ming Hsieh Department of Electrical Engineering
>     University of Southern California
>

-- 
Masoud Moshref Javadi
Computer Engineering PhD Student
Ming Hsieh Department of Electrical Engineering
University of Southern California

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.noxrepo.org/pipermail/pox-dev-noxrepo.org/attachments/20120906/2f64efe1/attachment-0002.htm>


More information about the pox-dev mailing list