Documentation
¶
Overview ¶
Package networkdeviceconfigimpl implements the networkdeviceconfig component interface
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthCredentials ¶
type AuthCredentials struct {
Username string `mapstructure:"username"`
Password string `mapstructure:"password"`
Port string `mapstructure:"port"`
Protocol string `mapstructure:"protocol"`
}
AuthCredentials holds the authentication credentials to connect to a network device.
type DeviceConfig ¶
type DeviceConfig struct {
IPAddress string `mapstructure:"ip_address"` // ip address of the network device, e.g., "10.0.0.1"
Auth AuthCredentials `mapstructure:"auth"`
}
DeviceConfig holds the info to connect to a network device, including its IP address and authentication credentials.
type ProcessedNcmConfig ¶
type ProcessedNcmConfig struct {
Namespace string
Devices map[string]DeviceConfig // map of device IP addresses to DeviceConfig
}
ProcessedNcmConfig is the processed config structure for Network Config Management (NCM) to be used by the component
type Provides ¶
type Provides struct {
Comp networkdeviceconfig.Component
}
Provides defines the output of the networkdeviceconfig component
func NewComponent ¶
NewComponent creates a new networkdeviceconfig component
type RawNcmConfig ¶
type RawNcmConfig struct {
Namespace string `mapstructure:"namespace"` // namespace for the network config management, e.g., "default"
Devices []DeviceConfig `mapstructure:"devices"`
}
RawNcmConfig is the raw config structure for Network Config Management (NCM) taken from the Agent configuration
type RemoteClient ¶
type RemoteClient interface {
NewSession() (RemoteSession, error)
Close() error
}
RemoteClient defines the interface for a remote client that can create sessions to execute commands on a device
type RemoteClientFactory ¶
type RemoteClientFactory interface {
Connect(ip string, auth AuthCredentials) (RemoteClient, error)
}
RemoteClientFactory defines the interface for creating remote clients
type RemoteSession ¶
RemoteSession defines the interface for a session that can execute commands on a remote device
type Requires ¶
type Requires struct {
// Remove this field if the component has no lifecycle hooks
Lifecycle compdef.Lifecycle
Config config.Component
Logger log.Component
}
Requires defines the dependencies for the networkdeviceconfig component
type SSHClient ¶
type SSHClient struct {
// contains filtered or unexported fields
}
SSHClient implements RemoteClient using SSH
func (*SSHClient) NewSession ¶
func (r *SSHClient) NewSession() (RemoteSession, error)
NewSession creates a new SSH session for the client (needed for every command execution)
type SSHClientFactory ¶
type SSHClientFactory struct{}
SSHClientFactory creates a new SSHClient for SSH connections
func (*SSHClientFactory) Connect ¶
func (f *SSHClientFactory) Connect(ip string, auth AuthCredentials) (RemoteClient, error)
Connect establishes a new SSH connection to the specified IP address using the provided authentication credentials
type SSHSession ¶
type SSHSession struct {
// contains filtered or unexported fields
}
SSHSession implements RemoteSession using an SSH session
func (*SSHSession) CombinedOutput ¶
func (s *SSHSession) CombinedOutput(cmd string) ([]byte, error)
CombinedOutput runs a command using the SSH session and returns its output