try out ipmi and redfish rust crates
This commit is contained in:
parent
7d69ac447a
commit
1881428a63
1
harmony-rs/.gitignore
vendored
Normal file
1
harmony-rs/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
target
|
1434
harmony-rs/Cargo.lock
generated
Normal file
1434
harmony-rs/Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
9
harmony-rs/Cargo.toml
Normal file
9
harmony-rs/Cargo.toml
Normal file
@ -0,0 +1,9 @@
|
||||
[package]
|
||||
name = "harmony-rs"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
libredfish = "0.1.1"
|
||||
reqwest = {version = "0.11", features = ["blocking", "json"] }
|
||||
rust-ipmi = "0.1.1"
|
20
harmony-rs/src/main.rs
Normal file
20
harmony-rs/src/main.rs
Normal file
@ -0,0 +1,20 @@
|
||||
use libredfish::{Config, Redfish};
|
||||
use reqwest::blocking::Client;
|
||||
|
||||
pub fn main() {
|
||||
let client = Client::builder().danger_accept_invalid_certs(true).build().expect("Failed to build reqwest client");
|
||||
let redfish = Redfish::new(
|
||||
client,
|
||||
Config {
|
||||
user: Some(String::from("Administrator")),
|
||||
endpoint: String::from("10.10.8.104/redfish/v1"),
|
||||
// password: Some(String::from("YOUR_PASSWORD")),
|
||||
password: Some(String::from("wrongpass")),
|
||||
port: None,
|
||||
},
|
||||
);
|
||||
|
||||
let response = redfish.get_power_status().expect("Failed redfish request");
|
||||
|
||||
println!("Got power {:?}", response);
|
||||
}
|
16
harmony-rs/src/main_ipmi.rs
Normal file
16
harmony-rs/src/main_ipmi.rs
Normal file
@ -0,0 +1,16 @@
|
||||
use rust_ipmi::{IPMIClient, NetFn};
|
||||
fn main() {
|
||||
let connection_string = "192.168.11.132:443";
|
||||
println!("Hello, world! {}", connection_string);
|
||||
let mut client: IPMIClient = IPMIClient::new(connection_string).expect("Failed to create ipmi client");
|
||||
|
||||
client.establish_connection("root", "YOUR_PASSWORD")
|
||||
.expect("Failed to establish connection with the BMC");
|
||||
|
||||
let response = client.send_raw_request(NetFn::App, 0x3b, Some(vec![0x04]));
|
||||
|
||||
match response {
|
||||
Ok(response) => println!("{}", response),
|
||||
Err(err) => println!("Got error {:?}", err),
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user