I'm a bit surprised that you're getting no result at all as opposed to, say, 
exceptions in the POX log.  Have you tried turning logging to DEBUG level and 
reading through to make sure there are no hints as to what might be going 
wrong?  It's possible that raiseEventNoErrors() is masking the exceptions.  You 
might try at least temporarily replacing such calls with just plain 
raiseEvent().

It looks like you want these events to be raised using the same sources as 
normal OpenFlow events.  Normally, sources need to be aware of the events 
they'll be raising.  In your case, these sources are the Connection (in of_01) 
and OpenFlowNexus (in openflow/__init__) classes.  Have you added your event to 
their set of _eventMixin_events?

On Nov 3, 2014, at 2:15 AM, Adam Pavlidis <adampavli...@gmail.com> wrote:

> Hello,
> 
> i am trying to implement a controller module that handles two types of Events:
> the already existing FlowRemoved and another of my own creation
> "CustomEvent" that i will execute in various circumstances.
> 
> I have read the section on custom events contained in the POX manual
> ( 
> https://openflow.stanford.edu/display/ONL/POX+Wiki#POXWiki-TheEventSystem%3Apox.lib.revent
> )
> and have successfully executed the examples.
> 
> I have looked up a bit how the POX raises events such as PacketIn.
> I added the following lines of code in pox/pox/openflow/__init__.py
> 
> class CustomEvent(Event):
>  """
>  Our own custom event
>  """
>  def __init__(self):
>    Event.__init__(self)
> 
> Then i added a handler for that event in an already existing controller 
> module,
> 
> def _handle_CustomEvent (self, event):
>  log.debug('The Event was raised successfully')
> 
> However when i manually raise the above event,
> (e.g. during the handling of a PacketIn event in
> forwarding.l2_learning) nothing happens.
> I used both the method explained in the manual (creating a subclass of
> EventMixin with _eventMixin_set=([CustomEvent], creating an instance
> of that class and raising the event on that instance), and the
> core.raiselater method.
> 
> Important note: In the same module there is a handler for FlowRemoved
> Events, that is notified without issues, when a flow is removed from the
> switch, so i don't think there is a listener issue.
> 
> In my efforts to find the problem i tried to experiment in
> openflow/of_01.py and specifically in lines 85, 177 where FlowRemoved
> and PacketIn events are raised from the Controller, i tried to force
> raise my own
> event when a PacketIn was supposed to be raised.
> 
> def handle_PACKET_IN (con, msg): #A
>  e = con.ofnexus.raiseEventNoErrors(CustomEvent, con, msg)
>  if e is None or e.halt != True:
>    con.raiseEventNoErrors(CustomEvent, con, msg)
> 
> Nothing happened either (apart from losing connectivity between the hosts).
> 
> I would appreciate any help,
> Adam Pavlidis

Reply via email to