On first glance... I think this may be a bug in libopenflow_01.py.  I'm pretty 
surprised it hasn't been noticed until now since it appears to be very old.

Can you try changing libopenflow_01.py around like line 1075 in 
_make_addr()("if (type(ipOrIPAndBits...") from an "if" to an "elif"?

-- Murphy

On Mar 21, 2014, at 1:58 AM, 陳耀庭 <ytche...@cht.com.tw> wrote:

> Hello All,
>  
> I am trying to use POX web service to set a flow rule that matches based on 
> the nw_src and nw_dst fields of the match object.
> I am using an OpenFlow Switch and a POX controller.
> I use the following command to execute POX in Ubuntu.
> ./pox.py  --verbose web.webcore --address='192.168.1.1' --port=5566 
> openflow.webservice
>  
> I use curl to set the flow rule
>  
> curl -i -X POST –d 
> '{"method":"set_table","params":{"dpid":"00-00-00-00-00-01","flows":[{"actions":[{"type":"OFPAT_OUTPUT",
>  "port":1}],"match":{"dl_type":"0x0800","nw_src":"192.168.1.2"}}]}}' 
> http://192.168.1.11:5566/OF/
>  
> Then I get the following error message:
>  
> ERROR:recoco:Exception calling <bound method OFSetTableRequest._do_init of 
> <pox.openflow.webservice.OFSetTableRequest object at 0xa207c4c>>
> Traceback (most recent call last):
>   File "/home/routeflow/pox/pox/lib/recoco/recoco.py", line 774, in run
>     e[0](*e[1], **e[2])
>   File "/home/routeflow/pox/pox/openflow/webservice.py", line 73, in _do_init
>     self._init(*args, **kw)
>   File "/home/routeflow/pox/pox/openflow/webservice.py", line 164, in _init
>     self._con.send(fm)
>   File "/home/routeflow/pox/pox/openflow/of_01.py", line 692, in send
>     data = data.pack()
>   File "/home/routeflow/pox/pox/openflow/libopenflow_01.py", line 2316, in 
> pack
>     packed += self.match.pack(flow_mod=True)
>   File "/home/routeflow/pox/pox/openflow/libopenflow_01.py", line 1205, in 
> pack
>     packed += struct.pack("!LLHH", check_ip_or_arp(fix(self.nw_src)),
>   File "/home/routeflow/pox/pox/openflow/libopenflow_01.py", line 1203, in fix
>     return addr.toUnsigned()
> AttributeError: 'tuple' object has no attribute 'toUnsigned'
> ERROR:web.jsonrpc:While handling set_table...
> Traceback (most recent call last):
>   File "/home/routeflow/pox/pox/web/jsonrpc.py", line 161, in _handle
>     r = method(*params,**kw)
>   File "/home/routeflow/pox/pox/openflow/webservice.py", line 191, in 
> _exec_set_table
>     return OFSetTableRequest(con, flows).get_response()
>   File "/home/routeflow/pox/pox/openflow/webservice.py", line 84, in 
> get_response
>     raise RuntimeError("Operation timed out")
> RuntimeError: Operation timed out
> DEBUG:web.webcore.server:/OF/:"POST /OF/ HTTP/1.1" 200 -
>  
>  
> How should I set a flow rule using the nw_src or nw_dst field?
>  
> Thanks.
>  
> Timothy

Reply via email to