feat: Refactored harmony into a workspace with independent modules per client, completed RusshClient test_connection implementation. Needs refactoring though

This commit is contained in:
jeangab
2024-09-06 16:10:06 -04:00
parent cc01ec5fe5
commit 8592a3bc36
14 changed files with 116 additions and 46 deletions

View File

@@ -4,3 +4,8 @@ version = "0.1.0"
edition = "2021"
[dependencies]
harmony = { path = "../harmony" }
log = { workspace = true }
env_logger = { workspace = true }
tokio = { workspace = true }

View File

@@ -1,9 +1,11 @@
use crate::domain::{
hardware::{Location, Host, HostCategory},
use harmony::domain::{
hardware::{Host, HostCategory, Location, NetworkInterface},
inventory::Inventory,
};
pub fn get_fqm_inventory() -> Inventory {
pub fn get_inventory() -> Inventory {
let network = vec![NetworkInterface::new(1_000_000_000, "TODO MAC ADDRESS".into(), true ) ];
let storage = vec![];
Inventory {
location: Location::new(
"1134 Grande Allée Ouest 1er étage, Québec, Qc".into(),
@@ -11,8 +13,8 @@ pub fn get_fqm_inventory() -> Inventory {
),
host: vec![Host {
category: HostCategory::Server,
network: vec![],
storage: vec![],
network,
storage,
labels: vec![],
}],
switch: vec![],

View File

@@ -1,3 +1,4 @@
pub mod inventory;
pub fn add(left: usize, right: usize) -> usize {
left + right
}

View File

@@ -0,0 +1,22 @@
use fqm::inventory::get_inventory;
use harmony::{
domain::{
inventory::{Inventory, InventoryFilter},
maestro::Maestro,
},
modules::opnsense_dhcp::OPNSenseDhcpScore,
};
use log::info;
#[tokio::main]
async fn main() {
env_logger::init();
tokio::spawn(async move {
info!("FQM Harmony Starting");
let maestro = Maestro::new(get_inventory());
let score = OPNSenseDhcpScore::new(InventoryFilter::new(vec![]));
let result = maestro.interpret(score).await.unwrap();
info!("{result}");
}).await;
}