summaryrefslogtreecommitdiffstats
path: root/test/test_classifier.py
diff options
context:
space:
mode:
authorPaul Vinciguerra <pvinci@vinciconsulting.com>2018-11-25 10:35:29 -0800
committerOle Trøan <otroan@employees.org>2018-11-27 09:01:27 +0000
commit6e4c6ad92e59045f0babf5af5093cb8402ec37fb (patch)
tree59edf45a2f162be15a7603540b399cefa8990670 /test/test_classifier.py
parent6c746172ef2a8ab7b6a267a889fedd1336f00371 (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_classifier.py')
-rw-r--r--test/test_classifier.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/test/test_classifier.py b/test/test_classifier.py
index ade96737e42..f865cb9f6d5 100644
--- a/test/test_classifier.py
+++ b/test/test_classifier.py
@@ -1,9 +1,8 @@
#!/usr/bin/env python
-import unittest
-import socket
import binascii
-import sys
+import socket
+import unittest
from framework import VppTestCase, VppTestRunner
@@ -218,9 +217,9 @@ class TestClassifier(VppTestCase):
:param int dst_port: destination port number "x"
"""
if src_ip:
- src_ip = socket.inet_aton(src_ip).encode('hex')
+ src_ip = binascii.hexlify(socket.inet_aton(src_ip))
if dst_ip:
- dst_ip = socket.inet_aton(dst_ip).encode('hex')
+ dst_ip = binascii.hexlify(socket.inet_aton(dst_ip))
return ('{:0>20}{:0>12}{:0>8}{:0>4}{:0>4}'.format(
hex(proto)[2:], src_ip, dst_ip, hex(src_port)[2:],