[pve-devel] [PATCH pve-network 2/2] bgp: add ebgp_multihop option

Alexandre Derumier aderumier at odiso.com
Sat Apr 10 12:33:55 CEST 2021


---
 PVE/Network/SDN/Controllers/BgpPlugin.pm        | 7 +++++++
 test/zones/evpn/ebgp/expected_controller_config | 1 +
 test/zones/evpn/ebgp/sdn_config                 | 2 +-
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/PVE/Network/SDN/Controllers/BgpPlugin.pm b/PVE/Network/SDN/Controllers/BgpPlugin.pm
index e5d8490..69c688b 100644
--- a/PVE/Network/SDN/Controllers/BgpPlugin.pm
+++ b/PVE/Network/SDN/Controllers/BgpPlugin.pm
@@ -24,6 +24,10 @@ sub properties {
 	    optional => 1,
 	    description => "Enable ebgp. (remote-as external)",
 	},
+	'ebgp-multihop' => {
+	    type => 'integer',
+	    optional => 1,
+	},
 	loopback => {
 	    description => "source loopback interface.",
 	    type => 'string'
@@ -38,6 +42,7 @@ sub options {
 	'asn' => { optional => 0 },
 	'peers' => { optional => 0 },
 	'ebgp' => { optional => 1 },
+	'ebgp-multihop' => { optional => 1 },
 	'loopback' => { optional => 1 },
     };
 }
@@ -51,6 +56,7 @@ sub generate_controller_config {
 
     my $asn = $plugin_config->{asn};
     my $ebgp = $plugin_config->{ebgp};
+    my $ebgp_multihop = $plugin_config->{'ebgp-multihop'};
     my $loopback = $plugin_config->{loopback};
     my $local_node = PVE::INotify::nodename();
 
@@ -85,6 +91,7 @@ sub generate_controller_config {
 	push @controller_config, "neighbor BGP peer-group";
 	push @controller_config, "neighbor BGP remote-as $remoteas";
 	push @controller_config, "neighbor BGP bfd";
+	push @controller_config, "neighbor BGP ebgp-multihop $ebgp_multihop" if $ebgp && $ebgp_multihop;
     }
 
     # BGP peers
diff --git a/test/zones/evpn/ebgp/expected_controller_config b/test/zones/evpn/ebgp/expected_controller_config
index 4c42012..be3e1af 100644
--- a/test/zones/evpn/ebgp/expected_controller_config
+++ b/test/zones/evpn/ebgp/expected_controller_config
@@ -23,6 +23,7 @@ router bgp 65001
  neighbor BGP peer-group
  neighbor BGP remote-as external
  neighbor BGP bfd
+ neighbor BGP ebgp-multihop 3
  neighbor 192.168.0.252 peer-group BGP
  neighbor 192.168.0.253 peer-group BGP
  !
diff --git a/test/zones/evpn/ebgp/sdn_config b/test/zones/evpn/ebgp/sdn_config
index 379dc14..91c1b61 100644
--- a/test/zones/evpn/ebgp/sdn_config
+++ b/test/zones/evpn/ebgp/sdn_config
@@ -12,7 +12,7 @@
   controllers  => {
                ids => { 
 			evpnctl => { type => "evpn", 'peers' => '192.168.0.1,192.168.0.2,192.168.0.3', asn => "65000" },
-			localhost => { type => "bgp", 'peers' => '192.168.0.252,192.168.0.253', ebgp => "1", asn => "65001", node => "localhost" },
+			localhost => { type => "bgp", 'peers' => '192.168.0.252,192.168.0.253', ebgp => "1", 'ebgp-multihop' => '3', asn => "65001", node => "localhost" },
 		      },
              },
 
-- 
2.20.1





More information about the pve-devel mailing list