Documentation ¶
Overview ¶
Package gnmi implements a gnmi server to mock a device with YANG models.
Package gnmi implements a gnmi server to mock a device with YANG models.
Package gnmi implements a gnmi server to mock a device with YANG models.
Package gnmi implements a gnmi server to mock a device with YANG models.
Package gnmi implements a gnmi server to mock a device with YANG models.
Package gnmi implements a gnmi server to mock a device with YANG models.
Package gnmi implements a gnmi server to mock a device with YANG models.
Package gnmi implements a gnmi server to mock a device with YANG models.
Index ¶
- func Contains(a []string, x string) bool
- type Config
- type ConfigCallback
- type GnmiService
- type GoStructEnumData
- type JSONUnmarshaler
- type Model
- type ModelInfo
- type ModelType
- type Server
- func (s *Server) Capabilities(ctx context.Context, req *pb.CapabilityRequest) (*pb.CapabilityResponse, error)
- func (s *Server) Get(ctx context.Context, req *pb.GetRequest) (*pb.GetResponse, error)
- func (s *Server) GetConfig() (ygot.ValidatedGoStruct, error)
- func (s *Server) InternalUpdate(fp func(config ygot.ValidatedGoStruct) error) error
- func (s *Server) Set(ctx context.Context, req *pb.SetRequest) (*pb.SetResponse, error)
- func (s *Server) Subscribe(stream pb.GNMI_SubscribeServer) error
- func (s *Server) WatchConfigUpdates(ch chan *pb.Update)
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConfigCallback ¶
type ConfigCallback func(ygot.ValidatedGoStruct) error
ConfigCallback is the signature of the function to apply a validated config to the physical device.
type GnmiService ¶
type GnmiService interface { northbound.Service GetServer() *Server }
type GoStructEnumData ¶
type GoStructEnumData map[string]map[int64]ygot.EnumDefinition
GoStructEnumData is the data type to maintain GoStruct enum type.
type JSONUnmarshaler ¶
JSONUnmarshaler is the signature of the Unmarshal() function in the GoStruct code generated by openconfig ygot library.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model contains the model data and GoStruct information for the device to config.
func NewModel ¶
func NewModel(m []*pb.ModelData, t reflect.Type, r *yang.Entry, f JSONUnmarshaler, e GoStructEnumData) *Model
NewModel returns an instance of Model struct.
func (*Model) NewConfigStruct ¶
func (m *Model) NewConfigStruct(jsonConfig []byte) (ygot.ValidatedGoStruct, error)
NewConfigStruct creates a ValidatedGoStruct of this model from jsonConfig. If jsonConfig is nil, creates an empty GoStruct.
func (*Model) SupportedModels ¶
SupportedModels returns a list of supported models.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server struct maintains the data structure for device config and implements the interface of gnmi server. It supports Capabilities, Get, and Set APIs.
func (*Server) Capabilities ¶
func (s *Server) Capabilities(ctx context.Context, req *pb.CapabilityRequest) (*pb.CapabilityResponse, error)
Capabilities returns supported encodings and supported models.
func (*Server) Get ¶
func (s *Server) Get(ctx context.Context, req *pb.GetRequest) (*pb.GetResponse, error)
Get implements the Get RPC in gNMI spec.
func (*Server) GetConfig ¶
func (s *Server) GetConfig() (ygot.ValidatedGoStruct, error)
GetConfig returns the config store
func (*Server) InternalUpdate ¶
func (s *Server) InternalUpdate(fp func(config ygot.ValidatedGoStruct) error) error
InternalUpdate is an experimental feature to let the server update its internal states. Use it with your own risk.
func (*Server) Set ¶
func (s *Server) Set(ctx context.Context, req *pb.SetRequest) (*pb.SetResponse, error)
Set implements the Set RPC in gNMI spec.
func (*Server) Subscribe ¶
func (s *Server) Subscribe(stream pb.GNMI_SubscribeServer) error
Subscribe handle subscribe requests including POLL, STREAM, ONCE subscribe requests