use std::{any::Any, net::ToSocketAddrs};
use crate::error::Error;
use super::config::ConfigSession;
pub trait NetworkDevice {
fn connect<A: ToSocketAddrs>(
addr: A,
username: Option<&str>,
password: Option<&str>,
) -> Result<Self, Error>
where
Self: Sized;
fn into_dyn(self) -> Box<dyn NetworkDevice>
where
Self: Sized + 'static,
{
Box::new(self)
}
fn as_any(&mut self) -> &mut dyn Any
where
Self: 'static;
fn execute(&mut self, command: &str) -> Result<String, Error>;
fn enter_config(&mut self) -> Result<Box<dyn ConfigSession + '_>, Error>;
fn exit(&mut self) -> Result<(), Error>;
fn version(&mut self) -> Result<String, Error>;
fn logbuffer(&mut self) -> Result<String, Error>;
fn ping(&mut self, ip: &str) -> Result<String, Error>;
}