blob: fc221aa9ab54adce354dfa1df8490e2c3cf26003 [file] [log] [blame]
Filip Tehlar229f5fc2022-08-09 14:44:47 +00001package main
2
Maros Ondrejicka11a03e92022-12-01 09:56:37 +01003func (s *VethsSuite) TestEchoBuiltin() {
Maros Ondrejickaffa3f602023-01-26 10:07:29 +01004 serverVpp := s.getContainerByName("server-vpp").vppInstance
Maros Ondrejicka2908f8c2023-02-02 08:58:04 +01005 serverVeth := s.netInterfaces["vppsrv"]
Maros Ondrejickaffa3f602023-01-26 10:07:29 +01006
Maros Ondrejicka2908f8c2023-02-02 08:58:04 +01007 serverVpp.vppctl("test echo server " +
Maros Ondrejickae7625d02023-02-28 16:55:01 +01008 " uri tcp://" + serverVeth.ip4AddressString() + "/1234")
Filip Tehlar229f5fc2022-08-09 14:44:47 +00009
Maros Ondrejickaffa3f602023-01-26 10:07:29 +010010 clientVpp := s.getContainerByName("client-vpp").vppInstance
Filip Tehlar229f5fc2022-08-09 14:44:47 +000011
Filip Tehlarefe875e2023-09-04 14:17:52 +020012 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 Ondrejicka87531802022-12-19 20:35:27 +010015 s.log(o)
Filip Tehlarefe875e2023-09-04 14:17:52 +020016 s.assertNotContains(o, "failed:")
17}
18
19func (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 Tehlar229f5fc2022-08-09 14:44:47 +000044}