[pve-devel] [PATCH pve-network 2/3] controllers: frr: add parsing of "interfaces" section

Alexandre Derumier aderumier at odiso.com
Wed Sep 13 13:38:43 CEST 2023


---
 src/PVE/Network/SDN/Controllers/EvpnPlugin.pm | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm b/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm
index fd4b801..f1dd20f 100644
--- a/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm
+++ b/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm
@@ -384,6 +384,20 @@ sub generate_frr_ip_protocol {
    foreach my $rule (sort @$ips) {
 	push @{$final_config}, $rule;
    }
+
+}
+
+sub generate_frr_interfaces {
+   my ($final_config, $interfaces) = @_;
+
+   foreach my $k (sort keys %$interfaces) {
+	my $iface = $interfaces->{$k};
+	push @{$final_config}, "!";
+	push @{$final_config}, "interface $k";
+	foreach my $rule (sort @$iface) {
+	    push @{$final_config}, " $rule";
+	}
+   }
 }
 
 sub generate_frr_routemap {
@@ -445,6 +459,7 @@ sub generate_controller_rawconfig {
     }
 
     generate_frr_vrf($final_config, $config->{frr}->{vrf});
+    generate_frr_interfaces($final_config, $config->{frr_interfaces});
     generate_frr_recurse($final_config, $config->{frr}, undef, 0);
     generate_frr_list($final_config, $config->{frr_access_list}, "access-list");
     generate_frr_list($final_config, $config->{frr_prefix_list}, "ip prefix-list");
@@ -481,6 +496,9 @@ sub parse_merge_frr_local_config {
 	} elsif ($line =~ m/^vrf (.+)$/) {
 	    $section = \$config->{'frr'}->{'vrf'}->{$1};
 	    next;
+	} elsif ($line =~ m/^interface (.+)$/) {
+	    $section = \$config->{'frr_interfaces'}->{$1};
+	    next;
 	} elsif ($line =~ m/address-family (.+)$/) {
 	    $section = \$config->{'frr'}->{'router'}->{$router}->{'address-family'}->{$1};
 	    next;
-- 
2.39.2





More information about the pve-devel mailing list