[pve-devel] [PATCH v2 pve-network 13/15] evpn zone plugin : remove vrf option
Alexandre Derumier
aderumier at odiso.com
Tue Nov 26 10:00:28 CET 2019
instead, use zone name as vrf
Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
PVE/Network/SDN/Controllers.pm | 2 +-
PVE/Network/SDN/Controllers/EvpnPlugin.pm | 4 +---
PVE/Network/SDN/Zones/EvpnPlugin.pm | 19 +++----------------
test/documentation.txt | 2 +-
4 files changed, 6 insertions(+), 21 deletions(-)
diff --git a/PVE/Network/SDN/Controllers.pm b/PVE/Network/SDN/Controllers.pm
index 827c715..f089538 100644
--- a/PVE/Network/SDN/Controllers.pm
+++ b/PVE/Network/SDN/Controllers.pm
@@ -103,7 +103,7 @@ sub generate_controller_config {
my $plugin_config = $transport_cfg->{ids}->{$id};
my $controllerid = $plugin_config->{controller};
next if !$controllerid;
- my $controller = $transport_cfg->{ids}->{$controllerid};
+ my $controller = $controller_cfg->{ids}->{$controllerid};
if ($controller) {
my $controller_plugin = PVE::Network::SDN::Controllers::Plugin->lookup($controller->{type});
$controller_plugin->generate_controller_transport_config($plugin_config, $controller, $id, $uplinks, $config);
diff --git a/PVE/Network/SDN/Controllers/EvpnPlugin.pm b/PVE/Network/SDN/Controllers/EvpnPlugin.pm
index 97dc825..012c9a4 100644
--- a/PVE/Network/SDN/Controllers/EvpnPlugin.pm
+++ b/PVE/Network/SDN/Controllers/EvpnPlugin.pm
@@ -105,8 +105,6 @@ sub generate_controller_config {
@router_config = ();
#import /32 routes of evpn network from vrf1 to default vrf (for packet return)
- #frr 7.1 tag is bugged -> works fine with 7.1 stable branch(20190829-02-g6ba76bbc1)
- #https://github.com/FRRouting/frr/issues/4905
foreach my $address (@gatewaypeers) {
push @router_config, "neighbor $address activate";
}
@@ -121,7 +119,7 @@ sub generate_controller_config {
sub generate_controller_transport_config {
my ($class, $plugin_config, $router, $id, $uplinks, $config) = @_;
- my $vrf = $plugin_config->{'vrf'};
+ my $vrf = $id;
my $vrfvxlan = $plugin_config->{'vrf-vxlan'};
my $asn = $router->{asn};
my $gatewaynodes = $router->{'gateway-nodes'};
diff --git a/PVE/Network/SDN/Zones/EvpnPlugin.pm b/PVE/Network/SDN/Zones/EvpnPlugin.pm
index 1119226..62382fb 100644
--- a/PVE/Network/SDN/Zones/EvpnPlugin.pm
+++ b/PVE/Network/SDN/Zones/EvpnPlugin.pm
@@ -14,10 +14,6 @@ sub type {
sub properties {
return {
- 'vrf' => {
- description => "vrf name.",
- type => 'string', #fixme: format
- },
'vrf-vxlan' => {
type => 'integer',
description => "l3vni.",
@@ -34,7 +30,6 @@ sub options {
return {
nodes => { optional => 1},
'uplink-id' => { optional => 0 },
- 'vrf' => { optional => 0 },
'vrf-vxlan' => { optional => 0 },
'controller' => { optional => 0 },
};
@@ -51,7 +46,7 @@ sub generate_sdn_config {
my $mac = $vnet->{mac};
my $uplink = $plugin_config->{'uplink-id'};
- my $vrf = $plugin_config->{'vrf'};
+ my $vrf = $zoneid;
my $vrfvxlan = $plugin_config->{'vrf-vxlan'};
die "missing vxlan tag" if !$tag;
@@ -102,7 +97,7 @@ sub generate_sdn_config {
if ($vrfvxlan) {
#l3vni vxlan interface
- my $iface_vxlan = "vxlan$vrf";
+ my $iface_vxlan = "vxvrf$vrf";
@iface_config = ();
push @iface_config, "vxlan-id $vrfvxlan";
push @iface_config, "vxlan-local-tunnelip $ifaceip" if $ifaceip;
@@ -137,15 +132,7 @@ sub on_update_hook {
die "$controller is not a evpn controller type" if $controller_cfg->{ids}->{$controller}->{type} ne 'evpn';
}
- #vrf && vrf-vxlan need to be defined
- my $vrf = $zone_cfg->{ids}->{$zoneid}->{vrf};
-
- # verify that vrf is not already declared in another zone
- foreach my $id (keys %{$zone_cfg->{ids}}) {
- next if $id eq $zoneid;
- die "vrf $vrf is already declared in $id"
- if (defined($zone_cfg->{ids}->{$id}->{vrf}) && $zone_cfg->{ids}->{$id}->{vrf} eq $vrf);
- }
+ #vrf-vxlan need to be defined
my $vrfvxlan = $zone_cfg->{ids}->{$zoneid}->{'vrf-vxlan'};
# verify that vrf-vxlan is not already declared in another zone
diff --git a/test/documentation.txt b/test/documentation.txt
index 6b2dfb2..82e7e14 100644
--- a/test/documentation.txt
+++ b/test/documentation.txt
@@ -18,7 +18,7 @@ pvesh create /cluster/sdn/controllers/ --controller frrrouter1 --type evpn --upl
pvesh create /cluster/sdn/zones/ --zone layer2evpnzone --type evpn --uplink-id 1 --controller frrrouter1
#create a layer3 routable vxlan bgpevpn transportzone
-pvesh create /cluster/sdn/zones/ --zone layer3evpnzone --type evpn --uplink-id 1 --controller frrrouter1 --vrf vrf1 --vrf-vxlan 4000
+pvesh create /cluster/sdn/zones/ --zone layer3evpnzone --type evpn --uplink-id 1 --controller frrrouter1 --vrf-vxlan 4000
#create a vnet in the transportzone
--
2.20.1
More information about the pve-devel
mailing list