]> git.proxmox.com Git - pve-network.git/blobdiff - PVE/Network/SDN/Controllers/BgpPlugin.pm
controllers: evpn : remove "no bgp ebgp-requires-policy"
[pve-network.git] / PVE / Network / SDN / Controllers / BgpPlugin.pm
index 69c688be2c45b1f2c0a0f036288b242a4ea9ac88..bfeda0cac908fa04ae414838b00d6dfab35e05ba 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();
 
 
@@ -82,10 +89,11 @@ sub generate_controller_config {
 
     @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";
@@ -110,6 +118,16 @@ sub generate_controller_config {
        push(@{$bgp->{"address-family"}->{"$ipversion unicast"}}, "neighbor BGP soft-reconfiguration inbound");
     }
 
+    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");
+
+       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;
 }