From 31ba9f00628da7da4339b4cdc2d208e06d686092 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Thu, 18 Jan 2024 17:11:23 +0100 Subject: ethernet: T4638: deleting parent interface does not delete underlying VIFs (cherry picked from commit 7ba47f027f3a9441125c13a927eb23cee2de041b) --- python/vyos/ifconfig/ethernet.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/python/vyos/ifconfig/ethernet.py b/python/vyos/ifconfig/ethernet.py index c9fa6ea8b..3fe54d7bf 100644 --- a/python/vyos/ifconfig/ethernet.py +++ b/python/vyos/ifconfig/ethernet.py @@ -19,6 +19,7 @@ import re from glob import glob from vyos.ethtool import Ethtool +from vyos.ifconfig import Section from vyos.ifconfig.interface import Interface from vyos.util import run from vyos.util import dict_search @@ -91,6 +92,10 @@ class EthernetIf(Interface): # will remain visible for the operating system. self.set_admin_state('down') + # Remove all VLAN subinterfaces - filter with the VLAN dot + for vlan in [x for x in Section.interfaces(self.iftype) if x.startswith(f'{self.ifname}.')]: + Interface(vlan).remove() + super().remove() def set_flow_control(self, enable): -- cgit v1.2.3