From 81f3704392a5b2e647c24adbbedf570b9a7e04ee Mon Sep 17 00:00:00 2001 From: Alexey Shabalin Date: Tue, 23 Nov 2021 19:31:35 +0300 Subject: [PATCH] Python 3 support --- utilities/ovs-test.in | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/utilities/ovs-test.in b/utilities/ovs-test.in index eb712ffe8..d7621c2c5 100644 --- a/utilities/ovs-test.in +++ b/utilities/ovs-test.in @@ -25,7 +25,7 @@ import socket import subprocess import sys import time -import xmlrpclib +import xmlrpc.client import argparse import twisted @@ -42,7 +42,7 @@ DEFAULT_TEST_TUN = "ovstestport1" def collect_information(node): """Print information about hosts that will do testing""" - print "Node %s:%u " % (node[0], node[1]) + print("Node %s:%u " % (node[0], node[1])) server = util.rpc_client(node[0], node[1]) interface_name = server.get_interface(node[0]) phys_iface = None @@ -50,8 +50,8 @@ def collect_information(node): mtu = 1500 if not interface_name: - print ("Could not find interface that has %s IP address." - "Make sure that you specified correct Outer IP." % (node[0])) + print("Could not find interface that has %s IP address." + "Make sure that you specified correct Outer IP." % (node[0])) else: if server.is_ovs_bridge(interface_name): phys_iface = server.get_iface_from_bridge(interface_name) @@ -62,18 +62,18 @@ def collect_information(node): driver = server.get_driver(phys_iface) mtu = server.get_interface_mtu(phys_iface) - print "Will be using %s (%s) with MTU %u" % (phys_iface, node[0], - mtu) + print("Will be using %s (%s) with MTU %u" % (phys_iface, node[0], + mtu)) if not driver: - print "Unable to get driver information from ethtool." + print("Unable to get driver information from ethtool.") else: - print "On this host %s has %s." % (phys_iface, driver) + print("On this host %s has %s." % (phys_iface, driver)) if not uname: - print "Unable to retrieve kernel information. Is this Linux?" + print("Unable to retrieve kernel information. Is this Linux?") else: - print "Running kernel %s." % uname - print "\n" + print("Running kernel %s." % uname) + print() return mtu @@ -113,29 +113,29 @@ if __name__ == '__main__': tunnel_modes = ovs_args.tunnelModes if direct is not None: - print "Performing direct tests" + print("Performing direct tests") tests.do_direct_tests(node2, node1, bandwidth, interval, ps) if vlan_tag is not None: - print "Performing VLAN tests" + print("Performing VLAN tests") tests.do_vlan_tests(node2, node1, bandwidth, interval, ps, vlan_tag) for tmode in tunnel_modes: - print "Performing", tmode, "tests" + print("Performing", tmode, "tests") tests.do_l3_tests(node2, node1, bandwidth, interval, ps, tmode) except KeyboardInterrupt: pass - except xmlrpclib.Fault: - print "Couldn't establish XMLRPC control channel" + except xmlrpc.client.Fault: + print("Couldn't establish XMLRPC control channel") except socket.error: - print "Couldn't establish XMLRPC control channel" - except xmlrpclib.ProtocolError: - print "XMLRPC control channel was abruptly terminated" + print("Couldn't establish XMLRPC control channel") + except xmlrpc.client.ProtocolError: + print("XMLRPC control channel was abruptly terminated") except twisted.internet.error.CannotListenError: - print "Couldn't start XMLRPC server on port %u" % ovs_args.port + print("Couldn't start XMLRPC server on port %u" % ovs_args.port) finally: if local_server is not None: local_server.terminate() -- 2.33.0