Documentation ¶
Index ¶
- Constants
- Variables
- func LogDebug(v ...interface{})
- func LogError(v ...interface{})
- func LogErrorsIfNotNil(err error, v ...interface{})
- func LogInfo(v ...interface{})
- func LogPanic(v ...interface{})
- func LogWarning(v ...interface{})
- func SetLogLevel(ll LogLevel)
- type AppConfig
- type AppType
- type BenchmarkConfig
- type CoresInfo
- type DockerConfig
- type LogLevel
- type Logger
- func (l *Logger) LogDebug(v ...interface{})
- func (l *Logger) LogError(v ...interface{})
- func (l *Logger) LogErrorsIfNotNil(err error, v ...interface{})
- func (l *Logger) LogInfo(v ...interface{})
- func (l *Logger) LogPanic(v ...interface{})
- func (l *Logger) LogWarning(v ...interface{})
- func (l *Logger) String() string
- type Measurement
- type Report
- type RunningApp
- type TestConfig
- type TestReport
- type TestStatus
- type TestType
- type TestcaseReportInfo
- type TestsuiteConfig
Constants ¶
const ( PktgenGetPortsNumberCommand = "printf(\"%d\\n\", pktgen.portStats(\"all\", \"port\").n);" PktgenGetPortStatsCommand = "stat = pktgen.portStats(\"all\", \"rate\");" PktgenPrintPortStatsCommand = "printf(\"%%d %%d %%d %%d\\n\", stat[%d].pkts_tx, stat[%d].mbits_tx, stat[%d].pkts_rx, stat[%d].mbits_rx);" PktgenExitCommand = "os.exit(0);" PktgenGetPortsNumberFormat = "%d" PktgenGetPortStatsFormat = "%d %d %d %d" )
Pktgen commands constants
const ( LogOffLvl LogLevel = iota LogPanicLvl = LogOffLvl LogErrorsLvl LogWarningsLvl LogInfoLvl LogDebugLvl )
Constants for different log levels.
Variables ¶
var ( TestPassedRegexp = regexp.MustCompile(`^TEST PASSED$`) TestFailedRegexp = regexp.MustCompile(`^TEST FAILED$`) TestCoresRegexp = regexp.MustCompile(`^DEBUG: System is using (\d+) cores now\. (\d+) cores are left available\.$`) DeleteContainersOnExit = true )
Test statuses regular expressions.
Functions ¶
func LogDebug ¶
func LogDebug(v ...interface{})
LogDebug logs if level is is equal to or higher than LogDebugLvl.
func LogError ¶
func LogError(v ...interface{})
LogError logs if level is is equal to or higher than LogErrorsLvl.
func LogErrorsIfNotNil ¶
func LogErrorsIfNotNil(err error, v ...interface{})
LogErrorsIfNotNil logs if level is equal to or higher than LogErrorsLvl if error is not nil.
func LogInfo ¶
func LogInfo(v ...interface{})
LogInfo logs if level is is equal to or higher than LogInfoLvl.
func LogWarning ¶
func LogWarning(v ...interface{})
LogWarning logs if level is is equal to or higher than LogWarningsLvl.
Types ¶
type AppConfig ¶
type AppConfig struct { // Specifies host name where docker daemon is running. Port number // is specified in DockerConfig structure and is the same for all // hosts. HostName string `json:"host-name"` // Specifies docker image to run for this test application. ImageName string `json:"image-name"` // Specifies application type. Valid values are "TestAppGo" and "TestAppPktgen" Type AppType `json:"app-type"` // Specifies an array of application command line arguments. First // argument is application executable. CommandLine []string `json:"exec-cmd"` }
AppConfig struct has settings controlling test distributed application parameters.
type AppType ¶
type AppType int
AppType is a type of application.
func (*AppType) UnmarshalJSON ¶
UnmarshalJSON unmarshals data and checks app type validity.
type BenchmarkConfig ¶
type BenchmarkConfig struct { // Array of strings to pass to pktgen Lua scripting interface upon // startup. All commands are executed once after getting port // number information from pktgen. StartCommands []string `json:"pktgen-startup-commands"` // Start gathering statistics after this number of // nanoseconds. Zero by default, so gather all statisctics. MeasureAfter time.Duration `json:"measure-after"` // Gather statistics for this number of nanoseconds. When zero, // don't stop gathering statistics. Zero by default. MeasureFor time.Duration `json:"measure-for"` }
BenchmarkConfig struct has settings controlling benchmark parameters, usually for tests with type TestTypeBenchmark.
type CoresInfo ¶
type CoresInfo struct {
CoresUsed, CoresFree int
}
CoresInfo has info about used and free cores.
type DockerConfig ¶
type DockerConfig struct { // Timeout for one http communication request. This setting is // controlling all framework-application communications. If no // answer is received after this time, test is considered failed. RequestTimeout time.Duration `json:"request-timeout"` // Version of docker remote client protocol. Should not be greater // than docker daemon which runs on network hosts. DockerVersion string `json:"docker-client-version"` // Whether to use Privileged container setting. Should be "true" // if DPDK is used on any of network hosts. Privileged bool `json:"privileged"` // Specifies volumes to map from outside system into docker // container. If wrong filesystems are specified in this array, // DPDK doesn't work. Volumes []string `json:"map-volumes"` // Network socket port to be used to communicate with docker // daemon. Usually 2375. DockerPort int `json:"docker-port"` // Network socket port to be used to communicate with pktgen // program. Usually 22022. PktgenPort int `json:"pktgen-port"` }
DockerConfig struct has settings controlling communication with docker daemons.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger type contains a logging object that generates lines of output to an io.Writer and file for logging.
func NewLogger ¶
NewLogger creates and returns a new Logger object initialized with file for output.
func (*Logger) LogDebug ¶
func (l *Logger) LogDebug(v ...interface{})
LogDebug logs if level is is equal to or higher than LogDebugLvl. Logs to standard output and to file in l.
func (*Logger) LogError ¶
func (l *Logger) LogError(v ...interface{})
LogError logs if level is is equal to or higher than LogErrorsLvl. Logs to standard output and to file in l.
func (*Logger) LogErrorsIfNotNil ¶
LogErrorsIfNotNil logs if level is equal to or higher than LogErrorsLvl if error is not nil.
func (*Logger) LogInfo ¶
func (l *Logger) LogInfo(v ...interface{})
LogInfo logs if level is is equal to or higher than LogInfoLvl. Logs to standard output and to file in l.
func (*Logger) LogPanic ¶
func (l *Logger) LogPanic(v ...interface{})
LogPanic prints error and calls panic.
func (*Logger) LogWarning ¶
func (l *Logger) LogWarning(v ...interface{})
LogWarning logs if level is is equal to or higher than LogWarningsLvl. Logs to standard output and to file in l.
type Measurement ¶
type Measurement struct {
PktsTX, MbitsTX, PktsRX, MbitsRX int64
}
Measurement has measured by benchmark values.
type Report ¶
type Report struct { Done chan error Pipe chan TestcaseReportInfo // contains filtered or unexported fields }
Report represents test report.
func StartReport ¶
StartReport initializes and starts report writing.
type RunningApp ¶
type RunningApp struct { Status TestStatus Benchmarks [][]Measurement CoresStats []CoresInfo Logger *Logger // contains filtered or unexported fields }
RunningApp structure represents the app being run.
func (*RunningApp) InitTest ¶
func (app *RunningApp) InitTest(logger *Logger, index int, config *AppConfig, dc *DockerConfig, test *TestConfig)
InitTest makes test initialization.
func (*RunningApp) String ¶
func (app *RunningApp) String() string
type TestConfig ¶
type TestConfig struct { // Test case name identifier. It is better to be unique. Name string `json:"name"` // Test time out. For benchmark tests this is the duration for // which test applications are running. For scenario tests this is // the duration after which test is considered hanging and // failed. For both test types applications are forcedly stopped // after this time. TestTime time.Duration `json:"test-time"` // Type of the test. Valid values are "TestTypeBenchmark" and // "TestTypeScenario". Type TestType `json:"test-type"` // Array of settings specific for each test application. Apps []AppConfig `json:"test-apps"` // Benchmark controlling settings. May be omitted for scenario // tests. BenchConf BenchmarkConfig `json:"benchmarking-settings"` }
TestConfig struct has settings for one test case.
func (*TestConfig) String ¶
func (test *TestConfig) String() string
type TestReport ¶
type TestReport struct { AppIndex int AppStatus TestStatus // contains filtered or unexported fields }
TestReport has info about test status and application.
type TestStatus ¶
type TestStatus int
TestStatus is a status of the test.
const ( TestCreated TestStatus = iota TestInitialized TestInvalid TestRunning TestReportedPassed TestReportedFailed TestTimedOut )
Constants for different test statuses.
type TestType ¶
type TestType int
TestType is a type of the test.
func (*TestType) UnmarshalJSON ¶
UnmarshalJSON unmarshals data and checks test type validity.
type TestcaseReportInfo ¶
type TestcaseReportInfo struct { Status TestStatus Benchdata []Measurement CoresStats CoresInfo CoreLastValue int CoreDecreased bool Apps []RunningApp }
TestcaseReportInfo has all info about test.
type TestsuiteConfig ¶
type TestsuiteConfig struct { // Settings which control docker daemon functionality. Config DockerConfig `json:"docker-config"` // Array of test cases. Tests []TestConfig `json:"tests"` }
TestsuiteConfig struct has settings which describe whole test suite.
func ReadConfig ¶
func ReadConfig(fileName string) (*TestsuiteConfig, error)
ReadConfig function reads and parses config file.
func (*TestsuiteConfig) RunAllTests ¶
func (config *TestsuiteConfig) RunAllTests(logdir string)
RunAllTests launches all tests.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
localTesting
|
|
Only IPv4, Only tunnel, Only ESP, Only AES-128-CBC
|
Only IPv4, Only tunnel, Only ESP, Only AES-128-CBC |
stability
|
|