Dear,
My Friend is facing difficulties to perform a route deletion using Ryu and
REST API. So, I'm here to show you the following message from him. Could
someone help with this case? I'll be very thankfull.
"Hi friends!
I'm trying to delete a route from inside a python program *extract.py*,
using the simple topology: h1-s1.
*extract.py* extends *wflow.py*, and this one is a version from the
*rest_router.py* and *simple_monitor.py* with some modifications.
I am using this code to delete a route:
*print(">>>>>>>>>>>>>> EXTRACT.PY", stat.duration_sec)*
* if stat.duration_sec == 120:*
* print("changing routes....")*
* url = 'http://localhost:8080/router/0000000000000001
<http://localhost:8080/router/0000000000000001>'*
* payload = '{"route_id": "2"}'*
* res = requests.delete(url, data=payload)*
But it's not working. The messages that I receive are:
*('>>>>>>>>>>>>>> EXTRACT.PY', 120)*
*changing routes....*
*Starting new HTTP connection (1): localhost*
After a few seconds I receive:
*(31783) accepted ('127.0.0.1', 55789)*
*Setting read timeout to None*
*127.0.0.1 - - [20/Jun/2018 01:26:39] "DELETE /router/0000000000000001
HTTP/1.1" 200 218 1.001163*
*"DELETE /router/0000000000000001 HTTP/1.1" 200 109*
*('>>>>>>>>>>>>>> EXTRACT.PY', 12090)*
*changing routes....*
*Starting new HTTP connection (1): localhost*
After a more few seconds I receive:
*Setting read timeout to None*
*(31783) accepted ('127.0.0.1', 55790)*
*127.0.0.1 - - [20/Jun/2018 01:27:10] "DELETE /router/0000000000000001
HTTP/1.1" 200 218 1.000890*
*"DELETE /router/0000000000000001 HTTP/1.1" 200 109*
And then:
*Logged from file wflow.py, line 77*
*SimpleMonitor13: Exception occurred during handler processing. Backtrace
from offending handler [_flow_stats_reply_handler] servicing event
[EventOFPFlowStatsReply] follows.*
*Traceback (most recent call last):*
* File "/usr/local/lib/python2.7/dist-packages/ryu/base/app_manager.py",
line 290, in _event_loop*
* handler(ev)*
* File "/home/wilson_siqueira/8-berrondo/wflow.py", line 81, in
_flow_stats_reply_handler*
* key=lambda flow: (flow.match['in_port'],*
* File "/home/wilson_siqueira/8-berrondo/wflow.py", line 81, in <lambda>*
* key=lambda flow: (flow.match['in_port'],*
* File
"/usr/local/lib/python2.7/dist-packages/ryu/ofproto/ofproto_v1_3_parser.py",
line 857, in __getitem__*
* return dict(self._fields2)[key]*
*KeyError: 'in_port'*
The switch was configured with the script below when I start the controller
from the first time:
curl -X POST -d '{"address": "10.0.0.2/8"}' http://localhost:8080/router/
0000000000000001
curl -X POST -d '{"destination": "20.0.0.0/8", "gateway": "10.0.0.1"}'
http://localhost:8080/router/0000000000000001
curl -X POST -d '{"destination": "30.0.0.0/8", "gateway": "10.0.0.1"}'
http://localhost:8080/router/0000000000000001
When I delete the route manualy it works.
I don't face the problem when I POST the routes from inside this same
program (extract.py) with the command below:
*url = 'http://localhost:8080/router/0000000000000001
<http://localhost:8080/router/0000000000000001>'*
* payload = '{"destination": "40.0.0.0/8 <http://40.0.0.0/8>",
"gateway": "10.0.0.1"}'*
* res = requests.post(url, data=payload)*
It seems that the controller looses its configuration when I try to delete
a route. "Data is nothing" was one of the messages that I saw when I used
pdb to trace the problem.
So what I have to do to delete a route from a python program?"
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel