chore: Some cleanup in harmony repo
This commit is contained in:
parent
58a4e7882b
commit
3592b176e5
@ -1,5 +1,5 @@
|
|||||||
mod management;
|
mod management;
|
||||||
use std::sync::{Arc, Mutex, RwLock, RwLockWriteGuard};
|
use std::sync::{Arc, RwLock };
|
||||||
|
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use log::debug;
|
use log::debug;
|
||||||
|
@ -2,3 +2,8 @@ mod domain;
|
|||||||
pub use domain::*;
|
pub use domain::*;
|
||||||
pub mod infra;
|
pub mod infra;
|
||||||
pub mod modules;
|
pub mod modules;
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use crate::infra::opnsense::OPNSenseFirewall;
|
||||||
|
}
|
||||||
|
@ -16,42 +16,43 @@ use crate::{
|
|||||||
|
|
||||||
use crate::domain::score::Score;
|
use crate::domain::score::Score;
|
||||||
|
|
||||||
/// OPNSenseDhcpScore will set static DHCP entries using index based hostname
|
/**
|
||||||
/// and ip addresses.
|
OPNSenseDhcpScore will set static DHCP entries using index based hostname
|
||||||
///
|
and ip addresses.
|
||||||
/// For example :
|
|
||||||
/// ```rust
|
For example :
|
||||||
///
|
```rust
|
||||||
/// let node1 = todo!(); // Node pointing to clustermember controlplane0 with ip 10.10.0.20 and host with mac 01
|
let node1 = todo!(); // Node pointing to clustermember controlplane0 with ip 10.10.0.20 and host with mac 01
|
||||||
/// let node2 = todo!(); // Node pointing to clustermember controlplane1 with ip 10.10.0.21 and host with mac 02
|
let node2 = todo!(); // Node pointing to clustermember controlplane1 with ip 10.10.0.21 and host with mac 02
|
||||||
/// let node3 = todo!(); // Node pointing to clustermember controlplane2 with ip 10.10.0.22 and host with mac 03
|
let node3 = todo!(); // Node pointing to clustermember controlplane2 with ip 10.10.0.22 and host with mac 03
|
||||||
///
|
|
||||||
/// let score = OPNSenseDhcpScore {
|
let score = OPNSenseDhcpScore {
|
||||||
/// nodes: vec![node1, node2, node3],
|
nodes: vec![node1, node2, node3],
|
||||||
/// }
|
}
|
||||||
/// ```
|
```
|
||||||
///
|
|
||||||
/// Running such a score would create these static entries :
|
Running such a score would create these static entries :
|
||||||
///
|
|
||||||
/// ```rust
|
```rust
|
||||||
/// let entries = vec![
|
let entries = vec![
|
||||||
/// DHCPEntry {
|
DHCPEntry {
|
||||||
/// mac: 01,
|
mac: 01,
|
||||||
/// ip: 10.10.0.20,
|
ip: 10.10.0.20,
|
||||||
/// hostname: "controlplane0"
|
hostname: "controlplane0"
|
||||||
/// }
|
}
|
||||||
/// DHCPEntry {
|
DHCPEntry {
|
||||||
/// mac: 02,
|
mac: 02,
|
||||||
/// ip: 10.10.0.21,
|
ip: 10.10.0.21,
|
||||||
/// hostname: "controlplane0"
|
hostname: "controlplane0"
|
||||||
/// }
|
}
|
||||||
/// DHCPEntry {
|
DHCPEntry {
|
||||||
/// mac: 03,
|
mac: 03,
|
||||||
/// ip: 10.10.0.22,
|
ip: 10.10.0.22,
|
||||||
/// hostname: "controlplane2"
|
hostname: "controlplane2"
|
||||||
/// }
|
}
|
||||||
/// ]
|
]
|
||||||
/// ```
|
```
|
||||||
|
*/
|
||||||
#[derive(Debug, new, Clone)]
|
#[derive(Debug, new, Clone)]
|
||||||
pub struct DhcpScore {
|
pub struct DhcpScore {
|
||||||
host_binding: Vec<HostBinding>,
|
host_binding: Vec<HostBinding>,
|
||||||
@ -78,7 +79,7 @@ pub struct DhcpInterpret {
|
|||||||
impl DhcpInterpret {
|
impl DhcpInterpret {
|
||||||
pub fn new(score: DhcpScore) -> Self {
|
pub fn new(score: DhcpScore) -> Self {
|
||||||
let version = Version::from("1.0.0").expect("Version should be valid");
|
let version = Version::from("1.0.0").expect("Version should be valid");
|
||||||
let name = "OPNSenseDhcpScore".to_string();
|
let name = "DhcpInterpret".to_string();
|
||||||
let id = Id::from_string(format!("{name}_{version}"));
|
let id = Id::from_string(format!("{name}_{version}"));
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
|
Loading…
Reference in New Issue
Block a user