Documentation
¶
Index ¶
- type Server
- func (s *Server) Capabilities(_ context.Context, _ *gpb.CapabilityRequest) (*gpb.CapabilityResponse, error)
- func (s *Server) Close()
- func (s *Server) GRPCAddr() string
- func (s *Server) Get(_ context.Context, req *gpb.GetRequest) (*gpb.GetResponse, error)
- func (s *Server) Set(_ context.Context, req *gpb.SetRequest) (*gpb.SetResponse, error)
- func (s *Server) State() *State
- func (s *Server) Subscribe(stream grpc.BidiStreamingServer[gpb.SubscribeRequest, gpb.SubscribeResponse]) error
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
gpb.UnimplementedGNMIServer
// contains filtered or unexported fields
}
Server implements the GNMI gRPC server for testing purposes. It maintains an internal state that can be manipulated via gNMI requests or by modifying the internal state directly.
func NewTestServer ¶
NewTestServer starts an in-process gNMI server on a random available port.
func (*Server) Capabilities ¶
func (s *Server) Capabilities(_ context.Context, _ *gpb.CapabilityRequest) (*gpb.CapabilityResponse, error)
Capabilities returns the capabilities of the gNMI server
func (*Server) Get ¶
func (s *Server) Get(_ context.Context, req *gpb.GetRequest) (*gpb.GetResponse, error)
Get returns the current state of the server for the requested path
func (*Server) Set ¶
func (s *Server) Set(_ context.Context, req *gpb.SetRequest) (*gpb.SetResponse, error)
Set updates the state of the server for the requested path
func (*Server) State ¶
State returns the internal state of the server Callers must use State's methods (Get, Set, Del) which handle locking.
func (*Server) Subscribe ¶
func (s *Server) Subscribe(stream grpc.BidiStreamingServer[gpb.SubscribeRequest, gpb.SubscribeResponse]) error
Subscribe handles gNMI subscription requests.
type State ¶
State represents a JSON body that can be manipulated using sjson syntax.