Documentation
¶
Overview ¶
Package gnmi implements a gRPC gNMI agent for testing against a collector implementation. Each agent will generate a set of Value protocol buffer messages that create a queue of updates to be streamed from a synthetic device.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct { gnmipb.UnimplementedGNMIServer // contains filtered or unexported fields }
Agent manages a single gNMI agent implementation. Each client that connects via Subscribe or Get will receive a stream of updates based on the requested path and the provided initial configuration.
func NewFromServer ¶
NewFromServer returns a new initialized fake agent from provided server.
func (*Agent) Requests ¶
func (a *Agent) Requests() []*gnmipb.SubscribeRequest
Requests returns the subscribe requests received by the most recently created client.
func (*Agent) Subscribe ¶
func (a *Agent) Subscribe(stream gnmipb.GNMI_SubscribeServer) error
Subscribe implements the gNMI Subscribe RPC.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client contains information about a client that has connected to the fake.
func (*Client) Close ¶
func (c *Client) Close()
Close will cancel the client context and will cause the send and recv goroutines to exit.
func (*Client) Run ¶
func (c *Client) Run(stream gpb.GNMI_SubscribeServer) (err error)
Run starts the client. The first message received must be a SubscriptionList. Once the client is started, it will run until the stream is closed or the schedule completes. For Poll queries the Run will block internally after sync until a Poll request is made to the server. This is important as the test may look like a deadlock since it can cause a timeout. Also if you Reset the client the change will not take effect until after the previous queue has been drained of notifications.
Directories
¶
Path | Synopsis |
---|---|
cmd
|
|
fake_server
The fake_server is a simple gRPC gnmi agent implementation which will take a configuration and start a listening service for the configured target.
|
The fake_server is a simple gRPC gnmi agent implementation which will take a configuration and start a listening service for the configured target. |
gen_fake_config
The gen_fake_config command converts a hardcoded fake.proto message into a textual protobuf.
|
The gen_fake_config command converts a hardcoded fake.proto message into a textual protobuf. |