Documentation
¶
Overview ¶
Package fptest provides helper functions for organizing tests and reporting results.
Index ¶
- func AssignToNetworkInstance(t testing.TB, d *ondatra.DUTDevice, i string, ni string, si uint32)
- func ConfigEnableTbNative(t testing.TB, d *ondatra.DUTDevice)
- func ConfigureDefaultNetworkInstance(t testing.TB, d *ondatra.DUTDevice)
- func CopyDeviceConfig(t testing.TB, dut *ondatra.DUTDevice, config *oc.Root) *oc.Root
- func GetDeviceConfig(t testing.TB, dev gnmi.DeviceOrOpts) *oc.Root
- func GetIfSpeed(t *testing.T, p *ondatra.Port) oc.E_IfEthernet_ETHERNET_SPEED
- func LogQuery(t testing.TB, what string, query LoggableQuery, obj ygot.GoStruct)
- func NonFatal(t testing.TB, f func(t testing.TB)) (ok bool)
- func RunTests(m *testing.M)
- func SetPortSpeed(t testing.TB, p *ondatra.Port)
- func WriteOutput(filename, suffix string, content string) (string, error)
- func WriteQuery(t testing.TB, what string, query LoggableQuery, obj ygot.GoStruct)
- type LoggableQuery
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssignToNetworkInstance ¶
AssignToNetworkInstance attaches a subinterface to a network instance.
func ConfigEnableTbNative ¶
ConfigEnableTbNative enables admin-state of table-connections in native mode.
func ConfigureDefaultNetworkInstance ¶
ConfigureDefaultNetworkInstance configures the default network instance name and type.
func CopyDeviceConfig ¶
CopyDeviceConfig returns a deep copy of a device config but refurbishes it enough so it can be pushed out again
func GetDeviceConfig ¶
GetDeviceConfig gets a full config from a device but refurbishes it enough so it can be pushed out again. Ideally, we should be able to push the config we get from the same device without modification, but this is not explicitly defined in OpenConfig.
func GetIfSpeed ¶
GetIfSpeed returns an explicit speed of an interface in OC format
func LogQuery ¶
LogQuery logs a ygot GoStruct at path as either config or telemetry, depending on the query. It also writes a copy to a *.json file in the directory specified by the -outputs_dir flag.
func RunTests ¶
RunTests initializes the appropriate binding and runs the tests. It should be called from every featureprofiles tests like this:
package test import "github.com/openconfig/featureprofiles/internal/fptest" func TestMain(m *testing.M) { fptest.RunTests(m) }
func SetPortSpeed ¶
SetPortSpeed sets the DUT config for the interface port-speed according to ondatra.Prot.Speed()
func WriteOutput ¶
WriteOutput writes content to a file in --outputs_dir, after sanitizing the filename and making it unique. Returns the sanitized filename relative to --outputs_dir.
func WriteQuery ¶
WriteQuery is like LogQuery but only writes to test output dir, so it does not pollute the test log.
Types ¶
type LoggableQuery ¶
type LoggableQuery interface { PathStruct() ygnmi.PathStruct IsState() bool }
LoggableQuery is a subset of the ygnmi.AnyQuery type used for logging