Documentation ¶
Overview ¶
Package discovery implements the link and host discovery control logic
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { EmitFrequency int64 `mapstructure:"emitFrequency" yaml:"emitFrequency"` MaxLinkAge int64 `mapstructure:"maxLinkAge" yaml:"maxLinkAge"` PipelineValidationFrequency int64 `mapstructure:"pipelineValidationFrequency" yaml:"pipelineValidationFrequency"` PortRediscoveryFrequency int64 `mapstructure:"portRediscoveryFrequency" yaml:"portRediscoveryFrequency"` LinkPruneFrequency int64 `mapstructure:"linkPruneFrequency" yaml:"linkPruneFrequency"` }
Config contains configuration parameters for the link discovery
type Controller ¶
type Controller struct { configtree.Configurable configtree.GNMIConfigurable TargetAddress string IngressDeviceID string // contains filtered or unexported fields }
Controller represents the link discovery control
func NewController ¶
func NewController(targetAddress string, agentID string) *Controller
NewController creates a new link discovery controller
func (*Controller) GetLinks ¶
func (c *Controller) GetLinks() []*Link
GetLinks returns a list of currently discovered links, sorted by ingress port
func (*Controller) RefreshConfig ¶
func (c *Controller) RefreshConfig()
RefreshConfig refreshes the config tree state from any relevant external source state
func (*Controller) UpdateConfig ¶
func (c *Controller) UpdateConfig()
UpdateConfig should be called after the configuration tree has been updated to save the configuration and to reflect it back to the controller's Config structure for easy access.
type Link ¶
type Link struct { EgressPort uint32 EgressDeviceID string IngressPort uint32 LastUpdate time.Time }
Link holds data about each discovered ingress links
type State ¶
type State int
State represents the various states of controller lifecycle
const ( // Disconnected represents the default/initial state Disconnected State = iota // Connected represents state where Stratum connection(s) have been established Connected // PipelineConfigAvailable represents state where P4Info has been obtained PipelineConfigAvailable // Elected represents state where the link agent established mastership for its role Elected // PortsDiscovered represents state where the link agent discovered all Stratum ports PortsDiscovered // Configured represents state where the link agent has been fully configured and can discover links Configured // Reconfigured represents state where new configuration has been received Reconfigured // Stopped represents state where the link agent has been issued a stop command Stopped )