On Thu, Sep 15, 2016 at 05:50:38PM +0200, Ondrej Lichtner wrote:
On Thu, Sep 15, 2016 at 10:42:14AM +0300, idosch(a)idosch.org wrote:
> From: Ido Schimmel <idosch(a)mellanox.com>
>
> QoS recipes are going to require LLDP support in order to test
> functionality such as priority flow control (PFC) and enhanced
> transmission selection (ETS).
>
> Enable the lldpad daemon when invoked via m.enable_lldpad() in a task
> and disable it during clean up, if it was enabled as part of the recipe.
>
> Later patches in the series will introduce per-interface methods to
> configure PFC and ETS.
>
> Signed-off-by: Ido Schimmel <idosch(a)mellanox.com>
> ---
> lnst/Controller/Machine.py | 16 ++++++++++++++++
> lnst/Controller/Task.py | 3 +++
> lnst/Slave/NetTestSlave.py | 8 ++++++++
> 3 files changed, 27 insertions(+)
>
> diff --git a/lnst/Controller/Machine.py b/lnst/Controller/Machine.py
> index 70295ba..a2a42d4 100644
> --- a/lnst/Controller/Machine.py
> +++ b/lnst/Controller/Machine.py
> @@ -334,6 +334,11 @@ class Machine(object):
>
> self.del_namespaces()
>
> + # Interface teardown requires LLDP to be enabled for the
> + # changes to take effect, so disable it afterwards.
> + if self.get_lldpad_status():
> + self.disable_lldpad()
> +
> self.restore_nm_option()
> self._rpc_call("bye")
> except:
> @@ -578,6 +583,17 @@ class Machine(object):
> def get_security(self):
> return self._security
>
> + def enable_lldpad(self):
> + self._rpc_call("enable_lldpad")
> + self._lldpad = True
> +
> + def disable_lldpad(self):
> + self._lldpad = False
> + self._rpc_call("disable_lldpad")
> +
> + def get_lldpad_status(self):
> + return self._lldpad
> +
> class Interface(object):
> """ Abstraction of a test network interface on a slave machine
>
> diff --git a/lnst/Controller/Task.py b/lnst/Controller/Task.py
> index f9a15f2..889eec7 100644
> --- a/lnst/Controller/Task.py
> +++ b/lnst/Controller/Task.py
> @@ -489,6 +489,9 @@ class HostAPI(object):
>
> return self._add_iface("vxlan", if_id, netns, ip, options,
slaves)
>
> + def enable_lldpad(self):
> + self._m.enable_lldpad()
> +
> class DeviceAPI(object):
> def __init__(self, net_device, host):
> self._dev = net_device
> diff --git a/lnst/Slave/NetTestSlave.py b/lnst/Slave/NetTestSlave.py
> index f0b3183..6d83be9 100644
> --- a/lnst/Slave/NetTestSlave.py
> +++ b/lnst/Slave/NetTestSlave.py
> @@ -903,6 +903,14 @@ class SlaveMethods:
> return False
> return True
>
> + def enable_lldpad(self):
> + exec_cmd("service lldpad start")
> + return True
> +
> + def disable_lldpad(self):
> + exec_cmd("service lldpad stop")
> + return True
> +
Will this also work correctly on systemd systems? I'm not sure if the
sysv<->systemd translation scripts are still available/installed by
default.
Maybe calling either "sytemctl start" or "service start" based on
the
current system would make more sense.
Well, I ran the recipes on a systemd system (Fedora), so yes. Also,
Fedora wiki says this:
"Note on 'service' and 'chkconfig' commands
The 'service' and 'chkconfig' commands will mostly continue to work as
expected in the systemd world, this guide is how to use the native
systemctl replacements."
https://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet
I guess it's fine.
Regarding to why I chose to use 'service' instead of 'systemctl', then
it's because I already saw other LNST parts are using it. See
recipes/regression_tests/phase1/3_vlans.py for example
Whereas:
$ git grep -n 'systemctl' | wc -l
0
Thanks
>
>
> > class ServerHandler(ConnectionHandler):
> > def __init__(self, addr):
> > super(ServerHandler, self).__init__()
> > --
> > 2.7.4
> > _______________________________________________
> > LNST-developers mailing list
> > lnst-developers(a)lists.fedorahosted.org
> >
https://lists.fedorahosted.org/admin/lists/lnst-developers@lists.fedoraho...