[pve-devel] [PATCH v2 pve-network 6/9] evpn: extract function that reads frr config.
Stefan Lendl
s.lendl at proxmox.com
Tue Apr 2 18:07:35 CEST 2024
read_local_frr_config reads /etc/frr/frr.conf.local.
This allows mocking local fs access in tests.
Signed-off-by: Stefan Lendl <s.lendl at proxmox.com>
Reviewed-by: Max Carrara <m.carrara at proxmox.com>
Tested-by: Max Carrara <m.carrara at proxmox.com>
---
src/PVE/Network/SDN/Controllers/EvpnPlugin.pm | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm b/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm
index c2fdf88..836a689 100644
--- a/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm
+++ b/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm
@@ -487,6 +487,12 @@ sub generate_frr_list {
}
}
+sub read_local_frr_config {
+ if (-e "/etc/frr/frr.conf.local") {
+ return file_get_contents("/etc/frr/frr.conf.local");
+ }
+};
+
sub generate_controller_rawconfig {
my ($class, $plugin_config, $config) = @_;
@@ -500,8 +506,8 @@ sub generate_controller_rawconfig {
push @{$final_config}, "service integrated-vtysh-config";
push @{$final_config}, "!";
- if (-e "/etc/frr/frr.conf.local") {
- my $local_conf = file_get_contents("/etc/frr/frr.conf.local");
+ my $local_conf = read_local_frr_config();
+ if ($local_conf) {
parse_merge_frr_local_config($config, $local_conf);
}
--
2.44.0
More information about the pve-devel
mailing list