[PATCH] Add set_mtu and get_mtu API methods
by Jiri Prochazka
This patch adds two new methods to our API - set_mtu and get_mtu. Names are self-explanatory,
the only drawback these methods have, is that setting MTU to a certain value is persistent
on non-virtual devices. Workaround for this is to store mtu values before the test run
and set them back after the test finished.
I will try to implement persistency toggling in the future.
Signed-off-by: Jiri Prochazka <jprochaz(a)redhat.com>
---
lnst/Controller/Machine.py | 6 ++++++
lnst/Controller/Task.py | 6 ++++++
lnst/Slave/NetTestSlave.py | 12 ++++++++++++
3 files changed, 24 insertions(+)
diff --git a/lnst/Controller/Machine.py b/lnst/Controller/Machine.py
index e303c1a..fd4f004 100644
--- a/lnst/Controller/Machine.py
+++ b/lnst/Controller/Machine.py
@@ -696,6 +696,12 @@ class Interface(object):
self._machine._rpc_call("deconfigure_interface", self.get_id())
self._configured = False
+ def set_mtu(self, mtu):
+ self._machine._rpc_call("set_mtu", self.get_id(), mtu)
+
+ def get_mtu(self):
+ return self._machine._rpc_call("get_mtu", self.get_id())
+
class StaticInterface(Interface):
""" Static interface
diff --git a/lnst/Controller/Task.py b/lnst/Controller/Task.py
index be6b5cc..ee0d468 100644
--- a/lnst/Controller/Task.py
+++ b/lnst/Controller/Task.py
@@ -346,6 +346,12 @@ class InterfaceAPI(object):
def get_ip_prefix(self, ip_index):
return VolatileValue(self._if.get_prefix, ip_index)
+ def set_mtu(self, mtu):
+ self._if.set_mtu(mtu)
+
+ def get_mtu(self):
+ return VolatileValue(self._if.get_mtu)
+
class ModuleAPI(object):
""" An API class representing a module. """
diff --git a/lnst/Slave/NetTestSlave.py b/lnst/Slave/NetTestSlave.py
index 8eb1f99..65601a8 100644
--- a/lnst/Slave/NetTestSlave.py
+++ b/lnst/Slave/NetTestSlave.py
@@ -609,6 +609,18 @@ class SlaveMethods:
device.set_netns(None)
return True
+ def set_mtu(self, if_id, mtu):
+ device = self._if_manager.get_mapped_device(if_id)
+ dev_name = device.get_name()
+ exec_cmd("ip link set dev %s mtu %s" % (dev_name, mtu))
+ return True
+
+ def get_mtu(self, if_id):
+ device = self._if_manager.get_mapped_device(if_id)
+ dev_name = device.get_name()
+ mtu, _ = exec_cmd("cat /sys/class/net/%s/mtu" % dev_name, log_outputs=False)
+ return mtu
+
class ServerHandler(ConnectionHandler):
def __init__(self, addr):
super(ServerHandler, self).__init__()
--
2.1.0
8 years, 4 months
[PATCH 1/2] Utils: fix in list_to_dot function
by Ondrej Lichtner
From: Ondrej Lichtner <olichtne(a)redhat.com>
Keys generated for lists of simple values would end with a '.', example:
dict1.dict2.list0. = value
This fixes the issue so the generated keys look like this:
dict_x.dict_y.list0 = value
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Common/Utils.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lnst/Common/Utils.py b/lnst/Common/Utils.py
index 38aa48b..6884dfa 100644
--- a/lnst/Common/Utils.py
+++ b/lnst/Common/Utils.py
@@ -221,10 +221,10 @@ def list_to_dot(original_list, prefix="", key=""):
return_list = []
index = 0
for value in original_list:
- iter_key = prefix + key + str(index) + '.'
+ iter_key = prefix + key + str(index)
index += 1
if isinstance(value, collections.Mapping):
- sub_list = dict_to_dot(value, iter_key)
+ sub_list = dict_to_dot(value, iter_key + '.')
return_list.extend(sub_list)
elif isinstance(value, list):
raise Exception("Nested lists not allowed")
--
2.1.0
8 years, 4 months
[lnst] Created tag v8
by Jiří Pírko
The lightweight tag 'v8' was created pointing to:
154da1d... 8 release
8 years, 5 months
[lnst] 8 release
by Jiří Pírko
commit 154da1d774e9ddaf3946ab5bfd3a92fd7a3f12d0
Author: Jiri Pirko <jiri(a)resnulli.us>
Date: Mon Apr 27 18:53:50 2015 +0200
8 release
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
setup.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/setup.py b/setup.py
index a7d0948..d281fe9 100755
--- a/setup.py
+++ b/setup.py
@@ -171,7 +171,7 @@ DATA_FILES = CONFIG + TEST_MODULES + MULTICAST_TEST_TOOLS + MAN_PAGES + \
SCHEMAS + BASH_COMP + RECIPE_FILES
setup(name="lnst",
- version="7",
+ version="8",
description="Linux Network Stack Test",
author="LNST Team",
author_email="lnst-developers(a)lists.fedorahosted.org",
8 years, 5 months
An issue with LNST(pyroute2?) on ppc64
by Artem Savkov
Hi All,
We've tried running LNST tests with a ppc64 machine as slave (another
machine, which acted as master+slave was x86_64) and got the following
traceback with all tests (even the most basic ping test):
2015-04-23 12:42:29 (secondone) - DEBUG: Executing: "ping 10.16.167.142 -c 10 -I eth1"
2015-04-23 12:42:29 (secondone) - WARNING: decoding NDA_DST
2015-04-23 12:42:29 (secondone) - WARNING:
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/pyroute2-0.3.6-py2.6.egg/pyroute2/netlink/__init__.py", line 1084, in decode_nlas
nla.decode()
File "/usr/lib/python2.6/site-packages/pyroute2-0.3.6-py2.6.egg/pyroute2/netlink/__init__.py", line 1215, in decode
family = self.family_map[self.parent['family']]
KeyError: 33554432
These tracebacks don't seem to affect test in any way.
I've digged into this a bit and the issue seems to be caused by an unexpected
byteorder when decoding a message in pyrote2.netlink.nlmsg_base.decode().
This happens when we get a 'family' of 4 bytes, so we read 4 bytes:
0x02 0x00 0x00 0x00
And struct.unpack() translates it into 33554432 instead of 2.
I realize that I might be in a wrong list for this, so I wanted to ask
if thats something our setup (x86_64 mixed with ppc64) or LNST might be
responsible for or should I take this to pyroute2 devs?
P.S. If thats a pyroute2 bug I would be greatful if someone would help
me out to reproduce this with a simple script instead of LNST.
--
Regards,
Artem
8 years, 5 months
[lnst] Config: add configuration of PerfRepo access
by Jiří Pírko
commit 4db899cc0d01bd1e63b11742068ea7f3b94cfa63
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Fri Apr 24 10:56:01 2015 +0200
Config: add configuration of PerfRepo access
Having the perfrepo access information in a configuration file means
that python tasks that use PerfRepo are more portable don't have to
contain usernames and passwords.
You can now call the connect_PerfRepo() method without arguments, it
will use what you've set in the configuration file.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
install/lnst-ctl.conf.in | 6 ++++++
lnst-ctl.conf | 5 +++++
lnst/Common/Config.py | 20 ++++++++++++++++++++
lnst/Controller/Task.py | 15 +++++++++++----
4 files changed, 42 insertions(+), 4 deletions(-)
---
diff --git a/install/lnst-ctl.conf.in b/install/lnst-ctl.conf.in
index 4d31483..ad0efc1 100644
--- a/install/lnst-ctl.conf.in
+++ b/install/lnst-ctl.conf.in
@@ -55,3 +55,9 @@ log_dir = @ctl_logs_dir@
# dynamic interface configuration. This feature is mostly used by LNST
# developers when testing new features.
allow_virtual = True
+
+# Optional section for configuring access to a PerfRepo instance
+#[perfrepo]
+#url =
+#username =
+#password =
diff --git a/lnst-ctl.conf b/lnst-ctl.conf
index d9a28e3..cc2e6b3 100644
--- a/lnst-ctl.conf
+++ b/lnst-ctl.conf
@@ -12,3 +12,8 @@ test_module_dirs = ./test_modules
log_dir = ./Logs
xslt_url = http://www.lnst-project.org/files/result_xslt/xml_to_html.xsl
allow_virtual = True
+
+[perfrepo]
+url =
+username =
+password =
diff --git a/lnst/Common/Config.py b/lnst/Common/Config.py
index fd43742..e6b600b 100644
--- a/lnst/Common/Config.py
+++ b/lnst/Common/Config.py
@@ -82,6 +82,26 @@ class Config():
"name" : "allow_virtual"
}
+ self._options['perfrepo'] = dict()
+ self._options['perfrepo']['url'] = {\
+ "value" : "",
+ "additive" : False,
+ "action" : self.optionPlain,
+ "name" : "url"
+ }
+ self._options['perfrepo']['username'] = {\
+ "value" : "",
+ "additive" : False,
+ "action" : self.optionPlain,
+ "name" : "username"
+ }
+ self._options['perfrepo']['password'] = {\
+ "value" : "",
+ "additive" : False,
+ "action" : self.optionPlain,
+ "name" : "password"
+ }
+
self.colours_scheme()
def slave_init(self):
diff --git a/lnst/Controller/Task.py b/lnst/Controller/Task.py
index be6b5cc..034dc5f 100644
--- a/lnst/Controller/Task.py
+++ b/lnst/Controller/Task.py
@@ -14,6 +14,7 @@ from lnst.Controller.PerfRepo import PerfRepoRESTAPI
from lnst.Controller.PerfRepo import PerfRepoTestExecution
from lnst.Controller.PerfRepo import PerfRepoValue
from lnst.Common.Utils import dot_to_dict, dict_to_dot, list_to_dot
+from lnst.Common.Config import lnst_config
# The handle to be imported from each task
ctl = None
@@ -102,9 +103,15 @@ class ControllerAPI(object):
"""
return self._ctl._get_alias(alias)
- def connect_PerfRepo(self, hostname, username, password):
+ def connect_PerfRepo(self, url=None, username=None, password=None):
if not self._perf_repo_api.connected():
- self._perf_repo_api.connect(hostname, username, password)
+ if url is None:
+ url = lnst_config.get_option("perfrepo", "url")
+ if username is None:
+ url = lnst_config.get_option("perfrepo", "username")
+ if password is None:
+ url = lnst_config.get_option("perfrepo", "password")
+ self._perf_repo_api.connect(url, username, password)
return self._perf_repo_api
def get_configuration(self):
@@ -454,8 +461,8 @@ class PerfRepoAPI(object):
def connected(self):
return self._rest_api is not None
- def connect(self, hostname, username, password):
- self._rest_api = PerfRepoRESTAPI(hostname, username, password)
+ def connect(self, url, username, password):
+ self._rest_api = PerfRepoRESTAPI(url, username, password)
def new_result(self, testUid, name):
result = PerfRepoResult(testUid, name)
8 years, 5 months
[lnst] regression-tests: remove pstree dependency from #25
by Jiří Pírko
commit 9b871260e60087d4473802e4a440ef3b1ab33c3d
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Fri Apr 24 10:55:53 2015 +0200
regression-tests: remove pstree dependency from #25
pstree is a needless dependency, just use ps instead of it.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
regression-tests/tests/25/recipe1.xml | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/regression-tests/tests/25/recipe1.xml b/regression-tests/tests/25/recipe1.xml
index 8b9aee3..276061c 100644
--- a/regression-tests/tests/25/recipe1.xml
+++ b/regression-tests/tests/25/recipe1.xml
@@ -36,7 +36,7 @@
<run command="ping -c 4 {ip(tm2,phy1)}" host="tm1" netns="in"/>
<run command="ping {ip(tm2,phy1)}" host="tm1" netns="in" bg_id="on_bg"/>
<ctl_wait seconds="2"/>
- <run command="pstree -p" host="tm1" netns="in"/>
+ <run command="ps aux" host="tm1" netns="in"/>
<ctl_wait seconds="2"/>
<intr host="tm1" bg_id="on_bg"/>
</task>
8 years, 5 months
[PATCH] Config: add configuration of PerfRepo access
by Ondrej Lichtner
From: Ondrej Lichtner <olichtne(a)redhat.com>
Having the perfrepo access information in a configuration file means
that python tasks that use PerfRepo are more portable don't have to
contain usernames and passwords.
You can now call the connect_PerfRepo() method without arguments, it
will use what you've set in the configuration file.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
install/lnst-ctl.conf.in | 6 ++++++
lnst-ctl.conf | 5 +++++
lnst/Common/Config.py | 20 ++++++++++++++++++++
lnst/Controller/Task.py | 15 +++++++++++----
4 files changed, 42 insertions(+), 4 deletions(-)
diff --git a/install/lnst-ctl.conf.in b/install/lnst-ctl.conf.in
index 4d31483..ad0efc1 100644
--- a/install/lnst-ctl.conf.in
+++ b/install/lnst-ctl.conf.in
@@ -55,3 +55,9 @@ log_dir = @ctl_logs_dir@
# dynamic interface configuration. This feature is mostly used by LNST
# developers when testing new features.
allow_virtual = True
+
+# Optional section for configuring access to a PerfRepo instance
+#[perfrepo]
+#url =
+#username =
+#password =
diff --git a/lnst-ctl.conf b/lnst-ctl.conf
index d9a28e3..cc2e6b3 100644
--- a/lnst-ctl.conf
+++ b/lnst-ctl.conf
@@ -12,3 +12,8 @@ test_module_dirs = ./test_modules
log_dir = ./Logs
xslt_url = http://www.lnst-project.org/files/result_xslt/xml_to_html.xsl
allow_virtual = True
+
+[perfrepo]
+url =
+username =
+password =
diff --git a/lnst/Common/Config.py b/lnst/Common/Config.py
index fd43742..e6b600b 100644
--- a/lnst/Common/Config.py
+++ b/lnst/Common/Config.py
@@ -82,6 +82,26 @@ class Config():
"name" : "allow_virtual"
}
+ self._options['perfrepo'] = dict()
+ self._options['perfrepo']['url'] = {\
+ "value" : "",
+ "additive" : False,
+ "action" : self.optionPlain,
+ "name" : "url"
+ }
+ self._options['perfrepo']['username'] = {\
+ "value" : "",
+ "additive" : False,
+ "action" : self.optionPlain,
+ "name" : "username"
+ }
+ self._options['perfrepo']['password'] = {\
+ "value" : "",
+ "additive" : False,
+ "action" : self.optionPlain,
+ "name" : "password"
+ }
+
self.colours_scheme()
def slave_init(self):
diff --git a/lnst/Controller/Task.py b/lnst/Controller/Task.py
index be6b5cc..034dc5f 100644
--- a/lnst/Controller/Task.py
+++ b/lnst/Controller/Task.py
@@ -14,6 +14,7 @@ from lnst.Controller.PerfRepo import PerfRepoRESTAPI
from lnst.Controller.PerfRepo import PerfRepoTestExecution
from lnst.Controller.PerfRepo import PerfRepoValue
from lnst.Common.Utils import dot_to_dict, dict_to_dot, list_to_dot
+from lnst.Common.Config import lnst_config
# The handle to be imported from each task
ctl = None
@@ -102,9 +103,15 @@ class ControllerAPI(object):
"""
return self._ctl._get_alias(alias)
- def connect_PerfRepo(self, hostname, username, password):
+ def connect_PerfRepo(self, url=None, username=None, password=None):
if not self._perf_repo_api.connected():
- self._perf_repo_api.connect(hostname, username, password)
+ if url is None:
+ url = lnst_config.get_option("perfrepo", "url")
+ if username is None:
+ url = lnst_config.get_option("perfrepo", "username")
+ if password is None:
+ url = lnst_config.get_option("perfrepo", "password")
+ self._perf_repo_api.connect(url, username, password)
return self._perf_repo_api
def get_configuration(self):
@@ -454,8 +461,8 @@ class PerfRepoAPI(object):
def connected(self):
return self._rest_api is not None
- def connect(self, hostname, username, password):
- self._rest_api = PerfRepoRESTAPI(hostname, username, password)
+ def connect(self, url, username, password):
+ self._rest_api = PerfRepoRESTAPI(url, username, password)
def new_result(self, testUid, name):
result = PerfRepoResult(testUid, name)
--
2.1.0
8 years, 5 months
[PATCH] regression-tests: remove pstree dependency from #25
by Ondrej Lichtner
From: Ondrej Lichtner <olichtne(a)redhat.com>
pstree is a needless dependency, just use ps instead of it.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
regression-tests/tests/25/recipe1.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/regression-tests/tests/25/recipe1.xml b/regression-tests/tests/25/recipe1.xml
index 8b9aee3..276061c 100644
--- a/regression-tests/tests/25/recipe1.xml
+++ b/regression-tests/tests/25/recipe1.xml
@@ -36,7 +36,7 @@
<run command="ping -c 4 {ip(tm2,phy1)}" host="tm1" netns="in"/>
<run command="ping {ip(tm2,phy1)}" host="tm1" netns="in" bg_id="on_bg"/>
<ctl_wait seconds="2"/>
- <run command="pstree -p" host="tm1" netns="in"/>
+ <run command="ps aux" host="tm1" netns="in"/>
<ctl_wait seconds="2"/>
<intr host="tm1" bg_id="on_bg"/>
</task>
--
2.1.0
8 years, 5 months
Re: [lnst: 6/6] Cover letter for "PerfRepo support"
by Ondrej Lichtner
On Thu, Apr 23, 2015 at 04:10:49PM +0200, Jiri Pirko wrote:
> Thu, Apr 23, 2015 at 03:31:33PM CEST, olichtne(a)redhat.com wrote:
> >On Mon, Apr 20, 2015 at 12:39:03PM +0200, Ondrej Lichtner wrote:
> >> On Mon, Apr 20, 2015 at 11:35:44AM +0200, Jiri Pirko wrote:
> >> > Mon, Apr 20, 2015 at 10:38:05AM CEST, olichtne(a)redhat.com wrote:
> >> > >One thing I forgot... this adds a new dependency on a Python library
> >> > >'requests', on Fedora, this is installed by default, however on RHEL
> >> > >machines you need to install it using:
> >> > >yum install python-requests
> >> >
> >> > Will add this to the spec file. Thanks.
> >> >
> >> > Talking about this, are there any other dependencies that need to be
> >> > added there?
> >>
> >> I don't think so, but I'll try running a with clean virt machines just
> >> to be sure.
> >
> >
> >So I've tried this with lnst-slave on minimal RHEL6 and RHEL7 installs
> >and we need at least these:
> >tar
> >bzip2
> >gcc
> >bridge-utils
> >python-pyroute2
> >lxml
> >python-requests
> >
> >Tomorrow I'll try to run the Controller from a minimal install as well,
> >to see if anything else is missing
> >
> >
> >One of the regression tests also needs pstree which is a useless
> >dependency so I'll fix that separately.
> >
> >I also found that running a test with team configuration on RHEL6 leaves
> >lnst-slave in an inconsistent state (at least for a while), not an
> >important bug since you shouldn't be testing team on RHEL6, but I
> >definitely should look into it further.
>
> Thanks for the info Ondrej. Will adjust spec.
And 'make' forgot about that one... Tested the minimal Controller,
doesn't seem anything else needs to be added. So in the end it should be
something like this:
common:
tar
bzip2
python-pyroute2
controller:
python-lxml
python-requests
slave:
bridge-utils
gcc
make
gcc and make are listed as optional on the wiki, but when you want to
use test_tools they're pretty much unavoidable so I don't know... do we
add them to the spec or just keep the info on the wiki?
-Ondrej
8 years, 5 months