8 func (s *VethsSuite) TestVclEchoQuic() {
9 s.skip("quic test skipping..")
13 func (s *VethsSuite) TestVclEchoUdp() {
14 s.skip("udp echo currently broken in vpp, skipping..")
18 func (s *VethsSuite) TestVclEchoTcp() {
22 func (s *VethsSuite) testVclEcho(proto string) {
23 serverVethAddress := s.netInterfaces["vppsrv"].IP4AddressString()
24 uri := proto + "://" + serverVethAddress + "/12344"
26 echoSrvContainer := s.getContainerByName("server-application")
27 serverCommand := "vpp_echo server TX=RX" +
28 " socket-name " + echoSrvContainer.GetContainerWorkDir() + "/var/run/app_ns_sockets/1" +
29 " use-app-socket-api" +
32 echoSrvContainer.execServer(serverCommand)
34 echoClnContainer := s.getContainerByName("client-application")
36 clientCommand := "vpp_echo client" +
37 " socket-name " + echoClnContainer.GetContainerWorkDir() + "/var/run/app_ns_sockets/2" +
38 " use-app-socket-api uri " + uri
40 o := echoClnContainer.exec(clientCommand)
45 func (s *VethsSuite) TestVclRetryAttach() {
46 s.skip("this test takes too long, for now it's being skipped")
47 s.testRetryAttach("tcp")
50 func (s *VethsSuite) testRetryAttach(proto string) {
51 srvVppContainer := s.getTransientContainerByName("server-vpp")
53 echoSrvContainer := s.getContainerByName("server-application")
55 serverVclConfContent := fmt.Sprintf(vclTemplate, echoSrvContainer.GetContainerWorkDir(), "1")
56 echoSrvContainer.createFile("/vcl.conf", serverVclConfContent)
58 echoSrvContainer.addEnvVar("VCL_CONFIG", "/vcl.conf")
59 echoSrvContainer.execServer("vcl_test_server -p " + proto + " 12346")
61 s.log("This whole test case can take around 3 minutes to run. Please be patient.")
62 s.log("... Running first echo client test, before disconnect.")
64 serverVeth := s.netInterfaces[serverInterfaceName]
65 serverVethAddress := serverVeth.IP4AddressString()
67 echoClnContainer := s.getTransientContainerByName("client-application")
68 clientVclConfContent := fmt.Sprintf(vclTemplate, echoClnContainer.GetContainerWorkDir(), "2")
69 echoClnContainer.createFile("/vcl.conf", clientVclConfContent)
71 testClientCommand := "vcl_test_client -U -p " + proto + " " + serverVethAddress + " 12346"
72 echoClnContainer.addEnvVar("VCL_CONFIG", "/vcl.conf")
73 o := echoClnContainer.exec(testClientCommand)
75 s.log("... First test ended. Stopping VPP server now.")
77 // Stop server-vpp-instance, start it again and then run vcl-test-client once more
78 srvVppContainer.vppInstance.disconnect()
79 stopVppCommand := "/bin/bash -c 'ps -C vpp_main -o pid= | xargs kill -9'"
80 srvVppContainer.exec(stopVppCommand)
84 s.log("... VPP server is starting again, so waiting for a bit.")
85 time.Sleep(30 * time.Second) // Wait a moment for the re-attachment to happen
87 s.log("... Running second echo client test, after disconnect and re-attachment.")
88 o = echoClnContainer.exec(testClientCommand)
93 func (s *VethsSuite) TestTcpWithLoss() {
94 serverVpp := s.getContainerByName("server-vpp").vppInstance
96 serverVeth := s.netInterfaces[serverInterfaceName]
97 serverVpp.vppctl("test echo server uri tcp://%s/20022",
98 serverVeth.IP4AddressString())
100 clientVpp := s.getContainerByName("client-vpp").vppInstance
102 // Ensure that VPP doesn't abort itself with NSIM enabled
103 // Warning: Removing this ping will make the test fail!
104 clientVpp.vppctl("ping %s", serverVeth.IP4AddressString())
106 // Add loss of packets with Network Delay Simulator
107 clientVpp.vppctl("set nsim poll-main-thread delay 0.01 ms bandwidth 40 gbit" +
108 " packet-size 1400 packets-per-drop 1000")
110 clientVpp.vppctl("nsim output-feature enable-disable host-vppcln")
112 // Do echo test from client-vpp container
113 output := clientVpp.vppctl("test echo client uri tcp://%s/20022 mbytes 50",
114 serverVeth.IP4AddressString())
115 s.assertEqual(true, len(output) != 0)
116 s.assertNotContains(output, "failed: timeout")