From 405d3ee7ac909bbf458f522e6539a1f4eacdf7e6 Mon Sep 17 00:00:00 2001 From: Viacheslav Hletenko Date: Wed, 15 Jan 2025 09:50:49 +0000 Subject: warning: introduce a delay between add() and kernel_add() Introduce a delay to address instability in the VPP API, which may fail to create the LCP or establish a connection. This should be reviewed and resolved in future releases. This fixes confgurations with included kernel-itnerface (LCP) And all smoketests Example: set interfaces ethernet eth1 address '192.0.2.1/30' set vpp settings interface eth1 driver 'dpdk' set vpp interfaces vxlan vxlan10 remote '192.0.2.2' set vpp interfaces vxlan vxlan10 source-address '192.0.2.1' set vpp interfaces vxlan vxlan10 vni '10' set vpp interfaces vxlan vxlan10 kernel-interface 'vpptap10' Without this delay we get: vyos@r14# commit [ vpp interfaces vxlan vxlan10 ] Traceback (most recent call last): File "/usr/libexec/vyos/services/vyos-configd", line 139, in run_script script.apply(c) File "/usr/libexec/vyos//conf_mode/vpp_interfaces_vxlan.py", line 174, in apply i.kernel_add() File "/usr/lib/python3/dist-packages/vyos/vpp/interface/vxlan.py", line 85, in kernel_add self.vpp.lcp_pair_add(self.ifname, self.kernel_interface) File "/usr/lib/python3/dist-packages/vyos/vpp/control_vpp.py", line 79, in check_retval_wrapper return_value = decorated_func(cls, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/vyos/vpp/control_vpp.py", line 58, in api_safe_wrapper return decorated_func(cls, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/vyos/vpp/control_vpp.py", line 188, in lcp_pair_add return self.__vpp_api_client.api.lcp_itf_pair_add_del_v2(**api_call_args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/vpp_papi/vpp_papi.py", line 129, in __call__ return self._func(**kwargs) ^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/vpp_papi/vpp_papi.py", line 564, in f return self._call_vpp(i, msg, multipart, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/vpp_papi/vpp_papi.py", line 853, in _call_vpp raise VPPIOError(2, "VPP API client: read failed") vpp_papi.vpp_papi.VPPIOError: [Errno 2] VPP API client: read failed --- src/conf_mode/vpp_interfaces_loopback.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/conf_mode/vpp_interfaces_loopback.py') diff --git a/src/conf_mode/vpp_interfaces_loopback.py b/src/conf_mode/vpp_interfaces_loopback.py index 56a825ae6..a96c379a1 100644 --- a/src/conf_mode/vpp_interfaces_loopback.py +++ b/src/conf_mode/vpp_interfaces_loopback.py @@ -17,6 +17,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. import os +import time from vyos import ConfigError @@ -134,6 +135,9 @@ def apply(config): # Add kernel-interface (LCP) if interface is not exist if 'kernel_interface' in config and not is_interface(kernel_interface): + # Introduce a delay to address instability in the VPP API, which may fail to create the LCP + # or establish a connection. This should be reviewed and resolved in future releases. + time.sleep(2) i.kernel_add() call_dependents() -- cgit v1.2.3