Documentation
¶
Index ¶
- func InitBus(tc *TestContext) *processingBus
- type Callback
- type EdgeNodeDescription
- type EdgeNodeOption
- type GetEdgeNodeOpts
- type ProcAppLogFunc
- type ProcInfoFunc
- type ProcLogFlowFunc
- type ProcLogFunc
- type ProcMetricFunc
- type ProcTimerFunc
- type Project
- type State
- func (state *State) CheckReady() bool
- func (state *State) GetAinfoSlice() []*info.ZInfoApp
- func (state *State) GetAppMetrics() []*metrics.AppMetric
- func (state *State) GetBinfoSlice() []*info.ZInfoBlob
- func (state *State) GetCinfoSlice() []*info.ZInfoContentTree
- func (state *State) GetDeviceMetrics() *metrics.DeviceMetric
- func (state *State) GetDinfo() *info.ZInfoDevice
- func (state *State) GetInfoProcessingFunction() ProcInfoFunc
- func (state *State) GetLastInfoTime() *timestamppb.Timestamp
- func (state *State) GetMetricProcessingFunction() ProcMetricFunc
- func (state *State) GetNetworkInstanceMetrics() []*metrics.ZMetricNetworkInstance
- func (state *State) GetNiinfoSlice() []*info.ZInfoNetworkInstance
- func (state *State) GetVinfoSlice() []*info.ZInfoVolume
- func (state *State) GetVolumeMetrics() []*metrics.ZMetricVolume
- func (state *State) LookUp(path string) (value reflect.Value, err error)
- type TestContext
- func (tc *TestContext) AddEdgeNodesFromDescription()
- func (tc *TestContext) AddNode(node *device.Ctx)
- func (tc *TestContext) AddProcAppLog(edgeNode *device.Ctx, appUUID uuid.UUID, processFunction ProcAppLogFunc)
- func (tc *TestContext) AddProcFlowLog(edgeNode *device.Ctx, processFunction ProcLogFlowFunc)
- func (tc *TestContext) AddProcInfo(edgeNode *device.Ctx, processFunction ProcInfoFunc)
- func (tc *TestContext) AddProcLog(edgeNode *device.Ctx, processFunction ProcLogFunc)
- func (tc *TestContext) AddProcMetric(edgeNode *device.Ctx, processFunction ProcMetricFunc)
- func (tc *TestContext) AddProcTimer(edgeNode *device.Ctx, processFunction ProcTimerFunc)
- func (tc *TestContext) CheckMessageInAppLog(edgeNode *device.Ctx, appID uuid.UUID, message string, callbacks ...Callback) ProcTimerFunc
- func (tc *TestContext) ConfigSync(edgeNode *device.Ctx)
- func (tc *TestContext) ExpandOnSuccess(secs int)
- func (tc *TestContext) GetController() controller.Cloud
- func (tc *TestContext) GetEdgeNode(opts ...GetEdgeNodeOpts) *device.Ctx
- func (tc *TestContext) GetNodeDescriptions() (nodes []*EdgeNodeDescription)
- func (tc *TestContext) GetState(edgeNode *device.Ctx) *State
- func (tc *TestContext) InitProject(name string)
- func (tc *TestContext) NewEdgeNode(opts ...EdgeNodeOption) *device.Ctx
- func (tc *TestContext) PortForwardCommand(cmd func(fwdPort uint16) error, eveIfName string, targetPort uint16) error
- func (tc *TestContext) StartTrackingState(onlyNewElements bool)
- func (tc *TestContext) UpdateEdgeNode(edgeNode *device.Ctx, opts ...EdgeNodeOption)
- func (tc *TestContext) WaitForProc(secs int)
- func (tc *TestContext) WaitForProcWithErrorCallback(secs int, callback Callback)
- func (tc *TestContext) WaitForState(edgeNode *device.Ctx, secs int)
- func (tc *TestContext) WithCurrentProject() EdgeNodeOption
- func (tc *TestContext) WithDeviceModel(devModel string) EdgeNodeOption
- func (tc *TestContext) WithNodeDescription(nodeDescription *EdgeNodeDescription) EdgeNodeOption
- func (tc *TestContext) WithTest(t *testing.T) GetEdgeNodeOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitBus ¶
func InitBus(tc *TestContext) *processingBus
Types ¶
type EdgeNodeDescription ¶
EdgeNodeDescription must be defined in config file
func (*EdgeNodeDescription) GetEdgeNode ¶
func (nodeDescription *EdgeNodeDescription) GetEdgeNode(tc *TestContext) *device.Ctx
GetEdgeNode returns EdgeNode for provided EdgeNodeDescription based on onboarding key (if exists) or name
type EdgeNodeOption ¶
EdgeNodeOption is type to use for creation of device.Ctx
type GetEdgeNodeOpts ¶
GetEdgeNodeOpts pattern to pass device modifications
type ProcAppLogFunc ¶
ProcAppLogFunc provides callback to process app log
type ProcInfoFunc ¶
ProcInfoFunc provides callback to process info
type ProcLogFlowFunc ¶
type ProcLogFlowFunc func(log *flowlog.FlowMessage) error
ProcLogFlowFunc provides callback to process flowLog
type ProcLogFunc ¶
type ProcLogFunc func(log *elog.FullLogEntry) error
ProcLogFunc provides callback to process log
type ProcMetricFunc ¶
type ProcMetricFunc func(metric *metrics.ZMetricMsg) error
ProcMetricFunc provides callback to process metric
type ProcTimerFunc ¶
type ProcTimerFunc func() error
ProcTimerFunc provides callback to process on timer event
func SendCommandSSH ¶
func SendCommandSSH(ip *string, port *int, user, password, command string, foreground bool, callbacks ...Callback) ProcTimerFunc
SendCommandSSH try to access SSH with timer and sends command
func SendFileSCP ¶
func SendFileSCP(ip *string, port *int, user, password, filename, destpath string) ProcTimerFunc
SendFileSCP sends a file over SCP
type Project ¶
type Project struct {
// contains filtered or unexported fields
}
Project structure for test set
type State ¶
type State struct {
// contains filtered or unexported fields
}
State aggregates device state
func (*State) CheckReady ¶
CheckReady returns true in all needed information obtained from controller
func (*State) GetAinfoSlice ¶
GetAinfoSlice get []*info.ZInfoApp from obtained info
func (*State) GetAppMetrics ¶
GetAppMetrics get []*metrics.AppMetric from obtained metrics
func (*State) GetBinfoSlice ¶
GetBinfoSlice get []*info.ZInfoBlob from obtained info
func (*State) GetCinfoSlice ¶
func (state *State) GetCinfoSlice() []*info.ZInfoContentTree
GetCinfoSlice get []*info.ZInfoContentTree from obtained info
func (*State) GetDeviceMetrics ¶
func (state *State) GetDeviceMetrics() *metrics.DeviceMetric
GetDeviceMetrics get *metrics.DeviceMetric from obtained metrics
func (*State) GetDinfo ¶
func (state *State) GetDinfo() *info.ZInfoDevice
GetDinfo get *info.ZInfoDevice from obtained info
func (*State) GetInfoProcessingFunction ¶
func (state *State) GetInfoProcessingFunction() ProcInfoFunc
GetInfoProcessingFunction returns processing function for ZInfoMsg
func (*State) GetLastInfoTime ¶
func (state *State) GetLastInfoTime() *timestamppb.Timestamp
GetLastInfoTime get *timestamp.Timestamp for last received info
func (*State) GetMetricProcessingFunction ¶
func (state *State) GetMetricProcessingFunction() ProcMetricFunc
GetMetricProcessingFunction returns processing function for ZMetricMsg
func (*State) GetNetworkInstanceMetrics ¶
func (state *State) GetNetworkInstanceMetrics() []*metrics.ZMetricNetworkInstance
GetNetworkInstanceMetrics get []*metrics.ZMetricNetworkInstance from obtained metrics
func (*State) GetNiinfoSlice ¶
func (state *State) GetNiinfoSlice() []*info.ZInfoNetworkInstance
GetNiinfoSlice get []*info.ZInfoNetworkInstance from obtained info
func (*State) GetVinfoSlice ¶
func (state *State) GetVinfoSlice() []*info.ZInfoVolume
GetVinfoSlice get []*info.ZInfoVolume from obtained info
func (*State) GetVolumeMetrics ¶
func (state *State) GetVolumeMetrics() []*metrics.ZMetricVolume
GetVolumeMetrics get []*metrics.ZMetricVolume from obtained metrics
func (*State) LookUp ¶
LookUp access fields of State objects by path path contains address to lookup for example: LookUp("Dinfo.Network[0].IPAddrs[0]") will return first IP of first network of EVE All top fields to lookup in: Dinfo *info.ZInfoDevice Ainfo []*info.ZInfoApp Niinfo []*info.ZInfoNetworkInstance Vinfo []*info.ZInfoVolume Cinfo []*info.ZInfoContentTree Binfo []*info.ZInfoBlob Cipherinfo []*info.ZInfoCipher AppMetrics []*metrics.AppMetric NetworkInstanceMetrics []*metrics.ZMetricNetworkInstance VolumeMetrics []*metrics.ZMetricVolume DeviceMetrics *metrics.DeviceMetric
type TestContext ¶
type TestContext struct { Cloud controller.Cloud SdnClient *edensdn.SdnClient WithSdn bool ProcBus *processingBus Tests map[*device.Ctx]*testing.T // contains filtered or unexported fields }
TestContext is main structure for running tests
func (*TestContext) AddEdgeNodesFromDescription ¶
func (tc *TestContext) AddEdgeNodesFromDescription()
AddEdgeNodesFromDescription adds EdgeNodes from description in test.eve param
func (*TestContext) AddNode ¶
func (tc *TestContext) AddNode(node *device.Ctx)
AddNode add node to test context
func (*TestContext) AddProcAppLog ¶
func (tc *TestContext) AddProcAppLog(edgeNode *device.Ctx, appUUID uuid.UUID, processFunction ProcAppLogFunc)
AddProcAppLog add processFunction, that will get all app logs for edgeNode
func (*TestContext) AddProcFlowLog ¶
func (tc *TestContext) AddProcFlowLog(edgeNode *device.Ctx, processFunction ProcLogFlowFunc)
AddProcFlowLog add processFunction, that will get all FlowLogs for edgeNode
func (*TestContext) AddProcInfo ¶
func (tc *TestContext) AddProcInfo(edgeNode *device.Ctx, processFunction ProcInfoFunc)
AddProcInfo add processFunction, that will get all info for edgeNode
func (*TestContext) AddProcLog ¶
func (tc *TestContext) AddProcLog(edgeNode *device.Ctx, processFunction ProcLogFunc)
AddProcLog add processFunction, that will get all logs for edgeNode
func (*TestContext) AddProcMetric ¶
func (tc *TestContext) AddProcMetric(edgeNode *device.Ctx, processFunction ProcMetricFunc)
AddProcMetric add processFunction, that will get all metrics for edgeNode
func (*TestContext) AddProcTimer ¶
func (tc *TestContext) AddProcTimer(edgeNode *device.Ctx, processFunction ProcTimerFunc)
AddProcTimer add processFunction, that will fire with time intervals for edgeNode
func (*TestContext) CheckMessageInAppLog ¶
func (tc *TestContext) CheckMessageInAppLog(edgeNode *device.Ctx, appID uuid.UUID, message string, callbacks ...Callback) ProcTimerFunc
CheckMessageInAppLog try to find message in logs of app
func (*TestContext) ConfigSync ¶
func (tc *TestContext) ConfigSync(edgeNode *device.Ctx)
ConfigSync send config to controller
func (*TestContext) ExpandOnSuccess ¶
func (tc *TestContext) ExpandOnSuccess(secs int)
ExpandOnSuccess adds additional time to global timeout on every success check
func (*TestContext) GetController ¶
func (tc *TestContext) GetController() controller.Cloud
GetController returns current controller
func (*TestContext) GetEdgeNode ¶
func (tc *TestContext) GetEdgeNode(opts ...GetEdgeNodeOpts) *device.Ctx
GetEdgeNode return node from context
func (*TestContext) GetNodeDescriptions ¶
func (tc *TestContext) GetNodeDescriptions() (nodes []*EdgeNodeDescription)
GetNodeDescriptions returns list of nodes from config
func (*TestContext) GetState ¶
func (tc *TestContext) GetState(edgeNode *device.Ctx) *State
GetState returns State object for edgeNode
func (*TestContext) InitProject ¶
func (tc *TestContext) InitProject(name string)
InitProject init project object with defined name
func (*TestContext) NewEdgeNode ¶
func (tc *TestContext) NewEdgeNode(opts ...EdgeNodeOption) *device.Ctx
NewEdgeNode creates edge node
func (*TestContext) PortForwardCommand ¶
func (tc *TestContext) PortForwardCommand(cmd func(fwdPort uint16) error, eveIfName string, targetPort uint16) error
PortForwardCommand forwards network traffic from a command run inside the host and targeted towards EVE VM. The command should be run from inside of `cmd` function, with localhost (or 127.0.0.1) as the destination IP and fwdPort as the destination port.
func (*TestContext) StartTrackingState ¶
func (tc *TestContext) StartTrackingState(onlyNewElements bool)
StartTrackingState init function for State monitoring if onlyNewElements set no use old information from controller
func (*TestContext) UpdateEdgeNode ¶
func (tc *TestContext) UpdateEdgeNode(edgeNode *device.Ctx, opts ...EdgeNodeOption)
UpdateEdgeNode update edge node
func (*TestContext) WaitForProc ¶
func (tc *TestContext) WaitForProc(secs int)
WaitForProc blocking execution until the time elapses or all Procs gone returns error on timeout
func (*TestContext) WaitForProcWithErrorCallback ¶
func (tc *TestContext) WaitForProcWithErrorCallback(secs int, callback Callback)
WaitForProcWithErrorCallback blocking execution until the time elapses or all Procs gone and fires callback in case of timeout
func (*TestContext) WaitForState ¶
func (tc *TestContext) WaitForState(edgeNode *device.Ctx, secs int)
WaitForState wait for State initialization from controller
func (*TestContext) WithCurrentProject ¶
func (tc *TestContext) WithCurrentProject() EdgeNodeOption
WithCurrentProject sets project info
func (*TestContext) WithDeviceModel ¶
func (tc *TestContext) WithDeviceModel(devModel string) EdgeNodeOption
WithDeviceModel sets device model info
func (*TestContext) WithNodeDescription ¶
func (tc *TestContext) WithNodeDescription(nodeDescription *EdgeNodeDescription) EdgeNodeOption
WithNodeDescription sets device info
func (*TestContext) WithTest ¶
func (tc *TestContext) WithTest(t *testing.T) GetEdgeNodeOpts
WithTest assign *testing.T for device