aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/flowprobe/test
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2019-10-21 23:13:46 +0200
committerNeale Ranns <nranns@cisco.com>2019-10-22 07:39:23 +0000
commitb0d83f188dc9a6bb6cdb13e83baa8c345956a9d2 (patch)
tree66cfb496e401c691a9ab6dfb1f6d27a72fe11432 /src/plugins/flowprobe/test
parent98bd35808dfcff6dee22575fcaff3167256c06f5 (diff)
flowprobe: tests support python3
Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I7425147e864467e4f94cee2a82ef74a894339471
Diffstat (limited to 'src/plugins/flowprobe/test')
-rw-r--r--src/plugins/flowprobe/test/test_flowprobe.py20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/plugins/flowprobe/test/test_flowprobe.py b/src/plugins/flowprobe/test/test_flowprobe.py
index 9ffe84b8c2c..307d836e9ed 100644
--- a/src/plugins/flowprobe/test/test_flowprobe.py
+++ b/src/plugins/flowprobe/test/test_flowprobe.py
@@ -18,6 +18,8 @@ from vpp_pg_interface import CaptureTimeoutError
from util import ppp
from ipfix import IPFIX, Set, Template, Data, IPFIXDecoder
from vpp_ip_route import VppIpRoute, VppRoutePath
+from vpp_papi.macaddress import mac_ntop
+from socket import inet_ntop
class VppCFLOW(VppObject):
@@ -438,11 +440,9 @@ class Flowprobe(MethodHolder):
# packets
self.assertEqual(int(binascii.hexlify(record[2]), 16), 1)
# src mac
- self.assertEqual(':'.join(re.findall('..', record[56].encode(
- 'hex'))), self.pg8.local_mac)
+ self.assertEqual(mac_ntop(record[56]), self.pg8.local_mac)
# dst mac
- self.assertEqual(':'.join(re.findall('..', record[80].encode(
- 'hex'))), self.pg8.remote_mac)
+ self.assertEqual(mac_ntop(record[80]), self.pg8.remote_mac)
flowTimestamp = int(binascii.hexlify(record[156]), 16) >> 32
# flow start timestamp
self.assertAlmostEqual(flowTimestamp, nowUNIX, delta=1)
@@ -452,15 +452,11 @@ class Flowprobe(MethodHolder):
# ethernet type
self.assertEqual(int(binascii.hexlify(record[256]), 16), 8)
# src ip
- self.assertEqual('.'.join(re.findall('..', record[8].encode(
- 'hex'))),
- '.'.join('{:02x}'.format(int(n)) for n in
- self.pg7.remote_ip4.split('.')))
+ self.assertEqual(inet_ntop(socket.AF_INET, record[8]),
+ self.pg7.remote_ip4)
# dst ip
- self.assertEqual('.'.join(re.findall('..', record[12].encode(
- 'hex'))),
- '.'.join('{:02x}'.format(int(n)) for n in
- "9.0.0.100".split('.')))
+ self.assertEqual(inet_ntop(socket.AF_INET, record[12]),
+ "9.0.0.100")
# protocol (TCP)
self.assertEqual(int(binascii.hexlify(record[4]), 16), 6)
# src port