<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Jul 16, 2013, at 8:40 AM, adria sole wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">I had looked at nicira.py and I hadn't understood very well the code...:<div style=""><br></div><div style="">I suppose I have to add my own function in nicira.py like:</div><div style=""><br></div><div style=""> class nx_adria (of.ofp_action_vendor_base):</div>
<div style=""> with my own self.stringADRIA</div><div style=""><br></div><div style="">I don't know how to create this message in nicira.py, where are called _pack_body, _unpack_body,</div></div></blockquote><div><br></div>I wasn't suggesting that, actually. The OpenFlow protocol has a mechanism for adding "vendor messages", and POX has some support for working with them. nicira.py is an example of doing this -- it adds the ones associated with Open vSwitch. You can write all the extension code in your own Python module, without hacking up POX itself -- there's actually nothing "special" about nicira.py.</div><div><br></div><div><blockquote type="cite"><div dir="ltr"><div style="">is there anywhere for seeing a simple example with only one attribute: self.string (like a message sending a string with hello world).</div></div></blockquote><div><br></div><div>Not presently. Vendor extensions are the "right" way to do this because they are compliant with the OpenFlow standard and because adding them doesn't require hacking up POX. But it's possible you'd be better off sticking to just adding nonstandard messages for the time being since it looked like your previous attempt almost worked if you'd just renumber of your messages.</div><div><br></div><div>I expect the harder part of all of this will be implementing the switch side of it anyway...</div><div><br></div><div>-- Murphy</div><br><blockquote type="cite"><div dir="ltr"><div style=""><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2013/7/16 adria sole <span dir="ltr"><<a href="mailto:adriasole@gmail.com" target="_blank">adriasole@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">I simply want to create a message that passes a string to the switch, and then I will have to configure openwrt switch for getting this string. </p>
<div class="gmail_quote">El 16/07/2013 00:13, "Murphy McCauley" <<a href="mailto:murphy.mccauley@gmail.com" target="_blank">murphy.mccauley@gmail.com</a>> escribió:<div><div class="h5"><br type="attribution">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">I don't entirely understand what you're doing, but if it can be done with a regular (though nonstandard) message, I'd be surprised if it couldn't be done with a vendor message.<div>
<br></div><div>-- Murphy<br><div><br><div><div><div><div>On Jul 15, 2013, at 3:08 PM, adria sole wrote:</div><br><blockquote type="cite"><p dir="ltr">I want to add a global counter which will be the sum of specific flows. I want to create a new message when a new switch is connected to notify other switches that a new global counter has to be created (and pass the dpid for identifying this new global counter). I will look at vendor messages tomorrow, can I create this new message with this extension? </p><p dir="ltr">Thank you very much! </p>
<div class="gmail_quote">El 16/07/2013 00:00, "Murphy McCauley" <<a href="mailto:murphy.mccauley@gmail.com" target="_blank">murphy.mccauley@gmail.com</a>> escribió:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The code expects the message type identifiers to be contiguous. In your case, it looks like you're creating 23 and 24 but there's no 22. Renumbering your messages to be 22 and 23 may fix the problem.<br>
<br>
However, you should think about whether you have a good reason for creating new non-standard message types. OpenFlow has an extension mechanism in the form of vendor messages, and POX has some support for integrating vendor messages without hacking up libopenflow itself (this is used for implementing the Nicira/OVS extensions in nicira.py).<br>
<br>
-- Murphy<br>
<br>
On Jul 15, 2013, at 8:42 AM, adria sole wrote:<br>
<br>
> I try to add a message similar to barrier request/reply, but when I add my code I get this error:<br>
><br>
> I can't find where is the error, I think it is because of number 23 and 24 I have put to my adria messages...<br>
><br>
> Ty in advance!<br>
><br>
> POX 0.1.0 (betta) / Copyright 2011-2013 James McCauley, et al.<br>
> Traceback (most recent call last):<br>
> File "./pox.py", line 44, in <module><br>
> from pox.boot import boot<br>
> File "/home/adria/Descargas/pox/pox/boot.py", line 57, in <module><br>
> import pox.openflow.of_01<br>
> File "/home/adria/Descargas/pox/pox/openflow/of_01.py", line 43, in <module><br>
> unpackers = make_type_to_unpacker_table()<br>
> File "/home/adria/Descargas/pox/pox/openflow/util.py", line 31, in make_type_to_unpacker_table<br>
> r = [of._message_type_to_class[i].unpack_new for i in range(0, top)]<br>
> KeyError: 22<br>
><br>
> In libopenflow_01 I have added:<br>
> @openflow_s_message("OFPT_ADRIA_REPLY", 23,<br>
> reply_to="ofp_adria_request")<br>
> class ofp_adria_reply (ofp_header):<br>
> /*Here same code as Barrier*/<br>
><br>
> @openflow_c_message("OFPT_ADRIA_REQUEST", 24,<br>
> request_for="ofp_adria_reply")<br>
> class ofp_adria_request (ofp_header):<br>
> /*Here same code as Barrier*/<br>
><br>
> In __init__.py I have added:<br>
> class OpenFlowNexus (EventMixin):<br>
> _eventMixin_events = set([<br>
> ...<br>
> AdriaIn,<br>
> ...<br>
> ])<br>
><br>
> class AdriaIn (Event):<br>
> /*Same code as barrier In*/<br>
><br>
> In of_01.py:<br>
> handlerMap = {<br>
> ...<br>
> of.OFTP_ADRIA_REPLY : handle_ADRIA,<br>
> ...<br>
> }<br>
><br>
> def handle_ADRIA (con, msg):<br>
> e = con.ofnexus.raiseEventNoErrors(AdriaIn, con, msg)<br>
> if e is None or e.halt != True:<br>
> con.raiseEventNoErrors(AdriaIn, con, msg)<br>
><br>
> In my_component.py (which I run with pox.py):<br>
> when I want on code inside a def of class LearningSwitch (object)::<br>
> adriamsg = of.ofp_adria_request()<br>
> self.connection.send(adriamsg)<br>
><br>
> In class LearningSwitch (object):<br>
> def _handle_AdriaIn (self, event):<br>
> print "ADRIA: rebut un adria"<br>
<br>
</blockquote></div>
</blockquote></div><br></div></div></div></div></div></blockquote></div></div></div>
</blockquote></div><br></div>
</blockquote></div><br></body></html>