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_), +
Re: [nox-dev] Contributing to Nox
Thanks. I pushed this. Regards KK On 12 January 2011 21:40, Derek Cormier derek.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.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 ~~~ ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
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] Contributing to Nox
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 ~~~ ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
Re: [nox-dev] Contributing to Nox
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 Casado cas...@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 ~~~ ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
Re: [nox-dev] Contributing to Nox
Hi All, With Derek's patch, the documentation for destiny branch is more useful for those using Python. Consequently, I have pushed the doxygen documentation for destiny (which include Derek's patch) to replace the one previously generated from zaku. FYI. Regards KK On 11 January 2011 11:43, kk yap yap...@stanford.edu 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 Casado cas...@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 ~~~ ___ 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 +
Re: [nox-dev] Contributing to Nox
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 Cormier 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 Cormier 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 + 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
Re: [nox-dev] Contributing to Nox
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 McCauley 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 Story 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 yap 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 Cormier 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 Cormier 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 + 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