Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions crates/agent/src/command_line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ pub enum AgentCommand {
#[clap(about = "One-off health check")]
Health,

#[clap(about = "Print LLDP neighbors visible on this host and exit")]
LldpNeighbors,

#[clap(about = "One-off network monitor")]
Network(NetworkOptions),

Expand Down
4 changes: 4 additions & 0 deletions crates/agent/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,10 @@ pub async fn start(cmdline: command_line::Options) -> eyre::Result<()> {
println!("{}", serde_json::to_string_pretty(&health_report)?);
}

Some(AgentCommand::LldpNeighbors) => {
carbide_host_support::lldp_collector::print_lldp_neighbors()?;
}

// One-off network monitor check.
// dumps JSON-formatted peer DPU network reachability and latency status
Some(AgentCommand::Network(options)) => {
Expand Down
9 changes: 8 additions & 1 deletion crates/agent/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
use std::time::Duration;

fn main() -> eyre::Result<()> {
let options = agent::Options::load();

// Purely local interrogation for troubleshooting.
if matches!(options.cmd, Some(agent::AgentCommand::LldpNeighbors)) {
return carbide_host_support::lldp_collector::print_lldp_neighbors();
}

carbide_host_support::init_logging("nico-dpu-agent")?;

// We need a multi-threaded runtime since background threads will queue work
Expand All @@ -26,7 +33,7 @@ fn main() -> eyre::Result<()> {
let rt = tokio::runtime::Builder::new_multi_thread()
.enable_all()
.build()?;
rt.block_on(agent::start(agent::Options::load()))?;
rt.block_on(agent::start(options))?;
rt.shutdown_timeout(Duration::from_secs(2));
Ok(())
}
4 changes: 2 additions & 2 deletions crates/host-support/src/hardware_enumeration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ mod tpm;
/// Path where the init container writes the hardware snapshot, and the containerized agent reads it from.
pub const HW_CACHE_PATH: &str = "/data/hw_output.json";

const PCI_SUBCLASS: &str = "ID_PCI_SUBCLASS_FROM_DATABASE";
pub(crate) const PCI_SUBCLASS: &str = "ID_PCI_SUBCLASS_FROM_DATABASE";
const PCI_DEV_PATH: &str = "DEVPATH";
const PCI_MODEL: &str = "ID_MODEL_FROM_DATABASE";
const PCI_SLOT_NAME: &str = "PCI_SLOT_NAME";
Expand Down Expand Up @@ -154,7 +154,7 @@ fn convert_udev_to_mac(udev: String) -> Result<String, HardwareEnumerationError>
Ok(mac)
}

fn convert_property_to_string<'a>(
pub fn convert_property_to_string<'a>(
name: &'a str,
default_value: &'a str,
device: &'a Device,
Expand Down
Loading