diff options
author | Maros Ondrejicka <maros.ondrejicka@pantheon.tech> | 2023-01-26 10:07:29 +0100 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2023-02-09 17:02:43 +0000 |
commit | ffa3f60290499bdacc37a97c49f2e794b5e1f18c (patch) | |
tree | c23820e0d91d2a1a0eef2596b0de60c06f1ea303 /extras/hs-test/actions.go | |
parent | 7a6532bb9f3b9c429f92d11a6ccbf55638906d0a (diff) |
hs-test: configure VPP from test context
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
Diffstat (limited to 'extras/hs-test/actions.go')
-rw-r--r-- | extras/hs-test/actions.go | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/extras/hs-test/actions.go b/extras/hs-test/actions.go index 279589b5d41..60398704763 100644 --- a/extras/hs-test/actions.go +++ b/extras/hs-test/actions.go @@ -1,7 +1,6 @@ package main import ( - "bytes" "context" "fmt" "os" @@ -47,17 +46,6 @@ func configureProxyTcp(ifName0, ipAddr0, ifName1, ipAddr1 string) ConfFn { } } -func (a *Actions) RunHttpCliSrv(args []string) *ActionResult { - cmd := fmt.Sprintf("http cli server") - return ApiCliInband(workDir, cmd) -} - -func (a *Actions) RunHttpCliCln(args []string) *ActionResult { - cmd := fmt.Sprintf("http cli client uri http://10.10.10.1/80 query %s", getArgs()) - fmt.Println(cmd) - return ApiCliInband(workDir, cmd) -} - func (a *Actions) ConfigureVppProxy(args []string) *ActionResult { ctx, cancel := newVppContext() defer cancel() @@ -123,31 +111,6 @@ func ApiCliInband(root, cmd string) *ActionResult { return NewActionResult(err, ActionResultWithStdout(cliInbandReply.Reply)) } -func (a *Actions) RunEchoClient(args []string) *ActionResult { - outBuff := bytes.NewBuffer([]byte{}) - errBuff := bytes.NewBuffer([]byte{}) - - cmd := fmt.Sprintf("vpp_echo client socket-name %s/var/run/app_ns_sockets/2 use-app-socket-api uri %s://10.10.10.1/12344", workDir, args[2]) - err := exechelper.Run(cmd, - exechelper.WithStdout(outBuff), exechelper.WithStderr(errBuff), - exechelper.WithStdout(os.Stdout), exechelper.WithStderr(os.Stderr)) - - return NewActionResult(err, ActionResultWithStdout(string(outBuff.String())), - ActionResultWithStderr(string(errBuff.String()))) -} - -func (a *Actions) RunEchoServer(args []string) *ActionResult { - cmd := fmt.Sprintf("vpp_echo server TX=RX socket-name %s/var/run/app_ns_sockets/1 use-app-socket-api uri %s://10.10.10.1/12344", workDir, args[2]) - errCh := exechelper.Start(cmd) - select { - case err := <-errCh: - writeSyncFile(NewActionResult(err, ActionResultWithDesc("echo_server: "))) - default: - } - writeSyncFile(OkResult()) - return nil -} - func (a *Actions) RunEchoSrvInternal(args []string) *ActionResult { cmd := fmt.Sprintf("test echo server %s uri tcp://10.10.10.1/1234", getArgs()) return ApiCliInband(workDir, cmd) @@ -158,49 +121,6 @@ func (a *Actions) RunEchoClnInternal(args []string) *ActionResult { return ApiCliInband(workDir, cmd) } -func (a *Actions) RunVclEchoServer(args []string) *ActionResult { - f, err := os.Create("vcl_1.conf") - if err != nil { - return NewActionResult(err, ActionResultWithStderr(("create vcl config: "))) - } - socketPath := fmt.Sprintf("%s/var/run/app_ns_sockets/1", workDir) - fmt.Fprintf(f, vclTemplate, socketPath, "1") - f.Close() - - os.Setenv("VCL_CONFIG", "./vcl_1.conf") - cmd := fmt.Sprintf("vcl_test_server -p %s 12346", args[2]) - errCh := exechelper.Start(cmd) - select { - case err := <-errCh: - writeSyncFile(NewActionResult(err, ActionResultWithDesc("vcl_test_server: "))) - default: - } - writeSyncFile(OkResult()) - return nil -} - -func (a *Actions) RunVclEchoClient(args []string) *ActionResult { - outBuff := bytes.NewBuffer([]byte{}) - errBuff := bytes.NewBuffer([]byte{}) - - f, err := os.Create("vcl_2.conf") - if err != nil { - return NewActionResult(err, ActionResultWithStderr(("create vcl config: "))) - } - socketPath := fmt.Sprintf("%s/var/run/app_ns_sockets/2", workDir) - fmt.Fprintf(f, vclTemplate, socketPath, "2") - f.Close() - - os.Setenv("VCL_CONFIG", "./vcl_2.conf") - cmd := fmt.Sprintf("vcl_test_client -U -p %s 10.10.10.1 12346", args[2]) - err = exechelper.Run(cmd, - exechelper.WithStdout(outBuff), exechelper.WithStderr(errBuff), - exechelper.WithStdout(os.Stdout), exechelper.WithStderr(os.Stderr)) - - return NewActionResult(err, ActionResultWithStdout(string(outBuff.String())), - ActionResultWithStderr(string(errBuff.String()))) -} - func configure2vethsTopo(ifName, interfaceAddress, namespaceId string, secret uint64, optionalHardwareAddress ...string) ConfFn { return func(ctx context.Context, vppConn api.Connection) error { |