At Thu,  2 Jun 2016 16:17:02 +0900,
IWASE Yusuke wrote:
> 
> Signed-off-by: IWASE Yusuke <[email protected]>
> ---
>  ryu/controller/controller.py              |  2 --
>  ryu/services/protocols/bgp/speaker.py     |  2 +-
>  ryu/services/protocols/bgp/utils/other.py | 12 +++++-------
>  3 files changed, 6 insertions(+), 10 deletions(-)

> diff --git a/ryu/services/protocols/bgp/utils/other.py 
> b/ryu/services/protocols/bgp/utils/other.py
> index 94f849a..c8410e8 100644
> --- a/ryu/services/protocols/bgp/utils/other.py
> +++ b/ryu/services/protocols/bgp/utils/other.py

This file no longer seems to be used.
I guess it's better to simply delete this.

> @@ -1,11 +1,9 @@
> +import six
> +
> +
>  def bytes2hex(given_bytes):
> -    return ''.join(["%02X " % ord(x) for x in given_bytes]).strip()
> +    return ' '.join('%02X' % b for b in bytearray(given_bytes))

FYI, six.indexbytes could be used without converting to bytearray in
this case.

>  
>  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)
> +    return b''.join([six.int2byte(int(c, 16)) for c in given_hex.split()])
> -- 
> 2.7.4

--
IWAMOTO Toshihiro

------------------------------------------------------------------------------
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