aboutsummaryrefslogtreecommitdiffstats
path: root/extras/hs-test/raw_session_test.go
blob: 822ee5c68e30d2c35fc8f45d3e3955bd54bb987c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package main

import . "fd.io/hs-test/infra"

func init() {
	RegisterVethTests(VppEchoQuicTest, VppEchoTcpTest)
}

func VppEchoQuicTest(s *VethsSuite) {
	testVppEcho(s, "quic")
}

// TODO: udp echo currently broken in vpp
func VppEchoUdpTest(s *VethsSuite) {
	testVppEcho(s, "udp")
}

func VppEchoTcpTest(s *VethsSuite) {
	testVppEcho(s, "tcp")
}

func testVppEcho(s *VethsSuite, proto string) {
	serverVethAddress := s.GetInterfaceByName(ServerInterfaceName).Ip4AddressString()
	uri := proto + "://" + serverVethAddress + "/12344"

	echoSrvContainer := s.GetContainerByName("server-app")
	serverCommand := "vpp_echo server TX=RX" +
		" socket-name " + echoSrvContainer.GetContainerWorkDir() + "/var/run/app_ns_sockets/default" +
		" use-app-socket-api" +
		" uri " + uri
	s.Log(serverCommand)
	echoSrvContainer.ExecServer(true, serverCommand)

	echoClnContainer := s.GetContainerByName("client-app")

	clientCommand := "vpp_echo client" +
		" socket-name " + echoClnContainer.GetContainerWorkDir() + "/var/run/app_ns_sockets/default" +
		" use-app-socket-api uri " + uri
	s.Log(clientCommand)
	o := echoClnContainer.Exec(true, clientCommand)
	s.Log(o)
}