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 ¶
- type Agent
- func (a *Agent) Address() string
- func (a *Agent) Capabilities(context.Context, *gnmipb.CapabilityRequest) (*gnmipb.CapabilityResponse, error)
- func (a *Agent) Clear()
- func (a *Agent) Close()
- func (a *Agent) Get(context.Context, *gnmipb.GetRequest) (*gnmipb.GetResponse, error)
- func (a *Agent) Port() int64
- func (a *Agent) Serve() error
- func (a *Agent) Set(context.Context, *gnmipb.SetRequest) (*gnmipb.SetResponse, error)
- func (a *Agent) State() fpb.State
- func (a *Agent) Subscribe(stream gnmipb.GNMI_SubscribeServer) error
- func (a *Agent) Target() string
- func (a *Agent) Type() string
- type Client
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
// 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) Capabilities ¶
func (a *Agent) Capabilities(context.Context, *gnmipb.CapabilityRequest) (*gnmipb.CapabilityResponse, error)
Capabilities implements the gNMI Capabilities RPC.
func (*Agent) Clear ¶
func (a *Agent) Clear()
Clear closes all currently connected clients of the agent.
func (*Agent) Close ¶
func (a *Agent) Close()
Close shuts down the agent and closes all clients currently connected to the agent.
func (*Agent) Get ¶
func (a *Agent) Get(context.Context, *gnmipb.GetRequest) (*gnmipb.GetResponse, error)
Get implements the gNMI Get RPC.
func (*Agent) Set ¶
func (a *Agent) Set(context.Context, *gnmipb.SetRequest) (*gnmipb.SetResponse, error)
Set implements the gNMI Set RPC.
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. |