vendors

package
v0.0.0-...-e702a9a Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver

type Driver interface {
	// Vendor returns the vendor and the driver instance. The vendor is used
	// to identify the driver and the driver instance is used to call the
	// functions of the driver.
	Vendor() registry.Vendor
	// Connect connects to the switch via SSH. The connection information is
	// provided via the first parameter. Keep in mind that the password is
	// not encrypted.
	Connect(cfg config.Connection) error
	// Disconnect disconnects from the switch.
	Disconnect() error

	// GetHardwareInfo returns the hardware information of the switch. The
	// HardwareInfo struct may contain not all information, depending on the
	// vendor.
	GetHardwareInfo() (*models.HardwareInfo, error)
	// ListArpTable returns the ARP table of the switch. The ARP table contains
	// all MAC addresses and the switch port they are connected to.
	ListArpTable() ([]models.ArpEntry, error)

	// ListInterfaces returns a list of all interfaces, build in the switch. The
	// interface list may contain not all information, depending on the vendor.
	ListInterfaces() ([]*models.Interface, error)
	// ConfigureInterface configures the interface with the given configuration.
	// Returns true if the interface was changed and false if not.
	ConfigureInterface(update *models.UpdateInterface) (bool, error)
	// GetInterface returns the interface with the given name. The interface
	// may contain not all information, depending on the vendor.
	GetInterface(name string) (*models.Interface, error)
	// ListLLDPNeighbors returns a list of neighbors, which are discovered
	// through LLDP. This information can be used to get insights about the
	// network topology or for debugging purposes.
	ListLLDPNeighbors() ([]models.LLDPNeighbor, error)

	// Logger returns the logger of the driver. This is a generic logger, which
	// can be overwritten by the vendor driver.
	Logger() *log.Logger
}

Driver is the interface, which all vendor drivers have to implement. The driver is responsible for connecting to the switch, getting information about the switch and configuring the switch. The driver can also overwrite the logger. Some vendors do not support all features, so some functions may return the "not implemented" error.

func New

func New(vendor registry.Vendor) (Driver, error)

New returns a new driver for the given vendor. If the vendor is not supported, an error is returned.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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