8 func (s *VethsSuite) TestVclEchoQuic() {
9 s.T().Skip("quic test skipping..")
13 func (s *VethsSuite) TestVclEchoUdp() {
14 s.T().Skip("udp echo currently broken in vpp, skipping..")
18 func (s *VethsSuite) TestVclEchoTcp() {
22 func (s *VethsSuite) testVclEcho(proto string) {
23 srvVppContainer := s.getContainerByName("server-vpp")
25 _, err := srvVppContainer.execAction("Configure2Veths srv")
28 clnVppContainer := s.getContainerByName("client-vpp")
30 _, err = clnVppContainer.execAction("Configure2Veths cln")
33 echoSrvContainer := s.getContainerByName("server-application")
36 _, err = echoSrvContainer.execAction("RunEchoServer "+proto)
39 echoClnContainer := s.getContainerByName("client-application")
41 o, err := echoClnContainer.execAction("RunEchoClient "+proto)
47 func (s *VethsSuite) TestVclRetryAttach() {
49 s.testRetryAttach("tcp")
52 func (s *VethsSuite) testRetryAttach(proto string) {
53 srvVppContainer := s.getContainerByName("server-vpp")
55 _, err := srvVppContainer.execAction("Configure2Veths srv-with-preset-hw-addr")
58 clnVppContainer := s.getContainerByName("client-vpp")
60 _, err = clnVppContainer.execAction("Configure2Veths cln")
63 echoSrvContainer := s.getContainerByName("server-application")
64 _, err = echoSrvContainer.execAction("RunVclEchoServer "+proto)
67 fmt.Println("This whole test case can take around 3 minutes to run. Please be patient.")
68 fmt.Println("... Running first echo client test, before disconnect.")
69 echoClnContainer := s.getContainerByName("client-application")
70 _, err = echoClnContainer.execAction("RunVclEchoClient "+proto)
72 fmt.Println("... First test ended. Stopping VPP server now.")
74 // Stop server-vpp-instance, start it again and then run vcl-test-client once more
75 stopVppCommand := "/bin/bash -c 'ps -C vpp_main -o pid= | xargs kill -9'"
76 _, err = srvVppContainer.exec(stopVppCommand)
78 time.Sleep(5 * time.Second) // Give parent process time to reap the killed child process
79 stopVppCommand = "/bin/bash -c 'ps -C hs-test -o pid= | xargs kill -9'"
80 _, err = srvVppContainer.exec(stopVppCommand)
82 _, err = srvVppContainer.execAction("Configure2Veths srv-with-preset-hw-addr")
85 fmt.Println("... VPP server is starting again, so waiting for a bit.")
86 time.Sleep(30 * time.Second) // Wait a moment for the re-attachment to happen
88 fmt.Println("... Running second echo client test, after disconnect and re-attachment.")
89 _, err = echoClnContainer.execAction("RunVclEchoClient "+proto)
94 func (s *VethsSuite) TestTcpWithLoss() {
95 serverContainer := s.getContainerByName("server-vpp")
97 serverVpp := NewVppInstance(serverContainer)
98 s.assertNotNil(serverVpp)
99 serverVpp.set2VethsServer()
100 err := serverVpp.start()
101 s.assertNil(err, "starting VPP failed")
103 _, err = serverVpp.vppctl("test echo server uri tcp://10.10.10.1/20022")
104 s.assertNil(err, "starting echo server failed")
106 clientContainer := s.getContainerByName("client-vpp")
108 clientVpp := NewVppInstance(clientContainer)
109 s.assertNotNil(clientVpp)
110 clientVpp.set2VethsClient()
111 err = clientVpp.start()
112 s.assertNil(err, "starting VPP failed")
114 // Ensure that VPP doesn't abort itself with NSIM enabled
115 // Warning: Removing this ping will make the test fail!
116 _, err = serverVpp.vppctl("ping 10.10.10.2")
117 s.assertNil(err, "ping failed")
119 // Add loss of packets with Network Delay Simulator
120 _, err = clientVpp.vppctl("set nsim poll-main-thread delay 0.01 ms bandwidth 40 gbit packet-size 1400 packets-per-drop 1000")
121 s.assertNil(err, "configuring NSIM failed")
122 _, err = clientVpp.vppctl("nsim output-feature enable-disable host-vppcln")
123 s.assertNil(err, "enabling NSIM failed")
125 // Do echo test from client-vpp container
126 output, err := clientVpp.vppctl("test echo client uri tcp://10.10.10.1/20022 mbytes 50")
128 s.assertEqual(true, len(output) != 0)
129 s.assertNotContains(output, "failed: timeout")