blob: d950cf834b549b10fe6167442bc804d85acb2450 [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() {
Maros Ondrejicka7e1d6ef2023-02-28 19:40:09 +010023 s.skipIfUnconfiguring()
24
Maros Ondrejickac2f76f42023-02-27 13:22:45 +010025 s.SetupVolumes()
26 s.SetupContainers()
27
28 // Setup test conditions
29 var startupConfig Stanza
30 startupConfig.
31 NewStanza("session").
32 Append("enable").
33 Append("use-app-socket-api").Close()
34
35 // ... for proxy
36 vppProxyContainer := s.getContainerByName(vppProxyContainerName)
37 proxyVpp, _ := vppProxyContainer.newVppInstance(startupConfig)
38 proxyVpp.start()
39
40 clientInterface := s.netInterfaces[mirroringClientInterfaceName]
41 proxyVpp.createTap(clientInterface, 1)
42
43 serverInterface := s.netInterfaces[mirroringServerInterfaceName]
44 proxyVpp.createTap(serverInterface, 2)
45
46 nginxContainer := s.getTransientContainerByName(nginxProxyContainerName)
47 nginxContainer.create()
48 nginxContainer.copy("./resources/nginx/nginx_proxy_mirroring.conf", "/nginx.conf")
49 nginxContainer.start()
50
51 proxyVpp.waitForApp("-app", 5)
52}