From: Romain Lenglet <romain.leng...@berabera.info>

The C++ implementation allowed passing the 64-bit opaque cookie with
every flow command, but not the Python wrapper.
---
 src/nox/coreapps/pyrt/context.i |    3 ++-
 src/nox/lib/core.py             |   26 ++++++++++++++++++--------
 2 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/src/nox/coreapps/pyrt/context.i b/src/nox/coreapps/pyrt/context.i
index 803513d..6172a75 100644
--- a/src/nox/coreapps/pyrt/context.i
+++ b/src/nox/coreapps/pyrt/context.i
@@ -96,7 +96,8 @@ public:
     void send_flow_command(uint64_t datapath_id, ofp_flow_mod_command, 
                            const ofp_match&, uint16_t idle_timeout,
                            uint16_t hard_timeout, const Nonowning_buffer& 
actions,
-                           uint32_t buffer_id, uint16_t priority);
+                           uint32_t buffer_id, uint16_t priority,
+                           uint64_t cookie);
 
     int close_openflow_connection(uint64_t datapathid);
 
diff --git a/src/nox/lib/core.py b/src/nox/lib/core.py
index 37bae36..910e5c7 100644
--- a/src/nox/lib/core.py
+++ b/src/nox/lib/core.py
@@ -249,7 +249,8 @@ class Component:
     def send_flow_command(self, dp_id, command, attrs, 
                           priority=openflow.OFP_DEFAULT_PRIORITY,
                           add_args=None,
-                          hard_timeout=openflow.OFP_FLOW_PERMANENT):
+                          hard_timeout=openflow.OFP_FLOW_PERMANENT,
+                          cookie=0):
         m = set_match(attrs)
         if m == None:
             return False
@@ -265,7 +266,8 @@ class Component:
             buffer_id = UINT32_MAX
         
         self.ctxt.send_flow_command(dp_id, command, m, idle_timeout,
-                                    hard_timeout, oactions, buffer_id, 
priority)
+                                    hard_timeout, oactions, buffer_id, 
priority,
+                                    cookie)
 
         return True
 
@@ -294,7 +296,7 @@ class Component:
         else:
             self.send_openflow_packet(dp_id, packet, actions, inport)
 
-    def delete_datapath_flow(self, dp_id, attrs):
+    def delete_datapath_flow(self, dp_id, attrs, cookie=0):
         """
         Delete all flow entries matching the passed in (potentially
         wildcarded) flow
@@ -302,10 +304,12 @@ class Component:
         dp_id - datapath to delete the entries from
         attrs - the flow as a dictionary (described above)
         """
-        return self.send_flow_command(dp_id, openflow.OFPFC_DELETE, attrs)
+        return self.send_flow_command(dp_id, openflow.OFPFC_DELETE, attrs,
+                                      cookie=cookie)
 
     def delete_strict_datapath_flow(self, dp_id, attrs, 
-                        priority=openflow.OFP_DEFAULT_PRIORITY):
+                                    priority=openflow.OFP_DEFAULT_PRIORITY,
+                                    cookie=0):
         """
         Strictly delete the flow entry matching the passed in (potentially
         wildcarded) flow.  i.e. matched flow have exactly the same
@@ -315,9 +319,11 @@ class Component:
         attrs - the flow as a dictionary (described above)
         priority - the priority of the entry to be deleted (only meaningful 
                    for entries with wildcards)
+        cookie - the opaque controller-issued identifier associated with the
+                 flow
         """
         return self.send_flow_command(dp_id, openflow.OFPFC_DELETE_STRICT, 
-                                      attrs, priority)
+                                      attrs, priority, cookie=cookie)
 
     ###########################################################################
     # The following methods manipulate a flow entry in a datapath.
@@ -342,7 +348,7 @@ class Component:
     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):
+                              inport=None, packet=None, cookie=0):
         """
         Add a flow entry to datapath
 
@@ -372,12 +378,16 @@ class Component:
 
         inport - When packet is sent, the port on which packet came in as 
input,
         so that it can be omitted from any OFPP_FLOOD outputs.
+
+        cookie - the opaque controller-issued identifier associated with the
+        flow
         """
         if buffer_id == None:
             buffer_id = UINT32_MAX
 
         self.send_flow_command(dp_id, openflow.OFPFC_ADD, attrs, priority,
-                          (idle_timeout, actions, buffer_id), hard_timeout)
+                               (idle_timeout, actions, buffer_id), 
hard_timeout,
+                               cookie=cookie)
         
         if buffer_id == UINT32_MAX and packet != None:
             for action in actions:
-- 
1.7.2.3


_______________________________________________
nox-dev mailing list
nox-dev@noxrepo.org
http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org

Reply via email to