frr

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandError

type CommandError struct {
	Command   string
	Error     error
	Context   string
	Timestamp time.Time
	Output    string
}

CommandError represents a failed command execution

type ErrorCollector

type ErrorCollector struct {
	// contains filtered or unexported fields
}

ErrorCollector collects command execution results

type ExecutionResult

type ExecutionResult struct {
	Output           string
	Success          bool
	Error            error
	ExecutionTime    time.Duration
	CommandsExecuted int
	ErrorCount       int
}

ExecutionResult represents the result of command execution

type VtyshCommand

type VtyshCommand struct {
	Command     string
	Description string
	Required    bool
}

VtyshCommand represents a single vtysh command

type VtyshManager

type VtyshManager struct {
	// contains filtered or unexported fields
}

VtyshManager manages vtysh operations with enhanced error handling

func NewVtyshManager

func NewVtyshManager(logger *logger.Logger) *VtyshManager

NewVtyshManager creates a new VtyshManager with error tracking

func (*VtyshManager) CheckProtocolRunning

func (vm *VtyshManager) CheckProtocolRunning(protocol string) (bool, error)

CheckProtocolRunning checks if a specific FRR protocol is running

func (*VtyshManager) ExecuteCommand

func (vm *VtyshManager) ExecuteCommand(command string) (string, error)

ExecuteCommand executes a single vtysh command and returns its output

func (*VtyshManager) ExecuteCommandsInContext

func (vm *VtyshManager) ExecuteCommandsInContext(context string, commands []string) error

ExecuteCommandsInContext executes multiple commands in a specific context

func (*VtyshManager) ExecuteSimpleSession

func (vm *VtyshManager) ExecuteSimpleSession(commands []string) error

ExecuteSimpleSession executes commands in a single vtysh session with proper validation

func (*VtyshManager) GetCurrentConfig

func (vm *VtyshManager) GetCurrentConfig(section string) (string, error)

GetCurrentConfig retrieves current configuration for a specific section

func (*VtyshManager) ValidateVtyshAvailable

func (vm *VtyshManager) ValidateVtyshAvailable() error

ValidateVtyshAvailable checks if vtysh is available and accessible

func (*VtyshManager) WaitForProtocolReady

func (vm *VtyshManager) WaitForProtocolReady(protocol string, timeout time.Duration) error

WaitForProtocolReady waits for a protocol to be ready after configuration changes

func (*VtyshManager) WriteMemory

func (vm *VtyshManager) WriteMemory() error

WriteMemory saves the running configuration to startup configuration

type VtyshManagerInterface

type VtyshManagerInterface interface {
	ExecuteCommand(command string) (string, error)
	ExecuteSession(session *VtyshSession) error
	ExecuteSimpleSession(commands []string) error
	ExecuteCommandsInContext(context string, commands []string) error
	GetCurrentConfig(section string) (string, error)
	CheckProtocolRunning(protocol string) (bool, error)
	ParseConfigSection(section string) (map[string][]string, error)
	ValidateVtyshAvailable() error
	WaitForProtocolReady(protocol string, timeout time.Duration) error
}

VtyshManagerInterface defines the interface for vtysh operations

type VtyshSession

type VtyshSession struct {
	Commands []VtyshCommand
	Context  string // e.g., "configure terminal", "router bgp 65001"
}

VtyshSession represents a vtysh configuration session

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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