This patch fixes value error exception.
The datapath-id is given in hex.

> Traceback (most recent call last):
>   File "/usr/lib/python2.7/dist-packages/gevent/pywsgi.py", line 438,
>   in handle_one_response
>     self.run_application()
>   File "/usr/lib/python2.7/dist-packages/gevent/pywsgi.py", line 424,
>   in run_application
>     self.result = self.application(self.environ, self.start_response)
>   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line
>   130, in __call__
>     resp = self.call_func(req, *args, **self.kwargs)
>   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line
>   195, in call_func
>     return self.func(req, *args, **kwargs)
>   File "/opt/stack/ryu/ryu/app/wsgi.py", line 81, in __call__
>     return controller(req)
>   File "/opt/stack/ryu/ryu/app/wsgi.py", line 52, in __call__
>     return getattr(self, action)(req, **kwargs)
>   File "/opt/stack/ryu/ryu/app/rest.py", line 104, in create
>     self.nw.create_port(network_id, int(dpid), int(port_id))
> ValueError: invalid literal for int() with base 10: '0000666a9c296241'

Signed-off-by: Yoshihiro Kaneko <[email protected]>
---
 ryu/app/rest.py |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ryu/app/rest.py b/ryu/app/rest.py
index 19a39dc..aac60f4 100644
--- a/ryu/app/rest.py
+++ b/ryu/app/rest.py
@@ -101,7 +101,7 @@ class PortController(ControllerBase):
 
     def create(self, req, network_id, dpid, port_id, **_kwargs):
         try:
-            self.nw.create_port(network_id, int(dpid), int(port_id))
+            self.nw.create_port(network_id, int(dpid, 16), int(port_id))
         except NetworkNotFound:
             return Response(status=404)
         except PortAlreadyExist:
@@ -111,7 +111,7 @@ class PortController(ControllerBase):
 
     def update(self, req, network_id, dpid, port_id, **_kwargs):
         try:
-            self.nw.update_port(network_id, int(dpid), int(port_id))
+            self.nw.update_port(network_id, int(dpid, 16), int(port_id))
         except NetworkNotFound:
             return Response(status=404)
 
@@ -127,7 +127,7 @@ class PortController(ControllerBase):
 
     def delete(self, req, network_id, dpid, port_id, **_kwargs):
         try:
-            self.nw.remove_port(network_id, int(dpid), int(port_id))
+            self.nw.remove_port(network_id, int(dpid, 16), int(port_id))
         except (NetworkNotFound, PortNotFound):
             return Response(status=404)
 
-- 
1.7.9.5


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to