X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=extras%2Fhs-test%2Fvppinstance.go;h=e31b7929fd8f8455bf095adfa99cf1927f4e2fce;hb=cc1475cdc2bddeac5237012dae1c19278ee5346c;hp=c871697cb4462365e6382cfc5d9eb75fb0462e30;hpb=3a910ab76800b9608b05e6b188730a2290b51ae0;p=vpp.git diff --git a/extras/hs-test/vppinstance.go b/extras/hs-test/vppinstance.go index c871697cb44..e31b7929fd8 100644 --- a/extras/hs-test/vppinstance.go +++ b/extras/hs-test/vppinstance.go @@ -5,6 +5,7 @@ import ( "os" "os/exec" "os/signal" + "strconv" "strings" "syscall" "time" @@ -55,6 +56,8 @@ plugins { plugin af_packet_plugin.so { enable } plugin hs_apps_plugin.so { enable } plugin http_plugin.so { enable } + plugin http_static_plugin.so { enable } + plugin prom_plugin.so { enable } } logging { @@ -136,10 +139,9 @@ func (vpp *VppInstance) start() error { cont <- true }() - // Start VPP in GDB and wait for user to attach it - vpp.container.execServer("su -c \"gdb -ex run --args vpp -c " + startupFileName + " &> /proc/1/fd/1\"") + vpp.container.execServer("su -c \"vpp -c " + startupFileName + " &> /proc/1/fd/1\"") fmt.Println("run following command in different terminal:") - fmt.Println("docker exec -it " + vpp.container.name + " gdb -ex \"attach $(docker exec " + vpp.container.name + " pidof gdb)\"") + fmt.Println("docker exec -it " + vpp.container.name + " gdb -ex \"attach $(docker exec " + vpp.container.name + " pidof vpp)\"") fmt.Println("Afterwards press CTRL+C to continue") <-cont fmt.Println("continuing...") @@ -192,6 +194,23 @@ func (vpp *VppInstance) vppctl(command string, arguments ...any) string { return string(output) } +func (vpp *VppInstance) GetSessionStat(stat string) int { + o := vpp.vppctl("show session stats") + vpp.getSuite().log(o) + for _, line := range strings.Split(o, "\n") { + if strings.Contains(line, stat) { + tokens := strings.Split(strings.TrimSpace(line), " ") + val, err := strconv.Atoi(tokens[0]) + if err != nil { + vpp.getSuite().FailNow("failed to parse stat value %s", err) + return 0 + } + return val + } + } + return 0 +} + func (vpp *VppInstance) waitForApp(appName string, timeout int) { for i := 0; i < timeout; i++ { o := vpp.vppctl("show app")