From f01c865c8728b8f3c56c63318bbac51325583820 Mon Sep 17 00:00:00 2001 From: Pim van Pelt Date: Sun, 7 Apr 2024 23:36:30 +0200 Subject: [PATCH] Emit config for loopbacks before interfaces This is in preparation of moving to OSPFv3 on VPP. > If no primary address exists for the interface selected, then the > primary address of the first non-loopback interface that has one will be > used regardless of this setting. To to ensure that for IPv4-less transit networks, the loopback address is chosen, make it the first interface (notably by ensuring that 'lcp create' for the loopback interfaces comes before that of PHY and sub-ints). --- vppcfg/vpp/reconciler.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/vppcfg/vpp/reconciler.py b/vppcfg/vpp/reconciler.py index b163974..6797044 100644 --- a/vppcfg/vpp/reconciler.py +++ b/vppcfg/vpp/reconciler.py @@ -906,7 +906,7 @@ class Reconciler: ] ## First create untagged ... - for ifname in interface.get_interfaces(self.cfg) + loopback.get_loopbacks( + for ifname in loopback.get_loopbacks(self.cfg) + interface.get_interfaces( self.cfg ): if interface.is_sub(self.cfg, ifname): @@ -1195,7 +1195,7 @@ class Reconciler: tag_list = [0, 1, 2] for numtags in tag_list: - for ifname in interface.get_interfaces(self.cfg) + loopback.get_loopbacks( + for ifname in loopback.get_loopbacks(self.cfg) + interface.get_interfaces( self.cfg ): if numtags == 0 and interface.is_sub(self.cfg, ifname): @@ -1313,7 +1313,7 @@ class Reconciler: def __sync_mpls_state(self): """Synchronize the VPP Dataplane configuration for interface and loopback MPLS state""" - for ifname in interface.get_interfaces(self.cfg) + loopback.get_loopbacks( + for ifname in loopback.get_loopbacks(self.cfg) + interface.get_interfaces( self.cfg ): if ifname.startswith("loop"): @@ -1343,7 +1343,7 @@ class Reconciler: def __sync_unnumbered(self): """Synchronize the VPP Dataplane configuration for unnumbered interface""" - for ifname in interface.get_interfaces(self.cfg) + loopback.get_loopbacks( + for ifname in loopback.get_loopbacks(self.cfg) + interface.get_interfaces( self.cfg ): if ifname.startswith("loop"): @@ -1395,7 +1395,7 @@ class Reconciler: def __sync_addresses(self): """Synchronize the VPP Dataplane configuration for interface addresses""" - for ifname in interface.get_interfaces(self.cfg) + loopback.get_loopbacks( + for ifname in loopback.get_loopbacks(self.cfg) + interface.get_interfaces( self.cfg ): config_addresses = []