diff options
author | 2025-02-05 14:45:31 +0100 | |
---|---|---|
committer | 2025-02-05 14:45:31 +0100 | |
commit | d9701475f4a4809eb8b32ea04a9c05e2cf74ee94 (patch) | |
tree | c48558289c8643d57880a72454bb88a65a4a5d93 /resources | |
parent | 528fa294d4e60c6c9dbc122057f95160a3becd8a (diff) |
fix(hoststack): Base ldpreload path on CPU arch
Without this, Nginx drop all packets on 2n-grc.
+ Also fix iperf3, even though we do not have working 3n ARM testbed.
- If something else breaks Nginx, failed requests still count as real.
Change-Id: Ib8d13986d2d58aaf3f63e70152bec45b303475f0
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Diffstat (limited to 'resources')
-rw-r--r-- | resources/libraries/python/Constants.py | 5 | ||||
-rw-r--r-- | resources/libraries/python/HoststackUtil.py | 38 | ||||
-rw-r--r-- | resources/libraries/robot/hoststack/hoststack.robot | 6 |
3 files changed, 37 insertions, 12 deletions
diff --git a/resources/libraries/python/Constants.py b/resources/libraries/python/Constants.py index 4646ae3c5d..6a7b81b70d 100644 --- a/resources/libraries/python/Constants.py +++ b/resources/libraries/python/Constants.py @@ -155,8 +155,9 @@ class Constants: # VPP Communications Library templates location RESOURCES_TPL_TELEMETRY = "resources/templates/telemetry" - # VPP Communications Library LD_PRELOAD library - VCL_LDPRELOAD_LIBRARY = "/usr/lib/x86_64-linux-gnu/libvcl_ldpreload.so" + # VPP Communications Library LD_PRELOAD library. + # Set to override, keep empty for autodetection based on architecture. + VCL_LDPRELOAD_LIBRARY = "" # VPP service unit name VPP_UNIT = "vpp" diff --git a/resources/libraries/python/HoststackUtil.py b/resources/libraries/python/HoststackUtil.py index 4ac73ff924..3ada07b2a4 100644 --- a/resources/libraries/python/HoststackUtil.py +++ b/resources/libraries/python/HoststackUtil.py @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Cisco and/or its affiliates. +# Copyright (c) 2025 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -12,8 +12,10 @@ # limitations under the License. """Host Stack util library.""" + import json from time import sleep + from robot.api import logger from resources.libraries.python.Constants import Constants @@ -23,11 +25,29 @@ from resources.libraries.python.model.ExportResult import ( ) from resources.libraries.python.PapiExecutor import PapiSocketExecutor from resources.libraries.python.ssh import exec_cmd, exec_cmd_no_error +from resources.libraries.python.topology import Topology class HoststackUtil(): """Utilities for Host Stack tests.""" @staticmethod + def _get_ldpreload_path(node): + """Return the absolute path to VCL LD_PRELOAD library. + + If Constants override the path, return that. + Otherwise return the default pattern, with arch value from topology. + + :param node: Topology node to decide architecture. + :type node: dict + :returns: Path to correct VCL preload library. + :rtype: str + """ + if ret := Constants.VCL_LDPRELOAD_LIBRARY: + return ret + arch = Topology.get_node_arch(node) + return f"/usr/lib/{arch}-linux-gnu/libvcl_ldpreload.so" + + @staticmethod def get_vpp_echo_command(vpp_echo_attributes): """Construct the vpp_echo command using the specified attributes. @@ -64,11 +84,13 @@ class HoststackUtil(): return vpp_echo_cmd @staticmethod - def get_iperf3_command(iperf3_attributes): + def get_iperf3_command(iperf3_attributes, node): """Construct the iperf3 command using the specified attributes. :param iperf3_attributes: iperf3 test program attributes. + :param node: Topology node (architecture implies ldpreload path). :type iperf3_attributes: dict + :type node: dict :returns: Command line components of the iperf3 command 'env_vars' - environment variables 'name' - program name @@ -80,8 +102,8 @@ class HoststackUtil(): f"{Constants.RESOURCES_TPL_VCL}/" \ f"{iperf3_attributes[u'vcl_config']}" if iperf3_attributes[u"ld_preload"]: - iperf3_cmd[u"env_vars"] += \ - f" LD_PRELOAD={Constants.VCL_LDPRELOAD_LIBRARY}" + ldpreload = HoststackUtil._get_ldpreload_path(node) + iperf3_cmd[u"env_vars"] += f" LD_PRELOAD={ldpreload}" if iperf3_attributes[u'transparent_tls']: iperf3_cmd[u"env_vars"] += u" LDP_ENV_TLS_TRANS=1" @@ -195,15 +217,17 @@ class HoststackUtil(): return program_stdout_log, program_stderr_log @staticmethod - def get_nginx_command(nginx_attributes, nginx_version, nginx_ins_dir): + def get_nginx_command(nginx_attributes, nginx_version, nginx_ins_dir, node): """Construct the NGINX command using the specified attributes. :param nginx_attributes: NGINX test program attributes. :param nginx_version: NGINX version. :param nginx_ins_dir: NGINX install dir. + :param node: Topology node (architecture implies ldpreload path). :type nginx_attributes: dict :type nginx_version: str :type nginx_ins_dir: str + :type node: dict :returns: Command line components of the NGINX command 'env_vars' - environment variables 'name' - program name @@ -216,8 +240,8 @@ class HoststackUtil(): f"{Constants.RESOURCES_TPL_VCL}/" \ f"{nginx_attributes[u'vcl_config']}" if nginx_attributes[u"ld_preload"]: - nginx_cmd[u"env_vars"] += \ - f" LD_PRELOAD={Constants.VCL_LDPRELOAD_LIBRARY}" + ldpreload = HoststackUtil._get_ldpreload_path(node) + nginx_cmd[u"env_vars"] += f" LD_PRELOAD={ldpreload}" if nginx_attributes[u'transparent_tls']: nginx_cmd[u"env_vars"] += u" LDP_ENV_TLS_TRANS=1" diff --git a/resources/libraries/robot/hoststack/hoststack.robot b/resources/libraries/robot/hoststack/hoststack.robot index d5cbd0bce0..643a67cd85 100644 --- a/resources/libraries/robot/hoststack/hoststack.robot +++ b/resources/libraries/robot/hoststack/hoststack.robot @@ -544,7 +544,7 @@ | | Set To Dictionary | ${iperf3_client_attr} | ip_address | | ... | ${dut2_if1_ip4_addr} | | Configure VPP Hoststack Attributes on all DUTs -| | ${iperf3_server}= | Get Iperf3 Command | ${iperf3_server_attr} +| | ${iperf3_server}= | Get Iperf3 Command | ${iperf3_server_attr} | ${dut2} | | ${skip_cnt}= | Evaluate | | ... | ${CPU_CNT_SYSTEM} + ${CPU_CNT_MAIN} + ${vpp_hoststack_attr}[phy_cores] | | ${numa}= | Get interfaces numa node | ${dut2} | ${dut2_if1} @@ -557,7 +557,7 @@ | | ... | ${dut2} | ${dut2_if1} | ${dut2_if1_ip4_addr} | ${dut2_if1_ip4_prefix} | | ... | ${iperf3_server_attr}[namespace] | ${core_list} | | ... | ${iperf3_server_attr}[cfg_vpp_feature] | ${iperf3_server} -| | ${iperf3_client}= | Get Iperf3 Command | ${iperf3_client_attr} +| | ${iperf3_client}= | Get Iperf3 Command | ${iperf3_client_attr} | ${dut1} | | ${numa}= | Get interfaces numa node | ${dut1} | ${dut1_if1} | | ${core_list}= | Cpu list per node str | ${dut1} | ${numa} | | ... | skip_cnt=${skip_cnt} | cpu_cnt=${iperf3_client_attr}[cpu_cnt] @@ -619,7 +619,7 @@ | | ${cpu_idle_list}= | Get Slice From List | ${cpu_idle} | | ... | ${${skip_cnt} + ${attr}[cpu_cnt]} | | ${nginx_server}= | Get Nginx Command | ${attr} -| | ... | ${nginx_version} | ${packages_dir} +| | ... | ${nginx_version} | ${packages_dir} | ${DUT1} | | Start Hoststack Test Program | | ... | ${DUT1} | ${attr}[namespace] | ${core_list} | | ... | ${nginx_server} |