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_bonding.py | 5 +++++ src/conf_mode/vpp_interfaces_geneve.py | 4 ++++ src/conf_mode/vpp_interfaces_gre.py | 4 ++++ src/conf_mode/vpp_interfaces_ipip.py | 4 ++++ src/conf_mode/vpp_interfaces_loopback.py | 4 ++++ src/conf_mode/vpp_interfaces_vxlan.py | 4 ++++ 6 files changed, 25 insertions(+) (limited to 'src') diff --git a/src/conf_mode/vpp_interfaces_bonding.py b/src/conf_mode/vpp_interfaces_bonding.py index 135be5c04..9f8133cfa 100644 --- a/src/conf_mode/vpp_interfaces_bonding.py +++ b/src/conf_mode/vpp_interfaces_bonding.py @@ -17,6 +17,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. import os +import time from vyos.config import Config from vyos.configdict import leaf_node_changed @@ -192,6 +193,10 @@ def apply(config): kernel_interface = config.get('kernel_interface', '') i = BondInterface(ifname, mode, lb, mac, 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.add() # Add members to bond if members: diff --git a/src/conf_mode/vpp_interfaces_geneve.py b/src/conf_mode/vpp_interfaces_geneve.py index a7e7ae8e5..17e0f0cfb 100644 --- a/src/conf_mode/vpp_interfaces_geneve.py +++ b/src/conf_mode/vpp_interfaces_geneve.py @@ -17,6 +17,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. import os +import time from vyos import ConfigError @@ -164,6 +165,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() diff --git a/src/conf_mode/vpp_interfaces_gre.py b/src/conf_mode/vpp_interfaces_gre.py index f86d59087..feff0d6b5 100644 --- a/src/conf_mode/vpp_interfaces_gre.py +++ b/src/conf_mode/vpp_interfaces_gre.py @@ -17,6 +17,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. import os +import time from vyos import ConfigError @@ -163,6 +164,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() diff --git a/src/conf_mode/vpp_interfaces_ipip.py b/src/conf_mode/vpp_interfaces_ipip.py index 6de34e794..e15eaf5e5 100644 --- a/src/conf_mode/vpp_interfaces_ipip.py +++ b/src/conf_mode/vpp_interfaces_ipip.py @@ -17,6 +17,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. import os +import time from vyos import ConfigError @@ -162,6 +163,9 @@ def apply(config): i.add() if 'kernel_interface' in config: + # 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() 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() diff --git a/src/conf_mode/vpp_interfaces_vxlan.py b/src/conf_mode/vpp_interfaces_vxlan.py index a8a918805..de3114124 100644 --- a/src/conf_mode/vpp_interfaces_vxlan.py +++ b/src/conf_mode/vpp_interfaces_vxlan.py @@ -17,6 +17,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. import os +import time from vyos import ConfigError @@ -169,6 +170,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