[pve-devel] [PATCH pve-network 37/38] sdn: controllers : add ebgp support

Alexandre Derumier aderumier at odiso.com
Sun Nov 8 15:19:39 CET 2020


---
 PVE/Network/SDN/Controllers/EvpnPlugin.pm | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/PVE/Network/SDN/Controllers/EvpnPlugin.pm b/PVE/Network/SDN/Controllers/EvpnPlugin.pm
index ca7be5b..e88e60a 100644
--- a/PVE/Network/SDN/Controllers/EvpnPlugin.pm
+++ b/PVE/Network/SDN/Controllers/EvpnPlugin.pm
@@ -26,6 +26,11 @@ sub properties {
 	    description => "peers address list.",
 	    type => 'string', format => 'ip-list'
 	},
+	ebgp => {
+	    type => 'boolean',
+	    optional => 1,
+	    description => "Enable ebgp. (remote-as external)",
+	},
 	'gateway-nodes' => get_standard_option('pve-node-list'),
 	'gateway-external-peers' => {
 	    description => "upstream bgp peers address list.",
@@ -39,6 +44,7 @@ sub options {
 	'node' => { optional => 1 },
 	'asn' => { optional => 0 },
 	'peers' => { optional => 0 },
+	'ebgp' => { optional => 1 },
 	'gateway-nodes' => { optional => 1 },
 	'gateway-external-peers' => { optional => 1 },
     };
@@ -52,6 +58,7 @@ sub generate_controller_config {
     @peers = PVE::Tools::split_list($plugin_config->{'peers'}) if $plugin_config->{'peers'};
 
     my $asn = $plugin_config->{asn};
+    my $ebgp = $plugin_config->{ebgp};
     my $gatewaynodes = $plugin_config->{'gateway-nodes'};
     my @gatewaypeers;
     @gatewaypeers = PVE::Tools::split_list($plugin_config->{'gateway-external-peers'}) if $plugin_config->{'gateway-external-peers'};
@@ -75,9 +82,11 @@ sub generate_controller_config {
 	"coalesce-time 1000",
     );
 
+    my $remoteas = $ebgp ? "external" : $asn;
+
     foreach my $address (@peers) {
 	next if $address eq $ifaceip;
-	push @controller_config, "neighbor $address remote-as $asn";
+	push @controller_config, "neighbor $address remote-as $remoteas";
     }
 
     if ($is_gateway) {
-- 
2.20.1





More information about the pve-devel mailing list