diff --git a/harmony/src/domain/maestro/mod.rs b/harmony/src/domain/maestro/mod.rs index ed28173..46ec8da 100644 --- a/harmony/src/domain/maestro/mod.rs +++ b/harmony/src/domain/maestro/mod.rs @@ -3,7 +3,7 @@ use std::sync::{Arc, RwLock}; use log::info; use super::{ - interpret::{Interpret, InterpretError, Outcome}, + interpret::{InterpretError, Outcome}, inventory::Inventory, score::Score, topology::HAClusterTopology, diff --git a/harmony/src/domain/topology/mod.rs b/harmony/src/domain/topology/mod.rs index 81dd36e..438a3dd 100644 --- a/harmony/src/domain/topology/mod.rs +++ b/harmony/src/domain/topology/mod.rs @@ -14,7 +14,7 @@ pub use http::*; pub use network::*; pub use tftp::*; -use std::{net::IpAddr, sync::Arc}; +use std::net::IpAddr; pub type IpAddress = IpAddr; diff --git a/harmony/src/modules/lamp.rs b/harmony/src/modules/lamp.rs new file mode 100644 index 0000000..b0aa94f --- /dev/null +++ b/harmony/src/modules/lamp.rs @@ -0,0 +1,70 @@ +use async_trait::async_trait; + +use crate::{ + data::{Id, Version}, + interpret::{Interpret, InterpretError, InterpretName, InterpretStatus, Outcome}, + inventory::Inventory, + modules::k8s::deployment::K8sDeploymentScore, + score::Score, + topology::HAClusterTopology, +}; + +#[derive(Debug, Clone)] +pub struct LAMPScore { + pub name: String, +} + +impl Score for LAMPScore { + fn create_interpret(&self) -> Box { + todo!() + } + + fn name(&self) -> String { + "LampScore".to_string() + } + + fn clone_box(&self) -> Box { + Box::new(self.clone()) + } +} + +#[derive(Debug)] +pub struct LAMPInterpret { + score: LAMPScore, +} + +#[async_trait] +impl Interpret for LAMPInterpret { + async fn execute( + &self, + inventory: &Inventory, + topology: &HAClusterTopology, + ) -> Result { + let deployment_score = K8sDeploymentScore { + name: self.score.name.clone(), + image: "local_image".to_string(), + }; + + deployment_score + .create_interpret() + .execute(inventory, topology) + .await?; + todo!() + } + + fn get_name(&self) -> InterpretName { + todo!() + } + + fn get_version(&self) -> Version { + todo!() + } + + fn get_status(&self) -> InterpretStatus { + todo!() + } + + fn get_children(&self) -> Vec { + todo!() + } +} diff --git a/harmony/src/modules/mod.rs b/harmony/src/modules/mod.rs index c181375..51e164f 100644 --- a/harmony/src/modules/mod.rs +++ b/harmony/src/modules/mod.rs @@ -7,3 +7,4 @@ pub mod load_balancer; pub mod okd; pub mod opnsense; pub mod tftp; +pub mod lamp; diff --git a/opnsense-config-xml/src/data/dhcpd.rs b/opnsense-config-xml/src/data/dhcpd.rs index 6e694b5..5b06610 100644 --- a/opnsense-config-xml/src/data/dhcpd.rs +++ b/opnsense-config-xml/src/data/dhcpd.rs @@ -4,13 +4,6 @@ use yaserde::MaybeString; use super::opnsense::{NumberOption, Range, StaticMap}; -// #[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] -// #[yaserde(rename = "dhcpd")] -// pub struct Dhcpd { -// #[yaserde(rename = "lan")] -// pub lan: DhcpInterface, -// } - #[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] pub struct DhcpInterface { pub enable: Option, @@ -42,77 +35,3 @@ pub struct DhcpRange { #[yaserde(rename = "to")] pub to: String, } - -#[cfg(test)] -mod test { - use crate::xml_utils::to_xml_str; - - use pretty_assertions::assert_eq; - - #[test] - fn dhcpd_should_deserialize_serialize_identical() { - let dhcpd: Dhcpd = - yaserde::de::from_str(SERIALIZED_DHCPD).expect("Deserialize Dhcpd failed"); - - assert_eq!( - to_xml_str(&dhcpd).expect("Serialize Dhcpd failed"), - SERIALIZED_DHCPD - ); - } - - const SERIALIZED_DHCPD: &str = " - - - 1 - 192.168.20.1 - somedomain.yourlocal.mcd - hmac-md5 - - - - - 192.168.20.50 - 192.168.20.200 - - - 192.168.20.1 - - - 55:55:55:55:55:1c - 192.168.20.160 - somehost983 - someservire8 - - - - - - 55:55:55:55:55:1c - 192.168.20.155 - somehost893 - - - - - - 55:55:55:55:55:1c - 192.168.20.165 - somehost893 - - - - - - - 55:55:55:55:55:1c - 192.168.20.50 - hostswitch2 - switch-2 (bottom) - - - - - - -\n"; -}