Signed-off-by: IWASE Yusuke <[email protected]>
---
 ryu/services/protocols/bgp/utils/internable.py | 106 -------------------------
 ryu/services/protocols/bgp/utils/logs.py       |  36 ---------
 ryu/services/protocols/bgp/utils/other.py      |  11 ---
 3 files changed, 153 deletions(-)
 delete mode 100644 ryu/services/protocols/bgp/utils/internable.py
 delete mode 100644 ryu/services/protocols/bgp/utils/logs.py
 delete mode 100644 ryu/services/protocols/bgp/utils/other.py

diff --git a/ryu/services/protocols/bgp/utils/internable.py 
b/ryu/services/protocols/bgp/utils/internable.py
deleted file mode 100644
index 2029bf0..0000000
--- a/ryu/services/protocols/bgp/utils/internable.py
+++ /dev/null
@@ -1,106 +0,0 @@
-# Copyright (C) 2014 Nippon Telegraph and Telephone Corporation.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#    http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import weakref
-
-
-#
-# Internable
-#
-class Internable(object):
-    """Class that allows instances to be 'interned'. That is, given an
-    instance of this class, one can obtain a canonical (interned)
-    copy.
-
-    This saves memory when there are likely to be many identical
-    instances of the class -- users hold references to a single
-    interned object instead of references to different objects that
-    are identical.
-
-    The interned version of a given instance is created on demand if
-    necessary, and automatically cleaned up when nobody holds a
-    reference to it.
-
-    Instances of sub-classes must be usable as dictionary keys for
-    Internable to work.
-    """
-
-    _internable_stats = None
-    _internable_dict = None
-
-    def __init__(self):
-        self._interned = False
-
-    class Stats(object):
-
-        def __init__(self):
-            self.d = {}
-
-        def incr(self, name):
-            self.d[name] = self.d.get(name, 0) + 1
-
-        def __repr__(self):
-            return repr(self.d)
-
-        def __str__(self):
-            return str(self.d)
-
-    @classmethod
-    def _internable_init(cls):
-        # Objects to be interned are held as keys in a dictionary that
-        # only holds weak references to keys. As a result, when the
-        # last reference to an interned object goes away, the object
-        # will be removed from the dictionary.
-        cls._internable_dict = weakref.WeakKeyDictionary()
-        cls._internable_stats = Internable.Stats()
-
-    @classmethod
-    def intern_stats(cls):
-        return cls._internable_stats
-
-    def intern(self):
-        """Returns either itself or a canonical copy of itself."""
-
-        # If this is an interned object, return it
-        if hasattr(self, '_interned'):
-            return self._internable_stats.incr('self')
-
-        #
-        # Got to find or create an interned object identical to this
-        # one. Auto-initialize the class if need be.
-        #
-        cls = self.__class__
-
-        if not cls._internable_dict:
-            cls._internable_init()
-
-        obj = cls._internable_dict.get(self)
-        if (obj):
-            # Found an interned copy.
-            cls._internable_stats.incr('found')
-            return obj
-
-        # Create an interned copy. Take care to only keep a weak
-        # reference to the object itself.
-        def object_collected(obj):
-            cls._internable_stats.incr('collected')
-            # print("Object %s garbage collected" % obj)
-            pass
-
-        ref = weakref.ref(self, object_collected)
-        cls._internable_dict[self] = ref
-        self._interned = True
-        cls._internable_stats.incr('inserted')
-        return self
diff --git a/ryu/services/protocols/bgp/utils/logs.py 
b/ryu/services/protocols/bgp/utils/logs.py
deleted file mode 100644
index aa07d5c..0000000
--- a/ryu/services/protocols/bgp/utils/logs.py
+++ /dev/null
@@ -1,36 +0,0 @@
-import json
-import logging
-import six
-import time
-
-from datetime import datetime
-
-
-class ApgwFormatter(logging.Formatter):
-    LOG_TIME_FORMAT = '%Y-%m-%dT%H:%M:%S.%fZ'
-    COMPONENT_NAME = 'BGPSpeaker'
-
-    def format(self, record):
-        msg = {
-            'component_name': self.COMPONENT_NAME,
-            'timestamp': datetime.utcfromtimestamp(
-                time.time()
-            ).strftime(self.LOG_TIME_FORMAT),
-            'msg': six.text_type(record.msg),
-            'level': record.levelname
-
-        }
-
-        if hasattr(record, 'log_type'):
-            assert record.log_type in ('log', 'stats', 'state')
-            msg['log_type'] = record.log_type
-        else:
-            msg['log_type'] = 'log'
-        if hasattr(record, 'resource_id'):
-            msg['resource_id'] = record.resource_id
-        if hasattr(record, 'resource_name'):
-            msg['resource_name'] = record.resource_name
-
-        record.msg = json.dumps(msg)
-
-        return super(ApgwFormatter, self).format(record)
diff --git a/ryu/services/protocols/bgp/utils/other.py 
b/ryu/services/protocols/bgp/utils/other.py
deleted file mode 100644
index 94f849a..0000000
--- a/ryu/services/protocols/bgp/utils/other.py
+++ /dev/null
@@ -1,11 +0,0 @@
-def bytes2hex(given_bytes):
-    return ''.join(["%02X " % ord(x) for x in given_bytes]).strip()
-
-
-def hex2byte(given_hex):
-    given_hex = ''.join(given_hex.split())
-    result = []
-    for offset in range(0, len(given_hex), 2):
-        result.append(chr(int(given_hex[offset:offset + 2], 16)))
-
-    return ''.join(result)
-- 
2.7.4


------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to