ffa3f60290
Instead of configuring VPP instances running inside of a container, now the configuration is going to be done from within the test context by using binary API and shared volume that exposes api socket. This converts just some of the test cases, rest is to follow. Type: test Signed-off-by: Maros Ondrejicka <maros.ondrejicka@pantheon.tech> Change-Id: I87e4ab15de488f0eebb01ff514596265fc2a787f
85 lines
2.0 KiB
Go
85 lines
2.0 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"time"
|
|
)
|
|
|
|
func (s *VethsSuite) TestLDPreloadIperfVpp() {
|
|
var clnVclConf, srvVclConf Stanza
|
|
|
|
serverContainer := s.getContainerByName("server-vpp")
|
|
srvVcl := serverContainer.GetHostWorkDir() + "/vcl_srv.conf"
|
|
|
|
clientContainer := s.getContainerByName("client-vpp")
|
|
clnVcl := clientContainer.GetHostWorkDir() + "/vcl_cln.conf"
|
|
|
|
ldpreload := os.Getenv("HST_LDPRELOAD")
|
|
s.assertNotEqual("", ldpreload)
|
|
|
|
ldpreload = "LD_PRELOAD=" + ldpreload
|
|
|
|
stopServerCh := make(chan struct{}, 1)
|
|
srvCh := make(chan error, 1)
|
|
clnCh := make(chan error)
|
|
|
|
s.log("starting VPPs")
|
|
|
|
_, err := serverContainer.execAction("Configure2Veths srv")
|
|
s.assertNil(err)
|
|
|
|
_, err = clientContainer.execAction("Configure2Veths cln")
|
|
s.assertNil(err)
|
|
|
|
clientAppSocketApi := fmt.Sprintf("app-socket-api %s/var/run/app_ns_sockets/2",
|
|
clientContainer.GetContainerWorkDir())
|
|
err = clnVclConf.
|
|
NewStanza("vcl").
|
|
Append("rx-fifo-size 4000000").
|
|
Append("tx-fifo-size 4000000").
|
|
Append("app-scope-local").
|
|
Append("app-scope-global").
|
|
Append("use-mq-eventfd").
|
|
Append(clientAppSocketApi).Close().
|
|
SaveToFile(clnVcl)
|
|
s.assertNil(err)
|
|
|
|
serverAppSocketApi := fmt.Sprintf("app-socket-api %s/var/run/app_ns_sockets/1",
|
|
serverContainer.GetContainerWorkDir())
|
|
err = srvVclConf.
|
|
NewStanza("vcl").
|
|
Append("rx-fifo-size 4000000").
|
|
Append("tx-fifo-size 4000000").
|
|
Append("app-scope-local").
|
|
Append("app-scope-global").
|
|
Append("use-mq-eventfd").
|
|
Append(serverAppSocketApi).Close().
|
|
SaveToFile(srvVcl)
|
|
s.assertNil(err)
|
|
|
|
s.log("attaching server to vpp")
|
|
|
|
// FIXME
|
|
time.Sleep(5 * time.Second)
|
|
|
|
srvEnv := append(os.Environ(), ldpreload, "VCL_CONFIG="+srvVcl)
|
|
go StartServerApp(srvCh, stopServerCh, srvEnv)
|
|
|
|
err = <-srvCh
|
|
s.assertNil(err)
|
|
|
|
s.log("attaching client to vpp")
|
|
var clnRes = make(chan string, 1)
|
|
clnEnv := append(os.Environ(), ldpreload, "VCL_CONFIG="+clnVcl)
|
|
go StartClientApp(clnEnv, clnCh, clnRes)
|
|
s.log(<-clnRes)
|
|
|
|
// wait for client's result
|
|
err = <-clnCh
|
|
s.assertNil(err)
|
|
|
|
// stop server
|
|
stopServerCh <- struct{}{}
|
|
}
|