blob: 438b7ba03a5631b6808746b4ab0ef25e6e64d08e [file] [log] [blame]
Filip Tehlar71fc1942023-05-22 15:48:51 +02001package main
2
Adrian Villin4677d922024-06-14 09:32:39 +02003import . "fd.io/hs-test/infra"
4
Adrian Villincee15aa2024-03-14 11:42:55 -04005func init() {
Adrian Villin4677d922024-06-14 09:32:39 +02006 RegisterVethTests(VppEchoQuicTest, VppEchoTcpTest)
Adrian Villincee15aa2024-03-14 11:42:55 -04007}
8
9func VppEchoQuicTest(s *VethsSuite) {
Adrian Villin4677d922024-06-14 09:32:39 +020010 testVppEcho(s, "quic")
Filip Tehlar71fc1942023-05-22 15:48:51 +020011}
12
Adrian Villin637edda2024-05-06 06:55:34 -040013// TODO: udp echo currently broken in vpp
Adrian Villincee15aa2024-03-14 11:42:55 -040014func VppEchoUdpTest(s *VethsSuite) {
Adrian Villin4677d922024-06-14 09:32:39 +020015 testVppEcho(s, "udp")
Filip Tehlar71fc1942023-05-22 15:48:51 +020016}
17
Adrian Villincee15aa2024-03-14 11:42:55 -040018func VppEchoTcpTest(s *VethsSuite) {
Adrian Villin4677d922024-06-14 09:32:39 +020019 testVppEcho(s, "tcp")
Filip Tehlar71fc1942023-05-22 15:48:51 +020020}
21
Adrian Villin4677d922024-06-14 09:32:39 +020022func testVppEcho(s *VethsSuite, proto string) {
23 serverVethAddress := s.GetInterfaceByName(ServerInterfaceName).Ip4AddressString()
Filip Tehlar71fc1942023-05-22 15:48:51 +020024 uri := proto + "://" + serverVethAddress + "/12344"
25
Adrian Villin4677d922024-06-14 09:32:39 +020026 echoSrvContainer := s.GetContainerByName("server-app")
Filip Tehlar71fc1942023-05-22 15:48:51 +020027 serverCommand := "vpp_echo server TX=RX" +
Adrian Villin4677d922024-06-14 09:32:39 +020028 " socket-name " + echoSrvContainer.GetContainerWorkDir() + "/var/run/app_ns_sockets/default" +
Filip Tehlar71fc1942023-05-22 15:48:51 +020029 " use-app-socket-api" +
30 " uri " + uri
Adrian Villin4677d922024-06-14 09:32:39 +020031 s.Log(serverCommand)
32 echoSrvContainer.ExecServer(serverCommand)
Filip Tehlar71fc1942023-05-22 15:48:51 +020033
Adrian Villin4677d922024-06-14 09:32:39 +020034 echoClnContainer := s.GetContainerByName("client-app")
Filip Tehlar71fc1942023-05-22 15:48:51 +020035
36 clientCommand := "vpp_echo client" +
Adrian Villin4677d922024-06-14 09:32:39 +020037 " socket-name " + echoClnContainer.GetContainerWorkDir() + "/var/run/app_ns_sockets/default" +
Filip Tehlar71fc1942023-05-22 15:48:51 +020038 " use-app-socket-api uri " + uri
Adrian Villin4677d922024-06-14 09:32:39 +020039 s.Log(clientCommand)
40 o := echoClnContainer.Exec(clientCommand)
41 s.Log(o)
Filip Tehlar71fc1942023-05-22 15:48:51 +020042}