well, it seems that iv solved the problem. Sorry for bother u guys :(

actions = 
[{'type':'SET_FIELD','field':'eth_dst','value':eth_src},{'type':'OUTPUT','port':in_port}]

the error disappears if i wrote like that. But i'm still not sure whether
it works or not. I'll confirm it when i finished my programming.

2015-01-26 20:00 GMT+08:00 ocean shi <[email protected]>:

> hi, i want to modify the eth_dst but failed.
> Firstly, I wrote one function to add the flow entry( all of the flowing
> codes are used in OF v1.3):
>
> def add_flow_entry(dpid,match,priority,actions):
>     url = "http://127.0.0.1:8080/stats/flowentry/add";
>     post_data = "{'dpid':%s,'match':%s,'priority':%s,'actions':%s}" % 
> (dpid,str(match),priority,str(actions))
>
>     req = urllib2.Request(url,post_data)
>     res = urllib2.urlopen(req)
>     return res.getcode()
>
> and i use the flowing code to call it:
>
> actions = 
> [{'type':'SET_FIELD','eth_dst':eth_src},{'type':'OUTPUT','port':in_port}]
> match = {'eth_type':0x0800, 'ipv4_dst':src_ip}
> priority = "2222"
>
> #I have got the dpid but it's not written here
>
> res = add_flow_entry(dpid,match,priority,actions)
>
>
> Then i got the error informatioin:
>
> Traceback (most recent call last):
>   File "/usr/lib/python2.7/dist-packages/eventlet/wsgi.py", line 384, in 
> handle_one_response
>     result = self.application(self.environ, start_response)
>   File "/usr/local/lib/python2.7/dist-packages/ryu/app/wsgi.py", line 197, in 
> __call__
>     return super(wsgify_hack, self).__call__(environ, start_response)
>   File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
>     resp = self.call_func(req, *args, **self.kwargs)
>   File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
>     return self.func(req, *args, **kwargs)
>   File "/usr/local/lib/python2.7/dist-packages/ryu/app/wsgi.py", line 259, in 
> __call__
>     return controller(req)
>   File "/usr/local/lib/python2.7/dist-packages/ryu/app/wsgi.py", line 121, in 
> __call__
>     return getattr(self, action)(req, **kwargs)
>   File "/home/ocean/KuaiPan/ryu-master/ryu/app/ofctl_rest.py", line 357, in 
> mod_flow_entry
>     ofctl_v1_3.mod_flow_entry(dp, flow, cmd)
>   File "/usr/local/lib/python2.7/dist-packages/ryu/lib/ofctl_v1_3.py", line 
> 942, in mod_flow_entry
>     inst = to_actions(dp, flow.get('actions', []))
>   File "/usr/local/lib/python2.7/dist-packages/ryu/lib/ofctl_v1_3.py", line 
> 108, in to_actions
>     action = to_action(dp, a)
>   File "/usr/local/lib/python2.7/dist-packages/ryu/lib/ofctl_v1_3.py", line 
> 89, in to_action
>     result = parser.OFPActionSetField(**{field: value})
> TypeError: __init__() keywords must be strings
> 127.0.0.1 - - [26/Jan/2015 19:41:17] "POST /stats/flowentry/add HTTP/1.1" 500 
> 1596 0.013896
> EVENT ofp_event->switches EventOFPPacketIn
> EVENT ofp_event->Imisa EventOFPPacketIn
> hub: uncaught exception: Traceback (most recent call last):
>   File "/usr/local/lib/python2.7/dist-packages/ryu/lib/hub.py", line 52, in 
> _launch
>     func(*args, **kwargs)
>   File "/usr/local/lib/python2.7/dist-packages/ryu/base/app_manager.py", line 
> 274, in _event_loop
>     handler(ev)
>   File "/home/ocean/KuaiPan/imisa/imisa.py", line 106, in packet_in_handler
>     res = add_flow_entry(dpid,match,priority,actions)
>   File "/home/ocean/KuaiPan/imisa/restapi.py", line 41, in add_flow_entry
>     res = urllib2.urlopen(req)
>   File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
>     return _opener.open(url, data, timeout)
>   File "/usr/lib/python2.7/urllib2.py", line 410, in open
>     response = meth(req, response)
>   File "/usr/lib/python2.7/urllib2.py", line 523, in http_response
>     'http', request, response, code, msg, hdrs)
>   File "/usr/lib/python2.7/urllib2.py", line 448, in error
>     return self._call_chain(*args)
>   File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
>     result = func(*args)
>   File "/usr/lib/python2.7/urllib2.py", line 531, in http_error_default
>     raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
> HTTPError: HTTP Error 500: Internal Server Error
>
> i'm still working on it but have not find it out yet. Is there anyone met
> this problem before? Thx
>
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to