74 lines
1.7 KiB
Rust
74 lines
1.7 KiB
Rust
|
|
// SDN (Software-Defined Networking) management module
|
||
|
|
// Provides operations for managing Proxmox SDN
|
||
|
|
|
||
|
|
use serde::{Deserialize, Serialize};
|
||
|
|
|
||
|
|
/// EVPN zone information
|
||
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||
|
|
pub struct EvpnZone {
|
||
|
|
pub zone: String,
|
||
|
|
pub asn: u32,
|
||
|
|
pub vni: u32,
|
||
|
|
pub gateways: Vec<String>,
|
||
|
|
pub status: String,
|
||
|
|
}
|
||
|
|
|
||
|
|
/// Virtual network information
|
||
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||
|
|
pub struct VirtualNetwork {
|
||
|
|
pub vnet: String,
|
||
|
|
pub zone: String,
|
||
|
|
pub l2vni: u32,
|
||
|
|
pub dhcp: bool,
|
||
|
|
pub status: String,
|
||
|
|
}
|
||
|
|
|
||
|
|
/// List EVPN zones
|
||
|
|
pub async fn list_evpn_zones(
|
||
|
|
_client: &crate::proxmox::client::ProxmoxClient,
|
||
|
|
_ticket: &str,
|
||
|
|
) -> Result<Vec<EvpnZone>, String> {
|
||
|
|
Err("Not implemented yet".to_string())
|
||
|
|
}
|
||
|
|
|
||
|
|
/// Create EVPN zone
|
||
|
|
pub async fn create_evpn_zone(
|
||
|
|
_client: &crate::proxmox::client::ProxmoxClient,
|
||
|
|
_zone: &str,
|
||
|
|
_asn: u32,
|
||
|
|
_vni: u32,
|
||
|
|
_ticket: &str,
|
||
|
|
) -> Result<(), String> {
|
||
|
|
Err("Not implemented yet".to_string())
|
||
|
|
}
|
||
|
|
|
||
|
|
/// List virtual networks
|
||
|
|
pub async fn list_vnets(
|
||
|
|
_client: &crate::proxmox::client::ProxmoxClient,
|
||
|
|
_ticket: &str,
|
||
|
|
) -> Result<Vec<VirtualNetwork>, String> {
|
||
|
|
Err("Not implemented yet".to_string())
|
||
|
|
}
|
||
|
|
|
||
|
|
#[cfg(test)]
|
||
|
|
mod tests {
|
||
|
|
use super::*;
|
||
|
|
|
||
|
|
#[test]
|
||
|
|
fn test_evpn_zone_serialization() {
|
||
|
|
let zone = EvpnZone {
|
||
|
|
zone: "primary".to_string(),
|
||
|
|
asn: 65001,
|
||
|
|
vni: 1000,
|
||
|
|
gateways: vec!["10.0.0.1".to_string()],
|
||
|
|
status: "active".to_string(),
|
||
|
|
};
|
||
|
|
|
||
|
|
let json = serde_json::to_string(&zone).unwrap();
|
||
|
|
let deserialized: EvpnZone = serde_json::from_str(&json).unwrap();
|
||
|
|
|
||
|
|
assert_eq!(zone.zone, deserialized.zone);
|
||
|
|
assert_eq!(zone.status, "active");
|
||
|
|
}
|
||
|
|
}
|