public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Gabriel Goller <g.goller@proxmox.com>
Subject: Re: [pve-devel] [PATCH network] sdn: factor out frr config generation and writing
Date: Tue, 11 Feb 2025 21:30:15 +0100	[thread overview]
Message-ID: <64364b99-d647-46fa-8593-7ad325c5c373@proxmox.com> (raw)
In-Reply-To: <20250205161340.740740-1-g.goller@proxmox.com>

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.goller@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


  reply	other threads:[~2025-02-11 20:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-05 16:13 Gabriel Goller
2025-02-11 20:30 ` Thomas Lamprecht [this message]
2025-02-12  8:45   ` Stefan Hanreich
2025-02-12 11:17 ` Stefan Hanreich
2025-02-13 10:09   ` Gabriel Goller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=64364b99-d647-46fa-8593-7ad325c5c373@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=g.goller@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal