From c9c3ad18cf35848e435cad09def8c33f8f1f6f68 Mon Sep 17 00:00:00 2001 From: Andre Kantek Date: Thu, 18 Apr 2024 08:18:16 -0300 Subject: [PATCH] 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 --- .../src/modules/platform/manifests/network.pp | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/puppet-manifests/src/modules/platform/manifests/network.pp b/puppet-manifests/src/modules/platform/manifests/network.pp index a6ef565f9..7aa025b25 100644 --- a/puppet-manifests/src/modules/platform/manifests/network.pp +++ b/puppet-manifests/src/modules/platform/manifests/network.pp @@ -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'], } }