]> git.proxmox.com Git - pve-network.git/blobdiff - PVE/Network/SDN/Controllers/BgpPlugin.pm
controllers: evpn : use frr restart if reload fail
[pve-network.git] / PVE / Network / SDN / Controllers / BgpPlugin.pm
index 075ca905a9e18b9dc0969dcbbaf4311d034d6aa0..73ed17199a8fa6e02591387456a1f96a45185d44 100644 (file)
@@ -19,6 +19,10 @@ sub type {
 
 sub properties {
     return {
+       'bgp-multipath-as-path-relax' => {
+           type => 'boolean',
+           optional => 1,
+       },
        ebgp => {
            type => 'boolean',
            optional => 1,
@@ -41,6 +45,7 @@ sub options {
        'node' => { optional => 0 },
        'asn' => { optional => 0 },
        'peers' => { optional => 0 },
+       'bgp-multipath-as-path-relax' => { optional => 1 },
        'ebgp' => { optional => 1 },
        'ebgp-multihop' => { optional => 1 },
        'loopback' => { optional => 1 },
@@ -58,6 +63,8 @@ sub generate_controller_config {
     my $ebgp = $plugin_config->{ebgp};
     my $ebgp_multihop = $plugin_config->{'ebgp-multihop'};
     my $loopback = $plugin_config->{loopback};
+    my $multipath_relax = $plugin_config->{'bgp-multipath-as-path-relax'};
+
     my $local_node = PVE::INotify::nodename();
 
 
@@ -74,18 +81,18 @@ sub generate_controller_config {
     my @controller_config = (
         "bgp router-id $ifaceip",
         "no bgp default ipv4-unicast",
-        "coalesce-time 1000",
-        "bgp network import-check"
+        "coalesce-time 1000"
     );
 
     push(@{$bgp->{""}}, @controller_config) if keys %{$bgp} == 0;
 
     @controller_config = ();
     if($ebgp) {
-       push @controller_config, "no bgp ebgp-requires-policy";
        push @controller_config, "bgp disable-ebgp-connected-route-check" if $loopback;
     }
 
+    push @controller_config, "bgp bestpath as-path multipath-relax" if $multipath_relax;
+
     #BGP neighbors
     if(@peers) {
        push @controller_config, "neighbor BGP peer-group";
@@ -113,8 +120,11 @@ sub generate_controller_config {
     if ($loopback) {
        push(@{$config->{frr}->{''}}, "ip prefix-list loopbacks_ips seq 10 permit 0.0.0.0/0 le 32");
        push(@{$config->{frr}->{''}}, "ip protocol bgp route-map correct_src");
-       push(@{$config->{frr}->{'route-map'}->{'correct_src permit 1'}}, "match ip address prefix-list loopbacks_ips");
-       push(@{$config->{frr}->{'route-map'}->{'correct_src permit 1'}}, "set src $ifaceip");
+
+       my $routemap_config = [];
+       push @{$routemap_config}, "match ip address prefix-list loopbacks_ips";
+       push @{$routemap_config}, "set src $ifaceip";
+       push(@{$config->{frr_routemap}->{'correct_src'}}, $routemap_config);
     }
 
     return $config;