server

package
v0.0.0-...-9c3e5b1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2016 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HOLDTIME_OPENSENT = 240
	HOLDTIME_IDLE     = 5
)
View Source
const (
	REQ_GLOBAL_CONFIG
	REQ_MOD_GLOBAL_CONFIG
	REQ_NEIGHBOR
	REQ_NEIGHBORS
	REQ_ADJ_RIB_IN
	REQ_ADJ_RIB_OUT
	REQ_LOCAL_RIB
	REQ_NEIGHBOR_SHUTDOWN
	REQ_NEIGHBOR_RESET
	REQ_NEIGHBOR_SOFT_RESET
	REQ_NEIGHBOR_SOFT_RESET_IN
	REQ_NEIGHBOR_SOFT_RESET_OUT
	REQ_NEIGHBOR_ENABLE
	REQ_NEIGHBOR_DISABLE
	REQ_MOD_NEIGHBOR
	REQ_ADD_NEIGHBOR
	REQ_DEL_NEIGHBOR
	REQ_GLOBAL_RIB
	REQ_MONITOR_GLOBAL_BEST_CHANGED
	REQ_MONITOR_INCOMING
	REQ_MONITOR_NEIGHBOR_PEER_STATE
	REQ_MONITOR_ROA_VALIDATION_RESULT
	REQ_MRT_GLOBAL_RIB
	REQ_MRT_LOCAL_RIB
	REQ_MOD_MRT
	REQ_MOD_BMP
	REQ_RPKI
	REQ_MOD_RPKI
	REQ_ROA
	REQ_VRF
	REQ_VRFS
	REQ_VRF_MOD
	REQ_MOD_PATH
	REQ_MOD_PATHS
	REQ_DEFINED_SET
	REQ_MOD_DEFINED_SET
	REQ_STATEMENT
	REQ_MOD_STATEMENT
	REQ_POLICY
	REQ_MOD_POLICY
	REQ_POLICY_ASSIGNMENT
	REQ_MOD_POLICY_ASSIGNMENT
	REQ_BMP_NEIGHBORS
	REQ_BMP_GLOBAL
	REQ_BMP_ADJ_IN
	REQ_DEFERRAL_TIMER_EXPIRED
)
View Source
const (
	FLOP_THRESHOLD    = time.Second * 30
	MIN_CONNECT_RETRY = 10
)
View Source
const (
	WATCHER_MRT watcherType // UPDATE MSG
	WATCHER_BMP
	WATCHER_ZEBRA
	WATCHER_GRPC_BESTPATH
	WATCHER_GRPC_INCOMING
)
View Source
const (
	WATCHER_EVENT_UPDATE_MSG watcherEventType
	WATCHER_EVENT_STATE_CHANGE
	WATCHER_EVENT_BESTPATH_CHANGE
	WATCHER_EVENT_POST_POLICY_UPDATE_MSG
)
View Source
const (
	TCP_MD5SIG = 14
)

Variables

This section is empty.

Functions

func DialTCPTimeoutWithMD5Sig

func DialTCPTimeoutWithMD5Sig(host string, port int, localAddr, key string, msec int) (*net.TCPConn, error)

func NewROAManager

func NewROAManager(as uint32) (*roaManager, error)

func NewRoaClient

func NewRoaClient(address, port string, ch chan *ROAEvent, lifetime int64) *roaClient

func NewZclient

func NewZclient(url string, redistRouteTypes []config.InstallProtocolType) (*zebra.Client, error)

func SetTcpMD5SigSockopts

func SetTcpMD5SigSockopts(l *net.TCPListener, address string, key string) error

func SetTcpTTLSockopts

func SetTcpTTLSockopts(conn *net.TCPConn, ttl int) error

Types

type AdminState

type AdminState int
const (
	ADMIN_STATE_UP AdminState = iota
	ADMIN_STATE_DOWN
	ADMIN_STATE_PFX_CT
)

func (AdminState) String

func (s AdminState) String() string

type BgpServer

type BgpServer struct {
	GrpcReqCh chan *GrpcRequest
	// contains filtered or unexported fields
}

func NewBgpServer

func NewBgpServer() *BgpServer

func (*BgpServer) Api2PathList

func (server *BgpServer) Api2PathList(resource api.Resource, name string, ApiPathList []*api.Path) ([]*table.Path, error)

func (*BgpServer) Listeners

func (server *BgpServer) Listeners(addr string) []*net.TCPListener

func (*BgpServer) PeerAdd

func (server *BgpServer) PeerAdd(peer config.Neighbor) error

func (*BgpServer) PeerDelete

func (server *BgpServer) PeerDelete(peer config.Neighbor) error

func (*BgpServer) PeerUpdate

func (server *BgpServer) PeerUpdate(peer config.Neighbor)

func (*BgpServer) RSimportPaths

func (server *BgpServer) RSimportPaths(peer *Peer, pathList []*table.Path) []*table.Path

func (*BgpServer) Serve

func (server *BgpServer) Serve()

func (*BgpServer) SetBmpConfig

func (server *BgpServer) SetBmpConfig(c []config.BmpServer) error

func (*BgpServer) SetGlobalType

func (server *BgpServer) SetGlobalType(g config.Global) error

func (*BgpServer) SetMrtConfig

func (server *BgpServer) SetMrtConfig(c []config.Mrt) error

func (*BgpServer) SetRoutingPolicy

func (server *BgpServer) SetRoutingPolicy(pl config.RoutingPolicy) error

func (*BgpServer) SetRpkiConfig

func (server *BgpServer) SetRpkiConfig(c []config.RpkiServer) error

func (*BgpServer) Shutdown

func (server *BgpServer) Shutdown()

func (*BgpServer) UpdatePolicy

func (server *BgpServer) UpdatePolicy(policy config.RoutingPolicy)

type FSM

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

func NewFSM

func NewFSM(gConf *config.Global, pConf *config.Neighbor, policy *table.RoutingPolicy) *FSM

func (*FSM) LocalHostPort

func (fsm *FSM) LocalHostPort() (string, uint16)

func (*FSM) RemoteHostPort

func (fsm *FSM) RemoteHostPort() (string, uint16)

func (*FSM) StateChange

func (fsm *FSM) StateChange(nextState bgp.FSMState)

type FSMHandler

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

func NewFSMHandler

func NewFSMHandler(fsm *FSM, incoming *channels.InfiniteChannel, stateCh chan *FsmMsg, outgoing chan *FsmOutgoingMsg) *FSMHandler

type FsmMsg

type FsmMsg struct {
	MsgType  FsmMsgType
	MsgSrc   string
	MsgData  interface{}
	PathList []*table.Path
	// contains filtered or unexported fields
}

type FsmMsgType

type FsmMsgType int
const (
	FSM_MSG_STATE_CHANGE FsmMsgType
	FSM_MSG_BGP_MESSAGE
	FSM_MSG_ROUTE_REFRESH
)

type FsmOutgoingMsg

type FsmOutgoingMsg struct {
	Paths        []*table.Path
	Notification *bgp.BGPMessage
	StayIdle     bool
}

type FsmStateReason

type FsmStateReason int
const (
	FSM_DYING FsmStateReason
	FSM_ADMIN_DOWN
	FSM_READ_FAILED
	FSM_WRITE_FAILED
	FSM_NOTIFICATION_SENT
	FSM_NOTIFICATION_RECV
	FSM_HOLD_TIMER_EXPIRED
	FSM_IDLE_HOLD_TIMER_EXPIRED
	FSM_RESTART_TIMER_EXPIRED
	FSM_GRACEFUL_RESTART
	FSM_INVALID_MSG
)

func (FsmStateReason) String

func (r FsmStateReason) String() string

type GrpcRequest

type GrpcRequest struct {
	RequestType int
	Name        string
	RouteFamily bgp.RouteFamily
	ResponseCh  chan *GrpcResponse
	EndCh       chan struct{}
	Err         error
	Data        interface{}
}

func NewGrpcRequest

func NewGrpcRequest(reqType int, name string, rf bgp.RouteFamily, d interface{}) *GrpcRequest

type GrpcResponse

type GrpcResponse struct {
	ResponseErr error
	Data        interface{}
}

func (*GrpcResponse) Err

func (r *GrpcResponse) Err() error

type Peer

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

func NewPeer

func NewPeer(g config.Global, conf config.Neighbor, loc *table.TableManager, policy *table.RoutingPolicy) *Peer

func (*Peer) DropAll

func (peer *Peer) DropAll(rfList []bgp.RouteFamily)

func (*Peer) ID

func (peer *Peer) ID() string

func (*Peer) MarshalJSON

func (peer *Peer) MarshalJSON() ([]byte, error)

func (*Peer) PassConn

func (peer *Peer) PassConn(conn *net.TCPConn)

func (*Peer) StaleAll

func (peer *Peer) StaleAll(rfList []bgp.RouteFamily)

func (*Peer) TableID

func (peer *Peer) TableID() string

func (*Peer) ToApiStruct

func (peer *Peer) ToApiStruct() *api.Peer

type ROA

type ROA struct {
	Family int
	Prefix *ipPrefix
	MaxLen uint8
	AS     uint32
	Src    string
}

func NewROA

func NewROA(family int, prefixByte []byte, prefixLen uint8, maxLen uint8, as uint32, src string) *ROA

func (*ROA) Equal

func (r *ROA) Equal(roa *ROA) bool

type ROAEvent

type ROAEvent struct {
	EventType ROAEventType
	Src       string
	Data      []byte
	// contains filtered or unexported fields
}

type ROAEventType

type ROAEventType uint8
const (
	CONNECTED ROAEventType = iota
	DISCONNECTED
	RTR
	LIFETIMEOUT
)

type SenderMsg

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

type Server

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

func NewGrpcServer

func NewGrpcServer(hosts string, bgpServerCh chan *GrpcRequest) *Server

func (*Server) Disable

func (s *Server) Disable(ctx context.Context, arg *api.Arguments) (*api.Error, error)

func (*Server) Enable

func (s *Server) Enable(ctx context.Context, arg *api.Arguments) (*api.Error, error)

func (*Server) GetDefinedSet

func (s *Server) GetDefinedSet(ctx context.Context, arg *api.DefinedSet) (*api.DefinedSet, error)

func (*Server) GetDefinedSets

func (s *Server) GetDefinedSets(arg *api.DefinedSet, stream api.GobgpApi_GetDefinedSetsServer) error

func (*Server) GetGlobalConfig

func (s *Server) GetGlobalConfig(ctx context.Context, arg *api.Arguments) (*api.Global, error)

func (*Server) GetMrt

func (s *Server) GetMrt(arg *api.MrtArguments, stream api.GobgpApi_GetMrtServer) error

func (*Server) GetNeighbor

func (s *Server) GetNeighbor(ctx context.Context, arg *api.Arguments) (*api.Peer, error)

func (*Server) GetNeighbors

func (s *Server) GetNeighbors(_ *api.Arguments, stream api.GobgpApi_GetNeighborsServer) error

func (*Server) GetPolicies

func (s *Server) GetPolicies(arg *api.Policy, stream api.GobgpApi_GetPoliciesServer) error

func (*Server) GetPolicy

func (s *Server) GetPolicy(ctx context.Context, arg *api.Policy) (*api.Policy, error)

func (*Server) GetPolicyAssignment

func (s *Server) GetPolicyAssignment(ctx context.Context, arg *api.PolicyAssignment) (*api.PolicyAssignment, error)

func (*Server) GetROA

func (s *Server) GetROA(arg *api.Arguments, stream api.GobgpApi_GetROAServer) error

func (*Server) GetRPKI

func (s *Server) GetRPKI(arg *api.Arguments, stream api.GobgpApi_GetRPKIServer) error

func (*Server) GetRib

func (s *Server) GetRib(ctx context.Context, arg *api.Table) (*api.Table, error)

func (*Server) GetStatement

func (s *Server) GetStatement(ctx context.Context, arg *api.Statement) (*api.Statement, error)

func (*Server) GetStatements

func (s *Server) GetStatements(arg *api.Statement, stream api.GobgpApi_GetStatementsServer) error

func (*Server) GetVrfs

func (s *Server) GetVrfs(arg *api.Arguments, stream api.GobgpApi_GetVrfsServer) error

func (*Server) ModBmp

func (s *Server) ModBmp(ctx context.Context, arg *api.ModBmpArguments) (*api.Error, error)

func (*Server) ModDefinedSet

func (s *Server) ModDefinedSet(ctx context.Context, arg *api.ModDefinedSetArguments) (*api.Error, error)

func (*Server) ModGlobalConfig

func (s *Server) ModGlobalConfig(ctx context.Context, arg *api.ModGlobalConfigArguments) (*api.Error, error)

func (*Server) ModMrt

func (s *Server) ModMrt(ctx context.Context, arg *api.ModMrtArguments) (*api.Error, error)

func (*Server) ModNeighbor

func (s *Server) ModNeighbor(ctx context.Context, arg *api.ModNeighborArguments) (*api.Error, error)

func (*Server) ModPath

func (s *Server) ModPath(ctx context.Context, arg *api.ModPathArguments) (*api.ModPathResponse, error)

func (*Server) ModPaths

func (s *Server) ModPaths(stream api.GobgpApi_ModPathsServer) error

func (*Server) ModPolicy

func (s *Server) ModPolicy(ctx context.Context, arg *api.ModPolicyArguments) (*api.Error, error)

func (*Server) ModPolicyAssignment

func (s *Server) ModPolicyAssignment(ctx context.Context, arg *api.ModPolicyAssignmentArguments) (*api.Error, error)

func (*Server) ModRPKI

func (s *Server) ModRPKI(ctx context.Context, arg *api.ModRpkiArguments) (*api.Error, error)

func (*Server) ModStatement

func (s *Server) ModStatement(ctx context.Context, arg *api.ModStatementArguments) (*api.Error, error)

func (*Server) ModVrf

func (s *Server) ModVrf(ctx context.Context, arg *api.ModVrfArguments) (*api.Error, error)

func (*Server) MonitorBestChanged

func (s *Server) MonitorBestChanged(arg *api.Arguments, stream api.GobgpApi_MonitorBestChangedServer) error

func (*Server) MonitorPeerState

func (s *Server) MonitorPeerState(arg *api.Arguments, stream api.GobgpApi_MonitorPeerStateServer) error

func (*Server) MonitorROAValidation

func (s *Server) MonitorROAValidation(arg *api.Arguments, stream api.GobgpApi_MonitorROAValidationServer) error

func (*Server) MonitorRib

func (s *Server) MonitorRib(arg *api.Table, stream api.GobgpApi_MonitorRibServer) error

func (*Server) Reset

func (s *Server) Reset(ctx context.Context, arg *api.Arguments) (*api.Error, error)

func (*Server) Serve

func (s *Server) Serve() error

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context, arg *api.Arguments) (*api.Error, error)

func (*Server) SoftReset

func (s *Server) SoftReset(ctx context.Context, arg *api.Arguments) (*api.Error, error)

func (*Server) SoftResetIn

func (s *Server) SoftResetIn(ctx context.Context, arg *api.Arguments) (*api.Error, error)

func (*Server) SoftResetOut

func (s *Server) SoftResetOut(ctx context.Context, arg *api.Arguments) (*api.Error, error)

type TCPListener

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

func NewTCPListener

func NewTCPListener(address string, port uint32, ch chan *net.TCPConn) (*TCPListener, error)

avoid mapped IPv6 address

func (*TCPListener) Close

func (l *TCPListener) Close() error

type Watchers

type Watchers map[watcherType]watcher

Jump to

Keyboard shortcuts

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