gnmi

package
v0.10.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2022 License: Apache-2.0 Imports: 31 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// SimulatorTargetVersion default version for simulated target
	SimulatorTargetVersion = "1.0.0"
	// SimulatorTargetType type for simulated target
	SimulatorTargetType = "devicesim-1.0.x"
)

Variables

View Source
var NoExtensions = make([]*gnmi_ext.Extension, 0)

NoExtensions can be used on a request that does not need extension values

View Source
var NoPaths = make([]protoutils.TargetPath, 0)

NoPaths can be used on a request that does not need path values

Functions

func AddTargetToTopo added in v0.10.13

func AddTargetToTopo(targetEntity *topo.Object) error

AddTargetToTopo adds a new target to topo

func CheckGNMIValue

func CheckGNMIValue(t *testing.T, gnmiClient gnmiclient.Impl, paths []protoutils.TargetPath, expectedValue string, expectedExtensions int, failMessage string)

CheckGNMIValue makes sure a value has been assigned properly by querying the onos-config northbound API

func CheckGNMIValueWithContext added in v0.10.10

func CheckGNMIValueWithContext(ctx context.Context, t *testing.T, gnmiClient gnmiclient.Impl, paths []protoutils.TargetPath, expectedValue string, expectedExtensions int, failMessage string)

CheckGNMIValueWithContext makes sure a value has been assigned properly by querying the onos-config northbound API

func CheckGNMIValues

func CheckGNMIValues(t *testing.T, gnmiClient gnmiclient.Impl, paths []protoutils.TargetPath, expectedValues []string, expectedExtensions int, failMessage string)

CheckGNMIValues makes sure a list of values has been assigned properly by querying the onos-config northbound API

func CheckTargetValue added in v0.10.13

func CheckTargetValue(t *testing.T, targetGnmiClient gnmiclient.Impl, targetPaths []protoutils.TargetPath, expectedValue string)

CheckTargetValue makes sure a value has been assigned properly to a target path by querying GNMI

func CreateSimulator added in v0.6.0

func CreateSimulator(t *testing.T) *helm.HelmRelease

CreateSimulator creates a device simulator

func CreateSimulatorWithName added in v0.6.0

func CreateSimulatorWithName(t *testing.T, name string) *helm.HelmRelease

CreateSimulatorWithName creates a device simulator

func DeleteSimulator added in v0.6.0

func DeleteSimulator(t *testing.T, simulator *helm.HelmRelease)

DeleteSimulator shuts down the simulator pod and removes the target from topology

func GetGNMIClientOrFail

func GetGNMIClientOrFail(t *testing.T) gnmiclient.Impl

GetGNMIClientOrFail makes a GNMI client to use for requests. If creating the client fails, the test is failed.

func GetGNMIClientWithContextOrFail added in v0.10.10

func GetGNMIClientWithContextOrFail(ctx context.Context, t *testing.T) gnmiclient.Impl

GetGNMIClientWithContextOrFail makes a GNMI client to use for requests. If creating the client fails, the test is failed.

func GetGNMIValue

func GetGNMIValue(ctx context.Context, c gnmiclient.Impl, paths []protoutils.TargetPath, encoding gpb.Encoding) ([]protoutils.TargetPath, []*gnmi_ext.Extension, error)

GetGNMIValue generates a GET request on the given client for a Path on a target

func GetOnosConfigDestination added in v0.10.13

func GetOnosConfigDestination() (gnmiclient.Destination, error)

GetOnosConfigDestination :

func GetSimulatorExtensions

func GetSimulatorExtensions() []*gnmi_ext.Extension

GetSimulatorExtensions creates the default set of extensions for a simulated target

func GetSimulatorTarget added in v0.10.13

func GetSimulatorTarget(simulator *helm.HelmRelease) (*topo.Object, error)

GetSimulatorTarget queries topo to find the topo object for a simulator target

func GetTargetGNMIClientOrFail added in v0.10.13

func GetTargetGNMIClientOrFail(t *testing.T, simulator *helm.HelmRelease) gnmiclient.Impl

GetTargetGNMIClientOrFail creates a GNMI client to a target. If there is an error, the test is failed

func GetTargetPath added in v0.10.13

func GetTargetPath(target string, path string) []protoutils.TargetPath

GetTargetPath creates a target path

func GetTargetPathWithValue added in v0.10.13

func GetTargetPathWithValue(target string, path string, value string, valueType string) []protoutils.TargetPath

GetTargetPathWithValue creates a target path with a value to set

func GetTargetPaths added in v0.10.13

func GetTargetPaths(targets []string, paths []string) []protoutils.TargetPath

GetTargetPaths creates multiple target paths

func GetTargetPathsWithValues added in v0.10.13

func GetTargetPathsWithValues(targets []string, paths []string, values []string) []protoutils.TargetPath

GetTargetPathsWithValues creates multiple target paths with values to set

func MakeContext

func MakeContext() context.Context

MakeContext returns a new context for use in GNMI requests

func MakeProtoPath

func MakeProtoPath(target string, path string) string

MakeProtoPath returns a Path: element for a given target and Path

func NewAdminServiceClient added in v0.6.0

func NewAdminServiceClient() (admin.ConfigAdminServiceClient, error)

NewAdminServiceClient :

func NewConfigurationServiceClient added in v0.10.13

func NewConfigurationServiceClient() (admin.ConfigurationServiceClient, error)

NewConfigurationServiceClient returns configuration store client

func NewSimulatorTargetEntity added in v0.10.13

func NewSimulatorTargetEntity(simulator *helm.HelmRelease, targetType string, targetVersion string) (*topo.Object, error)

NewSimulatorTargetEntity creates a topo entity for a device simulator target

func NewTopoClient added in v0.7.1

func NewTopoClient() (toposdk.Client, error)

NewTopoClient creates a topology client

func NewTransactionServiceClient added in v0.10.13

func NewTransactionServiceClient() (admin.TransactionServiceClient, error)

NewTransactionServiceClient :

func SetGNMIValue

func SetGNMIValue(ctx context.Context, c gnmiclient.Impl, updatePaths []protoutils.TargetPath, deletePaths []protoutils.TargetPath, extensions []*gnmi_ext.Extension) (string, []*gnmi_ext.Extension, error)

SetGNMIValue generates a SET request on the given client for update and delete paths on a target

func SetGNMIValueOrFail

func SetGNMIValueOrFail(t *testing.T, gnmiClient gnmiclient.Impl,
	updatePaths []protoutils.TargetPath, deletePaths []protoutils.TargetPath,
	extensions []*gnmi_ext.Extension) (configapi.TransactionID, v2.Index)

SetGNMIValueOrFail does a GNMI set operation to the given client, and fails the test if there is an error

func SetGNMIValueWithContext added in v0.10.10

func SetGNMIValueWithContext(ctx context.Context, t *testing.T, gnmiClient gnmiclient.Impl,
	updatePaths []protoutils.TargetPath, deletePaths []protoutils.TargetPath,
	extensions []*gnmi_ext.Extension) (configapi.TransactionID, v2.Index, error)

SetGNMIValueWithContext does a GNMI set operation to the given client, and fails the test if there is an error

func SetGNMIValueWithContextOrFail added in v0.10.10

func SetGNMIValueWithContextOrFail(ctx context.Context, t *testing.T, gnmiClient gnmiclient.Impl,
	updatePaths []protoutils.TargetPath, deletePaths []protoutils.TargetPath,
	extensions []*gnmi_ext.Extension) (configapi.TransactionID, v2.Index)

SetGNMIValueWithContextOrFail does a GNMI set operation to the given client, and fails the test if there is an error

func WaitForConfigurationCompleteOrFail added in v0.10.13

func WaitForConfigurationCompleteOrFail(t *testing.T, configurationID configapi.ConfigurationID, wait time.Duration) error

WaitForConfigurationCompleteOrFail wait for a configuration to complete or fail

func WaitForRollback added in v0.10.13

func WaitForRollback(t *testing.T, transactionIndex v2.Index, wait time.Duration) bool

WaitForRollback waits for a COMPLETED status on the most recent rollback transaction

func WaitForTarget added in v0.10.13

func WaitForTarget(t *testing.T, predicate func(*topo.Relation, topo.EventType) bool, timeout time.Duration) bool

WaitForTarget waits for a target to match the given predicate

func WaitForTargetAvailable added in v0.10.13

func WaitForTargetAvailable(t *testing.T, objectID topo.ID, timeout time.Duration) bool

WaitForTargetAvailable waits for a target to become available

func WaitForTargetUnavailable added in v0.10.13

func WaitForTargetUnavailable(t *testing.T, objectID topo.ID, timeout time.Duration) bool

WaitForTargetUnavailable waits for a target to become available

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL