diff options
author | Filip Tehlar <ftehlar@cisco.com> | 2023-05-22 15:48:51 +0200 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2023-05-24 17:38:10 +0000 |
commit | 71fc1947033854cd57c362df69f7f2e578af7d1b (patch) | |
tree | bed4beb03897cf100b1937064a531546a0c686da | |
parent | 5e42eae58be468ca82a372b4f751e98f327b389e (diff) |
hs-test: add vcl echo tests
Type: test
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Change-Id: I3e543cb292c7ed0f9d240f8f2473a1db07aff0fd
-rw-r--r-- | extras/hs-test/raw_session_test.go | 37 | ||||
-rw-r--r-- | extras/hs-test/topo-containers/2peerVeth.yaml | 4 | ||||
-rw-r--r-- | extras/hs-test/vcl_test.go | 54 |
3 files changed, 63 insertions, 32 deletions
diff --git a/extras/hs-test/raw_session_test.go b/extras/hs-test/raw_session_test.go new file mode 100644 index 00000000000..677a47b789a --- /dev/null +++ b/extras/hs-test/raw_session_test.go @@ -0,0 +1,37 @@ +package main + +func (s *VethsSuite) TestVppEchoQuic() { + s.skip("quic test skipping..") + s.testVppEcho("quic") +} + +func (s *VethsSuite) TestVppEchoUdp() { + s.skip("udp echo currently broken in vpp, skipping..") + s.testVppEcho("udp") +} + +func (s *VethsSuite) TestVppEchoTcp() { + s.testVppEcho("tcp") +} + +func (s *VethsSuite) testVppEcho(proto string) { + serverVethAddress := s.netInterfaces["vppsrv"].ip4AddressString() + uri := proto + "://" + serverVethAddress + "/12344" + + echoSrvContainer := s.getContainerByName("server-app") + serverCommand := "vpp_echo server TX=RX" + + " socket-name " + echoSrvContainer.getContainerWorkDir() + "/var/run/app_ns_sockets/1" + + " use-app-socket-api" + + " uri " + uri + s.log(serverCommand) + echoSrvContainer.execServer(serverCommand) + + echoClnContainer := s.getContainerByName("client-app") + + clientCommand := "vpp_echo client" + + " socket-name " + echoClnContainer.getContainerWorkDir() + "/var/run/app_ns_sockets/2" + + " use-app-socket-api uri " + uri + s.log(clientCommand) + o := echoClnContainer.exec(clientCommand) + s.log(o) +} diff --git a/extras/hs-test/topo-containers/2peerVeth.yaml b/extras/hs-test/topo-containers/2peerVeth.yaml index 72af1c9c838..36de33b0f45 100644 --- a/extras/hs-test/topo-containers/2peerVeth.yaml +++ b/extras/hs-test/topo-containers/2peerVeth.yaml @@ -16,10 +16,10 @@ containers: - name: "client-vpp" volumes: - <<: *client-vol - - name: "server-application" + - name: "server-app" volumes: - <<: *server-vol - - name: "client-application" + - name: "client-app" volumes: - <<: *client-vol diff --git a/extras/hs-test/vcl_test.go b/extras/hs-test/vcl_test.go index fe55af1866a..88acefd144f 100644 --- a/extras/hs-test/vcl_test.go +++ b/extras/hs-test/vcl_test.go @@ -5,41 +5,35 @@ import ( "time" ) -func (s *VethsSuite) TestVclEchoQuic() { - s.skip("quic test skipping..") - s.testVclEcho("quic") -} +func (s *VethsSuite) testVclEcho(proto string) { + port := "12345" + srvVppCont := s.getContainerByName("server-vpp") + srvAppCont := s.getContainerByName("server-app") -func (s *VethsSuite) TestVclEchoUdp() { - s.skip("udp echo currently broken in vpp, skipping..") - s.testVclEcho("udp") + serverVclConfContent := fmt.Sprintf(vclTemplate, srvVppCont.getContainerWorkDir(), "1") + srvAppCont.createFile("/vcl.conf", serverVclConfContent) + srvAppCont.addEnvVar("VCL_CONFIG", "/vcl.conf") + srvAppCont.execServer("vcl_test_server " + port) + + serverVeth := s.netInterfaces[serverInterfaceName] + serverVethAddress := serverVeth.ip4AddressString() + + echoClnContainer := s.getTransientContainerByName("client-app") + clientVclConfContent := fmt.Sprintf(vclTemplate, echoClnContainer.getContainerWorkDir(), "2") + echoClnContainer.createFile("/vcl.conf", clientVclConfContent) + + testClientCommand := "vcl_test_client -E -p " + proto + " " + serverVethAddress + " " + port + echoClnContainer.addEnvVar("VCL_CONFIG", "/vcl.conf") + o := echoClnContainer.exec(testClientCommand) + s.log(o) } func (s *VethsSuite) TestVclEchoTcp() { s.testVclEcho("tcp") } -func (s *VethsSuite) testVclEcho(proto string) { - serverVethAddress := s.netInterfaces["vppsrv"].ip4AddressString() - uri := proto + "://" + serverVethAddress + "/12344" - - echoSrvContainer := s.getContainerByName("server-application") - serverCommand := "vpp_echo server TX=RX" + - " socket-name " + echoSrvContainer.getContainerWorkDir() + "/var/run/app_ns_sockets/1" + - " use-app-socket-api" + - " uri " + uri - s.log(serverCommand) - echoSrvContainer.execServer(serverCommand) - - echoClnContainer := s.getContainerByName("client-application") - - clientCommand := "vpp_echo client" + - " socket-name " + echoClnContainer.getContainerWorkDir() + "/var/run/app_ns_sockets/2" + - " use-app-socket-api uri " + uri - s.log(clientCommand) - o := echoClnContainer.exec(clientCommand) - - s.log(o) +func (s *VethsSuite) TestVclEchoUdp() { + s.testVclEcho("udp") } func (s *VethsSuite) TestVclRetryAttach() { @@ -50,7 +44,7 @@ func (s *VethsSuite) TestVclRetryAttach() { func (s *VethsSuite) testRetryAttach(proto string) { srvVppContainer := s.getTransientContainerByName("server-vpp") - echoSrvContainer := s.getContainerByName("server-application") + echoSrvContainer := s.getContainerByName("server-app") serverVclConfContent := fmt.Sprintf(vclTemplate, echoSrvContainer.getContainerWorkDir(), "1") echoSrvContainer.createFile("/vcl.conf", serverVclConfContent) @@ -64,7 +58,7 @@ func (s *VethsSuite) testRetryAttach(proto string) { serverVeth := s.netInterfaces[serverInterfaceName] serverVethAddress := serverVeth.ip4AddressString() - echoClnContainer := s.getTransientContainerByName("client-application") + echoClnContainer := s.getTransientContainerByName("client-app") clientVclConfContent := fmt.Sprintf(vclTemplate, echoClnContainer.getContainerWorkDir(), "2") echoClnContainer.createFile("/vcl.conf", clientVclConfContent) |