Filip Tehlar | 71fc194 | 2023-05-22 15:48:51 +0200 | [diff] [blame] | 1 | package main |
| 2 | |
Adrian Villin | cee15aa | 2024-03-14 11:42:55 -0400 | [diff] [blame] | 3 | func init() { |
Adrian Villin | 637edda | 2024-05-06 06:55:34 -0400 | [diff] [blame] | 4 | registerVethTests(VppEchoQuicTest, VppEchoTcpTest) |
Adrian Villin | cee15aa | 2024-03-14 11:42:55 -0400 | [diff] [blame] | 5 | } |
| 6 | |
| 7 | func VppEchoQuicTest(s *VethsSuite) { |
Filip Tehlar | 71fc194 | 2023-05-22 15:48:51 +0200 | [diff] [blame] | 8 | s.testVppEcho("quic") |
| 9 | } |
| 10 | |
Adrian Villin | 637edda | 2024-05-06 06:55:34 -0400 | [diff] [blame] | 11 | // TODO: udp echo currently broken in vpp |
Adrian Villin | cee15aa | 2024-03-14 11:42:55 -0400 | [diff] [blame] | 12 | func VppEchoUdpTest(s *VethsSuite) { |
Filip Tehlar | 71fc194 | 2023-05-22 15:48:51 +0200 | [diff] [blame] | 13 | s.testVppEcho("udp") |
| 14 | } |
| 15 | |
Adrian Villin | cee15aa | 2024-03-14 11:42:55 -0400 | [diff] [blame] | 16 | func VppEchoTcpTest(s *VethsSuite) { |
Filip Tehlar | 71fc194 | 2023-05-22 15:48:51 +0200 | [diff] [blame] | 17 | s.testVppEcho("tcp") |
| 18 | } |
| 19 | |
| 20 | func (s *VethsSuite) testVppEcho(proto string) { |
adrianvillin | 28bd8f0 | 2024-02-13 06:00:02 -0500 | [diff] [blame] | 21 | serverVethAddress := s.getInterfaceByName(serverInterfaceName).ip4AddressString() |
Filip Tehlar | 71fc194 | 2023-05-22 15:48:51 +0200 | [diff] [blame] | 22 | uri := proto + "://" + serverVethAddress + "/12344" |
| 23 | |
| 24 | echoSrvContainer := s.getContainerByName("server-app") |
| 25 | serverCommand := "vpp_echo server TX=RX" + |
Filip Tehlar | 5ebdd51 | 2023-12-14 13:06:54 +0100 | [diff] [blame] | 26 | " socket-name " + echoSrvContainer.getContainerWorkDir() + "/var/run/app_ns_sockets/default" + |
Filip Tehlar | 71fc194 | 2023-05-22 15:48:51 +0200 | [diff] [blame] | 27 | " use-app-socket-api" + |
| 28 | " uri " + uri |
| 29 | s.log(serverCommand) |
| 30 | echoSrvContainer.execServer(serverCommand) |
| 31 | |
| 32 | echoClnContainer := s.getContainerByName("client-app") |
| 33 | |
| 34 | clientCommand := "vpp_echo client" + |
Filip Tehlar | 5ebdd51 | 2023-12-14 13:06:54 +0100 | [diff] [blame] | 35 | " socket-name " + echoClnContainer.getContainerWorkDir() + "/var/run/app_ns_sockets/default" + |
Filip Tehlar | 71fc194 | 2023-05-22 15:48:51 +0200 | [diff] [blame] | 36 | " use-app-socket-api uri " + uri |
| 37 | s.log(clientCommand) |
| 38 | o := echoClnContainer.exec(clientCommand) |
| 39 | s.log(o) |
| 40 | } |