[pve-devel] [PATCH v2 pve-network 09/15] rename frrevpn controller plugin to evpn plugin
Alexandre Derumier
aderumier at odiso.com
Tue Nov 26 10:00:24 CET 2019
Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
PVE/API2/Network/SDN/Controllers.pm | 2 +-
PVE/Network/SDN/Controllers.pm | 4 +-
.../{FrrEvpnPlugin.pm => EvpnPlugin.pm} | 4 +-
PVE/Network/SDN/Controllers/Makefile | 2 +-
PVE/Network/SDN/Zones/EvpnPlugin.pm | 12 +++---
PVE/Network/SDN/Zones/VlanPlugin.pm | 5 ---
PVE/Network/SDN/Zones/VxlanPlugin.pm | 39 -------------------
test/documentation.txt | 2 +-
8 files changed, 13 insertions(+), 57 deletions(-)
rename PVE/Network/SDN/Controllers/{FrrEvpnPlugin.pm => EvpnPlugin.pm} (99%)
diff --git a/PVE/API2/Network/SDN/Controllers.pm b/PVE/API2/Network/SDN/Controllers.pm
index 7b8356d..a740dbd 100644
--- a/PVE/API2/Network/SDN/Controllers.pm
+++ b/PVE/API2/Network/SDN/Controllers.pm
@@ -9,7 +9,7 @@ use PVE::Cluster qw(cfs_read_file cfs_write_file);
use PVE::Network::SDN::Zones;
use PVE::Network::SDN::Controllers;
use PVE::Network::SDN::Controllers::Plugin;
-use PVE::Network::SDN::Controllers::FrrEvpnPlugin;
+use PVE::Network::SDN::Controllers::EvpnPlugin;
use PVE::Network::SDN::Controllers::FaucetPlugin;
use Storable qw(dclone);
diff --git a/PVE/Network/SDN/Controllers.pm b/PVE/Network/SDN/Controllers.pm
index 2ee349d..827c715 100644
--- a/PVE/Network/SDN/Controllers.pm
+++ b/PVE/Network/SDN/Controllers.pm
@@ -12,10 +12,10 @@ use PVE::Cluster qw(cfs_read_file cfs_write_file cfs_lock_file);
use PVE::Network::SDN::Vnets;
use PVE::Network::SDN::Zones;
-use PVE::Network::SDN::Controllers::FrrEvpnPlugin;
+use PVE::Network::SDN::Controllers::EvpnPlugin;
use PVE::Network::SDN::Controllers::FaucetPlugin;
use PVE::Network::SDN::Controllers::Plugin;
-PVE::Network::SDN::Controllers::FrrEvpnPlugin->register();
+PVE::Network::SDN::Controllers::EvpnPlugin->register();
PVE::Network::SDN::Controllers::FaucetPlugin->register();
PVE::Network::SDN::Controllers::Plugin->init();
diff --git a/PVE/Network/SDN/Controllers/FrrEvpnPlugin.pm b/PVE/Network/SDN/Controllers/EvpnPlugin.pm
similarity index 99%
rename from PVE/Network/SDN/Controllers/FrrEvpnPlugin.pm
rename to PVE/Network/SDN/Controllers/EvpnPlugin.pm
index 052c77e..97dc825 100644
--- a/PVE/Network/SDN/Controllers/FrrEvpnPlugin.pm
+++ b/PVE/Network/SDN/Controllers/EvpnPlugin.pm
@@ -1,4 +1,4 @@
-package PVE::Network::SDN::Controllers::FrrEvpnPlugin;
+package PVE::Network::SDN::Controllers::EvpnPlugin;
use strict;
use warnings;
@@ -10,7 +10,7 @@ use PVE::JSONSchema qw(get_standard_option);
use base('PVE::Network::SDN::Controllers::Plugin');
sub type {
- return 'frrevpn';
+ return 'evpn';
}
sub properties {
diff --git a/PVE/Network/SDN/Controllers/Makefile b/PVE/Network/SDN/Controllers/Makefile
index 73c3b7b..3324125 100644
--- a/PVE/Network/SDN/Controllers/Makefile
+++ b/PVE/Network/SDN/Controllers/Makefile
@@ -1,4 +1,4 @@
-SOURCES=Plugin.pm FaucetPlugin.pm FrrEvpnPlugin.pm
+SOURCES=Plugin.pm FaucetPlugin.pm EvpnPlugin.pm
PERL5DIR=${DESTDIR}/usr/share/perl5
diff --git a/PVE/Network/SDN/Zones/EvpnPlugin.pm b/PVE/Network/SDN/Zones/EvpnPlugin.pm
index f999847..012274f 100644
--- a/PVE/Network/SDN/Zones/EvpnPlugin.pm
+++ b/PVE/Network/SDN/Zones/EvpnPlugin.pm
@@ -136,15 +136,15 @@ sub on_update_hook {
my ($class, $transportid, $sdn_cfg) = @_;
# verify that router exist
- if (defined($sdn_cfg->{ids}->{$transportid}->{router})) {
- my $router = $sdn_cfg->{ids}->{$transportid}->{router};
- if (!defined($sdn_cfg->{ids}->{$router})) {
- die "router $router don't exist";
+ if (defined($sdn_cfg->{ids}->{$transportid}->{controller})) {
+ my $controller = $sdn_cfg->{ids}->{$transportid}->{controller};
+ if (!defined($sdn_cfg->{ids}->{$controller})) {
+ die "controller $controller don't exist";
} else {
- die "$router is not a router type" if $sdn_cfg->{ids}->{$router}->{type} ne 'frr';
+ die "$controller is not a evpn controller type" if $sdn_cfg->{ids}->{$controller}->{type} ne 'evpn';
}
- #vrf && vrf-vxlan need to be defined with router
+ #vrf && vrf-vxlan need to be defined with controller
my $vrf = $sdn_cfg->{ids}->{$transportid}->{vrf};
if (!defined($vrf)) {
die "missing vrf option";
diff --git a/PVE/Network/SDN/Zones/VlanPlugin.pm b/PVE/Network/SDN/Zones/VlanPlugin.pm
index 39f103e..2dd65e9 100644
--- a/PVE/Network/SDN/Zones/VlanPlugin.pm
+++ b/PVE/Network/SDN/Zones/VlanPlugin.pm
@@ -80,11 +80,6 @@ sub on_delete_hook {
}
}
-sub on_update_hook {
- my ($class, $transportid, $sdn_cfg) = @_;
-
-}
-
1;
diff --git a/PVE/Network/SDN/Zones/VxlanPlugin.pm b/PVE/Network/SDN/Zones/VxlanPlugin.pm
index e3624ea..8a39921 100644
--- a/PVE/Network/SDN/Zones/VxlanPlugin.pm
+++ b/PVE/Network/SDN/Zones/VxlanPlugin.pm
@@ -134,45 +134,6 @@ sub on_delete_hook {
}
}
-sub on_update_hook {
- my ($class, $transportid, $sdn_cfg) = @_;
-
- # verify that router exist
- if (defined($sdn_cfg->{ids}->{$transportid}->{router})) {
- my $router = $sdn_cfg->{ids}->{$transportid}->{router};
- if (!defined($sdn_cfg->{ids}->{$router})) {
- die "router $router don't exist";
- } else {
- die "$router is not a router type" if $sdn_cfg->{ids}->{$router}->{type} ne 'frr';
- }
-
- #vrf && vrf-vxlan need to be defined with router
- my $vrf = $sdn_cfg->{ids}->{$transportid}->{vrf};
- if (!defined($vrf)) {
- die "missing vrf option";
- } else {
- # verify that vrf is not already declared in another transport
- foreach my $id (keys %{$sdn_cfg->{ids}}) {
- next if $id eq $transportid;
- die "vrf $vrf is already declared in $id"
- if (defined($sdn_cfg->{ids}->{$id}->{vrf}) && $sdn_cfg->{ids}->{$id}->{vrf} eq $vrf);
- }
- }
-
- my $vrfvxlan = $sdn_cfg->{ids}->{$transportid}->{'vrf-vxlan'};
- if (!defined($vrfvxlan)) {
- die "missing vrf-vxlan option";
- } else {
- # verify that vrf-vxlan is not already declared in another transport
- foreach my $id (keys %{$sdn_cfg->{ids}}) {
- next if $id eq $transportid;
- die "vrf-vxlan $vrfvxlan is already declared in $id"
- if (defined($sdn_cfg->{ids}->{$id}->{'vrf-vxlan'}) && $sdn_cfg->{ids}->{$id}->{'vrf-vxlan'} eq $vrfvxlan);
- }
- }
- }
-}
-
1;
diff --git a/test/documentation.txt b/test/documentation.txt
index 8b78d46..6b2dfb2 100644
--- a/test/documentation.txt
+++ b/test/documentation.txt
@@ -12,7 +12,7 @@ pvesh create /cluster/sdn/zones/ --zone vxlanmulticastzone --type vxlan --uplink
pvesh create /cluster/sdn/zones/ --zone vxlanunicastzone --type vxlan --uplink-id 1 --unicast-address 192.168.0.1,192.168.0.2,192.168.0.3
#create an controller
-pvesh create /cluster/sdn/controllers/ --controller frrrouter1 --type frrevpn --uplink-id 1 --peers 192.168.0.1,192.168.0.2,192.168.0.3 --asn 1234 --gateway-nodes pxnode1,pxnode2 --gateway-external-peers 192.168.0.253,192.168.0.254
+pvesh create /cluster/sdn/controllers/ --controller frrrouter1 --type evpn --uplink-id 1 --peers 192.168.0.1,192.168.0.2,192.168.0.3 --asn 1234 --gateway-nodes pxnode1,pxnode2 --gateway-external-peers 192.168.0.253,192.168.0.254
#create a layer2 vxlan bgpevpn transportzone
pvesh create /cluster/sdn/zones/ --zone layer2evpnzone --type evpn --uplink-id 1 --controller frrrouter1
--
2.20.1
More information about the pve-devel
mailing list