feat(harmony): add TFTP server functionality (#10)

Introduce a new module and interface for serving files via TFTP in the HAClusterTopology structure. This includes adding the necessary dependencies, creating the `TftpServer` trait, implementing it where appropriate, and integrating its usage within the topology struct.

Reviewed-on: #10
Co-authored-by: Jean-Gabriel Gill-Couture <jg@nationtech.io>
Co-committed-by: Jean-Gabriel Gill-Couture <jg@nationtech.io>
This commit is contained in:
2025-01-07 19:12:35 +00:00
committed by johnride
parent 098cb30523
commit 925e84e4d2
25 changed files with 914 additions and 320 deletions

View File

@@ -12,3 +12,4 @@ tokio = { workspace = true }
harmony_macros = { version = "1.0.0", path = "../../harmony_macros" }
log = { workspace = true }
env_logger = { workspace = true }
url = { workspace = true }

View File

@@ -9,8 +9,8 @@ use harmony::{
infra::opnsense::OPNSenseManagementInterface,
inventory::Inventory,
maestro::Maestro,
modules::okd::{dhcp::OKDBootstrapDhcpScore, dns::OKDBootstrapDnsScore},
topology::{LogicalHost, UnmanagedRouter},
modules::{okd::{dhcp::OKDBootstrapDhcpScore, dns::OKDBootstrapDnsScore}, tftp::TftpScore},
topology::{LogicalHost, UnmanagedRouter, Url},
};
use harmony_macros::ip;
@@ -23,14 +23,10 @@ async fn main() {
name: String::from("opnsense-1"),
};
let firewall = harmony::topology::LogicalHost {
ip: ip!("127.0.0.1"),
name: String::from("opnsense-1"),
};
let opnsense = Arc::new(
harmony::infra::opnsense::OPNSenseFirewall::new(
firewall,
Some(2222),
None,
"lan",
"root",
"opnsense",
@@ -48,6 +44,7 @@ async fn main() {
)),
load_balancer: opnsense.clone(),
firewall: opnsense.clone(),
tftp_server: opnsense.clone(),
dhcp_server: opnsense.clone(),
dns_server: opnsense.clone(),
control_plane: vec![LogicalHost {
@@ -81,11 +78,13 @@ async fn main() {
// let dhcp_score = OKDBootstrapDhcpScore::new(&topology, &inventory);
// let dns_score = OKDBootstrapDnsScore::new(&topology);
let load_balancer_score =
harmony::modules::okd::load_balancer::OKDLoadBalancerScore::new(&topology);
// let load_balancer_score =
// harmony::modules::okd::load_balancer::OKDLoadBalancerScore::new(&topology);
let tftp_score = TftpScore::new(Url::LocalFolder("../../../watchguard/tftpboot".to_string()));
let maestro = Maestro::new(inventory, topology);
// maestro.interpret(dns_score).await.unwrap();
// maestro.interpret(dhcp_score).await.unwrap();
maestro.interpret(load_balancer_score).await.unwrap();
// maestro.interpret(load_balancer_score).await.unwrap();
maestro.interpret(tftp_score).await.unwrap();
}