8 func (s *NsSuite) TestHttpTps() {
9 iface := s.netInterfaces[clientInterface]
10 client_ip := iface.ip4AddressString()
12 finished := make(chan error, 1)
14 container := s.getContainerByName("vpp")
16 // configure vpp in the container
17 container.vppInstance.vppctl("http tps uri tcp://0.0.0.0/8080")
19 go startWget(finished, client_ip, port, "test_file_10M", "client")
25 func (s *VethsSuite) TestHttpCli() {
26 serverContainer := s.getContainerByName("server-vpp")
27 clientContainer := s.getContainerByName("client-vpp")
29 serverVeth := s.netInterfaces[serverInterfaceName]
31 serverContainer.vppInstance.vppctl("http cli server")
33 uri := "http://" + serverVeth.ip4AddressString() + "/80"
35 o := clientContainer.vppInstance.vppctl("http cli client" +
36 " uri " + uri + " query /show/version")
39 s.assertContains(o, "<html>", "<html> not found in the result!")
42 func (s *NoTopoSuite) TestNginxAsServer() {
44 finished := make(chan error, 1)
46 nginxCont := s.getContainerByName("nginx")
47 s.assertNil(nginxCont.run())
49 vpp := s.getContainerByName("vpp").vppInstance
50 vpp.waitForApp("nginx-", 5)
52 serverAddress := s.netInterfaces[tapInterfaceName].peer.ip4AddressString()
54 defer func() { os.Remove(query) }()
55 go startWget(finished, serverAddress, "80", query, "")
56 s.assertNil(<-finished)
59 func runNginxPerf(s *NoTopoSuite, mode, ab_or_wrk string) error {
63 serverAddress := s.netInterfaces[tapInterfaceName].peer.ip4AddressString()
65 vpp := s.getContainerByName("vpp").vppInstance
67 nginxCont := s.getContainerByName("nginx")
68 s.assertNil(nginxCont.run())
69 vpp.waitForApp("nginx-", 5)
71 if ab_or_wrk == "ab" {
72 abCont := s.getContainerByName("ab")
73 args := fmt.Sprintf("-n %d -c %d", nRequests, nClients)
76 } else if mode != "cps" {
77 return fmt.Errorf("invalid mode %s; expected cps/rps", mode)
79 args += " http://" + serverAddress + ":80/64B.json"
80 abCont.extraRunningArgs = args
81 o, err := abCont.combinedOutput()
85 wrkCont := s.getContainerByName("wrk")
86 args := fmt.Sprintf("-c %d -t 2 -d 30 http://%s:80/64B.json", nClients,
88 wrkCont.extraRunningArgs = args
89 o, err := wrkCont.combinedOutput()
96 func (s *NoTopoSuite) TestNginxPerfCps() {
97 s.assertNil(runNginxPerf(s, "cps", "ab"))
100 func (s *NoTopoSuite) TestNginxPerfRps() {
101 s.assertNil(runNginxPerf(s, "rps", "ab"))
104 func (s *NoTopoSuite) TestNginxPerfWrk() {
105 s.assertNil(runNginxPerf(s, "", "wrk"))