summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clover/cloverctl/src/cloverctl/cmd/clear.go2
-rw-r--r--clover/cloverctl/src/cloverctl/cmd/clear_visibility.go7
-rw-r--r--clover/cloverctl/src/cloverctl/cmd/create.go4
-rw-r--r--clover/cloverctl/src/cloverctl/cmd/create_docker_registry.go16
-rw-r--r--clover/cloverctl/src/cloverctl/cmd/create_idsrules.go17
-rw-r--r--clover/cloverctl/src/cloverctl/cmd/create_kubernetes.go18
-rw-r--r--clover/cloverctl/src/cloverctl/cmd/create_testplan.go22
-rw-r--r--clover/cloverctl/src/cloverctl/cmd/delete.go4
-rw-r--r--clover/cloverctl/src/cloverctl/cmd/delete_docker_registry.go11
-rw-r--r--clover/cloverctl/src/cloverctl/cmd/delete_kubernetes.go11
-rw-r--r--clover/cloverctl/src/cloverctl/cmd/get.go4
-rw-r--r--clover/cloverctl/src/cloverctl/cmd/get_docker_registry.go6
-rw-r--r--clover/cloverctl/src/cloverctl/cmd/get_kubernetes.go6
-rw-r--r--clover/cloverctl/src/cloverctl/cmd/get_services.go2
-rw-r--r--clover/cloverctl/src/cloverctl/cmd/get_testresult.go47
-rw-r--r--clover/cloverctl/src/cloverctl/cmd/get_visibility.go11
-rw-r--r--clover/cloverctl/src/cloverctl/cmd/init.go2
-rw-r--r--clover/cloverctl/src/cloverctl/cmd/init_visibility.go10
-rw-r--r--clover/cloverctl/src/cloverctl/cmd/provider.go6
-rw-r--r--clover/cloverctl/src/cloverctl/cmd/root.go58
-rw-r--r--clover/cloverctl/src/cloverctl/cmd/set_nginx.go19
-rw-r--r--clover/cloverctl/src/cloverctl/cmd/set_visibility.go16
-rw-r--r--clover/cloverctl/src/cloverctl/cmd/start.go4
-rw-r--r--clover/cloverctl/src/cloverctl/cmd/start_ids.go11
-rw-r--r--clover/cloverctl/src/cloverctl/cmd/start_testplan.go23
-rw-r--r--clover/cloverctl/src/cloverctl/cmd/start_visibility.go13
-rw-r--r--clover/cloverctl/src/cloverctl/cmd/stop.go4
-rw-r--r--clover/cloverctl/src/cloverctl/cmd/stop_ids.go9
-rw-r--r--clover/cloverctl/src/cloverctl/cmd/stop_visibility.go7
-rw-r--r--clover/clovisor/Dockerfile3
-rwxr-xr-xclover/spark/docker/clover-spark/build.sh2
-rwxr-xr-xclover/spark/docker/spark-submit/runner.sh2
-rwxr-xr-xclover/spark/docker/spark-submit/runner_fast.sh2
-rw-r--r--clover/spark/src/main/scala/CloverSlow.scala50
-rw-r--r--docs/release/configguide/index.rst8
-rw-r--r--docs/release/configguide/jmeter_config_guide.rst298
-rw-r--r--docs/release/userguide/index.rst8
-rw-r--r--download/cloverctl.tar.gzbin0 -> 10050633 bytes
38 files changed, 574 insertions, 169 deletions
diff --git a/clover/cloverctl/src/cloverctl/cmd/clear.go b/clover/cloverctl/src/cloverctl/cmd/clear.go
index 309df70..eab784a 100644
--- a/clover/cloverctl/src/cloverctl/cmd/clear.go
+++ b/clover/cloverctl/src/cloverctl/cmd/clear.go
@@ -17,7 +17,7 @@ var clearCmd = &cobra.Command{
Short: "Truncate visibility tables",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
- fmt.Println("clear called")
+ fmt.Println("Uncomplete command")
},
}
diff --git a/clover/cloverctl/src/cloverctl/cmd/clear_visibility.go b/clover/cloverctl/src/cloverctl/cmd/clear_visibility.go
index 2ad43f1..2e66637 100644
--- a/clover/cloverctl/src/cloverctl/cmd/clear_visibility.go
+++ b/clover/cloverctl/src/cloverctl/cmd/clear_visibility.go
@@ -9,6 +9,7 @@ package cmd
import (
"fmt"
+ "os"
"gopkg.in/resty.v1"
"github.com/spf13/cobra"
)
@@ -16,7 +17,7 @@ import (
var visibilityclearCmd = &cobra.Command{
Use: "visibility",
- Short: "Clear visibility tables",
+ Short: "Clear visibility data",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
clearCollector()
@@ -28,12 +29,14 @@ func init() {
}
func clearCollector() {
+ checkControllerIP()
url := controllerIP + "/visibility/clear"
resp, err := resty.R().
Get(url)
if err != nil {
- panic(err.Error())
+ fmt.Printf("Cannot connect to controller: %v\n", err)
+ os.Exit(1)
}
fmt.Printf("\n%v\n", resp)
}
diff --git a/clover/cloverctl/src/cloverctl/cmd/create.go b/clover/cloverctl/src/cloverctl/cmd/create.go
index 3a09fa4..a66acf9 100644
--- a/clover/cloverctl/src/cloverctl/cmd/create.go
+++ b/clover/cloverctl/src/cloverctl/cmd/create.go
@@ -14,10 +14,10 @@ import (
var createCmd = &cobra.Command{
Use: "create",
- Short: "Create resources including IDS rules, L7 testplans, etc.",
+ Short: "Create clover configurations and deployments",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
- fmt.Println("create called")
+ fmt.Println("Incomplete command")
},
}
diff --git a/clover/cloverctl/src/cloverctl/cmd/create_docker_registry.go b/clover/cloverctl/src/cloverctl/cmd/create_docker_registry.go
index 77045f6..37e8aeb 100644
--- a/clover/cloverctl/src/cloverctl/cmd/create_docker_registry.go
+++ b/clover/cloverctl/src/cloverctl/cmd/create_docker_registry.go
@@ -10,7 +10,7 @@ package cmd
import (
"fmt"
"io/ioutil"
-
+ "os"
"gopkg.in/resty.v1"
"github.com/ghodss/yaml"
"github.com/spf13/cobra"
@@ -28,21 +28,24 @@ var dockerregistryCmd = &cobra.Command{
func init() {
providercreateCmd.AddCommand(dockerregistryCmd)
- dockerregistryCmd.Flags().StringVarP(&cloverFile, "file", "f", "", "Input yaml file to add kubernetes provider")
+ dockerregistryCmd.Flags().StringVarP(&cloverFile, "file", "f", "",
+ "Input yaml file to add docker registry")
dockerregistryCmd.MarkFlagRequired("file")
}
func createDockerRegistry() {
+ checkControllerIP()
url := controllerIP + "/halyard/addregistry"
in, err := ioutil.ReadFile(cloverFile)
if err != nil {
- fmt.Println("Please specify a valid rule definition yaml file")
- return
+ fmt.Println("Please specify a valid yaml file")
+ os.Exit(1)
}
out_json, err := yaml.YAMLToJSON(in)
if err != nil {
- panic(err.Error())
+ fmt.Printf("Invalid yaml: %v\n", err)
+ os.Exit(1)
}
resp, err := resty.R().
@@ -50,7 +53,8 @@ func createDockerRegistry() {
SetBody(out_json).
Post(url)
if err != nil {
- panic(err.Error())
+ fmt.Printf("Cannot connect to controller: %v\n", err)
+ os.Exit(1)
}
fmt.Printf("\n%v\n", resp)
diff --git a/clover/cloverctl/src/cloverctl/cmd/create_idsrules.go b/clover/cloverctl/src/cloverctl/cmd/create_idsrules.go
index bc0d8d5..6e59297 100644
--- a/clover/cloverctl/src/cloverctl/cmd/create_idsrules.go
+++ b/clover/cloverctl/src/cloverctl/cmd/create_idsrules.go
@@ -9,6 +9,7 @@ package cmd
import (
"fmt"
+ "os"
"io/ioutil"
"gopkg.in/resty.v1"
"github.com/ghodss/yaml"
@@ -18,7 +19,7 @@ import (
var idsrulesCmd = &cobra.Command{
Use: "idsrules",
- Short: "Create one or many IDS rules from yaml file",
+ Short: "Create one or many snort IDS rules from yaml file",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
createIDSRules()
@@ -27,30 +28,32 @@ var idsrulesCmd = &cobra.Command{
func init() {
createCmd.AddCommand(idsrulesCmd)
- idsrulesCmd.Flags().StringVarP(&cloverFile, "file", "f", "", "Input yaml file to add IDS rules")
+ idsrulesCmd.Flags().StringVarP(&cloverFile, "file", "f", "",
+ "Input yaml file to add IDS rules")
idsrulesCmd.MarkFlagRequired("file")
}
func createIDSRules() {
+ checkControllerIP()
url := controllerIP + "/snort/addrule"
in, err := ioutil.ReadFile(cloverFile)
if err != nil {
fmt.Println("Please specify a valid rule definition yaml file")
- return
+ os.Exit(1)
}
out_json, err := yaml.YAMLToJSON(in)
if err != nil {
- panic(err.Error())
+ fmt.Printf("Invalid yaml: %v\n", err)
+ os.Exit(1)
}
resp, err := resty.R().
SetHeader("Content-Type", "application/json").
SetBody(out_json).
Post(url)
if err != nil {
- panic(err.Error())
+ fmt.Printf("Cannot connect to controller: %v\n", err)
+ os.Exit(1)
}
fmt.Printf("\n%v\n", resp)
- //fmt.Println(string(out_json))
-
}
diff --git a/clover/cloverctl/src/cloverctl/cmd/create_kubernetes.go b/clover/cloverctl/src/cloverctl/cmd/create_kubernetes.go
index 7311090..8ff4394 100644
--- a/clover/cloverctl/src/cloverctl/cmd/create_kubernetes.go
+++ b/clover/cloverctl/src/cloverctl/cmd/create_kubernetes.go
@@ -12,7 +12,7 @@ import (
"time"
"io/ioutil"
"strings"
-
+ "os"
"gopkg.in/resty.v1"
"github.com/ghodss/yaml"
"github.com/spf13/cobra"
@@ -33,7 +33,7 @@ type DockerRegistry struct {
var kubeproviderCmd = &cobra.Command{
Use: "kubernetes",
- Short: "Add one kubernete provider from yaml file to spinnaker",
+ Short: "Add one kubernetes provider from yaml file to spinnaker",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
createProvider()
@@ -42,17 +42,19 @@ var kubeproviderCmd = &cobra.Command{
func init() {
providercreateCmd.AddCommand(kubeproviderCmd)
- kubeproviderCmd.Flags().StringVarP(&cloverFile, "file", "f", "", "Input yaml file to add kubernetes provider")
+ kubeproviderCmd.Flags().StringVarP(&cloverFile, "file", "f", "",
+ "Input yaml file to add kubernetes provider")
kubeproviderCmd.MarkFlagRequired("file")
}
func createProvider() {
+ checkControllerIP()
url := controllerIP + "/halyard/addkube"
in, err := ioutil.ReadFile(cloverFile)
if err != nil {
- fmt.Println("Please specify a valid rule definition yaml file")
- return
+ fmt.Println("Please specify a valid yaml file")
+ os.Exit(1)
}
t := Kubernetes{}
@@ -73,14 +75,16 @@ func createProvider() {
newconfig, _ := yaml.Marshal(&t)
out_json, err := yaml.YAMLToJSON(newconfig)
if err != nil {
- panic(err.Error())
+ fmt.Printf("Invalid yaml: %v\n", err)
+ os.Exit(1)
}
resp, err := resty.R().
SetHeader("Content-Type", "application/json").
SetBody(out_json).
Post(url)
if err != nil {
- panic(err.Error())
+ fmt.Printf("Cannot connect to controller: %v\n", err)
+ os.Exit(1)
}
fmt.Printf("\n%v\n", resp)
diff --git a/clover/cloverctl/src/cloverctl/cmd/create_testplan.go b/clover/cloverctl/src/cloverctl/cmd/create_testplan.go
index 686d5ba..1d9d8b2 100644
--- a/clover/cloverctl/src/cloverctl/cmd/create_testplan.go
+++ b/clover/cloverctl/src/cloverctl/cmd/create_testplan.go
@@ -9,49 +9,51 @@ package cmd
import (
"fmt"
+ "os"
"gopkg.in/resty.v1"
"io/ioutil"
"github.com/ghodss/yaml"
"github.com/spf13/cobra"
+
)
var testplanCmd = &cobra.Command{
Use: "testplan",
- Short: "Create L7 client emulation test plans from yaml file",
+ Short: "Create jmeter L7 client emulation test plan from yaml file",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
createTestPlan()
- //fmt.Printf("%v\n", cmd.Parent().CommandPath())
},
}
func init() {
createCmd.AddCommand(testplanCmd)
- testplanCmd.Flags().StringVarP(&cloverFile, "file", "f", "", "Input yaml file with test plan params")
+ testplanCmd.Flags().StringVarP(&cloverFile, "file", "f", "",
+ "Input test plan yaml file")
testplanCmd.MarkFlagRequired("file")
}
func createTestPlan() {
+ checkControllerIP()
url := controllerIP + "/jmeter/gen"
in, err := ioutil.ReadFile(cloverFile)
if err != nil {
- fmt.Println("Please specify a valid test plan yaml file")
- return
+ fmt.Println("Please specify a valid yaml file")
+ os.Exit(1)
}
out_json, err := yaml.YAMLToJSON(in)
if err != nil {
- panic(err.Error())
+ fmt.Printf("Invalid yaml: %v\n", err)
+ os.Exit(1)
}
resp, err := resty.R().
SetHeader("Content-Type", "application/json").
SetBody(out_json).
Post(url)
if err != nil {
- panic(err.Error())
+ fmt.Printf("Cannot connect to controller: %v\n", err)
+ os.Exit(1)
}
fmt.Printf("\n%v\n", resp)
- //fmt.Println(string(out_json))
-
}
-
diff --git a/clover/cloverctl/src/cloverctl/cmd/delete.go b/clover/cloverctl/src/cloverctl/cmd/delete.go
index 742d769..34070e7 100644
--- a/clover/cloverctl/src/cloverctl/cmd/delete.go
+++ b/clover/cloverctl/src/cloverctl/cmd/delete.go
@@ -14,10 +14,10 @@ import (
var deleteCmd = &cobra.Command{
Use: "delete",
- Short: "Delete resources including clover-system services",
+ Short: "Delete configurations and clover services",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
- fmt.Println("delete called")
+ fmt.Println("Incomplete command")
},
}
diff --git a/clover/cloverctl/src/cloverctl/cmd/delete_docker_registry.go b/clover/cloverctl/src/cloverctl/cmd/delete_docker_registry.go
index d4403a5..3bb411a 100644
--- a/clover/cloverctl/src/cloverctl/cmd/delete_docker_registry.go
+++ b/clover/cloverctl/src/cloverctl/cmd/delete_docker_registry.go
@@ -10,14 +10,14 @@ package cmd
import (
"fmt"
"encoding/json"
-
+ "os"
"gopkg.in/resty.v1"
"github.com/spf13/cobra"
)
var deldockerproviderCmd = &cobra.Command{
Use: "docker-registry",
- Short: "delete one docker registry provider by name from spinnaker",
+ Short: "Delete one docker registry provider by name from spinnaker",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
deldockerProvider()
@@ -26,12 +26,14 @@ var deldockerproviderCmd = &cobra.Command{
func init() {
providerdelCmd.AddCommand(deldockerproviderCmd)
- deldockerproviderCmd.Flags().StringVarP(&name, "name", "n", "", "Input docker-registry account name")
+ deldockerproviderCmd.Flags().StringVarP(&name, "name", "n", "",
+ "Input docker-registry account name")
deldockerproviderCmd.MarkFlagRequired("name")
}
func deldockerProvider() {
+ checkControllerIP()
url := controllerIP + "/halyard/delprovider"
var in = map[string]string{"name": name, "provider":"dockerRegistry"}
@@ -45,7 +47,8 @@ func deldockerProvider() {
SetBody(out_json).
Post(url)
if err != nil {
- panic(err.Error())
+ fmt.Printf("Cannot connect to controller: %v\n", err)
+ os.Exit(1)
}
fmt.Printf("\n%v\n", resp)
diff --git a/clover/cloverctl/src/cloverctl/cmd/delete_kubernetes.go b/clover/cloverctl/src/cloverctl/cmd/delete_kubernetes.go
index 77b466a..a6f29f9 100644
--- a/clover/cloverctl/src/cloverctl/cmd/delete_kubernetes.go
+++ b/clover/cloverctl/src/cloverctl/cmd/delete_kubernetes.go
@@ -10,7 +10,7 @@ package cmd
import (
"fmt"
"encoding/json"
-
+ "os"
"gopkg.in/resty.v1"
"github.com/spf13/cobra"
)
@@ -18,7 +18,7 @@ import (
var name string
var delkubeproviderCmd = &cobra.Command{
Use: "kubernetes",
- Short: "delete one kubernete provider by name from spinnaker",
+ Short: "Delete one kubernetes provider by name from spinnaker",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
delProvider()
@@ -27,12 +27,14 @@ var delkubeproviderCmd = &cobra.Command{
func init() {
providerdelCmd.AddCommand(delkubeproviderCmd)
- delkubeproviderCmd.Flags().StringVarP(&name, "name", "n", "", "Input kubernetes account name")
+ delkubeproviderCmd.Flags().StringVarP(&name, "name", "n", "",
+ "Input kubernetes account name")
delkubeproviderCmd.MarkFlagRequired("name")
}
func delProvider() {
+ checkControllerIP()
url := controllerIP + "/halyard/delprovider"
var in = map[string]string{"name": name, "provider":"kubernetes"}
@@ -46,7 +48,8 @@ func delProvider() {
SetBody(out_json).
Post(url)
if err != nil {
- panic(err.Error())
+ fmt.Printf("Cannot connect to controller: %v\n", err)
+ os.Exit(1)
}
fmt.Printf("\n%v\n", resp)
diff --git a/clover/cloverctl/src/cloverctl/cmd/get.go b/clover/cloverctl/src/cloverctl/cmd/get.go
index ae3d98e..c8493be 100644
--- a/clover/cloverctl/src/cloverctl/cmd/get.go
+++ b/clover/cloverctl/src/cloverctl/cmd/get.go
@@ -14,10 +14,10 @@ import (
var getCmd = &cobra.Command{
Use: "get",
- Short: "Get information about a resource",
+ Short: "Get information about a configuration or deployment",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
- fmt.Println("get called")
+ fmt.Println("Incomplete command")
},
}
diff --git a/clover/cloverctl/src/cloverctl/cmd/get_docker_registry.go b/clover/cloverctl/src/cloverctl/cmd/get_docker_registry.go
index 93c1b3e..7ae94c9 100644
--- a/clover/cloverctl/src/cloverctl/cmd/get_docker_registry.go
+++ b/clover/cloverctl/src/cloverctl/cmd/get_docker_registry.go
@@ -11,7 +11,7 @@ import (
"fmt"
"strings"
"encoding/json"
-
+ "os"
"gopkg.in/resty.v1"
"github.com/spf13/cobra"
)
@@ -31,6 +31,7 @@ func init() {
}
func getdocker() {
+ checkControllerIP()
url := controllerIP + "/halyard/account"
var provider = map[string]string{"name": "dockerRegistry"}
@@ -44,7 +45,8 @@ func getdocker() {
SetBody(out_json).
Get(url)
if err != nil {
- panic(err.Error())
+ fmt.Printf("Cannot connect to controller: %v\n", err)
+ os.Exit(1)
}
if resp.StatusCode() != 200 {
fmt.Printf("\n%v\n", resp)
diff --git a/clover/cloverctl/src/cloverctl/cmd/get_kubernetes.go b/clover/cloverctl/src/cloverctl/cmd/get_kubernetes.go
index 16dcca1..bd5875c 100644
--- a/clover/cloverctl/src/cloverctl/cmd/get_kubernetes.go
+++ b/clover/cloverctl/src/cloverctl/cmd/get_kubernetes.go
@@ -11,7 +11,7 @@ import (
"fmt"
"strings"
"encoding/json"
-
+ "os"
"gopkg.in/resty.v1"
"github.com/spf13/cobra"
)
@@ -31,6 +31,7 @@ func init() {
}
func getkube() {
+ checkControllerIP()
url := controllerIP + "/halyard/account"
var provider = map[string]string{"name": "kubernetes"}
@@ -44,7 +45,8 @@ func getkube() {
SetBody(out_json).
Get(url)
if err != nil {
- panic(err.Error())
+ fmt.Printf("Cannot connect to controller: %v\n", err)
+ os.Exit(1)
}
if resp.StatusCode() != 200 {
fmt.Printf("\n%v\n", resp)
diff --git a/clover/cloverctl/src/cloverctl/cmd/get_services.go b/clover/cloverctl/src/cloverctl/cmd/get_services.go
index cfa56bd..bab13ce 100644
--- a/clover/cloverctl/src/cloverctl/cmd/get_services.go
+++ b/clover/cloverctl/src/cloverctl/cmd/get_services.go
@@ -14,7 +14,7 @@ import (
var servicesCmd = &cobra.Command{
Use: "services",
- Short: "Get info on Kubernetes services",
+ Short: "Get listing of Kubernetes services",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
cloverkube.GetServices()
diff --git a/clover/cloverctl/src/cloverctl/cmd/get_testresult.go b/clover/cloverctl/src/cloverctl/cmd/get_testresult.go
index 12d47c3..f9d8e6d 100644
--- a/clover/cloverctl/src/cloverctl/cmd/get_testresult.go
+++ b/clover/cloverctl/src/cloverctl/cmd/get_testresult.go
@@ -9,37 +9,54 @@ package cmd
import (
"fmt"
+ "os"
"gopkg.in/resty.v1"
"github.com/spf13/cobra"
)
-var JmeterResult string
-
var testresultCmd = &cobra.Command{
Use: "testresult",
- Short: "Get test results from L7 client emulation",
+ Short: "Get test results from jmeter L7 client emulation",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
- getResult()
+ getResult("log")
},
}
-func init() {
- getCmd.AddCommand(testresultCmd)
- testresultCmd.Flags().StringVarP(&JmeterResult, "r", "r", "", "Result to retrieve - use 'log' or 'results'")
- testresultCmd.MarkFlagRequired("r")
+var log_testresultCmd = &cobra.Command{
+ Use: "log",
+ Short: "Get jmeter summary log results",
+ Long: ``,
+ Run: func(cmd *cobra.Command, args []string) {
+ getResult("log")
+ },
+}
+var detail_testresultCmd = &cobra.Command{
+ Use: "detail",
+ Short: "Get jmeter detailed results",
+ Long: ``,
+ Run: func(cmd *cobra.Command, args []string) {
+ getResult("detail")
+ },
}
+func init() {
+ getCmd.AddCommand(testresultCmd)
+ testresultCmd.AddCommand(log_testresultCmd)
+ testresultCmd.AddCommand(detail_testresultCmd)
+}
-func getResult() {
- switch JmeterResult {
- case "results":
+func getResult(result_type string) {
+ checkControllerIP()
+ switch result_type {
+ case "detail":
url := controllerIP + "/jmeter/results/results"
resp, err := resty.R().
Get(url)
if err != nil {
- panic(err.Error())
+ fmt.Printf("Cannot connect to controller: %v\n", err)
+ os.Exit(1)
}
fmt.Printf("\nResponse Body: %v\n", resp)
case "log":
@@ -47,10 +64,12 @@ func getResult() {
resp, err := resty.R().
Get(url)
if err != nil {
- panic(err.Error())
+ fmt.Printf("Cannot connect to controller: %v\n", err)
+ os.Exit(1)
}
fmt.Printf("\nResponse Body: %v\n", resp)
default:
- fmt.Println("Unrecoginized jmeter result type - use 'log' or 'results'")
+ msg := "Unrecoginized jmeter result type"
+ fmt.Printf("%s - use 'log' or 'detail'", msg)
}
}
diff --git a/clover/cloverctl/src/cloverctl/cmd/get_visibility.go b/clover/cloverctl/src/cloverctl/cmd/get_visibility.go
index 820b25a..a701164 100644
--- a/clover/cloverctl/src/cloverctl/cmd/get_visibility.go
+++ b/clover/cloverctl/src/cloverctl/cmd/get_visibility.go
@@ -9,6 +9,7 @@ package cmd
import (
"fmt"
+ "os"
"gopkg.in/resty.v1"
"github.com/spf13/cobra"
)
@@ -27,12 +28,15 @@ var visibilitygetCmd = &cobra.Command{
func init() {
getCmd.AddCommand(visibilitygetCmd)
- visibilitygetCmd.PersistentFlags().StringVarP(&VisibilityStat, "stat", "s", "", "Visibility stats type to get")
- visibilitygetCmd.PersistentFlags().StringVarP(&VisibilityConfig, "conf", "c", "", "Visibility config type to get")
+ visibilitygetCmd.PersistentFlags().StringVarP(&VisibilityStat, "stat", "s",
+ "", "Visibility stats type to get")
+ visibilitygetCmd.PersistentFlags().StringVarP(&VisibilityConfig, "conf",
+ "c", "", "Visibility config type to get")
}
func getVisibility() {
+ checkControllerIP()
url_prefix := "/visibility/get/"
get_data := "all"
response_prefix := "Config"
@@ -50,7 +54,8 @@ func getVisibility() {
SetHeader("Accept", "application/json").
Get(url)
if err != nil {
- panic(err.Error())
+ fmt.Printf("Cannot connect to controller: %v\n", err)
+ os.Exit(1)
}
fmt.Printf("\n%s %s: %v\n", response_prefix, get_data, resp)
}
diff --git a/clover/cloverctl/src/cloverctl/cmd/init.go b/clover/cloverctl/src/cloverctl/cmd/init.go
index 613b263..102c5ba 100644
--- a/clover/cloverctl/src/cloverctl/cmd/init.go
+++ b/clover/cloverctl/src/cloverctl/cmd/init.go
@@ -17,7 +17,7 @@ var initCmd = &cobra.Command{
Short: "Initialize visibility schemas",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
- fmt.Println("init called")
+ fmt.Println("Incomplete command")
},
}
diff --git a/clover/cloverctl/src/cloverctl/cmd/init_visibility.go b/clover/cloverctl/src/cloverctl/cmd/init_visibility.go
index ac9ec5c..004c300 100644
--- a/clover/cloverctl/src/cloverctl/cmd/init_visibility.go
+++ b/clover/cloverctl/src/cloverctl/cmd/init_visibility.go
@@ -9,6 +9,7 @@ package cmd
import (
"fmt"
+ "os"
"gopkg.in/resty.v1"
"github.com/spf13/cobra"
)
@@ -16,7 +17,7 @@ import (
var visibilityinitCmd = &cobra.Command{
Use: "visibility",
- Short: "Init visibility data schemas",
+ Short: "Initialize visibility data schemas in cassandra",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
initCollector()
@@ -28,14 +29,15 @@ func init() {
}
func initCollector() {
+
+ checkControllerIP()
url := controllerIP + "/collector/init"
resp, err := resty.R().
Get(url)
if err != nil {
- panic(err.Error())
+ fmt.Printf("Cannot connect to controller: %v\n", err)
+ os.Exit(1)
}
fmt.Printf("\n%v\n", resp)
}
-
-
diff --git a/clover/cloverctl/src/cloverctl/cmd/provider.go b/clover/cloverctl/src/cloverctl/cmd/provider.go
index fc8e888..e6f1cc8 100644
--- a/clover/cloverctl/src/cloverctl/cmd/provider.go
+++ b/clover/cloverctl/src/cloverctl/cmd/provider.go
@@ -17,7 +17,7 @@ var providercreateCmd = &cobra.Command{
Short: "Add spinnaker provider",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
- fmt.Println("provider called")
+ fmt.Println("Incomplete command")
},
}
@@ -26,7 +26,7 @@ var providerdelCmd = &cobra.Command{
Short: "Delete spinnaker provider",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
- fmt.Println("provider called")
+ fmt.Println("Incomplete command")
},
}
@@ -35,7 +35,7 @@ var providergetCmd = &cobra.Command{
Short: "Get spinnaker provider",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
- fmt.Println("provider called")
+ fmt.Println("Incomplete command")
},
}
func init() {
diff --git a/clover/cloverctl/src/cloverctl/cmd/root.go b/clover/cloverctl/src/cloverctl/cmd/root.go
index 6878077..d1d9405 100644
--- a/clover/cloverctl/src/cloverctl/cmd/root.go
+++ b/clover/cloverctl/src/cloverctl/cmd/root.go
@@ -10,6 +10,7 @@ package cmd
import (
"fmt"
"os"
+ "strings"
homedir "github.com/mitchellh/go-homedir"
"github.com/spf13/cobra"
@@ -18,7 +19,6 @@ import (
)
var cfgFile string
-
var controllerIP string
var cloverFile string
@@ -33,8 +33,9 @@ var rootCmd = &cobra.Command{
//},
}
-// Execute adds all child commands to the root command and sets flags appropriately.
-// This is called by main.main(). It only needs to happen once to the rootCmd.
+// Execute adds all child commands to the root command and sets flags
+// appropriately. This is called by main.main(). It only needs to happen
+// once to the rootCmd.
func Execute() {
if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
@@ -48,19 +49,12 @@ func init() {
// Here you will define your flags and configuration settings.
// Cobra supports persistent flags, which, if defined here,
// will be global for your application.
- rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.cloverctl.yaml)")
+ rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "",
+ "config file (default is $HOME/.cloverctl.yaml)")
// Cobra also supports local flags, which will only run
// when this action is called directly.
rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
-
- cPort, cIP := cloverkube.GetServicesPortIP("clover-controller")
- if cIP == "" {
- controllerIP = "http://10.244.0.1:" + fmt.Sprint(cPort)
- } else {
- controllerIP = "http://" + cIP
- }
- fmt.Printf("\nclover-controller: %s %s\n", fmt.Sprint(cPort), cIP)
}
// initConfig reads in config file and ENV variables if set.
@@ -76,15 +70,51 @@ func initConfig() {
os.Exit(1)
}
- // Search config in home directory with name ".cloverctl" (without extension).
+ // Search config in home directory with name ".cloverctl"
viper.AddConfigPath(home)
viper.SetConfigName(".cloverctl")
}
viper.AutomaticEnv() // read in environment variables that match
- // If a config file is found, read it in.
+ cip_file := ""
+ // If a config file is found in home, read it in.
if err := viper.ReadInConfig(); err == nil {
fmt.Println("Using config file:", viper.ConfigFileUsed())
+ cip_file = viper.GetString("ControllerIP")
+ } else {
+ // Check for file in path from cloverctl
+ ep, err := os.Executable()
+ if err == nil {
+ exe_path := strings.Replace(ep, "cloverctl", "", -1)
+ viper.AddConfigPath(exe_path)
+ if err := viper.ReadInConfig(); err == nil {
+ fmt.Println("Using config file:", viper.ConfigFileUsed())
+ cip_file = viper.GetString("ControllerIP")
+ }
+ }
+ }
+
+ cPort, cip_kube := cloverkube.GetServicesPortIP("clover-controller")
+ // If IP in file
+ if cip_file != "" {
+ // Nodeport
+ controllerIP = "http://" + cip_file + ":" + fmt.Sprint(cPort)
+ }
+ // Override IP, if LB IP found
+ if cip_kube != "" {
+ fmt.Printf("IP %v", cip_kube)
+ controllerIP = "http://" + cip_kube
+ }
+}
+
+func checkControllerIP() {
+ // controllerIP exists
+ service := "clover-controller"
+ if controllerIP == "" {
+ fmt.Printf("%s address unspecified or cannot be found\n", service)
+ os.Exit(1)
+ } else {
+ fmt.Printf("%s address: %s\n", service, controllerIP)
}
}
diff --git a/clover/cloverctl/src/cloverctl/cmd/set_nginx.go b/clover/cloverctl/src/cloverctl/cmd/set_nginx.go
index e7e65c2..6b571bb 100644
--- a/clover/cloverctl/src/cloverctl/cmd/set_nginx.go
+++ b/clover/cloverctl/src/cloverctl/cmd/set_nginx.go
@@ -9,6 +9,7 @@ package cmd
import (
"fmt"
+ "os"
"io/ioutil"
"gopkg.in/resty.v1"
"github.com/spf13/cobra"
@@ -36,17 +37,19 @@ var setlbCmd = &cobra.Command{
func init() {
setCmd.AddCommand(setserverCmd)
- setserverCmd.Flags().StringVarP(&cloverFile, "file", "f", "", "Input yaml file for server config")
+ setserverCmd.Flags().StringVarP(&cloverFile, "file", "f", "",
+ "Input yaml file for server config")
setserverCmd.MarkFlagRequired("file")
setCmd.AddCommand(setlbCmd)
- setlbCmd.Flags().StringVarP(&cloverFile, "file", "f", "", "Input yaml file for lb config")
+ setlbCmd.Flags().StringVarP(&cloverFile, "file", "f", "",
+ "Input yaml file for lb config")
setlbCmd.MarkFlagRequired("file")
-
}
func setNginx(nginx_service string) {
+ checkControllerIP()
url := ""
if nginx_service == "server" {
url = controllerIP + "/nginx/server"
@@ -57,20 +60,20 @@ func setNginx(nginx_service string) {
in, err := ioutil.ReadFile(cloverFile)
if err != nil {
fmt.Println("Please specify a valid yaml file")
- return
+ os.Exit(1)
}
out_json, err := yaml.YAMLToJSON(in)
if err != nil {
- panic(err.Error())
+ fmt.Printf("Invalid yaml: %v\n", err)
+ os.Exit(1)
}
resp, err := resty.R().
SetHeader("Content-Type", "application/json").
SetBody(out_json).
Post(url)
if err != nil {
- panic(err.Error())
+ fmt.Printf("Cannot connect to controller: %v\n", err)
+ os.Exit(1)
}
fmt.Printf("\n%v\n", resp)
-
-
}
diff --git a/clover/cloverctl/src/cloverctl/cmd/set_visibility.go b/clover/cloverctl/src/cloverctl/cmd/set_visibility.go
index 685b250..ec28122 100644
--- a/clover/cloverctl/src/cloverctl/cmd/set_visibility.go
+++ b/clover/cloverctl/src/cloverctl/cmd/set_visibility.go
@@ -9,6 +9,7 @@ package cmd
import (
"fmt"
+ "os"
"io/ioutil"
"gopkg.in/resty.v1"
"github.com/spf13/cobra"
@@ -27,31 +28,32 @@ var setvisibilitystatsCmd = &cobra.Command{
func init() {
setCmd.AddCommand(setvisibilitystatsCmd)
- setvisibilitystatsCmd.Flags().StringVarP(&cloverFile, "file", "f", "", "Input yaml file to set visibility config")
+ setvisibilitystatsCmd.Flags().StringVarP(&cloverFile, "file", "f", "",
+ "Input yaml file to set visibility config")
setvisibilitystatsCmd.MarkFlagRequired("file")
-
}
func setCollector() {
+ checkControllerIP()
url := controllerIP + "/visibility/set"
in, err := ioutil.ReadFile(cloverFile)
if err != nil {
fmt.Println("Please specify a valid yaml file")
- return
+ os.Exit(1)
}
out_json, err := yaml.YAMLToJSON(in)
if err != nil {
- panic(err.Error())
+ fmt.Printf("Invalid yaml: %v\n", err)
+ os.Exit(1)
}
resp, err := resty.R().
SetHeader("Content-Type", "application/json").
SetBody(out_json).
Post(url)
if err != nil {
- panic(err.Error())
+ fmt.Printf("Cannot connect to controller: %v\n", err)
+ os.Exit(1)
}
fmt.Printf("\n%v\n", resp)
-
-
}
diff --git a/clover/cloverctl/src/cloverctl/cmd/start.go b/clover/cloverctl/src/cloverctl/cmd/start.go
index 741eacd..d2eb864 100644
--- a/clover/cloverctl/src/cloverctl/cmd/start.go
+++ b/clover/cloverctl/src/cloverctl/cmd/start.go
@@ -14,10 +14,10 @@ import (
var startCmd = &cobra.Command{
Use: "start",
- Short: "Start processes including tests, visibility and ingress services",
+ Short: "Start processes and tests",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
- fmt.Println("start called")
+ fmt.Println("Incomplete command")
},
}
diff --git a/clover/cloverctl/src/cloverctl/cmd/start_ids.go b/clover/cloverctl/src/cloverctl/cmd/start_ids.go
index 0f495a7..be039fa 100644
--- a/clover/cloverctl/src/cloverctl/cmd/start_ids.go
+++ b/clover/cloverctl/src/cloverctl/cmd/start_ids.go
@@ -9,6 +9,7 @@ package cmd
import (
"fmt"
+ "os"
"gopkg.in/resty.v1"
"github.com/spf13/cobra"
)
@@ -16,8 +17,8 @@ import (
var startidsCmd = &cobra.Command{
Use: "ids",
- Short: "Start IDS process",
- Long: `Restart IDS process when adding custom rules`,
+ Short: "Start snort IDS process",
+ Long: `Restart snort IDS process when adding custom rules`,
Run: func(cmd *cobra.Command, args []string) {
startIDS()
},
@@ -29,14 +30,14 @@ func init() {
func startIDS() {
+ checkControllerIP()
url := controllerIP + "/snort/start"
resp, err := resty.R().
Get(url)
if err != nil {
- panic(err.Error())
+ fmt.Printf("Cannot connect to controller: %v\n", err)
+ os.Exit(1)
}
fmt.Printf("\n%v\n", resp)
}
-
-
diff --git a/clover/cloverctl/src/cloverctl/cmd/start_testplan.go b/clover/cloverctl/src/cloverctl/cmd/start_testplan.go
index b516ad6..9e664c0 100644
--- a/clover/cloverctl/src/cloverctl/cmd/start_testplan.go
+++ b/clover/cloverctl/src/cloverctl/cmd/start_testplan.go
@@ -9,6 +9,7 @@ package cmd
import (
"fmt"
+ "os"
"strings"
"gopkg.in/resty.v1"
"github.com/spf13/cobra"
@@ -18,20 +19,21 @@ import (
var testplanstartCmd = &cobra.Command{
Use: "testplan",
- Short: "Start a test for a given test plan",
+ Short: "Start test for configured test plan",
Long: `Specify number of slaves to use with '-s' flag. Default is 0 slaves,
-which runs tests only from jmeter-master.`,
+which runs tests from jmeter-master only.`,
Run: func(cmd *cobra.Command, args []string) {
startTest()
- //fmt.Printf("%v\n", cmd.Parent().CommandPath())
},
}
var num_slaves int
func init() {
startCmd.AddCommand(testplanstartCmd)
- testplanstartCmd.PersistentFlags().StringVarP(&cloverFile, "file", "f", "", "Currently unused")
- testplanstartCmd.PersistentFlags().IntVarP(&num_slaves, "slaves", "s", 0, "Number of slaves to use")
+ testplanstartCmd.PersistentFlags().StringVarP(&cloverFile, "file", "f", "",
+ "Currently unused")
+ testplanstartCmd.PersistentFlags().IntVarP(&num_slaves, "slaves", "s", 0,
+ "Number of slaves to use")
}
func startTest() {
@@ -39,21 +41,24 @@ func startTest() {
ips := cloverkube.GetPodsIP("clover-jmeter-slave", "default")
fmt.Printf("\njmeter-slaves found: %s\n", ips)
if num_slaves > len(ips) {
- fmt.Printf("Number of slaves specified must be less than found: %d\n", len(ips))
+ fmt.Printf("Number of slaves specified must be less than found: %d\n",
+ len(ips))
return
}
ip_list := strings.Join(ips[0:num_slaves], ",")
+ checkControllerIP()
url := controllerIP + "/jmeter/start"
resp, err := resty.R().
SetHeader("Content-Type", "application/json").
- SetBody(fmt.Sprintf(`{"num_slaves":"%d", "slave_list":"%s"}`, num_slaves, ip_list)).
+ SetBody(fmt.Sprintf(`{"num_slaves":"%d", "slave_list":"%s"}`, num_slaves,
+ ip_list)).
Post(url)
if err != nil {
- panic(err.Error())
+ fmt.Printf("Cannot connect to controller: %v\n", err)
+ os.Exit(1)
}
fmt.Printf("\n%v\n", resp)
-
}
diff --git a/clover/cloverctl/src/cloverctl/cmd/start_visibility.go b/clover/cloverctl/src/cloverctl/cmd/start_visibility.go
index 18f8aac..bbc25d8 100644
--- a/clover/cloverctl/src/cloverctl/cmd/start_visibility.go
+++ b/clover/cloverctl/src/cloverctl/cmd/start_visibility.go
@@ -9,6 +9,7 @@ package cmd
import (
"fmt"
+ "os"
"io/ioutil"
"gopkg.in/resty.v1"
"github.com/ghodss/yaml"
@@ -18,7 +19,7 @@ import (
var visibilitystartCmd = &cobra.Command{
Use: "visibility",
- Short: "Start visibility data collection",
+ Short: "Start visibility collector process",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
startCollector()
@@ -36,23 +37,27 @@ func startCollector() {
if cloverFile != "" {
in, err := ioutil.ReadFile(cloverFile)
if err != nil {
- panic(err.Error())
+ fmt.Printf("Cannot read file: %v\n", err)
+ os.Exit(1)
}
out_json, err := yaml.YAMLToJSON(in)
message_body = string(out_json)
if err != nil {
- panic(err.Error())
+ fmt.Printf("Invalid yaml: %v\n", err)
+ os.Exit(1)
}
} else {
message_body = `{"sample_interval":"10", "t_port":"80", "t_host":"jaeger-query.istio-system"}`
}
+ checkControllerIP()
url := controllerIP + "/collector/start"
resp, err := resty.R().
SetHeader("Content-Type", "application/json").
SetBody(message_body).
Post(url)
if err != nil {
- panic(err.Error())
+ fmt.Printf("Cannot connect to controller: %v\n", err)
+ os.Exit(1)
}
fmt.Printf("\n%v\n", resp)
}
diff --git a/clover/cloverctl/src/cloverctl/cmd/stop.go b/clover/cloverctl/src/cloverctl/cmd/stop.go
index cfb7245..e77a36b 100644
--- a/clover/cloverctl/src/cloverctl/cmd/stop.go
+++ b/clover/cloverctl/src/cloverctl/cmd/stop.go
@@ -14,10 +14,10 @@ import (
var stopCmd = &cobra.Command{
Use: "stop",
- Short: "Stop processes including visibility and ingress services",
+ Short: "Stop processes including visibility and sample services",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
- fmt.Println("stop called")
+ fmt.Println("Incomplete command")
},
}
diff --git a/clover/cloverctl/src/cloverctl/cmd/stop_ids.go b/clover/cloverctl/src/cloverctl/cmd/stop_ids.go
index b39b1e9..c810d9d 100644
--- a/clover/cloverctl/src/cloverctl/cmd/stop_ids.go
+++ b/clover/cloverctl/src/cloverctl/cmd/stop_ids.go
@@ -9,6 +9,7 @@ package cmd
import (
"fmt"
+ "os"
"gopkg.in/resty.v1"
"github.com/spf13/cobra"
)
@@ -16,8 +17,8 @@ import (
var stopidsCmd = &cobra.Command{
Use: "ids",
- Short: "Stop IDS process",
- Long: `Restart IDS process when adding custom rules`,
+ Short: "Stop snort IDS process",
+ Long: `Restart snort IDS process when adding custom rules`,
Run: func(cmd *cobra.Command, args []string) {
stopIDS()
},
@@ -29,12 +30,14 @@ func init() {
func stopIDS() {
+ checkControllerIP()
url := controllerIP + "/snort/stop"
resp, err := resty.R().
Get(url)
if err != nil {
- panic(err.Error())
+ fmt.Printf("Cannot connect to controller: %v\n", err)
+ os.Exit(1)
}
fmt.Printf("\n%v\n", resp)
}
diff --git a/clover/cloverctl/src/cloverctl/cmd/stop_visibility.go b/clover/cloverctl/src/cloverctl/cmd/stop_visibility.go
index 4233157..fda226e 100644
--- a/clover/cloverctl/src/cloverctl/cmd/stop_visibility.go
+++ b/clover/cloverctl/src/cloverctl/cmd/stop_visibility.go
@@ -9,6 +9,7 @@ package cmd
import (
"fmt"
+ "os"
"gopkg.in/resty.v1"
"github.com/spf13/cobra"
)
@@ -16,7 +17,7 @@ import (
var visibilitystopCmd = &cobra.Command{
Use: "visibility",
- Short: "Stop visibility data collection",
+ Short: "Stop visibility collector process",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
stopCollector()
@@ -29,12 +30,14 @@ func init() {
func stopCollector() {
+ checkControllerIP()
url := controllerIP + "/collector/stop"
resp, err := resty.R().
Get(url)
if err != nil {
- panic(err.Error())
+ fmt.Printf("Cannot connect to controller: %v\n", err)
+ os.Exit(1)
}
fmt.Printf("\n%v\n", resp)
}
diff --git a/clover/clovisor/Dockerfile b/clover/clovisor/Dockerfile
index 4df4ee5..63375a1 100644
--- a/clover/clovisor/Dockerfile
+++ b/clover/clovisor/Dockerfile
@@ -1,6 +1,6 @@
FROM ubuntu:18.04
-ARG TARGET_KERNEL_VER
+ARG TARGET_KERNEL_VER="4.15.0-36-generic"
RUN set -ex; \
echo "deb [trusted=yes] http://repo.iovisor.org/apt/bionic bionic main" > /etc/apt/sources.list.d/iovisor.list; \
@@ -12,6 +12,7 @@ RUN set -ex; \
libelf1;
COPY . .
+COPY bin/clovisor .
RUN chmod +x clovisor
CMD ["./clovisor"]
diff --git a/clover/spark/docker/clover-spark/build.sh b/clover/spark/docker/clover-spark/build.sh
index a1a8788..d139b35 100755
--- a/clover/spark/docker/clover-spark/build.sh
+++ b/clover/spark/docker/clover-spark/build.sh
@@ -7,7 +7,7 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
-IMAGE_PATH=${IMAGE_PATH:-"kube1-node1:5000"}
+IMAGE_PATH=${IMAGE_PATH:-"localhost:5000"}
IMAGE_NAME=${IMAGE_NAME:-"clover-spark:latest"}
# Copy clover-spark jar first
diff --git a/clover/spark/docker/spark-submit/runner.sh b/clover/spark/docker/spark-submit/runner.sh
index b98ff32..5de3824 100755
--- a/clover/spark/docker/spark-submit/runner.sh
+++ b/clover/spark/docker/spark-submit/runner.sh
@@ -12,7 +12,7 @@
./runner_fast.sh &
IMAGE_NAME=${IMAGE_NAME:-"clover-spark:latest"}
-IMAGE_PATH=${IMAGE_PATH:-"localhost:5000"}
+IMAGE_PATH=${IMAGE_PATH:-"opnfv"}
CLASS_NAME=${CLASS_NAME:-"CloverSlow"}
JAR_NAME=${JAR_NAME:-"clover-spark_2.11-1.0.jar"}
diff --git a/clover/spark/docker/spark-submit/runner_fast.sh b/clover/spark/docker/spark-submit/runner_fast.sh
index 2381351..0a387b2 100755
--- a/clover/spark/docker/spark-submit/runner_fast.sh
+++ b/clover/spark/docker/spark-submit/runner_fast.sh
@@ -9,7 +9,7 @@
#
IMAGE_NAME=${IMAGE_NAME:-"clover-spark:latest"}
-IMAGE_PATH=${IMAGE_PATH:-"localhost:5000"}
+IMAGE_PATH=${IMAGE_PATH:-"opnfv"}
CLASS_NAME=${CLASS_NAME:-"CloverFast"}
JAR_NAME=${JAR_NAME:-"clover-spark_2.11-1.0.jar"}
diff --git a/clover/spark/src/main/scala/CloverSlow.scala b/clover/spark/src/main/scala/CloverSlow.scala
index 1866d72..c389967 100644
--- a/clover/spark/src/main/scala/CloverSlow.scala
+++ b/clover/spark/src/main/scala/CloverSlow.scala
@@ -42,38 +42,38 @@ object CloverSlow {
.config("spark.cassandra.connection.port", "9042")
.getOrCreate()
- val services = redis.smembers("visibility_services")
-
spark
.read.cassandraFormat("spans", "visibility")
.load()
.createOrReplaceTempView("curspans")
- if (distinct_url_service) {
- // Get number of distinct URLs per service (node_id)
- for (s <- services.get) {
- val service = s.get
- val perurl = spark.sql(
- s"""
- |SELECT node_id,count(distinct http_url)
- |as urls,collect_set(http_url) as values
- |FROM curspans
- |WHERE node_id LIKE '%$service%'
- |GROUP BY node_id
- """.stripMargin)
- for ((row) <- perurl.collect) {
- println(row)
- val node_id = row.get(0)
- val url_count = row.get(1)
- val url_distinct = row.getList(2).toString
- redis.hmset(service, Map("node_id" -> node_id,
- "url_count" -> url_count,
- "url_distinct" -> url_distinct))
+ for( x <- 1 to 500 ) {
+
+ val services = redis.smembers("visibility_services")
+
+ if (distinct_url_service) {
+ // Get number of distinct URLs per service (node_id)
+ for (s <- services.get) {
+ val service = s.get
+ val perurl = spark.sql(
+ s"""
+ |SELECT node_id,count(distinct http_url)
+ |as urls,collect_set(http_url) as values
+ |FROM curspans
+ |WHERE node_id LIKE '%$service%'
+ |GROUP BY node_id
+ """.stripMargin)
+ for ((row) <- perurl.collect) {
+ println(row)
+ val node_id = row.get(0)
+ val url_count = row.get(1)
+ val url_distinct = row.getList(2).toString
+ redis.hmset(service, Map("node_id" -> node_id,
+ "url_count" -> url_count,
+ "url_distinct" -> url_distinct))
+ }
}
}
- }
-
- for( x <- 1 to 500 ) {
if (response_times) {
try {
diff --git a/docs/release/configguide/index.rst b/docs/release/configguide/index.rst
index 547f10f..ec7b16a 100644
--- a/docs/release/configguide/index.rst
+++ b/docs/release/configguide/index.rst
@@ -3,11 +3,11 @@
.. http://creativecommons.org/licenses/by/4.0
.. (c) OPNFV, Authors of Clover
-.. _clover_config_guides:
+.. _clover_configguide:
-=================================
-OPNFV Clover Configuration Guides
-=================================
+==========================
+Clover Configuration Guide
+==========================
.. toctree::
:maxdepth: 2
diff --git a/docs/release/configguide/jmeter_config_guide.rst b/docs/release/configguide/jmeter_config_guide.rst
new file mode 100644
index 0000000..de1d2f5
--- /dev/null
+++ b/docs/release/configguide/jmeter_config_guide.rst
@@ -0,0 +1,298 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. http://creativecommons.org/licenses/by/4.0
+.. SPDX-License-Identifier CC-BY-4.0
+.. (c) Authors of Clover
+
+.. _jmeter_config_guide:
+
+=======================================
+JMeter Validation Configuration Guide
+=======================================
+
+This document provides a guide to use the JMeter validation service, which is introduced in
+the Clover Gambia release.
+
+Overview
+=========
+
+Apache JMeter is a mature, open source application that supports web client emulation. Its
+functionality has been integrated into the Clover project to allow various CI validations
+and performance tests to be performed. The system under test can either be REST services/APIs
+directly or a set of L7 network services. In the latter scenario, Clover nginx servers may
+be employed as an endpoint to allow traffic to be sent end-to-end across a service chain.
+
+The Clover JMeter integration is packaged as docker containers with manifests to deploy
+in a Kubernetes (k8s) cluster. The Clover CLI (**cloverctl**) can be used to configure and
+control the JMeter service within the k8s cluster via **clover-controller**.
+
+The Clover JMeter integration has the following attributes:
+
+ * **Master/Slave Architecture:** uses the native master/slave implementation of JMeter. The master
+ and slaves have distinct OPNFV docker containers for rapid deployment and usage. Slaves allow
+ the scale of the emulation to be increased linearly for performance testing. However, for
+ functional validations and modest scale, the master may be employed without any slaves.
+
+ * **Test Creation & Control:** JMeter makes use of a rich XML-based test plan. While this offers
+ a plethora of configurable options, it can be daunting for a beginner user to edit directly.
+ Clover provides an abstracted yaml syntax exposing a subset of the available configuration
+ parameters. JMeter test plans are generated on the master and tests can be started from
+ **cloverctl** CLI.
+
+ * **Result Collection:** summary log results and detailed per-request results can be retrieved
+ from the JMeter master during and after tests from the **cloverctl** or from a REST API exposed
+ via **clover-controller**.
+
+.. image:: imgs/jmeter_overview.png
+ :align: center
+ :scale: 100%
+
+Deploying Clover JMeter service
+===============================
+
+Prerequisites
+-------------
+
+The following assumptions must be met before continuing on to deployment:
+
+ * Installation of Docker has already been performed. It's preferable to install Docker CE.
+ * Installation of k8s in a single-node or multi-node cluster.
+ * Clover CLI (**cloverctl**) has been downloaded and setup. Instructions to deploy can be found
+ at :ref:`controller_services_controller`
+ * The **clover-controller** service is deployed in the k8s cluster the validation services will
+ be deployed in. Instructions to deploy can be found at :ref:`controller_services_controller`.
+
+Deploy with Clover CLI
+-----------------------
+
+The easiest way to deploy Clover JMeter validation services into your k8s cluster is to use the
+**cloverctl** CLI using the following command:
+
+.. code-block:: bash
+
+ $ cloverctl create system validation
+
+Container images with the Gambia release tag will pulled if the tag is unspecified. The release
+tag is **opnfv-7.0.0** for the Gambia release. To deploy the latest containers from master, use
+the command shown below::
+
+ $ cloverctl create system validation -t latest
+
+The Clover CLI will add master/slave pods to the k8s cluster in the default namespace.
+
+The JMeter master/slave docker images will automatically be pulled from the OPNFV public
+Dockerhub registry. Deployments and respective services will be created with three slave
+replica pods added with the **clover-jmeter-slave** prefix. A single master pod will be
+created with the **clover-jmeter-master** prefix.
+
+Deploy from source
+------------------
+
+To continue to deploy from the source code, clone the Clover git repository and navigate
+within to the directory, as shown below:
+
+.. code-block:: bash
+
+ $ git clone https://gerrit.opnfv.org/gerrit/clover
+ $ cd clover/clover/tools/jmeter/yaml
+ $ git checkout stable/gambia
+
+To deploy the master use the following two commands, which will create a manifest with
+the Gambia release tags and creates the deployment in the k8s cluster::
+
+ $ python render_master.py --image_tag=opnfv-7.0.0 --image_path=opnfv
+ $ kubectl create -f clover-jmeter-master.yaml
+
+JMeter can be injected into an Istio service mesh. To deploy in the default
+namespace within the service mesh, use the following command for manual
+sidecar injection::
+
+ $ istioctl kube-inject -f clover-jmeter-master.yaml | kubectl apply -f -
+
+**Note, when injecting JMeter into the service mesh, only the master will function for
+the Clover integration, as master-slave communication is known not to function with the Java
+RMI API. Ensure 'istioctl' is in your path for the above command.**
+
+To deploy slave replicas, render the manifest yaml and create in k8s adjusting the
+``--replica_count`` value for the number of slave pods desired::
+
+ $ python render_slave.py --image_tag=opnfv-7.0.0 --image_path=opnfv --replica_count=3
+ $ kubectl create -f clover-jmeter-slave.yaml
+
+Verifying the deployment
+------------------------
+
+To verify the validation services are deployed, ensure the following pods are present
+with the command below:
+
+.. code-block:: bash
+
+ $ kubectl get pod --all-namespaces
+
+The listing below must include the following pods assuming deployment in the default
+namespace:
+
+.. code-block:: bash
+
+ NAMESPACE NAME READY STATUS
+ default clover-jmeter-master-688677c96f-8nnnr 1/1 Running
+ default clover-jmeter-slave-7f9695d56-8xh67 1/1 Running
+ default clover-jmeter-slave-7f9695d56-fmpz5 1/1 Running
+ default clover-jmeter-slave-7f9695d56-kg76s 1/1 Running
+ default clover-jmeter-slave-7f9695d56-qfgqj 1/1 Running
+
+Using JMeter Validation
+=======================
+
+Creating a test plan
+--------------------
+
+To employ a test plan that can be used against the :ref:`sdc_config_guide` sample, navigate to
+ cloverctl yaml directory and use the sample named 'jmeter_testplan.yaml', which is shown below.
+
+.. code-block:: bash
+
+ load_spec:
+ num_threads: 5
+ loops: 2
+ ramp_time: 60
+ duration: 80
+ url_list:
+ - name: url1
+ url: http://proxy-access-control.default:9180
+ method: GET
+ user-agent: chrome
+ - name: url2
+ url: http://proxy-access-control.default:9180
+ method: GET
+ user-agent: safari
+
+The composition of the yaml file breaks down as follows:
+ * ``load_spec`` section of the yaml defines the load profile of the test.
+ * `num_threads`` parameter defines the maximum number of clients/users the test will emulate.
+ * ``ramp_time`` determines the rate at which threads/users will be setup.
+ * ``loop`` parameter reruns the same test and can be set to 0 to loop forever.
+ * ``duration`` parameter is used to limit the test run time and be used as a hard cutoff when
+ using loop forever.
+ * ``url_list`` section of the yaml defines a set of HTTP requests that each user will perform.
+ It includes the request URL that is given a name (used as reference in detailed per-request
+ results) and the HTTP method to use (ex. GET, POST). The ``user-agent`` parameter allows this
+ HTTP header to be specified per request and can be used to emulate browsers and devices.
+
+The ``url`` syntax is <domain or IP>:<port #>. The colon port number may be omitted if port 80
+is intended.
+
+The test plan yaml is an abstraction of the JMeter XML syntax (uses .jmx extension) and can be
+pushed to the master using the **cloverctl** CLI with the following command:
+
+.. code-block:: bash
+
+ $ cloverctl create testplan –f jmeter_testplan.yaml
+
+The test plan can now be executed and will automatically be distributed to available JMeter slaves.
+
+Starting the test
+-----------------
+
+Once a test plan has been created on the JMeter master, a test can be started for the test plan
+with the following command:
+
+.. code-block:: bash
+
+ $ cloverctl start testplan
+
+The test will be executed from the **clover-jmeter-master** pod, whereby HTTP requests will
+originate directly from the master. The number of aggregate threads/users and request rates
+can be scaled by increasing the thread count or decreasing the ramp time respectively in the
+test plan yaml. However, the scale of the test can also be controlled by adding slaves to the
+test. When slaves are employed, the master will only be used to control slaves and will not be
+a source of traffic. Each slave pod will execute the test plan in its entirety.
+
+To execute tests using slaves, add the flag '-s' to the start command from the Clover CLI as shown
+below:
+
+.. code-block:: bash
+
+ $ cloverctl start testplan –s <slave count>
+
+The **clover-jmeter-slave** pods must be deployed in advance before executing the above command. If
+the steps outlined in section `Deploy with Clover CLI`_ have been followed, three slaves will
+have already been deployed.
+
+Retrieving Results
+------------------
+
+Results for the test can be obtained by executing the following command:
+
+.. code-block:: bash
+
+ $ cloverctl get testresult
+ $ cloverctl get testresult log
+
+The bottom of the log will display a summary of the test results, as shown below::
+
+ 3 in 00:00:00 = 111.1/s Avg: 7 Min: 6 Max: 8 Err: 0 (0.00%)
+ 20 in 00:00:48 = 0.4/s Avg: 10 Min: 6 Max: 31 Err: 0 (0.00%)
+
+Each row of the summary table is a snapshot in time with the final numbers in the last row.
+In this example, 20 requests (5 users/threads x 2 URLs) x loops) were sent successfully
+with no HTTP responses with invalid/error (4xx/5xx) status codes. Longer tests will produce
+a larger number of snapshot rows. Minimum, maximum and average response times are output per
+snapshot.
+
+To obtain detailed, per-request results use the ``detail`` option, as shown below::
+
+ $ cloverctl get testresult detail
+
+ 1541567388622,14,url1,200,OK,ThreadGroup 1-4,text,true,,843,0,1,1,14,0,0
+ 1541567388637,8,url2,200,OK,ThreadGroup 1-4,text,true,,843,0,1,1,8,0,0
+ 1541567388646,6,url1,200,OK,ThreadGroup 1-4,text,true,,843,0,1,1,6,0,0
+ 1541567388653,7,url2,200,OK,ThreadGroup 1-4,text,true,,843,0,1,1,7,0,0
+ 1541567400622,12,url1,200,OK,ThreadGroup 1-5,text,true,,843,0,1,1,12,0,0
+ 1541567400637,8,url2,200,OK,ThreadGroup 1-5,text,true,,843,0,1,1,8,0,0
+ 1541567400645,7,url1,200,OK,ThreadGroup 1-5,text,true,,843,0,1,1,7,0,0
+ 1541567400653,6,url2,200,OK,ThreadGroup 1-5,text,true,,843,0,1,1,6,0,0
+
+Columns are broken down on the following fields:
+ * timeStamp, elapsed, label, responseCode, responseMessage, threadName, dataType, success
+ * failureMessage bytes, sentBytes, grpThreads, allThreads, Latency, IdleTime, Connect
+
+``elapsed`` or ``Latency`` values are in milliseconds.
+
+Uninstall from Kubernetes environment
+=====================================
+
+Delete with Clover CLI
+-----------------------
+
+When you're finished working with JMeter validation services, you can uninstall it with the
+following command:
+
+.. code-block:: bash
+
+ $ cloverctl delete system validation
+
+The command above will remove the clover-jmeter-master and clover-jmeter-slave deployment
+and service resources from the current k8s context.
+
+Delete from source
+------------------
+
+The JMeter validation services can be uninstalled from the source code using the commands below:
+
+.. code-block:: bash
+
+ $ cd clover/samples/scenarios
+ $ kubectl delete -f clover-jmeter-master.yaml
+ $ kubectl delete -f clover-jmeter-slave.yaml
+
+Uninstall from Docker environment
+=================================
+
+The OPNFV docker images can be removed with the following commands from nodes
+in the k8s cluster.
+
+.. code-block:: bash
+
+ $ docker rmi opnfv/clover-jmeter-master
+ $ docker rmi opnfv/clover-jmeter-slave
+ $ docker rmi opnfv/clover-controller
diff --git a/docs/release/userguide/index.rst b/docs/release/userguide/index.rst
index 5be100f..d09a9d7 100644
--- a/docs/release/userguide/index.rst
+++ b/docs/release/userguide/index.rst
@@ -3,9 +3,11 @@
.. http://creativecommons.org/licenses/by/4.0
.. (c) OPNFV, Authors of Clover
-=================================
-OPNFV Clover User Guide
-=================================
+.. _clover_userguide:
+
+=================
+Clover User Guide
+=================
.. toctree::
:maxdepth: 1
diff --git a/download/cloverctl.tar.gz b/download/cloverctl.tar.gz
new file mode 100644
index 0000000..0ec589a
--- /dev/null
+++ b/download/cloverctl.tar.gz
Binary files differ