[PATCH v2 1/4] Slave: add get_devices_by_params to SlaveMethods
by Jan Tluka
Method get_devices_by_params can be used for more variable queries for
example query by both driver name and hardware address. Basically
everything that provides Device::get_if_data(). Method has one parameter
params that is a dictionary of queried parameter key-values.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
lnst/Slave/NetTestSlave.py | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/lnst/Slave/NetTestSlave.py b/lnst/Slave/NetTestSlave.py
index 775d4a5..23fd009 100644
--- a/lnst/Slave/NetTestSlave.py
+++ b/lnst/Slave/NetTestSlave.py
@@ -154,6 +154,23 @@ class SlaveMethods:
return matched
+ def get_devices_by_params(self, params):
+ devices = self._if_manager.get_devices()
+ matched = []
+ for dev in devices:
+ dev_data = dev.get_if_data()
+ entry = {"name": dev.get_name(),
+ "hwaddr": dev.get_hwaddr()}
+ for key, value in params.iteritems():
+ if key not in dev_data or dev_data[key] != value:
+ entry = None
+ break
+
+ if entry is not None:
+ matched.append(entry)
+
+ return matched
+
def get_if_data(self, if_id):
dev = self._if_manager.get_mapped_device(if_id)
if dev is None:
--
2.1.0
8 years, 8 months
[PATCH] Refactorization of LNST Pool Wizard
by Jiri Prochazka
Removed MessageDispatcherLite.py
lnst-pool-wizard
+ Make pep8 compliant
+ Print error messages on stderr
+ Changes correspoding with Wizard.py refactorization
+ Remove blank line in help
Wizard.py
+ Make pep8 compliant
+ Most of the methods reworked to be more clean and readable
+ Setup for implementation of support for virtual machines
Closes #129
Signed-off-by: Jiri Prochazka <jprochaz(a)redhat.com>
---
lnst-pool-wizard | 55 ++--
lnst/Controller/MessageDispatcherLite.py | 66 -----
lnst/Controller/Wizard.py | 422 +++++++++++++++++++++----------
3 files changed, 332 insertions(+), 211 deletions(-)
delete mode 100644 lnst/Controller/MessageDispatcherLite.py
diff --git a/lnst-pool-wizard b/lnst-pool-wizard
index c788688..d7ad506 100755
--- a/lnst-pool-wizard
+++ b/lnst-pool-wizard
@@ -17,48 +17,67 @@ import getopt
RETVAL_PASS = 0
RETVAL_ERR = 1
-def help(retval = 0):
+
+def help(retval=0):
print "Usage:\n"\
" lnst-pool-wizard [mode] [hostname[:port]]\n"\
"\n"\
"Modes:\n"\
- " -h, --help display this help text and exit\n"\
- " -i, --interactive start wizard in interactive mode (this "\
- "is default mode)\n"\
- " -n, --noninteractive start wizard in noninteractive mode\n"\
+ " -h, --help display this help text and exit\n"\
+ " -p, --pool_dir <directory> set the pool dir (works both in) "\
+ "interactive and noninteractive mode\n"\
+ " -i, --interactive start wizard in interactive mode (this "\
+ "is default mode)\n"\
+ " -n, --noninteractive start wizard in noninteractive mode\n"\
"Examples:\n"\
" lnst-pool-wizard --interactive\n"\
" lnst-pool-wizard --noninteractive 192.168.122.2\n"\
- " lnst-pool-wizard -n 192.168.122.2:8888 192.168.122.3:9999 192.168.122.4\n"
+ " lnst-pool-wizard -n 192.168.122.2:8888 192.168.122.4\n"\
+ " lnst-pool-wizard -p \".pool/\" -n 192.168.1.1:8877 192.168.122.4"
sys.exit(retval)
def main():
try:
opts, args = getopt.getopt(
- sys.argv[1:],
- "hin",
- ["help", "interactive", "noninteractive"]
+ sys.argv[1:],
+ "hinp:",
+ ["help", "interactive", "noninteractive", "pool_dir="]
)
except getopt.GetoptError as err:
- print str(err)
+ sys.stderr.write(str(err))
help(RETVAL_ERR)
- wizard = Wizard()
- for opt, arg in opts:
+
+ pool_dir= None
+ mode = "interactive"
+
+ for opt, arg in opts:
if opt in ("-h", "--help"):
help()
elif opt in ("-i", "--interactive"):
- wizard.interactive()
- sys.exit(RETVAL_PASS)
+ mode = "interactive"
elif opt in ("-n", "--noninteractive"):
if not args:
- print "No hostname entered!"
+ sys.stderr.write("No hostnames entered\n")
return RETVAL_ERR
- wizard.noninteractive(args)
- sys.exit(RETVAL_PASS)
+ else:
+ hostlist = args
+ mode = "noninteractive"
+ elif opt in ("-p", "--pool_dir"):
+ if not arg:
+ sys.stderr.write("No pool directory specified\n")
+ else:
+ pool_dir = arg
else:
help(RETVAL_ERR)
- wizard.interactive()
+
+ w = Wizard()
+
+ if mode == "noninteractive":
+ w.noninteractive(hostlist, pool_dir)
+ else:
+ w.interactive(pool_dir)
+
sys.exit(RETVAL_PASS)
diff --git a/lnst/Controller/MessageDispatcherLite.py b/lnst/Controller/MessageDispatcherLite.py
deleted file mode 100644
index 2973763..0000000
--- a/lnst/Controller/MessageDispatcherLite.py
+++ /dev/null
@@ -1,66 +0,0 @@
-"""
-This module defines MessageDispatcherLite class which is derived from
-lnst.NetTestController.MessageDispatcher.
-
-Copyright 2011 Red Hat, Inc.
-Licensed under the GNU General Public License, version 2 as
-published by the Free Software Foundation; see COPYING for details.
-"""
-
-__author__ = """
-jpirko(a)redhat.com (Jiri Pirko)
-"""
-
-from lnst.Common.ConnectionHandler import send_data
-from lnst.Common.ConnectionHandler import ConnectionHandler
-from lnst.Controller.NetTestController import NetTestError
-
-class MessageDispatcherLite(ConnectionHandler):
- def __init__(self):
- super(MessageDispatcherLite, self).__init__()
-
- def add_slave(self, machine, connection):
- self.add_connection(1, connection)
-
- def send_message(self, machine_id, data):
- soc = self.get_connection(1)
-
- if send_data(soc, data) == False:
- msg = "Connection error from slave %s" % str(1)
- raise NetTestError(msg)
-
- def wait_for_result(self, machine_id):
- wait = True
- while wait:
- connected_slaves = self._connection_mapping.keys()
-
- messages = self.check_connections()
-
- remaining_slaves = self._connection_mapping.keys()
-
- for msg in messages:
- if msg[1]["type"] == "result" and msg[0] == 1:
- wait = False
- result = msg[1]["result"]
- else:
- self._process_message(msg)
-
- if connected_slaves != remaining_slaves:
- disconnected_slaves = set(connected_slaves) -\
- set(remaining_slaves)
- msg = "Slaves " + str(list(disconnected_slaves)) + \
- " disconnected from the controller."
- raise NetTestError(msg)
-
- return result
-
- def _process_message(self, message):
- if message[1]["type"] == "log":
- pass
- else:
- msg = "Unknown message type: %s" % message[1]["type"]
- raise NetTestError(msg)
-
- def disconnect_slave(self, machine_id):
- soc = self.get_connection(machine_id)
- self.remove_connection(soc)
diff --git a/lnst/Controller/Wizard.py b/lnst/Controller/Wizard.py
index c38aae5..e4ddc54 100644
--- a/lnst/Controller/Wizard.py
+++ b/lnst/Controller/Wizard.py
@@ -1,7 +1,7 @@
"""
-Wizard class for creating machine pool .xml files
+Wizard class for creating slave machine config files
-Copyright 2014 Red Hat Inc.
+Copyright 2015 Red Hat Inc.
Licensed under the GNU General Public Licence, version 2 as
published by the Free Software Foundation; see COPYING for details.
"""
@@ -9,150 +9,196 @@ published by the Free Software Foundation; see COPYING for details.
__author__ = """
jprochaz(a)redhat.com (Jiri Prochazka)
"""
+
import socket
import sys
+import time
import os
-from lnst.Controller.Machine import Machine
-from lnst.Controller.MessageDispatcherLite import MessageDispatcherLite
-from lnst.Common.NetUtils import test_tcp_connection
from lnst.Common.Utils import mkdir_p
from lnst.Common.Config import DefaultRPCPort
+from lnst.Common.ConnectionHandler import send_data, recv_data
from xml.dom.minidom import getDOMImplementation
+DefaultPoolDir = os.path.expanduser("~/.lnst/pool/")
+PATH_IS_DIR_ACCESSIBLE = 0
+PATH_IS_DIR_NOT_ACCESSIBLE = 1
+PATH_DOES_NOT_EXIST = 2
+PATH_NOT_DIR = 3
+
+
class Wizard:
- def __init__(self):
- self._msg_dispatcher = MessageDispatcherLite()
- self._pool_dir = os.path.expanduser("~/.lnst/pool")
- def interactive(self):
+ def interactive(self, pool_dir=None):
+ """ Starts Wizard in an interactive mode
+ @param pool_dir Path to pool directory (optional)
"""
- Starts Wizard in interactive mode. Wizard requests hostname and port
- from user, tests connectivity to entered host, then he tries to connect
- and configure slave on host machine, and finally he requests list of
- ethernet interfaces in state DOWN. Then he writes them into .xml file
- named by user. User can choose which interfaces should be added to the
- .xml file.
- """
-
- pool_dir = raw_input("Enter path to pool directory "\
- "(default: ~/.lnst/pool): ")
- if pool_dir != "":
- self._pool_dir = os.path.expanduser(pool_dir)
- print "Pool directory set to %s" % self._pool_dir
+ if pool_dir is None:
+ pool_dir = self._query_pool_dir()
+ else:
+ rv = self._check_path(pool_dir)
+ if rv == PATH_IS_DIR_ACCESSIBLE:
+ print("Pool directory set to '%s'" % pool_dir)
+ elif rv == PATH_DOES_NOT_EXIST:
+ sys.stderr.write("Path '%s' does not exist\n" % pool_dir)
+ pool_dir = self._query_pool_dir()
+ elif rv == PATH_NOT_DIR:
+ sys.stderr.write("Path '%s' exists but is not a directory\n"
+ % pool_dir)
+ pool_dir = self._query_pool_dir()
+ elif rv == PATH_IS_DIR_NOT_ACCESSIBLE:
+ sys.stderr.write("Directory '%s' is not writable\n" % pool_dir)
+ pool_dir = self._query_pool_dir()
while True:
- while True:
- hostname = raw_input("Enter hostname: ")
- try:
- # Tests if hostname is translatable into IP address
- socket.gethostbyname(hostname)
- break
- except:
- sys.stderr.write("Hostname is not translatable into valid"\
- " IP address.\n")
+ hostname = self._query_hostname()
+ port = self._query_port()
+
+ sock = self._get_connection(hostname, port)
+ if sock is None:
+ if self._query_continuation():
continue
- while True:
- port = raw_input("Enter port(default: 9999): ")
- if port == "":
- port = DefaultRPCPort
- try:
- port = int(port)
+ else:
break
- except:
- sys.stderr.write("Invalid port.")
- continue
- msg = self._get_suitable_interfaces(socket.gethostbyname(hostname),\
- port)
- if msg:
- self._write_to_xml(msg, hostname, port, "interactive")
- next_machine = raw_input("Do you want to add another machine? "\
- "[Y/n]: ")
- if next_machine.lower() == 'y' or next_machine == "":
+
+ machine_interfaces = self._get_machine_interfaces(sock)
+ sock.close()
+
+ if machine_interfaces == {}:
+ sys.stderr.write("No suitable interfaces found on the host "
+ "'%s:%s'\n" % (hostname, port))
+ elif machine_interfaces is not None:
+ filename = self._query_filename(hostname)
+ self._create_xml(machine_interfaces, hostname,
+ port, pool_dir, filename, "interactive")
+ if self._query_continuation():
continue
else:
break
- return
- def noninteractive(self, hostlist):
- """
- Starts Wizard in noninteractive mode. Wizard gets list of hosts and
- ports as arguments. He tries to connect and get info about suitable
- interfaces for each of the hosts. Noninteractive mode does not prompt
- user about anything, it automatically adds all suitable interfaces into
- .xml file named the same as the hostname of the selected machine.
+ def noninteractive(self, hostlist, pool_dir):
+ """ Starts Wizard in noninteractive mode
+ @param hostlist List of hosts (mandatory)
+ @param pool_dir Path to pool_directory (optional)
"""
- self._mode = "noninteractive"
+ if pool_dir is None:
+ pool_dir = DefaultPoolDir
+
+ rv = self._check_path(pool_dir)
+ if rv == PATH_IS_DIR_ACCESSIBLE:
+ print("Pool directory set to '%s'" % pool_dir)
+ elif rv == PATH_DOES_NOT_EXIST:
+ sys.stderr.write("Path '%s' does not exist\n" % pool_dir)
+ pool_dir = self._create_dir(pool_dir)
+ if pool_dir is None:
+ sys.stderr.write("Pool wizard aborted\n")
+ return
+ elif rv == PATH_NOT_DIR:
+ sys.stderr.write("Path '%s' exists but is not a directory\n"
+ % pool_dir)
+ sys.stderr.write("Pool wizard aborted\n")
+ return
+ elif rv == PATH_IS_DIR_NOT_ACCESSIBLE:
+ sys.stderr.write("Directory '%s' is not writable\n" % pool_dir)
+ sys.stderr.write("Pool wizard aborted\n")
+ return
+
for host in hostlist:
- # Checks if port was entered along with hostname
+ print("Processing host '%s'" % host)
+ # Check if port was entered along with hostname
if host.find(":") != -1:
- hostname = host.split(':')[0]
- try:
- port = int(host.split(':')[1])
- except:
- port = DefaultRPCPort
+ hostname = host.split(":")[0]
+ if hostname == "":
+ msg = "'%s' does not contain valid hostname\n" % host
+ sys.stderr.write(msg)
+ sys.stderr.write("Skipping host '%s'\n" % host)
+ continue
+ try:
+ port = int(host.split(":")[1])
+ except:
+ port = DefaultRPCPort
+ msg = "Invalid port entered, "\
+ "using '%s' instead\n" % port
+ sys.stderr.write(msg)
else:
hostname = host
port = DefaultRPCPort
- msg = self._get_suitable_interfaces(hostname, port)
- if not msg:
+
+ if not self._check_hostname(hostname):
+ sys.stderr.write("Hostname '%s' is not translatable into a "
+ "valid IP address\n" % hostname)
+ sys.stderr.write("Skipping host '%s'\n" % host)
continue
- self._write_to_xml(msg, hostname, port, "noninteractive")
- def _get_suitable_interfaces(self, hostname, port):
- """
- Calls all functions, which are used by both interactive and
- noninteractive mode to get list of suitable interfaces. The list is
- saved to variable msg.
- """
- if not test_tcp_connection(hostname, port):
- sys.stderr.write("Host destination '%s:%s' unreachable.\n"
- % (hostname, port))
- return False
- if not self._connect_and_configure_machine(hostname, port):
- return False
- msg = self._get_device_ifcs(hostname, port)
- self._msg_dispatcher.disconnect_slave(1)
- return msg
+ sock = self._get_connection(hostname, port)
+ if sock is None:
+ sys.stderr.write("Skipping host '%s'\n" % host)
+ continue
- def _get_device_ifcs(self, hostname, port):
- """
- Sends RPC call request to Slave to call function get_devices, which
- returns list of ethernet devices which are in state DOWN.
- """
- msg = self._machine._rpc_call("get_devices")
- if msg == {}:
- sys.stderr.write("No suitable interfaces found on the slave "\
- "'%s:%s'.\n" % (hostname, port))
- return False
- return msg
+ machine_interfaces = self._get_machine_interfaces(sock)
+ sock.close()
- def _connect_and_configure_machine(self, hostname, port):
- """
- Connects to Slave and configures it
+ if machine_interfaces is {}:
+ sys.stderr.write("No suitable interfaces found on the host "
+ "'%s:%s'\n" % (hostname, port))
+ continue
+ elif machine_interfaces is None:
+ continue
+ else:
+ filename = hostname + ".xml"
+ self._create_xml(machine_interfaces, hostname,
+ port, pool_dir, filename, "noninteractive")
+
+ def _check_hostname(self, hostname):
+ """ Checks hostnames translatibility
+ @param hostname Hostname which is checked whether it's valid
+ @return True if valid hostname was entered, False otherwise
"""
try:
- self._machine = Machine(1, hostname, None, port)
- self._machine.set_rpc(self._msg_dispatcher)
- self._machine.configure("MachinePoolWizard")
+ # Test if hostname is translatable into IP address
+ socket.gethostbyname(hostname)
return True
except:
- sys.stderr.write("Remote machine '%s:%s' configuration failed!\n"
- % (hostname, port))
- self._msg_dispatcher.disconnect_slave(1)
return False
- def _write_to_xml(self, msg, hostname, port, mode):
+ def _check_path(self, pool_dir):
+ """ Checks if path exists, is dir and is accessible by user
+ @param pool_dir Path to checked directory
+ @return True if user can write in entered directory, False otherwise
"""
- Used for writing desired output into .xml file. In interactive mode,
- user is prompted for every interface, in noninteractive mode all
- interfaces are automatically added to the .xml file.
+ if not os.path.exists(pool_dir):
+ return PATH_DOES_NOT_EXIST
+ if os.path.isdir(pool_dir):
+ if os.access(pool_dir, os.W_OK):
+ return PATH_IS_DIR_ACCESSIBLE
+ else:
+ return PATH_IS_DIR_NOT_ACCESSIBLE
+ else:
+ return PATH_NOT_DIR
+
+ def _create_dir(self, pool_dir):
+ """ Creates specified directory
+ @param pool_dir Directory to be created
+ @return Path to dir which was created, None if no directory was created
+ """
+ try:
+ mkdir_p(pool_dir)
+ print("Dir '%s' has been created" % pool_dir)
+ return pool_dir
+ except:
+ sys.stderr.write("Failed creating dir")
+ return None
+
+ def _create_xml(self, machine_interfaces, hostname,
+ port, pool_dir, filename, mode):
+ """ Creates slave machine XML file
+ @param machine_interfaces Dictionary with machine's interfaces
+ @param hostname Hostname of the machine
+ @param port Port on which LNST listens on the machine
+ @param pool_dir Path to directory where XML file will be created
+ @param filename Name of the XML file
+ @param mode Mode in which wizard was started
"""
- if mode == "interactive":
- output_file = raw_input("Enter the name of the output .xml file "\
- "(without .xml, default is hostname.xml): ")
- if mode == "noninteractive" or output_file == "":
- output_file = hostname
impl = getDOMImplementation()
doc = impl.createDocument(None, "slavemachine", None)
@@ -166,42 +212,164 @@ class Wizard:
interfaces_el = doc.createElement("interfaces")
top_el.appendChild(interfaces_el)
- devices_added = 0
- for interface in msg.itervalues():
- if mode == 'interactive':
+ interfaces_added = 0
+ for iface in machine_interfaces.itervalues():
+ if mode == "interactive":
answer = raw_input("Do you want to add interface '%s' (%s) "
- "to the recipe? [Y/n]" % (interface['name'],
- interface['hwaddr']))
- if mode == "noninteractive" or answer.lower() == 'y'\
+ "to the recipe? [Y/n]: " % (iface["name"],
+ iface["hwaddr"]))
+ if mode == "noninteractive" or answer.lower() == "y"\
or answer == "":
- devices_added += 1
+ interfaces_added += 1
eth_el = doc.createElement("eth")
- eth_el.setAttribute("id", interface['name'])
+ eth_el.setAttribute("id", iface["name"])
eth_el.setAttribute("label", "default_network")
interfaces_el.appendChild(eth_el)
params_el = doc.createElement("params")
eth_el.appendChild(params_el)
param_el = doc.createElement("param")
param_el.setAttribute("name", "hwaddr")
- param_el.setAttribute("value", interface['hwaddr'])
+ param_el.setAttribute("value", iface["hwaddr"])
params_el.appendChild(param_el)
- if devices_added == 0:
- sys.stderr.write("You didn't add any interface, no file '%s.xml' "\
- "will be created!\n" % output_file)
+ if interfaces_added == 0:
+ sys.stderr.write("You didn't add any interface, no file "
+ "'%s' will be created\n" % filename)
return
- mkdir_p(self._pool_dir)
try:
- f = open(self._pool_dir + "/" + output_file + ".xml", 'w')
+ f = open(pool_dir + "/" + filename, "w")
f.write(doc.toprettyxml())
f.close()
except:
- sys.stderr.write("File '%s.xml' could not be opened "\
- "or data written." % output_file+"\n")
- raise WizardException()
+ msg = "File '%s/%s' could not be opened or data written\n"\
+ % (pool_dir, filename)
+ raise WizardException(msg)
+
+ print("File '%s' successfuly created" % filename)
+
+ def _get_connection(self, hostname, port):
+ """ Connects to machine
+ @param hostname Hostname of the machine
+ @param port Port of the machine
+ @return Connected socket if connection was successful, None otherwise
+ """
+ try:
+ sock = socket.create_connection((hostname, port))
+ return sock
+ except socket.error:
+ sys.stderr.write("Connection to remote host '%s:%s' failed\n"
+ % (hostname, port))
+ return None
+
+ def _get_machine_interfaces(self, sock):
+ """ Gets machine interfaces via RPC call
+ @param sock Socket used for connecting to machine
+ @return Dictionary with machine interfaces or None if RPC call fails
+ """
+ msg = {"type": "command", "method_name": "get_devices", "args": {}}
+ if not send_data(sock, msg):
+ sys.stderr.write("Could not send request to slave machine\n")
+ return None
+
+ while True:
+ data = recv_data(sock)
+ if data["type"] == "result":
+ return data["result"]
+
+ def _query_continuation(self):
+ """ Queries user for adding next machine
+ @return True if user wants to add another machine, False otherwise
+ """
+ answer = raw_input("Do you want to add another machine? [Y/n]: ")
+ if answer.lower() == "y" or answer == "":
+ return True
+ else:
+ return False
+
+ def _query_dir_creation(self, pool_dir):
+ """ Queries user for creating specified directory
+ @return True if user wants to create the directory, False otherwise
+ """
+ answer = raw_input("Create dir '%s'? [Y/n]: " % pool_dir)
+ if answer.lower() == 'y' or answer == "":
+ return True
+ else:
+ return False
+
+ def _query_filename(self, hostname):
+ """ Queries user for name of the file
+ @hostname Hostname of the machine which is used as default filename
+ @return Name of the file with .xml extension
+ """
+ output_file = raw_input("Enter the name of the output .xml file "
+ "(without .xml, default is '%s.xml'): "
+ % hostname)
+ if output_file == "":
+ return hostname + ".xml"
+ else:
+ return output_file + ".xml"
+
+ def _query_hostname(self):
+ """ Queries user for hostname
+ @return Valid (is translatable to an IP address) hostname
+ """
+ while True:
+ hostname = raw_input("Enter hostname: ")
+ if hostname == "":
+ sys.stderr.write("No hostname entered\n")
+ continue
+ if self._check_hostname(hostname):
+ return hostname
+ else:
+ sys.stderr.write("Hostname '%s' is not translatable into a "
+ "valid IP address\n" % hostname)
+
+ def _query_pool_dir(self):
+ """ Queries user for pool directory
+ @return Valid (is writable by user) path to directory
+ """
+ while True:
+ pool_dir = raw_input("Enter path to a pool directory "
+ "(default: '%s'): " % DefaultPoolDir)
+ if pool_dir == "":
+ pool_dir = DefaultPoolDir
+
+ pool_dir = os.path.expanduser(pool_dir)
+ rv = self._check_path(pool_dir)
+ if rv == PATH_IS_DIR_ACCESSIBLE:
+ print("Pool directory set to '%s'" % pool_dir)
+ return pool_dir
+ elif rv == PATH_DOES_NOT_EXIST:
+ sys.stderr.write("Path '%s' does not exist\n"
+ % pool_dir)
+ if self._query_dir_creation(pool_dir):
+ created_dir = self._create_dir(pool_dir)
+ if created_dir is not None:
+ return created_dir
+
+ elif rv == PATH_NOT_DIR:
+ sys.stderr.write("Path '%s' exists but is not a directory\n"
+ % pool_dir)
+ elif rv == PATH_IS_DIR_NOT_ACCESSIBLE:
+ sys.stderr.write("Directory '%s' is not writable\n"
+ % pool_dir)
+
+ def _query_port(self):
+ """ Queries user for port
+ @return Integer representing port
+ """
+ while True:
+ port = raw_input("Enter port (default: %d): " % DefaultRPCPort)
+ if port == "":
+ return DefaultRPCPort
+ else:
+ try:
+ port = int(port)
+ return port
+ except:
+ sys.stderr.write("Invalid port entered\n")
- print "File '%s.xml' successfuly created." % output_file
class WizardException(Exception):
pass
--
2.4.3
8 years, 8 months
[PATCH] Netperf: divide the warning confidence by 2
by Ondrej Lichtner
From: Ondrej Lichtner <olichtne(a)redhat.com>
I just noticed that in the Netperf documentation they say that the
confidence interval (reported in the warning message when the requested
confidence wasn't reached) is the width of the whole interval, therefore
we need to divide by 2 to report the +- value properly.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
test_modules/Netperf.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test_modules/Netperf.py b/test_modules/Netperf.py
index ab79646..bbd6ea0 100644
--- a/test_modules/Netperf.py
+++ b/test_modules/Netperf.py
@@ -165,7 +165,7 @@ class Netperf(TestGeneric):
float(normal_confidence.group(1)))
else:
real_confidence = (float(normal_confidence.group(2)),
- float(warning_confidence.group(1)))
+ float(warning_confidence.group(1))/2)
return real_confidence
--
2.5.0
8 years, 8 months
[PATCH 1/2] InterfaceManager: Add carrier change methods
by Ido Schimmel
In order to test link negotiation it is useful to have methods that can
change the carrier state of an interface from a task.
Add the 'set_carrier_on' and 'set_carrier_off' methods for interfaces.
Unlike existing methods, these methods only change the carrier state and
nothing else (e.g. setting an address).
Signed-off-by: Ido Schimmel <idosch(a)mellanox.com>
Signed-off-by: Jiri Pirko <jiri(a)mellanox.com>
---
lnst/Controller/Machine.py | 14 ++++++++++++++
lnst/Controller/Task.py | 6 ++++++
lnst/Slave/InterfaceManager.py | 6 ++++++
lnst/Slave/NetTestSlave.py | 18 ++++++++++++++++++
4 files changed, 44 insertions(+)
diff --git a/lnst/Controller/Machine.py b/lnst/Controller/Machine.py
index e60e1ea..6a9f6f2 100644
--- a/lnst/Controller/Machine.py
+++ b/lnst/Controller/Machine.py
@@ -717,6 +717,20 @@ class Interface(object):
else:
self._machine._rpc_call("set_device_down", self._id)
+ def set_carrier_on(self):
+ netns = self._netns
+ if netns != None:
+ self._machine._rpc_call_to_netns(netns, "set_carrier_on", self._id)
+ else:
+ self._machine._rpc_call("set_carrier_on", self._id)
+
+ def set_carrier_off(self):
+ netns = self._netns
+ if netns != None:
+ self._machine._rpc_call_to_netns(netns, "set_carrier_off", self._id)
+ else:
+ self._machine._rpc_call("set_carrier_off", self._id)
+
def initialize(self):
phys_devs = self._machine._rpc_call("map_if_by_hwaddr",
self._id, self._hwaddr)
diff --git a/lnst/Controller/Task.py b/lnst/Controller/Task.py
index 0d437f3..f1e882f 100644
--- a/lnst/Controller/Task.py
+++ b/lnst/Controller/Task.py
@@ -370,6 +370,12 @@ class InterfaceAPI(object):
def set_mtu(self, mtu):
return self._if.set_mtu(mtu)
+ def set_carrier_on(self):
+ return self._if.set_carrier_on()
+
+ def set_carrier_off(self):
+ return self._if.set_carrier_off()
+
class ModuleAPI(object):
""" An API class representing a module. """
diff --git a/lnst/Slave/InterfaceManager.py b/lnst/Slave/InterfaceManager.py
index 09f3be9..0360d10 100644
--- a/lnst/Slave/InterfaceManager.py
+++ b/lnst/Slave/InterfaceManager.py
@@ -486,6 +486,12 @@ class Device(object):
else:
exec_cmd("ip link set %s down" % self._name)
+ def carrier_on(self):
+ exec_cmd("ip link set %s up" % self._name)
+
+ def carrier_off(self):
+ exec_cmd("ip link set %s down" % self._name)
+
def set_netns(self, netns):
self._netns = netns
return
diff --git a/lnst/Slave/NetTestSlave.py b/lnst/Slave/NetTestSlave.py
index 775d4a5..73f116e 100644
--- a/lnst/Slave/NetTestSlave.py
+++ b/lnst/Slave/NetTestSlave.py
@@ -174,6 +174,24 @@ class SlaveMethods:
return False
return True
+ def set_carrier_on(self, if_id):
+ dev = self._if_manager.get_mapped_device(if_id)
+ if dev is not None:
+ dev.carrier_on()
+ else:
+ logging.error("Device with id '%s' not found." % if_id)
+ return False
+ return True
+
+ def set_carrier_off(self, if_id):
+ dev = self._if_manager.get_mapped_device(if_id)
+ if dev is not None:
+ dev.carrier_off()
+ else:
+ logging.error("Device with id '%s' not found." % if_id)
+ return False
+ return True
+
def set_unmapped_device_down(self, hwaddr):
dev = self._if_manager.get_device_by_hwaddr(hwaddr)
if dev is not None:
--
2.4.6
8 years, 8 months
[PATCH] Fix missing self prefix and dict definition in Netperf test module
by Jiri Prochazka
Prefix self was missing in two cases of testname variable.
Dictionary res_data was not defined, but was used in code.
This patch fixes both bugs
Signed-off-by: Jiri Prochazka <jprochaz(a)redhat.com>
---
test_modules/Netperf.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/test_modules/Netperf.py b/test_modules/Netperf.py
index eebf834..ab79646 100644
--- a/test_modules/Netperf.py
+++ b/test_modules/Netperf.py
@@ -124,7 +124,8 @@ class Netperf(TestGeneric):
# decimal decimal decimal float (float)
pattern_tcp_stream = "\d+\s+\d+\s+\d+\s+\d+\.\d+\s+(\d+(\.\d+){0,1})"
r2 = re.search(pattern_tcp_stream, output.lower())
- elif self._testname == "TCP_RR" or testname == "UDP_RR" or testname == "SCTP_RR":
+ elif self._testname == "TCP_RR" or self._testname == "UDP_RR"\
+ or self._testname == "SCTP_RR":
# pattern for TCP_RR, UDP_RR and SCTP_RR throughput output
# decimal decimal decimal decimal float (float)
pattern_tcp_rr = "\d+\s+\d+\s+\d+\s+\d+\s+\d+\.\d+\s+(\d+(\.\d+){0,1})"
@@ -170,6 +171,8 @@ class Netperf(TestGeneric):
def _parse_threshold(self, threshold):
+ res_data = {}
+
if threshold is None:
return None
# pattern for threshold
--
2.4.3
8 years, 8 months
[patch lnst] PktCounter: add support for ipv6
by Jiri Pirko
From: Jiri Pirko <jiri(a)mellanox.com>
With the ipv6 support addition, I made little reshuffling.
Signed-off-by: Jiri Pirko <jiri(a)mellanox.com>
---
test_modules/PktCounter.py | 67 +++++++++++++++++++++++++++++-----------------
1 file changed, 42 insertions(+), 25 deletions(-)
diff --git a/test_modules/PktCounter.py b/test_modules/PktCounter.py
index bb0325b..52a1c30 100644
--- a/test_modules/PktCounter.py
+++ b/test_modules/PktCounter.py
@@ -15,34 +15,51 @@ import re
import os
from lnst.Common.TestsCommon import TestGeneric
from lnst.Common.ExecCmd import exec_cmd, ExecCmdFail
+from lnst.Common.Utils import bool_it
-def get_pkt_count(indev_name, dport, proto):
- if indev_name:
- p_indev_name = indev_name
- else:
- p_indev_name = "\*"
- if proto:
- p_proto = proto
- if dport:
- p_protodport = "%s dpt:%s" % (proto, dport)
+class PktCounter(TestGeneric):
+ def _iptables_exec(self, param_str):
+ if self._is_ipv6:
+ cmd = "ip6tables"
+ else:
+ cmd = "iptables"
+ return exec_cmd("%s %s" % (cmd, param_str))
+
+ def _get_pttr(self, p_proto, p_indev_name, p_protodport):
+ if self._is_ipv6:
+ return r'\s*(\d+)\s+\d+\s+%s\s+%s\s+\*\s+::\/0\s+::\/0\s*%s' % (p_proto, p_indev_name, p_protodport)
+ else:
+ return r'\s*(\d+)\s+\d+\s+%s\s+\-\-\s+%s\s+\*\s+0\.0\.0\.0\/0\s+0\.0\.0\.0\/0\s*%s' % (p_proto, p_indev_name, p_protodport)
+
+ def _get_pkt_count(self, indev_name, dport, proto):
+ if indev_name:
+ p_indev_name = indev_name
else:
+ p_indev_name = "\*"
+ if proto:
+ p_proto = proto
+ if dport:
+ p_protodport = "%s dpt:%s" % (proto, dport)
+ else:
+ p_protodport = ""
+ else:
+ p_proto = "all"
p_protodport = ""
- else:
- p_proto = "all"
- p_protodport = ""
- pttr = (r'\s*(\d+)\s+\d+\s+%s\s+\-\-\s+%s\s+\*\s+0\.0\.0\.0\/0\s+0\.0\.0\.0\/0\s*%s'
- % (p_proto, p_indev_name, p_protodport))
- data_stdout = exec_cmd("iptables -L -v -x -n")[0]
- match = re.search(pttr, data_stdout)
- if not match:
- return None
- return match.groups()[0]
+ pttr = self._get_pttr(p_proto, p_indev_name, p_protodport)
+ data_stdout = self._iptables_exec("-L -v -x -n")[0]
+ match = re.search(pttr, data_stdout)
+ if not match:
+ return None
+ return match.groups()[0]
-class PktCounter(TestGeneric):
def run(self):
indev_name = self.get_opt("input_netdev_name")
dport = self.get_opt("dport")
proto = self.get_opt("proto")
+ ipv6 = self.get_opt("ipv6")
+ self._is_ipv6 = False
+ if ipv6 and bool_it(ipv6):
+ self._is_ipv6 = True
params = ""
if indev_name:
params += " -i %s" % indev_name
@@ -57,16 +74,16 @@ class PktCounter(TestGeneric):
Remove all same already existing rules
'''
while True:
- if get_pkt_count(indev_name, dport, proto) == None:
+ if self._get_pkt_count(indev_name, dport, proto) == None:
break
- exec_cmd("iptables -D INPUT%s" % params)
+ self._iptables_exec("-D INPUT%s" % params)
- exec_cmd("iptables -I INPUT%s" % params)
+ self._iptables_exec("-I INPUT%s" % params)
self.wait_on_interrupt()
- count = get_pkt_count(indev_name, dport, proto)
+ count = self._get_pkt_count(indev_name, dport, proto)
- exec_cmd("iptables -D INPUT%s" % params)
+ self._iptables_exec("-D INPUT%s" % params)
return self.set_pass(res_data={"pkt_count": count})
--
2.4.3
8 years, 8 months
[PATCH] regression tests: fix name of mapping file
by Ondrej Lichtner
From: Ondrej Lichtner <olichtne(a)redhat.com>
The mapping file alias for the
virtual_bridge_2_vlans_over_active_backup_bond recipe was wrong.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
.../phase1/virtual_bridge_2_vlans_over_active_backup_bond.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/recipes/regression_tests/phase1/virtual_bridge_2_vlans_over_active_backup_bond.xml b/recipes/regression_tests/phase1/virtual_bridge_2_vlans_over_active_backup_bond.xml
index c320a93..18f8cf5 100644
--- a/recipes/regression_tests/phase1/virtual_bridge_2_vlans_over_active_backup_bond.xml
+++ b/recipes/regression_tests/phase1/virtual_bridge_2_vlans_over_active_backup_bond.xml
@@ -2,7 +2,7 @@
<define>
<alias name="ipv" value="both" />
<alias name="netperf_duration" value="60" />
- <alias name="mapping_file" value="virtual_bridge_2_vlans_over_bond.mapping" />
+ <alias name="mapping_file" value="virtual_bridge_2_vlans_over_active_backup_bond.mapping" />
</define>
<network>
<host id="host1">
--
2.5.0
8 years, 8 months
[PATCH 1/2] regression_tests: team_test fix direction parameters
by Ondrej Lichtner
From: Ondrej Lichtner <olichtne(a)redhat.com>
Parameters regarding the direction of the Netperf tests were
inconsistent and contained a few typos. This fixes the issue.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
recipes/regression_tests/phase2/team_test.py | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/recipes/regression_tests/phase2/team_test.py b/recipes/regression_tests/phase2/team_test.py
index 6503bc9..0ecc25c 100644
--- a/recipes/regression_tests/phase2/team_test.py
+++ b/recipes/regression_tests/phase2/team_test.py
@@ -160,8 +160,8 @@ for offload in offloads:
if udp_ipv4_id is not None:
result_udp = perf_api.new_result(udp_ipv4_id, "udp_ipv4_result")
result_udp.set_parameter(offload, state)
- result_tcp.set_parameter('netperf_server', "testmachine1")
- result_tcp.set_parameter('netperf_client', "testmachine2")
+ result_udp.set_parameter('netperf_server', "testmachine1")
+ result_udp.set_parameter('netperf_client', "testmachine2")
if product_name is not None:
result_udp.set_tag(product_name)
res_hash = result_udp.generate_hash(['kernel-release',
@@ -217,7 +217,8 @@ for offload in offloads:
if tcp_ipv6_id is not None:
result_tcp = perf_api.new_result(tcp_ipv6_id, "tcp_ipv6_result")
result_tcp.set_parameter(offload, state)
- result_tcp.set_parameter('netperf_direction', "testmachine1->testmachine2")
+ result_tcp.set_parameter('netperf_server', "testmachine1")
+ result_tcp.set_parameter('netperf_client', "testmachine2")
if product_name is not None:
result_tcp.set_tag(product_name)
res_hash = result_tcp.generate_hash(['kernel-release',
@@ -239,7 +240,8 @@ for offload in offloads:
if udp_ipv6_id is not None:
result_udp = perf_api.new_result(udp_ipv4_id, "udp_ipv6_result")
result_udp.set_parameter(offload, state)
- result_tcp.set_parameter('netperf_direction', "testmachine1->testmachine2")
+ result_udp.set_parameter('netperf_server', "testmachine1")
+ result_udp.set_parameter('netperf_client', "testmachine2")
if product_name is not None:
result_udp.set_tag(product_name)
res_hash = result_udp.generate_hash(['kernel-release',
@@ -347,8 +349,8 @@ for offload in offloads:
if udp_ipv4_id is not None:
result_udp = perf_api.new_result(udp_ipv4_id, "udp_ipv4_result")
result_udp.set_parameter(offload, state)
- result_udp.set_parameter('netperf_server', "testmachine1")
- result_udp.set_parameter('netperf_client', "testmachine2")
+ result_udp.set_parameter('netperf_server', "testmachine2")
+ result_udp.set_parameter('netperf_client', "testmachine1")
if product_name is not None:
result_udp.set_tag(product_name)
res_hash = result_udp.generate_hash(['kernel-release',
--
2.5.0
8 years, 8 months
[PATCH] regression tests: forgotten product_name alias
by Ondrej Lichtner
From: Ondrej Lichtner <olichtne(a)redhat.com>
In two tasks the product_name alias was forgotten, this patch fixes
that.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
recipes/regression_tests/phase1/virtual_bridge_vlan_in_host.py | 2 ++
recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.py | 2 ++
2 files changed, 4 insertions(+)
diff --git a/recipes/regression_tests/phase1/virtual_bridge_vlan_in_host.py b/recipes/regression_tests/phase1/virtual_bridge_vlan_in_host.py
index 1b0b119..d32b1e0 100644
--- a/recipes/regression_tests/phase1/virtual_bridge_vlan_in_host.py
+++ b/recipes/regression_tests/phase1/virtual_bridge_vlan_in_host.py
@@ -9,6 +9,8 @@ from lnst.Controller.PerfRepoUtils import parse_id_mapping, get_id
mapping_file = ctl.get_alias("mapping_file")
mapping = parse_id_mapping(mapping_file)
+product_name = ctl.get_alias("product_name")
+
tcp_ipv4_id = get_id(mapping, "tcp_ipv4_id")
tcp_ipv6_id = get_id(mapping, "tcp_ipv6_id")
udp_ipv4_id = get_id(mapping, "udp_ipv4_id")
diff --git a/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.py b/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.py
index 118250b..d15f2be 100644
--- a/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.py
+++ b/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.py
@@ -9,6 +9,8 @@ from lnst.Controller.PerfRepoUtils import parse_id_mapping, get_id
mapping_file = ctl.get_alias("mapping_file")
mapping = parse_id_mapping(mapping_file)
+product_name = ctl.get_alias("product_name")
+
tcp_ipv4_id = get_id(mapping, "tcp_ipv4_id")
tcp_ipv6_id = get_id(mapping, "tcp_ipv6_id")
udp_ipv4_id = get_id(mapping, "udp_ipv4_id")
--
2.5.0
8 years, 8 months
[PATCH] regression_tests: more copy-paste error fixes
by Ondrej Lichtner
From: Ondrej Lichtner <olichtne(a)redhat.com>
There were more copy-paste errors that resulted in the recipes failing
with Exceptions.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
recipes/regression_tests/phase1/3_vlans.py | 8 ++++----
.../regression_tests/phase1/3_vlans_over_bond.py | 8 ++++----
recipes/regression_tests/phase1/bonding_test.py | 8 ++++----
.../phase1/virtual_bridge_2_vlans_over_bond.py | 4 ++--
.../phase1/virtual_bridge_vlan_in_guest.py | 8 ++++----
.../phase1/virtual_bridge_vlan_in_host.py | 8 ++++----
.../regression_tests/phase2/3_vlans_over_team.py | 8 ++++----
recipes/regression_tests/phase2/team_test.py | 24 +++++++++++-----------
...l_ovs_bridge_2_vlans_over_active_backup_bond.py | 4 ++--
.../phase2/virtual_ovs_bridge_vlan_in_guest.py | 4 ++--
.../phase2/virtual_ovs_bridge_vlan_in_host.py | 4 ++--
11 files changed, 44 insertions(+), 44 deletions(-)
diff --git a/recipes/regression_tests/phase1/3_vlans.py b/recipes/regression_tests/phase1/3_vlans.py
index 1a2c834..0109ba0 100644
--- a/recipes/regression_tests/phase1/3_vlans.py
+++ b/recipes/regression_tests/phase1/3_vlans.py
@@ -175,7 +175,7 @@ for vlan1 in vlans:
result_udp.set_parameter('netperf_client_on_vlan', vlan2)
if product_name is not None:
result_udp.set_tag(product_name)
- res_hash = result_tcp.generate_hash(['kernel-release',
+ res_hash = result_udp.generate_hash(['kernel-release',
'redhat-release'])
result_udp.set_tag(res_hash)
@@ -211,7 +211,7 @@ for vlan1 in vlans:
perf_api.save_result(result_tcp)
if result_udp is not None and udp_res_data.get_result() is not None and\
- result_udp.get_result()['res_data'] is not None:
+ udp_res_data.get_result()['res_data'] is not None:
rate = udp_res_data.get_result()['res_data']['rate']
deviation = udp_res_data.get_result()['res_data']['rate_deviation']
@@ -258,7 +258,7 @@ for vlan1 in vlans:
result_udp.set_parameter('netperf_client_on_vlan', vlan2)
if product_name is not None:
result_udp.set_tag(product_name)
- res_hash = result_tcp.generate_hash(['kernel-release',
+ res_hash = result_udp.generate_hash(['kernel-release',
'redhat-release'])
result_udp.set_tag(res_hash)
@@ -292,7 +292,7 @@ for vlan1 in vlans:
perf_api.save_result(result_tcp)
if result_udp is not None and udp_res_data.get_result() is not None and\
- result_udp.get_result()['res_data'] is not None:
+ udp_res_data.get_result()['res_data'] is not None:
rate = udp_res_data.get_result()['res_data']['rate']
deviation = udp_res_data.get_result()['res_data']['rate_deviation']
diff --git a/recipes/regression_tests/phase1/3_vlans_over_bond.py b/recipes/regression_tests/phase1/3_vlans_over_bond.py
index c9d3286..4dae207 100644
--- a/recipes/regression_tests/phase1/3_vlans_over_bond.py
+++ b/recipes/regression_tests/phase1/3_vlans_over_bond.py
@@ -177,7 +177,7 @@ for vlan1 in vlans:
result_udp.set_parameter('netperf_client_on_vlan', vlan2)
if product_name is not None:
result_udp.set_tag(product_name)
- res_hash = result_tcp.generate_hash(['kernel-release',
+ res_hash = result_udp.generate_hash(['kernel-release',
'redhat-release'])
result_udp.set_tag(res_hash)
@@ -213,7 +213,7 @@ for vlan1 in vlans:
perf_api.save_result(result_tcp)
if result_udp is not None and udp_res_data.get_result() is not None and\
- result_udp.get_result()['res_data'] is not None:
+ udp_res_data.get_result()['res_data'] is not None:
rate = udp_res_data.get_result()['res_data']['rate']
deviation = udp_res_data.get_result()['res_data']['rate_deviation']
@@ -260,7 +260,7 @@ for vlan1 in vlans:
result_udp.set_parameter('netperf_client_on_vlan', vlan2)
if product_name is not None:
result_udp.set_tag(product_name)
- res_hash = result_tcp.generate_hash(['kernel-release',
+ res_hash = result_udp.generate_hash(['kernel-release',
'redhat-release'])
result_udp.set_tag(res_hash)
@@ -294,7 +294,7 @@ for vlan1 in vlans:
perf_api.save_result(result_tcp)
if result_udp is not None and udp_res_data.get_result() is not None and\
- result_udp.get_result()['res_data'] is not None:
+ udp_res_data.get_result()['res_data'] is not None:
rate = udp_res_data.get_result()['res_data']['rate']
deviation = udp_res_data.get_result()['res_data']['rate_deviation']
diff --git a/recipes/regression_tests/phase1/bonding_test.py b/recipes/regression_tests/phase1/bonding_test.py
index 29f251a..e59d830 100644
--- a/recipes/regression_tests/phase1/bonding_test.py
+++ b/recipes/regression_tests/phase1/bonding_test.py
@@ -158,7 +158,7 @@ for offload in offloads:
result_udp.set_parameter(offload, state)
if product_name is not None:
result_udp.set_tag(product_name)
- res_hash = result_tcp.generate_hash(['kernel-release',
+ res_hash = result_udp.generate_hash(['kernel-release',
'redhat-release'])
result_udp.set_tag(res_hash)
@@ -192,7 +192,7 @@ for offload in offloads:
perf_api.save_result(result_tcp)
if result_udp is not None and udp_res_data.get_result() is not None and\
- result_udp.get_result()['res_data'] is not None:
+ udp_res_data.get_result()['res_data'] is not None:
rate = udp_res_data.get_result()['res_data']['rate']
deviation = udp_res_data.get_result()['res_data']['rate_deviation']
@@ -234,7 +234,7 @@ for offload in offloads:
result_udp.set_parameter(offload, state)
if product_name is not None:
result_udp.set_tag(product_name)
- res_hash = result_tcp.generate_hash(['kernel-release',
+ res_hash = result_udp.generate_hash(['kernel-release',
'redhat-release'])
result_udp.set_tag(res_hash)
@@ -267,7 +267,7 @@ for offload in offloads:
perf_api.save_result(result_tcp)
if result_udp is not None and udp_res_data.get_result() is not None and\
- result_udp.get_result()['res_data'] is not None:
+ udp_res_data.get_result()['res_data'] is not None:
rate = udp_res_data.get_result()['res_data']['rate']
deviation = udp_res_data.get_result()['res_data']['rate_deviation']
diff --git a/recipes/regression_tests/phase1/virtual_bridge_2_vlans_over_bond.py b/recipes/regression_tests/phase1/virtual_bridge_2_vlans_over_bond.py
index 643b4b0..69e0605 100644
--- a/recipes/regression_tests/phase1/virtual_bridge_2_vlans_over_bond.py
+++ b/recipes/regression_tests/phase1/virtual_bridge_2_vlans_over_bond.py
@@ -224,7 +224,7 @@ for offload in offloads:
result_udp.set_parameter(offload, state)
if product_name is not None:
result_udp.set_tag(product_name)
- res_hash = result_tcp.generate_hash(['kernel-release',
+ res_hash = result_udp.generate_hash(['kernel-release',
'redhat-release'])
result_udp.set_tag(res_hash)
@@ -303,7 +303,7 @@ for offload in offloads:
result_udp.set_parameter(offload, state)
if product_name is not None:
result_udp.set_tag(product_name)
- res_hash = result_tcp.generate_hash(['kernel-release',
+ res_hash = result_udp.generate_hash(['kernel-release',
'redhat-release'])
result_udp.set_tag(res_hash)
diff --git a/recipes/regression_tests/phase1/virtual_bridge_vlan_in_guest.py b/recipes/regression_tests/phase1/virtual_bridge_vlan_in_guest.py
index 44e9d42..e7ef089 100644
--- a/recipes/regression_tests/phase1/virtual_bridge_vlan_in_guest.py
+++ b/recipes/regression_tests/phase1/virtual_bridge_vlan_in_guest.py
@@ -159,7 +159,7 @@ for offload in offloads:
result_udp.set_parameter(offload, state)
if product_name is not None:
result_udp.set_tag(product_name)
- res_hash = result_tcp.generate_hash(['kernel-release',
+ res_hash = result_udp.generate_hash(['kernel-release',
'redhat-release'])
result_udp.set_tag(res_hash)
@@ -194,7 +194,7 @@ for offload in offloads:
perf_api.save_result(result_tcp)
if result_udp is not None and udp_res_data.get_result() is not None and\
- result_udp.get_result()['res_data'] is not None:
+ udp_res_data.get_result()['res_data'] is not None:
rate = udp_res_data.get_result()['res_data']['rate']
deviation = udp_res_data.get_result()['res_data']['rate_deviation']
@@ -236,7 +236,7 @@ for offload in offloads:
result_udp.set_parameter(offload, state)
if product_name is not None:
result_udp.set_tag(product_name)
- res_hash = result_tcp.generate_hash(['kernel-release',
+ res_hash = result_udp.generate_hash(['kernel-release',
'redhat-release'])
result_udp.set_tag(res_hash)
@@ -270,7 +270,7 @@ for offload in offloads:
perf_api.save_result(result_tcp)
if result_udp is not None and udp_res_data.get_result() is not None and\
- result_udp.get_result()['res_data'] is not None:
+ udp_res_data.get_result()['res_data'] is not None:
rate = udp_res_data.get_result()['res_data']['rate']
deviation = udp_res_data.get_result()['res_data']['rate_deviation']
diff --git a/recipes/regression_tests/phase1/virtual_bridge_vlan_in_host.py b/recipes/regression_tests/phase1/virtual_bridge_vlan_in_host.py
index fcfd303..1b0b119 100644
--- a/recipes/regression_tests/phase1/virtual_bridge_vlan_in_host.py
+++ b/recipes/regression_tests/phase1/virtual_bridge_vlan_in_host.py
@@ -156,7 +156,7 @@ for offload in offloads:
result_udp.set_parameter(offload, state)
if product_name is not None:
result_udp.set_tag(product_name)
- res_hash = result_tcp.generate_hash(['kernel-release',
+ res_hash = result_udp.generate_hash(['kernel-release',
'redhat-release'])
result_udp.set_tag(res_hash)
@@ -190,7 +190,7 @@ for offload in offloads:
perf_api.save_result(result_tcp)
if result_udp is not None and udp_res_data.get_result() is not None and\
- result_udp.get_result()['res_data'] is not None:
+ udp_res_data.get_result()['res_data'] is not None:
rate = udp_res_data.get_result()['res_data']['rate']
deviation = udp_res_data.get_result()['res_data']['rate_deviation']
@@ -232,7 +232,7 @@ for offload in offloads:
result_udp.set_parameter(offload, state)
if product_name is not None:
result_udp.set_tag(product_name)
- res_hash = result_tcp.generate_hash(['kernel-release',
+ res_hash = result_udp.generate_hash(['kernel-release',
'redhat-release'])
result_udp.set_tag(res_hash)
@@ -265,7 +265,7 @@ for offload in offloads:
perf_api.save_result(result_tcp)
if result_udp is not None and udp_res_data.get_result() is not None and\
- result_udp.get_result()['res_data'] is not None:
+ udp_res_data.get_result()['res_data'] is not None:
rate = udp_res_data.get_result()['res_data']['rate']
deviation = udp_res_data.get_result()['res_data']['rate_deviation']
diff --git a/recipes/regression_tests/phase2/3_vlans_over_team.py b/recipes/regression_tests/phase2/3_vlans_over_team.py
index ad1a611..86c59b0 100644
--- a/recipes/regression_tests/phase2/3_vlans_over_team.py
+++ b/recipes/regression_tests/phase2/3_vlans_over_team.py
@@ -179,7 +179,7 @@ for vlan1 in vlans:
result_udp.set_parameter('netperf_client_on_vlan', vlan2)
if product_name is not None:
result_udp.set_tag(product_name)
- res_hash = result_tcp.generate_hash(['kernel-release',
+ res_hash = result_udp.generate_hash(['kernel-release',
'redhat-release'])
result_udp.set_tag(res_hash)
@@ -214,7 +214,7 @@ for vlan1 in vlans:
perf_api.save_result(result_tcp)
if result_udp is not None and udp_res_data.get_result() is not None and\
- result_udp.get_result()['res_data'] is not None:
+ udp_res_data.get_result()['res_data'] is not None:
rate = udp_res_data.get_result()['res_data']['rate']
deviation = udp_res_data.get_result()['res_data']['rate_deviation']
@@ -260,7 +260,7 @@ for vlan1 in vlans:
result_udp.set_parameter('netperf_client_on_vlan', vlan2)
if product_name is not None:
result_udp.set_tag(product_name)
- res_hash = result_tcp.generate_hash(['kernel-release',
+ res_hash = result_udp.generate_hash(['kernel-release',
'redhat-release'])
result_udp.set_tag(res_hash)
@@ -294,7 +294,7 @@ for vlan1 in vlans:
perf_api.save_result(result_tcp)
if result_udp is not None and udp_res_data.get_result() is not None and\
- result_udp.get_result()['res_data'] is not None:
+ udp_res_data.get_result()['res_data'] is not None:
rate = udp_res_data.get_result()['res_data']['rate']
deviation = udp_res_data.get_result()['res_data']['rate_deviation']
diff --git a/recipes/regression_tests/phase2/team_test.py b/recipes/regression_tests/phase2/team_test.py
index 4c04d82..6503bc9 100644
--- a/recipes/regression_tests/phase2/team_test.py
+++ b/recipes/regression_tests/phase2/team_test.py
@@ -164,7 +164,7 @@ for offload in offloads:
result_tcp.set_parameter('netperf_client', "testmachine2")
if product_name is not None:
result_udp.set_tag(product_name)
- res_hash = result_tcp.generate_hash(['kernel-release',
+ res_hash = result_udp.generate_hash(['kernel-release',
'redhat-release'])
result_udp.set_tag(res_hash)
@@ -198,7 +198,7 @@ for offload in offloads:
perf_api.save_result(result_tcp)
if result_udp is not None and udp_res_data.get_result() is not None and\
- result_udp.get_result()['res_data'] is not None:
+ udp_res_data.get_result()['res_data'] is not None:
rate = udp_res_data.get_result()['res_data']['rate']
deviation = udp_res_data.get_result()['res_data']['rate_deviation']
@@ -242,7 +242,7 @@ for offload in offloads:
result_tcp.set_parameter('netperf_direction', "testmachine1->testmachine2")
if product_name is not None:
result_udp.set_tag(product_name)
- res_hash = result_tcp.generate_hash(['kernel-release',
+ res_hash = result_udp.generate_hash(['kernel-release',
'redhat-release'])
result_udp.set_tag(res_hash)
@@ -275,7 +275,7 @@ for offload in offloads:
perf_api.save_result(result_tcp)
if result_udp is not None and udp_res_data.get_result() is not None and\
- result_udp.get_result()['res_data'] is not None:
+ udp_res_data.get_result()['res_data'] is not None:
rate = udp_res_data.get_result()['res_data']['rate']
deviation = udp_res_data.get_result()['res_data']['rate_deviation']
@@ -347,11 +347,11 @@ for offload in offloads:
if udp_ipv4_id is not None:
result_udp = perf_api.new_result(udp_ipv4_id, "udp_ipv4_result")
result_udp.set_parameter(offload, state)
- result_tcp.set_parameter('netperf_server', "testmachine1")
- result_tcp.set_parameter('netperf_client', "testmachine2")
+ result_udp.set_parameter('netperf_server', "testmachine1")
+ result_udp.set_parameter('netperf_client', "testmachine2")
if product_name is not None:
result_udp.set_tag(product_name)
- res_hash = result_tcp.generate_hash(['kernel-release',
+ res_hash = result_udp.generate_hash(['kernel-release',
'redhat-release'])
result_udp.set_tag(res_hash)
@@ -385,7 +385,7 @@ for offload in offloads:
perf_api.save_result(result_tcp)
if result_udp is not None and udp_res_data.get_result() is not None and\
- result_udp.get_result()['res_data'] is not None:
+ udp_res_data.get_result()['res_data'] is not None:
rate = udp_res_data.get_result()['res_data']['rate']
deviation = udp_res_data.get_result()['res_data']['rate_deviation']
@@ -427,11 +427,11 @@ for offload in offloads:
if udp_ipv6_id is not None:
result_udp = perf_api.new_result(udp_ipv4_id, "udp_ipv6_result")
result_udp.set_parameter(offload, state)
- result_tcp.set_parameter('netperf_server', "testmachine2")
- result_tcp.set_parameter('netperf_client', "testmachine1")
+ result_udp.set_parameter('netperf_server', "testmachine2")
+ result_udp.set_parameter('netperf_client', "testmachine1")
if product_name is not None:
result_udp.set_tag(product_name)
- res_hash = result_tcp.generate_hash(['kernel-release',
+ res_hash = result_udp.generate_hash(['kernel-release',
'redhat-release'])
result_udp.set_tag(res_hash)
@@ -464,7 +464,7 @@ for offload in offloads:
perf_api.save_result(result_tcp)
if result_udp is not None and udp_res_data.get_result() is not None and\
- result_udp.get_result()['res_data'] is not None:
+ udp_res_data.get_result()['res_data'] is not None:
rate = udp_res_data.get_result()['res_data']['rate']
deviation = udp_res_data.get_result()['res_data']['rate_deviation']
diff --git a/recipes/regression_tests/phase2/virtual_ovs_bridge_2_vlans_over_active_backup_bond.py b/recipes/regression_tests/phase2/virtual_ovs_bridge_2_vlans_over_active_backup_bond.py
index ec2f75b..a35d446 100644
--- a/recipes/regression_tests/phase2/virtual_ovs_bridge_2_vlans_over_active_backup_bond.py
+++ b/recipes/regression_tests/phase2/virtual_ovs_bridge_2_vlans_over_active_backup_bond.py
@@ -226,7 +226,7 @@ for offload in offloads:
result_udp.set_parameter(offload, state)
if product_name is not None:
result_udp.set_tag(product_name)
- res_hash = result_tcp.generate_hash(['kernel-release',
+ res_hash = result_udp.generate_hash(['kernel-release',
'redhat-release'])
result_udp.set_tag(res_hash)
@@ -305,7 +305,7 @@ for offload in offloads:
result_udp.set_parameter(offload, state)
if product_name is not None:
result_udp.set_tag(product_name)
- res_hash = result_tcp.generate_hash(['kernel-release',
+ res_hash = result_udp.generate_hash(['kernel-release',
'redhat-release'])
result_udp.set_tag(res_hash)
diff --git a/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_guest.py b/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_guest.py
index 31d69cb..89c3469 100644
--- a/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_guest.py
+++ b/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_guest.py
@@ -158,7 +158,7 @@ for offload in offloads:
result_udp.set_parameter(offload, state)
if product_name is not None:
result_udp.set_tag(product_name)
- res_hash = result_tcp.generate_hash(['kernel-release',
+ res_hash = result_udp.generate_hash(['kernel-release',
'redhat-release'])
result_udp.set_tag(res_hash)
@@ -235,7 +235,7 @@ for offload in offloads:
result_udp.set_parameter(offload, state)
if product_name is not None:
result_udp.set_tag(product_name)
- res_hash = result_tcp.generate_hash(['kernel-release',
+ res_hash = result_udp.generate_hash(['kernel-release',
'redhat-release'])
result_udp.set_tag(res_hash)
diff --git a/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.py b/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.py
index 05cc40b..118250b 100644
--- a/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.py
+++ b/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.py
@@ -155,7 +155,7 @@ for offload in offloads:
result_udp.set_parameter(offload, state)
if product_name is not None:
result_udp.set_tag(product_name)
- res_hash = result_tcp.generate_hash(['kernel-release',
+ res_hash = result_udp.generate_hash(['kernel-release',
'redhat-release'])
result_udp.set_tag(res_hash)
@@ -231,7 +231,7 @@ for offload in offloads:
result_udp.set_parameter(offload, state)
if product_name is not None:
result_udp.set_tag(product_name)
- res_hash = result_tcp.generate_hash(['kernel-release',
+ res_hash = result_udp.generate_hash(['kernel-release',
'redhat-release'])
result_udp.set_tag(res_hash)
--
2.5.0
8 years, 8 months