on OS X, ntop produces strings like '3ffe:507::1:200:86ff:fe05:80da' while others (NetBSD, Linux) produce '3ffe:507:0:1:200:86ff:fe05:80da'.
RFC 5952 4.2.2. says OS X behaviour is incorrect. (MUST NOT) for longer term, it's probably better to workaround this in addrconv module. Signed-off-by: YAMAMOTO Takashi <[email protected]> --- ryu/tests/unit/packet/test_arp.py | 8 ++++---- ryu/tests/unit/packet/test_ethernet.py | 4 ++-- ryu/tests/unit/packet/test_icmpv6.py | 9 +++++---- ryu/tests/unit/packet/test_ipv4.py | 4 ++-- ryu/tests/unit/packet/test_slow.py | 4 ++-- ryu/tests/unit/packet/test_vrrp.py | 6 +++--- 6 files changed, 18 insertions(+), 17 deletions(-) diff --git a/ryu/tests/unit/packet/test_arp.py b/ryu/tests/unit/packet/test_arp.py index 5f12ae3..c9bf6e2 100644 --- a/ryu/tests/unit/packet/test_arp.py +++ b/ryu/tests/unit/packet/test_arp.py @@ -108,10 +108,10 @@ class Test_arp(unittest.TestCase): eq_(res[2], self.hlen) eq_(res[3], self.plen) eq_(res[4], self.opcode) - eq_(addrconv.mac.bin_to_text(res[5]), self.src_mac) - eq_(addrconv.ipv4.bin_to_text(res[6]), self.src_ip) - eq_(addrconv.mac.bin_to_text(res[7]), self.dst_mac) - eq_(addrconv.ipv4.bin_to_text(res[8]), self.dst_ip) + eq_(res[5], addrconv.mac.text_to_bin(self.src_mac)) + eq_(res[6], addrconv.ipv4.text_to_bin(self.src_ip)) + eq_(res[7], addrconv.mac.text_to_bin(self.dst_mac)) + eq_(res[8], addrconv.ipv4.text_to_bin(self.dst_ip)) def _build_arp(self, vlan_enabled): if vlan_enabled is True: diff --git a/ryu/tests/unit/packet/test_ethernet.py b/ryu/tests/unit/packet/test_ethernet.py index 504a560..151e5c6 100644 --- a/ryu/tests/unit/packet/test_ethernet.py +++ b/ryu/tests/unit/packet/test_ethernet.py @@ -79,8 +79,8 @@ class Test_ethernet(unittest.TestCase): fmt = ethernet._PACK_STR res = struct.unpack(fmt, buf) - eq_(addrconv.mac.bin_to_text(res[0]), self.dst) - eq_(addrconv.mac.bin_to_text(res[1]), self.src) + eq_(res[0], addrconv.mac.text_to_bin(self.dst)) + eq_(res[1], addrconv.mac.text_to_bin(self.src)) eq_(res[2], self.ethertype) @raises(Exception) diff --git a/ryu/tests/unit/packet/test_icmpv6.py b/ryu/tests/unit/packet/test_icmpv6.py index 26b8c89..87e1696 100644 --- a/ryu/tests/unit/packet/test_icmpv6.py +++ b/ryu/tests/unit/packet/test_icmpv6.py @@ -203,7 +203,8 @@ class Test_icmpv6_neighbor_solict(unittest.TestCase): eq_(msg.code, self.code) eq_(msg.csum, self.csum) eq_(msg.data.res >> 29, self.res) - eq_(msg.data.dst, self.dst) + eq_(addrconv.ipv6.text_to_bin(msg.data.dst), + addrconv.ipv6.text_to_bin(self.dst)) eq_(n, None) if data: nd = msg.data @@ -234,7 +235,7 @@ class Test_icmpv6_neighbor_solict(unittest.TestCase): eq_(code, self.code) eq_(csum, nd_csum) eq_(res >> 29, self.res) - eq_(addrconv.ipv6.bin_to_text(dst), self.dst) + eq_(dst, addrconv.ipv6.text_to_bin(self.dst)) eq_(data, '') def test_serialize_with_data(self): @@ -257,10 +258,10 @@ class Test_icmpv6_neighbor_solict(unittest.TestCase): eq_(code, self.code) eq_(csum, nd_csum) eq_(res >> 29, self.res) - eq_(addrconv.ipv6.bin_to_text(dst), self.dst) + eq_(dst, addrconv.ipv6.text_to_bin(self.dst)) eq_(nd_type, self.nd_type) eq_(nd_length, self.nd_length) - eq_(addrconv.mac.bin_to_text(nd_hw_src), self.nd_hw_src) + eq_(nd_hw_src, addrconv.mac.text_to_bin(self.nd_hw_src)) class Test_icmpv6_neighbor_advert(Test_icmpv6_neighbor_solict): diff --git a/ryu/tests/unit/packet/test_ipv4.py b/ryu/tests/unit/packet/test_ipv4.py index 4dbc4f2..d04c426 100644 --- a/ryu/tests/unit/packet/test_ipv4.py +++ b/ryu/tests/unit/packet/test_ipv4.py @@ -118,8 +118,8 @@ class Test_ipv4(unittest.TestCase): eq_(res[4], self.flg_off) eq_(res[5], self.ttl) eq_(res[6], self.proto) - eq_(addrconv.ipv4.bin_to_text(res[8]), self.src) - eq_(addrconv.ipv4.bin_to_text(res[9]), self.dst) + eq_(res[8], addrconv.ipv4.text_to_bin(self.src)) + eq_(res[9], addrconv.ipv4.text_to_bin(self.dst)) eq_(option, self.option) # checksum diff --git a/ryu/tests/unit/packet/test_slow.py b/ryu/tests/unit/packet/test_slow.py index a66e663..c7cd3bd 100644 --- a/ryu/tests/unit/packet/test_slow.py +++ b/ryu/tests/unit/packet/test_slow.py @@ -423,7 +423,7 @@ class Test_lacp(unittest.TestCase): eq_(act_res[0], self.actor_tag) eq_(act_res[1], self.actor_length) eq_(act_res[2], self.actor_system_priority) - eq_(addrconv.mac.bin_to_text(act_res[3]), self.actor_system) + eq_(act_res[3], addrconv.mac.text_to_bin(self.actor_system)) eq_(act_res[4], self.actor_key) eq_(act_res[5], self.actor_port_priority) eq_(act_res[6], self.actor_port) @@ -432,7 +432,7 @@ class Test_lacp(unittest.TestCase): eq_(prt_res[0], self.partner_tag) eq_(prt_res[1], self.partner_length) eq_(prt_res[2], self.partner_system_priority) - eq_(addrconv.mac.bin_to_text(prt_res[3]), self.partner_system) + eq_(prt_res[3], addrconv.mac.text_to_bin(self.partner_system)) eq_(prt_res[4], self.partner_key) eq_(prt_res[5], self.partner_port_priority) eq_(prt_res[6], self.partner_port) diff --git a/ryu/tests/unit/packet/test_vrrp.py b/ryu/tests/unit/packet/test_vrrp.py index 962d56a..13b19ca 100644 --- a/ryu/tests/unit/packet/test_vrrp.py +++ b/ryu/tests/unit/packet/test_vrrp.py @@ -116,7 +116,7 @@ class Test_vrrpv2(unittest.TestCase): eq_(res[4], vrrp.VRRP_AUTH_NO_AUTH) eq_(res[5], max_adver_int) # res[6] is checksum - eq_(addrconv.ipv4.bin_to_text(res[7]), ip_address) + eq_(res[7], addrconv.ipv4.text_to_bin(ip_address)) eq_(res[8], 0) eq_(res[9], 0) eq_(len(buf), pack_len) @@ -258,7 +258,7 @@ class Test_vrrpv3_ipv4(unittest.TestCase): eq_(res[3], len(ip_addresses)) eq_(res[4], max_adver_int) # res[5] is checksum - eq_(addrconv.ipv4.bin_to_text(res[6]), ip_address) + eq_(res[6], addrconv.ipv4.text_to_bin(ip_address)) eq_(len(buf), pack_len) print(res) @@ -403,7 +403,7 @@ class Test_vrrpv3_ipv6(unittest.TestCase): eq_(res[3], len(ip_addresses)) eq_(res[4], max_adver_int) # res[5] is checksum - eq_(addrconv.ipv6.bin_to_text(res[6]), ip_address) + eq_(res[6], addrconv.ipv6.text_to_bin(ip_address)) eq_(len(buf), pack_len) print(res) -- 1.8.1.5 ------------------------------------------------------------------------------ Get your SQL database under version control now! Version control is standard for application code, but databases havent caught up. So what steps can you take to put your SQL databases under version control? Why should you start doing it? Read more to find out. http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk _______________________________________________ Ryu-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ryu-devel
