public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Gabriel Goller <g.goller@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: Re: [PATCH pve-network v4 9/9] api: add dry-run endpoint for sdn apply to preview changes
Date: Mon, 9 Mar 2026 16:48:26 +0100	[thread overview]
Message-ID: <qvhbtdrr2vrrqssnlkviuy5yibbpajd3b4hgz7vrbdon2hijjr@pzpae54pg2r7> (raw)
In-Reply-To: <20260306125315.190298-19-g.goller@proxmox.com>

> +__PACKAGE__->register_method({
> +    name => 'dry-run',
> +    path => 'dry-run',
> +    method => 'GET',
> +    permissions => {
> +        check => ['perm', '/nodes/{node}', ['Sys.Modify']],
> +    },
> +    description =>
> +        "Dry-run the SDN apply action and return the difference between the current configuration and the pending configuration",
> +    protected => 1,
> +    proxyto => 'node',
> +    parameters => {
> +        additionalProperties => 0,
> +        properties => {
> +            node => get_standard_option('pve-node'),
> +        },
> +    },
> +
> +    returns => {
> +        type => 'object',
> +        properties => {
> +            "frr-diff" => {
> +                type => 'string',
> +                description =>
> +                    'The difference between the current and pending FRR configuration.',
> +            },
> +            "interfaces-diff" => {
> +                type => 'string',
> +                description =>
> +                    'The difference between the current and pending /etc/network/interfaces.d/sdn configuration.',
> +            },
> +        },
> +    },
> +    code => sub {
> +        my ($param) = @_;
> +
> +        my $cfg = PVE::Network::SDN::compile_running_cfg();
> +
> +        my $fabric_cfg = PVE::Network::SDN::Fabrics::config(0);
> +        my $frr_cfg = PVE::Network::SDN::generate_frr_raw_config($cfg, $fabric_cfg);
> +        my $new_cfg_frr = PVE::Network::SDN::Frr::raw_config_to_string($frr_cfg);
> +
> +        # compile running config and skip version bump
> +        my $running_cfg = PVE::Network::SDN::compile_running_cfg(1);

Ah, a small oopsie happened here :(

The $running_cfg declaration should be at the top instead of the $cfg declaration.
This way we don't skip the version bump when having a fabrics-only sdn config.

> +
> +        my $new_interfaces_cfg =
> +            PVE::Network::SDN::generate_raw_etc_network_config($running_cfg);
> +
> +        my ($frr_tmp_filename, $frr_tmp_fh) = PVE::File::tempfile_contents($new_cfg_frr, 700);
> +
> +        my ($interfaces_tmp_filename, $interfaces_tmp_fh) =
> +            PVE::File::tempfile_contents($new_interfaces_cfg, 700);
> +
> +        my $return_value = {};
> +        $return_value->{"frr-diff"} = get_diff('/etc/frr/frr.conf', $frr_tmp_filename);
> +        $return_value->{"interfaces-diff"} =
> +            get_diff('/etc/network/interfaces.d/sdn', $interfaces_tmp_filename);
> +
> +        close($frr_tmp_fh);
> +        close($interfaces_tmp_fh);
> +        return $return_value;
> +    },
> +});
> +
>  1;
> [snip]

Gabriel




  parent reply	other threads:[~2026-03-09 15:48 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-06 12:52 [PATCH manager/network/proxmox{-ve-rs,-perl-rs} v4 00/19] Generate frr config using jinja templates and rust types Gabriel Goller
2026-03-06 12:52 ` [PATCH proxmox-ve-rs v4 1/8] ve-config: firewall: cargo fmt Gabriel Goller
2026-03-06 12:52 ` [PATCH proxmox-ve-rs v4 2/8] frr: add proxmox-frr-templates package that contains templates Gabriel Goller
2026-03-06 12:52 ` [PATCH proxmox-ve-rs v4 3/8] ve-config: remove FrrConfigBuilder struct Gabriel Goller
2026-03-06 12:52 ` [PATCH proxmox-ve-rs v4 4/8] sdn-types: support variable-length NET identifier Gabriel Goller
2026-03-06 12:52 ` [PATCH proxmox-ve-rs v4 5/8] frr: add template serializer and serialize fabrics using templates Gabriel Goller
2026-03-06 12:53 ` [PATCH proxmox-ve-rs v4 6/8] frr: add isis configuration and templates Gabriel Goller
2026-03-06 12:53 ` [PATCH proxmox-ve-rs v4 7/8] frr: support custom frr configuration lines Gabriel Goller
2026-03-06 12:53 ` [PATCH proxmox-ve-rs v4 8/8] frr: add bgp support with templates and serialization Gabriel Goller
2026-03-06 12:53 ` [PATCH proxmox-perl-rs v4 1/1] sdn: add function to generate the frr config for all daemons Gabriel Goller
2026-03-06 12:53 ` [PATCH pve-network v4 1/9] tests: use Test::Differences to make test assertions Gabriel Goller
2026-03-06 12:53 ` [PATCH pve-network v4 2/9] test: add tests for frr.conf.local merging Gabriel Goller
2026-03-06 12:53 ` [PATCH pve-network v4 3/9] test: bgp: add some various integration tests Gabriel Goller
2026-03-06 12:53 ` [PATCH pve-network v4 4/9] sdn: write structured frr config that can be rendered using templates Gabriel Goller
2026-03-06 12:53 ` [PATCH pve-network v4 5/9] sdn: remove duplicate comment line '!' in frr config Gabriel Goller
2026-03-06 12:53 ` [PATCH pve-network v4 6/9] tests: rearrange some statements in the " Gabriel Goller
2026-03-06 12:53 ` [PATCH pve-network v4 7/9] sdn: adjust frr.conf.local merging to rust template types Gabriel Goller
2026-03-06 12:53 ` [PATCH pve-network v4 8/9] test: adjust frr_local_merge test for new template generation Gabriel Goller
2026-03-06 12:53 ` [PATCH pve-network v4 9/9] api: add dry-run endpoint for sdn apply to preview changes Gabriel Goller
2026-03-06 17:13   ` Hannes Laimer
2026-03-09 12:24     ` Gabriel Goller
2026-03-09 15:48   ` Gabriel Goller [this message]
2026-03-06 12:53 ` [PATCH pve-manager v4 1/1] sdn: add dry-run diff view for sdn apply Gabriel Goller
2026-03-10 12:10 ` [PATCH manager/network/proxmox{-ve-rs,-perl-rs} v4 00/19] Generate frr config using jinja templates and rust types 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=qvhbtdrr2vrrqssnlkviuy5yibbpajd3b4hgz7vrbdon2hijjr@pzpae54pg2r7 \
    --to=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