Signed-off-by: IWAMOTO Toshihiro <[email protected]>
---
 ryu/lib/packet/bgp.py                                       | 4 ++--
 ryu/lib/packet/icmpv6.py                                    | 6 +++---
 ryu/lib/packet/igmp.py                                      | 2 +-
 ryu/lib/packet/ipv6.py                                      | 2 +-
 ryu/lib/packet/vrrp.py                                      | 4 ++--
 ryu/ofproto/nx_match.py                                     | 2 +-
 ryu/ofproto/ofproto_v1_0_parser.py                          | 2 +-
 ryu/ofproto/ofproto_v1_2.py                                 | 2 +-
 ryu/ofproto/ofproto_v1_3.py                                 | 2 +-
 ryu/ofproto/ofproto_v1_4.py                                 | 2 +-
 ryu/ofproto/ofproto_v1_5.py                                 | 2 +-
 ryu/services/protocols/bgp/operator/commands/show/memory.py | 4 ++--
 ryu/services/protocols/bgp/speaker.py                       | 2 +-
 ryu/services/protocols/vrrp/sample_router.py                | 4 ++--
 ryu/tests/unit/ofproto/test_parser_v12.py                   | 6 +++---
 ryu/tests/unit/ofproto/test_parser_v13.py                   | 4 ++--
 ryu/tests/unit/packet/test_igmp.py                          | 8 ++++----
 ryu/utils.py                                                | 2 +-
 18 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/ryu/lib/packet/bgp.py b/ryu/lib/packet/bgp.py
index cc95ce1..17f8e8f 100644
--- a/ryu/lib/packet/bgp.py
+++ b/ryu/lib/packet/bgp.py
@@ -735,14 +735,14 @@ class _AddrPrefix(StringifyMixin):
     def parser(cls, buf):
         (length, ) = struct.unpack_from(cls._PACK_STR, buf)
         rest = buf[struct.calcsize(cls._PACK_STR):]
-        byte_length = (length + 7) / 8
+        byte_length = (length + 7) // 8
         addr = cls._from_bin(rest[:byte_length])
         rest = rest[byte_length:]
         return cls(length=length, addr=addr), rest
 
     def serialize(self):
         # fixup
-        byte_length = (self.length + 7) / 8
+        byte_length = (self.length + 7) // 8
         bin_addr = self._to_bin(self.addr)
         if (self.length % 8) == 0:
             bin_addr = bin_addr[:byte_length]
diff --git a/ryu/lib/packet/icmpv6.py b/ryu/lib/packet/icmpv6.py
index c36ad04..9b0f2d9 100644
--- a/ryu/lib/packet/icmpv6.py
+++ b/ryu/lib/packet/icmpv6.py
@@ -449,7 +449,7 @@ class nd_option_la(nd_option):
         if mod:
             buf.extend(bytearray(8 - mod))
         if 0 == self.length:
-            self.length = len(buf) / 8
+            self.length = len(buf) // 8
             struct.pack_into('!B', buf, 1, self.length)
         return str(buf)
 
@@ -607,7 +607,7 @@ class nd_option_pi(nd_option):
             res1, self.val_l, self.pre_l, self.res2,
             addrconv.ipv6.text_to_bin(self.prefix)))
         if 0 == self.length:
-            self.length = len(hdr) / 8
+            self.length = len(hdr) // 8
             struct.pack_into('!B', hdr, 1, self.length)
         return str(hdr)
 
@@ -933,7 +933,7 @@ class mldv2_report_group(stringify.StringifyMixin):
                 self.aux = str(self.aux)
             buf.extend(self.aux)
             if 0 == self.aux_len:
-                self.aux_len = len(self.aux) / 4
+                self.aux_len = len(self.aux) // 4
                 struct.pack_into('!B', buf, 1, self.aux_len)
         return str(buf)
 
diff --git a/ryu/lib/packet/igmp.py b/ryu/lib/packet/igmp.py
index 1e4f2b9..f819fa6 100644
--- a/ryu/lib/packet/igmp.py
+++ b/ryu/lib/packet/igmp.py
@@ -460,7 +460,7 @@ class igmpv3_report_group(stringify.StringifyMixin):
                 self.aux = str(self.aux)
             buf.extend(self.aux)
             if 0 == self.aux_len:
-                self.aux_len = len(self.aux) / 4
+                self.aux_len = len(self.aux) // 4
                 struct.pack_into('!B', buf, 1, self.aux_len)
         return str(buf)
 
diff --git a/ryu/lib/packet/ipv6.py b/ryu/lib/packet/ipv6.py
index 54f51e8..463e491 100644
--- a/ryu/lib/packet/ipv6.py
+++ b/ryu/lib/packet/ipv6.py
@@ -462,7 +462,7 @@ class routing_type3(header):
     def serialize(self):
         if self.size == 0:
             self.size = ((len(self.adrs) - 1) * (16 - self.cmpi) +
-                         (16 - self.cmpe) + self._pad) / 8
+                         (16 - self.cmpe) + self._pad) // 8
         buf = struct.pack(self._PACK_STR, self.nxt, self.size,
                           self.type_, self.seg, (self.cmpi << 4) | self.cmpe,
                           self._pad << 4)
diff --git a/ryu/lib/packet/vrrp.py b/ryu/lib/packet/vrrp.py
index 699efa0..b840cd6 100644
--- a/ryu/lib/packet/vrrp.py
+++ b/ryu/lib/packet/vrrp.py
@@ -355,7 +355,7 @@ class vrrp(packet_base.PacketBase):
                            inet.IPPROTO_VRRP, VRRP_IPV6_HOP_LIMIT,
                            primary_ip_address, VRRP_IPV6_DST_ADDRESS)
         else:
-            header_length = ipv4.ipv4._MIN_LEN / 4      # XXX _MIN_LEN
+            header_length = ipv4.ipv4._MIN_LEN // 4      # XXX _MIN_LEN
             total_length = 0
             tos = 0xc0  # set tos to internetwork control
             identification = self.get_identification()
@@ -574,7 +574,7 @@ class vrrpv3(vrrp):
         max_adver_int &= VRRP_V3_MAX_ADVER_INT_MASK
 
         offset = cls._MIN_LEN
-        address_len = (len(buf) - offset) / count_ip
+        address_len = (len(buf) - offset) // count_ip
         # Address version (IPv4 or IPv6) is determined by network layer
         # header type.
         # Unfortunately it isn't available. Guess it by vrrp packet length.
diff --git a/ryu/ofproto/nx_match.py b/ryu/ofproto/nx_match.py
index 38ce02b..ec74160 100644
--- a/ryu/ofproto/nx_match.py
+++ b/ryu/ofproto/nx_match.py
@@ -1105,7 +1105,7 @@ def nxm_put(buf, offset, header, rule):
 
 
 def round_up(length):
-    return (length + 7) / 8 * 8  # Round up to a multiple of 8
+    return (length + 7) // 8 * 8  # Round up to a multiple of 8
 
 
 class NXMatch(object):
diff --git a/ryu/ofproto/ofproto_v1_0_parser.py 
b/ryu/ofproto/ofproto_v1_0_parser.py
index 2cabc08..df8ded6 100644
--- a/ryu/ofproto/ofproto_v1_0_parser.py
+++ b/ryu/ofproto/ofproto_v1_0_parser.py
@@ -1605,7 +1605,7 @@ class NXTPacketIn(NiciraHeader):
                    - ofproto.NICIRA_HEADER_SIZE)
 
         match = nx_match.NXMatch.parser(buf, offset, match_len)
-        offset += (match_len + 7) / 8 * 8
+        offset += (match_len + 7) // 8 * 8
         frame = buf[offset:]
         if total_len < len(frame):
             frame = frame[:total_len]
diff --git a/ryu/ofproto/ofproto_v1_2.py b/ryu/ofproto/ofproto_v1_2.py
index f5f831d..9f6c26a 100644
--- a/ryu/ofproto/ofproto_v1_2.py
+++ b/ryu/ofproto/ofproto_v1_2.py
@@ -785,7 +785,7 @@ def oxm_tlv_header_extract_hasmask(header):
 
 def oxm_tlv_header_extract_length(header):
     if oxm_tlv_header_extract_hasmask(header):
-        length = (header & 0xff) / 2
+        length = (header & 0xff) // 2
     else:
         length = header & 0xff
     return length
diff --git a/ryu/ofproto/ofproto_v1_3.py b/ryu/ofproto/ofproto_v1_3.py
index f6da98a..a06c305 100644
--- a/ryu/ofproto/ofproto_v1_3.py
+++ b/ryu/ofproto/ofproto_v1_3.py
@@ -1135,7 +1135,7 @@ def oxm_tlv_header_extract_hasmask(header):
 
 def oxm_tlv_header_extract_length(header):
     if oxm_tlv_header_extract_hasmask(header):
-        length = (header & 0xff) / 2
+        length = (header & 0xff) // 2
     else:
         length = header & 0xff
     return length
diff --git a/ryu/ofproto/ofproto_v1_4.py b/ryu/ofproto/ofproto_v1_4.py
index 6542b6f..7fcdf51 100644
--- a/ryu/ofproto/ofproto_v1_4.py
+++ b/ryu/ofproto/ofproto_v1_4.py
@@ -342,7 +342,7 @@ def oxm_tlv_header_extract_hasmask(header):
 
 def oxm_tlv_header_extract_length(header):
     if oxm_tlv_header_extract_hasmask(header):
-        length = (header & 0xff) / 2
+        length = (header & 0xff) // 2
     else:
         length = header & 0xff
     return length
diff --git a/ryu/ofproto/ofproto_v1_5.py b/ryu/ofproto/ofproto_v1_5.py
index 013de33..1ec4b97 100644
--- a/ryu/ofproto/ofproto_v1_5.py
+++ b/ryu/ofproto/ofproto_v1_5.py
@@ -379,7 +379,7 @@ def oxm_tlv_header_extract_hasmask(header):
 
 def oxm_tlv_header_extract_length(header):
     if oxm_tlv_header_extract_hasmask(header):
-        length = (header & 0xff) / 2
+        length = (header & 0xff) // 2
     else:
         length = header & 0xff
     return length
diff --git a/ryu/services/protocols/bgp/operator/commands/show/memory.py 
b/ryu/services/protocols/bgp/operator/commands/show/memory.py
index 97e7573..415d7fc 100644
--- a/ryu/services/protocols/bgp/operator/commands/show/memory.py
+++ b/ryu/services/protocols/bgp/operator/commands/show/memory.py
@@ -41,7 +41,7 @@ class Memory(Command):
 
             # Total size in MB
 
-            total_size = total_size / 1000000
+            total_size = total_size // 1000000
             ret = {
                 'unreachable': unreachable,
                 'total': total_size,
@@ -49,7 +49,7 @@ class Memory(Command):
 
             for class_name, s in size.items():
                 # Calculate size in MB
-                size_mb = s / 1000000
+                size_mb = s // 1000000
                 # We are only interested in class which take-up more than a MB
                 if size_mb > 0:
                     ret['summary'].append(
diff --git a/ryu/services/protocols/bgp/speaker.py 
b/ryu/services/protocols/bgp/speaker.py
index bed6276..71c7ec4 100644
--- a/ryu/services/protocols/bgp/speaker.py
+++ b/ryu/services/protocols/bgp/speaker.py
@@ -508,7 +508,7 @@ class BgpProtocol(Protocol, Activity):
         self._holdtime = neg_timer
         self._keepalive = self._create_timer('Keepalive Timer',
                                              self._send_keepalive)
-        interval = self._holdtime / 3
+        interval = self._holdtime // 3
         self._keepalive.start(interval, now=False)
         # Setup the expire timer.
         self._expiry = self._create_timer('Holdtime Timer', self._expired)
diff --git a/ryu/services/protocols/vrrp/sample_router.py 
b/ryu/services/protocols/vrrp/sample_router.py
index d810acd..8a057c9 100644
--- a/ryu/services/protocols/vrrp/sample_router.py
+++ b/ryu/services/protocols/vrrp/sample_router.py
@@ -377,14 +377,14 @@ class RouterIPV4OpenFlow(RouterIPV4):
     # _ARP_TABLE > _DROP_TABLE
     # to gurantee that responding arp can be disabled
     _ARP_TABLE = 0
-    _ARP_PRIORITY = _DROP_PRIORITY / 2
+    _ARP_PRIORITY = _DROP_PRIORITY // 2
 
     # it must be that
     # _ROUTEING_TABLE < _ARP_TABLE or
     # _ROUTING_TABLE > _ARP_TABLE
     # to gurantee that routing can be disabled
     _ROUTING_TABLE = 0
-    _ROUTING_PRIORITY = _ARP_PRIORITY / 2
+    _ROUTING_PRIORITY = _ARP_PRIORITY // 2
 
     def __init__(self, *args, **kwargs):
         super(RouterIPV4OpenFlow, self).__init__(*args, **kwargs)
diff --git a/ryu/tests/unit/ofproto/test_parser_v12.py 
b/ryu/tests/unit/ofproto/test_parser_v12.py
index bfa2d59..e55f825 100644
--- a/ryu/tests/unit/ofproto/test_parser_v12.py
+++ b/ryu/tests/unit/ofproto/test_parser_v12.py
@@ -6638,10 +6638,10 @@ class TestOFPMatch(unittest.TestCase):
 
         res = list(unpack_from(fmt, str(buf), 0)[3:])
         if type(value) is list:
-            res_value = res[:calcsize(pack_str) / 2]
+            res_value = res[:calcsize(pack_str) // 2]
             eq_(res_value, value)
             if mask:
-                res_mask = res[calcsize(pack_str) / 2:]
+                res_mask = res[calcsize(pack_str) // 2:]
                 eq_(res_mask, mask)
         else:
             res_value = res.pop(0)
@@ -7547,7 +7547,7 @@ class TestOFPMatchField(unittest.TestCase):
         res = OFPMatchField(header)
 
         eq_(res.header, header)
-        eq_(res.n_bytes, (header & 0xff) / 2)
+        eq_(res.n_bytes, (header & 0xff) // 2)
         eq_(res.length, 0)
 
     def test_init_hasmask_false(self):
diff --git a/ryu/tests/unit/ofproto/test_parser_v13.py 
b/ryu/tests/unit/ofproto/test_parser_v13.py
index f3f119a..cc72353 100644
--- a/ryu/tests/unit/ofproto/test_parser_v13.py
+++ b/ryu/tests/unit/ofproto/test_parser_v13.py
@@ -63,10 +63,10 @@ class TestOFPMatch(unittest.TestCase):
 
         res = list(unpack_from(fmt, str(buf), 0)[3:])
         if type(value) is list:
-            res_value = res[:calcsize(pack_str) / 2]
+            res_value = res[:calcsize(pack_str) // 2]
             eq_(res_value, value)
             if mask:
-                res_mask = res[calcsize(pack_str) / 2:]
+                res_mask = res[calcsize(pack_str) // 2:]
                 eq_(res_mask, mask)
         else:
             res_value = res.pop(0)
diff --git a/ryu/tests/unit/packet/test_igmp.py 
b/ryu/tests/unit/packet/test_igmp.py
index 6da5da9..bfb2a10 100644
--- a/ryu/tests/unit/packet/test_igmp.py
+++ b/ryu/tests/unit/packet/test_igmp.py
@@ -738,7 +738,7 @@ class Test_igmpv3_report_group(unittest.TestCase):
 
     def setUp_with_aux(self):
         self.aux = '\x01\x02\x03\x04\x05\x00\x00\x00'
-        self.aux_len = len(self.aux) / 4
+        self.aux_len = len(self.aux) // 4
         self.buf = pack(igmpv3_report_group._PACK_STR, self.type_,
                         self.aux_len, self.num,
                         addrconv.ipv4.text_to_bin(self.address))
@@ -751,7 +751,7 @@ class Test_igmpv3_report_group(unittest.TestCase):
         self.srcs = ['192.168.1.1', '192.168.1.2', '192.168.1.3']
         self.num = len(self.srcs)
         self.aux = '\x01\x02\x03\x04\x05\x00\x00\x00'
-        self.aux_len = len(self.aux) / 4
+        self.aux_len = len(self.aux) // 4
         self.buf = pack(igmpv3_report_group._PACK_STR, self.type_,
                         self.aux_len, self.num,
                         addrconv.ipv4.text_to_bin(self.address))
@@ -936,7 +936,7 @@ class Test_igmpv3_report_group(unittest.TestCase):
     @raises
     def test_aux_len_larger_than_aux(self):
         self.aux = '\x01\x02\x03\x04\x05\x00\x00\x00'
-        self.aux_len = len(self.aux) / 4 + 1
+        self.aux_len = len(self.aux) // 4 + 1
         self.buf = pack(igmpv3_report_group._PACK_STR, self.type_,
                         self.aux_len, self.num,
                         addrconv.ipv4.text_to_bin(self.address))
@@ -949,7 +949,7 @@ class Test_igmpv3_report_group(unittest.TestCase):
     @raises
     def test_aux_len_smaller_than_aux(self):
         self.aux = '\x01\x02\x03\x04\x05\x00\x00\x00'
-        self.aux_len = len(self.aux) / 4 - 1
+        self.aux_len = len(self.aux) // 4 - 1
         self.buf = pack(igmpv3_report_group._PACK_STR, self.type_,
                         self.aux_len, self.num,
                         addrconv.ipv4.text_to_bin(self.address))
diff --git a/ryu/utils.py b/ryu/utils.py
index 76ea189..c4be973 100644
--- a/ryu/utils.py
+++ b/ryu/utils.py
@@ -95,7 +95,7 @@ def import_module(modname):
 
 
 def round_up(x, y):
-    return ((x + y - 1) / y) * y
+    return ((x + y - 1) // y) * y
 
 
 def _str_to_hex(data):
-- 
2.1.4


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

Reply via email to