Filip Tehlar | 229f5fc | 2022-08-09 14:44:47 +0000 | [diff] [blame] | 1 | package main |
| 2 | |
Maros Ondrejicka | 11a03e9 | 2022-12-01 09:56:37 +0100 | [diff] [blame] | 3 | func (s *VethsSuite) TestEchoBuiltin() { |
Maros Ondrejicka | ffa3f60 | 2023-01-26 10:07:29 +0100 | [diff] [blame] | 4 | serverVpp := s.getContainerByName("server-vpp").vppInstance |
Maros Ondrejicka | 2908f8c | 2023-02-02 08:58:04 +0100 | [diff] [blame] | 5 | serverVeth := s.netInterfaces["vppsrv"] |
Maros Ondrejicka | ffa3f60 | 2023-01-26 10:07:29 +0100 | [diff] [blame] | 6 | |
Maros Ondrejicka | 2908f8c | 2023-02-02 08:58:04 +0100 | [diff] [blame] | 7 | serverVpp.vppctl("test echo server " + |
Maros Ondrejicka | e7625d0 | 2023-02-28 16:55:01 +0100 | [diff] [blame] | 8 | " uri tcp://" + serverVeth.ip4AddressString() + "/1234") |
Filip Tehlar | 229f5fc | 2022-08-09 14:44:47 +0000 | [diff] [blame] | 9 | |
Maros Ondrejicka | ffa3f60 | 2023-01-26 10:07:29 +0100 | [diff] [blame] | 10 | clientVpp := s.getContainerByName("client-vpp").vppInstance |
Filip Tehlar | 229f5fc | 2022-08-09 14:44:47 +0000 | [diff] [blame] | 11 | |
Filip Tehlar | efe875e | 2023-09-04 14:17:52 +0200 | [diff] [blame] | 12 | o := clientVpp.vppctl("test echo client nclients 100 bytes 1 verbose" + |
| 13 | " syn-timeout 100 test-timeout 100" + |
| 14 | " uri tcp://" + serverVeth.ip4AddressString() + "/1234") |
Maros Ondrejicka | 8753180 | 2022-12-19 20:35:27 +0100 | [diff] [blame] | 15 | s.log(o) |
Filip Tehlar | efe875e | 2023-09-04 14:17:52 +0200 | [diff] [blame] | 16 | s.assertNotContains(o, "failed:") |
| 17 | } |
| 18 | |
| 19 | func (s *VethsSuite) TestTcpWithLoss() { |
| 20 | serverVpp := s.getContainerByName("server-vpp").vppInstance |
| 21 | |
| 22 | serverVeth := s.netInterfaces[serverInterfaceName] |
| 23 | serverVpp.vppctl("test echo server uri tcp://%s/20022", |
| 24 | serverVeth.ip4AddressString()) |
| 25 | |
| 26 | clientVpp := s.getContainerByName("client-vpp").vppInstance |
| 27 | |
| 28 | // Ensure that VPP doesn't abort itself with NSIM enabled |
| 29 | // Warning: Removing this ping will make the test fail! |
| 30 | clientVpp.vppctl("ping %s", serverVeth.ip4AddressString()) |
| 31 | |
| 32 | // Add loss of packets with Network Delay Simulator |
| 33 | clientVpp.vppctl("set nsim poll-main-thread delay 0.01 ms bandwidth 40 gbit" + |
| 34 | " packet-size 1400 packets-per-drop 1000") |
| 35 | |
| 36 | clientVpp.vppctl("nsim output-feature enable-disable host-vppcln") |
| 37 | |
| 38 | // Do echo test from client-vpp container |
| 39 | output := clientVpp.vppctl("test echo client uri tcp://%s/20022 verbose echo-bytes mbytes 50", |
| 40 | serverVeth.ip4AddressString()) |
| 41 | s.log(output) |
| 42 | s.assertNotEqual(len(output), 0) |
| 43 | s.assertNotContains(output, "failed: timeout") |
Filip Tehlar | 229f5fc | 2022-08-09 14:44:47 +0000 | [diff] [blame] | 44 | } |