In SX mark floating IPs as deprecated in dual-stack

With the dual-stack feature the system now can have 2 floating IPs per
network. In non-SX systems the floating IPs are managed by SM, but not
in AIO-SX, this is done via puppet, and it requires to mark floating
addresses as deprecated.

This change can now process IPv4 and IPv6 addresses present in the
"platform::network::addresses::address_config" variable

Test Plan
[PASS] install AIO-SX and check if floating IPs have the correct
       flags
[PASS] in the installation configure dual-stack and check if floating
       IPs have the correct flags

Story: 2011027
Task: 49888
Depends-On: https://review.opendev.org/c/starlingx/config/+/916282
Change-Id: Ieb886eeb7844b58502bb3939a8b203595570c44c
This commit is contained in:
Andre Kantek 2024-04-18 08:18:16 -03:00
parent 7fb6a7bcb4
commit c9c3ad18cf
1 changed files with 20 additions and 16 deletions

View File

@ -335,7 +335,7 @@ class platform::network::admin::params(
) { }
define platform::network::network_address (
$address,
$addresses,
$ifname,
) {
# In AIO simplex configurations, the management addresses are assigned to the
@ -343,22 +343,26 @@ define platform::network::network_address (
# or assignment is prevented (can't have multiple global scope addresses on
# the loopback interface).
# For ipv6 the only way to initiate outgoing connections
# over the fixed ips is to set preferred_lft to 0 for the
# floating ips so that they are not used
if $ifname == 'lo' {
$options = 'scope host'
} elsif $::platform::network::mgmt::params::subnet_version == $::platform::params::ipv6 {
$options = 'preferred_lft 0'
} else {
$options = ''
}
$addresses.each |$address| {
# For ipv6 the only way to initiate outgoing connections
# over the fixed ips is to set preferred_lft to 0 for the
# floating ips so that they are not used
if $ifname == 'lo' {
$options = 'scope host'
} elsif $address =~ Stdlib::IP::Address::V6 {
$options = 'preferred_lft 0'
} else {
$options = ''
}
# addresses should only be configured if running in simplex, otherwise SM
# will configure them on the active controller.
exec { "Configuring ${name} IP address to ${address}":
command => "ip addr replace ${address} dev ${ifname} ${options}",
logoutput => true,
onlyif => ['test -f /etc/platform/simplex', 'test ! -f /var/run/.network_upgrade_bootstrap'],
}
# addresses should only be configured if running in simplex, otherwise SM
# will configure them on the active controller.
exec { "Configuring ${name} IP address to ${address}":
command => "ip addr replace ${address} dev ${ifname} ${options}",
onlyif => ['test -f /etc/platform/simplex', 'test ! -f /var/run/.network_upgrade_bootstrap'],
}
}