X-Git-Url: https://git.proxmox.com/?p=pve-network.git;a=blobdiff_plain;f=PVE%2FNetwork%2FSDN%2FControllers%2FEvpnPlugin.pm;h=0c498939dc09431dd131e806f7643eedb09b045a;hp=96abb9f0ab90ffa007db29e947aa28a2afb8cb03;hb=9c24bcc5eb191d6f59541dc714d4c8df672f0925;hpb=f34a898e01f3a9f80e39c37d4fd120b1e74c9fe8 diff --git a/PVE/Network/SDN/Controllers/EvpnPlugin.pm b/PVE/Network/SDN/Controllers/EvpnPlugin.pm index 96abb9f..0c49893 100644 --- a/PVE/Network/SDN/Controllers/EvpnPlugin.pm +++ b/PVE/Network/SDN/Controllers/EvpnPlugin.pm @@ -121,6 +121,7 @@ sub generate_controller_zone_config { my $exitnodes_primary = $plugin_config->{'exitnodes-primary'}; my $advertisesubnets = $plugin_config->{'advertise-subnets'}; my $exitnodes_local_routing = $plugin_config->{'exitnodes-local-routing'}; + my $rt_import = [PVE::Tools::split_list($plugin_config->{'rt-import'})] if $plugin_config->{'rt-import'}; my $asn = $controller->{asn}; my @peers = PVE::Tools::split_list($controller->{'peers'}) if $controller->{'peers'}; @@ -147,7 +148,6 @@ sub generate_controller_zone_config { #main vrf router @controller_config = (); push @controller_config, "bgp router-id $ifaceip"; - push @controller_config, "no bgp ebgp-requires-policy" if $ebgp; # push @controller_config, "!"; push(@{$config->{frr}->{router}->{"bgp $asn vrf $vrf"}->{""}}, @controller_config); @@ -202,6 +202,14 @@ sub generate_controller_zone_config { push(@{$config->{frr}->{router}->{"bgp $asn vrf $vrf"}->{"address-family"}->{"l2vpn evpn"}}, @controller_config); } + if($rt_import) { + @controller_config = (); + foreach my $rt (sort @{$rt_import}) { + push @controller_config, "route-target import $rt"; + } + push(@{$config->{frr}->{router}->{"bgp $asn vrf $vrf"}->{"address-family"}->{"l2vpn evpn"}}, @controller_config); + } + return $config; } @@ -361,12 +369,11 @@ sub generate_controller_rawconfig { my $nodename = PVE::INotify::nodename(); my $final_config = []; - push @{$final_config}, "log syslog informational"; - push @{$final_config}, "ip forwarding"; - push @{$final_config}, "ipv6 forwarding"; + push @{$final_config}, "frr version 8.0.1"; push @{$final_config}, "frr defaults datacenter"; - push @{$final_config}, "service integrated-vtysh-config"; push @{$final_config}, "hostname $nodename"; + push @{$final_config}, "log syslog informational"; + push @{$final_config}, "service integrated-vtysh-config"; push @{$final_config}, "!"; if (-e "/etc/frr/frr.conf.local") { @@ -421,7 +428,13 @@ sub reload_controller { }; if (-e $conf_file && -e $bin_path) { - run_command([$bin_path, '--stdout', '--reload', $conf_file], outfunc => {}, errfunc => $err); + eval { + run_command([$bin_path, '--stdout', '--reload', $conf_file], outfunc => {}, errfunc => $err); + }; + if ($@) { + warn "frr reload command fail. Restarting frr."; + eval { run_command(['systemctl', 'restart', 'frr']); }; + } } }