2015-06-20 0:10 GMT+09:00 IWAMOTO Toshihiro <[email protected]>:
> Generated by runnig "2to3 -f imports".
>
> Signed-off-by: IWAMOTO Toshihiro <[email protected]>
> ---
> ryu/app/client.py | 22
> +++++++++++-----------
> ryu/app/rest_conf_switch.py | 10 +++++-----
> .../commands/show/route_formatter_mixin.py | 4 ++--
> 3 files changed, 18 insertions(+), 18 deletions(-)
>
> diff --git a/ryu/app/client.py b/ryu/app/client.py
> index 7e8b90f..e14b312 100644
> --- a/ryu/app/client.py
> +++ b/ryu/app/client.py
> @@ -18,9 +18,9 @@
> # This module is *not* used by ryu-manager.
> # Imported and used by OpenStack Ryu plug-in and agent.
>
> -import httplib
> +import http.client
> import json
> -import urlparse
> +import urllib.parse
>
http.client and urllib.parse exist in only python3. Does ryu drop support
python2?
>
> def ignore_http_not_found(func):
> @@ -30,9 +30,9 @@ def ignore_http_not_found(func):
> """
> try:
> func()
> - except httplib.HTTPException as e:
> + except http.client.HTTPException as e:
> res = e.args[0]
> - if res.status != httplib.NOT_FOUND:
> + if res.status != http.client.NOT_FOUND:
> raise
>
>
> @@ -40,13 +40,13 @@ class RyuClientBase(object):
> def __init__(self, version, address):
> super(RyuClientBase, self).__init__()
> self.version = version
> - res = urlparse.SplitResult('', address, '', '', '')
> + res = urllib.parse.SplitResult('', address, '', '', '')
> self.host = res.hostname
> self.port = res.port
> self.url_prefix = '/' + self.version + '/'
>
> def _do_request(self, method, action, body=None):
> - conn = httplib.HTTPConnection(self.host, self.port)
> + conn = http.client.HTTPConnection(self.host, self.port)
> url = self.url_prefix + action
> headers = {}
> if body is not None:
> @@ -54,13 +54,13 @@ class RyuClientBase(object):
> headers['Content-Type'] = 'application/json'
> conn.request(method, url, body, headers)
> res = conn.getresponse()
> - if res.status in (httplib.OK,
> - httplib.CREATED,
> - httplib.ACCEPTED,
> - httplib.NO_CONTENT):
> + if res.status in (http.client.OK,
> + http.client.CREATED,
> + http.client.ACCEPTED,
> + http.client.NO_CONTENT):
> return res
>
> - raise httplib.HTTPException(
> + raise http.client.HTTPException(
> res, 'code %d reason %s' % (res.status, res.reason),
> res.getheaders(), res.read())
>
> diff --git a/ryu/app/rest_conf_switch.py b/ryu/app/rest_conf_switch.py
> index 62b791c..011a407 100644
> --- a/ryu/app/rest_conf_switch.py
> +++ b/ryu/app/rest_conf_switch.py
> @@ -21,7 +21,7 @@ This module provides a set of REST API for switch
> configuration.
> Used by OpenStack Ryu agent.
> """
>
> -import httplib
> +import http.client
> import json
> import logging
> from webob import Response
> @@ -72,7 +72,7 @@ class ConfSwitchController(ControllerBase):
> try:
> ret = func(dpid)
> except KeyError:
> - return Response(status=httplib.NOT_FOUND,
> + return Response(status=http.client.NOT_FOUND,
> body='no dpid is found %s' %
> dpid_lib.dpid_to_str(dpid))
>
> @@ -84,7 +84,7 @@ class ConfSwitchController(ControllerBase):
> return None
>
> def _ret(_ret):
> - return Response(status=httplib.ACCEPTED)
> + return Response(status=http.client.ACCEPTED)
>
> return self._do_switch(dpid, _delete_switch, _ret)
>
> @@ -104,7 +104,7 @@ class ConfSwitchController(ControllerBase):
> try:
> ret = func(dpid, key)
> except KeyError:
> - return Response(status=httplib.NOT_FOUND,
> + return Response(status=http.client.NOT_FOUND,
> body='no dpid/key is found %s %s' %
> (dpid_lib.dpid_to_str(dpid), key))
> return ret_func(ret)
> @@ -116,7 +116,7 @@ class ConfSwitchController(ControllerBase):
> return None
>
> def _ret(_ret):
> - return Response(status=httplib.CREATED)
> + return Response(status=http.client.CREATED)
>
> return self._do_key(dpid, key, _set_val, _ret)
>
> diff --git
> a/ryu/services/protocols/bgp/operator/commands/show/route_formatter_mixin.py
> b/ryu/services/protocols/bgp/operator/commands/show/route_formatter_mixin.py
> index b40b199..78b2fb3 100644
> ---
> a/ryu/services/protocols/bgp/operator/commands/show/route_formatter_mixin.py
> +++
> b/ryu/services/protocols/bgp/operator/commands/show/route_formatter_mixin.py
> @@ -1,4 +1,4 @@
> -import StringIO
> +import io
>
>
> class RouteFormatterMixin(object):
> @@ -17,7 +17,7 @@ class RouteFormatterMixin(object):
>
> @classmethod
> def _format_family(cls, dest_list):
> - msg = StringIO.StringIO()
> + msg = io.StringIO()
>
> def _append_path_info(buff, path, is_best, show_prefix):
> aspath = path.get('aspath')
> --
> 2.1.4
>
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Ryu-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>
--
Satoshi KOBAYASHI <[email protected]>
------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors
network devices and physical & virtual servers, alerts via email & sms
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel