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 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 Cormier<derek.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 Cormier<derek.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(byte_count_), cookie(cookie_) { }
Flow_removed_event(const datapathid datapath_id_,
@@ -73,6 +74,10 @@ struct Flow_removed_event
uint64_t byte_count;
//Opaque cookie
uint64_t cookie;
+ // Flow's priority
+ uint16_t priority;
+ // Reason for removal (see ofp_flow_removed_reason)
+ uint8_t reason;
const ofp_match* get_flow() const {
return &get_flow_removed()->match;
@@ -94,7 +99,9 @@ Flow_removed_event::Flow_removed_event(datapathid datapath_id_,
: Event(static_get_name()), Ofp_msg_event(&ofr->header, buf),
datapath_id(datapath_id_)
{
- cookie = ntohll(ofr->cookie);
+ priority = ntohs(ofr->priority);
+ reason = ntohs(ofr->reason);
+ cookie = ntohll(ofr->cookie);
duration_sec = ntohl(ofr->duration_sec);
duration_nsec = ntohl(ofr->duration_nsec);
idle_timeout = ntohs(ofr->idle_timeout);
diff --git a/src/nox/coreapps/pyrt/pyrt.cc b/src/nox/coreapps/pyrt/pyrt.cc
index da43a2b..fbda461 100644
--- a/src/nox/coreapps/pyrt/pyrt.cc
+++ b/src/nox/coreapps/pyrt/pyrt.cc
@@ -294,6 +294,8 @@ static void convert_flow_removed(const Event& e, PyObject* proxy) {
const Flow_removed_event& fre = dynamic_cast<const Flow_removed_event&>(e);
pyglue_setattr_string(proxy, "datapath_id", to_python(fre.cookie));
+ pyglue_setattr_string(proxy, "priority", to_python(fre.priority));
+ pyglue_setattr_string(proxy, "reason", to_python(fre.reason));
pyglue_setattr_string(proxy, "cookie", to_python(fre.cookie));
pyglue_setattr_string(proxy, "duration_sec", to_python(fre.duration_sec));
pyglue_setattr_string(proxy, "duration_nsec", to_python(fre.duration_nsec));
diff --git a/src/nox/lib/core.py b/src/nox/lib/core.py
index a9f48ab..f2bfe16 100644
--- a/src/nox/lib/core.py
+++ b/src/nox/lib/core.py
@@ -473,10 +473,13 @@ class Component:
"""\bref Register a handler for flow removed events.
The handler will be called with:
- handler(dpid, attrs, cookie, dur_sec, dur_nsec, byte_count, packet_count)
+ handler(dpid, attrs, priority, reason, cookie, dur_sec,
+ dur_nsec, byte_count, packet_count)
\note 'dpid' is the datapath id of the switch.
\note 'attrs' is a flow dictionary (see comment above)
+ \note 'priority' is the flow's priority
+ \note 'reason' why the flow was removed (see ofp_flow_removed_reason)
\note 'cookie' is the flow's cookie
\note 'dur_sec' is how long the flow was alive in (s).
\note 'dur_nsec' is how long the flow was alive beyond dur_sec in (ns).
@@ -567,8 +570,8 @@ class Component:
\note 'stats' is a list of dictionaries (one for each port)
\note with the keys:
\note \n
- \note PORT_NO, RX_PACKETS, TX_PACKETS, RX_BYTES, TX_BYTES
- \note RX_DROPPED, TX_DROPPED, RX_ERRORS, TX_ERRORS,
+ \note PORT_NO, RX_PACKETS, TX_PACKETS, RX_BYTES, TX_BYTES
+ \note RX_DROPPED, TX_DROPPED, RX_ERRORS, TX_ERRORS,
\note RX_FRAME_ERR, RX_OVER_ERROR, RX_CRC_ERROR, COLLISIONS
@param handler the handler function
diff --git a/src/nox/lib/util.py b/src/nox/lib/util.py
index eb7b8b4..853aff0 100644
--- a/src/nox/lib/util.py
+++ b/src/nox/lib/util.py
@@ -243,8 +243,9 @@ def gen_flow_mod_callback(handler):
def gen_flow_removed_callback(handler):
def f(event):
- ret = f.cb(event.datapath_id, event.flow, event.cookie, event.duration_sec,
- event.duration_nsec, event.byte_count, event.packet_count)
+ ret = f.cb(event.datapath_id, event.flow, event.priority, event.reason,
+ event.cookie, event.duration_sec, event.duration_nsec,
+ event.byte_count, event.packet_count)
if ret == None:
return CONTINUE
return ret
--
1.7.0.4
_______________________________________________
nox-dev mailing list
nox-dev@noxrepo.org
http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org