aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPaul Vinciguerra <pvinci@vinciconsulting.com>2018-11-28 19:06:41 -0800
committerOle Trøan <otroan@employees.org>2018-12-05 12:08:46 +0000
commit661f91fe0a6bd87040408d45d116b63c0811f4f9 (patch)
tree200f7020cc44eb22ad05c477df23ace03bd06a90 /test
parenta6fe463c1cb67a52f06e519a514a47a9b6af8057 (diff)
VPP-1508: Python3 compatible print
Change-Id: I7d2597f2a9589f2463e213da6ca67b1b7593095e Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
Diffstat (limited to 'test')
-rw-r--r--test/test_acl_plugin_macip.py35
-rw-r--r--test/test_flowprobe.py6
-rw-r--r--test/test_p2p_ethernet.py3
-rw-r--r--test/test_srv6.py1
-rw-r--r--test/test_srv6_ad.py1
-rwxr-xr-xtest/test_srv6_as.py1
6 files changed, 23 insertions, 24 deletions
diff --git a/test/test_acl_plugin_macip.py b/test/test_acl_plugin_macip.py
index 951e86af474..4872bffc17d 100644
--- a/test/test_acl_plugin_macip.py
+++ b/test/test_acl_plugin_macip.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+from __future__ import print_function
"""ACL plugin - MACIP tests
"""
import binascii
@@ -167,29 +168,29 @@ class MethodHolder(VppTestCase):
self.logger.info(self.vapi.ppcli("sh acl-plugin acl"))
self.logger.info(self.vapi.ppcli("sh acl-plugin interface"))
self.logger.info(self.vapi.ppcli("sh acl-plugin tables"))
- # print self.vapi.ppcli("show interface address")
- # print self.vapi.ppcli("show hardware")
- # print self.vapi.ppcli("sh acl-plugin macip interface")
- # print self.vapi.ppcli("sh acl-plugin macip acl")
+ # print(self.vapi.ppcli("show interface address"))
+ # print(self.vapi.ppcli("show hardware"))
+ # print(self.vapi.ppcli("sh acl-plugin macip interface"))
+ # print(self.vapi.ppcli("sh acl-plugin macip acl"))
self.delete_acls()
def macip_acl_dump_debug(self):
acls = self.vapi.macip_acl_dump()
if self.DEBUG:
for acl in acls:
- print "ACL #"+str(acl.acl_index)
+ print("ACL #"+str(acl.acl_index))
for r in acl.r:
rule = "ACTION"
if r.is_permit == 1:
rule = "PERMIT"
elif r.is_permit == 0:
rule = "DENY "
- print " IP6" if r.is_ipv6 else " IP4", \
- rule, \
- binascii.hexlify(r.src_mac), \
- binascii.hexlify(r.src_mac_mask),\
- unpack('<16B', r.src_ip_addr), \
- r.src_ip_prefix_len
+ print(" IP6" if r.is_ipv6 else " IP4",
+ rule,
+ binascii.hexlify(r.src_mac),
+ binascii.hexlify(r.src_mac_mask),
+ unpack('<16B', r.src_ip_addr),
+ r.src_ip_prefix_len)
return acls
def create_rules(self, mac_type=EXACT_MAC, ip_type=EXACT_IP,
@@ -569,22 +570,22 @@ class MethodHolder(VppTestCase):
# p_l3 = IPv6 if is_ip6 else IP
# if self.DEBUG:
# for p in stream:
- # print p[Ether].src, p[Ether].dst, p[p_l3].src, p[p_l3].dst
+ # print(p[Ether].src, p[Ether].dst, p[p_l3].src, p[p_l3].dst)
#
# acls = self.macip_acl_dump_debug()
# TODO : verify
# for acl in acls:
# for r in acl.r:
- # print binascii.hexlify(r.src_mac), \
+ # print(binascii.hexlify(r.src_mac), \
# binascii.hexlify(r.src_mac_mask),\
# unpack('<16B', r.src_ip_addr), \
- # r.src_ip_prefix_len
+ # r.src_ip_prefix_len)
#
# for p in capture:
- # print p[Ether].src, p[Ether].dst, p[p_l3].src, p[p_l3].dst
- # data = p[Raw].load.split(':',1)[1]
- # print p[p_l3].src, data
+ # print(p[Ether].src, p[Ether].dst, p[p_l3].src, p[p_l3].dst
+ # data = p[Raw].load.split(':',1)[1])
+ # print(p[p_l3].src, data)
def run_traffic(self, mac_type, ip_type, traffic, is_ip6, packets,
do_not_expected_capture=False, tags=None,
diff --git a/test/test_flowprobe.py b/test/test_flowprobe.py
index d2fd031777c..cd6fd1c1947 100644
--- a/test/test_flowprobe.py
+++ b/test/test_flowprobe.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-
+from __future__ import print_function
import binascii
import random
import socket
@@ -215,11 +215,11 @@ class MethodHolder(VppTestCase):
data_set={1: 'octets', 2: 'packets'},
ip_ver='v4'):
if self.debug_print:
- print capture[0].show()
+ print(capture[0].show())
if cflow.haslayer(Data):
data = decoder.decode_data_set(cflow.getlayer(Set))
if self.debug_print:
- print data
+ print(data)
if ip_ver == 'v4':
ip_layer = capture[0][IP]
else:
diff --git a/test/test_p2p_ethernet.py b/test/test_p2p_ethernet.py
index a4eeee0e47d..f055ffeb521 100644
--- a/test/test_p2p_ethernet.py
+++ b/test/test_p2p_ethernet.py
@@ -82,7 +82,8 @@ class P2PEthernetAPI(VppTestCase):
mactobinary(macs[i-1]),
i)
except Exception:
- print "Failed to create subif %d %s" % (i, macs[i-1])
+ self.logger.info("Failed to create subif %d %s" % (
+ i, macs[i-1]))
raise
intfs = self.vapi.cli("show interface").split("\n")
diff --git a/test/test_srv6.py b/test/test_srv6.py
index 3e5f856316d..47832e28903 100644
--- a/test/test_srv6.py
+++ b/test/test_srv6.py
@@ -2144,7 +2144,6 @@ class TestSRv6(VppTestCase):
compare_func(txed_packet, packet)
except:
- print packet.command()
self.logger.error(ppp("Unexpected or invalid packet:", packet))
raise
diff --git a/test/test_srv6_ad.py b/test/test_srv6_ad.py
index 299f34315e5..6dafa9f6b3f 100644
--- a/test/test_srv6_ad.py
+++ b/test/test_srv6_ad.py
@@ -793,7 +793,6 @@ class TestSRv6(VppTestCase):
compare_func(txed_packet, packet)
except:
- print packet.command()
self.logger.error(ppp("Unexpected or invalid packet:", packet))
raise
diff --git a/test/test_srv6_as.py b/test/test_srv6_as.py
index 0fa838edd10..64ff957da4b 100755
--- a/test/test_srv6_as.py
+++ b/test/test_srv6_as.py
@@ -874,7 +874,6 @@ class TestSRv6(VppTestCase):
compare_func(txed_packet, packet)
except:
- print packet.command()
self.logger.error(ppp("Unexpected or invalid packet:", packet))
raise