]> git.proxmox.com Git - pve-network.git/commitdiff
api2 : sdn : add role and type to index
authorAlexandre Derumier <aderumier@odiso.com>
Mon, 30 Sep 2019 09:03:39 +0000 (11:03 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 17 Oct 2019 17:25:49 +0000 (19:25 +0200)
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
PVE/API2/Network/SDN.pm

index 36d293d968757fe68502ae2adc3722bd845e7e4c..b6dd23e0efeadf1e7839762a06fe66ccb63f8499 100644 (file)
@@ -61,7 +61,10 @@ __PACKAGE__->register_method ({
        type => 'array',
        items => {
            type => "object",
-           properties => { sdn => { type => 'string'} },
+           properties => { sdn => { type => 'string'}, 
+                           type => { type => 'string'},
+                           role => { type => 'string'}
+                         },
        },
        links => [ { rel => 'child', href => "{sdn}" } ],
     },
@@ -82,6 +85,12 @@ __PACKAGE__->register_method ({
 
            my $scfg = &$api_sdn_config($cfg, $sdnid);
            next if $param->{type} && $param->{type} ne $scfg->{type};
+
+           my $plugin_config = $cfg->{ids}->{$sdnid};
+           my $plugin = PVE::Network::SDN::Plugin->lookup($plugin_config->{type});
+           my $pd = $plugin->plugindata();
+           my $role = $pd->{role};
+           $scfg->{role} = $role;
            push @$res, $scfg;
        }