server

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 License: Apache-2.0 Imports: 14 Imported by: 4

Documentation

Overview

Package server defines the basic elements of a gRIBI server that uses an in-memory data store for the AFT contents.

Index

Constants

View Source
const (
	// DefaultNetworkInstanceName specifies the name of the default network instance on the system.
	DefaultNetworkInstanceName = "DEFAULT"
)

Variables

This section is empty.

Functions

func DisableRIBCheckFn

func DisableRIBCheckFn() *disableCheckFn

DisableRIBCheckFn specifies that the consistency checking functions should be disabled for the RIB. It is useful for a testing RIB that does not need to have working references.

func WithNoRIBForwardReferences

func WithNoRIBForwardReferences() *disableRIBForwardRefs

WithNoRIBForwardReferences specifies that the server should not accept forward references in the RIB. This means that next-hop-groups should not be able to reference next-hops that do not exist, and entries cannot reference missing next-hop-groups.

func WithPostChangeRIBHook

func WithPostChangeRIBHook(fn rib.RIBHookFn) *postChangeRibHook

WithPostChangeRIBHook specifies that the given function that is of type rib.RIBHook function should be executed after each change in the RIB.

func WithRIBResolvedEntryHook

func WithRIBResolvedEntryHook(fn rib.ResolvedEntryFn) *resolvedEntryHook

WithResolvedEntryHook is a Server option that allows a function to be run for each entry that can be fully resolved within the RIB (e.g., IPv4Entry).

func WithVRFs

func WithVRFs(names []string) *withVRFs

WithVRFs specifies that the server should be initialised with the L3VRF network instances specified in the names list. Each is created in the server's RIB such that it can be referenced.

Types

type FakeServer

type FakeServer struct {
	*Server
}

FakeServer is a wrapper around the server with functions to enable testing to be performed more easily, for example, injecting specific state.

func NewFake

func NewFake(opt ...ServerOpt) (*FakeServer, error)

NewFake returns a new version of the fake server. This implementation wraps the Server implementation with functions to insert specific state into the server without a need to use the public APIs.

func (*FakeServer) InjectElectionID

func (f *FakeServer) InjectElectionID(id *spb.Uint128)

InjectElectionID allows a client to set an initial election ID on the server as though it was received from the client.

func (*FakeServer) InjectRIB

func (f *FakeServer) InjectRIB(r *rib.RIB)

InjectRIB allows a client to inject a RIB into the server as though it was received from the master client.

type Server

type Server struct {
	*spb.UnimplementedGRIBIServer
	// contains filtered or unexported fields
}

Server implements the gRIBI service.

func New

func New(opt ...ServerOpt) (*Server, error)

New creates a new gRIBI server.

func (*Server) Flush

func (s *Server) Flush(ctx context.Context, req *spb.FlushRequest) (*spb.FlushResponse, error)

Flush implements the gRIBI Flush RPC - used for removing entries from the server.

func (*Server) Get

func (s *Server) Get(req *spb.GetRequest, stream spb.GRIBI_GetServer) error

Get implements the gRIBI Get RPC.

func (*Server) Modify

func (s *Server) Modify(ms spb.GRIBI_ModifyServer) error

Modify implements the gRIBI Modify RPC.

type ServerOpt

type ServerOpt interface {
	// contains filtered or unexported methods
}

ServerOpt is an interface that is implemented by any options to the gRIBI server.

Jump to

Keyboard shortcuts

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