4 registerVethTests(EchoBuiltinTest)
5 registerSoloVethTests(TcpWithLossTest)
8 func EchoBuiltinTest(s *VethsSuite) {
9 serverVpp := s.getContainerByName("server-vpp").vppInstance
10 serverVeth := s.getInterfaceByName(serverInterfaceName)
12 serverVpp.vppctl("test echo server " +
13 " uri tcp://" + serverVeth.ip4AddressString() + "/1234")
15 clientVpp := s.getContainerByName("client-vpp").vppInstance
17 o := clientVpp.vppctl("test echo client nclients 100 bytes 1 verbose" +
18 " syn-timeout 100 test-timeout 100" +
19 " uri tcp://" + serverVeth.ip4AddressString() + "/1234")
21 s.assertNotContains(o, "failed:")
24 func TcpWithLossTest(s *VethsSuite) {
25 serverVpp := s.getContainerByName("server-vpp").vppInstance
27 serverVeth := s.getInterfaceByName(serverInterfaceName)
28 serverVpp.vppctl("test echo server uri tcp://%s/20022",
29 serverVeth.ip4AddressString())
31 clientVpp := s.getContainerByName("client-vpp").vppInstance
33 // Ensure that VPP doesn't abort itself with NSIM enabled
34 // Warning: Removing this ping will make VPP crash!
35 clientVpp.vppctl("ping %s", serverVeth.ip4AddressString())
37 // Add loss of packets with Network Delay Simulator
38 clientVpp.vppctl("set nsim poll-main-thread delay 0.01 ms bandwidth 40 gbit" +
39 " packet-size 1400 packets-per-drop 1000")
41 clientVpp.vppctl("nsim output-feature enable-disable host-" + s.getInterfaceByName(clientInterfaceName).name)
43 // Do echo test from client-vpp container
44 output := clientVpp.vppctl("test echo client uri tcp://%s/20022 verbose echo-bytes mbytes 50",
45 serverVeth.ip4AddressString())
47 s.assertNotEqual(len(output), 0)
48 s.assertNotContains(output, "failed: timeout", output)