[pve-devel] [PATCH v2 pve-network 12/13] sdn: add write_frr_config

Alexandre Derumier aderumier at odiso.com
Thu Aug 29 12:32:53 CEST 2019


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/Network/SDN.pm     | 13 +++++++++++++
 test/generateconfig.pl |  5 +++++
 2 files changed, 18 insertions(+)

diff --git a/PVE/Network/SDN.pm b/PVE/Network/SDN.pm
index 80a70d8..1e89d97 100644
--- a/PVE/Network/SDN.pm
+++ b/PVE/Network/SDN.pm
@@ -259,6 +259,19 @@ sub write_etc_network_config {
     $writefh->close();
 }
 
+sub write_frr_config {
+    my ($rawconfig) = @_;
+
+    return if !$rawconfig;
+    return if !-d "/etc/frr";
+
+    my $frr_config_file = "/etc/frr/frr.conf";
+
+    my $writefh = IO::File->new($frr_config_file,">");
+    print $writefh $rawconfig;
+    $writefh->close();
+}
+
 
 sub status {
 
diff --git a/test/generateconfig.pl b/test/generateconfig.pl
index 6003f94..04e930b 100644
--- a/test/generateconfig.pl
+++ b/test/generateconfig.pl
@@ -6,10 +6,15 @@ use PVE::Cluster qw(cfs_read_file);
 use PVE::Network::SDN;
 
 
+
 my $network_config = PVE::Network::SDN::generate_etc_network_config();
 PVE::Network::SDN::write_etc_network_config($network_config);
+print "/etc/network/interfaces\n";
 print $network_config;
+print "\n";
 
 
 my $frr_config = PVE::Network::SDN::generate_frr_config();
+PVE::Network::SDN::write_frr_config($frr_config);
+print "/etc/frr/frr.conf\n";
 print $frr_config;
-- 
2.20.1



More information about the pve-devel mailing list