blob: b61ea6c8b0dbef169c2fb21f4302dfa59c62aca3 [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 Ondrejickae7625d02023-02-28 16:55:01 +010025 s.setupVolumes()
26 s.setupContainers()
Maros Ondrejickac2f76f42023-02-27 13:22:45 +010027
28 // Setup test conditions
29 var startupConfig Stanza
30 startupConfig.
Maros Ondrejickae7625d02023-02-28 16:55:01 +010031 newStanza("session").
32 append("enable").
33 append("use-app-socket-api").close()
Maros Ondrejickac2f76f42023-02-27 13:22:45 +010034
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()
Maros Ondrejicka85396a52023-02-28 12:49:43 +010048
49 values := struct {
50 Proxy string
51 Server string
52 }{
Maros Ondrejickae7625d02023-02-28 16:55:01 +010053 Proxy: clientInterface.peer.ip4AddressString(),
54 Server: serverInterface.ip4AddressString(),
Maros Ondrejicka85396a52023-02-28 12:49:43 +010055 }
56 nginxContainer.createConfig(
57 "/nginx.conf",
58 "./resources/nginx/nginx_proxy_mirroring.conf",
59 values,
60 )
Maros Ondrejickac2f76f42023-02-27 13:22:45 +010061 nginxContainer.start()
62
Florin Corase2415f72023-02-28 14:51:03 -080063 proxyVpp.waitForApp("nginx-", 5)
Maros Ondrejickac2f76f42023-02-27 13:22:45 +010064}