diff options
author | Paul Vinciguerra <pvinci@vinciconsulting.com> | 2018-11-25 10:35:29 -0800 |
---|---|---|
committer | Ole Trøan <otroan@employees.org> | 2018-11-27 09:01:27 +0000 |
commit | 6e4c6ad92e59045f0babf5af5093cb8402ec37fb (patch) | |
tree | 59edf45a2f162be15a7603540b399cefa8990670 /test/test_ip4.py | |
parent | 6c746172ef2a8ab7b6a267a889fedd1336f00371 (diff) |
VPP-1508 python3 tests: .encode('hex')
Change to binascii.hexlify() for consistent bahavior.
Change-Id: Ie430cdd1ffeb6510db4aa037546e42d85992093b
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
Diffstat (limited to 'test/test_ip4.py')
-rw-r--r-- | test/test_ip4.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/test/test_ip4.py b/test/test_ip4.py index bd44a0a7fc9..9f2c925ec4d 100644 --- a/test/test_ip4.py +++ b/test/test_ip4.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +import binascii import random import socket import unittest @@ -302,9 +303,8 @@ class TestIPv4FibCrud(VppTestCase): :return list: added ips with 32 prefix """ added_ips = [] - dest_addr = int(socket.inet_pton(socket.AF_INET, - start_dest_addr).encode('hex'), - 16) + dest_addr = int(binascii.hexlify(socket.inet_pton(socket.AF_INET, + start_dest_addr)), 16) dest_addr_len = 32 n_next_hop_addr = socket.inet_pton(socket.AF_INET, next_hop_addr) for _ in range(count): @@ -318,9 +318,8 @@ class TestIPv4FibCrud(VppTestCase): def unconfig_fib_many_to_one(self, start_dest_addr, next_hop_addr, count): removed_ips = [] - dest_addr = int(socket.inet_pton(socket.AF_INET, - start_dest_addr).encode('hex'), - 16) + dest_addr = int(binascii.hexlify(socket.inet_pton(socket.AF_INET, + start_dest_addr)), 16) dest_addr_len = 32 n_next_hop_addr = socket.inet_pton(socket.AF_INET, next_hop_addr) for _ in range(count): |