From 9aeb60ad983451ce49f4a53af2b76c2e7348c03b Mon Sep 17 00:00:00 2001 From: Pim van Pelt Date: Fri, 25 Mar 2022 14:15:40 +0000 Subject: [PATCH] Also bring down BVIs and Loopbacks if they do not exist in the config --- vpp/reconciler.py | 2 +- vpp/vppapi.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/vpp/reconciler.py b/vpp/reconciler.py index 9152c2b..d277a3e 100644 --- a/vpp/reconciler.py +++ b/vpp/reconciler.py @@ -425,7 +425,7 @@ class Reconciler(): def prune_interfaces_down(self): """ Set admin-state down for all interfaces that are not in the config. """ - for ifname in self.vpp.get_qinx_interfaces() + self.vpp.get_dot1x_interfaces() + self.vpp.get_bondethernets() + self.vpp.get_vxlan_tunnels() + self.vpp.get_phys(): + for ifname in self.vpp.get_qinx_interfaces() + self.vpp.get_dot1x_interfaces() + self.vpp.get_bondethernets() + self.vpp.get_phys() + self.vpp.get_vxlan_tunnels() + self.vpp.get_bvis() + self.vpp.get_loopbacks(): if not ifname in interface.get_interfaces(self.cfg): iface = self.vpp.config['interface_names'][ifname] if iface.flags & 1: # IF_STATUS_API_FLAG_ADMIN_UP diff --git a/vpp/vppapi.py b/vpp/vppapi.py index f62bd3d..bbe2db2 100644 --- a/vpp/vppapi.py +++ b/vpp/vppapi.py @@ -151,6 +151,14 @@ class VPPApi(): dot1x_subints = [self.config['interfaces'][x].interface_name for x in self.config['interfaces'] if self.config['interfaces'][x].interface_dev_type in ['dpdk','bond'] and self.config['interfaces'][x].sub_id>0 and self.config['interfaces'][x].sub_inner_vlan_id==0] return dot1x_subints + def get_loopbacks(self): + loopbacks = [self.config['interfaces'][x].interface_name for x in self.config['interfaces'] if self.config['interfaces'][x].interface_dev_type=='Loopback'] + return loopbacks + + def get_bvis(self): + bvis = [self.config['interfaces'][x].interface_name for x in self.config['interfaces'] if self.config['interfaces'][x].interface_dev_type=='BVI'] + return bvis + def get_phys(self): phys = [self.config['interfaces'][x].interface_name for x in self.config['interfaces'] if self.config['interfaces'][x].interface_dev_type=='dpdk' and self.config['interfaces'][x].sub_id==0] return phys