>From 448ebe99e9dc42f62bc1cc9b2e49228c9a2b6a61 Mon Sep 17 00:00:00 2001
From: FUJITA Tomonori <[email protected]>
Date: Mon, 21 Sep 2015 21:18:40 +0900
Subject: [PATCH] bgp: python3 fixes

Signed-off-by: FUJITA Tomonori <[email protected]>
---
 ryu/services/protocols/bgp/base.py             | 2 +-
 ryu/services/protocols/bgp/rtconf/base.py      | 9 +++------
 ryu/services/protocols/bgp/utils/circlist.py   | 2 ++
 ryu/services/protocols/bgp/utils/internable.py | 1 +
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/ryu/services/protocols/bgp/base.py 
b/ryu/services/protocols/bgp/base.py
index aac0fe6..ed662d0 100644
--- a/ryu/services/protocols/bgp/base.py
+++ b/ryu/services/protocols/bgp/base.py
@@ -528,7 +528,7 @@ def validate(**kwargs):
     If name is not provided we use function name as name of the validator.
     """
     def decorator(func):
-        _VALIDATORS[kwargs.pop('name', func.func_name)] = func
+        _VALIDATORS[kwargs.pop('name', func.__name__)] = func
         return func
 
     return decorator
diff --git a/ryu/services/protocols/bgp/rtconf/base.py 
b/ryu/services/protocols/bgp/rtconf/base.py
index 5925e6e..eb19543 100644
--- a/ryu/services/protocols/bgp/rtconf/base.py
+++ b/ryu/services/protocols/bgp/rtconf/base.py
@@ -21,9 +21,6 @@ from abc import abstractmethod
 import numbers
 import logging
 import uuid
-from types import BooleanType
-from types import IntType
-from types import LongType
 
 from ryu.services.protocols.bgp.base import add_bgp_error_metadata
 from ryu.services.protocols.bgp.base import BGPSException
@@ -645,7 +642,7 @@ def validate_cap_rtc_as(rtc_as):
 
 @validate(name=HOLD_TIME)
 def validate_hold_time(hold_time):
-    if ((hold_time is None) or (not isinstance(hold_time, IntType)) or
+    if ((hold_time is None) or (not isinstance(hold_time, int)) or
             hold_time < 10):
         raise ConfigValueError(desc='Invalid hold_time configuration value %s'
                                % hold_time)
@@ -681,7 +678,7 @@ def validate_soo_list(soo_list):
 
 @validate(name=MAX_PREFIXES)
 def validate_max_prefixes(max_prefixes):
-    if not isinstance(max_prefixes, (IntType, LongType)):
+    if not isinstance(max_prefixes, (IntType, long)):
         raise ConfigTypeError(desc='Max. prefixes value should be of type '
                               'int or long but found %s' % type(max_prefixes))
     if max_prefixes < 0:
@@ -692,7 +689,7 @@ def validate_max_prefixes(max_prefixes):
 
 @validate(name=ADVERTISE_PEER_AS)
 def validate_advertise_peer_as(advertise_peer_as):
-    if not isinstance(advertise_peer_as, BooleanType):
+    if not isinstance(advertise_peer_as, bool):
         raise ConfigTypeError(desc='Invalid type for advertise-peer-as, '
                               'expected bool got %s' %
                               type(advertise_peer_as))
diff --git a/ryu/services/protocols/bgp/utils/circlist.py 
b/ryu/services/protocols/bgp/utils/circlist.py
index df92ff7..d22ec21 100644
--- a/ryu/services/protocols/bgp/utils/circlist.py
+++ b/ryu/services/protocols/bgp/utils/circlist.py
@@ -13,6 +13,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from six.moves import intern
+
 
 class CircularListType(object):
     """Instances of this class represent a specific type of list.
diff --git a/ryu/services/protocols/bgp/utils/internable.py 
b/ryu/services/protocols/bgp/utils/internable.py
index ae39798..9f5e8d9 100644
--- a/ryu/services/protocols/bgp/utils/internable.py
+++ b/ryu/services/protocols/bgp/utils/internable.py
@@ -14,6 +14,7 @@
 # limitations under the License.
 
 import weakref
+from six.moves import intern
 
 dict_name = intern('_internable_dict')
 
-- 
1.9.1


------------------------------------------------------------------------------
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to