Maros Ondrejicka | c2f76f4 | 2023-02-27 13:22:45 +0100 | [diff] [blame^] | 1 | package main |
| 2 | |
| 3 | const ( |
| 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 | |
| 12 | type NginxSuite struct { |
| 13 | HstSuite |
| 14 | } |
| 15 | |
| 16 | func (s *NginxSuite) SetupSuite() { |
| 17 | s.loadNetworkTopology("2taps") |
| 18 | |
| 19 | s.loadContainerTopology("nginxProxyAndServer") |
| 20 | } |
| 21 | |
| 22 | func (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 | } |