This isn't just with the Error_event event -- it just behaves the same as all the other Python events that currently keep the xid information, and also the same as the C++ API which does not byte-swap header fields. I agree it's probably not the most *desirable* behavior, but it is *consistent* (for some values of "consistent" anyway).
So I think the easy thing to do is for you to probably NOT convert to network order in your new pycontext code, and leave it up to "the user" to do it (or not -- since they're opaque, it generally shouldn't matter if they do it or not as long as they're consistent). The user may just be you in this case, in which case do whatever you want. :) It's altogether possible that I actually do conversion on all Python-side xids in my as-yet-uncommitted xid patch, but I don't remember. I don't immediately see a reason why it would be problematic. (Of the code currently in the repo, this is at least the event converters in pyrt.cc, though it may pop up in a few other places too.) -- Murphy On Fri, 2010-12-17 at 17:52 +0900, Derek Cormier wrote: > I may have found a bug with the new Error_event class you added > recently. I notice that when I set the xid of a flow mod, the xid in > an error event is different. Perhaps its not converted back from > network format? I'm not sure where that code is, but it is being > converted to network format on the way out in pycontext.cc. > > -Derek > > On 12/17/2010 04:07 PM, Derek Cormier wrote: > > It works =) > > > > On 12/17/2010 04:03 PM, Murphy McCauley wrote: > > > Ugh, I have actually been sitting on a patch forever that add > > > support for xids all the way through Python; I really should nail > > > it down and commit it. Sorry. > > > > > > > > > Change send_flow_command() in context.i also. > > > > > > > > > -- Murphy > > > > > > On Dec 16, 2010, at 10:52 PM, Derek Cormier wrote: > > > > > > > Hello, > > > > > > > > I'm modifying some Nox code so that core.py's > > > > install_datapath_flow takes another argument- the xid for the > > > > flow mod request. > > > > > > > > def install_datapath_flow(self, dp_id, attrs, idle_timeout, > > > > hard_timeout, > > > > actions, buffer_id=None, > > > > > > > > priority=openflow.OFP_DEFAULT_PRIORITY, > > > > inport=None, packet=None, xid=0): > > > > > > > > I also changed send_flow_command... > > > > > > > > def send_flow_command(self, dp_id, command, attrs, > > > > > > > > priority=openflow.OFP_DEFAULT_PRIORITY, > > > > add_args=None, > > > > > > > > hard_timeout=openflow.OFP_FLOW_PERMANENT, xid=0): > > > > > > > > ... and its call > > > > > > > > self.ctxt.send_flow_command(dp_id, command, m, idle_timeout, > > > > hard_timeout, oactions, > > > > buffer_id, priority, xid) > > > > > > > > I also made the argument changes in pycontext.hh and > > > > pycontext.c. > > > > > > > > However, when I run a Nox component that calls that method, I > > > > get the error: > > > > > > > > File "./nox/coreapps/pyrt/pycomponent.py", line 589, in > > > > send_flow_command > > > > def send_flow_command(self, *args): return > > > > _pycomponent.PyContext_send_flow_command(self, *args) > > > > TypeError: PyContext_send_flow_command() takes exactly 9 > > > > arguments (10 given) > > > > > > > > I did recompile the source. pycomponent.py seems to be created > > > > after building, so there is some other step I'm missing. I think > > > > it has to do with swig? > > > > > > > > Thanks for your help, > > > > Derek > > > > > > > > > > > > _______________________________________________ > > > > nox-dev mailing list > > > > [email protected] > > > > http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org > > > > > > > > > > > > _______________________________________________ > > nox-dev mailing list > > [email protected] > > http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org > > _______________________________________________ > nox-dev mailing list > [email protected] > http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org _______________________________________________ nox-dev mailing list [email protected] http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
