Documentation ¶
Index ¶
- Variables
- func AnalyseResults(cmd *cobra.Command, ts *suite.TestSuite, results []result.NetconfResult)
- func BuildTestSuite(path string) *suite.TestSuite
- func Completion(cmd *cobra.Command, args []string)
- func Execute(version string)
- func Init()
- func InitConfig()
- func OrderAndExcludeErrValues(results []result.NetconfResult, latencies map[string]map[string][]float64) int
- func SortLatencies(latencies map[string]map[string][]float64) []string
- func SortResults(results []result.NetconfResult)
- func StringAddr(v string) *string
- func Version(cmd *cobra.Command, args []string)
Constants ¶
This section is empty.
Variables ¶
var AnalyseCmd = &cobra.Command{ Use: "analyse <results file>", Short: "Analyse the output of a Test Suite run", Args: func(cmd *cobra.Command, args []string) error { if len(args) != 1 { return errors.New("analyse command requires a test results directory as an argument") } return nil }, Run: func(cmd *cobra.Command, args []string) { if results, ts, err := result.UnarchiveResults(args[0]); err != nil { log.Fatalf("Problem with loading result information: %v ", err) } else { AnalyseResults(cmd, ts, results) } }, }
AnalyseCmd represents the analyse command
var InitCmd = &cobra.Command{ Use: "init <directory>", Short: "Scaffold a Test Suite and snippets directory", Args: func(cmd *cobra.Command, args []string) error { if len(args) != 1 { return errors.New("init command requires a directory as an argument") } return nil }, Run: func(cmd *cobra.Command, args []string) { _, err := os.Stat(args[0]) if !os.IsNotExist(err) { log.Fatalf("%v already exists, remove it before running init or use a different directory", args[0]) } path := filepath.Join(args[0], "snippets") err = os.MkdirAll(path, os.ModePerm) if err != nil { log.Fatal(err) } bytes, err := yaml.Marshal(BuildTestSuite(path)) if err != nil { log.Fatal(err) } err = ioutil.WriteFile(filepath.Join(args[0], "test-suite.yml"), bytes, 0644) if err != nil { log.Fatal(err) } bytes = []byte("<interface><name>Ethernet0/0</name><mtu>1500</mtu></interface>") err = ioutil.WriteFile(filepath.Join(path, "edit-config.xml"), bytes, 0644) if err != nil { log.Fatal(err) } }, }
InitCmd represents the init command
var RootCmd = &cobra.Command{ Use: os.Args[0], Short: "A NETCONF Load Tester", }
RootCmd represents the base command when called without any subcommands
var ( // VERSION passed in as a build variable VERSION string )
Functions ¶
func AnalyseResults ¶ added in v0.1.14
AnalyseResults Analyse the output of a Test Suite run
func BuildTestSuite ¶ added in v0.1.14
BuildTestSuite Creates TestSuite scaffold files
func Completion ¶
Completion is a helper function to allow passing arguments to other functions (so that they can be unit tested)
func Execute ¶
func Execute(version string)
Execute adds all child commands to the root command sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.
func InitConfig ¶ added in v0.1.14
func InitConfig()
InitConfig reads in config file and ENV variables if set.
func OrderAndExcludeErrValues ¶ added in v0.1.14
func OrderAndExcludeErrValues(results []result.NetconfResult, latencies map[string]map[string][]float64) int
OrderAndExcludeErrValues Orders the results and removes errors from output. Returns number of errors found.
func SortLatencies ¶ added in v0.1.14
SortLatencies Sorts keys of latencies Map to allow for ordered iteration of map
func SortResults ¶ added in v0.1.14
func SortResults(results []result.NetconfResult)
SortResults Sorts its contents by hostname or operation if duplicate hostnames exist
func StringAddr ¶ added in v0.1.14
StringAddr is a helper routine that allocates a new string value to store v and returns a pointer to it.
Types ¶
This section is empty.