server

package
v0.0.0-...-65c99c8 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2016 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MEATUREMENT_UPDATE = "update"
	MEATUREMENT_PEER   = "peer"
	MEATUREMENT_TABLE  = "table"
)
View Source
const (
	FSM_DYING                   = "dying"
	FSM_ADMIN_DOWN              = "admin-down"
	FSM_READ_FAILED             = "read-failed"
	FSM_WRITE_FAILED            = "write-failed"
	FSM_NOTIFICATION_SENT       = "notificatoin-sent"
	FSM_NOTIFICATION_RECV       = "notification-received"
	FSM_HOLD_TIMER_EXPIRED      = "hold-timer-expired"
	FSM_IDLE_HOLD_TIMER_EXPIRED = "idle-hold-timer-expired"
	FSM_RESTART_TIMER_EXPIRED   = "restart-timer-expired"
	FSM_GRACEFUL_RESTART        = "graceful-restart"
	FSM_INVALID_MSG             = "invalid-msg"
	FSM_NEW_CONNECTION          = "new-connection"
	FSM_OPEN_MSG_RECEIVED       = "open-msg-received"
	FSM_OPEN_MSG_NEGOTIATED     = "open-msg-negotiated"
)
View Source
const (
	HOLDTIME_OPENSENT = 240
	HOLDTIME_IDLE     = 5
)
View Source
const (
	REQ_GET_SERVER
	REQ_START_SERVER
	REQ_STOP_SERVER
	REQ_NEIGHBOR
	REQ_ADJ_RIB_IN
	REQ_ADJ_RIB_OUT
	REQ_LOCAL_RIB
	REQ_NEIGHBOR_RESET
	REQ_NEIGHBOR_SOFT_RESET
	REQ_NEIGHBOR_SOFT_RESET_IN
	REQ_NEIGHBOR_SOFT_RESET_OUT
	REQ_NEIGHBOR_SHUTDOWN
	REQ_NEIGHBOR_ENABLE
	REQ_NEIGHBOR_DISABLE
	REQ_ADD_NEIGHBOR
	REQ_DEL_NEIGHBOR
	// FIXME: we should merge
	REQ_GRPC_ADD_NEIGHBOR
	REQ_GRPC_DELETE_NEIGHBOR
	REQ_UPDATE_NEIGHBOR
	REQ_GLOBAL_RIB
	REQ_MONITOR_RIB
	REQ_MONITOR_NEIGHBOR_PEER_STATE
	REQ_ENABLE_MRT
	REQ_DISABLE_MRT
	REQ_INJECT_MRT
	REQ_ADD_BMP
	REQ_DELETE_BMP
	REQ_VALIDATE_RIB
	// TODO: delete
	REQ_INITIALIZE_RPKI
	REQ_GET_RPKI
	REQ_ADD_RPKI
	REQ_DELETE_RPKI
	REQ_ENABLE_RPKI
	REQ_DISABLE_RPKI
	REQ_RESET_RPKI
	REQ_SOFT_RESET_RPKI
	REQ_ROA
	REQ_ADD_VRF
	REQ_DELETE_VRF
	REQ_VRF
	REQ_GET_VRF
	REQ_ADD_PATH
	REQ_DELETE_PATH
	REQ_GET_DEFINED_SET
	REQ_ADD_DEFINED_SET
	REQ_DELETE_DEFINED_SET
	REQ_REPLACE_DEFINED_SET
	REQ_GET_STATEMENT
	REQ_ADD_STATEMENT
	REQ_DELETE_STATEMENT
	REQ_REPLACE_STATEMENT
	REQ_GET_POLICY
	REQ_ADD_POLICY
	REQ_DELETE_POLICY
	REQ_REPLACE_POLICY
	REQ_GET_POLICY_ASSIGNMENT
	REQ_ADD_POLICY_ASSIGNMENT
	REQ_DELETE_POLICY_ASSIGNMENT
	REQ_REPLACE_POLICY_ASSIGNMENT
	REQ_BMP_NEIGHBORS
	REQ_BMP_GLOBAL
	REQ_BMP_ADJ_IN
	REQ_DEFERRAL_TIMER_EXPIRED
	REQ_RELOAD_POLICY
	REQ_INITIALIZE_ZEBRA
	REQ_INITIALIZE_COLLECTOR
	REQ_WATCHER_ADJ_RIB_IN // FIXME
)
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_COLLECTOR
	WATCHER_GRPC_MONITOR
)
View Source
const (
	WATCHER_EVENT_UPDATE_MSG watcherEventType
	WATCHER_EVENT_STATE_CHANGE
	WATCHER_EVENT_BESTPATH_CHANGE
	WATCHER_EVENT_POST_POLICY_UPDATE_MSG
	WATCHER_EVENT_ADJ_IN
)
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 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) (bool, error)

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) SetCollector

func (server *BgpServer) SetCollector(c config.Collector) 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) SetZebraConfig

func (server *BgpServer) SetZebraConfig(z config.Zebra) error

func (*BgpServer) Shutdown

func (server *BgpServer) Shutdown()

func (*BgpServer) UpdatePolicy

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

type Collector

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

func NewCollector

func NewCollector(grpcCh chan *GrpcRequest, url, dbName string, interval uint64) (*Collector, error)

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

	Version uint
	// 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 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) AddBmp

func (s *Server) AddBmp(ctx context.Context, arg *api.AddBmpRequest) (*api.AddBmpResponse, error)

func (*Server) AddDefinedSet

func (s *Server) AddDefinedSet(ctx context.Context, arg *api.AddDefinedSetRequest) (*api.AddDefinedSetResponse, error)

func (*Server) AddNeighbor

func (s *Server) AddNeighbor(ctx context.Context, arg *api.AddNeighborRequest) (*api.AddNeighborResponse, error)

func (*Server) AddPath

func (s *Server) AddPath(ctx context.Context, arg *api.AddPathRequest) (*api.AddPathResponse, error)

func (*Server) AddPolicy

func (s *Server) AddPolicy(ctx context.Context, arg *api.AddPolicyRequest) (*api.AddPolicyResponse, error)

func (*Server) AddPolicyAssignment

func (*Server) AddRpki

func (s *Server) AddRpki(ctx context.Context, arg *api.AddRpkiRequest) (*api.AddRpkiResponse, error)

func (*Server) AddStatement

func (s *Server) AddStatement(ctx context.Context, arg *api.AddStatementRequest) (*api.AddStatementResponse, error)

func (*Server) AddVrf

func (s *Server) AddVrf(ctx context.Context, arg *api.AddVrfRequest) (*api.AddVrfResponse, error)

func (*Server) DeleteBmp

func (s *Server) DeleteBmp(ctx context.Context, arg *api.DeleteBmpRequest) (*api.DeleteBmpResponse, error)

func (*Server) DeleteDefinedSet

func (*Server) DeleteNeighbor

func (*Server) DeletePath

func (s *Server) DeletePath(ctx context.Context, arg *api.DeletePathRequest) (*api.DeletePathResponse, error)

func (*Server) DeletePolicy

func (s *Server) DeletePolicy(ctx context.Context, arg *api.DeletePolicyRequest) (*api.DeletePolicyResponse, error)

func (*Server) DeleteRpki

func (s *Server) DeleteRpki(ctx context.Context, arg *api.DeleteRpkiRequest) (*api.DeleteRpkiResponse, error)

func (*Server) DeleteStatement

func (*Server) DeleteVrf

func (s *Server) DeleteVrf(ctx context.Context, arg *api.DeleteVrfRequest) (*api.DeleteVrfResponse, error)

func (*Server) DisableMrt

func (s *Server) DisableMrt(ctx context.Context, arg *api.DisableMrtRequest) (*api.DisableMrtResponse, error)

func (*Server) DisableNeighbor

func (*Server) DisableRpki

func (s *Server) DisableRpki(ctx context.Context, arg *api.DisableRpkiRequest) (*api.DisableRpkiResponse, error)

func (*Server) EnableMrt

func (s *Server) EnableMrt(ctx context.Context, arg *api.EnableMrtRequest) (*api.EnableMrtResponse, error)

func (*Server) EnableNeighbor

func (*Server) EnableRpki

func (s *Server) EnableRpki(ctx context.Context, arg *api.EnableRpkiRequest) (*api.EnableRpkiResponse, error)

func (*Server) GetDefinedSet

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

func (*Server) GetNeighbor

func (s *Server) GetNeighbor(ctx context.Context, arg *api.GetNeighborRequest) (*api.GetNeighborResponse, error)

func (*Server) GetPolicy

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

func (*Server) GetPolicyAssignment

func (*Server) GetRib

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

func (*Server) GetRoa

func (s *Server) GetRoa(ctx context.Context, arg *api.GetRoaRequest) (*api.GetRoaResponse, error)

func (*Server) GetRpki

func (s *Server) GetRpki(ctx context.Context, arg *api.GetRpkiRequest) (*api.GetRpkiResponse, error)

func (*Server) GetServer

func (s *Server) GetServer(ctx context.Context, arg *api.GetServerRequest) (*api.GetServerResponse, error)

func (*Server) GetStatement

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

func (*Server) GetVrf

func (s *Server) GetVrf(ctx context.Context, arg *api.GetVrfRequest) (*api.GetVrfResponse, error)

func (*Server) InjectMrt

func (s *Server) InjectMrt(stream api.GobgpApi_InjectMrtServer) error

func (*Server) MonitorPeerState

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

func (*Server) MonitorRib

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

func (*Server) ReplaceDefinedSet

func (*Server) ReplacePolicy

func (s *Server) ReplacePolicy(ctx context.Context, arg *api.ReplacePolicyRequest) (*api.ReplacePolicyResponse, error)

func (*Server) ReplaceStatement

func (*Server) ResetNeighbor

func (s *Server) ResetNeighbor(ctx context.Context, arg *api.ResetNeighborRequest) (*api.ResetNeighborResponse, error)

func (*Server) ResetRpki

func (s *Server) ResetRpki(ctx context.Context, arg *api.ResetRpkiRequest) (*api.ResetRpkiResponse, error)

func (*Server) Serve

func (s *Server) Serve() error

func (*Server) ShutdownNeighbor

func (*Server) SoftResetNeighbor

func (*Server) SoftResetRpki

func (s *Server) SoftResetRpki(ctx context.Context, arg *api.SoftResetRpkiRequest) (*api.SoftResetRpkiResponse, error)

func (*Server) StartServer

func (s *Server) StartServer(ctx context.Context, arg *api.StartServerRequest) (*api.StartServerResponse, error)

func (*Server) StopServer

func (s *Server) StopServer(ctx context.Context, arg *api.StopServerRequest) (*api.StopServerResponse, error)

func (*Server) ValidateRib

func (s *Server) ValidateRib(ctx context.Context, arg *api.ValidateRibRequest) (*api.ValidateRibResponse, 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

Jump to

Keyboard shortcuts

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