driver

package
v0.0.0-...-d379aa0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 21, 2021 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AristaEOSConnectWithSSH

func AristaEOSConnectWithSSH(d *NetDevice) error

func ArubaAOSCXConnectWithSSH

func ArubaAOSCXConnectWithSSH(d *NetDevice) error

func CiscoASAConnectWithSSH

func CiscoASAConnectWithSSH(d *NetDevice) error

func CiscoAireOSConnectWithSSH

func CiscoAireOSConnectWithSSH(d *NetDevice) error

func CiscoIOSXRConnectWithSSH

func CiscoIOSXRConnectWithSSH(d *NetDevice) error

func CiscoNXOSConnectWithSSH

func CiscoNXOSConnectWithSSH(d *NetDevice) error

func CiscoSMBConnectWithSSH

func CiscoSMBConnectWithSSH(d *NetDevice) error

func InitSSHParams

func InitSSHParams(s *SSHParams)

func InitTelnetParams

func InitTelnetParams(s *TelnetParams)

func JuniperJunosConnectWithSSH

func JuniperJunosConnectWithSSH(d *NetDevice) error

func ReadSSH

func ReadSSH(stdOut io.Reader, expect *regexp.Regexp, timeout int64) string

func ReadTelnet

func ReadTelnet(r io.Reader, expect *regexp.Regexp, timeout int64) (string, error)

func RunWithSSH

func RunWithSSH(nd NetDevice, commands []string, ch chan data.Result, wg *sync.WaitGroup)

RunWithSSH is the entrypoint to run commands

func RunWithTelnet

func RunWithTelnet(nd NetDevice, commands []string, ch chan data.Result, wg *sync.WaitGroup)

func SSHClientConfig

func SSHClientConfig(c data.Credentials, s SSHParams) (*ssh.ClientConfig, error)

func SendCommandWithSSH

func SendCommandWithSSH(conn SSHConn, cmd string, expect *regexp.Regexp, timeout int64) (data.CommandOutput, error)

func SendCommandWithTelnet

func SendCommandWithTelnet(conn *telnet.Conn, cmd string, expect *regexp.Regexp, timeout int64) (data.CommandOutput, error)

func SendCommandsWithSSH

func SendCommandsWithSSH(conn SSHConn, commands []string, expect *regexp.Regexp, timeout int64) ([]data.CommandOutput, error)

func SendCommandsWithTelnet

func SendCommandsWithTelnet(conn *telnet.Conn, commands []string, expect *regexp.Regexp, timeout int64) ([]data.CommandOutput, error)

func WriteSSH

func WriteSSH(stdIn io.Writer, cmd string) (int, error)

func WriteTelnet

func WriteTelnet(w io.Writer, s string) error

Types

type Devices

type Devices struct {
	Devices []NetDevice `json:"devices"`
}

Devices holds a collection of Device structs

type NetDevice

type NetDevice struct {
	IP                string `json:"ip"`
	Name              string `json:"name"`
	Vendor            string `json:"vendor"`
	Platform          string `json:"platform"`
	Connector         string `json:"connector"`
	SSHParams         `json:"sshParams"`
	TelnetParams      `json:"telnetParams"`
	data.Variables    `json:"variables"`
	Timeout           int64
	UserPromptRE      *regexp.Regexp
	SuperUserPromptRE *regexp.Regexp
	ConfigPromtRE     *regexp.Regexp
	SSHConn
	TelnetConn *telnet.Conn
	data.Credentials
}

func NewAristaEOSDevice

func NewAristaEOSDevice(d NetDevice) NetDevice

NewAristaEOSDevice takes a NetDevice and initializes a AristaEOSDevice.

func NewArubaAOSCXDevice

func NewArubaAOSCXDevice(d NetDevice) NetDevice

NewArubaAOSCXDevice takes a NetDevice and initializes a ArubaAOSCXDevice.

func NewCiscoASADevice

func NewCiscoASADevice(d NetDevice) NetDevice

NewCiscoASADevice takes a NetDevice and initializes a CiscoASADevice.

func NewCiscoAireOSDevice

func NewCiscoAireOSDevice(d NetDevice) NetDevice

NewCiscoAireOSDevice takes a NetDevice and initializes a CiscoAireOSDevice.

func NewCiscoIOSXRDevice

func NewCiscoIOSXRDevice(d NetDevice) NetDevice

NewCiscoIOSXRDevice takes a NetDevice and initializes a CiscoIOSXRDevice.

func NewCiscoNXOSDevice

func NewCiscoNXOSDevice(d NetDevice) NetDevice

NewCiscoNXOSDevice takes a NetDevice and initializes a CiscoNXOSDevice.

func NewCiscoSMBDevice

func NewCiscoSMBDevice(d NetDevice) NetDevice

NewCiscoSMBDevice takes a NetDevice and initializes a CiscoSMBDevice.

func NewJuniperJunosDevice

func NewJuniperJunosDevice(d NetDevice) NetDevice

NewJuniperJunosDevice takes a NetDevice and initializes a JuniperJunosDevice.

func (*NetDevice) ConnectWithSSH

func (d *NetDevice) ConnectWithSSH() error

func (*NetDevice) ConnectWithTelnet

func (d *NetDevice) ConnectWithTelnet() error

func (NetDevice) DisconnectSSH

func (d NetDevice) DisconnectSSH() error

func (NetDevice) DisconnectTelnet

func (d NetDevice) DisconnectTelnet() error

func (NetDevice) SendCommandWithSSH

func (d NetDevice) SendCommandWithSSH(command string) data.Result

func (NetDevice) SendCommandWithTelnet

func (d NetDevice) SendCommandWithTelnet(cmd string) data.Result

func (NetDevice) SendCommandsWithSSH

func (d NetDevice) SendCommandsWithSSH(commands []string) data.Result

func (NetDevice) SendCommandsWithTelnet

func (d NetDevice) SendCommandsWithTelnet(commands []string) data.Result

type SSHConn

type SSHConn struct {
	Session *ssh.Session
	StdIn   io.Writer
	StdOut  io.Reader
}

func ConnectWithSSH

func ConnectWithSSH(host string, port int, clientConfig *ssh.ClientConfig) (SSHConn, error)

type SSHParams

type SSHParams struct {
	Port                int    `json:"port"`
	KnownHostsFile      string `json:"knownHostsFile"`
	InsecureConnection  bool   `json:"insecureConnection"`
	InsecureCiphers     bool   `json:"insecureCiphers"`
	InsecureKeyExchange bool   `json:"insecureKeyExchange"`
}

type TelnetParams

type TelnetParams struct {
	Port int `json:"port"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL