Am 05.02.25 um 17:13 schrieb Gabriel Goller: > Previously the frr config generation and writing was only done in the > evpn plugin. This means that it was not possible to create a standalone > bgp and isis plugin without an evpn plugin in place. (The config would > just never be written.) To fix this, factor out the frr generation and > writing into a separate module and check if a frr-type-plugin is being > used. This also paves the way for the fabrics, which would get the > config from rust and then use this frr helper. > > Signed-off-by: Gabriel Goller <g.gol...@proxmox.com> > --- > src/PVE/Network/SDN/Controllers.pm | 47 ++- > src/PVE/Network/SDN/Controllers/BgpPlugin.pm | 18 +- > src/PVE/Network/SDN/Controllers/EvpnPlugin.pm | 289 +---------------- > src/PVE/Network/SDN/Controllers/Frr.pm | 296 ++++++++++++++++++ > src/PVE/Network/SDN/Controllers/IsisPlugin.pm | 18 +- > src/PVE/Network/SDN/Controllers/Makefile | 2 +- > src/PVE/Network/SDN/Zones/EvpnPlugin.pm | 15 + > 7 files changed, 383 insertions(+), 302 deletions(-) > create mode 100644 src/PVE/Network/SDN/Controllers/Frr.pm > > diff --git a/src/PVE/Network/SDN/Controllers.pm > b/src/PVE/Network/SDN/Controllers.pm > index fd7ad54ac38c..43f154b7338e 100644 > --- a/src/PVE/Network/SDN/Controllers.pm > +++ b/src/PVE/Network/SDN/Controllers.pm > @@ -12,6 +12,7 @@ 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::Frr; > use PVE::Network::SDN::Controllers::EvpnPlugin; > use PVE::Network::SDN::Controllers::BgpPlugin; > use PVE::Network::SDN::Controllers::IsisPlugin; > @@ -148,10 +149,22 @@ sub reload_controller { > > return if !$controller_cfg; > > + my $frr_reload = 0; > + > foreach my $id (keys %{$controller_cfg->{ids}}) { > my $plugin_config = $controller_cfg->{ids}->{$id}; > - my $plugin = > PVE::Network::SDN::Controllers::Plugin->lookup($plugin_config->{type}); > - $plugin->reload_controller(); > + my $type = $plugin_config->{type}; > + my @frr_types = ("bgp", "isis", "evpn");
instead of having those re-defined three times as array in the same module you could use a module wide hash, that would make checking easier too, like: my $frr_types = { bgp => 1, isis => 1, evpn => 1 }; Looks OK otherwise, albeit I mostly skimmed it a few days ago and had this lying around as draft, somebody else (@Stefan) checking would not hurt. _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel