9 releases (5 breaking)

0.6.0 Sep 27, 2024
0.5.1 Sep 2, 2024
0.4.0 Aug 29, 2024
0.3.0 Aug 22, 2024
0.1.0 Aug 21, 2024

#920 in Network programming

Download history 168/week @ 2024-08-15 258/week @ 2024-08-22 385/week @ 2024-08-29 41/week @ 2024-09-05 16/week @ 2024-09-12 4/week @ 2024-09-19 150/week @ 2024-09-26 11/week @ 2024-10-03

181 downloads per month

MIT license

22KB
338 lines

Rustmiko

(Currently) less compatible, but better typed Netmiko alternative in Rust.

Documentation

Documentation is available on docs.rs.

Compatibility

Type Meaning
Automated Tested, Supported and unit tests exist
Full Tested and fully supported
Partial Tested, but limited usage possible
Buggy No guarantee on anything
Brand Device Support
Cisco Catalyst 2960 Series Full
Juniper EX Series Full
Juniper SRX Series Full

Example

This example will set all ports up on a Cisco Catalyst 2960/CX Series Switch.

fn main() -> anyhow::Result<()> {
	let mut cisco = match CiscoTelnet::connect("192.168.1.101:23", "admin", "admin") {
		Ok(cisco) => {
			println!("Connected successfully");
			cisco
		},
		Err(e) => {
			eprintln!("Failed to connect: {}", e);
			return Ok(());
		},
	};

	{
		let mut config = cisco.enter_config()?;
		for index in 1..=8 {
			let interface = config.get_interface("gi", &[0, index]);
			match config.interface_up(&interface) {
                Ok(_) => println!("Interface {} is now up", interface.name()),
                Err(_) => println!("Failed to set Interface {} up", interface.name())
            }
		}
	}

	if let Err(e) = cisco.save() {
		eprintln!("Failed to save configuration: {e}");
	}

	Ok(())
}

Contributions

Due to the disadvantage of me being a human being, I do not have the ability or resources to own every switch in the entire world to test. I'd be really grateful if more configurations for different switches are added.

Thanks!

Dependencies

~7.5MB
~146K SLoC