[snip]
diff --git a/proxmox-ve-config/src/sdn/fabric/section_config/mod.rs 
b/proxmox-ve-config/src/sdn/fabric/section_config/mod.rs
index 7db378837eb1..174ea4d126c5 100644
--- a/proxmox-ve-config/src/sdn/fabric/section_config/mod.rs
+++ b/proxmox-ve-config/src/sdn/fabric/section_config/mod.rs
@@ -2,3 +2,108 @@ pub mod fabric;
 pub mod interface;
 pub mod node;
 pub mod protocol;
+
+use const_format::concatcp;
+use serde::{Deserialize, Serialize};
+
+use crate::sdn::fabric::section_config::{
+    fabric::{Fabric, FabricSection, FABRIC_ID_REGEX_STR},
+    node::{Node, NodeSection, NODE_ID_REGEX_STR},
+    protocol::{
+        openfabric::{OpenfabricNodeProperties, OpenfabricProperties},
+        ospf::{OspfNodeProperties, OspfProperties},
+    },
+};
+
+use proxmox_schema::{api, const_regex, ApiStringFormat};
+
+/// Represents a value that can be one of two given types.
+///
+/// This is used for the fabrics section config, where values could either be 
Fabrics or Nodes. It

Then please make it  `Fabric(F)` and `Node(N)` instead of `Left` and
`Right`...

A local helper type with a completely generic name and variant names is
just confusing otherwise.

Agree, changed it.

+/// can be used to split the sections contained in the config into their 
concrete types safely.
+pub enum Either<L, R> {
+    Left(L),
+    Right(R),
+}
+
+impl From<Section> for Either<Fabric, Node> {
+    fn from(section: Section) -> Self {
+        match section {
+            Section::OpenfabricFabric(fabric_section) => 
Self::Left(fabric_section.into()),
+            Section::OspfFabric(fabric_section) => 
Self::Left(fabric_section.into()),
+            Section::OpenfabricNode(node_section) => 
Self::Right(node_section.into()),
+            Section::OspfNode(node_section) => 
Self::Right(node_section.into()),
+        }
+    }
+}
+
[snip]

Thanks!


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to