Documentation ¶
Overview ¶
Package southbound implements configuration of network devices via gNMI clients.
Index ¶
- Variables
- func NewSubscribeRequest(subscribeOptions *SubscribeOptions) (*gpb.SubscribeRequest, error)
- func NewTargetItem(deviceID devicetype.VersionedID, target TargetIf)
- type BaseClientInterface
- type GnmiClient
- type SubscribeOptions
- type Target
- func (target *Target) Capabilities(ctx context.Context, request *gpb.CapabilityRequest) (*gpb.CapabilityResponse, error)
- func (target *Target) CapabilitiesWithString(ctx context.Context, request string) (*gpb.CapabilityResponse, error)
- func (target *Target) Client() GnmiClient
- func (target *Target) Close() error
- func (target *Target) ConnectTarget(ctx context.Context, device topodevice.Device) (devicetype.VersionedID, error)
- func (target *Target) Context() *context.Context
- func (target *Target) Destination() *client.Destination
- func (target *Target) Get(ctx context.Context, request *gpb.GetRequest) (*gpb.GetResponse, error)
- func (target *Target) GetWithString(ctx context.Context, request string) (*gpb.GetResponse, error)
- func (target *Target) Set(ctx context.Context, request *gpb.SetRequest) (*gpb.SetResponse, error)
- func (target *Target) SetWithString(ctx context.Context, request string) (*gpb.SetResponse, error)
- func (target *Target) Subscribe(ctx context.Context, request *gpb.SubscribeRequest, ...) error
- type TargetIf
Constants ¶
This section is empty.
Variables ¶
var GnmiBaseClientFactory = func() BaseClientInterface { return gnmiBaseClientImpl{ &client.BaseClient{}, } }
GnmiBaseClientFactory : Default BaseClient creation.
var GnmiClientFactory = func(ctx context.Context, d client.Destination) (GnmiClient, error) { openconfigClient, err := gclient.New(ctx, d) if err != nil { return nil, err } c := openconfigClient.(*gclient.Client) return gnmiClientImpl{ c: c, }, err }
GnmiClientFactory : Default GnmiClient creation.
var TargetGenerator = NewTarget
TargetGenerator is a function for generating gnmi southbound Targets Default target generator is the NewTarget func below - can be overridden for tests
Functions ¶
func NewSubscribeRequest ¶
func NewSubscribeRequest(subscribeOptions *SubscribeOptions) (*gpb.SubscribeRequest, error)
NewSubscribeRequest returns a SubscribeRequest for the given paths
func NewTargetItem ¶ added in v0.7.27
func NewTargetItem(deviceID devicetype.VersionedID, target TargetIf)
NewTargetItem - add to the target map
Types ¶
type BaseClientInterface ¶
BaseClientInterface : interface to hide struct dependency on client.BaseClient. Can be overridden by tests.
type GnmiClient ¶
type GnmiClient interface { Capabilities(ctx context.Context, r *gpb.CapabilityRequest) (*gpb.CapabilityResponse, error) Get(ctx context.Context, r *gpb.GetRequest) (*gpb.GetResponse, error) Set(ctx context.Context, r *gpb.SetRequest) (*gpb.SetResponse, error) Subscribe(ctx context.Context, q client.Query) error Close() error }
GnmiClient : interface to hide struct dependency on gnmi.client. Can be overridden by tests.
type SubscribeOptions ¶
type SubscribeOptions struct { UpdatesOnly bool Prefix string Mode string StreamMode string SampleInterval uint64 HeartbeatInterval uint64 Paths [][]string Origin string }
SubscribeOptions is the gNMI subscription request options
type Target ¶
type Target struct {
// contains filtered or unexported fields
}
Target struct for connecting to gNMI
func (*Target) Capabilities ¶
func (target *Target) Capabilities(ctx context.Context, request *gpb.CapabilityRequest) (*gpb.CapabilityResponse, error)
Capabilities get capabilities according to a formatted request
func (*Target) CapabilitiesWithString ¶
func (target *Target) CapabilitiesWithString(ctx context.Context, request string) (*gpb.CapabilityResponse, error)
CapabilitiesWithString allows a request for the capabilities by a string - can be empty
func (*Target) Client ¶
func (target *Target) Client() GnmiClient
Client allows retrieval of the context for the target
func (*Target) ConnectTarget ¶
func (target *Target) ConnectTarget(ctx context.Context, device topodevice.Device) (devicetype.VersionedID, error)
ConnectTarget connects to a given Device according to the passed information establishing a channel to it. TODO make asyc TODO lock channel to allow one request to device at each time
func (*Target) Destination ¶
func (target *Target) Destination() *client.Destination
Destination allows retrieval of the context for the target
func (*Target) Get ¶
func (target *Target) Get(ctx context.Context, request *gpb.GetRequest) (*gpb.GetResponse, error)
Get can make a get request according to a formatted request
func (*Target) GetWithString ¶
GetWithString can make a get request according by a string - can be empty
func (*Target) Set ¶
func (target *Target) Set(ctx context.Context, request *gpb.SetRequest) (*gpb.SetResponse, error)
Set can make a set request according to a formatted request
func (*Target) SetWithString ¶
SetWithString can make a set request according by a string
func (*Target) Subscribe ¶
func (target *Target) Subscribe(ctx context.Context, request *gpb.SubscribeRequest, handler client.ProtoHandler) error
Subscribe initiates a subscription to a target and set of paths by establishing a new channel
type TargetIf ¶
type TargetIf interface { ConnectTarget(ctx context.Context, device topodevice.Device) (devicetype.VersionedID, error) //Capabilities(ctx context.Context, request *gpb.CapabilityRequest) (*gpb.CapabilityResponse, error) CapabilitiesWithString(ctx context.Context, request string) (*gpb.CapabilityResponse, error) Get(ctx context.Context, request *gpb.GetRequest) (*gpb.GetResponse, error) GetWithString(ctx context.Context, request string) (*gpb.GetResponse, error) Set(ctx context.Context, request *gpb.SetRequest) (*gpb.SetResponse, error) SetWithString(ctx context.Context, request string) (*gpb.SetResponse, error) Subscribe(ctx context.Context, request *gpb.SubscribeRequest, handler client.ProtoHandler) error Context() *context.Context Destination() *client.Destination Client() GnmiClient Close() error }
TargetIf defines the API for Target
func GetTarget ¶
func GetTarget(key devicetype.VersionedID) (TargetIf, error)
GetTarget attempts to get a specific target from the targets cache
Directories ¶
Path | Synopsis |
---|---|
Package synchronizer synchronizes configurations down to devices
|
Package synchronizer synchronizes configurations down to devices |