Tue, Mar 14, 2017 at 02:04:15PM CET, petrm(a)mellanox.com wrote:
Add a very lightweight helper for handling tc qdiscs.
Signed-off-by: Petr Machata <petrm(a)mellanox.com>
---
recipes/switchdev/TestLib.py | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/recipes/switchdev/TestLib.py b/recipes/switchdev/TestLib.py
index d6b8fa7..a68b570 100644
--- a/recipes/switchdev/TestLib.py
+++ b/recipes/switchdev/TestLib.py
@@ -1,5 +1,5 @@
"""
-Copyright 2016 Mellanox Technologies. All rights reserved.
+Copyright 2016-2017 Mellanox Technologies. All rights reserved.
Licensed under the GNU General Public License, version 2 as
published by the Free Software Foundation; see COPYING for details.
"""
@@ -466,3 +466,22 @@ class TestLib:
err_msg = "got {} packets, expected {}".format(count, expected)
return self.custom(iface.get_host(), desc, err_msg)
+
+class Qdisc:
+ def __init__(self, iface, handle, qdisc):
+ self._ifname = iface.get_devname()
+ self._machine = iface.get_host()
+ self._handle = handle
+ self.run("tc qdisc add dev %s handle %x: %s"
+ % (self._ifname, self._handle, qdisc))
+
+ def filter_add(self, f):
+ self.run("tc filter add dev %s parent %x: %s"
+ % (self._ifname, self._handle, f))
+
+ def flush(self):
This certainly does not sound like a "flush"
Why this is not "filter_del" ?
>+ self.run("tc filter del dev %s parent %x:"
>+ % (self._ifname, self._handle))
>+
>+ def run(self, command):
>+ self._machine.run(command)
>--
>2.6.2
>_______________________________________________
>LNST-developers mailing list -- lnst-developers(a)lists.fedorahosted.org
>To unsubscribe send an email to lnst-developers-leave(a)lists.fedorahosted.org