There are two aspects to intelligently handling vendor messages.

The first is to hook the vendor message unpacking process in libopenflow so 
that it can unpack your vendor message into a custom class.

The second is hooking how core.openflow handles vendor messages.  Usually this 
will mean raising a custom event type in response.

Presently, how you do either of the above is not particularly beautiful.  
There's an example in openflow.nicira.  _init_unpacker() does the former, 
_init_handler() does the latter (actually, it raises an existing event -- to 
raise a new event, you'd have to define the Event subclass and then add it to 
core.openflow and Connection's _eventMixin_events).

You could actually skip the event generation (and even the custom unpacking if 
you really wanted...) and just hook the handler so that it came to your 
function instead of the original.  This is basically what _init_handler() does.

-- Murphy

On Jul 29, 2013, at 3:35 PM, adria sole wrote:

> Hi all,
> 
> I want to unpack a vendor message but I first have problems for handling the 
> vendor message. 
> 
> In my_component.py I have created an:
> def handle_VENDOR (con, msg):
>     log.info("ADRIA Vendor msg: " + str(msg))
> 
> But instead of printing the information from my_component.py it is printed by 
> of_01.py in:
> def handle_VENDOR (con, msg):
>   log.info("Vendor msg: " + str(msg))
> 
> How can I handle a vendor message? The code of my_component.py is very 
> similiar to l2_learning.py.
> 
> Thank you in advance!
> 
> Adrià Solé

Reply via email to