I might be missing something here, but this (correct?) code:

    msg = nx.nx_flow_mod()
    action = nx.nx_reg_load()
    action.dst = nx.NXM_NX_REG0
    action.nbits = 32
    action.value = 0xdeadbeef
    msg.actions.append(action)
    connection.send(msg)

gives me this error:

    ERROR:core:Exception while handling OpenFlowNexus!ConnectionUp...
    Traceback (most recent call last):
      File "/src/pox/pox/lib/revent/revent.py", line 234, in raiseEventNoErrors
        return self.raiseEvent(event, *args, **kw)
      File "/src/pox/pox/lib/revent/revent.py", line 281, in raiseEvent
        rv = event._invoke(handler, *args, **kw)
      File "/src/pox/pox/lib/revent/revent.py", line 159, in _invoke
        return handler(self, *args, **kw)
      File "/src/pox/ext/werk.py", line 68, in start_switch
        SwitchWerker(event.connection)
      File "/src/pox/ext/werk.py", line 27, in __init__
        connection.send(msg)
      File "/src/pox/pox/openflow/of_01.py", line 687, in send
        data = data.pack()
      File "/src/pox/pox/openflow/nicira.py", line 403, in pack
        packed += i.pack()
      File "/src/pox/pox/openflow/libopenflow_01.py", line 1958, in pack
        body = self._pack_body()
      File "/src/pox/pox/openflow/nicira.py", line 510, in _pack_body
        dst = o.pack(omittable=False)[:4]
      File "/src/pox/pox/openflow/nicira.py", line 911, in pack
        r += value
    TypeError: cannot concatenate 'str' and 'NoneType' objects

without this patch:

Signed-off-by: Saul St. John <[email protected]>
---
 pox/openflow/nicira.py |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/pox/openflow/nicira.py b/pox/openflow/nicira.py
index 35499a3..8c86206 100644
--- a/pox/openflow/nicira.py
+++ b/pox/openflow/nicira.py
@@ -905,10 +905,11 @@ class nxm_entry (object):
     r = struct.pack("!L", h)
 
     value = self._value
-    assert value is not None
-    assert len(value) == self._nxm_length, "value is wrong length"
 
-    r += value
+    if value is not None:
+        assert len(value) == self._nxm_length, "value is wrong length"
+        r += value
+    
     if mask is not None:
       assert 0 == sum(ord(v)&(0xff&~ord(m)) for v,m in zip(value,mask)), \
              "nonzero masked bits"
-- 
1.7.10.4

Reply via email to