This is a bug in NOX.  Furthermore, it's a bug in SWIG -- it's lying to
you.  The number of arguments is fine, but the code it generates to
check the types in order to distinguish between the two overloaded
variants of the function doesn't work, and the error message it gives
you as a result is just plain wrong.

Thanks for bringing it up.  I think I may have actually run into this
long ago but never looked into or done anything about it.

I've fixed this in the destiny branch (1df14bf6edbf).  Attached is a
patch for the master branch.

-- Murphy

On Thu, 2010-07-15 at 10:38 -0400, Niky Riga wrote:
> Hi,
> I am running nox_core of version
> 
> NOX 0.8.0~full~beta (nox_core), compiled Jun 21 2010 18:34:36
> Compiled with OpenFlow 0x01
> 
> I have a controller, written in python, that tries to send out a packet 
> on multiple ports of the switch.
> 
> My understanding is that the send_openflow() fxn can take a list of 
> actions, instead of just one but when I try to do that I get an error.
> The code that I am using is :
> 
> for p in ports :
>     if p is not inport :
>         actions.append([openflow.OFPAT_OUTPUT, [0, p]])
> inst.send_openflow(dpid, bufid, buf, actions, inport)
> 
> and the error I get is :
> 
> NotImplementedError: Wrong number of arguments for overloaded function
> 'PyContext_send_openflow_buffer'
> 
> Any idea what I am doing wrong?
> 
> Thanks,
> niky
> 
> _______________________________________________
> nox-dev mailing list
> nox-dev@noxrepo.org
> http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org

diff --git a/src/nox/coreapps/pyrt/context.i b/src/nox/coreapps/pyrt/context.i
index 13c9e7c..e9f3af1 100644
--- a/src/nox/coreapps/pyrt/context.i
+++ b/src/nox/coreapps/pyrt/context.i
@@ -44,12 +44,18 @@ namespace vigil {
 namespace applications {
 
 class PyContext {
+    %rename(send_openflow_buffer_port) send_openflow_buffer(
+            uint64_t datapath_id, uint32_t buffer_id,
+            uint16_t out_port, uint16_t in_port);
+    %rename(send_openflow_buffer_acts) send_openflow_buffer(
+            uint64_t datapath_id, uint32_t buffer_id,
+            const Nonowning_buffer& actions, uint16_t in_port);
     %rename(send_openflow_packet_port) send_openflow_packet(
             uint64_t datapath_id, const Nonowning_buffer&, 
             uint16_t out_port, uint16_t in_port);
     %rename(send_openflow_packet_acts) send_openflow_packet(
             uint64_t datapath_id, const Nonowning_buffer&,
-            const Nonowning_buffer&, uint16_t in_port);
+            const Nonowning_buffer& actions, uint16_t in_port);
 public:
     /*
      * Resolves a component interface description into a component
diff --git a/src/nox/lib/core.py b/src/nox/lib/core.py
index c83a8d4..30a2040 100644
--- a/src/nox/lib/core.py
+++ b/src/nox/lib/core.py
@@ -228,12 +228,14 @@ class Component:
         inport - dp port to mark as source (defaults to Controller port)
         """
         if type(actions) == types.IntType:
-            self.ctxt.send_openflow_buffer(dp_id, buffer_id, actions, inport)
+            self.ctxt.send_openflow_buffer_port(dp_id, buffer_id, actions,
+                                                inport)
         elif type(actions) == types.ListType:
             oactions = self.make_action_array(actions)
             if oactions == None:
                 raise Exception('Bad action')
-            self.ctxt.send_openflow_buffer(dp_id, buffer_id, oactions, inport)
+            self.ctxt.send_openflow_buffer_acts(dp_id, buffer_id, oactions,
+                                                inport)
         else:
             raise Exception('Bad argument')
 
_______________________________________________
nox-dev mailing list
nox-dev@noxrepo.org
http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org

Reply via email to