Documentation ¶
Overview ¶
Package birdwatcher implements the birdwatcher source for the Alice Looking Glass.
It deals with bird being able to run in single or multi table mode.
Index ¶
- type Birdwatcher
- type Client
- type ClientResponse
- type Config
- type GenericBirdwatcher
- type LockMap
- type MultiTableBirdwatcher
- func (src *MultiTableBirdwatcher) AllRoutes(ctx context.Context) (*api.RoutesResponse, error)
- func (src *MultiTableBirdwatcher) Neighbors(ctx context.Context) (*api.NeighborsResponse, error)
- func (src *MultiTableBirdwatcher) NeighborsSummary(ctx context.Context) (*api.NeighborsResponse, error)
- func (src *MultiTableBirdwatcher) Routes(ctx context.Context, neighborID string) (*api.RoutesResponse, error)
- func (src *MultiTableBirdwatcher) RoutesFiltered(ctx context.Context, neighborID string) (*api.RoutesResponse, error)
- func (src *MultiTableBirdwatcher) RoutesNotExported(ctx context.Context, neighborID string) (*api.RoutesResponse, error)
- func (src *MultiTableBirdwatcher) RoutesReceived(ctx context.Context, neighborID string) (*api.RoutesResponse, error)
- type SingleTableBirdwatcher
- func (src *SingleTableBirdwatcher) AllRoutes(ctx context.Context) (*api.RoutesResponse, error)
- func (src *SingleTableBirdwatcher) Neighbors(ctx context.Context) (*api.NeighborsResponse, error)
- func (src *SingleTableBirdwatcher) NeighborsSummary(ctx context.Context) (*api.NeighborsResponse, error)
- func (src *SingleTableBirdwatcher) Routes(ctx context.Context, neighborID string) (*api.RoutesResponse, error)
- func (src *SingleTableBirdwatcher) RoutesFiltered(ctx context.Context, neighborID string) (*api.RoutesResponse, error)
- func (src *SingleTableBirdwatcher) RoutesNotExported(ctx context.Context, neighborID string) (*api.RoutesResponse, error)
- func (src *SingleTableBirdwatcher) RoutesReceived(ctx context.Context, neighborID string) (*api.RoutesResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Birdwatcher ¶
A Birdwatcher source is a variant of an alice source and implements different strategies for fetching route information from bird.
func NewBirdwatcher ¶
func NewBirdwatcher(config Config) Birdwatcher
NewBirdwatcher creates a new Birdwatcher instance. This might be either a GenericBirdWatcher or a MultiTableBirdwatcher.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
A Client uses the http client to talk to the birdwatcher API.
func (*Client) GetEndpoint ¶
GetEndpoint makes an API request and returns the response. The response body will be parsed further downstream.
type ClientResponse ¶
type ClientResponse map[string]interface{}
ClientResponse is a json key value mapping
type Config ¶
type Config struct { ID string Name string API string `ini:"api"` Timezone string `ini:"timezone"` ServerTime string `ini:"servertime"` ServerTimeShort string `ini:"servertime_short"` ServerTimeExt string `ini:"servertime_ext"` ShowLastReboot bool `ini:"show_last_reboot"` Type string `ini:"type"` MainTable string `ini:"main_table"` PeerTablePrefix string `ini:"peer_table_prefix"` PipeProtocolPrefix string `ini:"pipe_protocol_prefix"` AltPipeProtocolPrefix string `ini:"alt_pipe_protocol_prefix"` AltPipeProtocolSuffix string `ini:"alt_pipe_protocol_suffix"` NeighborsRefreshTimeout int `ini:"neighbors_refresh_timeout"` StreamParserThrottle int }
Config contains all configuration attributes for a birdwatcher based source.
type GenericBirdwatcher ¶
type GenericBirdwatcher struct {
// contains filtered or unexported fields
}
GenericBirdwatcher is an Alice data source.
func (*GenericBirdwatcher) ExpireCaches ¶
func (b *GenericBirdwatcher) ExpireCaches() int
ExpireCaches clears all local caches
func (*GenericBirdwatcher) NeighborsStatus ¶
func (b *GenericBirdwatcher) NeighborsStatus(ctx context.Context) ( *api.NeighborsStatusResponse, error, )
NeighborsStatus retrieves neighbor status infos
func (*GenericBirdwatcher) Status ¶
func (b *GenericBirdwatcher) Status(ctx context.Context) (*api.StatusResponse, error)
Status retrievs the current backend status
type LockMap ¶
type LockMap struct {
// contains filtered or unexported fields
}
LockMap uses the sync.Map to manage locks, accessed by a key. TODO: Maybe this would be a nice generic helper
type MultiTableBirdwatcher ¶
type MultiTableBirdwatcher struct {
GenericBirdwatcher
}
MultiTableBirdwatcher implements a birdwatcher with a multitable bird as a datasource.
func (*MultiTableBirdwatcher) AllRoutes ¶
func (src *MultiTableBirdwatcher) AllRoutes( ctx context.Context, ) (*api.RoutesResponse, error)
AllRoutes retrieves a routes dump from the server
func (*MultiTableBirdwatcher) Neighbors ¶
func (src *MultiTableBirdwatcher) Neighbors( ctx context.Context, ) (*api.NeighborsResponse, error)
Neighbors get neighbors from protocols. TODO: this. needs. refactoring.
func (*MultiTableBirdwatcher) NeighborsSummary ¶
func (src *MultiTableBirdwatcher) NeighborsSummary( ctx context.Context, ) (*api.NeighborsResponse, error)
NeighborsSummary is for now using Neighbors
func (*MultiTableBirdwatcher) Routes ¶
func (src *MultiTableBirdwatcher) Routes( ctx context.Context, neighborID string, ) (*api.RoutesResponse, error)
Routes gets filtered and exported route from the birdwatcher backend.
func (*MultiTableBirdwatcher) RoutesFiltered ¶
func (src *MultiTableBirdwatcher) RoutesFiltered( ctx context.Context, neighborID string, ) (*api.RoutesResponse, error)
RoutesFiltered gets all filtered routes from the backend
func (*MultiTableBirdwatcher) RoutesNotExported ¶
func (src *MultiTableBirdwatcher) RoutesNotExported( ctx context.Context, neighborID string, ) (*api.RoutesResponse, error)
RoutesNotExported gets all not exported routes
func (*MultiTableBirdwatcher) RoutesReceived ¶
func (src *MultiTableBirdwatcher) RoutesReceived( ctx context.Context, neighborID string, ) (*api.RoutesResponse, error)
RoutesReceived returns all received routes
type SingleTableBirdwatcher ¶
type SingleTableBirdwatcher struct {
GenericBirdwatcher
}
SingleTableBirdwatcher is an Alice Source
func (*SingleTableBirdwatcher) AllRoutes ¶
func (src *SingleTableBirdwatcher) AllRoutes( ctx context.Context, ) (*api.RoutesResponse, error)
AllRoutes retrieves a route dump
func (*SingleTableBirdwatcher) Neighbors ¶
func (src *SingleTableBirdwatcher) Neighbors( ctx context.Context, ) (*api.NeighborsResponse, error)
Neighbors get neighbors from protocols
func (*SingleTableBirdwatcher) NeighborsSummary ¶
func (src *SingleTableBirdwatcher) NeighborsSummary( ctx context.Context, ) (*api.NeighborsResponse, error)
NeighborsSummary is for now an alias of Neighbors
func (*SingleTableBirdwatcher) Routes ¶
func (src *SingleTableBirdwatcher) Routes( ctx context.Context, neighborID string, ) (*api.RoutesResponse, error)
Routes gets filtered and exported routes
func (*SingleTableBirdwatcher) RoutesFiltered ¶
func (src *SingleTableBirdwatcher) RoutesFiltered( ctx context.Context, neighborID string, ) (*api.RoutesResponse, error)
RoutesFiltered gets all filtered routes
func (*SingleTableBirdwatcher) RoutesNotExported ¶
func (src *SingleTableBirdwatcher) RoutesNotExported( ctx context.Context, neighborID string, ) (*api.RoutesResponse, error)
RoutesNotExported get all not exported routes
func (*SingleTableBirdwatcher) RoutesReceived ¶
func (src *SingleTableBirdwatcher) RoutesReceived( ctx context.Context, neighborID string, ) (*api.RoutesResponse, error)
RoutesReceived gets all received routes