From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 0DB691FF16B for ; Fri, 7 Nov 2025 15:34:29 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 72B12140CD; Fri, 7 Nov 2025 15:32:51 +0100 (CET) From: Stefan Hanreich To: pve-devel@lists.proxmox.com Date: Fri, 7 Nov 2025 15:31:23 +0100 Message-ID: <20251107143201.689035-10-s.hanreich@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251107143201.689035-1-s.hanreich@proxmox.com> References: <20251107143201.689035-1-s.hanreich@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 1 AWL -1.478 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy ENA_SUBJ_ODD_CASE 2.6 Subject has odd case KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods RDNS_NONE 0.793 Delivered to internal network by a host with no rDNS SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record Subject: [pve-devel] [PATCH proxmox-ve-rs v3 7/7] add derive PartialEq, Eq and HashMap->BTreeMap for tests X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" From: Gabriel Goller Signed-off-by: Gabriel Goller Signed-off-by: Stefan Hanreich --- proxmox-frr/src/de/evpn.rs | 4 ++-- proxmox-frr/src/de/mod.rs | 10 +++++----- proxmox-frr/src/de/openfabric.rs | 22 +++++++++++----------- proxmox-frr/src/de/ospf.rs | 16 ++++++++-------- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/proxmox-frr/src/de/evpn.rs b/proxmox-frr/src/de/evpn.rs index 97faca4..942aecf 100644 --- a/proxmox-frr/src/de/evpn.rs +++ b/proxmox-frr/src/de/evpn.rs @@ -1,4 +1,4 @@ -use std::{collections::HashMap, net::IpAddr}; +use std::{collections::BTreeMap, net::IpAddr}; use proxmox_network_types::mac_address::MacAddress; use serde::Deserialize; @@ -6,7 +6,7 @@ use serde_repr::Deserialize_repr; /// All EVPN routes #[derive(Debug, Default, Deserialize)] -pub struct Routes(pub HashMap); +pub struct Routes(pub BTreeMap); /// The evpn routes a stored in a hashtable, which has a numPrefix and numPath key at /// the end which stores the number of paths and prefixes. These two keys have a i32 diff --git a/proxmox-frr/src/de/mod.rs b/proxmox-frr/src/de/mod.rs index 121451b..3f2bd68 100644 --- a/proxmox-frr/src/de/mod.rs +++ b/proxmox-frr/src/de/mod.rs @@ -1,4 +1,4 @@ -use std::{collections::HashMap, net::IpAddr}; +use std::{collections::BTreeMap, net::IpAddr}; use proxmox_network_types::ip_address::Cidr; use serde::{Deserialize, Serialize}; @@ -8,7 +8,7 @@ pub mod openfabric; pub mod ospf; /// A nexthop of a route -#[derive(Debug, Serialize, Deserialize, Clone)] +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)] pub struct NextHop { /// IP of the nexthop pub ip: Option, @@ -24,7 +24,7 @@ pub struct NextHop { } /// route -#[derive(Debug, Serialize, Deserialize, Clone)] +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)] pub struct Route { /// Array of all the nexthops associated with this route. When you have e.g. two /// connections between two nodes, there is going to be one route, but two nexthops. @@ -45,5 +45,5 @@ pub struct Route { /// routes we simply ask zebra which routes have been inserted and filter them by protocol. /// The following command is used to accomplish this: `show ip route json`. /// This struct can be used the deserialize the output of that command. -#[derive(Debug, Serialize, Deserialize, Default)] -pub struct Routes(pub HashMap>); +#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq, Eq)] +pub struct Routes(pub BTreeMap>); diff --git a/proxmox-frr/src/de/openfabric.rs b/proxmox-frr/src/de/openfabric.rs index 837159b..f4d522f 100644 --- a/proxmox-frr/src/de/openfabric.rs +++ b/proxmox-frr/src/de/openfabric.rs @@ -1,7 +1,7 @@ use serde::{Deserialize, Serialize}; /// State of the adjacency of a OpenFabric neighbor -#[derive(Debug, Clone, Copy, Serialize, Deserialize)] +#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)] pub enum AdjacencyState { Initializing, Up, @@ -12,7 +12,7 @@ pub enum AdjacencyState { /// Neighbor Interface /// /// Interface used to communicate with a specific neighbor -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] pub struct NeighborInterface { /// The name of the interface pub name: String, @@ -26,7 +26,7 @@ pub struct NeighborInterface { /// Adjacency information /// /// Circuits are Layer-2 Broadcast domains (Either point-to-point or LAN). -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] pub struct Circuit { /// The hostname of the adjacency peer pub adj: Option, @@ -35,7 +35,7 @@ pub struct Circuit { } /// An openfabric area the same as SDN fabric. -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] pub struct Area { /// The are name, this is the same as the fabric_id, so the name of the fabric. pub area: String, @@ -47,14 +47,14 @@ pub struct Area { /// /// This models the output of: /// `vtysh -c 'show openfabric neighbor json'`. -#[derive(Debug, Serialize, Deserialize, Default)] +#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq, Eq)] pub struct Neighbors { /// Every sdn fabric is also an openfabric 'area' pub areas: Vec, } /// The NetworkType of a OpenFabric interface -#[derive(Debug, Clone, Copy, Serialize, Deserialize)] +#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)] pub enum NetworkType { #[serde(rename(deserialize = "p2p", serialize = "Point-To-Point"))] PointToPoint, @@ -67,7 +67,7 @@ pub enum NetworkType { } /// The State of a OpenFabric interface -#[derive(Debug, Clone, Copy, Serialize, Deserialize)] +#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)] pub enum CircuitState { Init, Config, @@ -75,7 +75,7 @@ pub enum CircuitState { Unknown, } -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(rename_all = "kebab-case")] pub struct Interface { pub name: String, @@ -84,18 +84,18 @@ pub struct Interface { pub ty: NetworkType, } -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] pub struct InterfaceCircuits { pub interface: Interface, } -#[derive(Debug, Serialize, Deserialize, Default)] +#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq, Eq)] pub struct InterfaceArea { pub area: String, pub circuits: Vec, } -#[derive(Debug, Serialize, Deserialize, Default)] +#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq, Eq)] pub struct Interfaces { pub areas: Vec, } diff --git a/proxmox-frr/src/de/ospf.rs b/proxmox-frr/src/de/ospf.rs index 7e269fe..c3a6f81 100644 --- a/proxmox-frr/src/de/ospf.rs +++ b/proxmox-frr/src/de/ospf.rs @@ -1,9 +1,9 @@ -use std::collections::HashMap; +use std::collections::BTreeMap; use serde::{Deserialize, Serialize}; /// Information about the Neighbor (Peer) of the Adjacency. -#[derive(Debug, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(rename_all = "camelCase")] pub struct Neighbor { /// The full state of the neighbor. This is "{converged}/{role}". @@ -25,14 +25,14 @@ pub struct Neighbor { } /// The parsed OSPF neighbors -#[derive(Debug, Deserialize, Default)] +#[derive(Debug, Clone, Deserialize, Default, PartialEq, Eq)] pub struct Neighbors { /// The OSPF neighbors. This is nearly always a ip-address - neighbor mapping. - pub neighbors: HashMap>, + pub neighbors: BTreeMap>, } /// All possible OSPF network-types that can be returned from frr -#[derive(Debug, Clone, Copy, Serialize, Deserialize)] +#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)] pub enum NetworkType { #[serde(rename = "Null")] Null, @@ -50,7 +50,7 @@ pub enum NetworkType { Loopback, } -#[derive(Debug, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq, Eq)] #[serde(rename_all = "camelCase")] pub struct Interface { /// The interface state @@ -64,7 +64,7 @@ pub struct Interface { pub network_type: NetworkType, } -#[derive(Debug, Deserialize, Default)] +#[derive(Debug, Clone, Deserialize, Default, PartialEq, Eq)] pub struct Interfaces { - pub interfaces: HashMap, + pub interfaces: BTreeMap, } -- 2.47.3 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel