gnmi

package
v0.6.6 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2020 License: Apache-2.0 Imports: 32 Imported by: 0

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

func AddDeviceToTopo(d *device.Device) error

AddDeviceToTopo :

func AwaitDeviceState

func AwaitDeviceState(simulator *helm.HelmRelease, predicate func(*device.Device) 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

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

CreateSimulator creates a device simulator

func CreateSimulatorWithName

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

CreateSimulatorWithName creates a device simulator

func DeleteSimulator

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

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

func GetDestination

func GetDestination() (client.Destination, error)

GetDestination :

func GetDevice

func GetDevice(simulator *helm.HelmRelease) (*device.Device, error)

GetDevice :

func GetDeviceDestination

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

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

func NewAdminServiceClient() (admin.ConfigAdminServiceClient, error)

NewAdminServiceClient :

func NewChangeServiceClient

func NewChangeServiceClient() (diags.ChangeServiceClient, error)

NewChangeServiceClient :

func NewDevice

func NewDevice(simulator *helm.HelmRelease, deviceType string, version string) (*device.Device, error)

NewDevice :

func NewDeviceServiceClient

func NewDeviceServiceClient() (device.DeviceServiceClient, error)

NewDeviceServiceClient :

func NewOpStateDiagsClient

func NewOpStateDiagsClient() (diags.OpStateDiagsClient, error)

NewOpStateDiagsClient :

func RemoveDeviceFromTopo

func RemoveDeviceFromTopo(d *device.Device) 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) 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