gnmi

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2021 License: Apache-2.0 Imports: 32 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// SimulatorDeviceVersion default version for simulated device
	SimulatorDeviceVersion = "1.0.0"

	// SimulatorDeviceType type for simulated device
	SimulatorDeviceType = "Devicesim"
)

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.DevicePath, 0)

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

Functions

func AddDeviceToTopo added in v0.6.0

func AddDeviceToTopo(deviceEntity *topo.Object) error

AddDeviceToTopo :

func AwaitDeviceState added in v0.6.0

func AwaitDeviceState(simulator *helm.HelmRelease, predicate func(object *topo.Object) bool) error

AwaitDeviceState :

func CheckDeviceValue

func CheckDeviceValue(t *testing.T, deviceGnmiClient client.Impl, devicePaths []protoutils.DevicePath, expectedValue string)

CheckDeviceValue makes sure a value has been assigned properly to a device path by querying GNMI

func CheckGNMIValue

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

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

func CheckGNMIValues

func CheckGNMIValues(t *testing.T, gnmiClient client.Impl, paths []protoutils.DevicePath, 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 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 device from topology

func GetDestination added in v0.6.0

func GetDestination() (client.Destination, error)

GetDestination :

func GetDevice added in v0.6.0

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

GetDevice :

func GetDeviceDestination added in v0.6.0

func GetDeviceDestination(simulator *helm.HelmRelease) (client.Destination, error)

GetDeviceDestination :

func GetDeviceGNMIClientOrFail

func GetDeviceGNMIClientOrFail(t *testing.T, simulator *helm.HelmRelease) client.Impl

GetDeviceGNMIClientOrFail creates a GNMI client to a device. If there is an error, the test is failed

func GetDevicePath

func GetDevicePath(device string, path string) []protoutils.DevicePath

GetDevicePath creates a device path

func GetDevicePathWithValue

func GetDevicePathWithValue(device string, path string, value string, valueType string) []protoutils.DevicePath

GetDevicePathWithValue creates a device path with a value to set

func GetDevicePaths

func GetDevicePaths(devices []string, paths []string) []protoutils.DevicePath

GetDevicePaths creates multiple device paths

func GetDevicePathsWithValues

func GetDevicePathsWithValues(devices []string, paths []string, values []string) []protoutils.DevicePath

GetDevicePathsWithValues creates multiple device paths with values to set

func GetGNMIClientOrFail

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

GetGNMIClientOrFail 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 client.Impl, paths []protoutils.DevicePath, encoding gpb.Encoding) ([]protoutils.DevicePath, []*gnmi_ext.Extension, error)

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

func GetSimulatorExtensions

func GetSimulatorExtensions() []*gnmi_ext.Extension

GetSimulatorExtensions creates the default set of extensions for a simulated device

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 NewChangeServiceClient added in v0.6.0

func NewChangeServiceClient() (diags.ChangeServiceClient, error)

NewChangeServiceClient :

func NewDeviceEntity added in v0.7.27

func NewDeviceEntity(simulator *helm.HelmRelease, deviceType string, version string) (*topo.Object, error)

NewDeviceEntity :

func NewOpStateDiagsClient added in v0.6.0

func NewOpStateDiagsClient() (diags.OpStateDiagsClient, error)

NewOpStateDiagsClient :

func NewTopoClient added in v0.7.1

func NewTopoClient() (topo.TopoClient, error)

NewTopoClient :

func RemoveDeviceFromTopo added in v0.6.0

func RemoveDeviceFromTopo(d *topo.Object) error

RemoveDeviceFromTopo :

func SetGNMIValue

func SetGNMIValue(ctx context.Context, c client.Impl, updatePaths []protoutils.DevicePath, deletePaths []protoutils.DevicePath, 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 device

func SetGNMIValueOrFail

func SetGNMIValueOrFail(t *testing.T, gnmiClient client.Impl,
	updatePaths []protoutils.DevicePath, deletePaths []protoutils.DevicePath,
	extensions []*gnmi_ext.Extension) network.ID

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

func WaitForDevice

func WaitForDevice(t *testing.T, predicate func(*device.Device, topo.EventType) bool, timeout time.Duration) bool

WaitForDevice waits for a device to match the given predicate

func WaitForDeviceAvailable

func WaitForDeviceAvailable(t *testing.T, deviceID device.ID, timeout time.Duration) bool

WaitForDeviceAvailable waits for a device to become available

func WaitForDeviceUnavailable

func WaitForDeviceUnavailable(t *testing.T, deviceID device.ID, timeout time.Duration) bool

WaitForDeviceUnavailable waits for a device to become available

func WaitForNetworkChangeComplete

func WaitForNetworkChangeComplete(t *testing.T, networkChangeID network.ID, wait time.Duration) bool

WaitForNetworkChangeComplete waits for a COMPLETED status on the given change

Types

This section is empty.

Jump to

Keyboard shortcuts

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