[nox-dev] Pyglue Table_stats patch
Hello, I found an error where pglue was converting the max_entries and active_count fields of the Table_stats struct to python incorrectly. It was using the Py_BuildValue code of 'l', which should convert them into signed long integers (32-bit, I think). For some reason, they were being converted to 64-bit signed, but that's a different issue in itself. I changed the code to 'I' for 32-bit unsigned. Here's a patch to fix this. -- Derek From 5f077992ee10a20f3136178a1f1ee288e468b502 Mon Sep 17 00:00:00 2001 From: Derek Cormier derek.corm...@lab.ntt.co.jp Date: Mon, 28 Feb 2011 14:59:54 +0900 Subject: [PATCH 24/24] Pyglue now converts Flow_table fields correctly. The fields max_entries and active_count were not being converted into unsigned 32-bit ints when converting to Python. --- src/nox/coreapps/pyrt/pyglue.cc |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/nox/coreapps/pyrt/pyglue.cc b/src/nox/coreapps/pyrt/pyglue.cc index 176a9f4..69f0910 100644 --- a/src/nox/coreapps/pyrt/pyglue.cc +++ b/src/nox/coreapps/pyrt/pyglue.cc @@ -365,7 +365,7 @@ to_python(const Table_stats ts) CONVERT_SWITCH_STAT(ts.matched_count,pyo_matched_count) CONVERT_CHECK(pyo_matched_count) -ret = Py_BuildValue((char*){s:l, s:s#, s:l, s:l, s:S, s:S}, +ret = Py_BuildValue((char*){s:l, s:s#, s:I, s:I, s:S, s:S}, table_id, ts.table_id, name, ts.name.c_str(), ts.name.size(), max_entries, ts.max_entries, -- 1.7.0.4 ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
[nox-dev] Flow removed message's match has extra 0-fields
Hello, I think I may have found a bug. First, I add a flow where the dl_type set and everything else is wildcarded. Then I delete it using delete_strict_datapath_flow(). When I receive a flow removed event, I print out the match dictionary and see: {'dl_type': 5, 'nw_dst_n_wild': 0L, 'nw_dst': 0L, 'nw_src_n_wild': 0L, 'nw_proto': 0, 'nw_tos': 0, 'tp_dst': 0, 'tp_src': 0, 'nw_src': 0L} It's adding a few extra fields with values of 0. If I'm not mistaken, it should only have the dl_type field. I verified the flow was added properly to the switch by using openvswitch's flow dump. -Derek ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
[nox-dev] Getting Actions From Events in Python
Hello, I was looking at pyglue.cc and it looks like actions are never included in python events. A comment says to use Flow_stats, but flow stats contains a vector ofp_action_header's. Since actions are variable-length, won't this cut off data when the action is longer than the header? (For example, ofp_action_dl_addr). So, is there any way to get actions in events like flow stats in? If not, how could we go about implementing this? Thanks, Derek ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
Re: [nox-dev] Getting Actions From Events in Python
Ok I'll give it a try and submit a patch when I'm finished. Could you please tell me if the following is the right approach? template PyObject* to_python(const ofp_action_header a) { PyObject* dict = PyDict_New(); if (!dict) { return 0; } uint16_t type = ntohs(a.type); pyglue_setdict_string(dict, type, to_python(type)); pyglue_setdict_string(dict, length, to_python(ntohs(a.len)); /* depending on the action type, cast to the appropriate * action struct to get its fields. */ if (type == OFPAT_OUTPUT) { const ofp_action_output ao = reinterpret_castofp_action_output(a); uint16_t port = ntohs(ao.port); pyglue_setdict_string(dict, port, to_python(port)); /* max_len only has meaning when the destination port is the controller */ if (port == OFPP_CONTROLLER) { pyglue_setdict_string(dict, max_len, to_python(ntohs(ao.max_len))); } } else if (type == OFPAT_STRIP_VLAN) { /* nothing to set, no struct beyond the header */ } else if (type == OFPAT_SET_VLAN_VID) { const ofp_action_vlan_vid av = reinterpret_castofp_action_output(a); Is this the proper use of reinterpret cast? I've never had to use it before... -Derek On 01/28/2011 03:20 PM, James Murphy McCauley wrote: I believe the issue is that with the to_python() for ofp_flow_stats, we have no idea if the actions actually follow the ofp_flow_stats structure since, for example, someone could have just made an ofp_flow_stats struct and tried to pythonize it. I am not sure if this ever actually happens, but whatever. It's not provably a safe thing to do. However, the Flow_stats struct actually explicitly has the actions wrapped up into a vector, so it IS possible to safely pull them out of that. It just hasn't been done. The to_python() for Flow_stats should: Step one, convert the fields from the ofp_flow_stats struct itself into dict, which is done by just calling the to_python() for ofp_flow_stats. Step two, unpack v_actions from the Flow_stats struct into a list of dicts and throw it into dict too. Except instead of step two, we have /* XXX actions */. :) You should be able to just go ahead and implement it there. -- Murphy On Fri, 2011-01-28 at 14:50 +0900, Derek Cormier wrote: Hello, I was looking at pyglue.cc and it looks like actions are never included in python events. A comment says to use Flow_stats, but flow stats contains a vector ofp_action_header's. Since actions are variable-length, won't this cut off data when the action is longer than the header? (For example, ofp_action_dl_addr). So, is there any way to get actions in events like flow stats in? If not, how could we go about implementing this? Thanks, Derek ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
Re: [nox-dev] Getting Actions From Events in Python
Without minding the typos, that is... On 01/28/2011 04:46 PM, Derek Cormier wrote: Ok I'll give it a try and submit a patch when I'm finished. Could you please tell me if the following is the right approach? template PyObject* to_python(const ofp_action_header a) { PyObject* dict = PyDict_New(); if (!dict) { return 0; } uint16_t type = ntohs(a.type); pyglue_setdict_string(dict, type, to_python(type)); pyglue_setdict_string(dict, length, to_python(ntohs(a.len)); /* depending on the action type, cast to the appropriate * action struct to get its fields. */ if (type == OFPAT_OUTPUT) { const ofp_action_output ao = reinterpret_castofp_action_output(a); uint16_t port = ntohs(ao.port); pyglue_setdict_string(dict, port, to_python(port)); /* max_len only has meaning when the destination port is the controller */ if (port == OFPP_CONTROLLER) { pyglue_setdict_string(dict, max_len, to_python(ntohs(ao.max_len))); } } else if (type == OFPAT_STRIP_VLAN) { /* nothing to set, no struct beyond the header */ } else if (type == OFPAT_SET_VLAN_VID) { const ofp_action_vlan_vid av = reinterpret_castofp_action_output(a); Is this the proper use of reinterpret cast? I've never had to use it before... -Derek On 01/28/2011 03:20 PM, James Murphy McCauley wrote: I believe the issue is that with the to_python() for ofp_flow_stats, we have no idea if the actions actually follow the ofp_flow_stats structure since, for example, someone could have just made an ofp_flow_stats struct and tried to pythonize it. I am not sure if this ever actually happens, but whatever. It's not provably a safe thing to do. However, the Flow_stats struct actually explicitly has the actions wrapped up into a vector, so it IS possible to safely pull them out of that. It just hasn't been done. The to_python() for Flow_stats should: Step one, convert the fields from the ofp_flow_stats struct itself into dict, which is done by just calling the to_python() for ofp_flow_stats. Step two, unpack v_actions from the Flow_stats struct into a list of dicts and throw it into dict too. Except instead of step two, we have /* XXX actions */. :) You should be able to just go ahead and implement it there. -- Murphy On Fri, 2011-01-28 at 14:50 +0900, Derek Cormier wrote: Hello, I was looking at pyglue.cc and it looks like actions are never included in python events. A comment says to use Flow_stats, but flow stats contains a vector ofp_action_header's. Since actions are variable-length, won't this cut off data when the action is longer than the header? (For example, ofp_action_dl_addr). So, is there any way to get actions in events like flow stats in? If not, how could we go about implementing this? Thanks, Derek ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
Re: [nox-dev] Contributing to Nox
Thanks! I'm glad my patches are decent. I've attached another one for destiny: In a Flow_removed_event, the fields are taken from an ofp_flow_removed message, but a couple of fields were missing (reason and priority). I added these to the event struct and changed python's flow removed callback generator to give these new parameters. -Derek On 01/12/2011 04:43 AM, kk yap wrote: Hi Derek, Thanks. Great patches as usual. I have pushed them to the destiny branch. Martin and Murphy, I believe I have pushed most (if not all) of Derek's patches at this moment. If anything else is missing, let me know. Thanks. Regards KK On 11 January 2011 07:23, Martin Casadocas...@nicira.com wrote: Derek, Thanks for the patches, these are very helpful. One of us will take a look shortly. .martin Hello, Here are two patches for destiny for the Python API. patch 1: - in pyrt.cc, add datapath id to the dictionaries created by Flow_removed_event and Error_event patch2: - add lots of doxygen doc strings to core.api - add callback generators for flow mod and flow removed events - change the names of callback generators to make them more readable - add more constants for dictionary keys -Derek On 01/04/2011 10:27 AM, kk yap wrote: Hi Derek, Thanks. Doxygen comments are presented in the code. E.g., /** \brief Event * Some event * * @author ykk * @date Jan 2011 */ struct x_event { ... } They are more in-depth example in the components. Regards KK On 3 January 2011 17:19, Derek Cormierderek.corm...@lab.ntt.co.jp wrote: Sure thing. Where do the doxygen comments go? I've never used doxygen before, I'm assuming they go above the struct definition but I don't see any such comments in the files I edited. Is there another file? Thanks, -Derek On 01/04/2011 06:20 AM, kk yap wrote: Hi Derek, Sorry it took me a while to get to this. Can you put in doxygen comments for these patches? The patches includes new structs and so on from what I can see. Else, I can do it. But I doubt I can get to it fast enough. Thanks. Regards KK On 27 December 2010 23:23, Derek Cormierderek.corm...@lab.ntt.co.jp wrote: Here's a couple more patches for destiny. 'barrier-reply.tar.gz' - make barrier reply events available to the Python API. 'flow-stats-in.tar.gz' - add a convenience method in component to register for flow stats in events. -Derek On 12/28/2010 01:30 AM, Martin Casado wrote: Thanks KK. I pushed a few edits as well. Hi, I have done that for destiny and pushed the file. Martin, you should probably check the list again. If I have missed you out (since I only exploited git log), do let me know. Regards KK ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org -- ~~~ Martin Casado Nicira Networks, Inc. www.nicira.com | www.openvswitch.org cell: 650-776-1457 ~~~ From 9d769739a48653f5806f85a05deebe165b79deaa Mon Sep 17 00:00:00 2001 From: Derek Cormier derek.corm...@lab.ntt.co.jp Date: Thu, 13 Jan 2011 14:09:04 +0900 Subject: [PATCH 09/10] Added the priority and reason field from ofp_flow_removed to Flow_removed_event. The python flow removed callback generator also includes these new parameters. --- src/include/flow-removed.hh | 27 +-- src/nox/coreapps/pyrt/pyrt.cc |2 ++ src/nox/lib/core.py |9 ++--- src/nox/lib/util.py |5 +++-- 4 files changed, 28 insertions(+), 15 deletions(-) diff --git a/src/include/flow-removed.hh b/src/include/flow-removed.hh index f164f5e..206c4f5 100644 --- a/src/include/flow-removed.hh +++ b/src/include/flow-removed.hh @@ -43,16 +43,17 @@ struct Flow_removed_event public Flow_event, boost::noncopyable { -Flow_removed_event(datapathid datapath_id_, - uint32_t duration_sec_, uint32_t duration_nsec_, - uint16_t idle_timeout_, - uint64_t packet_count_, uint64_t byte_count_, - uint64_t cookie_) -: Event(static_get_name()), datapath_id(datapath_id_), +Flow_removed_event( + datapathid datapath_id_, uint16_t priority_, + uint8_t reason_, uint32_t duration_sec_, + uint32_t duration_nsec_, uint16_t idle_timeout_, + uint64_t packet_count_, uint64_t byte_count_, + uint64_t cookie_) +: Event(static_get_name()), datapath_id(datapath_id_), + priority(priority_), reason(reason_), duration_sec(duration_sec_), duration_nsec(duration_nsec_), - idle_timeout(idle_timeout_), - packet_count(packet_count_), byte_count(byte_count_), - cookie(cookie_) { } + idle_timeout(idle_timeout_), packet_count(packet_count_), + byte_count
Re: [nox-dev] Contributing to Nox
Woops, I introduced a bug. I was converting 'reason' to host byte order, but it's only 8 bits. This causes it to always be 0 since it turns into a short before ntohs(). I attached the fix, sorry about that. -Derek On 01/13/2011 02:55 PM, kk yap wrote: Thanks. I pushed this. Regards KK On 12 January 2011 21:40, Derek Cormierderek.corm...@lab.ntt.co.jp wrote: Thanks! I'm glad my patches are decent. I've attached another one for destiny: In a Flow_removed_event, the fields are taken from an ofp_flow_removed message, but a couple of fields were missing (reason and priority). I added these to the event struct and changed python's flow removed callback generator to give these new parameters. -Derek On 01/12/2011 04:43 AM, kk yap wrote: Hi Derek, Thanks. Great patches as usual. I have pushed them to the destiny branch. Martin and Murphy, I believe I have pushed most (if not all) of Derek's patches at this moment. If anything else is missing, let me know. Thanks. Regards KK On 11 January 2011 07:23, Martin Casadocas...@nicira.comwrote: Derek, Thanks for the patches, these are very helpful. One of us will take a look shortly. .martin Hello, Here are two patches for destiny for the Python API. patch 1: - in pyrt.cc, add datapath id to the dictionaries created by Flow_removed_event and Error_event patch2: - add lots of doxygen doc strings to core.api - add callback generators for flow mod and flow removed events - change the names of callback generators to make them more readable - add more constants for dictionary keys -Derek On 01/04/2011 10:27 AM, kk yap wrote: Hi Derek, Thanks. Doxygen comments are presented in the code. E.g., /** \brief Event * Some event * * @author ykk * @date Jan 2011 */ struct x_event { ... } They are more in-depth example in the components. Regards KK On 3 January 2011 17:19, Derek Cormierderek.corm...@lab.ntt.co.jp wrote: Sure thing. Where do the doxygen comments go? I've never used doxygen before, I'm assuming they go above the struct definition but I don't see any such comments in the files I edited. Is there another file? Thanks, -Derek On 01/04/2011 06:20 AM, kk yap wrote: Hi Derek, Sorry it took me a while to get to this. Can you put in doxygen comments for these patches? The patches includes new structs and so on from what I can see. Else, I can do it. But I doubt I can get to it fast enough. Thanks. Regards KK On 27 December 2010 23:23, Derek Cormierderek.corm...@lab.ntt.co.jp wrote: Here's a couple more patches for destiny. 'barrier-reply.tar.gz' - make barrier reply events available to the Python API. 'flow-stats-in.tar.gz' - add a convenience method in component to register for flow stats in events. -Derek On 12/28/2010 01:30 AM, Martin Casado wrote: Thanks KK. I pushed a few edits as well. Hi, I have done that for destiny and pushed the file. Martin, you should probably check the list again. If I have missed you out (since I only exploited git log), do let me know. Regards KK ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org -- ~~~ Martin Casado Nicira Networks, Inc. www.nicira.com | www.openvswitch.org cell: 650-776-1457 ~~~ From 3578f2c1aa8b0d62bf56198d23d419a4529f86a6 Mon Sep 17 00:00:00 2001 From: Derek Cormier derek.corm...@lab.ntt.co.jp Date: Thu, 13 Jan 2011 15:18:57 +0900 Subject: [PATCH 11/11] Fix a bug where the 8-bit reason field in a Flow_removed_event is being converted to host byte order. --- src/include/flow-removed.hh |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/include/flow-removed.hh b/src/include/flow-removed.hh index 206c4f5..8a7c81c 100644 --- a/src/include/flow-removed.hh +++ b/src/include/flow-removed.hh @@ -100,7 +100,7 @@ Flow_removed_event::Flow_removed_event(datapathid datapath_id_, datapath_id(datapath_id_) { priority = ntohs(ofr-priority); -reason= ntohs(ofr-reason); +reason= ofr-reason; cookie= ntohll(ofr-cookie); duration_sec = ntohl(ofr-duration_sec); duration_nsec = ntohl(ofr-duration_nsec); -- 1.7.0.4 ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
Re: [nox-dev] Quick Bugfix for pyglue.
Hi KK, No problem. I'm working on some more changes to further expose python, and I noticed that core.py has both method header comments and doc strings. If I clean up the comments, which should I use? And, do you also format python comments for doxygen? Thanks, -Derek On 01/06/2011 05:03 AM, kk yap wrote: Hi Derek, I pushed all the patches. I did not realize you are just exposing things to Python and not declaring new structs. Sorry. A quick glimpse has failed me. Regards KK On 3 January 2011 21:07, Derek Cormierderek.corm...@lab.ntt.co.jp wrote: Here is a patch for destiny to fix a bug where pyglue.cc was using ntohl on ofp_flow_stat's cookie field instead of ntohll, which is required for 64-bit values. -Derek ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
Re: [nox-dev] Telling Like Flows Apart
Srini, it appears I was mistaken. Open vSwitch does not add a duplicate. I thought it did before, but I might have been imagining things. -Derek On 12/29/2010 02:32 PM, Derek Cormier wrote: Hi Srini, If I recall correctly, when I add two flows with the same match pattern, Open vSwitch shows both of them when I dump the flows to the console. I can verify this, but not for about five days... -Derek On Wed, Dec 29, 2010 at 3:07 AM, Srini Seetharaman seeth...@stanford.edu mailto:seeth...@stanford.edu wrote: Hi Derek I'm curious: How do you add flows with same match pattern and not have them be overwritten at the switch level? On Sun, Dec 19, 2010 at 4:46 PM, Derek Cormier derek.corm...@lab.ntt.co.jp mailto:derek.corm...@lab.ntt.co.jp wrote: Let's say you add a few flows that are exactly the same using install_datapath_flow(). Then, you do a flow stats request for that flow. The response body should contain an array of flow stats- one for each flow. Is there any way to know which stats element belongs to which flow? Is the first element going to be the first flow that was added? Thanks, Derek ___ nox-dev mailing list nox-dev@noxrepo.org mailto:nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org ___ nox-dev mailing list nox-dev@noxrepo.org mailto:nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
[nox-dev] Quick Bugfix for pyglue.
Here is a patch for destiny to fix a bug where pyglue.cc was using ntohl on ofp_flow_stat's cookie field instead of ntohll, which is required for 64-bit values. -Derek From 05b659b0ba0840045b0223fb7f6843f7742c18ba Mon Sep 17 00:00:00 2001 From: Derek Cormier derek.corm...@lab.ntt.co.jp Date: Tue, 4 Jan 2011 13:55:51 +0900 Subject: [PATCH] Fix pyglue's cookie conversion for flow stats structure. When pyglue.cc converted the cookie in an ofp_flow_stats structure from network to host byte order, it used ntohl rather than ntohll. This gave incorrect values since cookies 64-bit. --- src/nox/coreapps/pyrt/pyglue.cc |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/nox/coreapps/pyrt/pyglue.cc b/src/nox/coreapps/pyrt/pyglue.cc index 1a6f780..b9db96f 100644 --- a/src/nox/coreapps/pyrt/pyglue.cc +++ b/src/nox/coreapps/pyrt/pyglue.cc @@ -519,7 +519,7 @@ to_python(const ofp_flow_stats fs) } pyglue_setdict_string(dict, table_id, to_python(fs.table_id)); pyglue_setdict_string(dict, match, to_python(fs.match)); -pyglue_setdict_string(dict, cookie, to_python(ntohl(fs.cookie))); +pyglue_setdict_string(dict, cookie, to_python(ntohll(fs.cookie))); pyglue_setdict_string(dict, duration_sec, to_python(ntohl(fs.duration_sec))); pyglue_setdict_string(dict, duration_nsec, to_python(ntohl(fs.duration_nsec))); pyglue_setdict_string(dict, priority, to_python(ntohs(fs.priority))); -- 1.7.0.4 ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
Re: [nox-dev] Telling Like Flows Apart
Hi Srini, If I recall correctly, when I add two flows with the same match pattern, Open vSwitch shows both of them when I dump the flows to the console. I can verify this, but not for about five days... -Derek On Wed, Dec 29, 2010 at 3:07 AM, Srini Seetharaman seeth...@stanford.eduwrote: Hi Derek I'm curious: How do you add flows with same match pattern and not have them be overwritten at the switch level? On Sun, Dec 19, 2010 at 4:46 PM, Derek Cormier derek.corm...@lab.ntt.co.jp wrote: Let's say you add a few flows that are exactly the same using install_datapath_flow(). Then, you do a flow stats request for that flow. The response body should contain an array of flow stats- one for each flow. Is there any way to know which stats element belongs to which flow? Is the first element going to be the first flow that was added? Thanks, Derek ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
Re: [nox-dev] Contributing to Nox
Here's a couple more patches for destiny. 'barrier-reply.tar.gz' - make barrier reply events available to the Python API. 'flow-stats-in.tar.gz' - add a convenience method in component to register for flow stats in events. -Derek On 12/28/2010 01:30 AM, Martin Casado wrote: Thanks KK. I pushed a few edits as well. Hi, I have done that for destiny and pushed the file. Martin, you should probably check the list again. If I have missed you out (since I only exploited git log), do let me know. Regards KK flow-stats-in.tar.gz Description: GNU Zip compressed data barrier-reply.tar.gz Description: GNU Zip compressed data ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
Re: [nox-dev] Contributing to Nox
Hi KK, I've attached the patch. Sorry for taking so long to reply, I was away for the holidays. The patch is for destiny. I have seen Murphy's patch, and this patch is based off of it. Murphy added the ability to use the component's register_handler method for error events, and mine just adds a convenience methods for registering errors, since they exist for other events as well. -Derek On 12/23/2010 03:20 AM, kk yap wrote: Thanks Alec. That's a useful feature I did not know about. Appreciate the advice. Hi Derek, Is this patch against destiny? We tend to patch the unstable branch (destiny), so if I can have a patch against destiny, that would be best. Also, have you seen Murphy's patch in the destiny branch? Regards KK commit a2efd049da9f0d0d8dc4e56dc1aaa64930c1d257 Author: Murphy McCauleymurphy.mccau...@gmail.com Date: Tue Dec 14 11:49:18 2010 -0800 Pythonize OpenFlow error messages OpenFlow error messages (ofp_error_msg / OFPT_ERROR_MSG) were previously only available in C++. They're now available in Python as well. On 22 December 2010 10:09, Alec Storyav...@cornell.edu wrote: If you click the little down arrow on the top right, and select Show original you get the non-formatted version of the message and should be able to get the patch out of there. On Wed, Dec 22, 2010 at 6:29 AM, kk yapyap...@stanford.edu wrote: Hi Derek, Many thanks for the patch. Do you mind sending me the patch zipped or tarballed? Sorry Gmail reformats things a little, so the git-format-patch output is distorted. Regards KK On 21 December 2010 23:38, Derek Cormierderek.corm...@lab.ntt.co.jp wrote: Hello, I would like to start contributing to the Nox code. This is my first time contributing to open source software, and I'm still new to git, so I don't know the exact process. I've seen some people post patch files, so I'll include a small change I made here. Recently the Error_event was made available in the python API, but core.py didn't have an easier member function to register errors (had to register using the Error_event.get_static_name() etc..). This isn't incredibly useful, but I just wanted to try contributing for the first time. Please let me know if I didn't do this right. Thanks! Derek From ea590df29ae342bb9029b90829fa1ddf3ff36d10 Mon Sep 17 00:00:00 2001 From: Derek Cormiercormier.de...@gmail.com Date: Wed, 22 Dec 2010 16:18:33 +0900 Subject: [PATCH] Allow python components to register for error events through a class method. --- src/nox/lib/core.py | 10 ++ src/nox/lib/util.py |9 + 2 files changed, 19 insertions(+), 0 deletions(-) diff --git a/src/nox/lib/core.py b/src/nox/lib/core.py index 3b994c6..70cdb48 100644 --- a/src/nox/lib/core.py +++ b/src/nox/lib/core.py @@ -678,6 +678,16 @@ class Component: self.register_handler(Switch_mgr_leave_event.static_get_name(), gen_switch_mgr_leave_cb(handler)) +def register_for_error(self, handler): + +register a handler to be called on every error +event handler will be called with the following args: + +handler(type, code, data, xid) + +self.register_handler(Error_event.static_get_name(), + gen_error_cb(handler)) + def unregister_handler(self, rule_id): Unregister a handler for match. diff --git a/src/nox/lib/util.py b/src/nox/lib/util.py index a192826..aa4b807 100644 --- a/src/nox/lib/util.py +++ b/src/nox/lib/util.py @@ -239,6 +239,15 @@ def gen_switch_mgr_leave_cb(handler): f.cb = handler return f +def gen_error_cb(handler): +def f(event): +ret = f.cb(event.type, event.code, event.data, event.xid) +if ret == None: +return CONTINUE +return ret +f.cb = handler +return f + def set_match(attrs): m = openflow.ofp_match() wildcards = 0 -- 1.7.0.4 ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org -- Alec Story Cornell University Biological Sciences, Computer Science 2012 ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org py-comp-reg-errors.patch.gz Description: GNU Zip compressed data ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
Re: [nox-dev] Contributing to Nox
Great. Should I post any future changes here on the Nox board or send them to a developer like yourself? -Derek On 12/27/2010 02:54 PM, kk yap wrote: Hi Derek, Thanks. I pushed this to destiny (unstable). Regards KK On 26 December 2010 16:56, Derek Cormier derek.corm...@lab.ntt.co.jp mailto:derek.corm...@lab.ntt.co.jp wrote: Woops! I'm not sure how it happened but I somehow messed up the patch file. Please use this attached one instead. -Derek On 12/27/2010 09:48 AM, Derek Cormier wrote: Hi KK, I've attached the patch. Sorry for taking so long to reply, I was away for the holidays. The patch is for destiny. I have seen Murphy's patch, and this patch is based off of it. Murphy added the ability to use the component's register_handler method for error events, and mine just adds a convenience methods for registering errors, since they exist for other events as well. -Derek On 12/23/2010 03:20 AM, kk yap wrote: Thanks Alec. That's a useful feature I did not know about. Appreciate the advice. Hi Derek, Is this patch against destiny? We tend to patch the unstable branch (destiny), so if I can have a patch against destiny, that would be best. Also, have you seen Murphy's patch in the destiny branch? Regards KK commit a2efd049da9f0d0d8dc4e56dc1aaa64930c1d257 Author: Murphy McCauleymurphy.mccau...@gmail.com mailto:murphy.mccau...@gmail.com Date: Tue Dec 14 11:49:18 2010 -0800 Pythonize OpenFlow error messages OpenFlow error messages (ofp_error_msg / OFPT_ERROR_MSG) were previously only available in C++. They're now available in Python as well. On 22 December 2010 10:09, Alec Storyav...@cornell.edu mailto:av...@cornell.edu wrote: If you click the little down arrow on the top right, and select Show original you get the non-formatted version of the message and should be able to get the patch out of there. On Wed, Dec 22, 2010 at 6:29 AM, kk yapyap...@stanford.edu mailto:yap...@stanford.edu wrote: Hi Derek, Many thanks for the patch. Do you mind sending me the patch zipped or tarballed? Sorry Gmail reformats things a little, so the git-format-patch output is distorted. Regards KK On 21 December 2010 23:38, Derek Cormierderek.corm...@lab.ntt.co.jp mailto:derek.corm...@lab.ntt.co.jp wrote: Hello, I would like to start contributing to the Nox code. This is my first time contributing to open source software, and I'm still new to git, so I don't know the exact process. I've seen some people post patch files, so I'll include a small change I made here. Recently the Error_event was made available in the python API, but core.py didn't have an easier member function to register errors (had to register using the Error_event.get_static_name() etc..). This isn't incredibly useful, but I just wanted to try contributing for the first time. Please let me know if I didn't do this right. Thanks! Derek From ea590df29ae342bb9029b90829fa1ddf3ff36d10 Mon Sep 17 00:00:00 2001 From: Derek Cormiercormier.de...@gmail.com mailto:cormier.de...@gmail.com Date: Wed, 22 Dec 2010 16:18:33 +0900 Subject: [PATCH] Allow python components to register for error events through a class method. --- src/nox/lib/core.py | 10 ++ src/nox/lib/util.py |9 + 2 files changed, 19 insertions(+), 0 deletions(-) diff --git a/src/nox/lib/core.py b/src/nox/lib/core.py index 3b994c6..70cdb48 100644 --- a/src/nox/lib/core.py +++ b/src/nox/lib/core.py @@ -678,6 +678,16 @@ class Component: self.register_handler(Switch_mgr_leave_event.static_get_name(), gen_switch_mgr_leave_cb(handler)) +def register_for_error(self, handler): + +register a handler to be called on every error +event handler will be called with the following args: + +handler(type, code, data, xid) + +self.register_handler(Error_event.static_get_name(), + gen_error_cb(handler)) + def unregister_handler(self, rule_id): Unregister a handler for match. diff --git a/src/nox/lib/util.py b/src/nox/lib/util.py index a192826..aa4b807 100644 --- a/src/nox/lib/util.py +++ b/src/nox/lib/util.py @@ -239,6 +239,15 @@ def gen_switch_mgr_leave_cb(handler): f.cb = handler return f +def gen_error_cb(handler): +def f(event): +ret = f.cb(event.type, event.code, event.data, event.xid) +if ret == None: +return CONTINUE
[nox-dev] Is flow mod event misleading?
I noticed that the flow mod event fires in response to a successful NOX API call for adding a flow. It gives the impression that it was successfully added to the switch, but, this is not always the case. For example, if I send two identical /ofp_flow_mod/ requests with the *OFPFF_CHECK_OVERLAP* flag set, then I will still get a flow mod, even though one triggers an error and is not added to the switch's table. I'm guessing the reason for this is speed. Since OpenFlow switches do not reply to flow mod requests, there are a couple ways I can think of to confirm if a flow was added: 1. Send a barrier message after each add flow message. If a reply is received and no error message was received, then it was added. 2. Store an internal copy of the flow table in the NOX component and check for potential errors before adding. Both of these solutions have problems if other components are also adding flows. Does anyone have any other ideas? It would be nice if the OpenFlow protocol had responses to flow mod requests that could be optionally turned on/off for speed. -Derek ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
Re: [nox-dev] Is flow mod event misleading?
Thanks KK, that clears everything up. May I ask, what is the main reason for not including a flow mod reply in the OpenFlow protocol? Is it speed? Isn't OpenFlow fast enough? -Derek On 12/20/2010 02:38 PM, kk yap wrote: Hi Derek, Some comments inline. Hope they help. Regards KK On 19 December 2010 21:10, Derek Cormierderek.corm...@lab.ntt.co.jp wrote: I noticed that the flow mod event fires in response to a successful NOX API call for adding a flow. It gives the impression that it was successfully added to the switch, but, this is not always the case. For example, if I send two identical ofp_flow_mod requests with the OFPFF_CHECK_OVERLAP flag set, then I will still get a flow mod, even though one triggers an error and is not added to the switch's table. A flow mod event is triggered whenever a flow_mod is sent by a component. As you have noticed, multiple comments can be sending flow mods and this is a way for a component to see all the flow mods sent. That's all. It does not imply NOX has sent the message, and even less if the switch has received it or processed it. I'm guessing the reason for this is speed. Since OpenFlow switches do not reply to flow mod requests, there are a couple ways I can think of to confirm if a flow was added: 1. Send a barrier message after each add flow message. If a reply is received and no error message was received, then it was added. Most of the time, you are right. While OpenFlow messages are carried over TCP and SSL connections, there is no guarantee that a switch will honor all the messages. Meaning, it is perfectly okay for a switch to send a reply to the barrier and ignore the flow mod before that. This is really because a switch can be overwhelmed by control messages and at some point it might discard messages. Your flow mod might just be the unlucky message dropped. 2. Store an internal copy of the flow table in the NOX component and check for potential errors before adding. Yes. This is prudent but unfortunately tedious. This allows assume you emulate the entire switch functionality in the controller. By the way, you still will not have any guarantees about the switch inserting the flow mod, as I have explained above. Both of these solutions have problems if other components are also adding flows. Does anyone have any other ideas? In my mind, the obvious way to do this is hard and evil. You have to send the flow mods, cache it in the controller and periodically dump the flow table to check that it is there. This can be done in conjunction with other operations like stat gathering, but the operation can be very stressful to a switch. It would be nice if the OpenFlow protocol had responses to flow mod requests that could be optionally turned on/off for speed. We have been through this discussion a few times in OpenFlow. And current result is that we still don't have it in the spec, even for the upcoming OpenFlow v1.1. -Derek ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
Re: [nox-dev] Help modifying some Nox code for the first time
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 nox-dev@noxrepo.org mailto:nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
Re: [nox-dev] ERR:Application 'python' description not found when running latest NOX
Did you call the configure script with python? ./configure --with-python=yes -Derek On 12/17/2010 10:18 AM, Stephen Wong wrote: Hi, I just compiled NOX from the latest repository (make/make check/make install all succeed), but when I tried to run it, I got the following error: openf...@linux-ojon:~/nox/nox/build src/nox_core -i ptcp:6634 -v 1|nox|INFO:Starting nox_core (/home/openflow/nox/nox/build/src/.libs/nox_core) 2|nox|ERR:Application 'python' description not found. And here is the NOX version number: openf...@linux-ojon:~/nox/nox/build src/nox_core -V NOX 0.9.0(zaku)~full~beta (nox_core), compiled Dec 16 2010 16:18:05 Compiled with OpenFlow 0x01 Any help is appreciated. Thanks! Thanks, - Stephen ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
[nox-dev] Help modifying some Nox code for the first time
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 nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
Re: [nox-dev] Help modifying some Nox code for the first time
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 nox-dev@noxrepo.org mailto:nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
[nox-dev] Associate xid with a flow mod event
Hello, When you receive a flow mod event, is there any way to associate it with the xid of the original request that caused it? I'm looking for a way to confirm that a specific request generated a specific response. For example, if multiple components are running and they both send a packet to add the same flow (with the no overlapping flows flag on), then one will get an error and the other will not. I suppose you could check the xid of the errors to determine who's was successful, but that seems a bit hackish. Thanks! Derek ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
Re: [nox-dev] Associate xid with a flow mod event
@KK It turns out I made a wrong assumption. I thought that when an ofp_flow_mod (OFPFC_ADD) message was sent, it returns a reply with the same xid. After looking at the OF protocol, it looks like a message is only sent back if an error occurred. @Rob The cookie isn't quite what I'm looking for, I'm not sure what it might be used for in the future... Basically, I'm looking for a way to validate that adding a flow worked. Consider the following cenario: There are two components: A B 1. A sends a request to add a flow. 2. B sends a request to add the exact same flow. 3. B's gets added first and is successful. 4. A received a flow mod event and thinks its flow was added. 5. A's flow gets added. It conflicts with B's flow and generates an error. 6. A sees an error for his exact flow and doesn't know if it's flow was added or another component's. -Derek ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
Re: [nox-dev] Error feedback from adding flows
Thanks Srini. Do you know if there is any way to catch error events in Python? I've looked through core.py and pycomponent.py but I can't seem to find anything. -Derek On 12/14/2010 04:19 AM, Srini Seetharaman wrote: There seems to be Error_event that is thrown. Maybe you can bind a handler for that. For the details of Error_event, please see include/error-event.hh On Fri, Dec 10, 2010 at 12:12 AM, Derek Cormier derek.corm...@lab.ntt.co.jp wrote: Hello, I'm looking for a way to see if adding a flow failed. In the OpenFlow protocol, it says an ofp_error_msg message is returned. Is there any event I can register for to catch this? I would also like to catch an error of type OFPET_FLOW_MOD_FAILED. I'm using a python component. Thanks! -Derek ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
[nox-dev] Error feedback from adding flows
Hello, I'm looking for a way to see if adding a flow failed. In the OpenFlow protocol, it says an ofp_error_msg message is returned. Is there any event I can register for to catch this? I would also like to catch an error of type OFPET_FLOW_MOD_FAILED. I'm using a python component. Thanks! -Derek ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
Re: [nox-dev] Help creating a flow
Oh, that's embarrasing! I was using body.port_no instead of body.out_port. It works now. -Derek On 12/03/2010 10:34 AM, Derek Cormier wrote: I registered for flow mod events and the event shows the flow being added. I can also see the flow through Open vSwitch. I'm not receiving any errors, so the request is in the correct format. Could it be a problem with Open vSwitch? Request == request = ofp_stats_request() request.header.xid = 25 request.type = OFPST_FLOW request.flags = 0 body = ofp_flow_stats_request() body.port_no = OFPP_NONE body.table_id = 0xff # All flow tables body.match.wildcards = OFPFW_ALL request.header.length = len(request.pack()) + len(body.pack()) self.send_openflow_command(dpid, request.pack() + body.pack()) ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
[nox-dev] Help creating a flow
Hello, I am trying to add a flow to a switch in my Nox component. After the switch joins the datapath, I create a simple flow to test that it works: flow = dict() flow[NW_PROTO] = UDP_PROTOCOL self.install_datapath_flow(dpid, flow, OFP_FLOW_PERMANENT, OFP_FLOW_PERMANENT, [[OFPAT_OUTPUT, [0, OFPP_CONTROLLER]]]) I then receive a flow stats reply event in my handler, but event.flows = [] and event.flowcount = 0. Do you know what I am doing wrong? Thank you, Derek ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
Re: [nox-dev] Help creating a flow
Oh, and I forgot to mention that I am sending a flow stats request. On 12/01/2010 10:30 AM, Derek Cormier wrote: Hello, I am trying to add a flow to a switch in my Nox component. After the switch joins the datapath, I create a simple flow to test that it works: flow = dict() flow[NW_PROTO] = UDP_PROTOCOL self.install_datapath_flow(dpid, flow, OFP_FLOW_PERMANENT, OFP_FLOW_PERMANENT, [[OFPAT_OUTPUT, [0, OFPP_CONTROLLER]]]) I then receive a flow stats reply event in my handler, but event.flows = [] and event.flowcount = 0. Do you know what I am doing wrong? Thank you, Derek ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
Re: [nox-dev] Help creating a flow
Hmm, the same thing happens using 0x. Yeah, something must be wrong with the request since I can guarantee the flow is added before it's sent. On 12/01/2010 11:40 AM, Kyriakos Zarifis wrote: hm, this looks good to me Still, it seems as though something is wrong with the request. and also looks the same as some code that I have that's working.. the only difference is that I'm using body.match.wildcards = 0x although that shouldn't make a difference. But if you want you can try it out On Tue, Nov 30, 2010 at 5:56 PM, Derek Cormier derek.corm...@lab.ntt.co.jp mailto:derek.corm...@lab.ntt.co.jp wrote: # Set up the OpenFlow stats request packet. request = ofp_stats_request() request.header.xid = c_htonl(long(25)) request.type = OFPST_FLOW request.flags = 0 body = ofp_flow_stats_request() body.port_no = OFPP_NONE body.table_id = 0xff # All flow tables body.match.wildcards = OFPFW_ALL request.header.length = len(request.pack()) + len(body.pack()) # Send the request. logger.info http://logger.info(Requesting flows from switch id: %d. % dpid) self.send_openflow_command(dpid, request.pack() + body.pack()) On 12/01/2010 10:55 AM, Kyriakos Zarifis wrote: can you paste the code where you build and send your stats request? On Tue, Nov 30, 2010 at 5:48 PM, Derek Cormier derek.corm...@lab.ntt.co.jp mailto:derek.corm...@lab.ntt.co.jp wrote: Interesting. I used Open vSwitch's ovs-ofctl dump-flows and I can see the flow. I am waiting three seconds after installing the flow before requesting the flow stats, so that should be enough time... -Derek On 12/01/2010 10:40 AM, Kyriakos Zarifis wrote: Can you look at the flowtable using dpctl to verify that it is empty? ( could it be the timing? are you sending the request right after you send the flowmod?) On Tue, Nov 30, 2010 at 5:33 PM, Derek Cormier derek.corm...@lab.ntt.co.jp mailto:derek.corm...@lab.ntt.co.jp wrote: Oh, and I forgot to mention that I am sending a flow stats request. On 12/01/2010 10:30 AM, Derek Cormier wrote: Hello, I am trying to add a flow to a switch in my Nox component. After the switch joins the datapath, I create a simple flow to test that it works: flow = dict() flow[NW_PROTO] = UDP_PROTOCOL self.install_datapath_flow(dpid, flow, OFP_FLOW_PERMANENT, OFP_FLOW_PERMANENT, [[OFPAT_OUTPUT, [0, OFPP_CONTROLLER]]]) I then receive a flow stats reply event in my handler, but event.flows = [] and event.flowcount = 0. Do you know what I am doing wrong? Thank you, Derek ___ nox-dev mailing list nox-dev@noxrepo.org mailto:nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org ___ nox-dev mailing list nox-dev@noxrepo.org mailto:nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org ___ nox-dev mailing list nox-dev@noxrepo.org mailto:nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org ___ nox-dev mailing list nox-dev@noxrepo.org mailto:nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
[nox-dev] Arguments For Components
Is there any way to send command line arguments to Nox components? Thanks, Derek ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
Re: [nox-dev] Arguments For Components
Hi Kyriakos, I was looking to send arguments when running ./nox_core. I just found the documentation on the Wiki, but it's not clear on how to access the arguments from the component. Do you know how to do this? Thanks! -Derek On 11/30/2010 10:16 AM, Kyriakos Zarifis wrote: Hi Derek, You can pass arguments to components on startup as flags when you run ./nox_core If you're talking about sending commands to components while NOX is running (which is think is what you want?), this can also be done using the messenger component. The idea is that you send a command (as a json string) to the messenger, indicating which component it is meant for. This would raise a JSONmsg_event which can be caught and handled by your component. I think the script nox_console communicates only with LAVI in that way, but it provides an example, and the idea is the same for any component. (If you use the GUI from destiny, you can type a json command in the console and direct it to any component) On Mon, Nov 29, 2010 at 4:48 PM, Derek Cormier derek.corm...@lab.ntt.co.jp mailto:derek.corm...@lab.ntt.co.jp wrote: Is there any way to send command line arguments to Nox components? Thanks, Derek ___ nox-dev mailing list nox-dev@noxrepo.org mailto:nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
[nox-dev] Finding out the switches connected to NOX
If I write a NOX component in python, are there any methods for returning the datapath ID of all connected switches? As I was browsing through the core API and components, I saw that many methods take a dpid, but I couldn't find any for retrieving them in the first place. Thanks, -Derek ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
[nox-dev] TCP Server in NOX Component
Hello, I am trying to run a thread inside of a python NOX component using twisted that listens for TCP connections. I added code to pyswitch.py to see if I could get it working. However, I am getting this seg fault from NOX. It seems to be failing at 'reactor.listenTCP(8007, factory)'. Any ideas on what the problem might be? Added code: class ServerThread(Thread): def run(self): print Thread started factory = Factory() factory.protocol = QOTD reactor.listenTCP(8007, factory) reactor.run() class QOTD(LineReceiver): def connectionMade(self): self.transport.write(Vene, vidi, vici\n) self.transport.loseConnection() I added the following two lines at the end of pyswitch's install method: self.serverThread = ServerThread() self.serverThread.start() NOX Output: NOX 0.9.1~full~beta (nox_core), compiled Nov 11 2010 10:38:11 Compiled with OpenFlow 0x01 Thread started Caught signal 11. 0x7f47a8541262 64 (vigil::fault_handler(int)+0x42) 0x7f47a79d5af0 0x7f47a85a206b 64 (vigil::co_fsm_run(vigil::co_thread*)+0x4b) 0x7f47a4cddc83 0x7f47a4ce193c 0x7f47a4ce1f1a 0x7f47a6610313 18446604128078702928 (PyEval_EvalFrameEx+0x5483) 0x7f47a6969440 18446744073666775329 (PyFrame_Type+0x0) Segmentation fault Thanks, -Derek ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
[nox-dev] Cannot access repository
Hello, Whenever I try to clone the repository using: git clone http://noxrepo.org/noxcore I get the following error: Initialized empty Git repository in /home/derek/VirtualBoxShared/Switch/Code/noxcore/.git/ fatal: http://noxrepo.org/noxcore/info/refs not found: did you run git update-server-info on the server? Does anyone know how to fix this? Thanks, --Derek ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
Re: [nox-dev] Cannot access repository
Hmm, the same thing happens with that address: Initialized empty Git repository in /home/derek/VirtualBoxShared/Switch/Code/nox/.git/ fatal: http://noxrepo.org/nox/info/refs not found: did you run git update-server-info on the server? On 11/12/2010 03:22 AM, Upthegrove, Timothy A wrote: Try git clone git://noxrepo.org/nox Tim Upthegrove Georgia Institute of Technology College of Computing (406)-437-1493 - Original Message - Hello, Whenever I try to clone the repository using: git clone http://noxrepo.org/noxcore I get the following error: Initialized empty Git repository in /home/derek/VirtualBoxShared/Switch/Code/noxcore/.git/ fatal: http://noxrepo.org/noxcore/info/refs not found: did you run git update-server-info on the server? Does anyone know how to fix this? Thanks, --Derek ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
Re: [nox-dev] Cannot access repository
Yes, I used http. I cannot use git behind my work's proxy... So I guess that's the problem. I assumed all git repositories work using http. On 11/12/2010 12:15 PM, Upthegrove, Timothy A wrote: This may be a dumb question, but did you use git:// instead of http:// in your second attempt? I noticed you were using http:// the first time... Thats the only thing I can think of. Tim Upthegrove Georgia Institute of Technology College of Computing (406)-437-1493 - Original Message - I just tried. It works for me. ykk$ git clone git://noxrepo.org/nox Initialized empty Git repository in Downloads/nox/.git/ remote: Counting objects: 3410, done. remote: Compressing objects: 100% (2357/2357), done. remote: Total 3410 (delta 2296), reused 1770 (delta 1021) Receiving objects: 100% (3410/3410), 2.30 MiB | 463 KiB/s, done. Resolving deltas: 100% (2296/2296), done. Regards KK On 11 November 2010 16:25, Derek Cormierderek.corm...@lab.ntt.co.jp wrote: Hmm, the same thing happens with that address: Initialized empty Git repository in /home/derek/VirtualBoxShared/Switch/Code/nox/.git/ fatal: http://noxrepo.org/nox/info/refs not found: did you run git update-server-info on the server? On 11/12/2010 03:22 AM, Upthegrove, Timothy A wrote: Try git clone git://noxrepo.org/nox Tim Upthegrove Georgia Institute of Technology College of Computing (406)-437-1493 - Original Message - Hello, Whenever I try to clone the repository using: git clone http://noxrepo.org/noxcore I get the following error: Initialized empty Git repository in /home/derek/VirtualBoxShared/Switch/Code/noxcore/.git/ fatal: http://noxrepo.org/noxcore/info/refs not found: did you run git update-server-info on the server? Does anyone know how to fix this? Thanks, --Derek ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
[nox-dev] Problem Installed NOX: make check
Hello, I was able to build NOX, but I get some errors when running 'make check'. I found a poster with the exact same problem as me , but I could not find a solution (http://www.mail-archive.com/nox-dev@noxrepo.org/msg00495.html). Here is some of my output (everything above this is good): 0% 10 20 30 40 50 60 70 80 90 100% ||||||||||| Running 74 test cases... ***ImportError: Import by filename is not supported. tests.cc(115): fatal error in nox.netapps.tests.pyunittests.storage_test.testAddthenDrop: Unable to import twisted.trial.reporter. *ImportError: Import by filename is not supported. tests.cc(115): fatal error in nox.netapps.tests.pyunittests.storage_test.testAddthenPut: Unable to import twisted.trial.reporter. *ImportError: Import by filename is not supported. tests.cc(115): fatal error in nox.netapps.tests.pyunittests.storage_test.testAddthenPutWrongTable: Unable to import twisted.trial.reporter. ImportError: Import by filename is not supported. tests.cc(115): fatal error in nox.netapps.tests.pyunittests.storage_test.testAddthenPutthenGet: Unable to import twisted.trial.reporter. *ImportError: Import by filename is not supported. tests.cc(115): fatal error in nox.netapps.tests.pyunittests.storage_test.testAddthenPutthenGetNextUsingIndex: Unable to import twisted.trial.reporter. *ImportError: Import by filename is not supported. tests.cc(115): fatal error in nox.netapps.tests.pyunittests.storage_test.testAddthenPutthenGetNextAll: Unable to import twisted.trial.reporter. ImportError: Import by filename is not supported. tests.cc(115): fatal error in nox.netapps.tests.pyunittests.storage_test.testAddthenPutthenGetDoubleIndexCheck: Unable to import twisted.trial.reporter. *ImportError: Import by filename is not supported. tests.cc(115): fatal error in nox.netapps.tests.pyunittests.storage_test.testMultiIndex: Unable to import twisted.trial.reporter. *ImportError: Import by filename is not supported. tests.cc(115): fatal error in nox.netapps.tests.pyunittests.storage_test.testMultiIndexModify: Unable to import twisted.trial.reporter. ImportError: Import by filename is not supported. tests.cc(115): fatal error in nox.netapps.tests.pyunittests.storage_test.testRemoveMultipleRows: Unable to import twisted.trial.reporter. *ImportError: Import by filename is not supported. tests.cc(115): fatal error in nox.netapps.tests.pyunittests.storage_test.testGetRemoveSequence: Unable to import twisted.trial.reporter. *ImportError: Import by filename is not supported. tests.cc(115): fatal error in nox.netapps.tests.pyunittests.storage_test.testCreateSchemaCheck: Unable to import twisted.trial.reporter. ImportError: Import by filename is not supported. tests.cc(115): fatal error in nox.netapps.tests.pyunittests.ethernet_parse_test.testEthernet: Unable to import twisted.trial.reporter. *ImportError: Import by filename is not supported. tests.cc(115): fatal error in nox.netapps.tests.pyunittests.ethernet_parse_test.testEthernetConstruct: Unable to import twisted.trial.reporter. *ImportError: Import by filename is not supported. tests.cc(115): fatal error in nox.netapps.tests.pyunittests.properties_test.store_and_load: Unable to import twisted.trial.reporter. ImportError: Import by filename is not supported. tests.cc(115): fatal error in nox.netapps.tests.pyunittests.directorymanager_test.testDirectoryManagement: Unable to import twisted.trial.reporter. *ImportError: Import by filename is not supported. tests.cc(115): fatal error in nox.netapps.tests.pyunittests.directorymanager_test.testAuthentication: Unable to import twisted.trial.reporter. *ImportError: Import by filename is not supported. tests.cc(115): fatal error in nox.netapps.tests.pyunittests.directorymanager_test.testPrincipals: Unable to import twisted.trial.reporter. ImportError: Import by filename is not supported. tests.cc(115): fatal error in nox.netapps.tests.pyunittests.directorymanager_test.testGroups: Unable to import twisted.trial.reporter. *ImportError: Import by filename is not supported. tests.cc(115): fatal error in nox.netapps.tests.pyunittests.dhcp_parse_test.fullDHCPPacket: Unable to import twisted.trial.reporter. *ImportError: Import by filename is not supported. tests.cc(115): fatal error in nox.netapps.tests.pyunittests.webservice_test.run_test: Unable to import twisted.trial.reporter. ImportError: Import by filename is not supported. tests.cc(115): fatal error in nox.netapps.tests.pyunittests.vlan_parse_test.testVlan: Unable to import twisted.trial.reporter. *ImportError: Import by filename is not supported. tests.cc(115): fatal error in