wip: Trying to figure out a nice way to have inventory and topology bound, maybe creating nodes that have this only purpose would make sense

This commit is contained in:
jeangab 2024-09-21 09:35:49 -04:00
parent 042ff7e7dd
commit 9d0aa406e4
6 changed files with 27 additions and 6 deletions

View File

@ -31,10 +31,10 @@ pub enum HostCategory {
#[derive(Debug, new, Clone)]
pub struct NetworkInterface {
name: String,
mac_address: MacAddress,
speed: u64,
plugged_in: bool,
pub name: String,
pub mac_address: MacAddress,
pub speed: u64,
pub plugged_in: bool,
}
type MacAddress = String;

View File

@ -0,0 +1,18 @@
use derive_new::new;
use crate::topology::{IpAddress, MacAddress, ManagementInterface};
#[derive(new)]
pub struct HPIlo {
ip_address: IpAddress,
mac_address: MacAddress,
}
impl ManagementInterface for HPIlo {
fn boot_to_pxe(&self) {
todo!()
}
fn get_ip(&self) -> IpAddress {
self.ip_address
}
}

View File

@ -1,9 +1,10 @@
use derive_new::new;
use crate::topology::{IpAddress, ManagementInterface};
use crate::topology::{IpAddress, MacAddress, ManagementInterface};
#[derive(new)]
pub struct IntelAmtManagement {
ip_address: IpAddress,
mac_address: MacAddress,
}
impl ManagementInterface for IntelAmtManagement {

View File

@ -1,3 +1,4 @@
pub mod executors;
pub mod opnsense;
pub mod intel_amt;
pub mod hp_ilo;

View File

@ -1,9 +1,10 @@
use derive_new::new;
use crate::topology::{Backend, DhcpServer, DnsServer, Firewall, FirewallError, FirewallRule, Frontend, IpAddress, LoadBalancer, LoadBalancerError};
use crate::{hardware::NetworkInterface, topology::{Backend, DhcpServer, DnsServer, Firewall, FirewallError, FirewallRule, Frontend, IpAddress, LoadBalancer, LoadBalancerError}};
#[derive(new, Clone)]
pub struct OPNSenseFirewall {
ip_address: IpAddress,
interfaces: Vec<NetworkInterface>,
}
impl Firewall for OPNSenseFirewall {