From 00ae14186c5292c04766321d02fc7f82668ee066 Mon Sep 17 00:00:00 2001 From: Martin Klozik Date: Fri, 17 Mar 2017 09:32:53 +0000 Subject: vpp: Reporting update related to VPP VSPERF reports were updated to contain vSwitch name. In case of VPP, it is not possible to read its version if VPP is not running. Thus VSPERF was enhanced to support tool version check during its runtime. This mechanism can be enhanced to support e.g. VNF in the future. JIRA: VSPERF-496 Change-Id: I74b47505e35340eead165d9b588e9cc15c058bbf Signed-off-by: Martin Klozik Reviewed-by: Al Morton Reviewed-by: Christian Trautman Reviewed-by: Sridhar Rao Reviewed-by: Trevor Cooper --- vswitches/ovs.py | 8 ++++++++ vswitches/vpp_dpdk_vhost.py | 21 ++++++++++++++++++++- vswitches/vswitch.py | 8 ++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) (limited to 'vswitches') diff --git a/vswitches/ovs.py b/vswitches/ovs.py index b6d64fb7..12620e22 100644 --- a/vswitches/ovs.py +++ b/vswitches/ovs.py @@ -95,6 +95,14 @@ class IVSwitchOvs(IVSwitch, tasks.Process): """ pass + # Method could be a function + # pylint: disable=no-self-use + def get_version(self): + """See IVswitch for general description + """ + # OVS version can be read offline + return [] + def stop(self): """See IVswitch for general description """ diff --git a/vswitches/vpp_dpdk_vhost.py b/vswitches/vpp_dpdk_vhost.py index d0d9e2ac..68375538 100644 --- a/vswitches/vpp_dpdk_vhost.py +++ b/vswitches/vpp_dpdk_vhost.py @@ -25,6 +25,7 @@ from src.dpdk import dpdk from conf import settings as S from vswitches.vswitch import IVSwitch from tools import tasks +from tools.version import Version # pylint: disable=too-many-public-methods class VppDpdkVhost(IVSwitch, tasks.Process): @@ -110,7 +111,6 @@ class VppDpdkVhost(IVSwitch, tasks.Process): self._logger.debug("VPP CLI args: %s", cli_args) return cli_args - def start(self): """Activates DPDK kernel modules and starts VPP @@ -156,6 +156,25 @@ class VppDpdkVhost(IVSwitch, tasks.Process): # has not been terminated yet tasks.Process.kill(self, signal, sleep) + def get_version(self): + """See IVswitch for general description + """ + versions = [] + output = self.run_vppctl(['show', 'version', 'verbose']) + if output[1]: + self._logger.warning("VPP version can not be read!") + return versions + + match = re.search(r'Version:\s*(.+)', output[0]) + if match: + versions.append(Version(S.getValue('VSWITCH'), match.group(1))) + + match = re.search(r'DPDK Version:\s*DPDK (.+)', output[0]) + if match: + versions.append(Version('dpdk', match.group(1))) + + return versions + def add_switch(self, switch_name, dummy_params=None): """See IVswitch for general description """ diff --git a/vswitches/vswitch.py b/vswitches/vswitch.py index 893bd1ff..dd69e6d9 100644 --- a/vswitches/vswitch.py +++ b/vswitches/vswitch.py @@ -20,6 +20,14 @@ class IVSwitch(object): Other methods are called only between start() and stop() """ + def get_version(self): + """Return version of vSwitch and DPDK (if used by vSwitch) + This method should be implemented in case, that version + of vswitch or DPDK can be read only during vSwitch runtime. + Otherwise it can be implemented inside tools/systeminfo.py. + """ + raise NotImplementedError() + def start(self): """Start the vSwitch -- cgit 1.2.3-korg