bird

package
v0.0.0-...-c8940be Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigExtension = ".conf"
View Source
const ResourceTypeBirdEBGPEBGP = "bird-ebgp"

Variables

This section is empty.

Functions

func ReloadBirdConfiguration

func ReloadBirdConfiguration(ctx context.Context) error

func SplitBy

func SplitBy(seq []byte) bufio.SplitFunc

Types

type BGPCapabilitiesInfo

type BGPCapabilitiesInfo []string

+k8s:deepcopy-gen=true

func (BGPCapabilitiesInfo) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BGPCapabilitiesInfo.

func (BGPCapabilitiesInfo) DeepCopyInto

func (in BGPCapabilitiesInfo) DeepCopyInto(out *BGPCapabilitiesInfo)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type BGPProtoBasics

type BGPProtoBasics struct {
	Name  string `json:"name"`
	Proto string `json:"proto"`
	Table string `json:"table"`
	State string `json:"state"`
	Since string `json:"since"`
	Info  string `json:"info"`
}

+k8s:deepcopy-gen=true

func (*BGPProtoBasics) DeepCopy

func (in *BGPProtoBasics) DeepCopy() *BGPProtoBasics

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BGPProtoBasics.

func (*BGPProtoBasics) DeepCopyInto

func (in *BGPProtoBasics) DeepCopyInto(out *BGPProtoBasics)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*BGPProtoBasics) IsEqual

func (basics *BGPProtoBasics) IsEqual(other *BGPProtoBasics) bool

type BGPProtoInfo

type BGPProtoInfo struct {
	Basics *BGPProtoBasics `json:"basics,omitempty"`

	VRF             *string `json:"vrf,omitempty"`
	BGPState        *string `json:"bgp_state,omitempty"`
	NeighborAddress *string `json:"neighbor_address,omitempty"`
	NeighborAS      *string `json:"neighbor_as,omitempty"`
	LocalAS         *string `json:"local_as,omitempty"`
	NeighborID      *string `json:"neighbor_id,omitempty"`
	Session         *string `json:"session,omitempty"`
	SourceAddress   *string `json:"source_address,omitempty"`
	HoldTimer       *string `json:"hold_timer,omitempty"`
	KeepaliveTimer  *string `json:"keepalive_timer,omitempty"`
	SendHoldTimer   *string `json:"send_hold_timer,omitempty"`

	LocalCapabilities    BGPCapabilitiesInfo    `json:"local_capabilities,omitempty"`
	NeighborCapabilities BGPCapabilitiesInfo    `json:"neighbor_capabilities,omitempty"`
	Channels             map[string]ChannelInfo `json:"channels,omitempty"`
}

+k8s:deepcopy-gen=true

func (*BGPProtoInfo) DeepCopy

func (in *BGPProtoInfo) DeepCopy() *BGPProtoInfo

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BGPProtoInfo.

func (*BGPProtoInfo) DeepCopyInto

func (in *BGPProtoInfo) DeepCopyInto(out *BGPProtoInfo)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*BGPProtoInfo) IsEqual

func (info *BGPProtoInfo) IsEqual(other pkginterfacestub.InterfaceStatus) bool

type BGPProtoList

type BGPProtoList []BGPProtocol

func (BGPProtoList) ToConfigs

func (protoList BGPProtoList) ToConfigs(dir string) error

type BGPProtocol

type BGPProtocol struct {
	Name         string  `yaml:"name" json:"name" bson:"name"`
	Template     *string `yaml:"template,omitempty" json:"template,omitempty" bson:"template,omitempty"`
	Interface    *string `yaml:"interface,omitempty" json:"interface,omitempty" bson:"interface,omitempty"`
	LocalAddress *string `yaml:"local_address,omitempty" json:"local_address,omitempty" bson:"local_address,omitempty"`
	PeerAddress  *string `yaml:"peer_address,omitempty" json:"peer_address,omitempty" bson:"peer_address,omitempty"`
	LocalASN     *string `yaml:"local_asn,omitempty" json:"local_asn,omitempty" bson:"local_asn,omitempty"`
	PeerASN      *string `yaml:"peer_asn,omitempty" json:"peer_asn,omitempty" bson:"peer_asn,omitempty"`
	PeerExternal *bool   `yaml:"peer_external,omitempty" json:"peer_external,omitempty" bson:"peer_external,omitempty"`
	PeerInternal *bool   `yaml:"peer_internal,omitempty" json:"peer_internal,omitempty" bson:"peer_internal,omitempty"`

	// For storing in database, distinguish which node the resource belongs to.
	Node *string `yaml:"node,omitempty" json:"node,omitempty" bson:"node,omitempty"`

	// For storing in database, the unique ID to distinguish the resource in the global scope.
	ResourceID *string `yaml:"resource_id,omitempty" json:"resource_id,omitempty" bson:"resource_id,omitempty"`

	// To support soft-deletion.
	Deleted bool `yaml:"deleted,omitempty" json:"deleted,omitempty" bson:"deleted,omitempty"`
}

+k8s:deepcopy-gen=true

func FromDirectory

func FromDirectory(dir string) ([]BGPProtocol, error)

func FromFile

func FromFile(filename string) (*BGPProtocol, error)

func (*BGPProtocol) Cancel

func (proto *BGPProtocol) Cancel(ctx context.Context) error

func (*BGPProtocol) CheckExist

func (proto *BGPProtocol) CheckExist(ctx context.Context) (bool, error)

func (*BGPProtocol) Create

func (proto *BGPProtocol) Create(ctx context.Context) error

func (*BGPProtocol) DeepCopy

func (in *BGPProtocol) DeepCopy() *BGPProtocol

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BGPProtocol.

func (*BGPProtocol) DeepCopyInto

func (in *BGPProtocol) DeepCopyInto(out *BGPProtocol)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*BGPProtocol) Delete

func (bgpProto *BGPProtocol) Delete(ctx context.Context) error

func (*BGPProtocol) DetectChanges

func (proto *BGPProtocol) DetectChanges(ctx context.Context) (pkgreconcile.InterfaceChangeSet, error)

func (*BGPProtocol) GetInterfaceName

func (proto *BGPProtocol) GetInterfaceName() string

func (*BGPProtocol) GetNetNsInfo

func (proto *BGPProtocol) GetNetNsInfo(ctx context.Context) (*pkgnetns.NetNsInfo, error)

func (*BGPProtocol) GetResourceID

func (proto *BGPProtocol) GetResourceID() (string, error)

func (*BGPProtocol) GetType

func (proto *BGPProtocol) GetType() string

func (*BGPProtocol) IsEqual

func (bgpProto *BGPProtocol) IsEqual(other *BGPProtocol) bool

func (*BGPProtocol) IsSoftDeleted

func (proto *BGPProtocol) IsSoftDeleted() bool

func (*BGPProtocol) SetNodeAndResourceID

func (proto *BGPProtocol) SetNodeAndResourceID(nodeName string) error

func (*BGPProtocol) ToBaseName

func (proto *BGPProtocol) ToBaseName() string

func (*BGPProtocol) ToConfig

func (proto *BGPProtocol) ToConfig() (string, error)

func (*BGPProtocol) ToFilePath

func (proto *BGPProtocol) ToFilePath(ctx context.Context) (string, error)

func (*BGPProtocol) ToStatus

type BirdBGPConfigurationList

type BirdBGPConfigurationList struct {
	// This is the directory where the bird bgp protocol configuration files are stored, each file should
	// be named as the pattern `<name>.conf`.
	TargetConfigDirectory string `yaml:"target_config_directory" json:"target_config_directory" bson:"target_config_directory"`

	// The controller/agent will connect to this socket and send command to the bird daemon to reload the new configuration.
	BirdSocketPath string `yaml:"bird_socket_path" json:"bird_socket_path" bson:"bird_socket_path"`

	// The list of BGPProtocol resources that are just parsed as the desired state, and will use in the reconciliation process.
	EBGPProtocols []BGPProtocol `yaml:"ebgp_protocols" json:"ebgp_protocols" bson:"ebgp_protocols"`
}

func (*BirdBGPConfigurationList) DetectChanges

func (bgpConfigList *BirdBGPConfigurationList) DetectChanges(ctx context.Context, delete bool) (pkgreconcile.ResourceListChangeSet, error)

func (*BirdBGPConfigurationList) GetType

func (bgpConfigList *BirdBGPConfigurationList) GetType() string

type BirdBGPProtoInfoParser

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

func NewBirdBGPProtoInfoParser

func NewBirdBGPProtoInfoParser(reader io.Reader) *BirdBGPProtoInfoParser

func (*BirdBGPProtoInfoParser) Parse

func (parser *BirdBGPProtoInfoParser) Parse() *BGPProtoInfo

type BirdBGPProtocolStatus

type BirdBGPProtocolStatus struct {
	// CurrentConfig is the current configuration parsed from file in the disk.
	CurrentConfig *BGPProtocol `yaml:"current_config,omitempty" json:"current_config,omitempty" bson:"current_config,omitempty"`

	// Current Bird BGP Protocol information gathered from `birdc show protocols all <name>`
	ProtocolStatus *BGPProtoInfo `yaml:"protocol_status,omitempty" json:"protocol_status,omitempty" bson:"protocol_status,omitempty"`
}

+k8s:deepcopy-gen=true

func (*BirdBGPProtocolStatus) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BirdBGPProtocolStatus.

func (*BirdBGPProtocolStatus) DeepCopyInto

func (in *BirdBGPProtocolStatus) DeepCopyInto(out *BirdBGPProtocolStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*BirdBGPProtocolStatus) IsEqual

func (bgpStatus *BirdBGPProtocolStatus) IsEqual(other pkginterfacestub.InterfaceStatus) bool

type BirdClient

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

func NewBirdClientFromSocket

func NewBirdClientFromSocket(socketPath string) *BirdClient

func (*BirdClient) Close

func (client *BirdClient) Close() error

func (*BirdClient) Connect

func (client *BirdClient) Connect(ctx context.Context) error

func (*BirdClient) GetConnection

func (client *BirdClient) GetConnection() net.Conn

func (*BirdClient) SendOneOffCommand

func (client *BirdClient) SendOneOffCommand(ctx context.Context, command string) (replies []string, err error)

func (*BirdClient) ShowBGPProtocolInfo

func (client *BirdClient) ShowBGPProtocolInfo(ctx context.Context, protocolName string) (*BGPProtoInfo, error)

type BirdEBGPChangeSet

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

func (*BirdEBGPChangeSet) Apply

func (changeSet *BirdEBGPChangeSet) Apply(ctx context.Context) error

func (*BirdEBGPChangeSet) GetInterfaceName

func (changeSet *BirdEBGPChangeSet) GetInterfaceName() string

func (*BirdEBGPChangeSet) GetType

func (changeSet *BirdEBGPChangeSet) GetType() string

func (*BirdEBGPChangeSet) HasUpdates

func (changeSet *BirdEBGPChangeSet) HasUpdates() bool

type BirdEBGPRessourceListChangeSet

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

func (*BirdEBGPRessourceListChangeSet) GetAddedResources

func (changeSet *BirdEBGPRessourceListChangeSet) GetAddedResources() []pkgreconcile.ResourceProvisioner

func (*BirdEBGPRessourceListChangeSet) GetRemovedResources

func (changeSet *BirdEBGPRessourceListChangeSet) GetRemovedResources() []pkgreconcile.ResourceCanceller

func (*BirdEBGPRessourceListChangeSet) GetUpdatedResources

func (changeSet *BirdEBGPRessourceListChangeSet) GetUpdatedResources() []pkgreconcile.InterfaceChangeSet

func (*BirdEBGPRessourceListChangeSet) HasUpdates

func (changeSet *BirdEBGPRessourceListChangeSet) HasUpdates() bool

type Block

type Block struct {
	BlockIndex int    `json:"block_index"`
	Lines      []Line `json:"lines"`
}

func (*Block) Content

func (b *Block) Content() string

type ChannelInfo

type ChannelInfo struct {
	Name             string                   `json:"name"`
	State            string                   `json:"state"`
	Preference       *int                     `json:"preference,omitempty"`
	InputFilter      string                   `json:"input_filter"`
	OutputFilter     string                   `json:"output_filter"`
	RoutesStat       *ChannelRoutesStat       `json:"routes_stat,omitempty"`
	RouteChangesStat *ChannelRouteChangesStat `json:"route_changes_stat,omitempty"`
	BGPNextHop       *string                  `json:"bgp_next_hop,omitempty"`
}

+k8s:deepcopy-gen=true

func (*ChannelInfo) DeepCopy

func (in *ChannelInfo) DeepCopy() *ChannelInfo

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ChannelInfo.

func (*ChannelInfo) DeepCopyInto

func (in *ChannelInfo) DeepCopyInto(out *ChannelInfo)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ChannelInfo) IsEqual

func (channelInfo *ChannelInfo) IsEqual(other *ChannelInfo) bool

type ChannelRouteChangesStat

type ChannelRouteChangesStat struct {
	ImportUpdates   *ChannelRouteChangesStatEntry `json:"import_updates,omitempty"`
	ImportWithdraws *ChannelRouteChangesStatEntry `json:"import_withdraws,omitempty"`
	ExportUpdates   *ChannelRouteChangesStatEntry `json:"export_updates,omitempty"`
	ExportWithdraws *ChannelRouteChangesStatEntry `json:"export_withdraws,omitempty"`
}

+k8s:deepcopy-gen=true

func (*ChannelRouteChangesStat) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ChannelRouteChangesStat.

func (*ChannelRouteChangesStat) DeepCopyInto

func (in *ChannelRouteChangesStat) DeepCopyInto(out *ChannelRouteChangesStat)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ChannelRouteChangesStat) IsEqual

func (routeUpdatesState *ChannelRouteChangesStat) IsEqual(other *ChannelRouteChangesStat) bool

type ChannelRouteChangesStatEntry

type ChannelRouteChangesStatEntry struct {
	Received *int `json:"received,omitempty"`
	Rejected *int `json:"rejected,omitempty"`
	Filtered *int `json:"filtered,omitempty"`
	Ignored  *int `json:"ignored,omitempty"`
	Accepted *int `json:"accepted,omitempty"`
}

+k8s:deepcopy-gen=true

func (*ChannelRouteChangesStatEntry) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ChannelRouteChangesStatEntry.

func (*ChannelRouteChangesStatEntry) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ChannelRouteChangesStatEntry) IsEqual

func (routeChangesStatEntry *ChannelRouteChangesStatEntry) IsEqual(other *ChannelRouteChangesStatEntry) bool

type ChannelRoutesStat

type ChannelRoutesStat struct {
	Imported  int `json:"imported"`
	Filtered  int `json:"filtered"`
	Exported  int `json:"exported"`
	Preferred int `json:"preferred"`
}

+k8s:deepcopy-gen=true

func (*ChannelRoutesStat) DeepCopy

func (in *ChannelRoutesStat) DeepCopy() *ChannelRoutesStat

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ChannelRoutesStat.

func (*ChannelRoutesStat) DeepCopyInto

func (in *ChannelRoutesStat) DeepCopyInto(out *ChannelRoutesStat)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ChannelRoutesStat) IsEqual

func (routesStat *ChannelRoutesStat) IsEqual(other *ChannelRoutesStat) bool

type Line

type Line struct {
	LineIdx      int           `json:"line_idx"`
	LineGroupIdx int           `json:"line_group_idx"`
	Raw          string        `json:"raw"`
	Metadata     LineMetadata  `json:"metadata"`
	Meaning      *ReplyMeaning `json:"meaning"`
	Indent       int           `json:"indent"`
	Content      string        `json:"content"`
	TrimmedLine  string        `json:"trimmed_line"`
}

type LineMetadata

type LineMetadata struct {
	HasGroupSeperator bool   `json:"has_group_seperator"`
	Continuation      bool   `json:"continuation"`
	EndOfReply        bool   `json:"end_of_reply"`
	ContentOffset     int    `json:"content_offset"`
	Code              string `json:"code"`
}

type RawMessages

type RawMessages struct {
	Lines  []Line  `json:"lines"`
	Blocks []Block `json:"blocks"`
	// contains filtered or unexported fields
}

func (*RawMessages) Ingest

func (msgs *RawMessages) Ingest(line string) *Block

func (*RawMessages) Init

func (msgs *RawMessages) Init()

type ReplyMeaning

type ReplyMeaning string
const (
	ReplySuccess      ReplyMeaning = "success"
	ReplyTableHeader  ReplyMeaning = "table_header"
	ReplyTableEntries ReplyMeaning = "table_entry"
	ReplyRuntimeError ReplyMeaning = "runtime_error"
	ReplySyntaxError  ReplyMeaning = "syntax_error"
)

func ReplyMeaningFromCode

func ReplyMeaningFromCode(code string) (replyMeaning *ReplyMeaning)

func (*ReplyMeaning) String

func (r *ReplyMeaning) String() string

Jump to

Keyboard shortcuts

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