blob: cd67efb6cc50e320e64a9019c280ecb40871c973 [file] [log] [blame]
Maros Ondrejickac2f76f42023-02-27 13:22:45 +01001package main
2
3const (
4 // These correspond to names used in yaml config
5 mirroringClientInterfaceName = "hst_client"
6 mirroringServerInterfaceName = "hst_server"
7 vppProxyContainerName = "vpp-proxy"
8 nginxProxyContainerName = "nginx-proxy"
9 nginxServerContainerName = "nginx-server"
10)
11
12type NginxSuite struct {
13 HstSuite
14}
15
16func (s *NginxSuite) SetupSuite() {
17 s.loadNetworkTopology("2taps")
18
19 s.loadContainerTopology("nginxProxyAndServer")
20}
21
22func (s *NginxSuite) SetupTest() {
23 s.SetupVolumes()
24 s.SetupContainers()
25
26 // Setup test conditions
27 var startupConfig Stanza
28 startupConfig.
29 NewStanza("session").
30 Append("enable").
31 Append("use-app-socket-api").Close()
32
33 // ... for proxy
34 vppProxyContainer := s.getContainerByName(vppProxyContainerName)
35 proxyVpp, _ := vppProxyContainer.newVppInstance(startupConfig)
36 proxyVpp.start()
37
38 clientInterface := s.netInterfaces[mirroringClientInterfaceName]
39 proxyVpp.createTap(clientInterface, 1)
40
41 serverInterface := s.netInterfaces[mirroringServerInterfaceName]
42 proxyVpp.createTap(serverInterface, 2)
43
44 nginxContainer := s.getTransientContainerByName(nginxProxyContainerName)
45 nginxContainer.create()
46 nginxContainer.copy("./resources/nginx/nginx_proxy_mirroring.conf", "/nginx.conf")
47 nginxContainer.start()
48
49 proxyVpp.waitForApp("-app", 5)
50}