[nox-dev] Python API buffer_id None problems
Hi developers. It seems that there is an inconsistency in python API (destiny branch) for using buffer_id. Namely, "send_openflow" documentation states that buffer_id -1 should be used to indicate no buffer but in the fact it tests for None. But apart from that, if you supply None to this function the call will fail with the following error: (openflow typemap) py argument to Buffer must be of type str, instead received as far as I can tell, the problem occurs inside the call self.ctxt.send_openflow_packet_acts(dp_id, packet, oactions, inport) in the send_openflow_packet() function. Any idea what might be the problem? I can debug it even more if you tell me where to find the implementation of context. Kind regards Peter Peresini ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev
Re: [nox-dev] Python API buffer_id None problems
Can you please show us the code you are using to call send_openflow()? -- Murphy On Jan 17, 2012, at 1:40 AM, Peter Peresini wrote: > Hi developers. > It seems that there is an inconsistency in python API (destiny branch) for > using buffer_id. Namely, "send_openflow" documentation states that buffer_id > -1 should be used to indicate no buffer but in the fact it tests for None. > But apart from that, if you supply None to this function the call will fail > with the following error: > > (openflow typemap) py argument to Buffer must be of type str, instead > received > > > as far as I can tell, the problem occurs inside the call >self.ctxt.send_openflow_packet_acts(dp_id, packet, oactions, > inport) > in the send_openflow_packet() function. > > Any idea what might be the problem? I can debug it even more if you tell me > where to find the implementation of context. > > Kind regards > Peter Peresini > > ___ > nox-dev mailing list > nox-dev@noxrepo.org > http://noxrepo.org/mailman/listinfo/nox-dev ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev
Re: [nox-dev] Python API buffer_id None problems
You're right about the documentation and the implementation being mismatched. The implementation is correct, the documentation is outdated. The error you see when you pass None as the buffer ID is almost certainly in your code and not in NOX. The error message is not that clear, but it's telling you that the "packet" argument must be a str, and you are passing an ethernet object from the packet library. You need to either convert this to a string (packet.tostring()), or try to use the original buffer (packet.arr or packet.arr.tostring(); I can't remember). Hope that helps. -- Murphy On Jan 17, 2012, at 5:31 AM, Peter Peresini wrote: > I can reproduce it with following simple command, packet is the packet > received in packet_in_callback, actions is a combination of setting ToS and > forwarding to a single port. > > self.send_openflow(datapath_id, None, packet, actions, inport=inport) > > Kind regards > Peter > > > On Tue, Jan 17, 2012 at 11:42 AM, Murphy McCauley wrote: > Can you please show us the code you are using to call send_openflow()? > > -- Murphy > > On Jan 17, 2012, at 1:40 AM, Peter Peresini wrote: > >> Hi developers. >> It seems that there is an inconsistency in python API (destiny branch) for >> using buffer_id. Namely, "send_openflow" documentation states that buffer_id >> -1 should be used to indicate no buffer but in the fact it tests for None. >> But apart from that, if you supply None to this function the call will fail >> with the following error: >> >> (openflow typemap) py argument to Buffer must be of type str, instead >> received >> >> >> as far as I can tell, the problem occurs inside the call >>self.ctxt.send_openflow_packet_acts(dp_id, packet, oactions, >> inport) >> in the send_openflow_packet() function. >> >> Any idea what might be the problem? I can debug it even more if you tell me >> where to find the implementation of context. >> >> Kind regards >> Peter Peresini >> >> ___ >> nox-dev mailing list >> nox-dev@noxrepo.org >> http://noxrepo.org/mailman/listinfo/nox-dev > > ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev
Re: [nox-dev] Python API buffer_id None problems
Hi Murphy, thanks a lot, packet.arr helped. But the documentation could be improved and at least hint that "packet" argument is actually packet.arr Best wishes Peter On Tue, Jan 17, 2012 at 3:30 PM, Murphy McCauley wrote: > You're right about the documentation and the implementation being > mismatched. The implementation is correct, the documentation is outdated. > > The error you see when you pass None as the buffer ID is almost certainly > in your code and not in NOX. The error message is not that clear, but it's > telling you that the "packet" argument must be a str, and you are passing > an ethernet object from the packet library. You need to either convert > this to a string (packet.tostring()), or try to use the original buffer > (packet.arr or packet.arr.tostring(); I can't remember). > > Hope that helps. > > -- Murphy > > On Jan 17, 2012, at 5:31 AM, Peter Peresini wrote: > > I can reproduce it with following simple command, packet is the packet > received in packet_in_callback, actions is a combination of setting ToS and > forwarding to a single port. > > self.send_openflow(datapath_id, None, packet, actions, inport=inport) > > Kind regards > Peter > > > On Tue, Jan 17, 2012 at 11:42 AM, Murphy McCauley wrote: > >> Can you please show us the code you are using to call send_openflow()? >> >> -- Murphy >> >> On Jan 17, 2012, at 1:40 AM, Peter Peresini wrote: >> >> Hi developers. >> It seems that there is an inconsistency in python API (destiny branch) >> for using buffer_id. Namely, "send_openflow" documentation states that >> buffer_id -1 should be used to indicate no buffer but in the fact it tests >> for None. >> But apart from that, if you supply None to this function the call will >> fail with the following error: >> >> (openflow typemap) py argument to Buffer must be of type str, instead >> received >> >> >> as far as I can tell, the problem occurs inside the call >>self.ctxt.send_openflow_packet_acts(dp_id, packet, oactions, >> inport) >> in the send_openflow_packet() function. >> >> Any idea what might be the problem? I can debug it even more if you tell >> me where to find the implementation of context. >> >> Kind regards >> Peter Peresini >> >> ___ >> nox-dev mailing list >> nox-dev@noxrepo.org >> http://noxrepo.org/mailman/listinfo/nox-dev >> >> >> > > ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev