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).
This commit is contained in:
Pim van Pelt
2024-04-07 23:36:30 +02:00
parent 95f4013f27
commit f01c865c87

View File

@ -906,7 +906,7 @@ class Reconciler:
] ]
## First create untagged ... ## 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 self.cfg
): ):
if interface.is_sub(self.cfg, ifname): if interface.is_sub(self.cfg, ifname):
@ -1195,7 +1195,7 @@ class Reconciler:
tag_list = [0, 1, 2] tag_list = [0, 1, 2]
for numtags in tag_list: 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 self.cfg
): ):
if numtags == 0 and interface.is_sub(self.cfg, ifname): if numtags == 0 and interface.is_sub(self.cfg, ifname):
@ -1313,7 +1313,7 @@ class Reconciler:
def __sync_mpls_state(self): def __sync_mpls_state(self):
"""Synchronize the VPP Dataplane configuration for interface and loopback MPLS state""" """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 self.cfg
): ):
if ifname.startswith("loop"): if ifname.startswith("loop"):
@ -1343,7 +1343,7 @@ class Reconciler:
def __sync_unnumbered(self): def __sync_unnumbered(self):
"""Synchronize the VPP Dataplane configuration for unnumbered interface""" """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 self.cfg
): ):
if ifname.startswith("loop"): if ifname.startswith("loop"):
@ -1395,7 +1395,7 @@ class Reconciler:
def __sync_addresses(self): def __sync_addresses(self):
"""Synchronize the VPP Dataplane configuration for interface addresses""" """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 self.cfg
): ):
config_addresses = [] config_addresses = []