On Thu, Sep 15, 2016 at 05:44:46PM +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()
> +
Why not also export the disable_lldpad() method? What if, for some
reason, you want to disable the daemon during the test?
I simply preferred not to export a function nobody calls from outside. I
don't have a strong opinion about this, so just let me know if you want
this changed.
Thanks
>
> > 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
> > +
> > 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...