summaryrefslogtreecommitdiffstats
path: root/test/test_ip4.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_ip4.py')
-rw-r--r--test/test_ip4.py11
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):