From 05b4d8467e827db099832e560e3a801466b9417e Mon Sep 17 00:00:00 2001 From: Dave Wallace Date: Wed, 15 Jan 2020 06:29:16 +0000 Subject: perf: Add hoststack NSIM+LDPRELOAD+IPERF3 test suite Change-Id: Ia7a876b1aa240676e1f2d23618c1d4e09ead14f0 Signed-off-by: Dave Wallace (cherry picked from commit d79b753c1fde3cd831f60ac5cc0034f613c44b43) --- resources/libraries/python/NsimUtil.py | 17 +++++++---------- resources/libraries/python/VppConfigGenerator.py | 5 +++++ resources/libraries/python/autogen/Regenerator.py | 10 ++++++---- resources/libraries/robot/hoststack/hoststack.robot | 8 +++++++- 4 files changed, 25 insertions(+), 15 deletions(-) (limited to 'resources/libraries') diff --git a/resources/libraries/python/NsimUtil.py b/resources/libraries/python/NsimUtil.py index 9d60a911b1..bd319e668e 100644 --- a/resources/libraries/python/NsimUtil.py +++ b/resources/libraries/python/NsimUtil.py @@ -13,14 +13,11 @@ """VPP Network Simulator Plugin util library.""" -from robot.api import logger - -from resources.libraries.python.Constants import Constants from resources.libraries.python.PapiExecutor import PapiSocketExecutor from resources.libraries.python.InterfaceUtil import InterfaceUtil -class NsimUtil(object): +class NsimUtil(): """VPP NSIM Plugin Keywords.""" @staticmethod @@ -33,14 +30,14 @@ class NsimUtil(object): :param interface1: 2nd Interface name for cross-connect feature :type node: dict :type vpp_nsim_attr: dict - :type interface0: string or int - :type interface1: string or int + :type interface0: str or int + :type interface1: str or int :raises RuntimeError: if no NSIM features are enabled or vpp papi command fails. """ host = node[u"host"] - if vpp_nsim_attr[u"output_feature_enable"] == False \ - and vpp_nsim_attr[u"cross_connect_feature_enable"] == False: + if not vpp_nsim_attr[u"output_feature_enable"] \ + and not vpp_nsim_attr[u"cross_connect_feature_enable"]: raise RuntimeError(f"No NSIM features enabled on host {host}:\n" f"vpp_nsim_attr = {vpp_nsim_attr}") cmd = u"nsim_configure" @@ -56,7 +53,7 @@ class NsimUtil(object): with PapiSocketExecutor(node) as papi_exec: papi_exec.add(cmd, **args).get_reply(err_msg) - if vpp_nsim_attr[u"output_feature_enable"] == True: + if vpp_nsim_attr[u"output_feature_enable"]: cmd = u"nsim_output_feature_enable_disable" args = dict( enable_disable=vpp_nsim_attr[u"output_feature_enable"], @@ -67,7 +64,7 @@ class NsimUtil(object): with PapiSocketExecutor(node) as papi_exec: papi_exec.add(cmd, **args).get_reply(err_msg) - elif vpp_nsim_attr[u"cross_connect_feature_enable"] == True: + elif vpp_nsim_attr[u"cross_connect_feature_enable"]: cmd = u"nsim_cross_connect_feature_enable_disable" args = dict( enable_disable=vpp_nsim_attr[u"cross_connect_feature_enable"], diff --git a/resources/libraries/python/VppConfigGenerator.py b/resources/libraries/python/VppConfigGenerator.py index 7a687ae200..b769b89acd 100644 --- a/resources/libraries/python/VppConfigGenerator.py +++ b/resources/libraries/python/VppConfigGenerator.py @@ -495,6 +495,11 @@ class VppConfigGenerator: path = [u"nat"] self.add_config_item(self._nodeconfig, value, path) + def add_nsim_poll_main_thread(self): + """Add NSIM poll-main-thread configuration.""" + path = [u"nsim", u"poll-main-thread"] + self.add_config_item(self._nodeconfig, u"", path) + def add_tcp_congestion_control_algorithm(self, value=u"cubic"): """Add TCP congestion control algorithm. diff --git a/resources/libraries/python/autogen/Regenerator.py b/resources/libraries/python/autogen/Regenerator.py index f065887da0..3ef4e8554d 100644 --- a/resources/libraries/python/autogen/Regenerator.py +++ b/resources/libraries/python/autogen/Regenerator.py @@ -512,10 +512,12 @@ class Regenerator: elif in_filename[-10:] in (u"-cps.robot", u"-rps.robot"): write_tcp_files(in_filename, in_prolog, hoststack_wrk_kwargs_list) - elif in_filename[-10:] in u"-bps.robot": - write_tcp_files(in_filename, in_prolog, - hoststack_iperf3_kwargs_list if u"iperf3" - in in_filename else hoststack_quic_kwargs_list) + elif in_filename[-10:] in (u"-bps.robot"): + if u"ldpreload-iperf3" in in_filename: + hoststack_kwargs_list = hoststack_iperf3_kwargs_list + else: + hoststack_kwargs_list = hoststack_quic_kwargs_list + write_tcp_files(in_filename, in_prolog, hoststack_kwargs_list) else: raise RuntimeError( f"Error in {in_filename}: non-primary suite type found." diff --git a/resources/libraries/robot/hoststack/hoststack.robot b/resources/libraries/robot/hoststack/hoststack.robot index e765169e32..16a390aeb8 100644 --- a/resources/libraries/robot/hoststack/hoststack.robot +++ b/resources/libraries/robot/hoststack/hoststack.robot @@ -386,7 +386,10 @@ | | | ... | ${namespace} | ${core_list} | ${cfg_vpp_feature} | | | ... | ${test_program} | | -| | Run Keyword If | ${vpp_nsim_attr}[output_feature_enable] +| | ${is_dut1}= | Run Keyword And Return Status +| | ... | Dictionaries should be equal | ${node} | ${dut1} +| | Run Keyword If +| | ... | ${is_dut1} and ${vpp_nsim_attr}[output_feature_enable] | | ... | Configure VPP NSIM | ${node} | ${vpp_nsim_attr} | ${intf} | | Run Keyword If | '${cfg_vpp_feature}' != '' | | ... | Additional VPP Config for Feature ${cfg_vpp_feature} | ${node} @@ -428,6 +431,9 @@ | | | ... | ${vpp_hoststack_attr}[api_seg_global_size] | | | Run keyword | ${dut}.Add api segment api size | | | ... | ${vpp_hoststack_attr}[api_seg_api_size] +| | | Run Keyword If +| | | ... | '${dut}' == 'DUT1' and ${vpp_nsim_attr}[output_feature_enable] +| | | ... | ${dut}.Add Nsim poll main thread | | | Run keyword | ${dut}.Add api segment gid | testuser | | | Run keyword | ${dut}.Add tcp congestion control algorithm | | | ... | ${vpp_hoststack_attr}[tcp_cc_algo] -- cgit 1.2.3-korg