4 . "fd.io/hs-test/infra"
8 RegisterVethTests(EchoBuiltinTest)
9 RegisterSoloVethTests(TcpWithLossTest)
12 func EchoBuiltinTest(s *VethsSuite) {
13 serverVpp := s.GetContainerByName("server-vpp").VppInstance
14 serverVeth := s.GetInterfaceByName(ServerInterfaceName)
16 serverVpp.Vppctl("test echo server " +
17 " uri tcp://" + serverVeth.Ip4AddressString() + "/1234")
19 clientVpp := s.GetContainerByName("client-vpp").VppInstance
21 o := clientVpp.Vppctl("test echo client nclients 100 bytes 1 verbose" +
22 " syn-timeout 100 test-timeout 100" +
23 " uri tcp://" + serverVeth.Ip4AddressString() + "/1234")
25 s.AssertNotContains(o, "failed:")
28 // unstable with multiple workers
29 func TcpWithLossTest(s *VethsSuite) {
31 serverVpp := s.GetContainerByName("server-vpp").VppInstance
33 serverVeth := s.GetInterfaceByName(ServerInterfaceName)
34 serverVpp.Vppctl("test echo server uri tcp://%s/20022",
35 serverVeth.Ip4AddressString())
37 clientVpp := s.GetContainerByName("client-vpp").VppInstance
39 // Ensure that VPP doesn't abort itself with NSIM enabled
40 // Warning: Removing this ping will make VPP crash!
41 clientVpp.Vppctl("ping %s", serverVeth.Ip4AddressString())
43 // Add loss of packets with Network Delay Simulator
44 clientVpp.Vppctl("set nsim poll-main-thread delay 0.01 ms bandwidth 40 gbit" +
45 " packet-size 1400 packets-per-drop 1000")
47 name := s.GetInterfaceByName(ClientInterfaceName).Name()
48 clientVpp.Vppctl("nsim output-feature enable-disable host-" + name)
50 // Do echo test from client-vpp container
51 output := clientVpp.Vppctl("test echo client uri tcp://%s/20022 verbose echo-bytes mbytes 50",
52 serverVeth.Ip4AddressString())
54 s.AssertNotEqual(len(output), 0)
55 s.AssertNotContains(output, "failed", output)