When querying the status of EVPN IP/MAC-VRFs, the nodes field of the
zone configuration is read. The nodes are returned as a dictionary,
but the API endpoints are treating the field as an array. This leads
to an error when trying to obtain the status of an EVPN zone with
nodes configured explicitly:

  Not an ARRAY reference at /usr/share/perl5/PVE/API2/Network/SDN/Nodes/Zone.pm 
line 379.

or

  Not an ARRAY reference at /usr/share/perl5/PVE/API2/Network/SDN/Nodes/Vnet.pm 
line 141.

This has been reported by a user in the forum [1].

[1] 
https://forum.proxmox.com/threads/sdn-evpn-ip-vrf-and-mac-vrf-panels-are-empty-but-vtysh-shows-correct-routes.183897/

Signed-off-by: Stefan Hanreich <[email protected]>
---
 src/PVE/API2/Network/SDN/Nodes/Vnet.pm | 2 +-
 src/PVE/API2/Network/SDN/Nodes/Zone.pm | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/PVE/API2/Network/SDN/Nodes/Vnet.pm 
b/src/PVE/API2/Network/SDN/Nodes/Vnet.pm
index d5dae56b..8cbf1e5e 100644
--- a/src/PVE/API2/Network/SDN/Nodes/Vnet.pm
+++ b/src/PVE/API2/Network/SDN/Nodes/Vnet.pm
@@ -138,7 +138,7 @@ __PACKAGE__->register_method({
         raise_param_exc({
             zone => "zone $vnet->{zone} of vnet $vnet_id does not exist on 
node $node_id",
         })
-            if defined($zone->{nodes}) && !grep { $_ eq $node_id } 
$zone->{nodes}->@*;
+            if defined($zone->{nodes}) && !$zone->{nodes}->{$node_id};
 
         return PVE::RS::SDN::Fabrics::l2vpn_routes($vnet_id);
     },
diff --git a/src/PVE/API2/Network/SDN/Nodes/Zone.pm 
b/src/PVE/API2/Network/SDN/Nodes/Zone.pm
index c1e48da7..a4e72c50 100644
--- a/src/PVE/API2/Network/SDN/Nodes/Zone.pm
+++ b/src/PVE/API2/Network/SDN/Nodes/Zone.pm
@@ -376,7 +376,7 @@ __PACKAGE__->register_method({
         raise_param_exc({
             zone => "zone does not exist on node $node_id",
         })
-            if defined($zone->{nodes}) && !grep { $_ eq $node_id } 
$zone->{nodes}->@*;
+            if defined($zone->{nodes}) && !$zone->{nodes}->{$node_id};
 
         return PVE::RS::SDN::Fabrics::l3vpn_routes($zone_id);
     },
-- 
2.47.3




Reply via email to