summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorzdc <taras@vyos.io>2025-06-18 11:51:34 +0300
committerzdc <taras@vyos.io>2025-06-18 12:05:08 +0300
commit516ea43279d750272be398a27948049581b22630 (patch)
tree4133188548f6012e889ff346803afb348432cc0a /python
parentaab8c6f8c69e2ca0381ae5874c591197dcae36a9 (diff)
downloadvyos-1x-516ea43279d750272be398a27948049581b22630.tar.gz
vyos-1x-516ea43279d750272be398a27948049581b22630.zip
XDP/Mellanox: T7223: Fixed interfaces initialization
For the XDP driver and Mellanox NIC, we create `defunct_*` interfaces to hide original interfaces from CLI, when they are replaced with VPP-enabled pairs. But sometimes IP addresses are not flushed from these `defunct_*` interfaces, which leads to broken routing afterward. This commit introduces an additional flush operation for `defunct_*` interfaces to ensure that they do not conflict with VPP interfaces.
Diffstat (limited to 'python')
-rw-r--r--python/vyos/vpp/control_host.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/python/vyos/vpp/control_host.py b/python/vyos/vpp/control_host.py
index ead9f6968..1ac004fbb 100644
--- a/python/vyos/vpp/control_host.py
+++ b/python/vyos/vpp/control_host.py
@@ -21,6 +21,8 @@ from re import fullmatch as re_fullmatch
from subprocess import run
from time import sleep
+from pyroute2 import IPRoute
+
from vyos.vpp.utils import EthtoolGDrvinfo
@@ -361,3 +363,13 @@ def set_status(iface_name: str, status: str) -> None:
status (str): status - "up" or "down"
"""
run(['ip', 'link', 'set', iface_name, status])
+
+
+def flush_ip(iface_name: str) -> None:
+ """Flush IP addresses from an interface
+
+ Args:
+ iface_name (str): name of an interface
+ """
+ iproute = IPRoute()
+ iproute.flush_addr(label=iface_name)