608d0069d9
Type: test Signed-off-by: Filip Tehlar <ftehlar@cisco.com> Change-Id: Ie90e4b02c268bc3ca40171b03829f5686fb83162
63 lines
1.5 KiB
Go
63 lines
1.5 KiB
Go
package main
|
|
|
|
const (
|
|
// These correspond to names used in yaml config
|
|
mirroringClientInterfaceName = "hst_client"
|
|
mirroringServerInterfaceName = "hst_server"
|
|
vppProxyContainerName = "vpp-proxy"
|
|
nginxProxyContainerName = "nginx-proxy"
|
|
nginxServerContainerName = "nginx-server"
|
|
)
|
|
|
|
type NginxSuite struct {
|
|
HstSuite
|
|
}
|
|
|
|
func (s *NginxSuite) SetupSuite() {
|
|
s.HstSuite.SetupSuite()
|
|
s.loadNetworkTopology("2taps")
|
|
s.loadContainerTopology("nginxProxyAndServer")
|
|
}
|
|
|
|
func (s *NginxSuite) SetupTest() {
|
|
s.HstSuite.SetupTest()
|
|
|
|
// Setup test conditions
|
|
var sessionConfig Stanza
|
|
sessionConfig.
|
|
newStanza("session").
|
|
append("enable").
|
|
append("use-app-socket-api").close()
|
|
|
|
cpus := s.AllocateCpus()
|
|
// ... for proxy
|
|
vppProxyContainer := s.getContainerByName(vppProxyContainerName)
|
|
proxyVpp, _ := vppProxyContainer.newVppInstance(cpus, sessionConfig)
|
|
proxyVpp.start()
|
|
|
|
clientInterface := s.netInterfaces[mirroringClientInterfaceName]
|
|
proxyVpp.createTap(clientInterface, 1)
|
|
|
|
serverInterface := s.netInterfaces[mirroringServerInterfaceName]
|
|
proxyVpp.createTap(serverInterface, 2)
|
|
|
|
nginxContainer := s.getTransientContainerByName(nginxProxyContainerName)
|
|
nginxContainer.create()
|
|
|
|
values := struct {
|
|
Proxy string
|
|
Server string
|
|
}{
|
|
Proxy: clientInterface.peer.ip4AddressString(),
|
|
Server: serverInterface.ip4AddressString(),
|
|
}
|
|
nginxContainer.createConfig(
|
|
"/nginx.conf",
|
|
"./resources/nginx/nginx_proxy_mirroring.conf",
|
|
values,
|
|
)
|
|
nginxContainer.start()
|
|
|
|
proxyVpp.waitForApp("nginx-", 5)
|
|
}
|