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

#735 in Network programming

Download history 425/week @ 2024-08-21 375/week @ 2024-08-28 52/week @ 2024-09-04 14/week @ 2024-09-11 6/week @ 2024-09-18 147/week @ 2024-09-25 13/week @ 2024-10-02 2/week @ 2024-10-09

708 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
~148K SLoC