forked from NationTech/harmony
feat: Refactored harmony into a workspace with independent modules per client, completed RusshClient test_connection implementation. Needs refactoring though
This commit is contained in:
@@ -4,3 +4,8 @@ version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
harmony = { path = "../harmony" }
|
||||
log = { workspace = true }
|
||||
env_logger = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
|
||||
|
||||
@@ -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![],
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
pub mod inventory;
|
||||
pub fn add(left: usize, right: usize) -> usize {
|
||||
left + right
|
||||
}
|
||||
|
||||
22
harmony-rs/fqm/src/main.rs
Normal file
22
harmony-rs/fqm/src/main.rs
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user